Skip to main content
PyBaMM models describe the electrochemical and thermal physics of a battery cell. Every model is built from a set of submodels — modular components that each represent a piece of the physics, such as particle diffusion, electrolyte transport, or SEI growth.

Model architecture

All battery models inherit from pybamm.BaseBatteryModel, which provides:
  • A submodels dictionary mapping submodel names to submodel objects
  • Default geometry, mesh, discretisation, and solver settings
  • A build() method that assembles the submodels into a system of equations
  • An options dictionary that controls which submodels are active
The Simulation class handles setting parameters, meshing, discretisation, and solving — so in most workflows you create a model and pass it directly to pybamm.Simulation.

Available lithium-ion models

Single Particle Model (SPM)The simplest electrochemical model. Each electrode is represented as a single spherical particle. The electrolyte concentration is assumed uniform (constant). Fast to solve, suitable for low C-rates.
Reference: Marquis et al. (2019)

Other chemistries

Lead-acid

pybamm.lead_acid.Full() — full porous-electrode lead-acid modelpybamm.lead_acid.LOQS() — leading-order quasi-static model

Equivalent circuit

pybamm.equivalent_circuit.Thevenin() — RC equivalent circuit model

Instantiating models

Basic instantiation
The options dict is optional — every option has a default. You only need to supply the keys you want to change.

Model options

Options control which submodels are active and how physics is represented. The full set is documented in BatteryModelOptions. Key options are listed below.
Controls how heat generation and transfer are modelled.
Sets the submodel used to describe lithium diffusion inside electrode particles.A 2-tuple sets different options per electrode:
Models the growth of the Solid Electrolyte Interface on the negative electrode.
Models lithium metal deposition on the negative electrode.
Models degradation of active material over cycling.
Sets the electrochemical kinetics model at the electrode-electrolyte interface.
Models mechanical stresses and cracking in electrode particles.

Combining options

Multiple options can be combined in a single dict:
DFN with degradation
Not all combinations of options are valid. PyBaMM will raise an OptionError if incompatible options are combined — for example, specifying "MSMR" for the "particle" option without also setting "open-circuit potential": "MSMR".

Basic models for teaching

PyBaMM includes simplified implementations that expose the full equation derivation, suitable for learning and custom extensions:

Checking what’s in a model