Methods for a SplitODEProblem() du/dt = f1(u, p, t) + f2(u, p, t)
whose first part f1 is fast (or stiff) and whose second part f2 is
slow, after OrdinaryDiffEqMultirate and OrdinaryDiffEqMultirateImplicit.
The fast part is advanced with small substeps inside each step while the
slow part is evaluated only a few times per step. sol$stats$nf counts
the evaluations of f1 (and those of f2 inside the Newton iterations
of the implicit MRI-GARK methods), sol$stats$nf2 the other evaluations
of f2.
Usage
MREEF(m = 4L, order = 4L, seq = "harmonic")
MRAB(k = 2L, m = 4L)
MRIGARKERK22a(m)
MRIGARKERK22b(m)
MRIGARKERK33a(m)
MRIGARKERK45a(m)
MRIGARKIRK21a(m, autodiff = NULL)
MRIGARKESDIRK34a(m, autodiff = NULL)
MRIGARKESDIRK46a(m, autodiff = NULL)
MIS(m)
MREIL(m = 4L, order = 4L, seq = "harmonic", autodiff = NULL)Arguments
- m
Number of fast substeps (or inner micro steps) per step or stage.
- order
Extrapolation order: the number of base solutions.
- seq
Step count sequence of the extrapolation,
"harmonic"or"romberg".- k
Adams-Bashforth order, from 1 to 5.
- autodiff
As for
ImplicitEuler(): how the Jacobian is formed when none is given.
Details
MREEF(): multirate Euler with the slow rate frozen over each macro interval andmexplicit Euler substeps of the fast part, raised to orderorderby Aitken-Neville (Richardson) extrapolation over the step countsseq("harmonic": 1, 2, 3, ...;"romberg": 1, 2, 4, ...).MRAB(): multirate Adams-Bashforth: the slow rate is evaluated once per step and themfast substeps use akstep Adams-Bashforth formula on the combined rate, started with lower orders inside each step. The error estimate compares orderskandk - 1(withk = 1there is none: the error estimate stays at 1, as in OrdinaryDiffEq).MRIGARKERK22a(),MRIGARKERK22b(),MRIGARKERK33a(),MRIGARKERK45a(): the explicit multirate infinitesimal GARK methods of Sandu (orders 2, 2, 3 and 4). Each stage integrates a modified fast problem withmexplicit Runge-Kutta micro steps (midpoint, RK3 or RK4) and a slow forcing that is polynomial in time.MIS(): the multirate infinitesimal step method MIS2 of Wensch, Knoth and Galant (order 2), whose inner problems takemax(1, ceiling(m d_i))explicit midpoint micro steps.MREIL(): asMREEF()with linearly implicit Euler substeps of the fast part,(I - h J) delta = h (f1 + f2)withJthe Jacobian off1(fromSplitFunction(f1, f2, jac = J1), else finite differences), for a stiff fast part. One Jacobian per step, one factorization per extrapolation column. A constant mass matrix enters asM - h J.MRIGARKIRK21a(),MRIGARKESDIRK34a(),MRIGARKESDIRK46a(): the solve decoupled implicit MRI-GARK methods of Sandu (orders 2, 3 and 4) for a stiff slow part: the fast stages are explicit as above, the slow corrections are diagonally implicit stages solved by Newton's method onf2(finite difference Jacobian off2).
Examples
# a fast linear relaxation coupled to a slow nonlinear oscillator
fast <- function(u, p, t) c(-20 * (u[1] - u[2]), 0)
slow <- function(u, p, t) c(0, -u[1] - 0.1 * u[2] * u[2] * u[2])
prob <- SplitODEProblem(fast, slow, c(1, 0.5), c(0, 1))
sol <- solve(prob, MRIGARKERK33a(m = 3), reltol = 1e-6, abstol = 1e-8)
sol$u[[length(sol$u)]]
#> [1] 0.1722704 0.1631493
solve(prob, MREEF(), dt = 1 / 16, adaptive = FALSE)$u[[17]]
#> [1] 0.1722681 0.1631470