Algebraic Solvers#

class pybamm.AlgebraicSolver(method='lm', tol=1e-06, extra_options=None)[source]#

Solve a discretised model which contains only (time independent) algebraic equations using a root finding algorithm. Uses scipy.optimize.root. Note: this solver could be extended for quasi-static models, or models in which the time derivative is manually discretised and results in a (possibly nonlinear) algebaric system at each time level.

Parameters:
  • method (str, optional) – The method to use to solve the system (default is “lm”). If it starts with “lsq”, least-squares minimization is used. The method for least-squares can be specified in the form “lsq_methodname”

  • tol (float, optional) – The tolerance for the solver (default is 1e-6).

  • extra_options (dict, optional) – Any options to pass to the rootfinder. Vary depending on which method is chosen. Please consult SciPy documentation for details.

Extends: pybamm.solvers.base_solver.BaseSolver

class pybamm.CasadiAlgebraicSolver(tol=1e-06, extra_options=None)[source]#

Solve a discretised model which contains only (time independent) algebraic equations using CasADi’s root finding algorithm. Note: this solver could be extended for quasi-static models, or models in which the time derivative is manually discretised and results in a (possibly nonlinear) algebaric system at each time level.

Parameters:
  • tol (float, optional) – The tolerance for the solver (default is 1e-6).

  • extra_options (dict, optional) – Any options to pass to the CasADi rootfinder. Please consult CasADi documentation for details.

Extends: pybamm.solvers.base_solver.BaseSolver