pybamm

Fast and flexible physics-based battery models in Python

https://github.com/pybamm-team/pybamm

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    22 of 135 committers (16.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.2%) to scientific vocabulary

Keywords

batteries battery-models hacktoberfest pybamm python simulation solvers

Keywords from Contributors

closember transformers jax optim spacy-extension data-profilers automl meshing hack algorithm
Last synced: 6 months ago · JSON representation ·

Repository

Fast and flexible physics-based battery models in Python

Basic Info
  • Host: GitHub
  • Owner: pybamm-team
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: develop
  • Homepage: https://www.pybamm.org/
  • Size: 188 MB
Statistics
  • Stars: 1,361
  • Watchers: 29
  • Forks: 666
  • Open Issues: 189
  • Releases: 56
Topics
batteries battery-models hacktoberfest pybamm python simulation solvers
Created over 7 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Codeowners

README.md

PyBaMM_logo

[![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](http://numfocus.org) [![Scheduled](https://github.com/pybamm-team/PyBaMM/actions/workflows/run_periodic_tests.yml/badge.svg?branch=develop)](https://github.com/pybamm-team/PyBaMM/actions/workflows/run_periodic_tests.yml) [![readthedocs](https://readthedocs.org/projects/pybamm/badge/?version=latest)](https://docs.pybamm.org/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/pybamm-team/PyBaMM/branch/main/graph/badge.svg)](https://codecov.io/gh/pybamm-team/PyBaMM) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pybamm-team/PyBaMM/blob/main/) [![DOI](https://zenodo.org/badge/DOI/10.5334/jors.309.svg)](https://doi.org/10.5334/jors.309) [![release](https://img.shields.io/github/v/release/pybamm-team/PyBaMM?color=yellow)](https://github.com/pybamm-team/PyBaMM/releases) [![code style](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/pybamm-team/PyBaMM/badge)](https://scorecard.dev/viewer/?uri=github.com/pybamm-team/PyBaMM)

PyBaMM

PyBaMM (Python Battery Mathematical Modelling) is an open-source battery simulation package written in Python. Our mission is to accelerate battery modelling research by providing open-source tools for multi-institutional, interdisciplinary collaboration. Broadly, PyBaMM consists of (i) a framework for writing and solving systems of differential equations, (ii) a library of battery models and parameters, and (iii) specialized tools for simulating battery-specific experiments and visualizing the results. Together, these enable flexible model definitions and fast battery simulations, allowing users to explore the effect of different battery designs and modeling assumptions under a variety of operating scenarios.

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 a variety of other needs.


💻 Using 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:

```python 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 a constant-current discharge followed by a constant-current-constant-voltage charge:

```python 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) 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.

Note that the examples on the default develop branch are tested on the latest develop commit. This may sometimes cause errors when running the examples on the pybamm pip package, which is synced to the main branch. You can switch to the main branch on github to see the version of the examples that is compatible with the latest pip release.

Versioning

PyBaMM makes releases every four months and we use CalVer, which means that the version number is YY.MM. The releases happen, approximately, at the end of January, May and September. There is no difference between releases that increment the year and releases that increment the month; in particular, releases that increment the month may introduce breaking changes. Breaking changes for each release are communicated via the CHANGELOG, and come with deprecation warnings or errors that are kept for at least one year (3 releases). If you find a breaking change that is not documented, or think it should be undone, please open an issue on GitHub.

🚀 Installing 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

pypi downloads

bash pip install pybamm

Using conda

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

conda_forge downloads

bash conda install -c conda-forge pybamm

Optional solvers

The following solvers are optionally available:

📖 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. (2021). Python Battery Mathematical Modelling (PyBaMM). Journal of Open Research Software, 9(1).

You can use the BibTeX

@article{Sulzer2021, title = {{Python Battery Mathematical Modelling (PyBaMM)}}, author = {Sulzer, Valentin and Marquis, Scott G. and Timms, Robert and Robinson, Martin and Chapman, S. Jon}, doi = {10.5334/jors.309}, journal = {Journal of Open Research Software}, publisher = {Software Sustainability Institute}, volume = {9}, number = {1}, pages = {14}, year = {2021} }

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

python 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.

🛠️ Contributing 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.

📫 Get in touch

For any questions, comments, suggestions or bug reports, please visit:

📃 License

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

Owner

  • Name: PyBaMM Team
  • Login: pybamm-team
  • Kind: organization

Citation (CITATION.cff)

cff-version: 1.1.0
message: "If you use PyBaMM, please cite it as below."
authors:
  - family-names: Sulzer
    given-names: Valentin
    orcid: "https://orcid.org/0000-0002-8687-327X"
  - family-names: Marquis
    given-names: Scott G.
    orcid: "https://orcid.org/0000-0002-6895-990X"
  - family-names: Timms
    given-names: Robert
    orcid: "https://orcid.org/0000-0002-8858-4818"
  - family-names: Robinson
    given-names: Martin
    orcid: "https://orcid.org/0000-0002-1572-6782"
  - family-names: Chapman
    given-names: S. Jon
    orcid: "https://orcid.org/0000-0003-3347-6024"
journal: "Journal of Open Research Software"
date-released: 2021-06-08
doi: 10.5334/jors.309
keywords:
  - "battery modelling"
  - "expression tree"
  - "python"
  - "symbolic differentiation"
version: "25.8.0"
repository-code: "https://github.com/pybamm-team/PyBaMM"
title: "Python Battery Mathematical Modelling (PyBaMM)"

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 11,836
  • Total Committers: 135
  • Avg Commits per committer: 87.674
  • Development Distribution Score (DDS): 0.677
Past Year
  • Commits: 480
  • Committers: 42
  • Avg Commits per committer: 11.429
  • Development Distribution Score (DDS): 0.825
Top Committers
Name Email Commits
Valentin Sulzer v****r@h****m 3,828
Martin Robinson m****s@g****m 879
Robert Timms t****s@m****k 826
Scottmar93 m****s@m****k 820
Ferran Brosa Planella F****a@w****k 791
Agriya Khetarpal 7****l 710
Thibault Lestang t****g@c****k 434
Saransh Chopra s****1@g****m 353
arjxn.py a****y@g****m 297
pre-commit-ci[bot] 6****] 296
Priyanshu Agarwal p****6@g****m 212
allcontributors[bot] 4****] 192
Eric G. Kratz k****n 189
DrSOKane s****e@i****k 152
Elias Hohl e****l@a****m 137
John Brittain j****2@g****m 115
tobykirk t****k@m****k 92
tomtranter t****r@g****m 91
Valentin Sulzer s****r@m****k 81
Pip Liggins p****s@d****k 81
Weilong w****i@i****k 77
dependabot[bot] 4****] 74
Vaibhav n****t@g****m 70
Alexander Bills a****s@a****u 65
Alec Bills a****s@g****m 53
Diego d****z@i****k 50
Jerom Palimattom Tom 8****m 49
felipe-salinas 6****s 49
Nwanoro n****o@l****k 46
Tanner Leo t****o@s****m 34
and 105 more...

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1,659
  • Total pull requests: 3,047
  • Average time to close issues: 3 months
  • Average time to close pull requests: 15 days
  • Total issue authors: 241
  • Total pull request authors: 143
  • Average comments per issue: 2.61
  • Average comments per pull request: 2.72
  • Merged pull requests: 2,575
  • Bot issues: 17
  • Bot pull requests: 551
