Skip to content

Commit

Permalink
Add more solvers (#1868)
Browse files Browse the repository at this point in the history
  • Loading branch information
visr authored Oct 7, 2024
1 parent 059a450 commit 67205d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions core/src/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ using OrdinaryDiffEqNonlinearSolve: NLNewton
using OrdinaryDiffEqLowOrderRK: Euler, RK4
using OrdinaryDiffEqTsit5: Tsit5
using OrdinaryDiffEqSDIRK: ImplicitEuler, KenCarp4, TRBDF2
using OrdinaryDiffEqBDF: QNDF
using OrdinaryDiffEqRosenbrock: Rodas5, Rosenbrock23
using OrdinaryDiffEqBDF: FBDF, QNDF
using OrdinaryDiffEqRosenbrock: Rosenbrock23, Rodas4P, Rodas5P

export Config, Solver, Results, Logging, Toml
export algorithm,
Expand Down Expand Up @@ -213,9 +213,11 @@ Map from config string to a supported algorithm type from [OrdinaryDiffEq](https
Supported algorithms:
- `QNDF`
- `FBDF`
- `Rosenbrock23`
- `TRBDF2`
- `Rodas5`
- `Rodas4P`
- `Rodas5P`
- `KenCarp4`
- `Tsit5`
- `RK4`
Expand All @@ -224,9 +226,11 @@ Supported algorithms:
"""
const algorithms = Dict{String, Type}(
"QNDF" => QNDF,
"FBDF" => FBDF,
"Rosenbrock23" => Rosenbrock23,
"TRBDF2" => TRBDF2,
"Rodas5" => Rodas5,
"Rodas4P" => Rodas4P,
"Rodas5P" => Rodas5P,
"KenCarp4" => KenCarp4,
"Tsit5" => Tsit5,
"RK4" => RK4,
Expand Down
2 changes: 1 addition & 1 deletion core/test/run_models_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ end
@test sparse_fdm.integrator.u sparse_ad.integrator.u atol = 4
@test dense_fdm.integrator.u sparse_ad.integrator.u atol = 4

config = Ribasim.Config(toml_path; solver_algorithm = "Rodas5", solver_autodiff = true)
config = Ribasim.Config(toml_path; solver_algorithm = "Rodas5P", solver_autodiff = true)
time_ad = Ribasim.run(config)
@test successful_retcode(time_ad)
@test time_ad.integrator.u sparse_ad.integrator.u atol = 10
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/usage.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If your model does not converge, or your performance is lower than expected, it

The default solver `algorithm = "QNDF"`, which is a multistep method similar to Matlab's `ode15s` [@shampine1997matlab].
It is an implicit method that supports the default adaptive timestepping.
The full list of available solvers is: `QNDF`, `Rosenbrock23`, `TRBDF2`, `Rodas5`, `KenCarp4`, `Tsit5`, `RK4`, `ImplicitEuler`, `Euler`.
The full list of available solvers is: `QNDF`, `FBDF`, `Rosenbrock23`, `Rodas4P`, `Rodas5P`, `TRBDF2`, `KenCarp4`, `Tsit5`, `RK4`, `ImplicitEuler`, `Euler`.
Information on the solver algorithms can be found on the [ODE solvers page](https://docs.sciml.ai/DiffEqDocs/stable/solvers/ode_solve/).

By default Ribasim uses adaptive timestepping, though not all algorithms support adaptive timestepping.
Expand Down

0 comments on commit 67205d5

Please sign in to comment.