Solutions

GeometricSolutions.EnsembleSolutionType

EnsembleSolution: Collection of solutions for an ensemble of geometric differential equations

Contains all fields necessary to store the solutions of an EnsembleProblem, which represents multiple instances of a geometric differential equation with different initial conditions and/or parameters. Each solution in the ensemble is stored as a GeometricSolution.

Fields

  • t: common time series shared across all solutions in the ensemble
  • s: vector of GeometricSolution objects, one for each problem instance
  • problem: the original EnsembleProblem

Type Parameters

  • dType: data type for solution values (e.g., Float64)
  • tType: data type for time values (e.g., Float64)
  • sType: type of the solution vector
  • probType: type of the ensemble problem

Constructor

EnsembleSolution(problem::EnsembleProblem, step::Int = 1)

Creates an EnsembleSolution from an EnsembleProblem. The optional parameter step determines the intervals for storing each solution, i.e., if step > 1 only every step'th solution point is stored for each ensemble member.

Usage

An EnsembleSolution can be iterated over to access individual solutions:

for sol in ensemble_solution
    # sol is a GeometricSolution
    process_solution(sol)
end

Individual solutions can be accessed by index:

first_solution = ensemble_solution[1]
last_solution = ensemble_solution[end]

The number of solutions in the ensemble:

n_solutions = nsamples(ensemble_solution)

Convert all solutions to arrays for analysis:

solution_arrays = arrays(ensemble_solution)

See Also

source
GeometricSolutions.GeometricSolutionType

GeometricSolution: Solution of a geometric differential equation

Contains all fields necessary to store the solution of a GeometricProblem.

Fields

  • t: time steps
  • s: NamedTuple of DataSeries for each solution component
  • step: store every step'th time step (default: 1)
  • nstore: number of time steps to store
  • offset: offset of current time step

Constructors

GeometricSolution(problem, step = 1)

The usual way to initialise a Solution is by passing a GeometricEquations.EquationProblem, which can for example be an GeometricEquations.ODEProblem or GeometricEquations.PODEProblem. The optional parameter step determines the intervals for storing the solution, i.e., if step > 1 only every step'th solution is actually stored.

source
GeometricSolutions.compute_differenceMethod

Computes the difference of two DataSeries.

Arguments: (x::DataSeries{DT}, y::DataSeries{DT})

Returns a DataSeries similar to x and y holding the time series of the difference between x and y.

source
GeometricSolutions.compute_error_driftMethod

Computes the drift in an invariant error.

Arguments: (t::TimeSeries, invariant_error::DataSeries{T,1}, interval_length=100)

The time series of the solution is split into intervals of interval_length time steps. In each interval, the maximum of the absolute value of the invariant error is determined. Returns a tuple of a TimeSeries that holds the centers of all intervals and a ScalarDataSeries that holds the maxima.

This is useful to detect drifts in invariants that are not preserved exactly but whose error is oscillating such as the energy error of Hamiltonian systems with symplectic integrators.

source
GeometricSolutions.compute_invariantMethod

Compute an invariant for the solution of a partitioned ODE or DAE system.

Arguments: (t::TimeSeries, q::DataSeries{T}, p::DataSeries{T}, invariant::Base.Callable)

The invariant functions needs to take three arguments (t,q,p) and return the corresponding value of the invariant.

Returns a ScalarDataSeries holding the time series of the invariant.

source
GeometricSolutions.compute_invariantMethod

Compute an invariant for the solution of an ODE or DAE system.

Arguments: (t::TimeSeries, q::DataSeries{T}, invariant::Base.Callable)

The invariant functions needs to take two arguments (t,q) and return the corresponding value of the invariant.

Returns a ScalarDataSeries holding the time series of the invariant.

source
GeometricSolutions.compute_invariant_errorMethod

Compute the relative error of an invariant for the solution of an ODE or DAE system.

Arguments: (t::TimeSeries, q::DataSeries{T}, invariant::Base.Callable)

The invariant functions needs to take two arguments (t,q) and return the corresponding value of the invariant.

Returns a tuple of two 1d DataSeries holding the time series of the invariant and the relativ error, respectively.

source
GeometricSolutions.compute_invariant_errorMethod

Compute the relative error of an invariant for the solution of a partitioned ODE or DAE system.

Arguments: (t::TimeSeries, q::DataSeries{T}, p::DataSeries{T}, invariant::Base.Callable)

The invariant functions needs to take three arguments (t,q,p) and return the corresponding value of the invariant.

Returns a tuple of two ScalarDataSeries holding the time series of the invariant and the relativ error, respectively.

source
GeometricSolutions.compute_momentum_errorMethod

Computes the difference of the momentum and the one-form of an implicit ODE or DAE system.

Arguments: (sol::GeometricSolution)

The problem type of the solution must be a subtype of IODEProblem, LODEProblem, IDAEProblem, or LDAEProblem.

Returns a DataSeries similar to sol.p holding the time series of the difference between the momentum and the one-form.

source
GeometricSolutions.compute_one_formMethod

Compute the one-form (symplectic potential) for the solution of a Lagrangian system.

Arguments: (sol::GeometricSolution)

The problem type of the solution must be a subtype of IODEProblem, LODEProblem, IDAEProblem, or LDAEProblem.

Returns a DataSeries similar to sol.p holding the time series of the one-form.

source
GeometricSolutions.compute_relative_errorMethod

Takes a ScalarDataSeries holding an invariant and computes the relative error (inv(t)-inv(0))/inv(0).

Returns a ScalarDataSeries similar to the argument holding the time series of the relativ errors.

source
GeometricSolutions.maximum_errorMethod

Computes the maximum absolute error between a solution and a reference.

Arguments: (sol, ref)

Returns maximum(abs.(sol .- ref)), the largest absolute component-wise difference.

source
GeometricSolutions.relative_maximum_errorMethod

Computes the relative maximum error between a solution and a reference.

Arguments: (sol, ref)

Returns maximum_error(sol, ref) / maximum(abs.(ref)), i.e. the maximum absolute error normalized by the maximum absolute value of the reference.

source
GeometricSolutions.relative_maximum_errorMethod

Computes the maximum over time of the relative maximum error between two DataSeries.

Arguments: (ds::DataSeries, ref::DataSeries)

For each time step the relative error maximum_error(ds[i], ref[i]) / maximum(abs.(ref[i])) is evaluated, i.e. each point is normalized by its own maximum absolute value. Returns the maximum of these per-step errors. An all-zero reference point matched exactly has a vanishing point-wise error and therefore contributes 0 rather than 0/0 = NaN.

source
GeometricSolutions.relative_norm_errorFunction

Computes the relative p-norm error between a solution and a reference.

Arguments: (sol, ref, p = 2)

Returns norm(sol .- ref, p) / norm(ref, p), i.e. the p-norm of the difference normalized by the p-norm of the reference.

source
GeometricSolutions.relative_norm_errorFunction

Computes the time trace of the relative p-norm error between two DataSeries.

Arguments: (ds::DataSeries, ref::DataSeries, p = 2)

For each time step the relative error norm(ds[i] - ref[i], p) / norm(ref[i], p) is evaluated. Returns a ScalarDataSeries holding this time series.

source

Solution Steps