Manual time-stepping

The fundamental method to step the solver through a solution is the step method on the OdeSolverMethod trait, which steps the solution forward in time by a single step, with a step size chosen by the solver in order to satisfy the error tolerances in the problem struct. The step method returns a Result that contains the new state of the solution if the step was successful, or an error if the step failed.

use diffsol::OdeSolverMethod;

pub fn solve_step<'a, Solver, Eqn>(solver: &mut Solver)
where
    Solver: OdeSolverMethod<'a, Eqn>,
    Eqn: diffsol::OdeEquations<T = f64> + 'a,
{
    while solver.state().t < 10.0 {
        if solver.step().is_err() {
            break;
        }
    }
}

The step method will return an error if the solver fails to converge to the solution or if the step size becomes too small.