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.

Metadata

Release files for pybamm 0.2.4.post3

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.post3
File Actions
pybamm-0.2.4.post3-py3-none-any.whl Python 3 none any Details for pybamm-0.2.4.post3-py3-none-any.whl
pybamm-0.2.4.post3-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details for pybamm-0.2.4.post3-cp38-cp38-manylinux2010_x86_64.whl
pybamm-0.2.4.post3-cp38-cp38-macosx_10_15_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.15+ x86-64 Details for pybamm-0.2.4.post3-cp38-cp38-macosx_10_15_x86_64.whl
pybamm-0.2.4.post3-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details for pybamm-0.2.4.post3-cp37-cp37m-manylinux2010_x86_64.whl
pybamm-0.2.4.post3-cp37-cp37m-macosx_10_15_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64 Details for pybamm-0.2.4.post3-cp37-cp37m-macosx_10_15_x86_64.whl
pybamm-0.2.4.post3-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details for pybamm-0.2.4.post3-cp36-cp36m-manylinux2010_x86_64.whl
pybamm-0.2.4.post3-cp36-cp36m-macosx_10_15_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64 Details for pybamm-0.2.4.post3-cp36-cp36m-macosx_10_15_x86_64.whl

Total release size: 5.6 MB

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

Download URL pybamm-0.2.4.post3-py3-none-any.whl
Size 520.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8564f2387ceaa94c1fa583dfbff8315a2234d9068990801293977ce0438e9ac
BLAKE2b-256 checksum
How to use checksums
707be731b8aeba3348785970208b6a6831379419087db9af53db715fa801017a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Release files / pybamm-0.2.4.post3-cp38-cp38-manylinux2010_x86_64.whl

Download URL pybamm-0.2.4.post3-cp38-cp38-manylinux2010_x86_64.whl
Size 1.0 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
eecf01bf78a1117a5e3b58d16561cd7761ae415fb7be03fb343dfc393e10c0fa
BLAKE2b-256 checksum
How to use checksums
bc014cd346ad8b1cdf07b2b10d2f7b51b6d19bcd25da5ba969f861184a9e9349
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

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

Download URL pybamm-0.2.4.post3-cp38-cp38-macosx_10_15_x86_64.whl
Size 699.7 kB
Tags CPython 3.8 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
295f1b945084c332757a3cd0f288532f9e2711e9a7dae768ce30a5b94e1b02f8
BLAKE2b-256 checksum
How to use checksums
a9e3494745750009a105a159258cdcc61ef28f37638eb3bda95604d5a84fd25d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

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

Download URL pybamm-0.2.4.post3-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
5ebd2376ef8fae4517e68cc1b3e7fc2778cf0fa528db6e84be7805868730642e
BLAKE2b-256 checksum
How to use checksums
cdc5855885a85944cba133745b477ad0e1d6a6353a64dbcbb726c067f283f24a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

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

Download URL pybamm-0.2.4.post3-cp37-cp37m-macosx_10_15_x86_64.whl
Size 699.0 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
14763fe5c1fcf3d4852af89b2b8f3863b2859550b2972d6566d2831bf22d0a88
BLAKE2b-256 checksum
How to use checksums
697ff0e938cfbc82d873bd8b1e90ebea22438611af6ace627e28dfac2ee81b5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

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

Download URL pybamm-0.2.4.post3-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
a82ebbca722486a8b93573cf3628ea6b04d3ba3fc18869c49004cc7cb54c9b7c
BLAKE2b-256 checksum
How to use checksums
3b4e769dba7d896fb89329b45cd3435974509369f12805a27ad533c4faaa9fb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

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

Download URL pybamm-0.2.4.post3-cp36-cp36m-macosx_10_15_x86_64.whl
Size 698.8 kB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
5837103e3b38385266df4b747461c629b9c5655c537c68954c7e805f8ed2cea0
BLAKE2b-256 checksum
How to use checksums
ab5d3f2ea69330682698e4ae891a7b890b35897eb363de1daf6c85ebea97fd6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

Security for pybamm 0.2.4.post3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.4.post3 This release

7 release files No provenance

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