Skip to contents

HybridExplicitImplicitRK(tab, order) advances the differential variables of a semi explicit index 1 DAE in mass matrix form (a diagonal mass matrix whose zero diagonal entries mark the algebraic variables) with explicit Runge-Kutta stages and the algebraic variables with Rosenbrock type linearly implicit stages, so only the algebraic block of the Jacobian is factorized; without algebraic variables it is the explicit method of the tableau. Tsit5DA() is the 12 stage order 5(4) instance of Steinebach based on Tsit5, with a third order dense output. As in OrdinaryDiffEq.jl the Jacobian of the algebraic block is evaluated at every step (max_jac_age and jac_reuse_gamma_tol have no effect) and is not counted in the statistics.

Usage

HybridExplicitImplicitRK(
  tab,
  order,
  autodiff = NULL,
  concrete_jac = NULL,
  linsolve = NULL,
  step_limiter = NULL,
  stage_limiter = NULL,
  max_jac_age = 20L,
  jac_reuse_gamma_tol = 0.03
)

Tsit5DA(
  autodiff = NULL,
  concrete_jac = NULL,
  linsolve = NULL,
  step_limiter = NULL,
  stage_limiter = NULL,
  max_jac_age = 20L,
  jac_reuse_gamma_tol = 0.03
)

Arguments

tab

The tableau: a list with entries A, C, gamma, b, bhat, c, d and H (the explicit coefficients, the linearly implicit Gamma coefficients, the weights of the solution and of the embedded method, the abscissae, the time derivative coefficients and the dense output matrix), or a function (T, T2) returning one.

order

The order of the method, used by the step size controller.

autodiff

How Jacobians are computed when the problem has no symbolic Jacobian: AutoForwardDiff() (dual numbers, as ForwardDiff; central differences when the function cannot run on them), AutoFiniteDiff(fdtype) or AutoSparse(ad); see AutoForwardDiff(). The default is AutoForwardDiff(), as in OrdinaryDiffEq.

concrete_jac, linsolve

Accepted for compatibility with OrdinaryDiffEq.jl; the linear systems are always solved densely.

step_limiter

A function limiter(u, integrator, p, t) returning the state after each accepted step, or NULL.

stage_limiter

Accepted for compatibility: as in OrdinaryDiffEq.jl, the out of place steps do not apply a stage limiter.

max_jac_age

Number of accepted steps after which a W-method evaluates the Jacobian again (1 for Rosenbrock23() and Rosenbrock32(), which then evaluate it at every step).

jac_reuse_gamma_tol

Relative change of dt * gamma above which a W-method evaluates the Jacobian again.

Value

An algorithm object.

Examples

f <- function(u, p, t) c(-u[1] + u[3], u[1] - 2 * u[2], u[3] - u[2] * u[2] - 0.5 * u[1])
M <- diag(c(1, 1, 0))
prob <- ODEProblem(ODEFunction(f, mass_matrix = M), c(1, 0.5, 0.75), c(0, 1))
solve(prob, Tsit5DA())(1)
#> [1] 0.7825609 0.4368508 0.5821191