- A framework for writing and solving systems of differential equations — flexible ODE/PDE definitions with multiple spatial discretisation methods and solvers.
- A library of battery models and parameters — ready-to-use physics-based models (SPM, SPMe, DFN, and more) backed by published parameter sets.
- Specialized tools for battery simulation — experiment definitions, result visualization, and batch study utilities.
Key features
Physics-based models
Run the Single Particle Model (SPM), Single Particle Model with electrolyte (SPMe), Doyle-Fuller-Newman (DFN), and several other full-order lithium-ion models out of the box.
Solvers
Choose from CasADi-based solvers, SciPy integrators, and an optional JAX-based solver. PyBaMM automatically selects a sensible default for each model.
Parameter sets
Access a curated library of published parameter sets including Chen2020, Marquis2019, Ecker2015, OKane2022, and others. Swap parameters with a single line of code.
Experiments
Define realistic cycling protocols in plain English — constant-current discharge, CC/CV charge, rest steps, and multi-cycle sequences via
pybamm.Experiment.Plotting
Visualize any model variable over time or through the electrode thickness.
sim.plot() produces an interactive plot of the most common outputs.Batch studies
Run parameter sweeps and compare results across models, parameter sets, or operating conditions using PyBaMM’s simulation and solution APIs.
Get started
Quickstart
Run your first simulation in under five minutes.
Installation
Install PyBaMM on Linux, macOS, or Windows.
NumFOCUS sponsorship
PyBaMM uses an open governance model and is fiscally sponsored by NumFOCUS. Consider making a tax-deductible donation to help the project pay for developer time, professional services, travel, workshops, and other needs.Citing PyBaMM
If you use PyBaMM in your work, please cite:Sulzer, V., Marquis, S. G., Timms, R., Robinson, M., & Chapman, S. J. (2021). Python Battery Mathematical Modelling (PyBaMM). Journal of Open Research Software, 9(1). https://doi.org/10.5334/jors.309To find out which additional papers you should cite based on the models and solvers you use, add the following line to the end of your script:
print_citations writes the BibTeX output to that file instead of the terminal.