Skip to main content

PyBaMM

Build readthedocs codecov Open In Colab black_code_style

PyBaMM (Python Battery Mathematical Modelling) solves physics-based electrochemical DAE models by using state-of-the-art automatic differentiation and numerical solvers. The Doyle-Fuller-Newman model can be solved in under 0.1 seconds, while the reduced-order Single Particle Model and Single Particle Model with electrolyte can be solved in just a few milliseconds. Additional physics can easily be included such as thermal effects, fast particle diffusion, 3D effects, and more. All models are implemented in a flexible manner, and a wide range of models and parameter sets (NCA, NMC, LiCoO2, ...) are available. There is also functionality to simulate any set of experimental instructions, such as CCCV or GITT, or specify drive cycles.

How do I use PyBaMM?

The easiest way to use PyBaMM is to run a 1C constant-current discharge with a model of your choice with all the default settings:

import pybamm
model = pybamm.lithium_ion.DFN()  # Doyle-Fuller-Newman model
sim = pybamm.Simulation(model)
sim.solve([0, 3600])  # solve for 1 hour
sim.plot()

or simulate an experiment such as CCCV:

import pybamm
experiment = pybamm.Experiment(
    [
        "Discharge at C/10 for 10 hours or until 3.3 V",
        "Rest for 1 hour",
        "Charge at 1 A until 4.1 V",
        "Hold at 4.1 V until 50 mA",
        "Rest for 1 hour",
    ]
    * 3,
)
model = pybamm.lithium_ion.DFN()
sim = pybamm.Simulation(model, experiment=experiment, solver=pybamm.CasadiSolver())
sim.solve()
sim.plot()

However, much greater customisation is available. It is possible to change the physics, parameter values, geometry, submesh type, number of submesh points, methods for spatial discretisation and solver for integration (see DFN script or notebook).

For new users we recommend the Getting Started guides. These are intended to be very simple step-by-step guides to show the basic functionality of PyBaMM, and can either be downloaded and used locally, or used online through Google Colab.

Further details can be found in a number of detailed examples, hosted here on github. In addition, there is a full API documentation, hosted on Read The Docs. Additional supporting material can be found here.

For further examples, see the list of repositories that use PyBaMM here

How can I install PyBaMM?

PyBaMM is available on GNU/Linux, MacOS and Windows. We strongly recommend to install PyBaMM within a python virtual environment, in order not to alter any distribution python files. For instructions on how to create a virtual environment for PyBaMM, see the documentation.

Using pip

pip install pybamm

Using conda

PyBaMM is available as a conda package through the conda-forge channel.

conda install -c conda-forge pybamm

Optional solvers

On GNU/Linux and MacOS, an optional scikits.odes-based solver is available, see the documentation.

Citing PyBaMM

If you use PyBaMM in your work, please cite our paper

Sulzer, V., Marquis, S. G., Timms, R., Robinson, M., & Chapman, S. J. (2020). Python Battery Mathematical Modelling (PyBaMM). ECSarXiv. February, 7.

You can use the bibtex

@article{sulzer2020python,
  title={Python Battery Mathematical Modelling (PyBaMM)},
  author={Sulzer, Valentin and Marquis, Scott G and Timms, Robert and Robinson, Martin and Chapman, S Jon},
  journal={ECSarXiv. February},
  volume={7},
  year={2020}
}

We would be grateful if you could also cite the relevant papers. These will change depending on what models and solvers you use. To find out which papers you should cite, add the line

pybamm.print_citations()

to the end of your script. This will print bibtex information to the terminal; passing a filename to print_citations will print the bibtex information to the specified file instead. A list of all citations can also be found in the citations file. In particular, PyBaMM relies heavily on CasADi. See CONTRIBUTING.md for information on how to add your own citations when you contribute.

How can I contribute to PyBaMM?

If you'd like to help us develop PyBaMM by adding new methods, writing documentation, or fixing embarrassing bugs, please have a look at these guidelines first.

Licensing

PyBaMM is fully open source. For more information about its license, see LICENSE.

