Skip to contents

The num_stages stage Gauss-Legendre implicit Runge-Kutta method of order 2 num_stages (symplectic and A-stable), after OrdinaryDiffEqFIRK's GaussLegendre: the full stage system is solved by a simplified Newton iteration with one LU factorization per step, the error estimate comes from the embedded weights of order num_stages - 1 (so adaptive stepping needs at least two stages) and the step size from the PI controller. The tableaus of 2 to 5 stages are Julia's; others are computed and agree with Julia's to rounding. The dense output is cubic Hermite.

Usage

GaussLegendre(
  num_stages = 2L,
  autodiff = NULL,
  extrapolant = "dense",
  fast_convergence_cutoff = 1/5,
  new_W_gamma_dt_cutoff = 1/5,
  controller = "PI",
  kappa = NULL,
  maxiters = 10L,
  step_limiter = NULL,
  concrete_jac = NULL,
  linsolve = NULL,
  precs = NULL
)

Arguments

num_stages

Number of stages (a positive integer).

autodiff

Differentiation choice for the Jacobian when the problem has none (see AutoForwardDiff()).

extrapolant

"dense" (the default: the previous collocation polynomial gives the starting values) or "constant" (zero starting values).

fast_convergence_cutoff

Rate below which the Newton iteration counts as fast.

new_W_gamma_dt_cutoff

Stored only; the out of place methods factorize every step.

controller

Accepted for compatibility (the PI controller is used, as in Julia).

kappa

Tolerance of the Newton stopping test (default 1/100; RadauIIA3() always uses 1/100, as Julia).

maxiters

Maximum number of Newton iterations.

step_limiter

Optional function(u, integrator, p, t) applied after every accepted step.

concrete_jac, linsolve

Accepted for compatibility; dense LU factorizations are used.

precs

Accepted for compatibility (no preconditioner is used).

Value

An ODE algorithm.

Examples

osc <- function(u, p, t) c(u[2], -u[1])
prob <- ODEProblem(osc, c(1, 0), c(0, 1))
sol <- solve(prob, GaussLegendre(num_stages = 3), reltol = 1e-8, abstol = 1e-10)
sol$u[[length(sol$u)]]
#> [1]  0.5403023 -0.8414710