OrdinaryDiffEqFIRK
FIRK methods are fully implicit Runge-Kutta methods. They can have special properties, like be symplectic integrators, and can achieve higher order for the same number of stage in comparison to diagonal methods. However, the fully implicit methods have a larger implicit system to solve and thus have a higher linear algebra cost. This can be useful in some contexts to promote more parallelism, but also since the size of the factorization is cubic and the dominant cost for large equations, multiplying O(n^3) operations to O((sn)^3) can be a considerable cost increase for FIRK tableaus, where s, the number of stages, is particularly large. That said, the restriction to diagonal implicitness imposes order restrictions, such as SDIRK methods having a maximum order of 5, which can restrict the problems best suited for SDIRK methods.
The most common FIRK method in production are those based on RadauIIA tableaus, which is an ODE representation of Gaussian collocation. Like Gaussian collocation, it achieves higher order convergence than its stages, namely order 2s+1 for s stages. Thus RadauIIA FIRK methods tend to be some of the highest order methods (excluding extrapolation methods). This means that high order RadauIIA methods are recommended in the same scenarios that high-order explicit Runge-Kutta methods are recommended simply with the restriction of being a stiff equation. Such scenarios include cases like very low tolerances: RadauIIA methods can be the best performing methods for scenarios where tolerances are 1e-9 and below. Additionally, for ODE systems of size less than 200, the increased size of the Jacobian is mitigated by improved multithreading, since BLAS implementations are only good at multithreading LU factorizations after a certain matrix size. For this reason, RadauIIA methods tend to be recommended in cases where ODE size is small to intermediate and very accurate solutions are required.
They should be tested against the parallel implicit extrapolation which also specialize in this regime.
Installation
To be able to access the solvers in OrdinaryDiffEqFIRK, you must first install them use the Julia package manager:
using Pkg
Pkg.add("OrdinaryDiffEqFIRK")This will only install the solvers listed at the bottom of this page. If you want to explore other solvers for your problem, you will need to install some of the other libraries listed in the navigation bar on the left.
Example usage
using OrdinaryDiffEqFIRK
function lorenz!(du, u, p, t)
du[1] = 10.0 * (u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz!, u0, tspan)
sol = solve(prob, RadauIIA5())Full list of solvers
OrdinaryDiffEqFIRK.RadauIIA3 — TypeRadauIIA3(; chunk_size = Val{0}(),
autodiff = AutoForwardDiff(),
standardtag = Val{true}(),
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
extrapolant = :dense,
smooth_est = true,
step_limiter! = trivial_limiter!)Fully-Implicit Runge-Kutta Method. An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. Similar to Hairer's SEULEX.
Keyword Arguments
autodiff: Uses ADTypes.jl to specify whether to use automatic differentiation via ForwardDiff.jl or finite differencing via FiniteDiff.jl. Defaults toAutoForwardDiff()for automatic differentiation, which by default useschunksize = 0, and thus uses the internal ForwardDiff.jl algorithm for the choice. To useFiniteDiff.jl, theAutoFiniteDiff()ADType can be used, which has a keyword argumentfdtypewith default valueVal{:forward}(), and alternativesVal{:central}()andVal{:complex}().standardtag: Specifies whether to use package-specific tags instead of the ForwardDiff default function-specific tags. For more information, see this blog post. Defaults toVal{true}().concrete_jac: Specifies whether a Jacobian should be constructed. Defaults tonothing, which means it will be chosen true/false depending on circumstances of the solver, such as whether a Krylov subspace method is used forlinsolve.linsolve: Any LinearSolve.jl compatible linear solver. For example, to use KLU.jl, specifyRadauIIA3(linsolve = KLUFactorization()). Whennothingis passed, usesDefaultLinearSolver.precs: Any LinearSolve.jl-compatible preconditioner can be used as a left or right preconditioner. Preconditioners are specified by thePl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)function where the arguments are defined as:W: the current Jacobian of the nonlinear system. Specified as either $I - \gamma J$ or $I/\gamma - J$ depending on the algorithm. This will commonly be aWOperatortype defined by OrdinaryDiffEq.jl. It is a lazy representation of the operator. Users can construct the W-matrix on demand by callingconvert(AbstractMatrix,W)to receive anAbstractMatrixmatching thejac_prototype.du: the current ODE derivativeu: the current ODE statep: the ODE parameterst: the current ODE timenewW: aBoolwhich specifies whether theWmatrix has been updated since the last call toprecs. It is recommended that this is checked to only update the preconditioner whennewW == true.Plprev: the previousPl.Prprev: the previousPr.solverdata: Optional extra data the solvers can give to theprecsfunction. Solver-dependent and subject to change.
(Pl,Pr)of the LinearSolve.jl-compatible preconditioners. To specify one-sided preconditioning, simply returnnothingfor the preconditioner which is not used. Additionally,precsmust supply the dispatch:
which is used in the solver setup phase to construct the integrator type with the preconditionersPl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)(Pl,Pr). The default isprecs=DEFAULT_PRECSwhere the default preconditioner function is defined as:DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothingextrapolant: TBDsmooth_est: TBDstep_limiter!: function of the formlimiter!(u, integrator, p, t)
References
@article{hairer1999stiff, title={Stiff differential equations solved by Radau methods}, author={Hairer, Ernst and Wanner, Gerhard}, journal={Journal of Computational and Applied Mathematics}, volume={111}, number={1-2}, pages={93–111}, year={1999}, publisher={Elsevier}}
OrdinaryDiffEqFIRK.RadauIIA5 — TypeRadauIIA5(; chunk_size = Val{0}(),
autodiff = AutoForwardDiff(),
standardtag = Val{true}(),
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
extrapolant = :dense,
smooth_est = true,
step_limiter! = trivial_limiter!)Fully-Implicit Runge-Kutta Method. An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. Similar to Hairer's SEULEX.
Keyword Arguments
autodiff: Uses ADTypes.jl to specify whether to use automatic differentiation via ForwardDiff.jl or finite differencing via FiniteDiff.jl. Defaults toAutoForwardDiff()for automatic differentiation, which by default useschunksize = 0, and thus uses the internal ForwardDiff.jl algorithm for the choice. To useFiniteDiff.jl, theAutoFiniteDiff()ADType can be used, which has a keyword argumentfdtypewith default valueVal{:forward}(), and alternativesVal{:central}()andVal{:complex}().standardtag: Specifies whether to use package-specific tags instead of the ForwardDiff default function-specific tags. For more information, see this blog post. Defaults toVal{true}().concrete_jac: Specifies whether a Jacobian should be constructed. Defaults tonothing, which means it will be chosen true/false depending on circumstances of the solver, such as whether a Krylov subspace method is used forlinsolve.linsolve: Any LinearSolve.jl compatible linear solver. For example, to use KLU.jl, specifyRadauIIA5(linsolve = KLUFactorization()). Whennothingis passed, usesDefaultLinearSolver.precs: Any LinearSolve.jl-compatible preconditioner can be used as a left or right preconditioner. Preconditioners are specified by thePl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)function where the arguments are defined as:W: the current Jacobian of the nonlinear system. Specified as either $I - \gamma J$ or $I/\gamma - J$ depending on the algorithm. This will commonly be aWOperatortype defined by OrdinaryDiffEq.jl. It is a lazy representation of the operator. Users can construct the W-matrix on demand by callingconvert(AbstractMatrix,W)to receive anAbstractMatrixmatching thejac_prototype.du: the current ODE derivativeu: the current ODE statep: the ODE parameterst: the current ODE timenewW: aBoolwhich specifies whether theWmatrix has been updated since the last call toprecs. It is recommended that this is checked to only update the preconditioner whennewW == true.Plprev: the previousPl.Prprev: the previousPr.solverdata: Optional extra data the solvers can give to theprecsfunction. Solver-dependent and subject to change.
(Pl,Pr)of the LinearSolve.jl-compatible preconditioners. To specify one-sided preconditioning, simply returnnothingfor the preconditioner which is not used. Additionally,precsmust supply the dispatch:
which is used in the solver setup phase to construct the integrator type with the preconditionersPl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)(Pl,Pr). The default isprecs=DEFAULT_PRECSwhere the default preconditioner function is defined as:DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothingextrapolant: TBDsmooth_est: TBDstep_limiter!: function of the formlimiter!(u, integrator, p, t)
References
@article{hairer1999stiff, title={Stiff differential equations solved by Radau methods}, author={Hairer, Ernst and Wanner, Gerhard}, journal={Journal of Computational and Applied Mathematics}, volume={111}, number={1-2}, pages={93–111}, year={1999}, publisher={Elsevier}}
OrdinaryDiffEqFIRK.RadauIIA9 — TypeRadauIIA9(; chunk_size = Val{0}(),
autodiff = AutoForwardDiff(),
standardtag = Val{true}(),
concrete_jac = nothing,
diff_type = Val{:forward},
linsolve = nothing,
precs = DEFAULT_PRECS,
extrapolant = :dense,
smooth_est = true,
step_limiter! = trivial_limiter!)Fully-Implicit Runge-Kutta Method. An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. Similar to Hairer's SEULEX.
Keyword Arguments
autodiff: Uses ADTypes.jl to specify whether to use automatic differentiation via ForwardDiff.jl or finite differencing via FiniteDiff.jl. Defaults toAutoForwardDiff()for automatic differentiation, which by default useschunksize = 0, and thus uses the internal ForwardDiff.jl algorithm for the choice. To useFiniteDiff.jl, theAutoFiniteDiff()ADType can be used, which has a keyword argumentfdtypewith default valueVal{:forward}(), and alternativesVal{:central}()andVal{:complex}().standardtag: Specifies whether to use package-specific tags instead of the ForwardDiff default function-specific tags. For more information, see this blog post. Defaults toVal{true}().concrete_jac: Specifies whether a Jacobian should be constructed. Defaults tonothing, which means it will be chosen true/false depending on circumstances of the solver, such as whether a Krylov subspace method is used forlinsolve.linsolve: Any LinearSolve.jl compatible linear solver. For example, to use KLU.jl, specifyRadauIIA9(linsolve = KLUFactorization()). Whennothingis passed, usesDefaultLinearSolver.precs: Any LinearSolve.jl-compatible preconditioner can be used as a left or right preconditioner. Preconditioners are specified by thePl,Pr = precs(W,du,u,p,t,newW,Plprev,Prprev,solverdata)function where the arguments are defined as:W: the current Jacobian of the nonlinear system. Specified as either $I - \gamma J$ or $I/\gamma - J$ depending on the algorithm. This will commonly be aWOperatortype defined by OrdinaryDiffEq.jl. It is a lazy representation of the operator. Users can construct the W-matrix on demand by callingconvert(AbstractMatrix,W)to receive anAbstractMatrixmatching thejac_prototype.du: the current ODE derivativeu: the current ODE statep: the ODE parameterst: the current ODE timenewW: aBoolwhich specifies whether theWmatrix has been updated since the last call toprecs. It is recommended that this is checked to only update the preconditioner whennewW == true.Plprev: the previousPl.Prprev: the previousPr.solverdata: Optional extra data the solvers can give to theprecsfunction. Solver-dependent and subject to change.
(Pl,Pr)of the LinearSolve.jl-compatible preconditioners. To specify one-sided preconditioning, simply returnnothingfor the preconditioner which is not used. Additionally,precsmust supply the dispatch:
which is used in the solver setup phase to construct the integrator type with the preconditionersPl, Pr = precs(W, du, u, p, t, ::Nothing, ::Nothing, ::Nothing, solverdata)(Pl,Pr). The default isprecs=DEFAULT_PRECSwhere the default preconditioner function is defined as:DEFAULT_PRECS(W, du, u, p, t, newW, Plprev, Prprev, solverdata) = nothing, nothingextrapolant: TBDsmooth_est: TBDstep_limiter!: function of the formlimiter!(u, integrator, p, t)
References
@article{hairer1999stiff, title={Stiff differential equations solved by Radau methods}, author={Hairer, Ernst and Wanner, Gerhard}, journal={Journal of Computational and Applied Mathematics}, volume={111}, number={1-2}, pages={93–111}, year={1999}, publisher={Elsevier}}