Release files for pybamm 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pybamm 0.2.4
File
pybamm-0.2.4-py3-none-any.whl Python 3 none any Details
pybamm-0.2.4-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details
pybamm-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
pybamm-0.2.4-cp37-cp37m-macosx_10_15_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64 Details
pybamm-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details
pybamm-0.2.4-cp36-cp36m-macosx_10_15_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64 Details

Total release size: 4.6 MB

Release files / pybamm-0.2.4-py3-none-any.whl

Download URL pybamm-0.2.4-py3-none-any.whl
Size 520.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba85cc88a01cbf66fa6ebda0b275dadeb9a1d74caa686c5a34578ce243bc4269
BLAKE2b-256 checksum
How to use checksums
fd339a091d0b2076f1e929fdadd83e6e14b6e6638722d62350deb7585ebd9033
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / pybamm-0.2.4-cp38-cp38-macosx_10_15_x86_64.whl

Download URL pybamm-0.2.4-cp38-cp38-macosx_10_15_x86_64.whl
Size 694.7 kB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
66fa1d3a2fd0fe4f842b5bcf0eaf41cde29a27cc1ade08cfc871ac09b42142db
BLAKE2b-256 checksum
How to use checksums
bcd31ff3ecf7c2efa7e94426f2b6345591761bfd26c5e8fb12c0f5c09d7061f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / pybamm-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl

Download URL pybamm-0.2.4-cp37-cp37m-manylinux2010_x86_64.whl
Size 1.0 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
da320010bed2eb3e7128494b47554530f98456696ba4c66e391873f3cd8c3aab
BLAKE2b-256 checksum
How to use checksums
a2de49fd213ab3993915ee4eb0609dbff568325730fd63d34d69bcbabdc716ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / pybamm-0.2.4-cp37-cp37m-macosx_10_15_x86_64.whl

Download URL pybamm-0.2.4-cp37-cp37m-macosx_10_15_x86_64.whl
Size 694.3 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
d881f4a4604b6f5d1adac0b1ff2f10d954e3094af90c8894fec6a488f6a3ffc7
BLAKE2b-256 checksum
How to use checksums
3c7f84dd0cc54ec72f46c56c32f9e70e811a4b3fbe1016b2f46bec30b012f8e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / pybamm-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl

Download URL pybamm-0.2.4-cp36-cp36m-manylinux2010_x86_64.whl
Size 1.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
66b341ca7cbb5dbb8ae01f7c31b257908720ab850c7a36ce3d006357c5e91f54
BLAKE2b-256 checksum
How to use checksums
2b7b379f8ae9a397eb72237cdb4551d72951dc513e5291ab6e3497d02f71ffde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / pybamm-0.2.4-cp36-cp36m-macosx_10_15_x86_64.whl

Download URL pybamm-0.2.4-cp36-cp36m-macosx_10_15_x86_64.whl
Size 694.1 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
71f72521ebd8aa846c1e4b5ff638629a106e533abd5c618a68e9ec5d0f2cda78
BLAKE2b-256 checksum
How to use checksums
e93744d08b0ec5b281c0d127da67ec917b4284e59a483a438b07a231e5fd6c86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

26.5.0

2 release files

26.4.4

2 release files

26.4.3

2 release files

26.4.1

2 release files

26.4.0

2 release files

26.3.1

2 release files

26.3.0

2 release files

25.6.0

2 release files

25.4.2

2 release files

25.4.1

2 release files

25.1.1

2 release files

25.1.0

2 release files

24.5

17 release files

24.1

16 release files

23.9

15 release files

23.5

19 release files

23.4

9 release files

23.3

9 release files

23.2

9 release files

23.1

9 release files

22.12

9 release files

22.11

9 release files

22.10

9 release files

22.9

13 release files

22.8

13 release files

22.7

13 release files

22.6

13 release files

22.5

13 release files

22.4

1 release file

22.3

14 release files

22.2

18 release files

22.1

18 release files

21.12

18 release files

21.11

19 release files

21.9

19 release files

0.4.0

17 release files

0.3.0

7 release files

This release

0.2.4 This release

6 release files

0.2.3

6 release files

0.2.2

3 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page