Creating a solver
Once you have defined the problem, you need to create a solver to solve the problem. The available solvers are:
diffsol::Bdf
: A Backwards Difference Formulae solver, suitable for stiff problems and singular mass matrices.diffsol::Sdirk
A Singly Diagonally Implicit Runge-Kutta (SDIRK or ESDIRK) solver. You can define your own butcher tableau usingTableau
or use one of the pre-defined tableaues.diffsol::ExplicitRk
: An explicit Runge-Kutta solver. You can define your own butcher tableau usingTableau
or use one of the pre-defined tableaues.
For each solver, you will need to specify the linear solver type to use. The available linear solvers are:
diffsol::NalgebraLU
: A LU decomposition solver using the nalgebra crate.diffsol::FaerLU
: A LU decomposition solver using the faer crate.diffsol::FaerSparseLU
: A sparse LU decomposition solver using thefaer
crate.
Each solver can be created directly, but it generally easier to use the methods on the OdeSolverProblem
struct to create the solver.
For example:
use crate::{problem_implicit, LS};
pub fn create_solvers() {
let problem = problem_implicit();
// BDF method using
let _bdf = problem.bdf::<LS>().unwrap();
// Create a tr_bdf2 or esdirk34 solvers directly (both are SDIRK solvers with different tableaus)
let _tr_bdf2 = problem.tr_bdf2::<LS>();
let _esdirk34 = problem.esdirk34::<LS>();
// Create a TSIT45 solver (a ERK method), this does not require a linear solver
let _tsit45 = problem.tsit45();
}