Boundary Value Problems
The Five Types of Boundary Value Problems
BoundaryValueDiffEq.jl tackles five related types of boundary value problems:
- General boundary value problems:, i.e., constraints are applied over the time span. Both overconstraints and underconstraints BVP are supported.
- Two-point boundary value problems:, i.e., constraints are only applied at start and end of time span. Both overconstraints and underconstraints BVP are supported.
- General second order boundary value problems, i.e., constraints for both solution and derivative of solution are applied over time span. Both overconstraints and underconstraints second order BVP are supported.
- Second order two-point boundary value problems, i.e., constraints for both solution and derivative of solution are only applied at the start and end of the time span. Both overconstraints and underconstraints second order BVP are supported.
- Boundary value differential algebraic equations, i.e., apart from constraints applied over the time span, BVDAE has additional algebraic equations which state the algebraic relationship of different states in BVDAE.
Problem Construction Details
SciMLBase.BVProblem
— TypeDefines an BVP problem. Documentation Page: https://docs.sciml.ai/DiffEqDocs/stable/types/bvp_types/
Mathematical Specification of a BVP Problem
To define a BVP Problem, you simply need to give the function $f$ and the initial condition $u_0$ which define an ODE:
\[\frac{du}{dt} = f(u,p,t)\]
along with an implicit function bc
which defines the residual equation, where
\[bc(u,p,t) = 0\]
is the manifold on which the solution must live. A common form for this is the two-point BVProblem
where the manifold defines the solution at two points:
\[u(t_0) = a u(t_f) = b\]
Problem Type
Constructors
TwoPointBVProblem{isinplace}(f, bc, u0, tspan, p=NullParameters(); kwargs...)
BVProblem{isinplace}(f, bc, u0, tspan, p=NullParameters(); kwargs...)
or if we have an initial guess function initialGuess(p, t)
for the given BVP, we can pass the initial guess to the problem constructors:
TwoPointBVProblem{isinplace}(f, bc, initialGuess, tspan, p=NullParameters(); kwargs...)
BVProblem{isinplace}(f, bc, initialGuess, tspan, p=NullParameters(); kwargs...)
For any BVP problem type, bc
must be inplace if f
is inplace. Otherwise it must be out-of-place.
If the bvp is a StandardBVProblem (also known as a Multi-Point BV Problem) it must define either of the following functions
bc!(residual, u, p, t)
residual = bc(u, p, t)
where residual
computed from the current u
. u
is an array of solution values where u[i]
is at time t[i]
, while p
are the parameters. For a TwoPointBVProblem
, t = tspan
. For the more general BVProblem
, u
can be all of the internal time points, and for shooting type methods u=sol
the ODE solution. Note that all features of the ODESolution
are present in this form. In both cases, the size of the residual matches the size of the initial condition.
If the bvp is a TwoPointBVProblem then bc
must be a Tuple (bca, bcb)
and each of them must define either of the following functions:
begin
bca!(resid_a, u_a, p)
bcb!(resid_b, u_b, p)
end
begin
resid_a = bca(u_a, p)
resid_b = bcb(u_b, p)
end
where resid_a
and resid_b
are the residuals at the two endpoints, u_a
and u_b
are the solution values at the two endpoints, and p
are the parameters.
Parameters are optional, and if not given, then a NullParameters()
singleton will be used which will throw nice errors if you try to index non-existent parameters. Any extra keyword arguments are passed on to the solvers. For example, if you set a callback
in the problem, then that callback
will be added in every solve call.
Fields
f
: The function for the ODE.bc
: The boundary condition function.u0
: The initial condition. Either the initial condition for the ODE as an initial value problem, or aVector
of values for $u(t_i)$ for collocation methods.tspan
: The timespan for the problem.p
: The parameters for the problem. Defaults toNullParameters
kwargs
: The keyword arguments passed onto the solves.
Special Keyword Arguments
nlls
: Specify that the BVP is a nonlinear least squares problem. UseVal(true)
orVal(false)
for type stability. By default this is automatically inferred based on the size of the input and outputs, however this is type unstable for any array type that doesn't store array size as part of type information. If we can't reliably infer this, we set it toNothing
. Downstreams solvers must be setup to deal with this case.
SciMLBase.TwoPointBVProblem
— Typestruct TwoPointBVProblem{iip}
SciMLBase.SecondOrderBVProblem
— TypeDefines a second order BVP problem. Documentation Page: https://docs.sciml.ai/DiffEqDocs/stable/types/bvp_types/
Mathematical Specification of a second order BVP Problem
To define a second order BVP Problem, you simply need to give the function $f$ and the initial condition $u_0$ which define an ODE:
\[\frac{ddu}{dt} = f(du,u,p,t)\]
along with an implicit function bc
which defines the residual equation, where
\[bc(du,u,p,t) = 0\]
is the manifold on which the solution must live. A common form for this is the two-point SecondOrderBVProblem
where the manifold defines the solution at two points:
\[g(u(t_0),u'(t_0)) = 0 g(u(t_f),u'(t_f)) = 0\]
Problem Type
Constructors
TwoPointSecondOrderBVProblem{isinplace}(f, bc, u0, tspan, p=NullParameters(); kwargs...)
SecondOrderBVProblem{isinplace}(f, bc, u0, tspan, p=NullParameters(); kwargs...)
or if we have an initial guess function initialGuess(p, t)
for the given BVP, we can pass the initial guess to the problem constructors:
TwoPointSecondOrderBVProblem{isinplace}(f, bc, initialGuess, tspan, p=NullParameters(); kwargs...)
SecondOrderBVProblem{isinplace}(f, bc, initialGuess, tspan, p=NullParameters(); kwargs...)
For any BVP problem type, bc
must be inplace if f
is inplace. Otherwise it must be out-of-place.
If the bvp is a StandardSecondOrderBVProblem (also known as a Multi-Point BV Problem) it must define either of the following functions
bc!(residual, du, u, p, t)
residual = bc(du, u, p, t)
where residual
computed from the current u
. u
is an array of solution values where u[i]
is at time t[i]
, while p
are the parameters. For a TwoPointBVProblem
, t = tspan
. For the more general BVProblem
, u
can be all of the internal time points, and for shooting type methods u=sol
the ODE solution. Note that all features of the ODESolution
are present in this form. In both cases, the size of the residual matches the size of the initial condition.
If the bvp is a TwoPointSecondOrderBVProblem
then bc
must be a Tuple (bca, bcb)
and each of them must define either of the following functions:
begin
bca!(resid_a, du_a, u_a, p)
bcb!(resid_b, du_b, u_b, p)
end
begin
resid_a = bca(du_a, u_a, p)
resid_b = bcb(du_b, u_b, p)
end
where resid_a
and resid_b
are the residuals at the two endpoints, u_a
and u_b
are the solution values at the two endpoints, du_a
and du_b
are the derivative of solution values at the two endpoints, and p
are the parameters.
Parameters are optional, and if not given, then a NullParameters()
singleton will be used which will throw nice errors if you try to index non-existent parameters. Any extra keyword arguments are passed on to the solvers. For example, if you set a callback
in the problem, then that callback
will be added in every solve call.
Fields
f
: The function for the ODE.bc
: The boundary condition function.u0
: The initial condition. Either the initial condition for the ODE as an initial value problem, or aVector
of values for $u(t_i)$ for collocation methods.tspan
: The timespan for the problem.p
: The parameters for the problem. Defaults toNullParameters
kwargs
: The keyword arguments passed onto the solves.
SciMLBase.TwoPointSecondOrderBVProblem
— Typestruct TwoPointSecondOrderBVProblem{iip}