Geometric Equation Problems
GeometricEquations.EquationProblem — TypeEquationProblem: stores a GeometricEquation together with initial conditions, parameters, time span and time step size.
Parameters
ST <: GeometricEquation: super type, used for dispatchDT <: Number: data typeTT <: Real: time step typeAT <: AbstractArray{DT}: array type of state variableequType <: GeometricEquation: equation typefunctionsType <: NamedTuple: types of all function methodssolutionsType <: NamedTuple: types of all solution methodsicsType <: NamedTuple: types of all initial conditionsparType <: OptionalParameters: parameters type
Fields
equation: reference to the parent equation object holding the vector fields, etc.functions: methods for all vector fields, etc., that define the problemsolutions: methods for all solutions, etc., if definedtimespan: time span for problem(t₀,t₁)timestep: time step to be used in simulationics:NamedTuplecontaining the initial conditions, must contain one field for each state variableparameters: either aNamedTuplecontaining the equation's parameters orNullParametersindicating that the equation does not have any parameters
Subtypes
The EquationProblem type has various subtypes for the different equations types, that are defined e.g. via
const ODEProblem = EquationProblem{ODE}and provide convenience constructors to construct an equation and the corresponding problem in one step, e.g.,
ODEProblem(v, timespan, timestep, ics::NamedTuple; kwargs...)
ODEProblem(v, timespan, timestep, q₀::StateVariable; kwargs...)All problem subtypes take the following keyword arguments:
invariants = NullInvariants()parameters = NullParameters()periodicity = NullPeriodicity()
If not set to their corresponding Null types, the user needs to pass a NamedTuple whose values are
- functions for invariants,
- arbitrary data structures for parameters,
- the same data structure as the solution for periodicity.
The latter should be zero everywhere, except for those components, that are periodic, i.e., whose value are supposed to stay within a range (0, max). Support for ranges starting with other values than zero is currently missing but can be added if demand arises.
Ordinary Differential Equation Problems
GeometricEquations.ODEProblem — TypeODEProblem: Ordinary Differential Equation Problem
Ordinary differential equations define an initial value problem of the form
\[\dot{q} (t) = v(t, q(t)) ,\]
with vector field $v$.
The dynamical variables $q$ with initial condition $q_{0}$ take values in $\mathbb{R}^{d}$.
Constructors
ODEProblem(v, timespan, timestep, ics::NamedTuple; kwargs...)
ODEProblem(v, timespan, timestep, q₀::StateVariable; kwargs...)
ODEProblem(v, timespan, timestep, q₀::AbstractArray; kwargs...)where v is the function computing the vector field, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entry q of type StateVariable. The initial condition q₀ can also be prescribed directly, as a StateVariable or an AbstractArray{<:Number}.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The function v providing the vector field must have the interface
function v(v, t, q, params)
v[1] = ...
v[2] = ...
...
endwhere t is the current time, q is the current solution vector, v is the vector which holds the result of evaluating the vector field $v$ on t and q, and params is a NamedTuple of additional parameters on which the vector field may depend.
GeometricEquations.PODEProblem — TypePODEProblem: Partitioned Ordinary Differential Equation Problem
A partitioned ordinary differential equation is an initial value problem of the form
\[\begin{aligned} \dot{q} (t) &= v(t, q(t), p(t)) , \\ \dot{p} (t) &= f(t, q(t), p(t)) , \end{aligned}\]
with vector fields $v$ and $f$.
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$.
Constructors
PODEProblem(v, f, timespan, timestep, ics; kwargs...)
PODEProblem(v, f, timespan, timestep, q₀::StateVariable, p₀::StateVariable; kwargs...)
PODEProblem(v, f, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray; kwargs...)where v and f are the function computing the vector fields, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q and p. The initial conditions q₀ and p₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions v and f see PODE.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v and f must have the interface
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f(f, t, q, p, params)
f[1] = ...
f[2] = ...
...
endwhere t is the current time, q and p are the current solution vectors, v and f are the vectors which hold the result of evaluating the vector fields $v$ and $f$ on t, q and p, and params is a NamedTuple of additional parameters.
GeometricEquations.HODEProblem — TypeHODEProblem: Hamiltonian Ordinary Differential Equation Problem
A canonical Hamiltonian system of equations is special case of a partitioned ordinary differential equation,
\[\begin{aligned} \dot{q} (t) &= v(t, q(t), p(t)) , \\ \dot{p} (t) &= f(t, q(t), p(t)) , \end{aligned}\]
with vector fields $v$ and $f$, given by
\[\begin{aligned} v &= \frac{\partial H}{\partial p} , & f &= - \frac{\partial H}{\partial q} . \end{aligned}\]
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $T^{*} Q \simeq \mathbb{R}^{d} \times \mathbb{R}^{d}$.
Constructors
HODEProblem(v, f, hamiltonian, timespan, timestep, ics; kwargs...)
HODEProblem(v, f, hamiltonian, timespan, timestep, q₀::StateVariable, p₀::StateVariable; kwargs...)
HODEProblem(v, f, hamiltonian, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray; kwargs...)where v and f are the function computing the vector fields, hamiltonian returns the value of the Hamiltonian (i.e. the total energy), timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q and p. The initial conditions q₀ and p₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions v, f and hamiltonian see HODE.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v, f and hamiltonian must have the interface
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f(f, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function hamiltonian(t, q, p, params)
return ...
endwhere t is the current time, q and p are the current solution vectors, v and f are the vectors which hold the result of evaluating the vector fields on t, q and p, and params is a NamedTuple of additional parameters.
GeometricEquations.IODEProblem — TypeIODEProblem: Implicit Ordinary Differential Equation Problem
An implicit ordinary differential equations is an initial value problem of the form
\[\begin{aligned} \dot{q} (t) &= v(t) , \\ \dot{p} (t) &= f(t, q(t), v(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \end{aligned}\]
with force field $f$, the momentum defined by $p$. This is a special case of a differential algebraic equation with dynamical variables $(q,p)$ and algebraic variable $v$, that is determined such that the constraint $p(t) = ϑ(t, q(t), v(t))$ is satisfied.
Many integrators perform a projection step in order to enforce this constraint. To this end, the system is extended to
\[\begin{aligned} \dot{q} (t) &= v(t) + λ(t) , \\ \dot{p} (t) &= f(t, q(t), v(t)) + g(t, q(t), v(t), λ(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \end{aligned}\]
where the vector field defining the projection step is usually given as
\[\begin{aligned} g(t, q(t), v(t), λ(t)) &= λ(t) \cdot \nabla ϑ(t, q(t), v(t)) . \end{aligned}\]
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variable $v$ with initial condition $v(t_{0}) = v_{0}$ takes values in $\mathbb{R}^{d}$.
Constructors
IODEProblem(ϑ, f, timespan, timestep, ics; kwargs...)
IODEProblem(ϑ, f, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)
IODEProblem(ϑ, f, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)
IODEProblem(ϑ, f, g, timespan, timestep, ics; kwargs...)
IODEProblem(ϑ, f, g, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)
IODEProblem(ϑ, f, g, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)The functions ϑ, f and g compute the momentum and the vector fields, respectively.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q, p and λ. The initial conditions q₀ and p₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions ϑ, f and g see IODE.
In addition to the standard keyword arguments for EquationProblem subtypes, an IODEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = _iode_default_v̄ and f̄ = f.
Initial conditions have to be prescribed for (q,p). If instead initial conditions are available only for (q,v), the function ϑ can be called to compute the corresponding initial value of p.
GeometricEquations.LODEProblem — TypeLODEProblem: Lagrangian Ordinary Differential Equation Problem
A Lagrangian system of equations is a special case of an implicit ordinary differential equations, that is an implicit initial value problem of the form
\[\begin{aligned} \dot{q} (t) &= v(t) , \\ \dot{p} (t) &= f(t, q(t), v(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \end{aligned}\]
with momentum $p$ and force field $f$, given by
\[\begin{aligned} p &= \frac{\partial L}{\partial v} , & f &= \frac{\partial L}{\partial q} . \end{aligned}\]
This is a special case of an implicit ordinary differential equation, that is defined by a Lagrangian, as well as a special case of a differential algebraic equation with dynamical variables $(q,p)$ and algebraic variable $v$, that is determined such that the constraint $p(t) = ϑ(t, q(t), v(t))$ is satisfied.
Many integrators perform a projection step in order to enforce this constraint. To this end, the system is extended to
\[\begin{aligned} \dot{q} (t) &= v(t) + \lambda(t) , \\ \dot{p} (t) &= f(t, q(t), v(t)) + g(t, q(t), v(t), \lambda(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \end{aligned}\]
where the vector field defining the projection step is usually given as
\[\begin{aligned} g(t, q(t), v(t), λ(t)) &= λ(t) \cdot \nabla ϑ(t, q(t), v(t)) . \end{aligned}\]
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $T^{*} Q \simeq \mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variable $λ$ with initial condition $λ(t_{0}) = λ_{0}$ takes values in $\mathbb{R}^{m}$.
Constructors
LODEProblem(ϑ, f, ω, l, timespan, timestep, ics; kwargs...)
LODEProblem(ϑ, f, ω, l, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)
LODEProblem(ϑ, f, ω, l, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)
LODEProblem(ϑ, f, g, ω, l, timespan, timestep, ics; kwargs...)
LODEProblem(ϑ, f, g, ω, l, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::AlgebraicVariable; kwargs...)
LODEProblem(ϑ, f, g, ω, l, timespan, timestep, q₀::AbstractArray, p₀::AbstractArray, λ₀::AbstractArray = zero(q₀); kwargs...)where ϑ, f and g are the functions computing the momentum and the vector fields, respectively, ω determines the symplectic matrix, and l returns the Lagrangian, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q, p and λ. The initial conditions q₀, p₀ and λ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}, where λ₀ can also be omitted. For the interfaces of the functions ϑ, f, g, ω and l see LODE.
In addition to the standard keyword arguments for EquationProblem subtypes, a LODEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = _lode_default_v̄ and f̄ = f.
GeometricEquations.SODEProblem — TypeSODEProblem: Split Ordinary Differential Equation Problem
Defines an initial value problem
\[\dot{q} (t) = v(t, q(t)) , \qquad q(t_{0}) = q_{0} ,\]
with vector field $v$, initial condition $q_{0}$ and the solution $q$ taking values in $\mathbb{R}^{d}$. Here, the vector field $v$ is given as a sum of vector fields
\[v (t) = v_1 (t) + ... + v_r (t) .\]
The dynamical variables $q$ with initial condition $q_{0}$ take values in $\mathbb{R}^{d}$.
Constructors
SODEProblem(v, q, timespan, timestep, ics::NamedTuple; kwargs...)
SODEProblem(v, q, timespan, timestep, q₀::StateVariable; kwargs...)
SODEProblem(v, q, timespan, timestep, q₀::AbstractArray; kwargs...)
SODEProblem(v, timespan, timestep, ics::NamedTuple; kwargs...)
SODEProblem(v, timespan, timestep, q₀::StateVariable; kwargs...)
SODEProblem(v, timespan, timestep, q₀::AbstractArray; kwargs...)where v is a tuple of functions computing the vector fields for each substep, q is an optional tuple of functions computing the solution for each substep, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entry q. The initial condition q₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v_i providing the vector field must have the interface
function v_i(v, t, q, params)
v[1] = ...
v[2] = ...
...
endand the functions q_i providing the solutions must have the interface
function q_i(q₁, t₁, q₀, t₀, params)
q₁[1] = q₀[1] + ...
q₁[2] = q₀[2] + ...
...
endwhere t₀ is the current time, q₀ is the current solution vector, q₁ is the new solution vector at time t₁, holding the result of computing one substep
The fact that the function v returns the solution and not just the vector field for each substep increases the flexibility for the use of splitting methods, e.g., it allows to use another integrator for solving substeps. with the vector field $v_i$.
Differential Algebraic Equation Problems
GeometricEquations.DAEProblem — TypeDAEProblem: Differential Algebraic Equation Problem
Defines a differential algebraic initial value problem
\[\begin{aligned} \dot{q} (t) &= v(t, q(t)) + u(t, q(t), \lambda(t)) , \\ 0 &= \phi (t, q(t)) , \end{aligned}\]
with vector field $v$, projection $u$, algebraic constraint $\phi=0$.
Some integrators also enforce the secondary constraint $\psi$, that is the time derivative of the algebraic constraint $\phi$. In this case, the system of equations is modified as follows
\[\begin{aligned} \dot{q} (t) &= v(t, q(t)) + u(t, q(t), \lambda(t)) + \bar{u} (t, q(t), \dot{q} (t), \dot{p} (t), \mu(t)) , \\ 0 &= \phi (t, q(t)) , \\ 0 &= \psi (t, q(t), \dot{q} (t)) . \end{aligned}\]
The dynamical variable $q$ with initial conditions $q(t_{0}) = q_{0}$ takes values in $\mathbb{R}^{d}$. The algebraic variables $(λ,μ)$ with initial condition $(λ(t_{0}) = λ_{0}, μ(t_{0}) = μ_{0})$ take values in $\mathbb{R}^{m} \times \mathbb{R}^{m}$.
Constructors
DAEProblem(v, u, ϕ, ū, ψ, timespan, timestep, ics::NamedTuple; kwargs...)
DAEProblem(v, u, ϕ, ū, ψ, timespan, timestep, q₀::StateVariable, λ₀::StateVariable, μ₀::StateVariable = zero(λ₀); kwargs...)
DAEProblem(v, u, ϕ, timespan, timestep, ics::NamedTuple; kwargs...)
DAEProblem(v, u, ϕ, timespan, timestep, q₀::StateVariable, λ₀::StateVariable; kwargs...)The functions v and u compute the vector field and the projection, respectively, ϕ provides the algebraic constraint. The functions ψ and ū are optional and provide the secondary constraint, that is the time derivative of the algebraic constraint, and the corresponding projection.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q, λ and μ. The initial conditions q₀, λ₀ and μ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions v, u, ϕ, ū, ψ see DAE.
In addition to the standard keyword arguments for EquationProblem subtypes, a DAEProblem accepts a function v̄ for the computation of an initial guess for the vector field with default value v̄ = v.
Function Definitions
The functions v, u and ϕ must have the interface
function v(v, t, q, params)
v[1] = ...
v[2] = ...
...
end
function u(u, t, q, λ, params)
u[1] = ...
u[2] = ...
...
end
function ϕ(ϕ, t, q, params)
ϕ[1] = ...
endwhere t is the current time, q and λ are the current solution vectors, and v, u and ϕ are the vectors which hold the result of evaluating the vector field $v$, the projection $u$ and the algebraic constraint $\phi$ on t, q and λ.
Some integrators also enforce the secondary constraint $\psi$ and require the following additional functions
function ū(u, t, q, μ, params)
u[1] = ...
u[2] = ...
...
end
function ψ(ψ, t, q, v, params)
ψ[1] = ...
endWith the above function definitions the DAEProblem can be created by
timespan = (0.0, 1.0)
timestep = 0.1
q₀ = [1., 1.]
λ₀ = [0.]
μ₀ = [0.]
prob = DAEProblem(v, u, ϕ, timespan, timestep, q₀, λ₀)or
prob = DAEProblem(v, u, ϕ, ū, ψ, timespan, timestep, q₀, λ₀, μ₀)GeometricEquations.PDAEProblem — TypePDAEProblem: Partitioned Differential Algebraic Equation Problem
A partitioned differential algebraic equation has the form
\[\begin{aligned} \dot{q} (t) &= v(t, q(t), p(t)) + u(t, q(t), p(t), \lambda(t)) , \\ \dot{p} (t) &= f(t, q(t), p(t)) + g(t, q(t), p(t), \lambda(t)) , \\ 0 &= \phi (t, q(t), p(t)) , \end{aligned}\]
with vector fields $v$ and $f$, projection $u$ and $g$, algebraic constraint $\phi=0$.
Some integrators also enforce the secondary constraint $\psi$, that is the time derivative of the algebraic constraint $\phi$. In this case, the system of equations is modified as follows
\[\begin{aligned} \dot{q} (t) &= v(t, q(t), p(t)) + u(t, q(t), p(t), \lambda(t)) + \bar{u} (t, q(t), p(t), \mu(t)) , \\ \dot{p} (t) &= f(t, q(t), p(t)) + g(t, q(t), p(t), \lambda(t)) + \bar{g} (t, q(t), p(t), \mu(t)) , \\ 0 &= \phi (t, q(t), p(t)) , \\ 0 &= \psi (t, q(t), p(t), \dot{q} (t), \dot{p} (t)) . \end{aligned}\]
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variables $(λ,μ)$ with initial condition $(λ(t_{0}) = λ_{0}, μ(t_{0}) = μ_{0})$ take values in $\mathbb{R}^{m} \times \mathbb{R}^{m}$.
Constructors
PDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, timespan, timestep, ics::NamedTuple; kwargs...)
PDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable, μ₀::StateVariable = zero(λ₀); kwargs...)
PDAEProblem(v, f, u, g, ϕ, timespan, timestep, ics::NamedTuple; kwargs...)
PDAEProblem(v, f, u, g, ϕ, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable; kwargs...)The functions v and f compute the vector field, u and g compute the projections, and ϕ provides the algebraic constraint. The functions ψ, ū and ḡ are optional and provide the secondary constraint and the corresponding projection.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q, p, λ and μ. The initial conditions q₀, p₀, λ₀ and μ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions v, f, u, g, ϕ, ū, ḡ, ψ see PDAE.
In addition to the standard keyword arguments for EquationProblem subtypes, a PDAEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = v and f̄ = f.
Function Definitions
The functions v, f, u, g and ϕ must have the interface
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f(g, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function u(u, t, q, p, λ, params)
u[1] = ...
u[2] = ...
...
end
function g(g, t, q, p, λ, params)
g[1] = ...
g[2] = ...
...
end
function ϕ(ϕ, t, q, p, params)
ϕ[1] = ...
endwhere t is the current time, q, p and λ are the current solution vectors, v, f, u and g are the vectors which hold the result of evaluating the vector fields $v$ and $f$, the projections $u$ and $g$, and ϕ holds the algebraic constraint $\phi$, evaluated on t, q, p and λ.
Some integrators also enforce the secondary constraint $\psi$ and require the following additional functions
function ū(u, t, q, p, μ, params)
u[1] = ...
u[2] = ...
...
end
function ḡ(g, t, q, p, μ, params)
g[1] = ...
g[2] = ...
...
end
function ψ(ψ, t, q, p, v, f, params)
ψ[1] = ...
endWith the above function definitions the PDAEProblem can be created by
timespan = (0.0, 1.0)
timestep = 0.1
q₀ = [1., 1.]
p₀ = [1., 0.]
λ₀ = [0.]
μ₀ = [0.]
prob = PDAEProblem(v, f, u, g, ϕ, timespan, timestep, q₀, p₀, λ₀)or
prob = PDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, timespan, timestep, q₀, p₀, λ₀, μ₀)GeometricEquations.HDAEProblem — TypeHDAEProblem: Hamiltonian Differential Algebraic Equation
A Hamiltonian differential algebraic is an initial value problem, that is a canonical Hamiltonian system of equations subject to Dirac constraints,
\[\begin{aligned} \dot{q} (t) &= v(t, q(t), p(t)) + u(t, q(t), p(t), \lambda(t)) + \bar{u} (t, q(t), p(t), \mu(t)) , \\ \dot{p} (t) &= f(t, q(t), p(t)) + g(t, q(t), p(t), \lambda(t)) + \bar{g} (t, q(t), p(t), \mu(t)) , \\ 0 &= \phi (t, q(t), p(t)) , \\ 0 &= \psi (t, q(t), p(t), \dot{q}(t), \dot{p}(t)) , \end{aligned}\]
with vector fields $v$, $u$, $\bar{u}$ and $f$, $g$, $\bar{g}$, primary constraint $\phi(q,p)=0$ and secondary constraint $\psi(q,p,\dot{q},\dot{p})=0$.
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variables $(λ,μ)$ with initial condition $(λ(t_{0}) = λ_{0}, μ(t_{0}) = μ_{0})$ take values in $\mathbb{R}^{m} \times \mathbb{R}^{m}$.
Constructors
HDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, h, timespan, timestep, ics::NamedTuple; kwargs...)
HDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, h, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable, μ₀::StateVariable = zero(λ₀); kwargs...)
HDAEProblem(v, f, u, g, ϕ, h, timespan, timestep, ics::NamedTuple; kwargs...)
HDAEProblem(v, f, u, g, ϕ, h, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable; kwargs...)The functions v and f compute the vector field, u and g compute the projections, ϕ provides the algebraic constraint and h the Hamiltonian. The functions ψ, ū and ḡ are optional and provide the secondary constraint, that is the time derivative of the algebraic constraint, and the corresponding projection.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q, p, λ and μ. The initial conditions q₀, p₀, λ₀ and μ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions v, f, u, g, ϕ, ū, ḡ, ψ, and h see HDAE.
In addition to the standard keyword arguments for EquationProblem subtypes, a HDAEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = v and f̄ = f.
Function Definitions
The functions v, f, u, g, ϕ and h must have the interface
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f(g, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function u(u, t, q, p, λ, params)
u[1] = ...
u[2] = ...
...
end
function g(g, t, q, p, λ, params)
g[1] = ...
g[2] = ...
...
end
function ϕ(ϕ, t, q, p, params)
ϕ[1] = ...
end
function h(t, q, p, params)
...
endwhere t is the current time, q, p, λ and μ are the current solution vectors, v, f, u and g are the vectors which hold the result of evaluating the vector fields $v$ and $f$, the projections on the primary constraint $u$ and $g$, ϕ holds the algebraic constraint $\phi$, and h returns the Hamiltonian of the system, all evaluated on t, q, p and λ.
Some integrators also enforce the secondary constraint $\psi$ and require the following additional functions
function ū(u, t, q, p, μ, params)
u[1] = ...
u[2] = ...
...
end
function ḡ(g, t, q, p, μ, params)
g[1] = ...
g[2] = ...
...
end
function ψ(ψ, t, q, p, v, f, params)
ψ[1] = ...
endWith the above function definitions the HDAEProblem can be created by
timespan = (0.0, 1.0)
timestep = 0.1
q₀ = [1., 1.]
p₀ = [1., 0.]
λ₀ = [0.]
μ₀ = [0.]
prob = HDAEProblem(v, f, u, g, ϕ, h, timespan, timestep, q₀, p₀, λ₀)or
prob = HDAEProblem(v, f, u, g, ϕ, ū, ḡ, ψ, h, timespan, timestep, q₀, p₀, λ₀, μ₀)GeometricEquations.IDAEProblem — TypeIDAEProblem: Implicit Differential Algebraic Equation Problem
An implicit differential algebraic initial value problem takes the form
\[\begin{aligned} \dot{q} (t) &= v(t) + u(t, q(t), v(t), p(t), \lambda(t)) , \\ \dot{p} (t) &= f(t, q(t), v(t)) + g(t, q(t), v(t), p(t), \lambda(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \\ 0 &= \phi (t, q(t), v(t), p(t)) , \end{aligned}\]
with force field $f$, the momentum defined by $ϑ$, projections $u$ and $g$, algebraic constraint $\phi(t,q,v,p)=0$.
Some integrators also enforce the secondary constraint $\psi$, that is the time derivative of the algebraic constraint $\phi$. In this case, the system of equations is modified as follows
\[\begin{aligned} \dot{q} (t) &= v(t) + u(t, q(t), v(t), p(t), \lambda(t)) + \bar{u} (t, q(t), v(t), p(t), \mu(t)) , \\ \dot{p} (t) &= f(t, q(t), v(t)) + g(t, q(t), v(t), p(t), \lambda(t)) + \bar{g} (t, q(t), v(t), p(t), \mu(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , && \\ 0 &= \phi (t, q(t), v(t), p(t)) , \\ 0 &= \psi (t, q(t), v(t), p(t), \dot{q} (t), \dot{p} (t)) . \end{aligned}\]
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variables $(λ,μ)$ with initial condition $(λ(t_{0}) = λ_{0}, μ(t_{0}) = μ_{0})$ take values in $\mathbb{R}^{m} \times \mathbb{R}^{m}$.
Constructors
IDAEProblem(ϑ, f, u, g, ϕ, ū, ḡ, ψ, timespan, timestep, ics; kwargs...)
IDAEProblem(ϑ, f, u, g, ϕ, ū, ḡ, ψ, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀), μ₀::StateVariable = zero(λ₀); kwargs...)
IDAEProblem(ϑ, f, u, g, ϕ, timespan, timestep, ics; kwargs...)
IDAEProblem(ϑ, f, u, g, ϕ, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀); kwargs...)The function ϑ computes the momentum, f computes the force field, u and g compute the projections, and ϕ provides the algebraic constraint. The functions ψ, ū and ḡ are optional and provide the secondary constraint, that is the time derivative of the algebraic constraint, and the corresponding projection.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q and p. The initial conditions q₀, p₀, λ₀ and μ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions ϑ, f, u, g, ϕ, ū, ḡ, ψ see IDAE.
In addition to the standard keyword arguments for EquationProblem subtypes, an IDAEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = _idae_default_v̄ and f̄ = f.
Function Definitions
The functions ϑ and f must have the interface
function ϑ(p, t, q, v, params)
p[1] = ...
p[2] = ...
...
end
function f(f, t, q, v, params)
f[1] = ...
f[2] = ...
...
endwhere t is the current time, q is the current solution vector, v is the current velocity and f and p are the vectors which hold the result of evaluating the functions $f$ and $ϑ$ on t, q and v. The funtions g, v̄ and f̄ are specified by
function u(u, t, q, v, p, λ, params)
u[1] = ...
u[2] = ...
...
end
function g(g, t, q, v, p, λ, params)
g[1] = ...
g[2] = ...
...
end
function v̄(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f̄(f, t, q, v, params)
f[1] = ...
f[2] = ...
...
endSome integrators also enforce the secondary constraint $\psi$ and require the following additional functions
function ū(u, t, q, v, p, μ, params)
u[1] = ...
u[2] = ...
...
end
function ḡ(g, t, q, v, p, μ, params)
g[1] = ...
g[2] = ...
...
end
function ψ(ψ, t, q, v, p, q̇, ṗ, params)
ψ[1] = ...
endGeometricEquations.LDAEProblem — TypeLDAEProblem: Lagrangian Differential Algebraic Equation Problem
A special case of an implicit initial value problem is a Lagrangian differential algebraic equation of the form
\[\begin{aligned} \dot{q} (t) &= v(t) + u(t, q(t), v(t), p(t), \lambda(t)) + \bar{u} (t, q(t), v(t), p(t), \mu(t)) , \\ \dot{p} (t) &= f(t, q(t), v(t)) + g(t, q(t), v(t), p(t), \lambda(t)) + \bar{g} (t, q(t), v(t), p(t), \mu(t)) , \\ p(t) &= ϑ(t, q(t), v(t)) , \\ 0 &= \phi (t, q(t), v(t), p(t)) , \\ 0 &= \psi (t, q(t), v(t), p(t), \dot{q}(t), \dot{p}(t)) , \end{aligned}\]
with momentum $p$ and force field $f$, given by
\[\begin{aligned} p &= \frac{\partial L}{\partial v} (q,v) , & f &= \frac{\partial L}{\partial q} (q,v) , \end{aligned}\]
projection fields $u$, $\bar{u}$ and $g$, $\bar{g}$. This is a special case of a differential algebraic equation with dynamical variables $(q,p)$ and algebraic variables $v$, $\lambda$ and $\mu$.
The dynamical variables $(q,p)$ with initial conditions $(q(t_{0}) = q_{0}, p(t_{0}) = p_{0})$ take values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$. The algebraic variables $(λ,μ)$ with initial condition $(λ(t_{0}) = λ_{0}, μ(t_{0}) = μ_{0})$ take values in $\mathbb{R}^{m} \times \mathbb{R}^{m}$.
Constructors
LDAEProblem(ϑ, f, u, g, ϕ, ū, ḡ, ψ, ω, l, timespan, timestep, ics; kwargs...)
LDAEProblem(ϑ, f, u, g, ϕ, ū, ḡ, ψ, ω, l, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀), μ₀::StateVariable = zero(λ₀); kwargs...)
LDAEProblem(ϑ, f, u, g, ϕ, ω, l, timespan, timestep, ics; kwargs...)
LDAEProblem(ϑ, f, u, g, ϕ, ω, l, timespan, timestep, q₀::StateVariable, p₀::StateVariable, λ₀::StateVariable = zero(q₀); kwargs...)The function ϑ computes the momentum, f computes the force field, u and g compute the projections, and ϕ provides the algebraic constraint. The functions ψ, ū and ḡ are optional and provide the secondary constraint, that is the time derivative of the algebraic constraint, and the corresponding projection.
timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entries q and p. The initial conditions q₀, p₀, λ₀ and μ₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}. For the interfaces of the functions ϑ, f, u, g, ϕ, ū, ḡ, ψ, ω and l see LDAE.
In addition to the standard keyword arguments for EquationProblem subtypes, a LDAEProblem accepts functions v̄ and f̄ for the computation of initial guesses for the vector fields with default values v̄ = _ldae_default_v̄ and f̄ = f.
Function Definitions
The functions ϑ and f must have the interface
function ϑ(p, t, q, v, params)
p[1] = ...
p[2] = ...
...
end
function f(f, t, q, v, params)
f[1] = ...
f[2] = ...
...
endwhere t is the current time, q is the current solution vector, v is the current velocity and f and p are the vectors which hold the result of evaluating the functions $f$ and $ϑ$ on t, q and v. The funtions g, v̄ and f̄ are specified by
function u(u, t, q, v, p, μ, params)
u[1] = ...
u[2] = ...
...
end
function g(g, t, q, v, p, μ, params)
g[1] = ...
g[2] = ...
...
end
function v̄(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f̄(f, t, q, v, params)
f[1] = ...
f[2] = ...
...
endand the functions ω and l, computing the symplectic matrix and the Lagrangian, have the following signature
function ω(f, t, q, v, params)
ω[1,1] = ...
ω[1,2] = ...
...
end
function l(t, q, v, params)
return ...
endSome integrators also enforce the secondary constraint $\psi$ and require the following additional functions
function ū(u, t, q, v, p, μ, params)
u[1] = ...
u[2] = ...
...
end
function ḡ(g, t, q, v, p, μ, params)
g[1] = ...
g[2] = ...
...
end
function ψ(ψ, t, q, v, p, q̇, ṗ, params)
ψ[1] = ...
endWith the above function definitions the LDAEProblem can be created by
timespan = (0.0, 1.0)
timestep = 0.1
q₀ = [1., 1.]
p₀ = [1., 0.]
λ₀ = [0.]
μ₀ = [0.]
prob = LDAEProblem(ϑ, f, u, g, ϕ, ω, l, timespan, timestep, q₀, p₀, λ₀)or
prob = LDAEProblem(ϑ, f, u, g, ϕ, ū, ḡ, ψ, ω, l, timespan, timestep, q₀, p₀, λ₀, μ₀)Stochastic Differential Equation Problems
GeometricEquations.SDEProblem — TypeSDEProblem: Stratonovich Stochastic Differential Equation Problem
Defines a stochastic differential initial value problem
\[\begin{aligned} dq (t) &= v(t, q(t)) \, dt + B(t, q(t)) \circ dW , & q(t_{0}) &= q_{0} , \end{aligned}\]
with drift vector field $v$, diffusion matrix $B$, initial conditions $q_{0}$, the dynamical variable $q$ taking values in $\mathbb{R}^{d}$, and the m-dimensional Wiener process W
Constructors
SDEProblem(v, B, timespan, timestep, ics::NamedTuple; kwargs...)
SDEProblem(v, B, timespan, timestep, q₀::StateVariable; kwargs...)where v is the function computing the vector field and B computes the diffusion matrix timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entry q. The initial condition q₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v and B, providing the drift vector field and diffusion matrix. The function v must have the interface
function v(v, t, q, params)
v[1] = ...
v[2] = ...
...
endwhere t is the current time, q is the current solution vector, v is the vector which holds the result of evaluating the vector field $v$ on t and q, and params are additional parameters. The function B should have a method with interface
function B(B, t, q, params)
B[1,1] = ...
...
endGeometricEquations.PSDEProblem — TypePSDEProblem: Stratonovich Partitioned Stochastic Differential Equation Problem
A partitioned stochastic differential equations is an initial value problem of the form
\[\begin{aligned} dq (t) &= v(t, q(t), p(t)) \, dt + B(t, q(t), p(t)) \circ dW , & q(t_{0}) &= q_{0} , \\ dp (t) &= f(t, q(t), p(t)) \, dt + G(t, q(t), p(t)) \circ dW , & p(t_{0}) &= p_{0} \end{aligned}\]
with the drift vector fields $v$ and $f$, diffusion matrices $B$ and $G$, initial conditions $q_{0}$ and $p_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$, and the m-dimensional Wiener process W
Constructors
PSDEProblem(v, f, B, G, timespan, timestep, ics::NamedTuple; kwargs...)
PSDEProblem(v, f, B, G, timespan, timestep, q₀::StateVariable; p₀::StateVariable; kwargs...)where v and f are the functions computing the vector field and B and G compute the diffusion matrices, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entry q. The initial condition q₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v, f, B and G, providing the drift vector fields and diffusion matrices, each take five arguments, v(v, t, q, p, params), f(f, t, q, p, params), B(B, t, q, p, params) and G(G, t, q, p, params), where t is the current time, (q, p) is the current solution, and v, f, B and G are the variables which hold the result of evaluating the vector fields $v$, $f$ and the matrices $B$, $G$ on t and (q,p), and params are optional parameters.
The corresponding methods should have the following signatures:
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f(f, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function B(B, t, q, p, params)
B[1,1] = ...
...
end
function G(G, t, q, p, params)
G[1,1] = ...
...
endGeometricEquations.SPSDEProblem — TypeSPSDEProblem: Stratonovich Split Partitioned Stochastic Differential Equation Problem
Defines a partitioned stochastic differential initial value problem
\[\begin{aligned} dq (t) &= v(t, q(t), p(t)) \, dt + B(t, q(t), p(t)) \circ dW , & q(t_{0}) &= q_{0} , \\ dp (t) &= [ f_1(t, q(t), p(t)) + f_2(t, q(t), p(t)) ] \, dt + [ G_1(t, q(t), p(t)) + G_2(t, q(t), p(t)) ] \circ dW , & p(t_{0}) &= p_{0} , \end{aligned}\]
with the drift vector fields $v$ and $f_i$, diffusion matrices $B$ and $G_i$, initial conditions $q_{0}$ and $p_{0}$, the dynamical variables $(q,p)$ taking values in $\mathbb{R}^{d} \times \mathbb{R}^{d}$, and the m-dimensional Wiener process W
Constructors
SPSDEProblem(v, f1, f2, B, G1, G2, timespan, timestep, ics::NamedTuple; kwargs...)
SPSDEProblem(v, f1, f2, B, G1, G2, timespan, timestep, q₀::StateVariable; p₀::StateVariable; kwargs...)where v and f are the functions computing the vector field and Bᵢ and Gᵢ compute the diffusion matrices, timespan is the time interval (t₀,t₁) for the problem to be solved in, timestep is the time step to be used in the simulation, and ics is a NamedTuple with entry q. The initial condition q₀ can also be prescribed directly, with StateVariable an AbstractArray{<:Number}.
For possible keyword arguments see the documentation on EquationProblem subtypes.
Function Definitions
The functions v, f1, f2, B, G1 and G2, providing the drift vector fields and diffusion matrices, all take five arguments, (out, t, q, p, params).
function v(v, t, q, p, params)
v[1] = ...
v[2] = ...
...
end
function f1(f, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function f2(f, t, q, p, params)
f[1] = ...
f[2] = ...
...
end
function B(B, t, q, p, params)
B[1,1] = ...
...
end
function G1(G, t, q, p, params)
G[1,1] = ...
...
end
function G2(G, t, q, p, params)
G[1,1] = ...
...
endwhere t is the current time, (q,p) is the current solution vector, and v, f, B and G are the variables which hold the result of evaluating the vector fields $v$, $f$ and the matrices $B_i$, $G_i$ on (t,q,p).