Previous topic

Scikits.odes Solvers

Next topic

Algebraic Solvers

This Page

Casadi Solver

class pybamm.CasadiSolver(mode='safe', rtol=1e-06, atol=1e-06, root_method='casadi', root_tol=1e-06, max_step_decrease_count=5, **extra_options)[source]

Solve a discretised model, using CasADi.

Extends: pybamm.BaseSolver

Parameters:
  • method (str, optional) – The method to use for solving the system (‘cvodes’, for ODEs, or ‘idas’, for DAEs). Default is ‘idas’.
  • mode (str) –

    How to solve the model (default is “safe”):

    • ”fast”: perform direct integration, without accounting for events. Recommended when simulating a drive cycle or other simulation where no events should be triggered.
    • ”safe”: perform step-and-check integration, checking whether events have been triggered. Recommended for simulations of a full charge or discharge.
  • rtol (float, optional) – The relative tolerance for the solver (default is 1e-6).
  • atol (float, optional) – The absolute tolerance for the solver (default is 1e-6).
  • root_method (str, optional) – The method to use for finding consistend initial conditions. Default is ‘lm’.
  • root_tol (float, optional) – The tolerance for root-finding. Default is 1e-6.
  • max_step_decrease_counts (float, optional) – The maximum number of times step size can be decreased before an error is raised. Default is 5.
  • extra_options (keyword arguments, optional) – Any extra keyword-arguments; these are passed directly to the CasADi integrator. Please consult CasADi documentation for details.