Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more solvers #1868

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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