Past Year
  • Issues: 203
  • Pull requests: 774
  • Average time to close issues: 18 days
  • Average time to close pull requests: 8 days
  • Issue authors: 74
  • Pull request authors: 45
  • Average comments per issue: 1.17
  • Average comments per pull request: 2.4
  • Merged pull requests: 583
  • Bot issues: 4
  • Bot pull requests: 187
Top Authors
Issue Authors
  • tinosulzer (369)
  • rtimms (169)
  • martinjrobins (148)
  • brosaplanella (125)
  • Scottmar93 (102)
  • Saransh-cpp (63)
  • agriyakhetarpal (61)
  • TomTranter (36)
  • ejfdickinson (19)
  • gyouhoc (18)
  • github-actions[bot] (16)
  • BradyPlanden (16)
  • valentinsulzer (15)
  • kratman (14)
  • DavidMStraub (12)
Pull Request Authors
  • tinosulzer (544)
  • kratman (268)
  • rtimms (184)
  • pre-commit-ci[bot] (183)
  • allcontributors[bot] (176)
  • agriyakhetarpal (132)
  • dependabot[bot] (131)
  • martinjrobins (128)
  • brosaplanella (109)
  • Saransh-cpp (87)
  • MarcBerliner (64)
  • prady0t (63)
  • Scottmar93 (62)
  • github-actions[bot] (61)
  • aabills (57)
