Shooting(ode_alg) solves for the initial state with Newton's method,
integrating the ODE with ode_alg for each residual. MultipleShooting( nshoots, ode_alg) shoots from nshoots nodes and adds continuity
conditions. MIRK4(), MIRK5() and MIRK6() are the mono-implicit
Runge-Kutta collocation methods of orders 4, 5 and 6 of
BoundaryValueDiffEq.jl with their continuous extensions and defect
control: starting from a uniform mesh of step dt, the mesh is refined
until the relative defect of the continuous solution is below abstol.
Options of solve(): dt (initial mesh step of the MIRK methods,
required), abstol (defect tolerance, 1e-6; for shooting the
nonlinear tolerance), adaptive = FALSE (keep the initial mesh),
nlsolve_kwargs = list(abstol = ) (Newton tolerance of the MIRK
methods, 1e-10), maxiters, and for shooting reltol and abstol of
the inner ODE solves through odesolve_kwargs.
Usage
Shooting(ode_alg = Tsit5())
MultipleShooting(nshoots = 10L, ode_alg = Tsit5())
MIRK4(defect_threshold = 0.1, max_num_subintervals = 3000L)
MIRK5(defect_threshold = 0.1, max_num_subintervals = 3000L)
MIRK6(defect_threshold = 0.1, max_num_subintervals = 3000L)
# S3 method for class 'BVProblem'
solve(a, b = NULL, ...)Arguments
- ode_alg
An ODE algorithm.
- nshoots
Number of shooting intervals.
- defect_threshold
Largest acceptable relative defect; above it the mesh is halved and the iteration restarts.
- max_num_subintervals
Largest number of mesh intervals.
- a
A
BVProblem.- b
A BVP algorithm;
MIRK4()by default.- ...
Solver options.
Examples
Shooting(Tsit5())
#> Shooting()
# y'' = 100 y with boundary layers: the mesh is refined from 4 intervals
bvp <- BVProblem(function(u, p, t) c(u[2], 100 * u[1]),
function(sol, p, t) c(sol(0)[1] - 1, sol(1)[1] - 1), c(1, 0), c(0, 1))
sol <- solve(bvp, MIRK4(), dt = 0.25)
length(sol$t)
#> [1] 69
sol(0.5)[1] - 1 / cosh(5)
#> [1] 4.501284e-08