Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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. It supports mass matrices, including singular mass matrices (DAEs).
  • diffsol::Sdirk: A Singly Diagonally Implicit Runge-Kutta (SDIRK or ESDIRK) solver, suitable for stiff problems. It supports mass matrices, including singular mass matrices (DAEs). You can define your own Butcher tableau using Tableau or use one of the pre-defined tableaus.
  • diffsol::ExplicitRk: An explicit Runge-Kutta solver, suitable for non-stiff problems. It does not support a mass matrix: if the problem has a mass matrix, creating the solver returns a MassMatrixNotSupported error. You can define your own Butcher tableau using Tableau or use one of the pre-defined tableaus.

For the implicit solvers (BDF and SDIRK), you will need to specify the linear solver type to use. The explicit Runge-Kutta solver does not use a linear solver. The available linear solvers are:

Each solver can be created directly, but it is 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();

    // Create a BDF solver
    let _bdf = problem.bdf::<LS>().unwrap();

    // Create tr_bdf2 and esdirk34 solvers (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();
}