PyBaMM-GEM
Spatially resolved (2D and 3D) battery models built on PyBaMM, laid out
like the PyBaMM model zoo: one folder per model, each with a model.toml manifest, a
CITATION.bib, a README, tests and an example.
Models
| Slug | Class | What it is |
|---|---|---|
spm_2d |
BasicSPM2D |
Single Particle Model with a pair of particles at every height z |
spm_3d |
BasicSPM3D |
The same, over a y-z grid of points |
dfn_2d |
DFN2D |
Doyle-Fuller-Newman model resolved in x and z |
dfn_3d |
DFN3D |
The same, resolved in x, y and z |
Installation
pip install git+https://github.com/ImperialCollegeLondon/PyBaMM-GEM
PyBaMM 26.9 or newer is needed.
Usage
import pybamm
import pybamm_gem as gem
print(gem.list_models())
model = gem.load("spm_2d")()
simulation = pybamm.Simulation(model)
solution = simulation.solve([0, 3000])
print(solution["Voltage [V]"](1500))
The classes are also available directly, for example gem.lithium_ion.BasicSPM2D or
gem.lithium_ion.DFN2D.
The commands are the same as in the PyBaMM model zoo (pybamm_model_zoo): list_models(),
info(), load(), require() and register_citation(). info(), load(), require() and
register_citation() take either the slug ("spm_2d") or the class name ("BasicSPM2D");
list_models() returns the slugs. With pybamm-model-zoo installed, the GEM models are also
listed by pybamm_model_zoo.list_models().
The notebook examples/higher_dimensional_models.ipynb runs all four models, compares them with
the stock PyBaMM models and shows a temperature that changes with height.
Licence
BSD 3-Clause, see LICENSE.txt. Copyright (c) 2026, Imperial College London.
Some of the model code is adapted from PyBaMM; see LICENSES-bundled.txt.
Releasing a new version
- In a pull request, raise
versioninpyproject.toml(for example0.2.1) and add aCHANGELOG.mdentry. Merge it. - On GitHub, go to Releases, then "Draft a new release". Create the tag
v0.2.1(a "v" and the version), add a title and notes, and publish. - The Release workflow builds and tests the package, uploads it to TestPyPI and tests it again. It then waits for a maintainer to approve the upload to PyPI (GitHub sends an email).
Metadata
Release files for PyBaMM-GEM 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybamm_gem-0.2.1.tar.gz | 144.1 kB | With provenance | Details for pybamm_gem-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybamm_gem-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for pybamm_gem-0.2.1-py3-none-any.whl |
Total release size: 174.1 kB
Release files / pybamm_gem-0.2.1.tar.gz
| Download URL | pybamm_gem-0.2.1.tar.gz |
|---|---|
| Size | 144.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed821369c20b7fd50177d5c7fda54927e2a1568f381e3d064f9fa5f7da7d9534
|
|
BLAKE2b-256 checksum How to use checksums |
ccbcc71c3eec353a4d64339ca7cd2cc87d88e7c199ea7ad94f2d63c1b42279fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logRelease files / pybamm_gem-0.2.1-py3-none-any.whl
| Download URL | pybamm_gem-0.2.1-py3-none-any.whl |
|---|---|
| Size | 30.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a15df66e4344c5fbe006ddf72b7591384db26f4b58734680829dbbf2a59a3d51
|
|
BLAKE2b-256 checksum How to use checksums |
3bc1d305b6ada996b25c46d64e01b1da69cf2bb13e35cfd67322658926954d9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logSecurity for PyBaMM-GEM 0.2.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pybamm_gem-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2026.
Transparency logA 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.