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 SteadyStateDiffEqSteady State Solver APIs
SteadyStateDiffEq.DynamicSS — Type
DynamicSS(alg = nothing; tspan = Inf) -> DynamicSSSolve 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 tosolve. Whenalg === nothing, the default ODE solver is selected by the downstream solver package.
Keywords
tspan: the time span used for the ODE solve. Iftspanis a number, it is equivalent to(zero(tspan), tspan).
Fields
alg: ODE solver algorithm, ornothingto 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);SteadyStateDiffEq.SSRootfind — Type
SSRootfind(alg = nothing) -> SSRootfindSolve 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 tosolve. Whenalg === nothing, the default nonlinear solver is selected by the downstream solver package.
Fields
alg: nonlinear solver algorithm, ornothingto 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());