SteadyStateDiffEq.jl

SteadyStateDiffEq.jl is the native Julia package for solving steady state problems within the SciML ecosystem. It provides methods for finding equilibrium solutions of differential equations.

Installation

SteadyStateDiffEq.jl is included with DifferentialEquations.jl. To use it standalone:

using Pkg
Pkg.add("SteadyStateDiffEq")
import SteadyStateDiffEq

Steady State Solver APIs

SteadyStateDiffEq.DynamicSS — Type
DynamicSS(alg = nothing; tspan = Inf) -> DynamicSS

Solve a steady-state problem by evolving the corresponding ODE until the derivative is close to zero.

DynamicSS internally adds a TerminateSteadyState callback. The abstol and reltol keywords passed to solve control the steady-state termination condition. Use odesolve_kwargs to pass separate keyword arguments to the ODE solve.

An SCCNonlinearProblem can also be solved directly: its blocks are solved sequentially in SCC order, updating each block's parameters from the upstream solutions through explicitfuns! as in the SCC solve. LinearProblem blocks are solved directly, and the remaining blocks are integrated to steady state by DynamicSS on the block residual — so convergence only requires each nonlinear block's residual to be attracting under its own pseudo-transient dynamics, not a globally attracting concatenated field. A SteadyStateProblem that records an SCCNonlinearProblem as its lowered_problem (for example one built by ModelingToolkit) takes the same sequential solve, and its solution is expressed on the lowered problem's state ordering.

Arguments

  • alg: the ODE solver algorithm passed to solve. When alg === nothing, the default ODE solver is selected by the downstream solver package.

Keywords

  • tspan: the time span used for the ODE solve. If tspan is a number, it is equivalent to (zero(tspan), tspan).

Fields

  • alg: ODE solver algorithm, or nothing to request downstream default selection.
  • tspan: time span passed to the internal ODE solve.

Example

julia> using SciMLBase: SteadyStateProblem, solve

julia> using SteadyStateDiffEq

julia> using Sundials: CVODE_BDF

julia> prob = SteadyStateProblem((u, p, t) -> 1 .- u, [0.0]);

julia> sol = solve(prob, DynamicSS(CVODE_BDF()); dt = 1.0);
Note

The default alg of nothing works only if DifferentialEquations.jl is installed and loaded.

Note

If you use CVODE_BDF you may need to give a starting dt via dt = .....

SteadyStateDiffEq.SSRootfind — Type
SSRootfind(alg = nothing) -> SSRootfind

Solve a steady-state problem by converting it to a NonlinearProblem and calling a nonlinear solver.

An SCCNonlinearProblem can also be solved directly: it is forwarded to alg unchanged, preserving its decomposition into linear and nonlinear blocks. This requires the SCC solver implementation from SCCNonlinearSolve.jl to be loaded (it is a dependency of NonlinearSolve.jl and ModelingToolkit.jl); alg may be nothing or a nonlinear solver algorithm (wrapped in SCCNonlinearSolve.SCCAlg automatically), or an SCCAlg configured with separate linear and nonlinear block solvers.

A SteadyStateProblem that records a lowered_problem (for example the SCC decomposition stored by ModelingToolkit) is solved through that lowering; since the lowering defines its own state ordering, the returned solution is expressed on the lowered problem.

Arguments

  • alg: the nonlinear solver algorithm passed to solve. When alg === nothing, the default nonlinear solver is selected by the downstream solver package.

Fields

  • alg: nonlinear solver algorithm, or nothing to request downstream default selection.

Example

julia> using SciMLBase: SteadyStateProblem, solve

julia> using SteadyStateDiffEq

julia> using NonlinearSolve

julia> prob = SteadyStateProblem((u, p, t) -> 1 .- u, [0.0]);

julia> sol = solve(prob, SSRootfind());
Note

The default alg of nothing works only if NonlinearSolve.jl is installed and loaded.