Top Labels
Issue Labels
bug (361) difficulty: easy (211) feature (209) priority: low (73) difficulty: medium (57) priority: medium (50) priority: high (40) priority:medium (36) difficulty: hard (28) priority:high (24) priority:low (23) in-progress (21) needs-reply (14) hacktoberfest (12) solver (11) release blocker (8) CI/CD (8) hackathon (5) help needed (5) ongoing (4) dependencies (3) refactor (3) optimization (1) good first issue (1)
Pull Request Labels
dependencies (133) github_actions (32) release blocker (28) feature (2) bug (2) infrastructure (2) GSoC 2025 (2) needs-reply (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 29,923 last-month
  • Total dependent packages: 4
    (may contain duplicates)
  • Total dependent repositories: 13
    (may contain duplicates)
  • Total versions: 124
  • Total maintainers: 1
pypi.org: pybamm

Python Battery Mathematical Modelling

  • Homepage: https://pybamm.org
  • Documentation: https://docs.pybamm.org
  • License: Copyright (c) 2018-2025, the PyBaMM team. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Latest release: 25.8.0
    published 7 months ago
  • Versions: 67
  • Dependent Packages: 4
  • Dependent Repositories: 13
  • Downloads: 29,923 Last month
Rankings
Stargazers count: 2.4%
Forks count: 2.8%
Average: 3.2%
Dependent packages count: 3.2%
Downloads: 3.5%
Dependent repos count: 4.1%
Maintainers (1)
Last synced: 6 months ago
proxy.golang.org: github.com/pybamm-team/PyBaMM
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/pybamm-team/pybamm
  • Versions: 22
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
conda-forge.org: pybamm
  • Homepage: https://pybamm.org/
  • License: BSD-3-Clause
  • Latest release: 0.2.0
    published almost 6 years ago
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Forks count: 10.7%
Stargazers count: 16.5%
Average: 28.1%
Dependent repos count: 34.0%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

.github/workflows/benchmark_on_push.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/periodic_benchmarks.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v2 composite
.github/workflows/publish_pypi.yml actions
  • actions/cache v2 composite
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/run_benchmarks_over_history.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
.github/workflows/test_on_push.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v2.1.0 composite
  • fkirc/skip-duplicate-actions master composite
.github/workflows/update_license.yml actions
  • FantasticFiasco/action-update-license-year v2 composite
  • actions/checkout v3 composite
.github/workflows/update_version.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • peter-evans/create-pull-request v3 composite
  • repo-sync/pull-request v2 composite
.github/workflows/validation_benchmarks.yml actions
  • mvasigh/dispatch-action main composite
.github/workflows/work_precision_sets.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • peter-evans/create-pull-request v3 composite
build_manylinux_wheels/action.yml actions
  • Dockerfile * docker
build_manylinux_wheels/Dockerfile docker
  • quay.io/pypa/manylinux2014_x86_64 2020-11-11-bc8ce45 build
setup.py pypi
  • Note *
  • Should *
  • anytree >=2.4.3
  • autograd >=1.2
  • bpx *
  • casadi >=3.5.0
  • imageio >=2.9.0
  • jupyter *
  • matplotlib >=2.0
  • numpy >=1.16
  • on *
  • outside *
  • pandas >=0.24
  • pybtex >=0.24.0
  • scikit-fem >=0.2.0
  • scipy >=1.3
  • sympy >=1.8
vcpkg.json vcpkg
  • casadi *
  • sundials *
.github/workflows/lychee_url_checker.yml actions
  • actions/cache v3 composite
  • actions/checkout v4 composite
  • lycheeverse/lychee-action v1.8.0 composite
.github/workflows/need_reply_remove.yml actions
  • octokit/request-action v2.x composite
.github/workflows/needs_reply.yml actions
  • dwieeb/needs-reply v2 composite
.github/workflows/release_reminder.yml actions
  • JasonEtco/create-an-issue v2 composite
  • actions/checkout v3 composite
.github/workflows/run_periodic_tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3.1.4 composite
  • fkirc/skip-duplicate-actions master composite
scripts/Dockerfile docker
  • continuumio/miniconda3 latest build
docs/_static/versions.json meteor