Fixed step second order implicit explicit two step methods for a
SplitODEProblem() du/dt = f1(u, p, t) + f2(u, p, t): the first part
f1 is treated implicitly by the Crank-Nicolson rule (Newton's method
with the Jacobian of f1: SplitFunction(f1, f2, jac = J1), else finite
differences), the second part f2 explicitly.
Arguments
- autodiff
As for
ImplicitEuler(): how the Jacobian off1is formed when none is given.- extrapolant
The initial guess of the Newton iteration; only
"linear"(the default of OrdinaryDiffEq, which starts fromdt * f1(u)) is used by these methods.
Details
CNAB2(): Crank-Nicolson Adams-Bashforth (He and Li 2010).CNLF2(): Crank-Nicolson leapfrog (Jiang, Kubacki, Layton, Moraiti and Tran 2015).
The first step, and the first step after an event that changes the
state, use the one step startup formula. Give dt; the methods are not
adaptive. As in OrdinaryDiffEq, f2 enters through the difference of
the derivative f1 + f2 carried from the previous step and f1.
Examples
prob <- SplitODEProblem(function(u, p, t) -9 * u, function(u, p, t) -u, 1, c(0, 1))
sol <- solve(prob, CNAB2(), dt = 0.05)
sol$u[[length(sol$u)]]
#> [1] 4.247664e-05
solve(prob, CNLF2(), dt = 0.05)$u[[21]]
#> [1] 1.017739e-05