Skip to contents

Implicit methods for stiff problems and differential algebraic equations in mass matrix form, as in OrdinaryDiffEq.jl. ImplicitEuler() is the backward Euler method with a divided difference error estimate, Trapezoid() the trapezoidal rule, and FBDF() the variable order (1 to 5) fixed leading coefficient backward differentiation formula. Each step is solved by a modified Newton iteration that reuses the Jacobian across steps until convergence slows down; the Jacobian is prob$f$jac when the problem has one (ODEProblem(sys, ..., jac = TRUE)) and finite differences otherwise.

Usage

ImplicitEuler(autodiff = NULL, nlsolve = NLNewton())

Trapezoid(autodiff = NULL, nlsolve = NLNewton())

FBDF(
  max_order = 5L,
  stald = TRUE,
  stald_rrcut = 0.98,
  stald_vrrtol = 1e-04,
  stald_vrrt2 = 5e-04,
  stald_sqtol = 0.001,
  stald_rrtol = 0.01,
  stald_tiny = 1e-90,
  qmax = 10,
  qsteady_min = 9/10,
  qsteady_max = 2,
  step_limiter = NULL,
  time_filter = FALSE,
  autodiff = NULL
)

Arguments

autodiff

As for ImplicitEuler().

nlsolve

The nonlinear solver of ImplicitEuler() and Trapezoid(): NLNewton() (with its kappa, max_iter, new_W_dt_cutoff, always_new, check_div, relax and predictor, a function predictor(uprev, p, t, dt) guessing the stage value at the stage time t), NLFunctional() or NLAnderson().

max_order

Maximum order of FBDF().

stald

Stability limit detection for orders 3 to 5 (CVODE's algorithm): lowers the order when the step size nears the stability boundary of the BDF formula.

stald_rrcut, stald_vrrtol, stald_vrrt2, stald_sqtol, stald_rrtol, stald_tiny

Tuning constants of the stability limit detection (CVODE's defaults).

qmax, qsteady_min, qsteady_max

Largest step growth factor and the range of factors that keep the step size.

step_limiter

A function limiter(u, integ, p, t) returning the state after each accepted step; prefer the step_limiter option of solve(), which every method honors.

time_filter

Apply the time filters of DeCaria et al. (adds filtered candidates of orders k + 1 and, at order 3, BDF3-Stab; the step uses the candidate with the largest step ratio). Requires an identity mass matrix.

Value

An algorithm object.

Examples

prob <- ODEProblem(function(u, p, t) -1000 * (u - cos(t)), 0, c(0, 1))
sol <- solve(prob, FBDF(), reltol = 1e-6)
sol(1)
#> [1] 0.5411432
sol2 <- solve(prob, ImplicitEuler())
sol2$retcode
#> [1] "Success"