diff --git a/docs/src/examples/classical_physics.md b/docs/src/examples/classical_physics.md index 4170ceb1d..c7f0558ea 100644 --- a/docs/src/examples/classical_physics.md +++ b/docs/src/examples/classical_physics.md @@ -70,7 +70,9 @@ we can use `SecondOrderODEProblem` as follows. ```@example physics # Simple Harmonic Oscillator Problem -import OrdinaryDiffEq as ODE, Plots +import OrdinaryDiffEq as ODE +import OrdinaryDiffEqRKN as ODERKN # DPRKN6 +import Plots #Parameters ω = 1 @@ -90,7 +92,7 @@ end #Pass to solvers prob = ODE.SecondOrderODEProblem(harmonicoscillator, dx₀, x₀, tspan, ω) -sol = ODE.solve(prob, ODE.DPRKN6()) +sol = ODE.solve(prob, ODERKN.DPRKN6()) #Plot Plots.plot(sol, idxs = [2, 1], linewidth = 2, title = "Simple Harmonic Oscillator", @@ -382,6 +384,7 @@ Plots.plot(sol.t, energy .- energy[1], title = "Change in Energy over Time", To prevent energy drift, we can instead use a symplectic integrator. We can directly define and solve the `SecondOrderODEProblem`: ```@example physics +import OrdinaryDiffEqSymplecticRK as ODESymp # KahanLi8 function HH_acceleration!(dv, v, u, p, t) x, y = u dx, dy = dv @@ -391,7 +394,7 @@ end initial_positions = [0.0, 0.1] initial_velocities = [0.5, 0.0] prob = ODE.SecondOrderODEProblem(HH_acceleration!, initial_velocities, initial_positions, tspan) -sol2 = ODE.solve(prob, ODE.KahanLi8(), dt = 1 / 10); +sol2 = ODE.solve(prob, ODESymp.KahanLi8(), dt = 1 / 10); ``` Notice that we get the same results: @@ -424,7 +427,7 @@ Plots.plot(sol2.t, energy .- energy[1], title = "Change in Energy over Time", And let's try to use a Runge-Kutta-Nyström solver to solve this. Note that Runge-Kutta-Nyström isn't symplectic. ```@example physics -sol3 = ODE.solve(prob, ODE.DPRKN6()); +sol3 = ODE.solve(prob, ODERKN.DPRKN6()); energy = map(x -> E(x[3], x[4], x[1], x[2]), sol3.u) @show ΔE = energy[1] - energy[end] Plots.gr() diff --git a/docs/src/examples/kepler_problem.md b/docs/src/examples/kepler_problem.md index 9b1c56265..8b82c3106 100644 --- a/docs/src/examples/kepler_problem.md +++ b/docs/src/examples/kepler_problem.md @@ -19,7 +19,11 @@ Also, we know that ``` ```@example kepler -import OrdinaryDiffEq as ODE, ForwardDiff, Plots +import OrdinaryDiffEq as ODE +import OrdinaryDiffEqSymplecticRK as ODESymp # KahanLi6 +import OrdinaryDiffEqRKN as ODERKN # DPRKN6, ERKN4 +import OrdinaryDiffEqLowOrderRK as ODELow # RK4 +import ForwardDiff, Plots import LinearAlgebra: norm H(q, p) = norm(p)^2 / 2 - inv(norm(q)) L(q, p) = q[1] * p[2] - p[1] * q[2] @@ -33,7 +37,7 @@ initial_cond = (initial_position, initial_velocity) initial_first_integrals = (H(initial_cond...), L(initial_cond...)) tspan = (0, 20.0) prob = ODE.DynamicalODEProblem(pdot, qdot, initial_velocity, initial_position, tspan) -sol = ODE.solve(prob, ODE.KahanLi6(), dt = 1 // 10); +sol = ODE.solve(prob, ODESymp.KahanLi6(), dt = 1 // 10); ``` Let's plot the orbit and check the energy and angular momentum variation. We know that energy and angular momentum should be constant, and they are also called first integrals. @@ -59,7 +63,7 @@ analysis_plot(sol, H, L) Let's try to use a Runge-Kutta-Nyström solver to solve this problem and check the first integrals' variation. ```@example kepler -sol2 = ODE.solve(prob, ODE.DPRKN6()) # dt is not necessary, because unlike symplectic +sol2 = ODE.solve(prob, ODERKN.DPRKN6()) # dt is not necessary, because unlike symplectic # integrators DPRKN6 is adaptive @show sol2.u |> length analysis_plot(sol2, H, L) @@ -68,7 +72,7 @@ analysis_plot(sol2, H, L) Let's then try to solve the same problem by the `ERKN4` solver, which is specialized for sinusoid-like periodic function ```@example kepler -sol3 = ODE.solve(prob, ODE.ERKN4()) # dt is not necessary, because unlike symplectic +sol3 = ODE.solve(prob, ODERKN.ERKN4()) # dt is not necessary, because unlike symplectic # integrators ERKN4 is adaptive @show sol3.u |> length analysis_plot(sol3, H, L) @@ -127,7 +131,7 @@ function hamiltonian(du, u, params, t) end prob2 = ODE.ODEProblem(hamiltonian, [initial_position; initial_velocity], tspan) -sol_ = ODE.solve(prob2, ODE.RK4(), dt = 1 // 5, adaptive = false) +sol_ = ODE.solve(prob2, ODELow.RK4(), dt = 1 // 5, adaptive = false) analysis_plot2(sol_, H, L) ``` @@ -140,7 +144,7 @@ function first_integrals_manifold(residual, u, p, t) end cb = CB.ManifoldProjection(first_integrals_manifold, autodiff = NLS.AutoForwardDiff()) -sol5 = ODE.solve(prob2, ODE.RK4(), dt = 1 // 5, adaptive = false, callback = cb) +sol5 = ODE.solve(prob2, ODELow.RK4(), dt = 1 // 5, adaptive = false, callback = cb) analysis_plot2(sol5, H, L) ``` @@ -152,7 +156,7 @@ function energy_manifold(residual, u, p, t) residual[3:4] .= 0 end energy_cb = CB.ManifoldProjection(energy_manifold, autodiff = NLS.AutoForwardDiff()) -sol6 = ODE.solve(prob2, ODE.RK4(), dt = 1 // 5, adaptive = false, callback = energy_cb) +sol6 = ODE.solve(prob2, ODELow.RK4(), dt = 1 // 5, adaptive = false, callback = energy_cb) analysis_plot2(sol6, H, L) ``` @@ -164,7 +168,7 @@ function angular_manifold(residual, u, p, t) residual[3:4] .= 0 end angular_cb = CB.ManifoldProjection(angular_manifold, autodiff = NLS.AutoForwardDiff()) -sol7 = ODE.solve(prob2, ODE.RK4(), dt = 1 // 5, adaptive = false, callback = angular_cb) +sol7 = ODE.solve(prob2, ODELow.RK4(), dt = 1 // 5, adaptive = false, callback = angular_cb) analysis_plot2(sol7, H, L) ``` diff --git a/docs/src/extras/timestepping.md b/docs/src/extras/timestepping.md index e94581343..3ef45ae76 100644 --- a/docs/src/extras/timestepping.md +++ b/docs/src/extras/timestepping.md @@ -232,6 +232,6 @@ end and used via ```julia -# Assuming: import DifferentialEquations as DE -sol = DE.solve(prob, DE.EM(), dt = dt, adaptive = true, controller = CustomController()) +import StochasticDiffEq as SDE # EM +sol = SDE.solve(prob, SDE.EM(), dt = dt, adaptive = true, controller = CustomController()) ``` diff --git a/docs/src/features/callback_functions.md b/docs/src/features/callback_functions.md index e17a54669..63fb4c052 100644 --- a/docs/src/features/callback_functions.md +++ b/docs/src/features/callback_functions.md @@ -298,6 +298,7 @@ that we implemented. Now ```@example callback3 import DifferentialEquations as DE +import OrdinaryDiffEqLowOrderRK as ODELow # BS3 cb = AutoAbstol(true; init_curmax = 1e-6) ``` @@ -313,7 +314,7 @@ end u0 = 10.0 const V = 1 prob = DE.ODEProblem(g, u0, (0.0, 10.0)) -integrator = DE.init(prob, DE.BS3(), callback = cb) +integrator = DE.init(prob, ODELow.BS3(), callback = cb) at1 = integrator.opts.abstol DE.step!(integrator) at2 = integrator.opts.abstol diff --git a/docs/src/features/dae_initialization.md b/docs/src/features/dae_initialization.md index 106f5cc08..19847efca 100644 --- a/docs/src/features/dae_initialization.md +++ b/docs/src/features/dae_initialization.md @@ -68,7 +68,9 @@ DiffEqBase.ShampineCollocationInit ### Example 1: Simple Pendulum DAE ```julia -using DifferentialEquations +using OrdinaryDiffEqBDF # DFBDF +using SciMLBase # DAEProblem, solve +using DiffEqBase # BrownFullBasicInit, CheckInit, NoInit function pendulum!(res, du, u, p, t) x, y, T = u @@ -114,7 +116,9 @@ sol = solve(prob2, DFBDF(), initializealg = CheckInit()) When using ModelingToolkit, initialization information is often included automatically: ```julia -using ModelingToolkit, DifferentialEquations +using ModelingToolkit +using OrdinaryDiffEqBDF # DFBDF +using SciMLBase # DAEProblem, solve @variables t x(t) y(t) T(t) @parameters g L @@ -143,9 +147,9 @@ Both OrdinaryDiffEq and Sundials support the same initialization algorithms thro ### OrdinaryDiffEq and Sundials ```julia -using OrdinaryDiffEq +using OrdinaryDiffEqBDF # DFBDF # or -using Sundials +using Sundials # IDA # Use Brown's algorithm to fix inconsistent conditions sol = solve(prob, DFBDF(), initializealg = BrownFullBasicInit()) # OrdinaryDiffEq diff --git a/docs/src/features/ensemble.md b/docs/src/features/ensemble.md index ca60ef4d9..7d9e9c40f 100644 --- a/docs/src/features/ensemble.md +++ b/docs/src/features/ensemble.md @@ -390,8 +390,9 @@ Now we build the SDE with these functions: ```@example ensemble2 import DifferentialEquations as DE +import StochasticDiffEq as SDE # SDEProblem, SRIW1 p = [1.5, 1.0, 0.1, 0.1] -prob = DE.SDEProblem(f, g, [1.0, 1.0], (0.0, 10.0), p) +prob = SDE.SDEProblem(f, g, [1.0, 1.0], (0.0, 10.0), p) ``` This is the base problem for our study. What would like to do with this experiment @@ -416,8 +417,8 @@ end Now we solve the problem 10 times and plot all of the trajectories in phase space: ```@example ensemble2 -ensemble_prob = DE.EnsembleProblem(prob, prob_func = prob_func) -sim = DE.solve(ensemble_prob, DE.SRIW1(), trajectories = 10); +ensemble_prob = SDE.EnsembleProblem(prob, prob_func = prob_func) +sim = SDE.solve(ensemble_prob, SDE.SRIW1(), trajectories = 10); nothing # hide ``` diff --git a/docs/src/features/io.md b/docs/src/features/io.md index 69cf91dd8..cbec3ed44 100644 --- a/docs/src/features/io.md +++ b/docs/src/features/io.md @@ -12,11 +12,13 @@ type as the data source to convert to other tabular data formats. For example, let's solve a 4x2 system of ODEs and get the DataFrame: ```@example IO -import OrdinaryDiffEq as ODE, DataFrames +import OrdinaryDiffEq as ODE +import OrdinaryDiffEqLowOrderRK as ODELow # Euler +import DataFrames f_2dlinear = (du, u, p, t) -> du .= 1.01u; tspan = (0.0, 1.0) prob = ODE.ODEProblem(f_2dlinear, rand(2, 2), tspan); -sol = ODE.solve(prob, ODE.Euler(); dt = 1 // 2^(4)); +sol = ODE.solve(prob, ODELow.Euler(); dt = 1 // 2^(4)); df = DataFrames.DataFrame(sol) ``` @@ -42,7 +44,7 @@ JLD2.jl and BSON.jl will work with the full solution type if you bring the requi back into scope before loading. For example, if we save the solution: ```@example IO -sol = ODE.solve(prob, ODE.Euler(); dt = 1 // 2^(4)) +sol = ODE.solve(prob, ODELow.Euler(); dt = 1 // 2^(4)) import JLD2 JLD2.@save "out.jld2" sol ``` @@ -60,7 +62,7 @@ JLD2.@load "out.jld2" sol The example with BSON.jl is: ```@example IO -sol = ODE.solve(prob, ODE.Euler(); dt = 1 // 2^(4)) +sol = ODE.solve(prob, ODELow.Euler(); dt = 1 // 2^(4)) import BSON BSON.bson("test.bson", Dict(:sol => sol)) ``` diff --git a/docs/src/features/linear_nonlinear.md b/docs/src/features/linear_nonlinear.md index 67f9c225c..200a56a4a 100644 --- a/docs/src/features/linear_nonlinear.md +++ b/docs/src/features/linear_nonlinear.md @@ -24,9 +24,13 @@ For linear solvers, DifferentialEquations.jl uses [LinearSolve.jl](https://github.com/SciML/LinearSolve.jl). Any [LinearSolve.jl algorithm](https://docs.sciml.ai/LinearSolve/stable/solvers/solvers/) can be used as the linear solver simply by passing the algorithm choice to -linsolve. For example, the following tells `TRBDF2` to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl) +linsolve. For example, the following tells `TRBDF2` (from +`OrdinaryDiffEqSDIRK`) to use [KLU.jl](https://github.com/JuliaSparse/KLU.jl) +(via `KLUFactorization` from `LinearSolve`): ```julia +using OrdinaryDiffEqSDIRK: TRBDF2 +using LinearSolve: KLUFactorization TRBDF2(linsolve = KLUFactorization()) ``` @@ -41,7 +45,8 @@ can be used as a left or right preconditioner. Preconditioners are configured on object itself, through LinearSolve's `Pl` / `Pr` interface. For example: ```julia -using LinearSolve +using LinearSolve # KrylovJL_GMRES +using OrdinaryDiffEqSDIRK: TRBDF2 alg = TRBDF2(linsolve = KrylovJL_GMRES(precs = mypreconditioner)) ``` diff --git a/docs/src/features/low_dep.md b/docs/src/features/low_dep.md index 279e8c233..f6a3af73b 100644 --- a/docs/src/features/low_dep.md +++ b/docs/src/features/low_dep.md @@ -102,12 +102,15 @@ so there is no issue here! For the add-on packages, you will normally need SciMLBase, the solver package you choose, and the add-on package. So for example, for predefined callbacks you -would likely want SciMLBase+OrdinaryDiffEq+DiffEqCallbacks. If you aren't sure -which package a specific command is from, then use `@which`. For example, from -the callback docs we have: +would likely want SciMLBase+OrdinaryDiffEq+DiffEqCallbacks. For example, the +callback `ProbIntsUncertainty` lives in `DiffEqCallbacks` and the explicit Euler +solver lives in `OrdinaryDiffEqLowOrderRK`, so this fully-explicit form replaces +the old `using DifferentialEquations` shape: ```@example low_dep_1 -import DifferentialEquations as DE +import OrdinaryDiffEq as ODE +import OrdinaryDiffEqLowOrderRK as ODELow # Euler +import DiffEqCallbacks as CB # ProbIntsUncertainty function fitz(du, u, p, t) V, R = u a, b, c = p @@ -117,41 +120,21 @@ end u0 = [-1.0; 1.0] tspan = (0.0, 20.0) p = (0.2, 0.2, 3.0) -prob = DE.ODEProblem(fitz, u0, tspan, p) -cb = DE.ProbIntsUncertainty(0.2, 1) -ensemble_prob = DE.EnsembleProblem(prob) -sim = DE.solve(ensemble_prob, DE.Euler(), trajectories = 100, callback = cb, dt = 1 / 10) +prob = ODE.ODEProblem(fitz, u0, tspan, p) +cb = CB.ProbIntsUncertainty(0.2, 1) +ensemble_prob = ODE.EnsembleProblem(prob) +sim = ODE.solve(ensemble_prob, ODELow.Euler(), trajectories = 100, callback = cb, dt = 1 / 10) ``` -If we wanted to know where `ProbIntsUncertainty(0.2,1)` came from, we can do: +If you encounter an unfamiliar name and want to discover which package owns it, +use `@which`: ```@example low_dep_1 import InteractiveUtils # hide -InteractiveUtils.@which DE.ProbIntsUncertainty(0.2, 1) -``` - -This says it's in the DiffEqCallbacks.jl package. Thus in this case, we could have -done - -```@example low_dep_2 -import OrdinaryDiffEq as ODE, DiffEqCallbacks as CB -function fitz(du, u, p, t) - V, R = u - a, b, c = p - du[1] = c * (V - V^3 / 3 + R) - du[2] = -(1 / c) * (V - a - b * R) -end -u0 = [-1.0; 1.0] -tspan = (0.0, 20.0) -p = (0.2, 0.2, 3.0) -prob = ODE.ODEProblem(fitz, u0, tspan, p) -cb = CB.ProbIntsUncertainty(0.2, 1) -ensemble_prob = ODE.EnsembleProblem(prob) -sim = ODE.solve(ensemble_prob, ODE.Euler(), trajectories = 100, callback = cb, dt = 1 / 10) +InteractiveUtils.@which CB.ProbIntsUncertainty(0.2, 1) ``` -instead of the full `using DifferentialEquations`. Note that due to the way -Julia dependencies work, any internal function in the package will work. The only -dependencies you need to explicitly `using` are the functions you are specifically -calling. Thus, this method can be used to determine all of the DiffEq packages -you are using. +Note that due to the way Julia dependencies work, any internal function in the +package will work. The only dependencies you need to explicitly `using` are the +functions you are specifically calling. Thus, this method can be used to +determine all of the DiffEq packages you are using. diff --git a/docs/src/features/verbosity.md b/docs/src/features/verbosity.md index 9c24d6ff4..d1b13cc1b 100644 --- a/docs/src/features/verbosity.md +++ b/docs/src/features/verbosity.md @@ -33,6 +33,7 @@ When using auto-switching algorithms, see when and why switches occur: ```julia using ODEProblemLibrary: prob_ode_vanderpol_stiff +using OrdinaryDiffEqRosenbrock: Rodas5 verbose = DEVerbosity(alg_switch = SciMLLogging.InfoLevel()) sol = solve(prob_ode_vanderpol_stiff, AutoTsit5(Rodas5()), verbose = verbose) @@ -110,6 +111,7 @@ The simplest approach is to pass a SciMLLogging preset, which is automatically c ```julia using OrdinaryDiffEqNonlinearSolve: NonlinearSolveAlg +using OrdinaryDiffEqSDIRK: ImplicitEuler # Enable detailed nonlinear solver diagnostics verbose = DEVerbosity(nonlinear_verbosity = SciMLLogging.Detailed()) diff --git a/docs/src/getting_started.md b/docs/src/getting_started.md index 471fa31b3..4d2c7905b 100644 --- a/docs/src/getting_started.md +++ b/docs/src/getting_started.md @@ -163,18 +163,39 @@ nothing # hide In DifferentialEquations.jl, some good “go-to” choices for ODEs are: - - `AutoTsit5(Rosenbrock23())` handles both stiff and non-stiff equations. This + - `OrdinaryDiffEqTsit5.AutoTsit5(OrdinaryDiffEqRosenbrock.Rosenbrock23())` handles both stiff and non-stiff equations. This is a good algorithm to use if you know nothing about the equation. - - `AutoVern7(Rodas5())` handles both stiff and non-stiff equations in a way that's + - `OrdinaryDiffEqVerner.AutoVern7(OrdinaryDiffEqRosenbrock.Rodas5P())` handles both stiff and non-stiff equations in a way that's efficient for high accuracy. - - `DE.Tsit5()` for standard non-stiff. This is the first algorithm to try in + - `OrdinaryDiffEqTsit5.Tsit5()` for standard non-stiff. This is the first algorithm to try in most cases. - - `BS3()` for fast low accuracy non-stiff. - - `Vern7()` for high accuracy non-stiff. - - `Rodas4()` or `Rodas5()` for small stiff equations with Julia-defined types, events, etc. - - `KenCarp4()` or `TRBDF2()` for medium-sized (100-2000 ODEs) stiff equations - - `RadauIIA5()` for really high accuracy stiff equations - - `QNDF()` for large stiff equations + - `OrdinaryDiffEqLowOrderRK.BS3()` for fast low accuracy non-stiff. + - `OrdinaryDiffEqVerner.Vern7()` for high accuracy non-stiff. + - `OrdinaryDiffEqRosenbrock.Rodas4()` or `OrdinaryDiffEqRosenbrock.Rodas5P()` for small stiff equations with Julia-defined types, events, etc. + - `OrdinaryDiffEqSDIRK.KenCarp4()` or `OrdinaryDiffEqSDIRK.TRBDF2()` for medium-sized (100-2000 ODEs) stiff equations + - `OrdinaryDiffEqFIRK.RadauIIA5()` for really high accuracy stiff equations + - `OrdinaryDiffEqBDF.QNDF()` for large stiff equations + +!!! note "v8: which package supplies each solver" + + Under DifferentialEquations.jl v8, the umbrella `using DifferentialEquations` + only re-exports `OrdinaryDiffEq`'s **default solver set**: `Tsit5`, + `Vern6`–`Vern9`, `AutoTsit5`, `AutoVern6`–`AutoVern9`, `Rosenbrock23`, + `Rodas5P`, `FBDF`, and `DefaultODEAlgorithm`. The other recommendations + above must be imported from their host sublibrary (these are sublibs of + OrdinaryDiffEq, so a `using OrdinaryDiffEq` plus the right + `using OrdinaryDiffEqXxx` will give you everything): + + | Solver(s) | Sublibrary | + |--------------------------------------------|-----------------------------| + | `BS3`, `RK4`, `Heun`, `Euler`, ... | `OrdinaryDiffEqLowOrderRK` | + | `Rodas4`, `Rodas5`, `ROS3P`, all Rosenbrock except `Rosenbrock23` / `Rodas5P` | `OrdinaryDiffEqRosenbrock` | + | `KenCarp3`, `KenCarp4`, `TRBDF2`, `Kvaerno*`, `ImplicitEuler`, ... | `OrdinaryDiffEqSDIRK` | + | `RadauIIA3`, `RadauIIA5`, `RadauIIA9` | `OrdinaryDiffEqFIRK` | + | `QNDF`, `QBDF`, `ABDF2`, `MEBDF2`, `DFBDF`, `DABDF2`, `DImplicitEuler`, `IMEXEuler`, `SBDF*` | `OrdinaryDiffEqBDF` | + | `DPRKN*`, `Nystrom*`, `ERKN*` | `OrdinaryDiffEqRKN` | + | `KahanLi*`, `McAte*`, `VelocityVerlet`, `SymplecticEuler`, ... | `OrdinaryDiffEqSymplecticRK` | + | `LinearExponential`, `Magnus*`, `LieRK4`, `RKMK*` | `OrdinaryDiffEqLinear` | For a comprehensive list of the available algorithms and detailed recommendations, [please see the solver documentation](@ref ode_solve). Every problem diff --git a/docs/src/solvers/bvp_solve.md b/docs/src/solvers/bvp_solve.md index 20889bc45..670553193 100644 --- a/docs/src/solvers/bvp_solve.md +++ b/docs/src/solvers/bvp_solve.md @@ -8,6 +8,21 @@ solve(prob::SecondOrderBVProblem, alg, dt; kwargs) Solves the BVP defined by `prob` using the algorithm `alg`. All algorithms except `Shooting` and `MultipleShooting` methods should specify a `dt` which is the step size for the discretized mesh. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `BoundaryValueDiffEqShooting` | `Shooting`, `MultipleShooting` | Fastest when not too stiff. | +| `BoundaryValueDiffEqMIRK` | MIRK2/3/4/5/6 (sparse Jacobians) | Default BVP workhorse; robust on standard two-point BVPs. | +| `BoundaryValueDiffEqFIRK` | RadauIIa1/2/3/5/7, LobattoIIIa/b/c | Stiff or high-precision BVPs (fully-implicit RK). | +| `BoundaryValueDiffEqAscher` | Ascher1/2/3/4/5/6/7 | Index-1 DAEs and mixed-order / stiff BVPs. | +| `BoundaryValueDiffEqMIRKN` | MIRK-N methods | Second-order BVPs (e.g. structural / mechanics). | +| `SimpleBoundaryValueDiffEq` | SimpleMIRK*, SimpleShooting | Lightweight BVP shooting; minimal dependencies. | +| `ODEInterface` | `BVPM2`, `BVPSOL` | Fortran BVP wrappers from ODEInterface.jl. | + + ## Recommended Methods The `MIRK` methods are recommended in most scenarios given their improved stability properties over the other methods. They have adaptivty and sparsity handling which allows for them to handle large-scale and difficult problems. However, they are not compatible with callbacks / event handling (i.e. discontinuities), and in such cases [Shooting methods](https://en.wikipedia.org/wiki/Shooting_method) are required. There are single shooting methods and multiple shooting methods available in BoundaryValueDiffEq.jl. Shooting methods should be used with an appropriate ODE solver such as `Shooting(Tsit5())` or `MultipleShooting(5, FBDF())`. Additionally, @@ -17,73 +32,99 @@ in many cases, single shooting method `Shooting` may be faster than collocation ### BoundaryValueDiffEq.jl +!!! note "v8: BoundaryValueDiffEq must be loaded explicitly" + + Under DifferentialEquations.jl v8 the `using DifferentialEquations` + umbrella only re-exports `OrdinaryDiffEq`. The BVP solvers below come from + `BoundaryValueDiffEq.jl` (and its sublibraries). Either load the umbrella + + ```julia + using BoundaryValueDiffEq # MIRK*, Shooting, MultipleShooting, + # RadauIIa*, LobattoIIIa/b/c*, Ascher*, + # MIRKN*, BVPJacobianAlgorithm + ``` + + or, for tighter compile times, just the relevant sublibrary: + + | Method family | Sublibrary | + |------------------------------------------------------------|-------------------------------------| + | `Shooting`, `MultipleShooting` | `BoundaryValueDiffEqShooting` | + | `MIRK2`–`MIRK6` | `BoundaryValueDiffEqMIRK` | + | `MIRKN4`, `MIRKN6` | `BoundaryValueDiffEqMIRKN` | + | `LobattoIIIa*`, `LobattoIIIb*`, `LobattoIIIc*`, `RadauIIa*` | `BoundaryValueDiffEqFIRK` | + | `Ascher1`–`Ascher7` (BVDAE) | `BoundaryValueDiffEqAscher` | + | `BVPM2`, `BVPSOL`, `COLNEW` (Fortran wrappers) | `BoundaryValueDiffEq` + `ODEInterface` | + + Shooting / `MultipleShooting` also need an OrdinaryDiffEq inner solver, e.g. + `Shooting(Tsit5())` requires `using OrdinaryDiffEqTsit5: Tsit5`. + #### Shooting Methods - - `Shooting(odealg())` - A wrapper over initial value problem solvers, it reduces BVP to an initial value problem and solves the IVP. - - `MultipleShooting(N, odealg())` - A wrapper over initial value problem solvers, it reduces BVP to `N` initial value problems and solves these IVPs. Multiple Shooting usually maintains more numerical stability than Single Shooting. + - `BoundaryValueDiffEqShooting.Shooting(odealg())` - A wrapper over initial value problem solvers, it reduces BVP to an initial value problem and solves the IVP. + - `BoundaryValueDiffEqShooting.MultipleShooting(N, odealg())` - A wrapper over initial value problem solvers, it reduces BVP to `N` initial value problems and solves these IVPs. Multiple Shooting usually maintains more numerical stability than Single Shooting. #### MIRK(Monotonic Implicit Runge-Kutta) Methods All `MIRK` methods have defect control adaptivity by default which adapts the mesh (`dt`) automatically. This can be turned off via the keyword argument `adaptive = false`. - - `MIRK2` - A 2nd order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. - - `MIRK3` - A 3rd order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. - - `MIRK4` - A 4th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. - - `MIRK5` - A 5th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. - - `MIRK6` - A 6th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. + - `BoundaryValueDiffEqMIRK.MIRK2` - A 2nd order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. + - `BoundaryValueDiffEqMIRK.MIRK3` - A 3rd order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. + - `BoundaryValueDiffEqMIRK.MIRK4` - A 4th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. + - `BoundaryValueDiffEqMIRK.MIRK5` - A 5th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. + - `BoundaryValueDiffEqMIRK.MIRK6` - A 6th order collocation method using an implicit Runge-Kutta tableau with a sparse Jacobian. #### FIRK(Fully Implicit Runge-Kutta) methods Similar to `MIRK` methods, fully implicit Runge-Kutta methods construct nonlinear problems from the collocation equations of a BVP and solve such nonlinear systems to obtain numerical solutions of BVP. When solving large boundary value problems, choose a nested NonlinearSolve.jl solver by setting `nested_nlsolve=true` in FIRK solvers can achieve better performance. - - `LobattoIIIa2` - A 2nd stage LobattoIIIa collocation method. - - - `LobattoIIIa3` - A 3rd stage LobattoIIIa collocation method. - - `LobattoIIIa4` - A 4th stage LobattoIIIa collocation method. - - `LobattoIIIa5` - A 5th stage LobattoIIIa collocation method. - - `LobattoIIIb2` - A 2nd stage LobattoIIIa collocation method, doesn't support defect control adaptivity. - - `LobattoIIIb3` - A 3rd stage LobattoIIIa collocation method. - - `LobattoIIIb4` - A 4th stage LobattoIIIa collocation method. - - `LobattoIIIb5` - A 5th stage LobattoIIIa collocation method. - - `LobattoIIIc2` - A 2nd stage LobattoIIIa collocation method, doesn't support defect control adaptivity. - - `LobattoIIIc3` - A 3rd stage LobattoIIIa collocation method. - - `LobattoIIIc4` - A 4th stage LobattoIIIa collocation method. - - `LobattoIIIc5` - A 5th stage LobattoIIIa collocation method. - - `RadauIIa1` - A 1st stage Radau collocation method, doesn't support defect control adaptivity. - - `RadauIIa2` - A 2nd stage Radau collocation method. - - `RadauIIa3` - A 3rd stage Radau collocation method. - - `RadauIIa5` - A 5th stage Radau collocation method. - - `RadauIIa7` - A 7th stage Radau collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIa2` - A 2nd stage LobattoIIIa collocation method. + + - `BoundaryValueDiffEqFIRK.LobattoIIIa3` - A 3rd stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIa4` - A 4th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIa5` - A 5th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIb2` - A 2nd stage LobattoIIIa collocation method, doesn't support defect control adaptivity. + - `BoundaryValueDiffEqFIRK.LobattoIIIb3` - A 3rd stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIb4` - A 4th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIb5` - A 5th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIc2` - A 2nd stage LobattoIIIa collocation method, doesn't support defect control adaptivity. + - `BoundaryValueDiffEqFIRK.LobattoIIIc3` - A 3rd stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIc4` - A 4th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.LobattoIIIc5` - A 5th stage LobattoIIIa collocation method. + - `BoundaryValueDiffEqFIRK.RadauIIa1` - A 1st stage Radau collocation method, doesn't support defect control adaptivity. + - `BoundaryValueDiffEqFIRK.RadauIIa2` - A 2nd stage Radau collocation method. + - `BoundaryValueDiffEqFIRK.RadauIIa3` - A 3rd stage Radau collocation method. + - `BoundaryValueDiffEqFIRK.RadauIIa5` - A 5th stage Radau collocation method. + - `BoundaryValueDiffEqFIRK.RadauIIa7` - A 7th stage Radau collocation method. #### Gauss Legendre collocation methods The `Ascher` collocation methods are similar with `MIRK` and `FIRK` methods but have extension for BVDAE prblem solving, the error control is based on instead of defect control adaptivity. - - `Ascher1` - A 1st stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher2` - A 2nd stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher3` - A 3rd stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher4` - A 4th stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher5` - A 5th stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher6` - A 6th stage Gauss Legendre collocation method with Ascher's error control adaptivity. - - `Ascher7` - A 7th stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher1` - A 1st stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher2` - A 2nd stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher3` - A 3rd stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher4` - A 4th stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher5` - A 5th stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher6` - A 6th stage Gauss Legendre collocation method with Ascher's error control adaptivity. + - `BoundaryValueDiffEqAscher.Ascher7` - A 7th stage Gauss Legendre collocation method with Ascher's error control adaptivity. #### MIRKN(Monotonic Implicit Runge-Kutta-Nystöm) methods - - `MIRKN4` - A 4th order collocation method using an implicit Runge-Kutta-Nyström tableau without defect control adaptivity. - - `MIRKN6` - A 6th order collocation method using an implicit Runge-Kutta-Nyström tableau without defect control adaptivity. + - `BoundaryValueDiffEqMIRKN.MIRKN4` - A 4th order collocation method using an implicit Runge-Kutta-Nyström tableau without defect control adaptivity. + - `BoundaryValueDiffEqMIRKN.MIRKN6` - A 6th order collocation method using an implicit Runge-Kutta-Nyström tableau without defect control adaptivity. ### SimpleBoundaryValueDiffEq.jl - - `SimpleMIRK4` - A simplified 4th order collocation method using an implicit Runge-Kutta tableau. - - `SimpleMIRK5` - A simplified 5th order collocation method using an implicit Runge-Kutta tableau. - - `SimpleMIRK6` - A simplified 6th order collocation method using an implicit Runge-Kutta tableau. - - `SimpleShooting` - A simplified single Shooting method. + - `SimpleBoundaryValueDiffEq.SimpleMIRK4` - A simplified 4th order collocation method using an implicit Runge-Kutta tableau. + - `SimpleBoundaryValueDiffEq.SimpleMIRK5` - A simplified 5th order collocation method using an implicit Runge-Kutta tableau. + - `SimpleBoundaryValueDiffEq.SimpleMIRK6` - A simplified 6th order collocation method using an implicit Runge-Kutta tableau. + - `SimpleBoundaryValueDiffEq.SimpleShooting` - A simplified single Shooting method. ### ODEInterface.jl ODEInterface.jl can be used seamlessly with BoundaryValueDiffEq.jl, after we define our model using `BVProblem` or `TwoPointBVProblem`, we can directly call the solvers from ODEInterface.jl. - - `BVPM2` - FORTRAN code for solving two-point boundary value problems. `BVPM2` is only compatible with `TwoPointBVProblem`. - - `BVPSOL` - FORTRAN77 code which solves highly nonlinear two point boundary value problems using a local linear solver (condensing algorithm) or a global sparse linear solver for the solution of the arising linear subproblems, by Peter Deuflhard, Georg Bader, Lutz Weimann. `BVPSOL` should be used with `TwoPointBVProblem` and initial guess. - - `COLNEW` - A Fortran77 code solves a multi-points boundary value problems for a mixed order system of ODEs by Uri Ascher and Georg Bader. It incorporates a new basis representation replacing b-splines, and improvements for the linear and nonlinear algebraic equation solvers. `COLNEW` support `TwoPointBVProblem` by default. To solve multi-points BVP using `COLNEW`, special form of multi-points boundary conditions should be provided by `COLNEW(bc_func, dbc_func, zeta)` where `bc_func(i, z, res)` is the multi-points boundary conditions, `dbc_func(i, z, dbc)` is the i-th row of jacobian of boundary conditions. + - `ODEInterface.BVPM2` - FORTRAN code for solving two-point boundary value problems. `BVPM2` is only compatible with `TwoPointBVProblem`. + - `ODEInterface.BVPSOL` - FORTRAN77 code which solves highly nonlinear two point boundary value problems using a local linear solver (condensing algorithm) or a global sparse linear solver for the solution of the arising linear subproblems, by Peter Deuflhard, Georg Bader, Lutz Weimann. `BVPSOL` should be used with `TwoPointBVProblem` and initial guess. + - `ODEInterface.COLNEW` - A Fortran77 code solves a multi-points boundary value problems for a mixed order system of ODEs by Uri Ascher and Georg Bader. It incorporates a new basis representation replacing b-splines, and improvements for the linear and nonlinear algebraic equation solvers. `COLNEW` support `TwoPointBVProblem` by default. To solve multi-points BVP using `COLNEW`, special form of multi-points boundary conditions should be provided by `COLNEW(bc_func, dbc_func, zeta)` where `bc_func(i, z, res)` is the multi-points boundary conditions, `dbc_func(i, z, dbc)` is the i-th row of jacobian of boundary conditions. diff --git a/docs/src/solvers/dae_solve.md b/docs/src/solvers/dae_solve.md index cbbde88de..6362d1158 100644 --- a/docs/src/solvers/dae_solve.md +++ b/docs/src/solvers/dae_solve.md @@ -1,5 +1,23 @@ # Mass Matrix and Fully Implicit DAE Solvers +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqBDF` | FBDF, QNDF, ABDF2, SBDF, DFBDF, DImplicitEuler | Stiff large/sparse mass-matrix or implicit-form DAEs. | +| `OrdinaryDiffEqRosenbrock` | Rosenbrock23, Rodas4/5P, ROS variants | Stiff small-to-medium index-1 mass-matrix DAEs. | +| `OrdinaryDiffEqSDIRK` | KenCarp3/4/47/58, TRBDF2, ImplicitEuler, Kvaerno | Stiff DAEs with cheap Jacobians; general fallback. | +| `OrdinaryDiffEqFIRK` | RadauIIA3/5/9 | Stiff DAEs needing high precision (1e-10+). | +| `OrdinaryDiffEqNonlinearSolve` | `BrownFullBasicInit`, `ShampineCollocationInit` | DAE consistent-initialization algorithms. | +| `SciMLBase` | `CheckInit`, `NoInit` | Common types and DAE-init policies. | +| `Sundials` | `CVODE_BDF`, `CVODE_Adams`, `IDA`, `ARKODE` | `IDA` for general implicit DAEs; industrial-grade C solvers. | +| `ODEInterfaceDiffEq` | `dopri5`, `dop853`, `radau`, `seulex`, `rodas` | Hairer / Wanner Fortran solvers (radau / rodas for DAEs). | +| `DASSL` | `dassl` | Classical Petzold DASSL Fortran DAE solver direct translation to Julia. | +| `DASKR` | `daskr` | Krylov variant of DASSL for large-scale DAEs. | + + ## Recommended Methods For medium to low accuracy small numbers of DAEs in constant mass matrix form, @@ -24,23 +42,29 @@ but still needs more optimizations. For all OrdinaryDiffEq.jl methods, an initialization scheme can be set with a common keyword argument `initializealg`. The choices are: - - `CheckInit`: Check that the provided initial conditions satisfy the equation; + - `SciMLBase.CheckInit`: Check that the provided initial conditions satisfy the equation; if not, error. This avoids the need for nonlinear solution, as well as avoiding changing the provided initial conditions. - - `BrownFullBasicInit`: For Index-1 DAEs implicit DAEs and semi-explicit + - `OrdinaryDiffEqNonlinearSolve.BrownFullBasicInit`: For Index-1 DAEs implicit DAEs and semi-explicit DAEs in mass matrix form. Keeps the differential variables constant. Requires `du0` when used on a `DAEProblem`. - - `ShampineCollocationInit`: For Index-1 DAEs implicit DAEs and semi-explicit + - `OrdinaryDiffEqNonlinearSolve.ShampineCollocationInit`: For Index-1 DAEs implicit DAEs and semi-explicit DAEs in mass matrix form. Changes both the differential and algebraic variables. - - `NoInit`: Explicitly opts-out of DAE initialization. + - `SciMLBase.NoInit`: Explicitly opts-out of DAE initialization. ### OrdinaryDiffEq.jl (Implicit ODE) These methods from OrdinaryDiffEq are for `DAEProblem` specifications. - - `DImplicitEuler` - 1st order A-L and stiffly stable adaptive implicit Euler - - `DABDF2` - 2nd order A-L stable adaptive BDF method. - - `DFBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, +!!! note "v8: import from `OrdinaryDiffEqBDF`" + + `DImplicitEuler`, `DABDF2`, and `DFBDF` live in + `OrdinaryDiffEqBDF` and are not in `OrdinaryDiffEq`'s default re-export + set under v7. Load them with `using OrdinaryDiffEqBDF`. + + - `OrdinaryDiffEqBDF.DImplicitEuler` - 1st order A-L and stiffly stable adaptive implicit Euler + - `OrdinaryDiffEqBDF.DABDF2` - 2nd order A-L stable adaptive BDF method. + - `OrdinaryDiffEqBDF.DFBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, similar to `ode15i` or `IDA` in divided differences form. ### OrdinaryDiffEq.jl (Mass Matrix) @@ -48,6 +72,19 @@ These methods from OrdinaryDiffEq are for `DAEProblem` specifications. These methods require the DAE to be an `ODEProblem` in mass matrix form. For extra options for the solvers, see the ODE solver page. +!!! note "v8: sublib mapping" + + Under OrdinaryDiffEq v7 only `Rosenbrock23`, `Rodas5P`, and `FBDF` from the + list below are re-exported by the umbrella `OrdinaryDiffEq` package. The + rest must be imported from their host sublib: + + | Section | Sublibrary | + |----------------------------|-----------------------------| + | Rosenbrock / Rosenbrock-W | `OrdinaryDiffEqRosenbrock` | + | FIRK (`RadauIIA5`) | `OrdinaryDiffEqFIRK` | + | SDIRK (`ImplicitEuler`, `ImplicitMidpoint`, `Trapezoid`) | `OrdinaryDiffEqSDIRK` | + | Multistep (`QNDF`, `FBDF`, ...) | `OrdinaryDiffEqBDF` | + !!! note The standard Hermite interpolation used for ODE methods in OrdinaryDiffEq.jl @@ -57,42 +94,42 @@ extra options for the solvers, see the ODE solver page. #### Rosenbrock Methods - - `ROS3P` - 3rd order A-stable and stiffly stable Rosenbrock method. Keeps high + - `OrdinaryDiffEqRosenbrock.ROS3P` - 3rd order A-stable and stiffly stable Rosenbrock method. Keeps high accuracy on discretizations of nonlinear parabolic PDEs. - - `Rodas3` - 3rd order A-stable and stiffly stable Rosenbrock method. - - `RosShamp4`- An A-stable 4th order Rosenbrock method. - - `Veldd4` - A 4th order D-stable Rosenbrock method. - - `Velds4` - A 4th order A-stable Rosenbrock method. - - `GRK4T` - An efficient 4th order Rosenbrock method. - - `GRK4A` - An A-stable 4th order Rosenbrock method. Essentially "anti-L-stable" + - `OrdinaryDiffEqRosenbrock.Rodas3` - 3rd order A-stable and stiffly stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.RosShamp4`- An A-stable 4th order Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Veldd4` - A 4th order D-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Velds4` - A 4th order A-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.GRK4T` - An efficient 4th order Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.GRK4A` - An A-stable 4th order Rosenbrock method. Essentially "anti-L-stable" but efficient. - - `Ros4LStab` - A 4th order L-stable Rosenbrock method. - - `Rodas4` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Ros4LStab` - A 4th order L-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Rodas4` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant - - `Rodas42` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas42` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant - - `Rodas4P` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas4P` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant. 4th order on linear parabolic problems and 3rd order accurate on nonlinear parabolic problems (as opposed to lower if not corrected). - - `Rodas4P2` - A 4th order L-stable stiffly stable Rosenbrock method with a stiff-aware + - `OrdinaryDiffEqRosenbrock.Rodas4P2` - A 4th order L-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant. 4th order on linear parabolic problems and 3rd order accurate on nonlinear parabolic problems. It is an improvement of Roadas4P and in case of inexact Jacobians a second order W method. - - `Rodas5` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware + - `OrdinaryDiffEqRosenbrock.Rodas5` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware 4th order interpolant. - - `Rodas5P` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware + - `OrdinaryDiffEqRosenbrock.Rodas5P` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware 4th order interpolant. Has improved stability in the adaptive time stepping embedding. #### Rosenbrock-W Methods - - `Rosenbrock23` - An Order 2/3 L-Stable Rosenbrock-W method which is good for very stiff equations with oscillations at low tolerances. 2nd order stiff-aware interpolation. - - `Rosenbrock32` - An Order 3/2 A-Stable Rosenbrock-W method which is good for mildly stiff equations without oscillations at low tolerances. Note that this method is prone to instability in the presence of oscillations, so use with caution. 2nd order stiff-aware interpolation. - - `RosenbrockW6S4OS` - A 4th order L-stable Rosenbrock-W method (fixed step only). - - `ROS34PW1a` - A 4th order L-stable Rosenbrock-W method. - - `ROS34PW1b` - A 4th order L-stable Rosenbrock-W method. - - `ROS34PW2` - A 4th order stiffy accurate Rosenbrock-W method for PDAEs. - - `ROS34PW3` - A 4th order strongly A-stable (Rinf~0.63) Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.Rosenbrock23` - An Order 2/3 L-Stable Rosenbrock-W method which is good for very stiff equations with oscillations at low tolerances. 2nd order stiff-aware interpolation. + - `OrdinaryDiffEqRosenbrock.Rosenbrock32` - An Order 3/2 A-Stable Rosenbrock-W method which is good for mildly stiff equations without oscillations at low tolerances. Note that this method is prone to instability in the presence of oscillations, so use with caution. 2nd order stiff-aware interpolation. + - `OrdinaryDiffEqRosenbrock.RosenbrockW6S4OS` - A 4th order L-stable Rosenbrock-W method (fixed step only). + - `OrdinaryDiffEqRosenbrock.ROS34PW1a` - A 4th order L-stable Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.ROS34PW1b` - A 4th order L-stable Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.ROS34PW2` - A 4th order stiffy accurate Rosenbrock-W method for PDAEs. + - `OrdinaryDiffEqRosenbrock.ROS34PW3` - A 4th order strongly A-stable (Rinf~0.63) Rosenbrock-W method. !!! note @@ -101,17 +138,17 @@ extra options for the solvers, see the ODE solver page. #### FIRK Methods - - `RadauIIA5` - An A-B-L stable fully implicit Runge-Kutta method with internal + - `OrdinaryDiffEqFIRK.RadauIIA5` - An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. #### SDIRK Methods - - `ImplicitEuler` - Stage order 1. A-B-L-stable. Adaptive + - `OrdinaryDiffEqSDIRK.ImplicitEuler` - Stage order 1. A-B-L-stable. Adaptive timestepping through a divided differences estimate via memory. Strong-stability preserving (SSP). - - `ImplicitMidpoint` - Stage order 1. Symplectic. Good for when symplectic + - `OrdinaryDiffEqSDIRK.ImplicitMidpoint` - Stage order 1. Symplectic. Good for when symplectic integration is required. - - `Trapezoid` - A second order A-stable symmetric ESDIRK method. "Almost + - `OrdinaryDiffEqSDIRK.Trapezoid` - A second order A-stable symmetric ESDIRK method. "Almost symplectic" without numerical dampening. Also known as Crank-Nicolson when applied to PDEs. Adaptive timestepping via divided differences on the memory. Good for highly stiff equations which are non-oscillatory. @@ -124,21 +161,21 @@ the ideas of the classic EPISODE integrator and early VODE designs. The Fixed Leading Coefficient (FLC) methods match the behavior of the classic VODE and Sundials CVODE integrator. - - `QNDF1` - An adaptive order 1 quasi-constant timestep L-stable numerical + - `OrdinaryDiffEqBDF.QNDF1` - An adaptive order 1 quasi-constant timestep L-stable numerical differentiation function (NDF) method. Optional parameter `kappa` defaults to Shampine's accuracy-optimal `-0.1850`. - - `QBDF1` - An adaptive order 1 L-stable BDF method. This is equivalent to + - `OrdinaryDiffEqBDF.QBDF1` - An adaptive order 1 L-stable BDF method. This is equivalent to implicit Euler but using the BDF error estimator. - - `ABDF2` - An adaptive order 2 L-stable fixed leading coefficient multistep + - `OrdinaryDiffEqBDF.ABDF2` - An adaptive order 2 L-stable fixed leading coefficient multistep BDF method. - - `QNDF2` - An adaptive order 2 quasi-constant timestep L-stable numerical + - `OrdinaryDiffEqBDF.QNDF2` - An adaptive order 2 quasi-constant timestep L-stable numerical differentiation function (NDF) method. - - `QBDF2` - An adaptive order 2 L-stable BDF method using quasi-constant timesteps. - - `QNDF` - An adaptive order quasi-constant timestep NDF method. Utilizes + - `OrdinaryDiffEqBDF.QBDF2` - An adaptive order 2 L-stable BDF method using quasi-constant timesteps. + - `OrdinaryDiffEqBDF.QNDF` - An adaptive order quasi-constant timestep NDF method. Utilizes Shampine's accuracy-optimal `kappa` values as defaults (has a keyword argument for a tuple of `kappa` coefficients). - - `QBDF` - An adaptive order quasi-constant timestep BDF method. - - `FBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, + - `OrdinaryDiffEqBDF.QBDF` - An adaptive order quasi-constant timestep BDF method. + - `OrdinaryDiffEqBDF.FBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, similar to `ode15i` or `CVODE_BDF` in divided differences form. ### [Sundials.jl](@id dae_solve_sundials) @@ -152,7 +189,7 @@ Pkg.add("Sundials") import Sundials ``` - - `IDA`: A fixed-leading coefficient fully implicit BDF method. Efficient for large systems. + - `Sundials.IDA`: A fixed-leading coefficient fully implicit BDF method. Efficient for large systems. For more details on controlling the Sundials.jl solvers, see the [Sundials detailed solver API page](@ref sundials) @@ -168,21 +205,21 @@ Pkg.add("DASKR") import DASKR ``` - - `daskr` - This is a wrapper for the well-known DASKR algorithm. + - `DASKR.daskr` - This is a wrapper for the well-known DASKR algorithm. For more details on controlling the DASKR.jl solvers, see the [DASKR detailed solver API page](@ref daskr) ### DASSL.jl - - `dassl` - A native Julia implementation of the DASSL algorithm. + - `DASSL.dassl` - A native Julia implementation of the DASSL algorithm. ### ODEInterfaceDiffEq.jl These methods require the DAE to be an `ODEProblem` in mass matrix form. For extra options for the solvers, see the ODE solver page. - - `seulex` - Extrapolation-algorithm based on the linear implicit Euler method. - - `radau` - Implicit Runge-Kutta (Radau IIA) of variable order between 5 and 13. - - `radau5` - Implicit Runge-Kutta method (Radau IIA) of order 5. - - `rodas` - Rosenbrock 4(3) method. + - `ODEInterfaceDiffEq.seulex` - Extrapolation-algorithm based on the linear implicit Euler method. + - `ODEInterfaceDiffEq.radau` - Implicit Runge-Kutta (Radau IIA) of variable order between 5 and 13. + - `ODEInterfaceDiffEq.radau5` - Implicit Runge-Kutta method (Radau IIA) of order 5. + - `ODEInterfaceDiffEq.rodas` - Rosenbrock 4(3) method. diff --git a/docs/src/solvers/dde_solve.md b/docs/src/solvers/dde_solve.md index f62b6b71a..eff9372da 100644 --- a/docs/src/solvers/dde_solve.md +++ b/docs/src/solvers/dde_solve.md @@ -5,6 +5,22 @@ Solves the DDE defined by `prob` using the algorithm `alg`. If no algorithm is given, a default algorithm will be chosen. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `DelayDiffEq` | `MethodOfSteps`, `DDEProblem`, `SDDEProblem` | DDE / SDDE driver - pick the inner ODE alg by ODE-style criteria. | +| `OrdinaryDiffEqTsit5` | `Tsit5`, `AutoTsit5` | Default non-stiff inner alg at medium tolerances (1e-3 - 1e-8). | +| `OrdinaryDiffEqVerner` | Vern6/7/8/9, AutoVern (lazy variants) | High-precision non-stiff inner alg (down to 1e-12+). | +| `OrdinaryDiffEqLowOrderRK` | BS3, DP5, RK4, Heun, Euler, OwrenZen | Non-stiff DDE inner alg at loose tolerances. | +| `OrdinaryDiffEqHighOrderRK` | DP8, TanYam7, TsitPap8, PFRK87 | High-order non-stiff inner alg alternatives to Verner. | +| `OrdinaryDiffEqRosenbrock` | Rosenbrock23, Rodas4/5P, ROS variants | Stiff small-to-medium DDEs (mass-matrix). | +| `OrdinaryDiffEqSDIRK` | KenCarp3/4/47/58, TRBDF2, ImplicitEuler, Kvaerno | Stiff DDEs with cheap Jacobians; general fallback. | +| `OrdinaryDiffEqBDF` | FBDF, QNDF, ABDF2, SBDF, DFBDF, DImplicitEuler | Stiff large/sparse DDEs. | + + ## Recommended Methods The recommended method for DDE problems are the `MethodOfSteps` algorithms. @@ -16,6 +32,26 @@ MethodOfSteps(alg; constrained = false, fpsolve = NLFunctional(; max_iter = 10)) where `alg` is an OrdinaryDiffEq.jl algorithm. Most algorithms should work. +!!! note "v8: DelayDiffEq must be loaded explicitly" + + Under DifferentialEquations.jl v8 the `using DifferentialEquations` + umbrella only re-exports `OrdinaryDiffEq`. `MethodOfSteps`, + `DDEProblem`, and the DDE-specific solver paths come from + `DelayDiffEq.jl`; load them with + + ```julia + using DelayDiffEq # MethodOfSteps, DDEProblem + # plus the OrdinaryDiffEq sublib(s) for the inner ODE algorithm, e.g. + using OrdinaryDiffEqTsit5: Tsit5 + alg = MethodOfSteps(Tsit5()) + ``` + + `DelayDiffEq` already `@reexport`s `OrdinaryDiffEq`'s default solver set + (`Tsit5`, `Vern6`–`Vern9`, `Rosenbrock23`, `Rodas5P`, `FBDF`, ...), so + `MethodOfSteps(Tsit5())` works after just `using DelayDiffEq`. Non-default + inner algorithms (`BS3`, `RK4`, `DP8`, `Rodas4`, `Rodas5`, ...) require + pulling in the corresponding `OrdinaryDiffEqXxx` sublib explicitly. + ### Nonstiff DDEs The standard algorithm choice is `MethodOfSteps(Tsit5())`. This is a highly efficient diff --git a/docs/src/solvers/discrete_solve.md b/docs/src/solvers/discrete_solve.md index fb5c1de45..20e15baf0 100644 --- a/docs/src/solvers/discrete_solve.md +++ b/docs/src/solvers/discrete_solve.md @@ -1,5 +1,15 @@ # Discrete Solvers +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqFunctionMap` | `FunctionMap` | Plain discrete iteration `u_{n+1} = f(u_n, p, t_n)` with full callback / saving support. | +| `SimpleDiffEq` | `SimpleATsit5`, `GPUVern7/9`, `SimpleFunctionMap` | Minimal-allocation discrete iteration for tight inner loops. | + + ## DiscreteProblems `solve(prob::DiscreteProblem,alg;kwargs)` @@ -21,7 +31,16 @@ all the extras like callbacks and saving support (but does have an integrator in ### OrdinaryDiffEq.jl - - `FunctionMap`: A basic function map which implements the full common interface. + - `OrdinaryDiffEqFunctionMap.FunctionMap`: A basic function map which implements the full common interface. + +!!! note "v8: import from `OrdinaryDiffEqFunctionMap`" + + `FunctionMap` lives in `OrdinaryDiffEqFunctionMap` and is not part of + OrdinaryDiffEq's default re-export set. Import it via: + + ```julia + using OrdinaryDiffEqFunctionMap # FunctionMap + ``` OrdinaryDiffEq.jl also contains the `FunctionMap` algorithm which lets you It has a piecewise constant interpolation and allows for all the @@ -54,5 +73,5 @@ piecewise constant. ### SimpleDiffEq.jl - - `SimpleFunctionMap`: A bare-bones implementation of a function map. Is optimally-efficient + - `SimpleDiffEq.SimpleFunctionMap`: A bare-bones implementation of a function map. Is optimally-efficient and has an integrator interface version, but does not support callbacks or saving controls. diff --git a/docs/src/solvers/dynamical_solve.md b/docs/src/solvers/dynamical_solve.md index cef38258b..4edb05297 100644 --- a/docs/src/solvers/dynamical_solve.md +++ b/docs/src/solvers/dynamical_solve.md @@ -38,6 +38,17 @@ which require this assumption will lose accuracy if this assumption is violated. Methods listed below make note of this requirement with "Requires quadratic kinetic energy". +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqRKN` | DPRKN6/8/12, ERKN4/5/7, IRKN3/4 | Second-order ODEs (Newtonian mechanics) without first-order conversion. | +| `OrdinaryDiffEqSymplecticRK` | KahanLi6/8, McAte, VelocityVerlet, Yoshida6 | Hamiltonian / conservative dynamics; long-time energy preservation. | +| `GeometricIntegratorsDiffEq` | Gauss, Lobatto, Radau, Symplectic methods | Wrappers for GeometricIntegrators.jl. | + + ## Recommendations When energy conservation is required, use a symplectic method. Otherwise, the @@ -78,59 +89,70 @@ Unless otherwise specified, the OrdinaryDiffEq algorithms all come with a interpolation. For the non-free higher order interpolating functions, the extra steps are computed lazily (i.e. not during the solve). +!!! note "v8: import from the dynamical OrdinaryDiffEq sublibs" + + None of the specialized solvers below are in OrdinaryDiffEq's default + re-export set under v7. Bring them in directly: + + ```julia + using OrdinaryDiffEqRKN # Nystrom*, IRKN*, ERKN*, DPRKN* + using OrdinaryDiffEqSymplecticRK # SymplecticEuler, VelocityVerlet, ... + # McAte*, KahanLi6, KahanLi8, SofSpa10 + ``` + ### Runge-Kutta-Nyström Integrators - - `Nystrom4`: 4th order explicit Runge-Kutta-Nyström method. Allows acceleration + - `OrdinaryDiffEqRKN.Nystrom4`: 4th order explicit Runge-Kutta-Nyström method. Allows acceleration to depend on velocity. Fixed timestep only. - - `IRKN3`: 4th order explicit two-step Runge-Kutta-Nyström method. Fixed + - `OrdinaryDiffEqRKN.IRKN3`: 4th order explicit two-step Runge-Kutta-Nyström method. Fixed timestep only. - - `IRKN4`: 4th order explicit two-step Runge-Kutta-Nyström method. Can be more + - `OrdinaryDiffEqRKN.IRKN4`: 4th order explicit two-step Runge-Kutta-Nyström method. Can be more efficient for smooth problems. Fixed timestep only. - - `ERKN4`: 4th order Runge-Kutta-Nyström method which integrates the periodic + - `OrdinaryDiffEqRKN.ERKN4`: 4th order Runge-Kutta-Nyström method which integrates the periodic properties of the harmonic oscillator exactly. Gets extra efficiency on periodic problems. - - `ERKN5`: 5th order Runge-Kutta-Nyström method which integrates the periodic + - `OrdinaryDiffEqRKN.ERKN5`: 5th order Runge-Kutta-Nyström method which integrates the periodic properties of the harmonic oscillator exactly. Gets extra efficiency on periodic problems. - - `ERKN7`: 7th order Runge-Kutta-Nyström method which integrates the periodic + - `OrdinaryDiffEqRKN.ERKN7`: 7th order Runge-Kutta-Nyström method which integrates the periodic properties of the harmonic oscillator exactly. Gets extra efficiency on periodic problems. - - `Nystrom4VelocityIndependent`: 4th order explicit Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.Nystrom4VelocityIndependent`: 4th order explicit Runge-Kutta-Nyström method. Fixed timestep only. - - `Nystrom5VelocityIndependent`: 5th order explicit Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.Nystrom5VelocityIndependent`: 5th order explicit Runge-Kutta-Nyström method. Fixed timestep only. - - `DPRKN4`: 4th order explicit adaptive Runge-Kutta-Nyström method. - - `DPRKN5`: 5th order explicit adaptive Runge-Kutta-Nyström method. - - `DPRKN6`: 6th order explicit adaptive Runge-Kutta-Nyström method. Free 6th + - `OrdinaryDiffEqRKN.DPRKN4`: 4th order explicit adaptive Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.DPRKN5`: 5th order explicit adaptive Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.DPRKN6`: 6th order explicit adaptive Runge-Kutta-Nyström method. Free 6th order interpolant. - - `DPRKN6FM`: 6th order explicit adaptive Runge-Kutta-Nyström method. - - `DPRKN8`: 8th order explicit adaptive Runge-Kutta-Nyström method. - - `DPRKN12`: 12th order explicit adaptive Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.DPRKN6FM`: 6th order explicit adaptive Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.DPRKN8`: 8th order explicit adaptive Runge-Kutta-Nyström method. + - `OrdinaryDiffEqRKN.DPRKN12`: 12th order explicit adaptive Runge-Kutta-Nyström method. ### Symplectic Integrators Note that all symplectic integrators are fixed timestep only. - - `SymplecticEuler`: First order explicit symplectic integrator - - `VelocityVerlet`: 2nd order explicit symplectic integrator. Requires `f_2(t,u) = v`, i.e. + - `OrdinaryDiffEqSymplecticRK.SymplecticEuler`: First order explicit symplectic integrator + - `OrdinaryDiffEqSymplecticRK.VelocityVerlet`: 2nd order explicit symplectic integrator. Requires `f_2(t,u) = v`, i.e. a second order ODE. - - `VerletLeapfrog`: 2nd order explicit symplectic integrator. - - `PseudoVerletLeapfrog`: 2nd order explicit symplectic integrator. - - `McAte2`: Optimized efficiency 2nd order explicit symplectic integrator. - - `Ruth3`: 3rd order explicit symplectic integrator. - - `McAte3`: Optimized efficiency 3rd order explicit symplectic integrator. - - `CandyRoz4`: 4th order explicit symplectic integrator. - - `McAte4`: 4th order explicit symplectic integrator. Requires quadratic + - `OrdinaryDiffEqSymplecticRK.VerletLeapfrog`: 2nd order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.PseudoVerletLeapfrog`: 2nd order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.McAte2`: Optimized efficiency 2nd order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.Ruth3`: 3rd order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.McAte3`: Optimized efficiency 3rd order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.CandyRoz4`: 4th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.McAte4`: 4th order explicit symplectic integrator. Requires quadratic kinetic energy. - - `CalvoSanz4`: Optimized efficiency 4th order explicit symplectic integrator. - - `McAte42`: 4th order explicit symplectic integrator. (Broken) - - `McAte5`: Optimized efficiency 5th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.CalvoSanz4`: Optimized efficiency 4th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.McAte42`: 4th order explicit symplectic integrator. (Broken) + - `OrdinaryDiffEqSymplecticRK.McAte5`: Optimized efficiency 5th order explicit symplectic integrator. Requires quadratic kinetic energy. - - `Yoshida6`: 6th order explicit symplectic integrator. - - `KahanLi6`: Optimized efficiency 6th order explicit symplectic integrator. - - `McAte8`: 8th order explicit symplectic integrator. - - `KahanLi8`: Optimized efficiency 8th order explicit symplectic integrator. - - `SofSpa10`: 10th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.Yoshida6`: 6th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.KahanLi6`: Optimized efficiency 6th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.McAte8`: 8th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.KahanLi8`: Optimized efficiency 8th order explicit symplectic integrator. + - `OrdinaryDiffEqSymplecticRK.SofSpa10`: 10th order explicit symplectic integrator. ### GeometricIntegrators.jl @@ -144,7 +166,7 @@ Pkg.clone("https://github.com/SciML/GeometricIntegratorsDiffEq.jl") import GeometricIntegratorsDiffEq ``` - - `GISymplecticEulerA` - First order explicit symplectic Euler A - - `GISymplecticEulerB` - First order explicit symplectic Euler B - - `GILobattoIIIAIIIB(n)` - Nth order Gauss-Labatto-IIIA-IIIB - - `GILobattoIIIBIIIA(n)` - Nth order Gauss-Labatto-IIIB-IIIA + - `GeometricIntegratorsDiffEq.GISymplecticEulerA` - First order explicit symplectic Euler A + - `GeometricIntegratorsDiffEq.GISymplecticEulerB` - First order explicit symplectic Euler B + - `GeometricIntegratorsDiffEq.GILobattoIIIAIIIB(n)` - Nth order Gauss-Labatto-IIIA-IIIB + - `GeometricIntegratorsDiffEq.GILobattoIIIBIIIA(n)` - Nth order Gauss-Labatto-IIIB-IIIA diff --git a/docs/src/solvers/nonautonomous_linear_ode.md b/docs/src/solvers/nonautonomous_linear_ode.md index bd2eedef1..65eb2ca72 100644 --- a/docs/src/solvers/nonautonomous_linear_ode.md +++ b/docs/src/solvers/nonautonomous_linear_ode.md @@ -28,6 +28,15 @@ u^\prime = Au where ``A`` is a constant operator. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqLinear` | Magnus, Lie-group, matrix-exponential methods | Linear time-dependent ODEs; matrix-exponential propagation. | + + ## Recommendations It is recommended to always specialize on the properties of the operator as much as possible. @@ -48,11 +57,21 @@ steps are computed lazily (i.e. not during the solve). Note that all of these methods are fixed timestep unless otherwise specified. +!!! note "v8: import from `OrdinaryDiffEqLinear`" + + `LinearExponential`, all `Magnus*`, all `RKMK*`, `LieEuler` / `LieRK4`, + `CayleyEuler`, `CG*`, etc. live in `OrdinaryDiffEqLinear` (a sublib of + OrdinaryDiffEq). Bring them in with: + + ```julia + using OrdinaryDiffEqLinear + ``` + ### Exponential Methods for Linear and Affine Problems These methods require that ``A`` is constant. - - `LinearExponential` - Exact solution formula for linear, time-independent problems. + - `OrdinaryDiffEqLinear.LinearExponential` - Exact solution formula for linear, time-independent problems. Options: @@ -70,11 +89,13 @@ Options: then the Lanczos algorithm will always be used and the IOP setting is ignored. ```@example linear_ode -import DifferentialEquations as DE, SciMLOperators +import DifferentialEquations as DE +import OrdinaryDiffEqLinear as ODELinear # LinearExponential, Magnus*, LieRK4, ... +import SciMLOperators _A = [2 -1; -3 -5] / 5 A = SciMLOperators.MatrixOperator(_A) prob = DE.ODEProblem(A, [1.0, -1.0], (1.0, 6.0)) -sol = DE.solve(prob, DE.LinearExponential()) +sol = DE.solve(prob, ODELinear.LinearExponential()) ``` !!! note @@ -89,14 +110,14 @@ sol = DE.solve(prob, DE.LinearExponential()) These methods require ``A`` is only dependent on the independent variable, i.e. ``A(t)``. - - `MagnusMidpoint` - Second order Magnus Midpoint method. - - `MagnusLeapfrog`- Second order Magnus Leapfrog method. - - `MagnusGauss4` - Fourth order Magnus method approximated using a two stage Gauss quadrature. - - `MagnusGL4`- Fourth order Magnus method approximated using Gauss-Legendre quadrature. - - `MagnusNC6`- Sixth order Magnus method approximated using Newton-Cotes quadrature. - - `MagnusGL6`- Sixth order Magnus method approximated using Gauss-Legendre quadrature. - - `MagnusNC8`- Eighth order Magnus method approximated using Newton-Cotes quadrature. - - `MagnusGL8`- Eighth order Magnus method approximated using Gauss-Legendre quadrature. + - `OrdinaryDiffEqLinear.MagnusMidpoint` - Second order Magnus Midpoint method. + - `OrdinaryDiffEqLinear.MagnusLeapfrog`- Second order Magnus Leapfrog method. + - `OrdinaryDiffEqLinear.MagnusGauss4` - Fourth order Magnus method approximated using a two stage Gauss quadrature. + - `OrdinaryDiffEqLinear.MagnusGL4`- Fourth order Magnus method approximated using Gauss-Legendre quadrature. + - `OrdinaryDiffEqLinear.MagnusNC6`- Sixth order Magnus method approximated using Newton-Cotes quadrature. + - `OrdinaryDiffEqLinear.MagnusGL6`- Sixth order Magnus method approximated using Gauss-Legendre quadrature. + - `OrdinaryDiffEqLinear.MagnusNC8`- Eighth order Magnus method approximated using Newton-Cotes quadrature. + - `OrdinaryDiffEqLinear.MagnusGL8`- Eighth order Magnus method approximated using Gauss-Legendre quadrature. Example: @@ -109,7 +130,7 @@ function update_func(A, u, p, t) end A = SciMLOperators.MatrixOperator(ones(2, 2), update_func! = update_func) prob = DE.ODEProblem(A, ones(2), (1.0, 6.0)) -sol = DE.solve(prob, DE.MagnusGL6(), dt = 1 / 10) +sol = DE.solve(prob, ODELinear.MagnusGL6(), dt = 1 / 10) ``` The initial values for ``A`` are irrelevant in this and similar cases, as the `update_func` immediately overwrites them. @@ -119,14 +140,14 @@ Starting with `ones(2,2)` is just a convenient way to get a mutable 2x2 matrix. These methods can be used when ``A`` is dependent on the state variables, i.e. ``A(u)``. - - `CayleyEuler` - First order method using Cayley transformations. - - `LieEuler` - First order Lie Euler method. - - `RKMK2` - Second order Runge–Kutta–Munthe-Kaas method. - - `RKMK4` - Fourth order Runge–Kutta–Munthe-Kaas method. - - `LieRK4` - Fourth order Lie Runge-Kutta method. - - `CG2` - Second order Crouch–Grossman method. - - `CG4a` - Fourth order Crouch-Grossman method. - - `MagnusAdapt4` - Fourth Order Adaptive Magnus method. + - `OrdinaryDiffEqLinear.CayleyEuler` - First order method using Cayley transformations. + - `OrdinaryDiffEqLinear.LieEuler` - First order Lie Euler method. + - `OrdinaryDiffEqLinear.RKMK2` - Second order Runge–Kutta–Munthe-Kaas method. + - `OrdinaryDiffEqLinear.RKMK4` - Fourth order Runge–Kutta–Munthe-Kaas method. + - `OrdinaryDiffEqLinear.LieRK4` - Fourth order Lie Runge-Kutta method. + - `OrdinaryDiffEqLinear.CG2` - Second order Crouch–Grossman method. + - `OrdinaryDiffEqLinear.CG4a` - Fourth order Crouch-Grossman method. + - `OrdinaryDiffEqLinear.MagnusAdapt4` - Fourth Order Adaptive Magnus method. Example: @@ -139,7 +160,7 @@ function update_func(A, u, p, t) end A = SciMLOperators.MatrixOperator(ones(2, 2), update_func! = update_func) prob = DE.ODEProblem(A, ones(2), (0, 30.0)) -sol = DE.solve(prob, DE.LieRK4(), dt = 1 / 4) +sol = DE.solve(prob, ODELinear.LieRK4(), dt = 1 / 4) ``` The above example solves a non-stiff Non-Autonomous Linear ODE @@ -158,13 +179,13 @@ function update_func(A, u, p, t) end A = SciMLOperators.MatrixOperator(ones(2, 2), update_func! = update_func) prob = DE.ODEProblem(A, ones(2), (30, 150.0)) -sol = DE.solve(prob, DE.MagnusAdapt4()) +sol = DE.solve(prob, ODELinear.MagnusAdapt4()) ``` # Time and State-Dependent Operators These methods can be used when ``A`` is dependent on both time and state variables, i.e. ``A(u,t)`` - - `CG3` - Third order Crouch-Grossman method. + - `OrdinaryDiffEqLinear.CG3` - Third order Crouch-Grossman method. [^1]: A description of IOP can be found in this [paper](https://doi.org/10.1016/j.jcp.2018.06.026). diff --git a/docs/src/solvers/ode_solve.md b/docs/src/solvers/ode_solve.md index 6b747c32c..f76716533 100644 --- a/docs/src/solvers/ode_solve.md +++ b/docs/src/solvers/ode_solve.md @@ -5,6 +5,43 @@ Solves the ODE defined by `prob` using the algorithm `alg`. If no algorithm is given, a default algorithm will be chosen. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqDefault` | `DefaultODEAlgorithm` (auto-switching) | General-purpose; auto-detects stiffness and switches. | +| `OrdinaryDiffEqTsit5` | `Tsit5`, `AutoTsit5` | Default non-stiff workhorse at medium tolerances (1e-3 - 1e-8). | +| `OrdinaryDiffEqVerner` | Vern6/7/8/9, AutoVern (lazy variants) | High-precision non-stiff (down to 1e-12+) on smooth RHS. | +| `OrdinaryDiffEqLowOrderRK` | BS3, DP5, RK4, Heun, Euler, OwrenZen | Non-stiff at loose tolerances; quick / one-off / sketches. | +| `OrdinaryDiffEqHighOrderRK` | DP8, TanYam7, TsitPap8, PFRK87 | High-order non-stiff alternatives to Verner. | +| `OrdinaryDiffEqFeagin` | Feagin10, Feagin12, Feagin14 | Very tight tolerances (1e-12 to 1e-30) on smooth non-stiff. | +| `OrdinaryDiffEqExplicitRK` | `ExplicitRK` (user-defined Butcher tableau) | Custom Butcher-tableau methods. | +| `OrdinaryDiffEqLowStorageRK` | CarpenterKennedy2N54, ORK256, etc. | Memory-constrained or large-N (PDE semi-discretization, GPU). | +| `OrdinaryDiffEqSSPRK` | SSPRK22/33/43/104 | Hyperbolic conservation laws / advection-dominated PDEs. | +| `OrdinaryDiffEqPRK` | KuttaPRK2p5 | Parallel explicit RK (multi-stage parallelism). | +| `OrdinaryDiffEqRosenbrock` | Rosenbrock23, Rodas4/5P, ROS variants | Stiff small-to-medium ODEs / index-1 DAEs (mass matrix). | +| `OrdinaryDiffEqSDIRK` | KenCarp3/4/47/58, TRBDF2, ImplicitEuler, Kvaerno | Stiff problems with cheap Jacobians; general stiff fallback. | +| `OrdinaryDiffEqFIRK` | RadauIIA3/5/9 | Stiff problems needing high precision (1e-10+) or very stiff. | +| `OrdinaryDiffEqPDIRK` | PDIRK44 | Diagonally-implicit RK with stage parallelism. | +| `OrdinaryDiffEqBDF` | FBDF, QNDF, ABDF2, SBDF, DFBDF, DImplicitEuler | Stiff large/sparse systems; index-1 DAEs (mass-matrix or implicit). | +| `OrdinaryDiffEqAdamsBashforthMoulton` | AB3-AB5, ABM, VCAB, VCABM | Non-stiff multistep on smooth, expensive RHS evaluations. | +| `OrdinaryDiffEqNordsieck` | AN5, JVODE | Variable-step / variable-order Adams in Nordsieck form. | +| `OrdinaryDiffEqExtrapolation` | ExtrapolationMidpoint, ImplicitHairerWanner, etc. | Smooth problems benefiting from Richardson extrapolation; very high order. | +| `OrdinaryDiffEqStabilizedRK` | ROCK2, ROCK4, RKC, ESERK4/5 | Mildly stiff PDE semi-discretizations (parabolic / reaction-diffusion). | +| `OrdinaryDiffEqExponentialRK` | LawsonEuler, ETDRK4, EPIRK, Exprb | Semilinear problems where the linear operator dominates. | +| `Sundials` | `CVODE_BDF`, `CVODE_Adams`, `IDA`, `ARKODE` | Industrial-grade C BDF / Adams / ARK; `IDA` for general implicit DAEs. | +| `LSODA` | `lsoda` | Classic Fortran auto-switching solver (Hindmarsh). | +| `ODEInterfaceDiffEq` | `dopri5`, `dop853`, `radau`, `seulex`, `rodas` | Hairer / Wanner Fortran solvers. | +| `ProbNumDiffEq` | `EK0`, `EK1` | Probabilistic numerics - get uncertainty estimates on the trajectory. | +| `TaylorIntegration` | `TaylorMethod` | Taylor method - super-high order for very smooth ODEs. | +| `SimpleDiffEq` | `SimpleATsit5`, `GPUVern7/9`, `SimpleFunctionMap` | Minimal-allocation solvers for tight inner loops. | +| `GeometricIntegratorsDiffEq` | Gauss, Lobatto, Radau, Symplectic methods | Wrappers for GeometricIntegrators.jl. | +| `BridgeDiffEq` | `BridgeR3`, `BridgeBS3`, `BridgeEM` | Wrappers for Bridge.jl ODE/SDE solvers. | +| `QuDiffEq` | Quantum-circuit-based ODE solvers | Quantum-circuit-based solvers. | + + ## Recommended Methods It is suggested that you try choosing an algorithm using the `alg_hints` @@ -136,51 +173,88 @@ allow for sophisticated event handling, etc. On stiff ODEs, these algorithms again consistently among the top. OrdinaryDiffEq.jl is recommended for most ODE problems. +!!! note "OrdinaryDiffEq v7 sublibrary structure" + + Starting with OrdinaryDiffEq v7 (released as part of DifferentialEquations.jl + v8), `using OrdinaryDiffEq` only re-exports a small **default solver set** + (`DefaultODEAlgorithm`, `Tsit5`, `AutoTsit5`, `Vern6`–`Vern9`, + `AutoVern6`–`AutoVern9`, `Rosenbrock23`, `Rodas5P`, `FBDF`). Every other + solver lives in a topic-specific sublibrary and must be brought in + explicitly, e.g. `using OrdinaryDiffEqLowOrderRK: BS3, RK4`. The sublibrary + that hosts each family is noted below at the start of each section; you can + also `using OrdinaryDiffEq` to get the umbrella default set plus the + sublibraries you need. + + | Family (section heading) | Host sublibrary | + |-------------------------------------------------------|--------------------------------------------------| + | Explicit Runge-Kutta (low order) | `OrdinaryDiffEqLowOrderRK` | + | Tsit5 / AutoTsit5 | `OrdinaryDiffEqTsit5` (re-exported by main pkg) | + | Verner / AutoVern | `OrdinaryDiffEqVerner` (re-exported by main pkg) | + | High-order RK (Feagin, TanYam7, DP8, ...) | `OrdinaryDiffEqHighOrderRK` | + | Parallel Explicit RK (KuttaPRK2p5) | `OrdinaryDiffEqPRK` | + | SSPRK family | `OrdinaryDiffEqSSPRK` | + | Low-Storage RK | `OrdinaryDiffEqLowStorageRK` | + | Explicit Extrapolation | `OrdinaryDiffEqExtrapolation` | + | Adams-Bashforth / Adaptive Adams | `OrdinaryDiffEqAdamsBashforthMoulton` | + | SDIRK (TRBDF2, KenCarp*, Kvaerno*, ImplicitEuler, ...) | `OrdinaryDiffEqSDIRK` | + | FIRK (RadauIIA*) | `OrdinaryDiffEqFIRK` | + | Parallel DIRK | `OrdinaryDiffEqPDIRK` | + | Rosenbrock / Rosenbrock-W (Rodas4, Rodas5, ROS3*, ...) | `OrdinaryDiffEqRosenbrock` (Rosenbrock23 / Rodas5P re-exported) | + | Stabilized Explicit (ROCK*, RKC, ESERK*, ...) | `OrdinaryDiffEqStabilizedRK` / `OrdinaryDiffEqStabilizedIRK` | + | Implicit Extrapolation | `OrdinaryDiffEqExtrapolation` | + | Exponential RK / EPIRK / Adaptive Exp Rosenbrock | `OrdinaryDiffEqExponentialRK` | + | BDF / FBDF / QNDF / QBDF / DFBDF / DABDF2 / DImplicitEuler / SBDF | `OrdinaryDiffEqBDF` (FBDF re-exported by main pkg) | + | Implicit SSPRK | `OrdinaryDiffEqSSPRK` | + | Function-map / DiscreteProblem default | `OrdinaryDiffEqFunctionMap` | + | Symplectic RK (KahanLi*, McAte*, VelocityVerlet, ...) | `OrdinaryDiffEqSymplecticRK` | + | Runge-Kutta-Nyström (DPRKN*, Nystrom*, ERKN*, IRKN*) | `OrdinaryDiffEqRKN` | + | Default algorithm chooser (`DefaultODEAlgorithm`) | `OrdinaryDiffEqDefault` (re-exported by main pkg) | + #### Explicit Runge-Kutta Methods - - `Euler`- The canonical forward Euler method. Fixed timestep only. - - `Midpoint` - The second order midpoint method. Uses embedded Euler method for + - `OrdinaryDiffEqLowOrderRK.Euler`- The canonical forward Euler method. Fixed timestep only. + - `OrdinaryDiffEqLowOrderRK.Midpoint` - The second order midpoint method. Uses embedded Euler method for adaptivity. - - `Heun` - The second order Heun's method. Uses embedded Euler method for + - `OrdinaryDiffEqLowOrderRK.Heun` - The second order Heun's method. Uses embedded Euler method for adaptivity. - - `Ralston` - The optimized second order midpoint method. Uses embedded Euler + - `OrdinaryDiffEqLowOrderRK.Ralston` - The optimized second order midpoint method. Uses embedded Euler method for adaptivity. - - `RK4` - The canonical Runge-Kutta Order 4 method. Uses a defect control for + - `OrdinaryDiffEqLowOrderRK.RK4` - The canonical Runge-Kutta Order 4 method. Uses a defect control for adaptive stepping using maximum error over the whole interval. - - `BS3` - Bogacki-Shampine 3/2 method. - - `OwrenZen3` - Owren-Zennaro optimized interpolation 3/2 method (free 3rd + - `OrdinaryDiffEqLowOrderRK.BS3` - Bogacki-Shampine 3/2 method. + - `OrdinaryDiffEqLowOrderRK.OwrenZen3` - Owren-Zennaro optimized interpolation 3/2 method (free 3rd order interpolant). - - `OwrenZen4` - Owren-Zennaro optimized interpolation 4/3 method (free 4th + - `OrdinaryDiffEqLowOrderRK.OwrenZen4` - Owren-Zennaro optimized interpolation 4/3 method (free 4th order interpolant). - - `OwrenZen5` - Owren-Zennaro optimized interpolation 5/4 method (free 5th + - `OrdinaryDiffEqLowOrderRK.OwrenZen5` - Owren-Zennaro optimized interpolation 5/4 method (free 5th order interpolant). - - `DP5` - Dormand-Prince's 5/4 Runge-Kutta method. (free 4th order interpolant). - - `Tsit5` - Tsitouras 5/4 Runge-Kutta method. (free 4th order interpolant). - - `Anas5(w)` - 4th order Runge-Kutta method designed for periodic problems. + - `OrdinaryDiffEqLowOrderRK.DP5` - Dormand-Prince's 5/4 Runge-Kutta method. (free 4th order interpolant). + - `OrdinaryDiffEqTsit5.Tsit5` - Tsitouras 5/4 Runge-Kutta method. (free 4th order interpolant). + - `OrdinaryDiffEqLowOrderRK.Anas5(w)` - 4th order Runge-Kutta method designed for periodic problems. Requires a periodicity estimate `w` which when accurate the method becomes 5th order (and is otherwise 4th order with less error for better estimates). - - `FRK65(w=0)` - Zero Dissipation Runge-Kutta of 6th order. Takes an optional + - `OrdinaryDiffEqLowOrderRK.FRK65(w=0)` - Zero Dissipation Runge-Kutta of 6th order. Takes an optional argument `w` to for the periodicity phase, in which case this method results in zero numerical dissipation. - - `PFRK87(w=0)` - Phase-fitted Runge-Kutta of 8th order. Takes an optional + - `OrdinaryDiffEqHighOrderRK.PFRK87(w=0)` - Phase-fitted Runge-Kutta of 8th order. Takes an optional argument `w` to for the periodicity phase, in which case this method results in zero numerical dissipation. - - `RKO65` - Tsitouras' Runge-Kutta-Oliver 6 stage 5th order method. This method is robust on problems + - `OrdinaryDiffEqLowOrderRK.RKO65` - Tsitouras' Runge-Kutta-Oliver 6 stage 5th order method. This method is robust on problems which have a singularity at `t=0`. - - `TanYam7` - Tanaka-Yamashita 7 Runge-Kutta method. - - `DP8` - Hairer's 8/5/3 adaption of the Dormand-Prince Runge-Kutta method. + - `OrdinaryDiffEqHighOrderRK.TanYam7` - Tanaka-Yamashita 7 Runge-Kutta method. + - `OrdinaryDiffEqHighOrderRK.DP8` - Hairer's 8/5/3 adaption of the Dormand-Prince Runge-Kutta method. (7th order interpolant). - - `TsitPap8` - Tsitouras-Papakostas 8/7 Runge-Kutta method. - - `Feagin10` - Feagin's 10th-order Runge-Kutta method. - - `Feagin12` - Feagin's 12th-order Runge-Kutta method. - - `Feagin14` - Feagin's 14th-order Runge-Kutta method. - - `MSRK5` - Stepanov 5th-order Runge-Kutta method. - - `MSRK6` - Stepanov 6th-order Runge-Kutta method. - - `Stepanov5` - Stepanov adaptive 5th-order Runge-Kutta method. - - `SIR54` - 5th order explicit Runge-Kutta method suited for SIR-type epidemic models. - - `Alshina2` - Alshina 2nd-order Runge-Kutta method. - - `Alshina3` - Alshina 3rd-order Runge-Kutta method. - - `Alshina6` - Alshina 6th-order Runge-Kutta method. + - `OrdinaryDiffEqHighOrderRK.TsitPap8` - Tsitouras-Papakostas 8/7 Runge-Kutta method. + - `OrdinaryDiffEqFeagin.Feagin10` - Feagin's 10th-order Runge-Kutta method. + - `OrdinaryDiffEqFeagin.Feagin12` - Feagin's 12th-order Runge-Kutta method. + - `OrdinaryDiffEqFeagin.Feagin14` - Feagin's 14th-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.MSRK5` - Stepanov 5th-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.MSRK6` - Stepanov 6th-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.Stepanov5` - Stepanov adaptive 5th-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.SIR54` - 5th order explicit Runge-Kutta method suited for SIR-type epidemic models. + - `OrdinaryDiffEqLowOrderRK.Alshina2` - Alshina 2nd-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.Alshina3` - Alshina 3rd-order Runge-Kutta method. + - `OrdinaryDiffEqLowOrderRK.Alshina6` - Alshina 6th-order Runge-Kutta method. Example usage: @@ -191,14 +265,14 @@ solve(prob, alg) Additionally, the following algorithms have a lazy interpolant: - - `BS5` - Bogacki-Shampine 5/4 Runge-Kutta method. (lazy 5th order interpolant). - - `Vern6` - Verner's “Most Efficient” 6/5 Runge-Kutta method. (lazy 6th order + - `OrdinaryDiffEqLowOrderRK.BS5` - Bogacki-Shampine 5/4 Runge-Kutta method. (lazy 5th order interpolant). + - `OrdinaryDiffEqVerner.Vern6` - Verner's “Most Efficient” 6/5 Runge-Kutta method. (lazy 6th order interpolant). - - `Vern7` - Verner's “Most Efficient” 7/6 Runge-Kutta method. (lazy 7th order + - `OrdinaryDiffEqVerner.Vern7` - Verner's “Most Efficient” 7/6 Runge-Kutta method. (lazy 7th order interpolant). - - `Vern8` - Verner's “Most Efficient” 8/7 Runge-Kutta method. (lazy 8th order + - `OrdinaryDiffEqVerner.Vern8` - Verner's “Most Efficient” 8/7 Runge-Kutta method. (lazy 8th order interpolant) - - `Vern9` - Verner's “Most Efficient” 9/8 Runge-Kutta method. (lazy 9th order + - `OrdinaryDiffEqVerner.Vern9` - Verner's “Most Efficient” 9/8 Runge-Kutta method. (lazy 9th order interpolant) These methods require a few extra steps in order to compute the high order @@ -217,46 +291,46 @@ solve(prob, Vern7(lazy = Val{false}())) #### Parallel Explicit Runge-Kutta Methods - - `KuttaPRK2p5` - A 5 parallel, 2 processor explicit Runge-Kutta method of 5th order. + - `OrdinaryDiffEqPRK.KuttaPRK2p5` - A 5 parallel, 2 processor explicit Runge-Kutta method of 5th order. These methods utilize multithreading on the `f` calls to parallelize the problem. This requires that simultaneous calls to `f` are thread-safe. #### Explicit Strong-Stability Preserving Runge-Kutta Methods for Hyperbolic PDEs (Conservation Laws) - - `SSPRK22` - The two-stage, second order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK22` - The two-stage, second order strong stability preserving (SSP) method of Shu and Osher (SSP coefficient 1, free 2nd order SSP interpolant). Fixed timestep only. - - `SSPRK33` - The three-stage, third order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK33` - The three-stage, third order strong stability preserving (SSP) method of Shu and Osher (SSP coefficient 1, free 2nd order SSP interpolant). Fixed timestep only. - - `SSPRK53` - The five-stage, third order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK53` - The five-stage, third order strong stability preserving (SSP) method of Ruuth (SSP coefficient 2.65, free 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRK63` - The six-stage, third order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK63` - The six-stage, third order strong stability preserving (SSP) method of Ruuth (SSP coefficient 3.518, free 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRK73` - The seven-stage, third order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK73` - The seven-stage, third order strong stability preserving (SSP) method of Ruuth (SSP coefficient 4.2879, free 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRK83` - The eight-stage, third order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK83` - The eight-stage, third order strong stability preserving (SSP) method of Ruuth (SSP coefficient 5.107, free 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRK432` - A 3/2 adaptive strong stability preserving (SSP) method with + - `OrdinaryDiffEqSSPRK.SSPRK432` - A 3/2 adaptive strong stability preserving (SSP) method with five stages (SSP coefficient 2, free 2nd order SSP interpolant). - - `SSPRK43` - A 3/2 adaptive strong stability preserving (SSP) method with + - `OrdinaryDiffEqSSPRK.SSPRK43` - A 3/2 adaptive strong stability preserving (SSP) method with five stages (SSP coefficient 2, free 2nd order SSP interpolant). The main method is the same as `SSPRK432`, but the embedded method has a larger stability region. - - `SSPRK932` - A 3/2 adaptive strong stability preserving (SSP) method with + - `OrdinaryDiffEqSSPRK.SSPRK932` - A 3/2 adaptive strong stability preserving (SSP) method with nine stages (SSP coefficient 6, free 3rd order Hermite interpolant). - - `SSPRK54` - The five-stage, fourth order strong stability preserving (SSP) + - `OrdinaryDiffEqSSPRK.SSPRK54` - The five-stage, fourth order strong stability preserving (SSP) method of Spiteri and Ruuth (SSP coefficient 1.508, 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRK104` - The ten-stage, fourth order strong stability preserving method + - `OrdinaryDiffEqSSPRK.SSPRK104` - The ten-stage, fourth order strong stability preserving method of Ketcheson (SSP coefficient 6, free 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRKMSVS32` - 3-stage, 2nd order SSP-optimal linear multistep method. + - `OrdinaryDiffEqSSPRK.SSPRKMSVS32` - 3-stage, 2nd order SSP-optimal linear multistep method. (SSP coefficient 0.5, 3rd order Hermite interpolant). Fixed timestep only. - - `SSPRKMSVS43` - 4-stage, 3rd order SSP-optimal linear multistep method. + - `OrdinaryDiffEqSSPRK.SSPRKMSVS43` - 4-stage, 3rd order SSP-optimal linear multistep method. (SSP coefficient 0.33, 3rd order Hermite interpolant). Fixed timestep only. The SSP coefficients of the methods can be queried as `ssp_coefficient(alg)`. @@ -274,94 +348,94 @@ Royal Society, 2011.). #### Low-Storage Methods - - `ORK256` - 5-stage, second order low-storage method for wave propagation + - `OrdinaryDiffEqLowStorageRK.ORK256` - 5-stage, second order low-storage method for wave propagation equations. Fixed timestep only. Like SSPRK methods, ORK256 also takes optional arguments `stage_limiter!`, `step_limiter!`, where `stage_limiter!` and `step_limiter!` are functions of the form `limiter!(u, integrator, p, t)`. - - `SSPRK53_2N1` and `SSPRK53_2N2` - 5-stage, third order low-storage methods + - `OrdinaryDiffEqSSPRK.SSPRK53_2N1` and `SSPRK53_2N2` - 5-stage, third order low-storage methods with large SSP coefficients. (SSP coefficient 2.18 and 2.15, free 3rd order Hermite interpolant). Fixed timestep only. - - `CarpenterKennedy2N54` - The five-stage, fourth order low-storage method of Carpenter and Kennedy + - `OrdinaryDiffEqLowStorageRK.CarpenterKennedy2N54` - The five-stage, fourth order low-storage method of Carpenter and Kennedy (free 3rd order Hermite interpolant). Fixed timestep only. Designed for hyperbolic PDEs (stability properties). Like SSPRK methods, `CarpenterKennedy2N54` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `NDBLSRK124` - 12-stage, fourth order low-storage method with optimized + - `OrdinaryDiffEqLowStorageRK.NDBLSRK124` - 12-stage, fourth order low-storage method with optimized stability regions for advection-dominated problems. Fixed timestep only. Like SSPRK methods, `NDBLSRK124` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `NDBLSRK134` - 13-stage, fourth order low-storage method with optimized + - `OrdinaryDiffEqLowStorageRK.NDBLSRK134` - 13-stage, fourth order low-storage method with optimized stability regions for advection-dominated problems. Fixed timestep only. Like SSPRK methods, `NDBLSRK134` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `NDBLSRK144` - 14-stage, fourth order low-storage method with optimized + - `OrdinaryDiffEqLowStorageRK.NDBLSRK144` - 14-stage, fourth order low-storage method with optimized stability regions for advection-dominated problems. Fixed timestep only. Like SSPRK methods, `NDBLSRK144` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `CFRLDDRK64` - 6-stage, fourth order low-storage, low-dissipation, + - `OrdinaryDiffEqLowStorageRK.CFRLDDRK64` - 6-stage, fourth order low-storage, low-dissipation, low-dispersion scheme. Fixed timestep only. - - `TSLDDRK74` - 7-stage, fourth order low-storage low-dissipation, + - `OrdinaryDiffEqLowStorageRK.TSLDDRK74` - 7-stage, fourth order low-storage low-dissipation, low-dispersion scheme with maximal accuracy and stability limit along the imaginary axes. Fixed timestep only. - - `DGLDDRK73_C` - 7-stage, third order low-storage low-dissipation, + - `OrdinaryDiffEqLowStorageRK.DGLDDRK73_C` - 7-stage, third order low-storage low-dissipation, low-dispersion scheme for discontinuous Galerkin space discretizations applied to wave propagation problems, optimized for PDE discretizations when maximum spatial step is small due to geometric features of computational domain. Fixed timestep only. Like SSPRK methods, `DGLDDRK73_C` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `DGLDDRK84_C` - 8-stage, fourth order low-storage low-dissipation, + - `OrdinaryDiffEqLowStorageRK.DGLDDRK84_C` - 8-stage, fourth order low-storage low-dissipation, low-dispersion scheme for discontinuous Galerkin space discretizations applied to wave propagation problems, optimized for PDE discretizations when maximum spatial step is small due to geometric features of computational domain. Fixed timestep only. Like SSPRK methods, `DGLDDRK84_C` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `DGLDDRK84_F` - 8-stage, fourth order low-storage low-dissipation, + - `OrdinaryDiffEqLowStorageRK.DGLDDRK84_F` - 8-stage, fourth order low-storage low-dissipation, low-dispersion scheme for discontinuous Galerkin space discretizations applied to wave propagation problems, optimized for PDE discretizations when the maximum spatial step size is not constrained. Fixed timestep only. Like SSPRK methods, `DGLDDRK84_F` also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `SHLDDRK64` - 6-stage, fourth order low-stage, low-dissipation, low-dispersion + - `OrdinaryDiffEqLowStorageRK.SHLDDRK64` - 6-stage, fourth order low-stage, low-dissipation, low-dispersion scheme. Fixed timestep only. Like SSPRK methods, SHLDDRK64 also takes optional arguments `stage_limiter!`, `step_limiter!`. - - `RK46NL` - 6-stage, fourth order low-stage, low-dissipation, low-dispersion + - `OrdinaryDiffEqLowStorageRK.RK46NL` - 6-stage, fourth order low-stage, low-dissipation, low-dispersion scheme. Fixed timestep only. - - `ParsaniKetchesonDeconinck3S32` - 3-stage, second order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S32` - 3-stage, second order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S82` - 8-stage, second order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S82` - 8-stage, second order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S53` - 5-stage, third order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S53` - 5-stage, third order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S173` - 17-stage, third order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S173` - 17-stage, third order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S94` - 9-stage, fourth order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S94` - 9-stage, fourth order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S184` - 18-stage, fourth order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S184` - 18-stage, fourth order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S105` - 10-stage, fifth order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S105` - 10-stage, fifth order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `ParsaniKetchesonDeconinck3S205` - 20-stage, fifth order (3S) low-storage scheme, optimized for the + - `OrdinaryDiffEqLowStorageRK.ParsaniKetchesonDeconinck3S205` - 20-stage, fifth order (3S) low-storage scheme, optimized for the spectral difference method applied to wave propagation problems. - - `CKLLSRK43_2` - 4-stage, third order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3C` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK95_4S` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK95_4C` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK95_4M` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3C_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3M_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3N_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK85_4C_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK85_4M_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK85_4P_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3N_4R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK54_3M_4R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK65_4M_4R` - 6-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK85_4FM_4R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `CKLLSRK75_4M_5R` - 7-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. - - `RDPK3Sp35` - 5-stage, third order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK43_2` - 4-stage, third order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3C` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK95_4S` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK95_4C` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK95_4M` - 9-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3C_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3M_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3N_3R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK85_4C_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK85_4M_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK85_4P_3R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3N_4R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK54_3M_4R` - 5-stage, fourth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK65_4M_4R` - 6-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK85_4FM_4R` - 8-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.CKLLSRK75_4M_5R` - 7-stage, fifth order low-storage scheme, optimized for compressible Navier–Stokes equations. + - `OrdinaryDiffEqLowStorageRK.RDPK3Sp35` - 5-stage, third order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. - - `RDPK3SpFSAL35` - 5-stage, third order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.RDPK3SpFSAL35` - 5-stage, third order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. - - `RDPK3Sp49` - 9-stage, fourth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.RDPK3Sp49` - 9-stage, fourth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. - - `RDPK3SpFSAL49` - 9-stage, fourth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.RDPK3SpFSAL49` - 9-stage, fourth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. - - `RDPK3Sp510` - 10-stage, fifth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.RDPK3Sp510` - 10-stage, fifth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. - - `RDPK3SpFSAL510` - 10-stage, fifth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. + - `OrdinaryDiffEqLowStorageRK.RDPK3SpFSAL510` - 10-stage, fifth order low-storage scheme with embedded error estimator, optimized for compressible fluid mechanics. Like SSPRK methods, this method also takes optional arguments `stage_limiter!` and `step_limiter!`. __NOTE__: All the 2N Methods (`ORK256`, `CarpenterKennedy2N54`, `NDBLSRK124`, `NDBLSRK134`, `NDBLSRK144`, `DGLDDRK73_C`, `DGLDDRK84_C`, `DGLDDRK84_F` and `SHLDDRK64`) work on the basic principle of being able to perform the step `S1 = S1 + F(S2)` in just 2 registers. Certain optimizations have been done to achieve this theoretical limit (when `alias_u0` is set) but have a limitation that `du` should always be on the left-hand side (assignments only) in the implementation. @@ -389,9 +463,9 @@ So, the above implementation of `f` becomes valid. The following are adaptive order, adaptive step size extrapolation methods: - - `AitkenNeville` - Euler extrapolation using Aitken-Neville with the Romberg Sequence. - - `ExtrapolationMidpointDeuflhard` - Midpoint extrapolation using Barycentric coordinates - - `ExtrapolationMidpointHairerWanner` - Midpoint extrapolation using Barycentric coordinates, + - `OrdinaryDiffEqExtrapolation.AitkenNeville` - Euler extrapolation using Aitken-Neville with the Romberg Sequence. + - `OrdinaryDiffEqExtrapolation.ExtrapolationMidpointDeuflhard` - Midpoint extrapolation using Barycentric coordinates + - `OrdinaryDiffEqExtrapolation.ExtrapolationMidpointHairerWanner` - Midpoint extrapolation using Barycentric coordinates, following Hairer's `ODEX` in the adaptivity behavior. These methods have arguments for `max_order`, `min_order`, and `init_order` on the adaptive order @@ -434,41 +508,41 @@ tend to be more efficient as the size of the system or the cost of `f` increases These methods require a choice of `dt`. - - `AB3` - The 3-step third order multistep method. Ralston's Second Order Method + - `OrdinaryDiffEqAdamsBashforthMoulton.AB3` - The 3-step third order multistep method. Ralston's Second Order Method is used to calculate starting values. - - `AB4` - The 4-step fourth order multistep method. Runge-Kutta method of order + - `OrdinaryDiffEqAdamsBashforthMoulton.AB4` - The 4-step fourth order multistep method. Runge-Kutta method of order 4 is used to calculate starting values. - - `AB5` - The 5-step fifth order multistep method. Runge-Kutta method of order + - `OrdinaryDiffEqAdamsBashforthMoulton.AB5` - The 5-step fifth order multistep method. Runge-Kutta method of order 4 is used to calculate starting values. - - `ABM32` - It is third order method. In `ABM32`, `AB3` works as predictor and + - `OrdinaryDiffEqAdamsBashforthMoulton.ABM32` - It is third order method. In `ABM32`, `AB3` works as predictor and Adams Moulton 2-steps method works as Corrector. Ralston's Second Order Method is used to calculate starting values. - - `ABM43` - It is fourth order method. In `ABM43`, `AB4` works as predictor and + - `OrdinaryDiffEqAdamsBashforthMoulton.ABM43` - It is fourth order method. In `ABM43`, `AB4` works as predictor and Adams Moulton 3-steps method works as Corrector. Runge-Kutta method of order 4 is used to calculate starting values. - - `ABM54` - It is fifth order method. In `ABM54`, `AB5` works as predictor and + - `OrdinaryDiffEqAdamsBashforthMoulton.ABM54` - It is fifth order method. In `ABM54`, `AB5` works as predictor and Adams Moulton 4-steps method works as Corrector. Runge-Kutta method of order 4 is used to calculate starting values. #### Adaptive step size Adams explicit Methods - - `VCAB3` - The 3rd order Adams method. Bogacki-Shampine 3/2 method is used to + - `OrdinaryDiffEqAdamsBashforthMoulton.VCAB3` - The 3rd order Adams method. Bogacki-Shampine 3/2 method is used to calculate starting values. - - `VCAB4` - The 4th order Adams method. Runge-Kutta 4 is used to calculate + - `OrdinaryDiffEqAdamsBashforthMoulton.VCAB4` - The 4th order Adams method. Runge-Kutta 4 is used to calculate starting values. - - `VCAB5` - The 5th order Adams method. Runge-Kutta 4 is used to calculate + - `OrdinaryDiffEqAdamsBashforthMoulton.VCAB5` - The 5th order Adams method. Runge-Kutta 4 is used to calculate starting values. - - `VCABM3` - The 3rd order Adams-Moulton method. Bogacki-Shampine 3/2 method is used + - `OrdinaryDiffEqAdamsBashforthMoulton.VCABM3` - The 3rd order Adams-Moulton method. Bogacki-Shampine 3/2 method is used to calculate starting values. - - `VCABM4` - The 4th order Adams-Moulton method. Runge-Kutta 4 is used to calculate + - `OrdinaryDiffEqAdamsBashforthMoulton.VCABM4` - The 4th order Adams-Moulton method. Runge-Kutta 4 is used to calculate starting values. - - `VCABM5` - The 5th order Adams-Moulton method. Runge-Kutta 4 is used to calculate + - `OrdinaryDiffEqAdamsBashforthMoulton.VCABM5` - The 5th order Adams-Moulton method. Runge-Kutta 4 is used to calculate starting values. - - `VCABM` - An adaptive order adaptive time Adams Moulton method. It uses an + - `OrdinaryDiffEqAdamsBashforthMoulton.VCABM` - An adaptive order adaptive time Adams Moulton method. It uses an order adaptivity algorithm is derived from Shampine's DDEABM. - - `AN5` - An adaptive 5th order fixed-leading coefficient Adams method in + - `OrdinaryDiffEqNordsieck.AN5` - An adaptive 5th order fixed-leading coefficient Adams method in Nordsieck form. - - `JVODE_Adams` - An adaptive time adaptive order fixed-leading coefficient Adams + - `OrdinaryDiffEqNordsieck.JVODE_Adams` - An adaptive time adaptive order fixed-leading coefficient Adams method in Nordsieck form. The order adaptivity algorithm is derived from Sundials' `CVODE_Adams`. In development. @@ -476,134 +550,134 @@ These methods require a choice of `dt`. #### SDIRK Methods - - `ImplicitEuler` - A 1st order implicit solver. A-B-L-stable. Adaptive + - `OrdinaryDiffEqSDIRK.ImplicitEuler` - A 1st order implicit solver. A-B-L-stable. Adaptive timestepping through a divided differences estimate via memory. Strong-stability preserving (SSP). - - `ImplicitMidpoint` - A second order A-stable symplectic and symmetric implicit + - `OrdinaryDiffEqSDIRK.ImplicitMidpoint` - A second order A-stable symplectic and symmetric implicit solver. Good for highly stiff equations which need symplectic integration. - - `Trapezoid` - A second order A-stable symmetric ESDIRK method. "Almost + - `OrdinaryDiffEqSDIRK.Trapezoid` - A second order A-stable symmetric ESDIRK method. "Almost symplectic" without numerical dampening. Also known as Crank-Nicolson when applied to PDEs. Adaptive timestepping via divided differences on the memory. Good for highly stiff equations which are non-oscillatory. - - `TRBDF2` - A second order A-B-L-S-stable one-step ESDIRK method. Includes + - `OrdinaryDiffEqSDIRK.TRBDF2` - A second order A-B-L-S-stable one-step ESDIRK method. Includes stiffness-robust error estimates for accurate adaptive timestepping, smoothed derivatives for highly stiff and oscillatory problems. - - `SDIRK2` - An A-B-L stable 2nd order SDIRK method - - `Kvaerno3` - An A-L stable stiffly-accurate 3rd order ESDIRK method - - `KenCarp3` - An A-L stable stiffly-accurate 3rd order ESDIRK method with splitting - - `Cash4` - An A-L stable 4th order SDIRK method - - `Hairer4` - An A-L stable 4th order SDIRK method - - `Hairer42` - An A-L stable 4th order SDIRK method - - `Kvaerno4` - An A-L stable stiffly-accurate 4th order ESDIRK method - - `KenCarp4` - An A-L stable stiffly-accurate 4th order ESDIRK method with splitting - - `KenCarp47` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method with splitting - - `Kvaerno5` - An A-L stable stiffly-accurate 5th order ESDIRK method - - `KenCarp5` - An A-L stable stiffly-accurate 5th order ESDIRK method with splitting - - `KenCarp58` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method with splitting - - `ESDIRK54I8L2SA` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method - - `ESDIRK436L2SA2` - An A-L stable stiffly-accurate 4th order six-stage ESDIRK method - - `ESDIRK437L2SA` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method - - `ESDIRK547L2SA2` - An A-L stable stiffly-accurate 5th order seven-stage ESDIRK method + - `OrdinaryDiffEqSDIRK.SDIRK2` - An A-B-L stable 2nd order SDIRK method + - `OrdinaryDiffEqSDIRK.Kvaerno3` - An A-L stable stiffly-accurate 3rd order ESDIRK method + - `OrdinaryDiffEqSDIRK.KenCarp3` - An A-L stable stiffly-accurate 3rd order ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.Cash4` - An A-L stable 4th order SDIRK method + - `OrdinaryDiffEqSDIRK.Hairer4` - An A-L stable 4th order SDIRK method + - `OrdinaryDiffEqSDIRK.Hairer42` - An A-L stable 4th order SDIRK method + - `OrdinaryDiffEqSDIRK.Kvaerno4` - An A-L stable stiffly-accurate 4th order ESDIRK method + - `OrdinaryDiffEqSDIRK.KenCarp4` - An A-L stable stiffly-accurate 4th order ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.KenCarp47` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.Kvaerno5` - An A-L stable stiffly-accurate 5th order ESDIRK method + - `OrdinaryDiffEqSDIRK.KenCarp5` - An A-L stable stiffly-accurate 5th order ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.KenCarp58` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.ESDIRK54I8L2SA` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method + - `OrdinaryDiffEqSDIRK.ESDIRK436L2SA2` - An A-L stable stiffly-accurate 4th order six-stage ESDIRK method + - `OrdinaryDiffEqSDIRK.ESDIRK437L2SA` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method + - `OrdinaryDiffEqSDIRK.ESDIRK547L2SA2` - An A-L stable stiffly-accurate 5th order seven-stage ESDIRK method #### Fully-Implicit Runge-Kutta Methods (FIRK) - - `RadauIIA3` - An A-B-L stable fully implicit Runge-Kutta method with internal + - `OrdinaryDiffEqFIRK.RadauIIA3` - An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. - - `RadauIIA5` - An A-B-L stable fully implicit Runge-Kutta method with internal + - `OrdinaryDiffEqFIRK.RadauIIA5` - An A-B-L stable fully implicit Runge-Kutta method with internal tableau complex basis transform for efficiency. #### Parallel Diagonally Implicit Runge-Kutta Methods - - `PDIRK44` - A 2 processor 4th order diagonally non-adaptive implicit method. + - `OrdinaryDiffEqPDIRK.PDIRK44` - A 2 processor 4th order diagonally non-adaptive implicit method. These methods also have option `nlsolve` same as SDIRK methods. These methods also require `f` to be thread safe. It parallelizes the `nlsolve` calls inside the method. #### Rosenbrock Methods - - `ROS3P` - 3rd order A-stable and stiffly stable Rosenbrock method. Keeps high + - `OrdinaryDiffEqRosenbrock.ROS3P` - 3rd order A-stable and stiffly stable Rosenbrock method. Keeps high accuracy on discretizations of nonlinear parabolic PDEs. - - `Rodas3` - 3rd order A-stable and stiffly stable Rosenbrock method. - - `Rodas3P` - 3rd order A-stable and stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas3` - 3rd order A-stable and stiffly stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Rodas3P` - 3rd order A-stable and stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant and additional error test for interpolation. Keeps accuracy on discretizations of linear parabolic PDEs. - - `RosShamp4`- An A-stable 4th order Rosenbrock method. - - `Veldd4` - A 4th order D-stable Rosenbrock method. - - `Velds4` - A 4th order A-stable Rosenbrock method. - - `GRK4T` - An efficient 4th order Rosenbrock method. - - `GRK4A` - An A-stable 4th order Rosenbrock method. Essentially "anti-L-stable" + - `OrdinaryDiffEqRosenbrock.RosShamp4`- An A-stable 4th order Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Veldd4` - A 4th order D-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Velds4` - A 4th order A-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.GRK4T` - An efficient 4th order Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.GRK4A` - An A-stable 4th order Rosenbrock method. Essentially "anti-L-stable" but efficient. - - `Ros4LStab` - A 4th order L-stable Rosenbrock method. - - `Rodas4` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Ros4LStab` - A 4th order L-stable Rosenbrock method. + - `OrdinaryDiffEqRosenbrock.Rodas4` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant - - `Rodas42` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas42` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant - - `Rodas4P` - A 4th order A-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas4P` - A 4th order A-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant. 4th order on linear parabolic problems and 3rd order accurate on nonlinear parabolic problems (as opposed to lower if not corrected). - - `Rodas4P2` - A 4th order L-stable stiffly stable Rosenbrock method with a + - `OrdinaryDiffEqRosenbrock.Rodas4P2` - A 4th order L-stable stiffly stable Rosenbrock method with a stiff-aware 3rd order interpolant. 4th order on linear parabolic problems and 3rd order accurate on nonlinear parabolic problems. It is an improvement of Roadas4P and in case of inexact Jacobians a second order W method. - - `Rodas5` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware + - `OrdinaryDiffEqRosenbrock.Rodas5` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware 4th order interpolant. - - `Rodas5P` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware + - `OrdinaryDiffEqRosenbrock.Rodas5P` - A 5th order A-stable stiffly stable Rosenbrock method with a stiff-aware 4th order interpolant. Has improved stability in the adaptive time stepping embedding. - - `ROS2` - A 2nd order L-stable Rosenbrock-Wanner method with 2 internal stages. - - `ROS3` - A 3rd order L-stable Rosenbrock-Wanner method with 3 internal stages + - `OrdinaryDiffEqRosenbrock.ROS2` - A 2nd order L-stable Rosenbrock-Wanner method with 2 internal stages. + - `OrdinaryDiffEqRosenbrock.ROS3` - A 3rd order L-stable Rosenbrock-Wanner method with 3 internal stages with an embedded strongly A-stable 2nd order method. - - `ROS2PR` - A 2nd order stiffly accurate Rosenbrock-Wanner method with 3 internal stages with Rinf=0. + - `OrdinaryDiffEqRosenbrock.ROS2PR` - A 2nd order stiffly accurate Rosenbrock-Wanner method with 3 internal stages with Rinf=0. For problems with medium stiffness the convergence behaviour is very poor and it is recommended to use `ROS2S` instead. - - `ROS3PR` - A 3nd order stiffly accurate Rosenbrock-Wanner method + - `OrdinaryDiffEqRosenbrock.ROS3PR` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 3 internal stages and B_PR consistent of order 3, which is strongly A-stable with Rinf~=-0.73. - - `Scholz4_7` - A 3nd order stiffly accurate Rosenbrock-Wanner method + - `OrdinaryDiffEqRosenbrock.Scholz4_7` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 3 internal stages and B_PR consistent of order 3, which is strongly A-stable with Rinf~=-0.73. Convergence with order 4 for the stiff case, but has a poor accuracy. - - `ROS3PRL` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 4 internal stages + - `OrdinaryDiffEqRosenbrock.ROS3PRL` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 4 internal stages with B_PR consistent of order 2 with Rinf=0. The order of convergence decreases if medium stiff problems are considered, but it has good results for very stiff cases. - - `ROS3PRL2` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 4 internal stages + - `OrdinaryDiffEqRosenbrock.ROS3PRL2` - A 3nd order stiffly accurate Rosenbrock-Wanner method with 4 internal stages with B_PR consistent of order 3. The order of convergence does NOT decreases if medium stiff problems are considered as it does for ROS3PRL. #### Rosenbrock-W Methods - - `Rosenbrock23` - An Order 2/3 L-Stable Rosenbrock-W method which is good for very + - `OrdinaryDiffEqRosenbrock.Rosenbrock23` - An Order 2/3 L-Stable Rosenbrock-W method which is good for very stiff equations with oscillations at low tolerances. 2nd order stiff-aware interpolation. - - `Rosenbrock32` - An Order 3/2 A-Stable Rosenbrock-W method which is good for mildly + - `OrdinaryDiffEqRosenbrock.Rosenbrock32` - An Order 3/2 A-Stable Rosenbrock-W method which is good for mildly stiff equations without oscillations at low tolerances. Note that this method is prone to instability in the presence of oscillations, so use with caution. 2nd order stiff-aware interpolation. - - `Rodas23W` - An Order 2/3 L-Stable Rosenbrock-W method for stiff ODEs and DAEs + - `OrdinaryDiffEqRosenbrock.Rodas23W` - An Order 2/3 L-Stable Rosenbrock-W method for stiff ODEs and DAEs in mass matrix form. 2nd order stiff-aware interpolation and additional error test for interpolation. - - `RosenbrockW6S4OS` - A 4th order L-stable Rosenbrock-W method (fixed step only). - - `ROS34PW1a` - A 4th order L-stable Rosenbrock-W method. - - `ROS34PW1b` - A 4th order L-stable Rosenbrock-W method. - - `ROS34PW2` - A 4th order stiffy accurate Rosenbrock-W method for PDAEs. - - `ROS34PW3` - A 4th order strongly A-stable (Rinf~0.63) Rosenbrock-W method. - - `ROS34PRw` - A 3nd order stiffly accurate Rosenbrock-Wanner W-method with 4 internal stages with B_PR consistent of order 2 - - `ROS2S` - A 2nd order stiffly accurate Rosenbrock-Wanner W-method + - `OrdinaryDiffEqRosenbrock.RosenbrockW6S4OS` - A 4th order L-stable Rosenbrock-W method (fixed step only). + - `OrdinaryDiffEqRosenbrock.ROS34PW1a` - A 4th order L-stable Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.ROS34PW1b` - A 4th order L-stable Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.ROS34PW2` - A 4th order stiffy accurate Rosenbrock-W method for PDAEs. + - `OrdinaryDiffEqRosenbrock.ROS34PW3` - A 4th order strongly A-stable (Rinf~0.63) Rosenbrock-W method. + - `OrdinaryDiffEqRosenbrock.ROS34PRw` - A 3nd order stiffly accurate Rosenbrock-Wanner W-method with 4 internal stages with B_PR consistent of order 2 + - `OrdinaryDiffEqRosenbrock.ROS2S` - A 2nd order stiffly accurate Rosenbrock-Wanner W-method with 3 internal stages with B_PR consistent of order 2 with Rinf=0. #### Stabilized Explicit Methods - - `ROCK2` - Second order stabilized Runge-Kutta method. Exhibits high stability + - `OrdinaryDiffEqStabilizedRK.ROCK2` - Second order stabilized Runge-Kutta method. Exhibits high stability for real eigenvalues and is smoothened to allow for moderate sized complex eigenvalues. - - `ROCK4` - Fourth order stabilized Runge-Kutta method. Exhibits high stability + - `OrdinaryDiffEqStabilizedRK.ROCK4` - Fourth order stabilized Runge-Kutta method. Exhibits high stability for real eigenvalues and is smoothened to allow for moderate sized complex eigenvalues. - - `RKC` - Second order stabilized Runge-Kutta method. Exhibits high stability + - `OrdinaryDiffEqStabilizedRK.RKC` - Second order stabilized Runge-Kutta method. Exhibits high stability for real eigenvalues and is smoothened to allow for moderate sized complex eigenvalues. - - `SERK2` - Second order stabilized extrapolated Runge-Kutta method. Exhibits + - `OrdinaryDiffEqStabilizedRK.SERK2` - Second order stabilized extrapolated Runge-Kutta method. Exhibits high stability for real eigenvalues and is smoothened to allow for moderate sized complex eigenvalues. - - `ESERK5` - Fifth order stabilized extrapolated Runge-Kutta method. Exhibits + - `OrdinaryDiffEqStabilizedRK.ESERK5` - Fifth order stabilized extrapolated Runge-Kutta method. Exhibits high stability for real eigenvalues and is smoothened to allow for moderate sized complex eigenvalues. @@ -615,12 +689,12 @@ control but has option of PI control. The following are adaptive order, adaptive step size extrapolation methods: - - `ImplicitEulerExtrapolation` - Extrapolation of implicit Euler method with Romberg sequence. + - `OrdinaryDiffEqExtrapolation.ImplicitEulerExtrapolation` - Extrapolation of implicit Euler method with Romberg sequence. Similar to Hairer's `SEULEX`. - - `ImplicitEulerBarycentricExtrapolation` - Extrapolation of the implicit Euler method, using + - `OrdinaryDiffEqExtrapolation.ImplicitEulerBarycentricExtrapolation` - Extrapolation of the implicit Euler method, using Barycentric coordinates to improve the stability of the method. - - `ImplicitDeuflhardExtrapolation` - Midpoint extrapolation using Barycentric coordinates - - `ImplicitHairerWannerExtrapolation` - Midpoint extrapolation using Barycentric coordinates, + - `OrdinaryDiffEqExtrapolation.ImplicitDeuflhardExtrapolation` - Midpoint extrapolation using Barycentric coordinates + - `OrdinaryDiffEqExtrapolation.ImplicitHairerWannerExtrapolation` - Midpoint extrapolation using Barycentric coordinates, following Hairer's `SODEX` in the adaptivity behavior. These methods have arguments for `max_order`, `min_order`, and `init_order` on the adaptive order @@ -659,19 +733,19 @@ These methods parallelize the J/W instantiation and factorization, making them efficient on small highly stiff ODEs. Has an option `threading=true` to turn on/off multithreading. - - `PDIRK44`: a 4th order 2-processor DIRK method. + - `OrdinaryDiffEqPDIRK.PDIRK44`: a 4th order 2-processor DIRK method. #### [Exponential Runge-Kutta Methods](@id exp_RK) These methods are all fixed timestepping only. - - `LawsonEuler` - First order exponential Euler scheme. - - `NorsettEuler` - First order exponential-RK scheme. Alias: `ETD1`. - - `ETD2` - Second order Exponential Time Differencing method (in development). - - `ETDRK2` - 2nd order exponential-RK scheme. - - `ETDRK3` - 3rd order exponential-RK scheme. - - `ETDRK4` - 4th order exponential-RK scheme. - - `HochOst4` - 4th order exponential-RK scheme with stiff order 4. + - `OrdinaryDiffEqExponentialRK.LawsonEuler` - First order exponential Euler scheme. + - `OrdinaryDiffEqExponentialRK.NorsettEuler` - First order exponential-RK scheme. Alias: `ETD1`. + - `OrdinaryDiffEqExponentialRK.ETD2` - Second order Exponential Time Differencing method (in development). + - `OrdinaryDiffEqExponentialRK.ETDRK2` - 2nd order exponential-RK scheme. + - `OrdinaryDiffEqExponentialRK.ETDRK3` - 3rd order exponential-RK scheme. + - `OrdinaryDiffEqExponentialRK.ETDRK4` - 4th order exponential-RK scheme. + - `OrdinaryDiffEqExponentialRK.HochOst4` - 4th order exponential-RK scheme with stiff order 4. The methods are intended for semilinear problems constructed by [`SplitODEProblem`](@ref split_ode_prob) or `SplitODEFunction`. They can @@ -693,8 +767,8 @@ constructor: #### Adaptive Exponential Rosenbrock Methods - - `Exprb32` - 3rd order adaptive Exponential-Rosenbrock scheme. - - `Exprb43` - 4th order adaptive Exponential-Rosenbrock scheme. + - `OrdinaryDiffEqExponentialRK.Exprb32` - 3rd order adaptive Exponential-Rosenbrock scheme. + - `OrdinaryDiffEqExponentialRK.Exprb43` - 4th order adaptive Exponential-Rosenbrock scheme. The exponential Rosenbrock methods cannot be applied to semilinear problems. Options for the solvers are the same as [Exponential Runge-Kutta Methods](@ref exp_RK), @@ -704,13 +778,13 @@ except that Krylov approximation is always used. These methods are all fixed timestepping only. - - `Exp4` - 4th order EPIRK scheme. - - `EPIRK4s3A` - 4th order EPIRK scheme with stiff order 4. - - `EPIRK4s3B` - 4th order EPIRK scheme with stiff order 4. - - `EPIRK5P1` - 5th order EPIRK scheme. - - `EPIRK5P2` - 5th order EPIRK scheme. - - `EPIRK5s3` - 5th order “horizontal” EPIRK scheme with stiff order 5. Broken. - - `EXPRB53s3`- 5th order EPIRK scheme with stiff order 5. + - `OrdinaryDiffEqExponentialRK.Exp4` - 4th order EPIRK scheme. + - `OrdinaryDiffEqExponentialRK.EPIRK4s3A` - 4th order EPIRK scheme with stiff order 4. + - `OrdinaryDiffEqExponentialRK.EPIRK4s3B` - 4th order EPIRK scheme with stiff order 4. + - `OrdinaryDiffEqExponentialRK.EPIRK5P1` - 5th order EPIRK scheme. + - `OrdinaryDiffEqExponentialRK.EPIRK5P2` - 5th order EPIRK scheme. + - `OrdinaryDiffEqExponentialRK.EPIRK5s3` - 5th order “horizontal” EPIRK scheme with stiff order 5. Broken. + - `OrdinaryDiffEqExponentialRK.EXPRB53s3`- 5th order EPIRK scheme with stiff order 5. Options: @@ -735,28 +809,28 @@ the ideas of the classic EPISODE integrator and early VODE designs. The Fixed Leading Coefficient (FLC) methods match the behavior of the classic VODE and Sundials CVODE integrator. - - `QNDF1` - An adaptive order 1 quasi-constant timestep L-stable numerical + - `OrdinaryDiffEqBDF.QNDF1` - An adaptive order 1 quasi-constant timestep L-stable numerical differentiation function (NDF) method. Optional parameter `kappa` defaults to Shampine's accuracy-optimal `-0.1850`. - - `QBDF1` - An adaptive order 1 L-stable BDF method. This is equivalent to + - `OrdinaryDiffEqBDF.QBDF1` - An adaptive order 1 L-stable BDF method. This is equivalent to implicit Euler but using the BDF error estimator. - - `ABDF2` - An adaptive order 2 L-stable fixed leading coefficient multistep + - `OrdinaryDiffEqBDF.ABDF2` - An adaptive order 2 L-stable fixed leading coefficient multistep BDF method. - - `QNDF2` - An adaptive order 2 quasi-constant timestep L-stable numerical + - `OrdinaryDiffEqBDF.QNDF2` - An adaptive order 2 quasi-constant timestep L-stable numerical differentiation function (NDF) method. - - `QBDF2` - An adaptive order 2 L-stable BDF method using quasi-constant timesteps. - - `QNDF` - An adaptive order quasi-constant timestep NDF method. Utilizes + - `OrdinaryDiffEqBDF.QBDF2` - An adaptive order 2 L-stable BDF method using quasi-constant timesteps. + - `OrdinaryDiffEqBDF.QNDF` - An adaptive order quasi-constant timestep NDF method. Utilizes Shampine's accuracy-optimal `kappa` values as defaults (has a keyword argument for a tuple of `kappa` coefficients). Similar to `ode15s`. - - `QBDF` - An adaptive order quasi-constant timestep BDF method. - - `MEBDF2` - The second order Modified Extended BDF method, which has improved + - `OrdinaryDiffEqBDF.QBDF` - An adaptive order quasi-constant timestep BDF method. + - `OrdinaryDiffEqBDF.MEBDF2` - The second order Modified Extended BDF method, which has improved stability properties over the standard BDF. Fixed timestep only. - - `FBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, + - `OrdinaryDiffEqBDF.FBDF` - A fixed-leading coefficient adaptive-order adaptive-time BDF method, similar to `ode15i` or `CVODE_BDF` in divided differences form. #### Implicit Strong-Stability Preserving Runge-Kutta Methods for Hyperbolic PDEs (Conservation Laws) - - `SSPSDIRK2` - A second order A-L stable symplectic SDIRK method with the strong + - `OrdinaryDiffEqSDIRK.SSPSDIRK2` - A second order A-L stable symplectic SDIRK method with the strong stability preserving (SSP) property (SSP coefficient 2). Fixed timestep only. #### [Extra Options](@id extra_options_ode) @@ -792,7 +866,7 @@ sol = solve(prob, Rosenbrock23(autodiff = AutoFiniteDiff(fdtype = Val{:forward}) Additionally, there is the tableau method: - - `ExplicitRK` - A general Runge-Kutta solver which takes in a tableau. Can be adaptive. Tableaus + - `OrdinaryDiffEqExplicitRK.ExplicitRK` - A general Runge-Kutta solver which takes in a tableau. Can be adaptive. Tableaus are specified via the keyword argument `tab=tableau`. The default tableau is for Dormand-Prince 4/5. Other supplied tableaus can be found in the Supplied Tableaus section. @@ -852,12 +926,12 @@ These methods require a `Autoalg(stiffalg)` to be chosen as the method to switch to when the ODE is stiff. It can be any of the OrdinaryDiffEq.jl one-step stiff methods and has all the arguments of the `AutoSwitch` algorithm. - - `AutoTsit5` - `Tsit5` with automated switching. - - `AutoDP5` - `DP5` with automated switching. - - `AutoVern6` - `Vern6` with automated switching. - - `AutoVern7` - `Vern7` with automated switching. - - `AutoVern8` - `Vern8` with automated switching. - - `AutoVern9` - `Vern9` with automated switching. + - `OrdinaryDiffEqTsit5.AutoTsit5` - `Tsit5` with automated switching. + - `OrdinaryDiffEqLowOrderRK.AutoDP5` - `DP5` with automated switching. + - `OrdinaryDiffEqVerner.AutoVern6` - `Vern6` with automated switching. + - `OrdinaryDiffEqVerner.AutoVern7` - `Vern7` with automated switching. + - `OrdinaryDiffEqVerner.AutoVern8` - `Vern8` with automated switching. + - `OrdinaryDiffEqVerner.AutoVern9` - `Vern9` with automated switching. Example: @@ -886,9 +960,9 @@ than other methods when the cost of the function calculations is really high, bu for less costly functions the cost of nurturing the timestep overweighs the benefits. However, the BDF method is a classic method for stiff equations and “generally works”. - - `CVODE_BDF` - CVode Backward Differentiation Formula (BDF) solver. - - `CVODE_Adams` - CVode Adams-Moulton solver. - - `ARKODE` - Explicit and ESDIRK Runge-Kutta methods of orders 2-8 depending + - `Sundials.CVODE_BDF` - CVode Backward Differentiation Formula (BDF) solver. + - `Sundials.CVODE_Adams` - CVode Adams-Moulton solver. + - `Sundials.ARKODE` - Explicit and ESDIRK Runge-Kutta methods of orders 2-8 depending on choice of options. The Sundials algorithms all come with a 3rd order Hermite polynomial interpolation. @@ -913,16 +987,16 @@ Pkg.add("ODEInterfaceDiffEq") import ODEInterfaceDiffEq ``` - - `dopri5` - Hairer's classic implementation of the Dormand-Prince 4/5 method. - - `dop853` - Explicit Runge-Kutta 8(5,3) by Dormand-Prince. - - `odex` - GBS extrapolation-algorithm based on the midpoint rule. - - `seulex` - Extrapolation-algorithm based on the linear implicit Euler method. - - `radau` - Implicit Runge-Kutta (Radau IIA) of variable order between 5 and 13. - - `radau5` - Implicit Runge-Kutta method (Radau IIA) of order 5. - - `rodas` - Rosenbrock 4(3) method. - - `ddeabm` - Adams-Bashforth-Moulton Predictor-Corrector method (order between + - `ODEInterfaceDiffEq.dopri5` - Hairer's classic implementation of the Dormand-Prince 4/5 method. + - `ODEInterfaceDiffEq.dop853` - Explicit Runge-Kutta 8(5,3) by Dormand-Prince. + - `ODEInterfaceDiffEq.odex` - GBS extrapolation-algorithm based on the midpoint rule. + - `ODEInterfaceDiffEq.seulex` - Extrapolation-algorithm based on the linear implicit Euler method. + - `ODEInterfaceDiffEq.radau` - Implicit Runge-Kutta (Radau IIA) of variable order between 5 and 13. + - `ODEInterfaceDiffEq.radau5` - Implicit Runge-Kutta method (Radau IIA) of order 5. + - `ODEInterfaceDiffEq.rodas` - Rosenbrock 4(3) method. + - `ODEInterfaceDiffEq.ddeabm` - Adams-Bashforth-Moulton Predictor-Corrector method (order between 1 and 12) - - `ddebdf` - Backward Differentiation Formula (orders between 1 and 5) + - `ODEInterfaceDiffEq.ddebdf` - Backward Differentiation Formula (orders between 1 and 5) Note that while the output only has a linear interpolation, a higher order interpolation is used for intermediate dense output for `saveat` and for @@ -933,7 +1007,7 @@ event handling. This setup provides a wrapper to the algorithm LSODA, a well-known method which uses switching to solve both stiff and non-stiff equations. - - `lsoda` - The LSODA wrapper algorithm. + - `LSODA.lsoda` - The LSODA wrapper algorithm. Note that this setup is not automatically included with DifferentialEquations.jl. To use the following algorithms, you must install and use LSODA.jl: @@ -987,25 +1061,25 @@ This setup provides access to simplified versions of a few ODE solvers. They mostly exist for experimentation, but offer shorter compile times. They have limitations compared to OrdinaryDiffEq.jl and are not generally faster. - - `SimpleTsit5` - A fixed timestep integrator form of Tsit5. Not compatible + - `SimpleDiffEq.SimpleTsit5` - A fixed timestep integrator form of Tsit5. Not compatible with events. - - `SimpleATsit5` - An adaptive Tsit5 with an interpolation in its simplest + - `SimpleDiffEq.SimpleATsit5` - An adaptive Tsit5 with an interpolation in its simplest form. Not compatible with events. - - `GPUSimpleATsit5` - A version of `SimpleATsit5` without the integrator + - `SimpleDiffEq.GPUSimpleATsit5` - A version of `SimpleATsit5` without the integrator interface. Only allows `solve`. - - `SimpleEuler` - A fixed timestep bare-bones Euler implementation with integrators. - - `LoopEuler` - A fixed timestep bare-bones Euler. Not compatible with events or + - `SimpleDiffEq.SimpleEuler` - A fixed timestep bare-bones Euler implementation with integrators. + - `SimpleDiffEq.LoopEuler` - A fixed timestep bare-bones Euler. Not compatible with events or the integrator interface. - - `GPUEuler` - A fully static Euler for specialized compilation to accelerators + - `SimpleDiffEq.GPUEuler` - A fully static Euler for specialized compilation to accelerators like GPUs and TPUs. - - `SimpleRK4` - A fixed timestep bare-bones RK4 implementation with integrators. - - `LoopRK4` - A fixed timestep bare-bones RK4. Not compatible with events or + - `SimpleDiffEq.SimpleRK4` - A fixed timestep bare-bones RK4 implementation with integrators. + - `SimpleDiffEq.LoopRK4` - A fixed timestep bare-bones RK4. Not compatible with events or the integrator interface. - - `GPURK4` - A fully static RK4 for specialized compilation to accelerators + - `SimpleDiffEq.GPURK4` - A fully static RK4 for specialized compilation to accelerators like GPUs and TPUs. - - `GPUVern7` - A fully static Vern7 for specialized compilation to accelerators + - `SimpleDiffEq.GPUVern7` - A fully static Vern7 for specialized compilation to accelerators like GPUs and TPUs. - - `GPUVern9` - A fully static Vern9 for specialized compilation to accelerators + - `SimpleDiffEq.GPUVern9` - A fully static Vern9 for specialized compilation to accelerators like GPUs and TPUs. Note that this setup is not automatically included with DifferentialEquations.jl. @@ -1028,13 +1102,13 @@ Pkg.add("ODE") import ODE ``` - - `ode23` - Bogacki-Shampine's order 2/3 Runge-Kutta method - - `ode45` - A Dormand-Prince order 4/5 Runge-Kutta method - - `ode23s` - A modified Rosenbrock order 2/3 method due to Shampine - - `ode78` - A Fehlburg order 7/8 Runge-Kutta method - - `ode4` - The classic Runge-Kutta order 4 method - - `ode4ms` - A fixed-step, fixed order Adams-Bashforth-Moulton method† - - `ode4s` - A 4th order Rosenbrock method due to Shampine + - `ODE.ode23` - Bogacki-Shampine's order 2/3 Runge-Kutta method + - `ODE.ode45` - A Dormand-Prince order 4/5 Runge-Kutta method + - `ODE.ode23s` - A modified Rosenbrock order 2/3 method due to Shampine + - `ODE.ode78` - A Fehlburg order 7/8 Runge-Kutta method + - `ODE.ode4` - The classic Runge-Kutta order 4 method + - `ODE.ode4ms` - A fixed-step, fixed order Adams-Bashforth-Moulton method† + - `ODE.ode4s` - A 4th order Rosenbrock method due to Shampine †: Does not step to the interval endpoint. This can cause issues with discontinuity detection, and [discrete variables need to be updated appropriately](@ref diffeq_arrays). @@ -1139,35 +1213,35 @@ Pkg.add(url = "https://github.com/SciML/GeometricIntegratorsDiffEq.jl") import GeometricIntegratorsDiffEq ``` - - `GIEuler` - 1st order Euler method - - `GIMidpoint` - 2nd order explicit midpoint method - - `GIHeun2` - 2nd order Heun's method - - `GIRalston2` - 2nd order Ralston's method - - `GIHeun3` - 3rd order Heun's method - - `GIRalston3` - 3rd order Ralston's method - - `GIRunge` - 3rd order Kutta's method - - `GIKutta` - 3rd order Kutta's method - - `GIRK4` - standard 4th order Runge-Kutta - - `GIRK416` - - `GIRK438` - 4th order Runge-Kutta, 3/8's rule - - `GIImplicitEuler` - 1st order implicit Euler method - - `GIImplicitMidpoint` - 2nd order implicit midpoint method - - `GIRadauIA(s)` - s-stage Radau-IA - - `GIRadauIIA(s)` - s-stage Radau-IA - - `GILobattoIIIA(s)` - - `GILobattoIIIB(s)` - - `GILobattoIIIC(s)` - - `GILobattoIIIC̄(s)` - - `GILobattoIIID(s)` - - `GILobattoIIIE(s)` - - `GILobattoIIIF(s)` - - `GISRK3` - 3-stage order 4 symmetric Runge-Kutta method - - `GISSPRK3` - 3rd order explicit SSP method + - `GeometricIntegratorsDiffEq.GIEuler` - 1st order Euler method + - `GeometricIntegratorsDiffEq.GIMidpoint` - 2nd order explicit midpoint method + - `GeometricIntegratorsDiffEq.GIHeun2` - 2nd order Heun's method + - `GeometricIntegratorsDiffEq.GIRalston2` - 2nd order Ralston's method + - `GeometricIntegratorsDiffEq.GIHeun3` - 3rd order Heun's method + - `GeometricIntegratorsDiffEq.GIRalston3` - 3rd order Ralston's method + - `GeometricIntegratorsDiffEq.GIRunge` - 3rd order Kutta's method + - `GeometricIntegratorsDiffEq.GIKutta` - 3rd order Kutta's method + - `GeometricIntegratorsDiffEq.GIRK4` - standard 4th order Runge-Kutta + - `GeometricIntegratorsDiffEq.GIRK416` + - `GeometricIntegratorsDiffEq.GIRK438` - 4th order Runge-Kutta, 3/8's rule + - `GeometricIntegratorsDiffEq.GIImplicitEuler` - 1st order implicit Euler method + - `GeometricIntegratorsDiffEq.GIImplicitMidpoint` - 2nd order implicit midpoint method + - `GeometricIntegratorsDiffEq.GIRadauIA(s)` - s-stage Radau-IA + - `GeometricIntegratorsDiffEq.GIRadauIIA(s)` - s-stage Radau-IA + - `GeometricIntegratorsDiffEq.GILobattoIIIA(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIIB(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIIC(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIIC̄(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIID(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIIE(s)` + - `GeometricIntegratorsDiffEq.GILobattoIIIF(s)` + - `GeometricIntegratorsDiffEq.GISRK3` - 3-stage order 4 symmetric Runge-Kutta method + - `GeometricIntegratorsDiffEq.GISSPRK3` - 3rd order explicit SSP method - `GICrankNicholson - - `GIKraaijevangerSpijker` - - `GIQinZhang` - - `GICrouzeix` - - `GIGLRK(s)` - Gauss-Legendre Runge-Kutta method of order 2s + - `GeometricIntegratorsDiffEq.GIKraaijevangerSpijker` + - `GeometricIntegratorsDiffEq.GIQinZhang` + - `GeometricIntegratorsDiffEq.GICrouzeix` + - `GeometricIntegratorsDiffEq.GIGLRK(s)` - Gauss-Legendre Runge-Kutta method of order 2s Note that all these methods require the user supplies `dt`. @@ -1185,8 +1259,8 @@ Pkg.add(url = "https://github.com/SciML/BridgeDiffEq.jl") import BridgeDiffEq ``` - - `BridgeR3` - 3rd order Ralston method - - `BridgeBS3` - 3rd order Bogacki-Shampine method + - `BridgeDiffEq.BridgeR3` - 3rd order Ralston method + - `BridgeDiffEq.BridgeBS3` - 3rd order Bogacki-Shampine method ### TaylorIntegration.jl @@ -1203,7 +1277,7 @@ Pkg.add("TaylorIntegration") import TaylorIntegration ``` - - `TaylorMethod(order)` - Taylor integration method with maximal `order` (required) + - `TaylorIntegration.TaylorMethod(order)` - Taylor integration method with maximal `order` (required) Note: this method is much faster if you put `@taylorize` on your derivative function! @@ -1222,8 +1296,8 @@ Pkg.add(url = "https://github.com/QuantumBFS/QuDiffEq.jl") import QuDiffEq ``` - - `QuLDE(k)` - Algorithm based on truncated Taylor series. The method linearizes a system of non-linear differential equations and solves the resultant by means of a quantum circuit. `k` selects the order in the Taylor series approximation (for the quantum circuit). - - `QuNLDE(k,ϵ)`- Algorithm uses forward Euler to solve quadratic differential equations. `k` selects the order in the Taylor series approximation (for the quantum circuit). `ϵ` sets the precision for Hamiltonian evolution. + - `QuDiffEq.QuLDE(k)` - Algorithm based on truncated Taylor series. The method linearizes a system of non-linear differential equations and solves the resultant by means of a quantum circuit. `k` selects the order in the Taylor series approximation (for the quantum circuit). + - `QuDiffEq.QuNLDE(k,ϵ)`- Algorithm uses forward Euler to solve quadratic differential equations. `k` selects the order in the Taylor series approximation (for the quantum circuit). `ϵ` sets the precision for Hamiltonian evolution. ### NeuralPDE.jl @@ -1286,7 +1360,7 @@ Pkg.add("ProbNumDiffEq") import ProbNumDiffEq ``` - - `EK1(order=3)` - A semi-implicit ODE solver based on extended Kalman filtering and smoothing with first order linearization. Recommended, but requires that the Jacobian of the vector field is specified. - - `EK0(order=3)` - An explicit ODE solver based on extended Kalman filtering and smoothing with zeroth order linearization. + - `ProbNumDiffEq.EK1(order=3)` - A semi-implicit ODE solver based on extended Kalman filtering and smoothing with first order linearization. Recommended, but requires that the Jacobian of the vector field is specified. + - `ProbNumDiffEq.EK0(order=3)` - An explicit ODE solver based on extended Kalman filtering and smoothing with zeroth order linearization. [^1]: Koskela, A. (2015). Approximating the matrix exponential of an advection-diffusion operator using the incomplete orthogonalization method. In Numerical Mathematics and Advanced Applications-ENUMATH 2013 (pp. 345-353). Springer, Cham. diff --git a/docs/src/solvers/rode_solve.md b/docs/src/solvers/rode_solve.md index f12726b62..f7963051f 100644 --- a/docs/src/solvers/rode_solve.md +++ b/docs/src/solvers/rode_solve.md @@ -1,5 +1,14 @@ # RODE Solvers +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `StochasticDiffEqRODE` | `RandomEM`, `RandomTamedEM`, `RandomHeun` | Random ODEs (RODEs); time-dependent random forcing. | + + ## Recommended Methods Currently, the only implemented method is the `RandomEM` method in StochasticDiffEq.jl. @@ -11,10 +20,17 @@ It is strong order alpha for an alpha-Holder continuous noise process. Each of the StochasticDiffEq.jl solvers come with a linear interpolation. - - `RandomEM`- The Euler-Maruyama method for RODEs. Strong order matching Holder continuity. + - `StochasticDiffEqRODE.RandomEM`- The Euler-Maruyama method for RODEs. Strong order matching Holder continuity. Example usage: ```julia +using StochasticDiffEq # RODEProblem, RandomEM sol = solve(prob, RandomEM(), dt = 1 / 100) ``` + +!!! note "v8: load StochasticDiffEq directly" + + Under DifferentialEquations.jl v8 the umbrella only re-exports + `OrdinaryDiffEq`, so `RandomEM` and the `RODEProblem` constructor must be + obtained from `StochasticDiffEq` directly. diff --git a/docs/src/solvers/sdae_solve.md b/docs/src/solvers/sdae_solve.md index 54c17fcb2..d70803ff6 100644 --- a/docs/src/solvers/sdae_solve.md +++ b/docs/src/solvers/sdae_solve.md @@ -1,28 +1,43 @@ # [SDAE Solvers](@id sdae_solve) +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `StochasticDiffEqImplicit` | ImplicitEM, ImplicitEulerHeun, ImplicitRKMil, STrapezoid, SImplicitMidpoint, SKenCarp, ISSEM, ISSEulerHeun | Stiff SDAEs in mass-matrix form (drift-implicit and split-step methods). | + + ## Recommended Methods The recommendations for SDAEs are the same recommended implicit SDE methods for stiff equations when the SDAE is specified in mass matrix form. +!!! note "v8: load StochasticDiffEq directly" + + All of the methods below come from `StochasticDiffEq.jl`. Under + DifferentialEquations.jl v8 the umbrella only re-exports `OrdinaryDiffEq`, + so use `using StochasticDiffEq` to access them. + #### Mass Matrix Form - - `ImplicitEM` - An order 0.5 Ito drift-implicit method. This is a theta method which + - `StochasticDiffEqImplicit.ImplicitEM` - An order 0.5 Ito drift-implicit method. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `STrapezoid` - An alias for `ImplicitEM` with `theta=1/2` - - `SImplicitMidpoint` - An alias for `ImplicitEM` with `theta=1/2` and `symplectic=true` - - `ImplicitEulerHeun` - An order 0.5 Stratonovich drift-implicit method. This is a + - `StochasticDiffEqImplicit.STrapezoid` - An alias for `ImplicitEM` with `theta=1/2` + - `StochasticDiffEqImplicit.SImplicitMidpoint` - An alias for `ImplicitEM` with `theta=1/2` and `symplectic=true` + - `StochasticDiffEqImplicit.ImplicitEulerHeun` - An order 0.5 Stratonovich drift-implicit method. This is a theta method which defaults to `theta=1/2` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `ImplicitRKMil` - An order 1.0 drift-implicit method. This is a theta method which + - `StochasticDiffEqImplicit.ImplicitRKMil` - An order 1.0 drift-implicit method. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. Defaults to solving the Ito problem, but `ImplicitRKMil(interpretation=:Stratonovich)` makes it solve the Stratonovich problem. This method defaults to @@ -30,21 +45,21 @@ stiff equations when the SDAE is specified in mass matrix form. implicit Midpoint method on the drift term and is symplectic in distribution. Handles diagonal and scalar noise. Uses a 1.5/2.0 heuristic for adaptive time stepping. - - `ISSEM` - An order 0.5 split-step Ito implicit method. It is fully implicit, + - `StochasticDiffEqImplicit.ISSEM` - An order 0.5 split-step Ito implicit method. It is fully implicit, meaning it can handle stiffness in the noise term. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `ISSEulerHeun` - An order 0.5 split-step Stratonovich implicit method. It is + - `StochasticDiffEqImplicit.ISSEulerHeun` - An order 0.5 split-step Stratonovich implicit method. It is fully implicit, meaning it can handle stiffness in the noise term. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, Q scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `SKenCarp` - Adaptive L-stable drift-implicit strong order 1.5 for additive + - `StochasticDiffEqImplicit.SKenCarp` - Adaptive L-stable drift-implicit strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal and scalar additive noise.\*† diff --git a/docs/src/solvers/sdde_solve.md b/docs/src/solvers/sdde_solve.md index 47280b490..de993be77 100644 --- a/docs/src/solvers/sdde_solve.md +++ b/docs/src/solvers/sdde_solve.md @@ -15,6 +15,16 @@ Solves the SDDE defined by `prob` using the algorithm `alg`. If no algorithm is given, a default algorithm will be chosen. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `DelayDiffEq` | `MethodOfSteps`, `SDDEProblem` | SDDE driver - reuses an SDE algorithm as the inner solver. | +| `StochasticDiffEq` | Umbrella for SDE solvers; pulls in `StochasticDiffEq*` sublibs | Provides the inner SDE algorithm names (EM, RKMil, SRIW1, ...). | + + ## Recommended Methods The recommended method for SDDE problems are the `SDE` algorithms. On SDEs you diff --git a/docs/src/solvers/sde_solve.md b/docs/src/solvers/sde_solve.md index 46dc324d2..e2775e983 100644 --- a/docs/src/solvers/sde_solve.md +++ b/docs/src/solvers/sde_solve.md @@ -1,5 +1,22 @@ # [SDE Solvers](@id sde_solve) +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `StochasticDiffEqLowOrder` | EM, EulerHeun, LambaEM, RKMilCommute, SOSRA2 | Non-stiff SDE workhorse; diagonal/scalar noise. | +| `StochasticDiffEqHighOrder` | SOSRI, SOSRA, RKMilGeneral, SRA1/2/3, SRIW1/2 | High-order strong/weak SDE methods (SRA/SRI families). | +| `StochasticDiffEqMilstein` | RKMil, RKMilCommute | Itô-Milstein methods for diagonal-noise SDEs. | +| `StochasticDiffEqImplicit` | ImplicitEM, ImplicitEulerHeun, ImplicitRKMil, STrapezoid, SImplicitMidpoint, SKenCarp | Stiff SDEs (drift-implicit and additive-noise SKenCarp). | +| `StochasticDiffEqROCK` | SROCK, SROCK2, SROCKC2, SKSROCK | Stiff SDEs from PDE semi-discretization. | +| `StochasticDiffEqWeak` | DRI1, RDI*, RS1/2, PL1WM, SIE, NON, COM | Weak-order convergence schemes for moment estimation. | +| `StochasticDiffEqCore` | `IICommutative`, `IILevyArea` types | Internals; rarely imported directly. | +| `BridgeDiffEq` | `BridgeR3`, `BridgeBS3`, `BridgeEM` | Wrappers for Bridge.jl ODE/SDE solvers. | +| `SimpleDiffEq` | `SimpleATsit5`, `GPUVern7/9`, `SimpleFunctionMap` | Minimal-allocation solvers for tight inner loops. | + + ## Recommended Methods For most Ito diagonal and scalar noise problems where a good amount of accuracy is @@ -80,10 +97,10 @@ approximation of the iterated integrals. For those methods, the algorithms have an `ii_approx` keyword argument that allows one to specify the method for the approximation. The choices are: - - `IICommutative`: a simplification of the integral which assumes the noise commutativity + - `StochasticDiffEqCore.IICommutative`: a simplification of the integral which assumes the noise commutativity property. If used on a non-commutative noise problem this will limit the strong convergence to 0.5. - - `IILevyArea`: computes the iterated integrals based on an approximation of the Levy area + - `StochasticDiffEqCore.IILevyArea`: computes the iterated integrals based on an approximation of the Levy area using the [LevyArea.jl](https://github.com/stochastics-uni-luebeck/LevyArea.jl) package: Kastner, F. and Rößler, A., [arXiv: 2201.08424](https://arxiv.org/abs/2201.08424) Kastner, F. and Rößler, A., LevyArea.jl, [10.5281/ZENODO.5883748](https://zenodo.org/record/5883749#.Yg-d698xmu4). @@ -115,65 +132,78 @@ Example: `RKMilGeneral(;ii_approx=IILevyArea())`. Each of the StochasticDiffEq.jl solvers come with a linear interpolation. Orders are given in terms of strong order. +!!! note "v8: StochasticDiffEq must be loaded explicitly" + + Under DifferentialEquations.jl v8 the `using DifferentialEquations` + umbrella only re-exports `OrdinaryDiffEq`. The SDE solvers below come from + `StochasticDiffEq.jl`; load them with + + ```julia + using StochasticDiffEq # SDEProblem, EM, SOSRI, SRIW1, ImplicitEM, ... + ``` + + or, equivalently, `using DifferentialEquations, StochasticDiffEq` if you + also want the umbrella. + #### Nonstiff Methods - - `EM`- The Euler-Maruyama method. Strong Order 0.5 in the Ito sense. Has an + - `StochasticDiffEqLowOrder.EM`- The Euler-Maruyama method. Strong Order 0.5 in the Ito sense. Has an optional argument `split=true` for controlling step splitting. When splitting is enabled, the stability with large diffusion eigenvalues is improved. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Fixed time step only.† - - `LambaEM`- A modified Euler-Maruyama method with adaptive time stepping with + - `StochasticDiffEqLowOrder.LambaEM`- A modified Euler-Maruyama method with adaptive time stepping with an error estimator based on Lamba and Rackauckas. Has an optional argument `split=true` for controlling step splitting. When splitting is enabled, the stability with large diffusion eigenvalues is improved. Strong Order 0.5 in the Ito sense. Can handle all forms of noise, including non-diagonal, scalar, and colored noise.† - - `EulerHeun` - The Euler-Heun method. Strong Order 0.5 in the Stratonovich sense. + - `StochasticDiffEqLowOrder.EulerHeun` - The Euler-Heun method. Strong Order 0.5 in the Stratonovich sense. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Fixed time step only.† - - `LambaEulerHeun` - A modified Euler-Heun method with adaptive time stepping + - `StochasticDiffEqLowOrder.LambaEulerHeun` - A modified Euler-Heun method with adaptive time stepping with an error estimator based on Lamba due to Rackauckas. Strong order 0.5 in the Stratonovich sense. Can handle all forms of noise, including non-diagonal, scalar, and colored noise.† - - `RKMil` - An explicit Runge-Kutta discretization of the strong order 1.0 + - `StochasticDiffEqLowOrder.RKMil` - An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method. Defaults to solving the Ito problem, but `RKMil(interpretation=:Stratonovich)` makes it solve the Stratonovich problem. Only handles scalar and diagonal noise.† - - `RKMilCommute` - An explicit Runge-Kutta discretization of the strong order 1.0 + - `StochasticDiffEqLowOrder.RKMilCommute` - An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method for commutative noise problems. Defaults to solving the Ito problem, but `RKMilCommute(interpretation=:Stratonovich)` makes it solve the Stratonovich problem. Uses a 1.5/2.0 error estimate for adaptive time stepping.† - - `RKMilGeneral(;interpretation=:Ito, ii_approx=IILevyArea()` - An explicit + - `StochasticDiffEqMilstein.RKMilGeneral(;interpretation=:Ito, ii_approx=IILevyArea()` - An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method for general non-commutative noise problems. Allows for a choice of interpretation between `:Ito` and `:Stratonovich`. Allows for a choice of iterated integral approximation. - - `WangLi3SMil_A` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `WangLi3SMil_B` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `WangLi3SMil_C` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `WangLi3SMil_D` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `WangLi3SMil_E` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `WangLi3SMil_F` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 - - `SRA` - Adaptive strong order 1.5 methods for additive Ito and Stratonovich SDEs. + - `StochasticDiffEqMilstein.WangLi3SMil_A` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqMilstein.WangLi3SMil_B` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqMilstein.WangLi3SMil_C` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqMilstein.WangLi3SMil_D` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqMilstein.WangLi3SMil_E` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqMilstein.WangLi3SMil_F` - fixed step-size explicit 3-stage Milstein methods for Ito problem with strong and weak order 1.0 + - `StochasticDiffEqHighOrder.SRA` - Adaptive strong order 1.5 methods for additive Ito and Stratonovich SDEs. Default tableau is for SRA1. Can handle diagonal, non-diagonal and scalar additive noise. - - `SRI` - Adaptive strong order 1.5 methods for diagonal/scalar Ito SDEs. + - `StochasticDiffEqHighOrder.SRI` - Adaptive strong order 1.5 methods for diagonal/scalar Ito SDEs. Default tableau is for SRIW1. - - `SRIW1` - Adaptive strong order 1.5 and weak order 2.0 for diagonal/scalar Ito SDEs.† - - `SRIW2` - Adaptive strong order 1.5 and weak order 3.0 for diagonal/scalar Ito SDEs.† - - `SOSRI` - Stability-optimized adaptive strong order 1.5 and weak order 2.0 for + - `StochasticDiffEqHighOrder.SRIW1` - Adaptive strong order 1.5 and weak order 2.0 for diagonal/scalar Ito SDEs.† + - `StochasticDiffEqHighOrder.SRIW2` - Adaptive strong order 1.5 and weak order 3.0 for diagonal/scalar Ito SDEs.† + - `StochasticDiffEqHighOrder.SOSRI` - Stability-optimized adaptive strong order 1.5 and weak order 2.0 for diagonal/scalar Ito SDEs. Stable at high tolerances and robust to stiffness.† - - `SOSRI2` - Stability-optimized adaptive strong order 1.5 and weak order 2.0 for + - `StochasticDiffEqHighOrder.SOSRI2` - Stability-optimized adaptive strong order 1.5 and weak order 2.0 for diagonal/scalar Ito SDEs. Stable at high tolerances and robust to stiffness.† - - `SRA1` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak + - `StochasticDiffEqHighOrder.SRA1` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal, and scalar additive noise.† - - `SRA2` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak + - `StochasticDiffEqHighOrder.SRA2` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal, and scalar additive noise.† - - `SRA3` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak + - `StochasticDiffEqHighOrder.SRA3` - Adaptive strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 3. Can handle non-diagonal and scalar additive noise.† - - `SOSRA` - A stability-optimized adaptive SRA. Strong order 1.5 for additive Ito and + - `StochasticDiffEqHighOrder.SOSRA` - A stability-optimized adaptive SRA. Strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal, and scalar additive noise. Stable at high tolerances and robust to stiffness.† - - `SOSRA2` - A stability-optimized adaptive SRA. Strong order 1.5 for additive Ito and + - `StochasticDiffEqHighOrder.SOSRA2` - A stability-optimized adaptive SRA. Strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal, and scalar additive noise. Stable at high tolerances and robust to stiffness.† @@ -193,45 +223,45 @@ For `SRA` and `SRI`, the following option is allowed: #### S-ROCK Methods - - `SROCK1` - is a fixed step size stabilized explicit method for stiff problems. Defaults to + - `StochasticDiffEqROCK.SROCK1` - is a fixed step size stabilized explicit method for stiff problems. Defaults to solving the Ito problem but `SROCK1(interpretation=:Stratonovich)` can make it solve the Stratonovich problem. Strong order of convergence is 0.5 and weak order 1, but is optimized to get order 1 in case of scalar/diagonal noise. - - `SROCKEM` - is fixed step Euler-Mayurama with first order ROCK stabilization, and can thus + - `StochasticDiffEqROCK.SROCKEM` - is fixed step Euler-Mayurama with first order ROCK stabilization, and can thus handle stiff problems. Only for Ito problems. Defaults to strong and weak order 1.0, but can solve with weak order 0.5 as `SROCKEM(strong_order_1=false)`. This method can handle 1-dimensional, diagonal and non-diagonal noise. - - `SROCK2` - is a weak second order and strong first order fixed step stabilized method for + - `StochasticDiffEqROCK.SROCK2` - is a weak second order and strong first order fixed step stabilized method for stiff Ito problems. This method can handle 1-dimensional, diagonal and non-diagonal noise. - - `SKSROCK` - is fixed step stabilized explicit method for stiff Ito problems. Strong order 0.5 + - `StochasticDiffEqROCK.SKSROCK` - is fixed step stabilized explicit method for stiff Ito problems. Strong order 0.5 and weak order 1. This method has a better stability domain then `SROCK1`. Also, it allows special post-processing techniques in case of ergodic dynamical systems, in the context of ergodic Brownian dynamics, to achieve order 2 accuracy. `SKSROCK(;post_processing=true)` will make use of post-processing. By default, it doesn't use post-processing. Post-processing is optional and under development. The rest of the method is completely functional and can handle 1-dimensional, diagonal and non-diagonal noise. - - `TangXiaoSROCK2` - is a fixed step size stabilized explicit method for stiff problems. Only for + - `StochasticDiffEqROCK.TangXiaoSROCK2` - is a fixed step size stabilized explicit method for stiff problems. Only for Ito problems. Weak order of 2 and strong order of 1. Has 5 versions with different stability domains which can be used as `TangXiaoSROCK2(version_num=i)` where `i` is 1-5. Under Development. #### Stiff Methods - - `ImplicitEM` - An order 0.5 Ito drift-implicit method. This is a theta method which + - `StochasticDiffEqImplicit.ImplicitEM` - An order 0.5 Ito drift-implicit method. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `STrapezoid` - An alias for `ImplicitEM` with `theta=1/2` - - `SImplicitMidpoint` - An alias for `ImplicitEM` with `theta=1/2` and `symplectic=true` - - `ImplicitEulerHeun` - An order 0.5 Stratonovich drift-implicit method. This is a + - `StochasticDiffEqImplicit.STrapezoid` - An alias for `ImplicitEM` with `theta=1/2` + - `StochasticDiffEqImplicit.SImplicitMidpoint` - An alias for `ImplicitEM` with `theta=1/2` and `symplectic=true` + - `StochasticDiffEqImplicit.ImplicitEulerHeun` - An order 0.5 Stratonovich drift-implicit method. This is a theta method which defaults to `theta=1/2` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `ImplicitRKMil` - An order 1.0 drift-implicit method. This is a theta method which + - `StochasticDiffEqImplicit.ImplicitRKMil` - An order 1.0 drift-implicit method. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. Defaults to solving the Ito problem, but `ImplicitRKMil(interpretation=:Stratonovich)` makes it solve the Stratonovich problem. This method defaults to @@ -239,21 +269,21 @@ For `SRA` and `SRI`, the following option is allowed: implicit Midpoint method on the drift term and is symplectic in distribution. Handles diagonal and scalar noise. Uses a 1.5/2.0 heuristic for adaptive time stepping. - - `ISSEM` - An order 0.5 split-step Ito implicit method. It is fully implicit, + - `StochasticDiffEqImplicit.ISSEM` - An order 0.5 split-step Ito implicit method. It is fully implicit, meaning it can handle stiffness in the noise term. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `ISSEulerHeun` - An order 0.5 split-step Stratonovich implicit method. It is + - `StochasticDiffEqImplicit.ISSEulerHeun` - An order 0.5 split-step Stratonovich implicit method. It is fully implicit, meaning it can handle stiffness in the noise term. This is a theta method which defaults to `theta=1` or the Trapezoid method on the drift term. This method defaults to `symplectic=false`, but when true and `theta=1/2` this is the implicit Midpoint method on the drift term and is symplectic in distribution. Can handle all forms of noise, including non-diagonal,Q scalar, and colored noise. Uses a 1.0/1.5 heuristic for adaptive time stepping. - - `SKenCarp` - Adaptive L-stable drift-implicit strong order 1.5 for additive + - `StochasticDiffEqImplicit.SKenCarp` - Adaptive L-stable drift-implicit strong order 1.5 for additive Ito and Stratonovich SDEs with weak order 2. Can handle diagonal, non-diagonal and scalar additive noise.\*† @@ -261,7 +291,7 @@ For `SRA` and `SRI`, the following option is allowed: The following methods require analytic derivatives of the diffusion term. - - `PCEuler` - The predictor corrector Euler method. Strong Order 0.5 in the Ito + - `StochasticDiffEqLowOrder.PCEuler` - The predictor corrector Euler method. Strong Order 0.5 in the Ito sense. Requires the ggprime function, which is defined as ```math @@ -283,50 +313,50 @@ The following methods require analytic derivatives of the diffusion term. Note that none of the following methods are adaptive. - - `SimplifiedEM` - A simplified Euler-Maruyama method with weak order 1.0 and fixed step + - `StochasticDiffEqLowOrder.SimplifiedEM` - A simplified Euler-Maruyama method with weak order 1.0 and fixed step size. Can handle all forms of noise, including non-diagonal, scalar, and colored noise.† - - `DRI1` - Adaptive step weak order 2.0 for Ito SDEs with minimized error constants + - `StochasticDiffEqWeak.DRI1` - Adaptive step weak order 2.0 for Ito SDEs with minimized error constants (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `DRI1NM` - Adaptive step weak order 2.0 for Ito SDEs with minimized error constants + - `StochasticDiffEqWeak.DRI1NM` - Adaptive step weak order 2.0 for Ito SDEs with minimized error constants (deterministic order 3). Can handle non-mixing diagonal (i.e., du[k] = f(u[k])) and scalar additive noise.† - - `RI1` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RI1` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RI3` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RI3` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RI5` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RI5` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RI6` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.RI6` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RDI1WM` - Fixed step weak order 1.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.RDI1WM` - Fixed step weak order 1.0 for Ito SDEs (deterministic order 2). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RDI2WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.RDI2WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RDI3WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RDI3WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RDI4WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RDI4WM` - Adaptive step weak order 2.0 for Ito SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RS1` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 2). + - `StochasticDiffEqWeak.RS1` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 2). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `RS2` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 3). + - `StochasticDiffEqWeak.RS2` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 3). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `PL1WM` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.PL1WM` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `PL1WMA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.PL1WMA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle additive noise.† - - `NON` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 4). + - `StochasticDiffEqWeak.NON` - Fixed step weak order 2.0 for Stratonovich SDEs (deterministic order 4). Can handle diagonal, non-diagonal, non-commuting, and scalar additive noise.† - - `SIEA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.SIEA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal and scalar additive noise.† Stochastic generalization of the improved Euler method. - - `SIEB` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.SIEB` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal and scalar additive noise.† Stochastic generalization of the improved Euler method. - - `SMEA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.SMEA` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal and scalar additive noise.† Stochastic generalization of the modified Euler method. - - `SMEB` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). + - `StochasticDiffEqWeak.SMEB` - Fixed step weak order 2.0 for Ito SDEs (deterministic order 2). Can handle diagonal and scalar additive noise.† Stochastic generalization of the modified Euler method. @@ -355,7 +385,7 @@ This setup provides access to simplified versions of a few SDE solvers. They mostly exist for experimentation, but offer shorter compile times. They have limitations compared to StochasticDiffEq.jl. - - `SimpleEM` - A fixed timestep solve method for Euler-Maruyama. Only works + - `SimpleDiffEq.SimpleEM` - A fixed timestep solve method for Euler-Maruyama. Only works with non-colored Gaussian noise. Note that this setup is not automatically included with DifferentialEquations.jl. @@ -380,9 +410,9 @@ Pkg.clone("https://github.com/SciML/BridgeDiffEq.jl") import BridgeDiffEq ``` - - `BridgeEuler` - Strong order 0.5 Euler-Maruyama method for Ito equations.† - - `BridgeHeun` - Strong order 0.5 Euler-Heun method for Stratonovich equations.† - - `BridgeSRK` - Strong order 1.0 derivative-free stochastic Runge-Kutta method + - `BridgeDiffEq.BridgeEuler` - Strong order 0.5 Euler-Maruyama method for Ito equations.† + - `BridgeDiffEq.BridgeHeun` - Strong order 0.5 Euler-Heun method for Stratonovich equations.† + - `BridgeDiffEq.BridgeSRK` - Strong order 1.0 derivative-free stochastic Runge-Kutta method for scalar (`<:Number`) Ito equations.† ##### Notes diff --git a/docs/src/solvers/split_ode_solve.md b/docs/src/solvers/split_ode_solve.md index 6fa707241..e35de69e0 100644 --- a/docs/src/solvers/split_ode_solve.md +++ b/docs/src/solvers/split_ode_solve.md @@ -4,6 +4,20 @@ The solvers which are available for a `SplitODEProblem` depend on the input linearity and number of components. Each solver has functional form (or many) that it allows. +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `OrdinaryDiffEqLowOrderRK` | BS3, DP5, RK4, Heun, Euler, OwrenZen | Explicit half of an IMEX split at loose tolerances. | +| `OrdinaryDiffEqSDIRK` | KenCarp3/4/47/58, TRBDF2, ImplicitEuler, Kvaerno | IMEX-ARK methods (KenCarp family) for stiff/non-stiff splits. | +| `OrdinaryDiffEqBDF` | FBDF, QNDF, ABDF2, SBDF, DFBDF, DImplicitEuler | SBDF multistep for stiff/non-stiff splits; large/sparse systems. | +| `OrdinaryDiffEqIMEXMultistep` | CNAB2, CNLF2 | Mixed stiff/non-stiff RHS (advection-diffusion-reaction). | +| `OrdinaryDiffEqExponentialRK` | LawsonEuler, ETDRK4, EPIRK, Exprb | Semilinear problems where the linear operator dominates. | +| `Sundials` | `CVODE_BDF`, `CVODE_Adams`, `IDA`, `ARKODE` | `ARKODE` IMEX-ARK; industrial-grade C IMEX solver. | + + ## Implicit-Explicit (IMEX) ODE The Implicit-Explicit (IMEX) ODE is a `SplitODEProblem` with two functions: @@ -25,24 +39,36 @@ the problem, though for large enough PDEs the `ARKODE` method with ### OrdinaryDiffEq.jl - - `SplitEuler`: 1st order fully explicit method. Used for testing accuracy +!!! note "v8: import from the IMEX OrdinaryDiffEq sublibs" + + None of the IMEX solvers below are in OrdinaryDiffEq's default re-export + set under v7. + + ```julia + using OrdinaryDiffEqLowOrderRK # SplitEuler + using OrdinaryDiffEqBDF # IMEXEuler, IMEXEulerARK, SBDF2, SBDF3, SBDF4, MEBDF2 + using OrdinaryDiffEqIMEXMultistep # CNAB2, CNLF2 + using OrdinaryDiffEqSDIRK # KenCarp3, KenCarp4, KenCarp47, KenCarp5, KenCarp58 + ``` + + - `OrdinaryDiffEqLowOrderRK.SplitEuler`: 1st order fully explicit method. Used for testing accuracy of splits. - - `IMEXEuler` : 1st order explicit Euler mixed with implicit Euler. Fixed time + - `OrdinaryDiffEqBDF.IMEXEuler` : 1st order explicit Euler mixed with implicit Euler. Fixed time step only. - - `CNAB2`: Crank-Nicolson Adams Bashforth Order 2. Fixed time step only. - - `CNLF2`: Crank-Nicolson Leapfrog of Order 2. Fixed time step only. - - `SBDF2` : 2nd order IMEX BDF method. Fixed time step only. - - `SBDF3` : 3rd order IMEX BDF method. Fixed time step only. In development. - - `SBDF4` : 4th order IMEX BDF method. Fixed time step only. In development. - - `KenCarp3`: An A-L stable stiffly-accurate 3rd order ESDIRK method. - - `KenCarp4`: An A-L stable stiffly-accurate 4th order ESDIRK method. - - `KenCarp47` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method with splitting - - `KenCarp5`: An A-L stable stiffly-accurate 5th order ESDIRK method. - - `KenCarp58` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method with splitting + - `OrdinaryDiffEqIMEXMultistep.CNAB2`: Crank-Nicolson Adams Bashforth Order 2. Fixed time step only. + - `OrdinaryDiffEqIMEXMultistep.CNLF2`: Crank-Nicolson Leapfrog of Order 2. Fixed time step only. + - `OrdinaryDiffEqBDF.SBDF2` : 2nd order IMEX BDF method. Fixed time step only. + - `OrdinaryDiffEqBDF.SBDF3` : 3rd order IMEX BDF method. Fixed time step only. In development. + - `OrdinaryDiffEqBDF.SBDF4` : 4th order IMEX BDF method. Fixed time step only. In development. + - `OrdinaryDiffEqSDIRK.KenCarp3`: An A-L stable stiffly-accurate 3rd order ESDIRK method. + - `OrdinaryDiffEqSDIRK.KenCarp4`: An A-L stable stiffly-accurate 4th order ESDIRK method. + - `OrdinaryDiffEqSDIRK.KenCarp47` - An A-L stable stiffly-accurate 4th order seven-stage ESDIRK method with splitting + - `OrdinaryDiffEqSDIRK.KenCarp5`: An A-L stable stiffly-accurate 5th order ESDIRK method. + - `OrdinaryDiffEqSDIRK.KenCarp58` - An A-L stable stiffly-accurate 5th order eight-stage ESDIRK method with splitting ### Sundials.jl - - `ARKODE`: An additive Runge-Kutta method. Order between 3rd and 5th. For a list + - `Sundials.ARKODE`: An additive Runge-Kutta method. Order between 3rd and 5th. For a list of available options, please see [its ODE solver page](https://docs.sciml.ai/DiffEqDocs/dev/api/sundials/). @@ -62,13 +88,19 @@ The appropriate algorithms for this form are: ### OrdinaryDiffEq.jl - - `LawsonEuler` - First order exponential Euler scheme. Fixed timestepping only. - - `NorsettEuler` - First order exponential-RK scheme. Fixed timestepping only. Alias: `ETD1`. - - `ETD2` - Second order Exponential Time Differencing method (in development). Fixed timestepping only. Doesn't support Krylov approximation. - - `ETDRK2` - 2nd order exponential-RK scheme. Fixed timestepping only. - - `ETDRK3` - 3rd order exponential-RK scheme. Fixed timestepping only. - - `ETDRK4` - 4th order exponential-RK scheme. Fixed timestepping only. - - `HochOst4` - 4th order exponential-RK scheme with stiff order 4. Fixed +!!! note "v8: import from `OrdinaryDiffEqExponentialRK`" + + The exponential RK / EPIRK families below all live in + `OrdinaryDiffEqExponentialRK` (a sublib of OrdinaryDiffEq). Bring them in + with `using OrdinaryDiffEqExponentialRK`. + + - `OrdinaryDiffEqExponentialRK.LawsonEuler` - First order exponential Euler scheme. Fixed timestepping only. + - `OrdinaryDiffEqExponentialRK.NorsettEuler` - First order exponential-RK scheme. Fixed timestepping only. Alias: `ETD1`. + - `OrdinaryDiffEqExponentialRK.ETD2` - Second order Exponential Time Differencing method (in development). Fixed timestepping only. Doesn't support Krylov approximation. + - `OrdinaryDiffEqExponentialRK.ETDRK2` - 2nd order exponential-RK scheme. Fixed timestepping only. + - `OrdinaryDiffEqExponentialRK.ETDRK3` - 3rd order exponential-RK scheme. Fixed timestepping only. + - `OrdinaryDiffEqExponentialRK.ETDRK4` - 4th order exponential-RK scheme. Fixed timestepping only. + - `OrdinaryDiffEqExponentialRK.HochOst4` - 4th order exponential-RK scheme with stiff order 4. Fixed timestepping only. Note that the generic algorithms `GenericIIF1` and `GenericIIF2` allow for a choice of `nlsolve`. diff --git a/docs/src/solvers/steady_state_solve.md b/docs/src/solvers/steady_state_solve.md index 4a9fcdc6f..e9c2baa38 100644 --- a/docs/src/solvers/steady_state_solve.md +++ b/docs/src/solvers/steady_state_solve.md @@ -10,6 +10,15 @@ Solves for the steady states in the problem defined by `prob` using the algorith For a more complete documentation on nonlinear solvers for steady state problems, see [NonlinearSolve.jl](https://docs.sciml.ai/NonlinearSolve/stable/) +## Packages + +The solvers on this page are distributed across the packages below. Add the package(s) you need to your environment. + +| Package | Methods | Good for | +|---|---|---| +| `SteadyStateDiffEq` | `DynamicSS`, `SSRootfind` | Time-integrate-to-equilibrium (`DynamicSS`) or algebraic root (`SSRootfind`). | + + ## Recommended Methods `DynamicSS` is a good choice if you think you may have multiple steady states @@ -24,10 +33,10 @@ large time steps as the steady state approaches. ### SteadyStateDiffEq.jl - - `SSRootfind` : Uses a rootfinding algorithm to find a steady state. Defaults + - `SteadyStateDiffEq.SSRootfind` : Uses a rootfinding algorithm to find a steady state. Defaults to using NLsolve.jl. A different algorithm can be specified via the `nlsolve` keyword argument. (This method is deprecated: use NonlinearSolve.jl instead). - - `DynamicSS` : Uses an ODE solver to find the steady state. Automatically + - `SteadyStateDiffEq.DynamicSS` : Uses an ODE solver to find the steady state. Automatically terminates when close to the steady state. `DynamicSS(alg;abstol=1e-8,reltol=1e-6,tspan=Inf)` requires that an ODE algorithm is given as the first argument. The absolute and diff --git a/docs/src/tutorials/advanced_ode_example.md b/docs/src/tutorials/advanced_ode_example.md index 9971a1e1e..4385f8876 100644 --- a/docs/src/tutorials/advanced_ode_example.md +++ b/docs/src/tutorials/advanced_ode_example.md @@ -185,17 +185,19 @@ Now let's see how the version with sparsity compares to the version without: ```@example stiff1 import BenchmarkTools as BT # for @btime -BT.@btime DE.solve(prob_ode_brusselator_2d, DE.TRBDF2(); save_everystep = false); -BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, DE.TRBDF2(); save_everystep = false); +import OrdinaryDiffEqSDIRK as ODESDIRK # TRBDF2, KenCarp47 +import LinearSolve as LS # KLUFactorization, UMFPACKFactorization, KrylovJL_GMRES +BT.@btime DE.solve(prob_ode_brusselator_2d, ODESDIRK.TRBDF2(); save_everystep = false); +BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, ODESDIRK.TRBDF2(); save_everystep = false); BT.@btime DE.solve( - prob_ode_brusselator_2d_sparse, DE.KenCarp47(; linsolve = DE.KLUFactorization()); + prob_ode_brusselator_2d_sparse, ODESDIRK.KenCarp47(; linsolve = LS.KLUFactorization()); save_everystep = false); nothing # hide ``` Note that depending on the properties of the sparsity pattern, one may want -to try alternative linear solvers such as `DE.TRBDF2(linsolve = DE.KLUFactorization())` -or `DE.TRBDF2(linsolve = DE.UMFPACKFactorization())`. +to try alternative linear solvers such as `ODESDIRK.TRBDF2(linsolve = LS.KLUFactorization())` +or `ODESDIRK.TRBDF2(linsolve = LS.UMFPACKFactorization())`. ## Using Jacobian-Free Newton-Krylov @@ -205,7 +207,7 @@ solver for changing to a Krylov method. To swap the linear solver out, we use the `linsolve` command and choose the GMRES linear solver. ```@example stiff1 -BT.@btime DE.solve(prob_ode_brusselator_2d, DE.KenCarp47(; linsolve = DE.KrylovJL_GMRES()); +BT.@btime DE.solve(prob_ode_brusselator_2d, ODESDIRK.KenCarp47(; linsolve = LS.KrylovJL_GMRES()); save_everystep = false); nothing # hide ``` @@ -247,7 +249,7 @@ end Base.eltype(::IncompleteLU.ILUFactorization{Tv, Ti}) where {Tv, Ti} = Tv BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, - DE.KenCarp47(; linsolve = DE.KrylovJL_GMRES(precs = incompletelu), + ODESDIRK.KenCarp47(; linsolve = LS.KrylovJL_GMRES(precs = incompletelu), concrete_jac = true); save_everystep = false); nothing # hide ``` @@ -276,7 +278,7 @@ function algebraicmultigrid(W, p) end BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, - DE.KenCarp47(; linsolve = DE.KrylovJL_GMRES(precs = algebraicmultigrid), + ODESDIRK.KenCarp47(; linsolve = LS.KrylovJL_GMRES(precs = algebraicmultigrid), concrete_jac = true); save_everystep = false); nothing # hide ``` @@ -293,7 +295,7 @@ function algebraicmultigrid2(W, p) end BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, - DE.KenCarp47(; linsolve = DE.KrylovJL_GMRES(precs = algebraicmultigrid2), + ODESDIRK.KenCarp47(; linsolve = LS.KrylovJL_GMRES(precs = algebraicmultigrid2), concrete_jac = true); save_everystep = false); nothing # hide ``` @@ -398,6 +400,10 @@ BT.@btime DE.solve(prob_ode_brusselator_2d_sparse, prec_side = 1); save_everystep = false); ``` +(`Sundials.CVODE_BDF` is from the **Sundials.jl** package — under DifferentialEquations.jl +v8 the umbrella no longer re-exports Sundials, so explicitly add `using Sundials` / +`import Sundials` whenever you want CVODE/IDA/ARKODE.) + And similarly for algebraic multigrid: ```julia diff --git a/docs/src/tutorials/dae_example.md b/docs/src/tutorials/dae_example.md index bf909853c..cf658d381 100644 --- a/docs/src/tutorials/dae_example.md +++ b/docs/src/tutorials/dae_example.md @@ -46,6 +46,7 @@ last row of `M` is just zero. We can implement this form as: ```@example dae import DifferentialEquations as DE +import OrdinaryDiffEqRosenbrock as ODERosenbrock # Rodas5 import Plots function rober(du, u, p, t) y₁, y₂, y₃ = u @@ -60,7 +61,7 @@ M = [1.0 0 0 0 0 0] f = DE.ODEFunction(rober, mass_matrix = M) prob_mm = DE.ODEProblem(f, [1.0, 0.0, 0.0], (0.0, 1e5), (0.04, 3e7, 1e4)) -sol = DE.solve(prob_mm, DE.Rodas5(), reltol = 1e-8, abstol = 1e-8) +sol = DE.solve(prob_mm, ODERosenbrock.Rodas5(), reltol = 1e-8, abstol = 1e-8) Plots.plot(sol, xscale = :log10, tspan = (1e-6, 1e5), layout = (3, 1)) ``` diff --git a/docs/src/tutorials/faster_ode_example.md b/docs/src/tutorials/faster_ode_example.md index ba9281836..23d1051b3 100644 --- a/docs/src/tutorials/faster_ode_example.md +++ b/docs/src/tutorials/faster_ode_example.md @@ -254,10 +254,16 @@ Choosing a good solver is required for getting top-notch speed. General recommendations can be found on the solver page (for example, the [ODE Solver Recommendations](@ref ode_solve)). The current recommendations can be simplified to a Rosenbrock method -(`DE.Rosenbrock23` or `DE.Rodas5`) for smaller (<50 ODEs) problems, ESDIRK methods -for slightly larger (`DE.TRBDF2` or `DE.KenCarp4` for <2000 ODEs), and `DE.QNDF` for even -larger problems. `lsoda` from [LSODA.jl](https://github.com/rveltz/LSODA.jl) is -sometimes worth a try for the medium-sized category. +(`Rosenbrock23` or `Rodas5P`, both from `OrdinaryDiffEqRosenbrock`; `Rosenbrock23` +and `Rodas5P` are in the default `OrdinaryDiffEq` re-export set, the rest of the +Rosenbrock family — including `Rodas5` — needs an explicit +`using OrdinaryDiffEqRosenbrock`) for smaller (<50 ODEs) problems, ESDIRK methods +for slightly larger (`TRBDF2` or `KenCarp4` from `OrdinaryDiffEqSDIRK` for +<2000 ODEs), and `QNDF` (from `OrdinaryDiffEqBDF`) for even larger problems. +`lsoda` from [LSODA.jl](https://github.com/rveltz/LSODA.jl) is sometimes worth a +try for the medium-sized category. Under DifferentialEquations.jl v8 the umbrella +`using DifferentialEquations` only re-exports `OrdinaryDiffEq`'s default solver +set; non-default solvers must be imported from their host sublibrary. More details on the solver to choose can be found by benchmarking. See the [SciMLBenchmarks](https://docs.sciml.ai/SciMLBenchmarksOutput/stable/) to