Skip to contents

SemilinearODEProblem(sys, op, tspan) builds a split ODE problem du/dt = f1(u) + f2(u) from the semiquadratic form of the system (calculate_semiquadratic_form()): by default the linear part A u is the stiff part f1 and the quadratic and nonlinear parts form f2, as ModelingToolkit's SemilinearODEProblem. The problem is an ODEProblem too (with f = f1 + f2), so every ODE solver applies.

Usage

SemilinearODEFunction(
  sys,
  stiff_linear = TRUE,
  stiff_quadratic = FALSE,
  stiff_nonlinear = FALSE,
  jac = FALSE,
  ...
)

SemilinearODEProblem(
  sys,
  op = list(),
  tspan = NULL,
  stiff_linear = TRUE,
  stiff_quadratic = FALSE,
  stiff_nonlinear = FALSE,
  jac = FALSE,
  ...
)

Arguments

sys

A complete ODE System.

stiff_linear, stiff_quadratic, stiff_nonlinear

Which parts go into the stiff function f1.

jac

Generate the Jacobian of the full right-hand side.

...

Passed to ODEProblem().

op

Operating point.

tspan

Time span.

Value

A SemilinearODEProblem (class SplitODEProblem, ODEProblem) or SemilinearODEFunction.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); y <- Variable("y", t)
sys <- mtkcompile(System(list(D(x) ~ -2 * x + x * y, D(y) ~ -y), t, name = "s"))
prob <- SemilinearODEProblem(sys, list(x ~ 1, y ~ 1), c(0, 1))
prob$f$f1(c(1, 1), prob$p, 0)
#> [1] -1 -2
sol <- solve(prob, Rodas5P())