Skip to content

Commit 573d272

Browse files
docs: add docstring for new BVProblem constructor
1 parent 83f201e commit 573d272

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/problems/bvproblem.jl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,48 @@
1+
"""
2+
```julia
3+
SciMLBase.BVProblem{iip}(sys::AbstractSystem, u0map, tspan,
4+
parammap = DiffEqBase.NullParameters();
5+
constraints = nothing, guesses = nothing,
6+
version = nothing, tgrad = false,
7+
jac = true, sparse = true,
8+
simplify = false,
9+
kwargs...) where {iip}
10+
```
11+
12+
Create a boundary value problem from the [`System`](@ref).
13+
14+
`u0map` is used to specify fixed initial values for the states. Every variable
15+
must have either an initial guess supplied using `guesses` or a fixed initial
16+
value specified using `u0map`.
17+
18+
Boundary value conditions are supplied to Systems in the form of a list of constraints.
19+
These equations should specify values that state variables should take at specific points,
20+
as in `x(0.5) ~ 1`). More general constraints that should hold over the entire solution,
21+
such as `x(t)^2 + y(t)^2`, should be specified as one of the equations used to build the
22+
`System`.
23+
24+
If a `System` without `constraints` is specified, it will be treated as an initial value problem.
25+
26+
```julia
27+
@parameters g t_c = 0.5
28+
@variables x(..) y(t) λ(t)
29+
eqs = [D(D(x(t))) ~ λ * x(t)
30+
D(D(y)) ~ λ * y - g
31+
x(t)^2 + y^2 ~ 1]
32+
cstr = [x(0.5) ~ 1]
33+
@mtkbuild pend = System(eqs, t; constraints = cstrs)
34+
35+
tspan = (0.0, 1.5)
36+
u0map = [x(t) => 0.6, y => 0.8]
37+
parammap = [g => 1]
38+
guesses = [λ => 1]
39+
40+
bvp = SciMLBase.BVProblem{true, SciMLBase.AutoSpecialize}(pend, u0map, tspan, parammap; guesses, check_length = false)
41+
```
42+
43+
If the `System` has algebraic equations, like `x(t)^2 + y(t)^2`, the resulting
44+
`BVProblem` must be solved using BVDAE solvers, such as Ascher.
45+
"""
146
@fallback_iip_specialize function SciMLBase.BVProblem{iip, spec}(
247
sys::System, u0map, tspan, parammap = SciMLBase.NullParameters();
348
check_compatibility = true, cse = true, checkbounds = false, eval_expression = false,

0 commit comments

Comments
 (0)