PyBaMM-GEM 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybamm_gem-0.2.0/.github/workflows/ci.yml +53 -0
- pybamm_gem-0.2.0/.gitignore +9 -0
- pybamm_gem-0.2.0/CHANGELOG.md +11 -0
- pybamm_gem-0.1.0/LICENSE → pybamm_gem-0.2.0/LICENSE.txt +29 -28
- pybamm_gem-0.2.0/LICENSES-bundled.txt +37 -0
- pybamm_gem-0.2.0/PKG-INFO +63 -0
- pybamm_gem-0.2.0/README.md +46 -0
- pybamm_gem-0.2.0/examples/higher_dimensional_models.ipynb +622 -0
- pybamm_gem-0.2.0/pyproject.toml +43 -0
- pybamm_gem-0.2.0/src/pybamm_gem/__init__.py +17 -0
- pybamm_gem-0.2.0/src/pybamm_gem/_registry.py +77 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/CITATION.bib +28 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/README.md +42 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/__init__.py +3 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/examples/run_dfn_2d.py +29 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/model.py +248 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/model.toml +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_2d/tests/test_dfn_2d.py +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/CITATION.bib +28 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/README.md +43 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/__init__.py +3 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/examples/run_dfn_3d.py +29 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/model.py +14 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/model.toml +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/dfn_3d/tests/test_dfn_3d.py +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/lithium_ion/__init__.py +6 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/CITATION.bib +17 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/README.md +40 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/__init__.py +3 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/examples/run_spm_2d.py +24 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/model.py +309 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/model.toml +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_2d/tests/test_spm_2d.py +35 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/CITATION.bib +17 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/README.md +39 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/__init__.py +3 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/examples/run_spm_3d.py +35 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/model.py +79 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/model.toml +21 -0
- pybamm_gem-0.2.0/src/pybamm_gem/spm_3d/tests/test_spm_3d.py +18 -0
- pybamm_gem-0.2.0/tests/test_registry.py +37 -0
- pybamm_gem-0.1.0/.git_archival.txt +0 -4
- pybamm_gem-0.1.0/.gitattributes.txt +0 -1
- pybamm_gem-0.1.0/.gitignore +0 -129
- pybamm_gem-0.1.0/.pre-commit-config.yaml +0 -65
- pybamm_gem-0.1.0/.readthedocs.yml +0 -28
- pybamm_gem-0.1.0/CITATION.cff +0 -25
- pybamm_gem-0.1.0/CODE_OF_CONDUCT.md +0 -45
- pybamm_gem-0.1.0/CONTRIBUTING.md +0 -150
- pybamm_gem-0.1.0/LICENSES-bundled.txt +0 -10
- pybamm_gem-0.1.0/PKG-INFO +0 -175
- pybamm_gem-0.1.0/README.md +0 -127
- pybamm_gem-0.1.0/docs/_static/.gitkeep +0 -0
- pybamm_gem-0.1.0/docs/architecture.md +0 -42
- pybamm_gem-0.1.0/docs/conf.py +0 -191
- pybamm_gem-0.1.0/docs/design_principles.md +0 -101
- pybamm_gem-0.1.0/docs/index.md +0 -17
- pybamm_gem-0.1.0/docs/refs.bib +0 -0
- pybamm_gem-0.1.0/examples/01_parameter_set_registration_demo.ipynb +0 -259
- pybamm_gem-0.1.0/noxfile.py +0 -70
- pybamm_gem-0.1.0/pyproject.toml +0 -139
- pybamm_gem-0.1.0/src/pybamm_gem/__init__.py +0 -77
- pybamm_gem-0.1.0/src/pybamm_gem/_version.py +0 -24
- pybamm_gem-0.1.0/src/pybamm_gem/entry_point.py +0 -154
- pybamm_gem-0.1.0/src/pybamm_gem/models/input/ExampleReservoir.py +0 -200
- pybamm_gem-0.1.0/src/pybamm_gem/models/input/ExampleSPM.py +0 -215
- pybamm_gem-0.1.0/src/pybamm_gem/parameters/input/ExampleChen2020.py +0 -371
- pybamm_gem-0.1.0/src/pybamm_gem/parameters/input/Imperial2026.py +0 -352
- pybamm_gem-0.1.0/src/pybamm_gem/py.typed +0 -0
- pybamm_gem-0.1.0/tests/generated_project_tests/test_entry_points.py +0 -46
- pybamm_gem-0.1.0/tests/user_tests/test_package.py +0 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Runs the tests on every push and pull request, and every Monday, against the latest
|
|
2
|
+
# PyBaMM release. A failing scheduled run opens ONE issue (or adds a comment to the open
|
|
3
|
+
# one). It never changes any code.
|
|
4
|
+
name: CI
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
pull_request:
|
|
9
|
+
schedule:
|
|
10
|
+
- cron: "17 6 * * 1"
|
|
11
|
+
workflow_dispatch:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
issues: write
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
release:
|
|
19
|
+
name: PyBaMM release
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- name: Install
|
|
27
|
+
run: |
|
|
28
|
+
pip install --upgrade pip
|
|
29
|
+
pip install -e ".[dev]"
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: ruff check src tests
|
|
32
|
+
- name: Test
|
|
33
|
+
run: pytest
|
|
34
|
+
|
|
35
|
+
report:
|
|
36
|
+
name: Report a failure
|
|
37
|
+
needs: [release]
|
|
38
|
+
if: ${{ always() && github.event_name == 'schedule' && needs.release.result == 'failure' }}
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
steps:
|
|
41
|
+
- name: Open an issue, or comment on the open one
|
|
42
|
+
env:
|
|
43
|
+
GH_TOKEN: ${{ github.token }}
|
|
44
|
+
REPO: ${{ github.repository }}
|
|
45
|
+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
46
|
+
run: |
|
|
47
|
+
TITLE="Weekly check failed"
|
|
48
|
+
NUMBER=$(gh issue list --repo "$REPO" --state open --search "$TITLE in:title" --json number --jq '.[0].number')
|
|
49
|
+
if [ -z "$NUMBER" ]; then
|
|
50
|
+
gh issue create --repo "$REPO" --title "$TITLE" --body "The weekly check failed. See $RUN_URL"
|
|
51
|
+
else
|
|
52
|
+
gh issue comment "$NUMBER" --repo "$REPO" --body "Failed again. See $RUN_URL"
|
|
53
|
+
fi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- Rebuilt in the PyBaMM model-zoo layout: one folder per model, each with a `model.toml`
|
|
6
|
+
manifest, `CITATION.bib`, `README.md`, tests and an example.
|
|
7
|
+
- Models: `spm_2d` (`BasicSPM2D`), `spm_3d` (`BasicSPM3D`), `dfn_2d` (`DFN2D`) and `dfn_3d` (`DFN3D`).
|
|
8
|
+
- Registry: `pybamm_gem.list_models()`, `pybamm_gem.info()` and `pybamm_gem.load()`.
|
|
9
|
+
- Example notebook: `examples/higher_dimensional_models.ipynb`.
|
|
10
|
+
- Needs PyBaMM 26.9 or newer.
|
|
11
|
+
- The previous code is kept on the branch `legacy-2026-11`.
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
and
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Imperial College London
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
PyBaMM-GEM contains code adapted from PyBaMM (https://github.com/pybamm-team/PyBaMM):
|
|
2
|
+
|
|
3
|
+
- src/pybamm_gem/spm_2d/model.py, adapted from pybamm/models/full_battery_models/lithium_ion/basic_spm.py
|
|
4
|
+
- src/pybamm_gem/dfn_2d/model.py, the electrolyte and electrode submodel methods, adapted from
|
|
5
|
+
pybamm/models/submodels/electrolyte_conductivity/full_conductivity.py,
|
|
6
|
+
pybamm/models/submodels/electrolyte_diffusion/full_diffusion.py and
|
|
7
|
+
pybamm/models/submodels/electrode/ohm/full_ohm.py
|
|
8
|
+
|
|
9
|
+
PyBaMM is distributed under the following licence:
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2018, the PyBaMM team.
|
|
12
|
+
All rights reserved.
|
|
13
|
+
|
|
14
|
+
Redistribution and use in source and binary forms, with or without
|
|
15
|
+
modification, are permitted provided that the following conditions are met:
|
|
16
|
+
|
|
17
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
18
|
+
list of conditions and the following disclaimer.
|
|
19
|
+
|
|
20
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer in the documentation
|
|
22
|
+
and/or other materials provided with the distribution.
|
|
23
|
+
|
|
24
|
+
* Neither the name of the copyright holder nor the names of its
|
|
25
|
+
contributors may be used to endorse or promote products derived from
|
|
26
|
+
this software without specific prior written permission.
|
|
27
|
+
|
|
28
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
29
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
30
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
31
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
32
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
33
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
34
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
35
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
36
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
37
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: PyBaMM-GEM
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Spatially resolved (2D and 3D) battery models for PyBaMM
|
|
5
|
+
Author: Mohammed Asheruddin N
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
License-File: LICENSE.txt
|
|
8
|
+
License-File: LICENSES-bundled.txt
|
|
9
|
+
Keywords: battery,electrochemistry,lithium-ion,modelling,pybamm,simulation
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: pybamm[cite]>=26.9
|
|
12
|
+
Requires-Dist: tomli>=2.0.1; python_version < '3.11'
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
15
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# PyBaMM-GEM
|
|
19
|
+
|
|
20
|
+
Spatially resolved (2D and 3D) battery models built on [PyBaMM](https://pybamm.org), laid out
|
|
21
|
+
like the PyBaMM model zoo: one folder per model, each with a `model.toml` manifest, a
|
|
22
|
+
`CITATION.bib`, a README, tests and an example.
|
|
23
|
+
|
|
24
|
+
## Models
|
|
25
|
+
|
|
26
|
+
| Slug | Class | What it is |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `spm_2d` | `BasicSPM2D` | Single Particle Model with a pair of particles at every height z |
|
|
29
|
+
| `spm_3d` | `BasicSPM3D` | The same, over a y-z grid of points |
|
|
30
|
+
| `dfn_2d` | `DFN2D` | Doyle-Fuller-Newman model resolved in x and z |
|
|
31
|
+
| `dfn_3d` | `DFN3D` | The same, resolved in x, y and z |
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install git+https://github.com/ImperialCollegeLondon/PyBaMM-GEM
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
PyBaMM 26.9 or newer is needed.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import pybamm
|
|
45
|
+
import pybamm_gem as gem
|
|
46
|
+
|
|
47
|
+
print(gem.list_models())
|
|
48
|
+
model = gem.load("spm_2d")()
|
|
49
|
+
simulation = pybamm.Simulation(model)
|
|
50
|
+
solution = simulation.solve([0, 3000])
|
|
51
|
+
print(solution["Voltage [V]"](1500))
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The classes are also available directly, for example `gem.lithium_ion.BasicSPM2D` or
|
|
55
|
+
`gem.lithium_ion.DFN2D`.
|
|
56
|
+
|
|
57
|
+
The notebook `examples/higher_dimensional_models.ipynb` runs all four models, compares them with
|
|
58
|
+
the stock PyBaMM models and shows a temperature that changes with height.
|
|
59
|
+
|
|
60
|
+
## Licence
|
|
61
|
+
|
|
62
|
+
BSD 3-Clause, see `LICENSE.txt`. Copyright (c) 2026, Imperial College London.
|
|
63
|
+
Some of the model code is adapted from PyBaMM; see `LICENSES-bundled.txt`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# PyBaMM-GEM
|
|
2
|
+
|
|
3
|
+
Spatially resolved (2D and 3D) battery models built on [PyBaMM](https://pybamm.org), laid out
|
|
4
|
+
like the PyBaMM model zoo: one folder per model, each with a `model.toml` manifest, a
|
|
5
|
+
`CITATION.bib`, a README, tests and an example.
|
|
6
|
+
|
|
7
|
+
## Models
|
|
8
|
+
|
|
9
|
+
| Slug | Class | What it is |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `spm_2d` | `BasicSPM2D` | Single Particle Model with a pair of particles at every height z |
|
|
12
|
+
| `spm_3d` | `BasicSPM3D` | The same, over a y-z grid of points |
|
|
13
|
+
| `dfn_2d` | `DFN2D` | Doyle-Fuller-Newman model resolved in x and z |
|
|
14
|
+
| `dfn_3d` | `DFN3D` | The same, resolved in x, y and z |
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
pip install git+https://github.com/ImperialCollegeLondon/PyBaMM-GEM
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
PyBaMM 26.9 or newer is needed.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import pybamm
|
|
28
|
+
import pybamm_gem as gem
|
|
29
|
+
|
|
30
|
+
print(gem.list_models())
|
|
31
|
+
model = gem.load("spm_2d")()
|
|
32
|
+
simulation = pybamm.Simulation(model)
|
|
33
|
+
solution = simulation.solve([0, 3000])
|
|
34
|
+
print(solution["Voltage [V]"](1500))
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The classes are also available directly, for example `gem.lithium_ion.BasicSPM2D` or
|
|
38
|
+
`gem.lithium_ion.DFN2D`.
|
|
39
|
+
|
|
40
|
+
The notebook `examples/higher_dimensional_models.ipynb` runs all four models, compares them with
|
|
41
|
+
the stock PyBaMM models and shows a temperature that changes with height.
|
|
42
|
+
|
|
43
|
+
## Licence
|
|
44
|
+
|
|
45
|
+
BSD 3-Clause, see `LICENSE.txt`. Copyright (c) 2026, Imperial College London.
|
|
46
|
+
Some of the model code is adapted from PyBaMM; see `LICENSES-bundled.txt`.
|