Skip to content

Commit bb74c4e

Browse files
Merge pull request #2586 from pybamm-team/develop
Make release v22.12
2 parents 08db559 + e090ada commit bb74c4e

File tree

102 files changed

+3623
-3309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3623
-3309
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,15 @@
542542
"test",
543543
"doc"
544544
]
545+
},
546+
{
547+
"login": "iatzak",
548+
"name": "iatzak",
549+
"avatar_url": "https://avatars.githubusercontent.com/u/112731474?v=4",
550+
"profile": "https://github.com/iatzak",
551+
"contributions": [
552+
"doc"
553+
]
545554
}
546555
],
547556
"contributorsPerLine": 7,

.github/workflows/publish_pypi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ jobs:
7979
if: matrix.os == 'macos-latest'
8080
run: |
8181
# https://github.com/actions/virtual-environments/issues/1280
82+
rm -f /usr/local/bin/2to3*
83+
rm -f /usr/local/bin/idle3*
84+
rm -f /usr/local/bin/pydoc3*
85+
rm -f /usr/local/bin/python3*
8286
brew update
8387
brew reinstall gcc
8488
python -m pip install cmake wget

.github/workflows/test_on_push.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ jobs:
6868
- name: Install MacOS system dependencies
6969
if: matrix.os == 'macos-latest'
7070
run: |
71-
rm -f /usr/local/bin/2to3
71+
rm -f /usr/local/bin/2to3*
72+
rm -f /usr/local/bin/idle3*
73+
rm -f /usr/local/bin/pydoc3*
74+
rm -f /usr/local/bin/python3*
7275
brew update
7376
brew install graphviz
7477
brew install openblas

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
exclude: assets/js/webapp\.js
1111

1212
- repo: https://github.com/psf/black
13-
rev: 22.10.0
13+
rev: 22.12.0
1414
hooks:
1515
- id: black
1616

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# [Unreleased](https://github.com/pybamm-team/PyBaMM/)
22

3+
# [v22.12](https://github.com/pybamm-team/PyBaMM/tree/v22.12) - 2022-12-31
4+
5+
## Features
6+
7+
- Added functionality to create `pybamm.ParameterValues` from a [BPX standard](https://github.com/pybamm-team/BPX) JSON file ([#2555](https://github.com/pybamm-team/PyBaMM/pull/2555)).
8+
- Allow the option "surface form" to be "differential" in the `MPM` ([#2533](https://github.com/pybamm-team/PyBaMM/pull/2533))
9+
- Added variables "Loss of lithium due to loss of active material in negative/positive electrode [mol]". These should be included in the calculation of "total lithium in system" to make sure that lithium is truly conserved. ([#2529](https://github.com/pybamm-team/PyBaMM/pull/2529))
10+
- `initial_soc` can now be a string "x V", in which case the simulation is initialized to start from that voltage ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))
11+
- The `ElectrodeSOH` solver can now calculate electrode balance based on a target "cell capacity" (requires cell capacity "Q" as input), as well as the default "cyclable cell capacity" (requires cyclable lithium capacity "Q_Li" as input). Use the keyword argument `known_value` to control which is used. ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))
12+
13+
## Bug fixes
14+
15+
- Fixed bug with `EntryPoints` in Spyder IDE ([#2584](https://github.com/pybamm-team/PyBaMM/pull/2584))
16+
- Fixed electrolyte conservation when options {"surface form": "algebraic"} are used
17+
- Fixed "constant concentration" electrolyte model so that "porosity times concentration" is conserved when porosity changes ([#2529](https://github.com/pybamm-team/PyBaMM/pull/2529))
18+
- Fix installation on `Google Colab` (`pybtex` and `Colab` issue) ([#2526](https://github.com/pybamm-team/PyBaMM/pull/2526))
19+
20+
## Breaking changes
21+
22+
- Renamed "Negative/Positive electrode SOC" to "Negative/Positive electrode stoichiometry" to avoid confusion with cell SOC ([#2529](https://github.com/pybamm-team/PyBaMM/pull/2529))
23+
- Removed external variables and submodels. InputParameter should now be used in all cases ([#2502](https://github.com/pybamm-team/PyBaMM/pull/2502))
24+
- Trying to use a solver to solve multiple models results in a RuntimeError exception ([#2481](https://github.com/pybamm-team/PyBaMM/pull/2481))
25+
- Inputs for the `ElectrodeSOH` solver are now (i) "Q_Li", the total cyclable capacity of lithium in the electrodes (previously "n_Li", the total number of moles, n_Li = 3600/F \* Q_Li) (ii) "Q_n", the capacity of the negative electrode (previously "C_n"), and "Q_p", the capacity of the positive electrode (previously "C_p") ([#2508](https://github.com/pybamm-team/PyBaMM/pull/2508))
26+
327
# [v22.11.1](https://github.com/pybamm-team/PyBaMM/tree/v22.11.1) - 2022-12-13
428

529
## Bug fixes

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ keywords:
2424
- "expression tree"
2525
- "python"
2626
- "symbolic differentiation"
27-
version: "22.11.1"
27+
version: "22.12"
2828
repository-code: "https://github.com/pybamm-team/PyBaMM"
2929
title: "Python Battery Mathematical Modelling (PyBaMM)"

CONTRIBUTING.md

Lines changed: 70 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Finally, if you really, really, _really_ love developing PyBaMM, have a look at
6161

6262
## Coding style guidelines
6363

64-
PyBaMM follows the [PEP8 recommendations](https://www.python.org/dev/peps/pep-0008/) for coding style. These are very common guidelines, and community tools have been developed to check how well projects implement them. We recommend using pre-commit hooks to check your code before committing it. See [installing and using pre-commit](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md#installing-and using-pre-commit) section for more details.
64+
PyBaMM follows the [PEP8 recommendations](https://www.python.org/dev/peps/pep-0008/) for coding style. These are very common guidelines, and community tools have been developed to check how well projects implement them. We recommend using pre-commit hooks to check your code before committing it. See [installing and using pre-commit](https://github.com/pybamm-team/PyBaMM/blob/develop/CONTRIBUTING.md#installing-and-using-pre-commit) section for more details.
6565

6666
### Flake8
6767

@@ -194,67 +194,76 @@ This also means that, if you can't fix the bug yourself, it will be much easier
194194

195195
1. Run individual test scripts instead of the whole test suite:
196196

197-
```bash
198-
python tests/unit/path/to/test
199-
```
197+
```bash
198+
python tests/unit/path/to/test
199+
```
200200

201-
You can also run an individual test from a particular script, e.g.
201+
You can also run an individual test from a particular script, e.g.
202202

203-
```bash
204-
python tests/unit/test_quick_plot.py TestQuickPlot.test_failure
205-
```
203+
```bash
204+
python tests/unit/test_quick_plot.py TestQuickPlot.test_failure
205+
```
206206

207-
If you want to run several, but not all, the tests from a script, you can restrict which tests are run from a particular script by using the skipping decorator:
207+
If you want to run several, but not all, the tests from a script, you can restrict which tests are run from a particular script by using the skipping decorator:
208208

209-
```python
210-
@unittest.skip("")
211-
def test_bit_of_code(self):
212-
...
213-
```
209+
```python
210+
@unittest.skip("")
211+
def test_bit_of_code(self):
212+
...
213+
```
214214

215-
or by just commenting out all the tests you don't want to run 2. Set break points, either in your IDE or using the python debugging module. To use the latter, add the following line where you want to set the break point
215+
or by just commenting out all the tests you don't want to run.
216216

217-
```python
218-
import ipdb; ipdb.set_trace()
219-
```
217+
2. Set break points, either in your IDE or using the python debugging module. To use the latter, add the following line where you want to set the break point
220218

221-
This will start the [Python interactive debugger](https://gist.github.com/mono0926/6326015). If you want to be able to use magic commands from `ipython`, such as `%timeit`, then set
219+
```python
220+
import ipdb; ipdb.set_trace()
221+
```
222222

223-
```python
224-
from IPython import embed; embed(); import ipdb; ipdb.set_trace()
225-
```
223+
This will start the [Python interactive debugger](https://gist.github.com/mono0926/6326015). If you want to be able to use magic commands from `ipython`, such as `%timeit`, then set
226224

227-
at the break point instead.
228-
Figuring out where to start the debugger is the real challenge. Some good ways to set debugging break points are:
229-
a. Try-except blocks. Suppose the line `do_something_complicated()` is raising a `ValueError`. Then you can put a try-except block around that line as:
225+
```python
226+
from IPython import embed; embed(); import ipdb; ipdb.set_trace()
227+
```
230228

231-
```python
232-
try:
233-
do_something_complicated()
234-
except ValueError:
235-
import ipdb; ipdb.set_trace()
236-
```
229+
at the break point instead.
230+
Figuring out where to start the debugger is the real challenge. Some good ways to set debugging break points are:
237231

238-
This will start the debugger at the point where the `ValueError` was raised, and allow you to investigate further. Sometimes, it is more informative to put the try-except block further up the call stack than exactly where the error is raised.
239-
b. Warnings. If functions are raising warnings instead of errors, it can be hard to pinpoint where this is coming from. Here, you can use the `warnings` module to convert warnings to errors:
232+
1. Try-except blocks. Suppose the line `do_something_complicated()` is raising a `ValueError`. Then you can put a try-except block around that line as:
240233

241-
```python
242-
import warnings
243-
warnings.simplefilter("error")
244-
```
234+
```python
235+
try:
236+
do_something_complicated()
237+
except ValueError:
238+
import ipdb; ipdb.set_trace()
239+
```
245240

246-
Then you can use a try-except block, as in a., but with, for example, `RuntimeWarning` instead of `ValueError`.
247-
c. Stepping through the expression tree. Most calls in PyBaMM are operations on [expression trees](https://github.com/pybamm-team/PyBaMM/blob/develop/examples/notebooks/expression_tree/expression-tree.ipynb). To view an expression tree in ipython, you can use the `render` command:
241+
This will start the debugger at the point where the `ValueError` was raised, and allow you to investigate further. Sometimes, it is more informative to put the try-except block further up the call stack than exactly where the error is raised.
248242

249-
```python
250-
expression_tree.render()
251-
```
243+
2. Warnings. If functions are raising warnings instead of errors, it can be hard to pinpoint where this is coming from. Here, you can use the `warnings` module to convert warnings to errors:
252244

253-
You can then step through the expression tree, using the `children` attribute, to pinpoint exactly where a bug is coming from. For example, if `expression_tree.jac(y)` is failing, you can check `expression_tree.children[0].jac(y)`, then `expression_tree.children[0].children[0].jac(y)`, etc. 3. To isolate whether a bug is in a model, its jacobian or its simplified version, you can set the `use_jacobian` and/or `use_simplify` attributes of the model to `False` (they are both `True` by default for most models). 4. If a model isn't giving the answer you expect, you can try comparing it to other models. For example, you can investigate parameter limits in which two models should give the same answer by setting some parameters to be small or zero. The `StandardOutputComparison` class can be used to compare some standard outputs from battery models. 5. To get more information about what is going on under the hood, and hence understand what is causing the bug, you can set the [logging](https://realpython.com/python-logging/) level to `DEBUG` by adding the following line to your test or script:
245+
```python
246+
import warnings
247+
warnings.simplefilter("error")
248+
```
254249

255-
```python3
256-
pybamm.set_logging_level("DEBUG")
257-
```
250+
Then you can use a try-except block, as in a., but with, for example, `RuntimeWarning` instead of `ValueError`.
251+
252+
3. Stepping through the expression tree. Most calls in PyBaMM are operations on [expression trees](https://github.com/pybamm-team/PyBaMM/blob/develop/examples/notebooks/expression_tree/expression-tree.ipynb). To view an expression tree in ipython, you can use the `render` command:
253+
254+
```python
255+
expression_tree.render()
256+
```
257+
258+
You can then step through the expression tree, using the `children` attribute, to pinpoint exactly where a bug is coming from. For example, if `expression_tree.jac(y)` is failing, you can check `expression_tree.children[0].jac(y)`, then `expression_tree.children[0].children[0].jac(y)`, etc.
259+
260+
3. To isolate whether a bug is in a model, its jacobian or its simplified version, you can set the `use_jacobian` and/or `use_simplify` attributes of the model to `False` (they are both `True` by default for most models).
261+
4. If a model isn't giving the answer you expect, you can try comparing it to other models. For example, you can investigate parameter limits in which two models should give the same answer by setting some parameters to be small or zero. The `StandardOutputComparison` class can be used to compare some standard outputs from battery models.
262+
5. To get more information about what is going on under the hood, and hence understand what is causing the bug, you can set the [logging](https://realpython.com/python-logging/) level to `DEBUG` by adding the following line to your test or script:
263+
264+
```python3
265+
pybamm.set_logging_level("DEBUG")
266+
```
258267

259268
6. In models that inherit from `pybamm.BaseBatteryModel` (i.e. any battery model), you can use `self.process_parameters_and_discretise` to process a symbol and see what it will look like.
260269

@@ -270,24 +279,26 @@ as above, and then use some of the profiling tools. In order of increasing detai
270279

271280
1. Simple timer. In ipython, the command
272281

273-
```
274-
%time command_to_time()
275-
```
282+
```
283+
%time command_to_time()
284+
```
276285

277-
tells you how long the line `command_to_time()` takes. You can use `%timeit` instead to run the command several times and obtain more accurate timings. 2. Simple profiler. Using `%prun` instead of `%time` will give a brief profiling report 3. Detailed profiler. You can install the detailed profiler `snakeviz` through pip:
286+
tells you how long the line `command_to_time()` takes. You can use `%timeit` instead to run the command several times and obtain more accurate timings.
278287

279-
```bash
280-
pip install snakeviz
281-
```
288+
2. Simple profiler. Using `%prun` instead of `%time` will give a brief profiling report 3. Detailed profiler. You can install the detailed profiler `snakeviz` through pip:
282289

283-
and then, in ipython, run
290+
```bash
291+
pip install snakeviz
292+
```
284293

285-
```
286-
%load_ext snakeviz
287-
%snakeviz command_to_time()
288-
```
294+
and then, in ipython, run
295+
296+
```
297+
%load_ext snakeviz
298+
%snakeviz command_to_time()
299+
```
289300

290-
This will open a window in your browser with detailed profiling information.
301+
This will open a window in your browser with detailed profiling information.
291302

292303
## Documentation
293304

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
1616

17-
[![All Contributors](https://img.shields.io/badge/all_contributors-48-orange.svg)](#-contributors)
17+
[![All Contributors](https://img.shields.io/badge/all_contributors-49-orange.svg)](#-contributors)
1818

1919
<!-- ALL-CONTRIBUTORS-BADGE:END -->
2020

@@ -218,6 +218,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
218218
<td align="center"><a href="https://github.com/abillscmu"><img src="https://avatars.githubusercontent.com/u/48105066?v=4?s=100" width="100px;" alt="Alec Bills"/><br /><sub><b>Alec Bills</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=abillscmu" title="Code">💻</a></td>
219219
<td align="center"><a href="https://github.com/agriyakhetarpal"><img src="https://avatars.githubusercontent.com/u/74401230?v=4?s=100" width="100px;" alt="Agriya Khetarpal"/><br /><sub><b>Agriya Khetarpal</b></sub></a><br /><a href="#infra-agriyakhetarpal" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=agriyakhetarpal" title="Code">💻</a></td>
220220
<td align="center"><a href="https://github.com/awadell1"><img src="https://avatars.githubusercontent.com/u/5857298?v=4?s=100" width="100px;" alt="Alex Wadell"/><br /><sub><b>Alex Wadell</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=awadell1" title="Code">💻</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=awadell1" title="Tests">⚠️</a> <a href="https://github.com/pybamm-team/PyBaMM/commits?author=awadell1" title="Documentation">📖</a></td>
221+
<td align="center"><a href="https://github.com/iatzak"><img src="https://avatars.githubusercontent.com/u/112731474?v=4?s=100" width="100px;" alt="iatzak"/><br /><sub><b>iatzak</b></sub></a><br /><a href="https://github.com/pybamm-team/PyBaMM/commits?author=iatzak" title="Documentation">📖</a></td>
221222
</tr>
222223
</tbody>
223224
</table>

casadi-headers

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit c31bbfbb5149f090ab30e6cba6898150525e9dfe

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
author = "The PyBaMM Team"
2828

2929
# The short X.Y version
30-
version = "22.11.1"
30+
version = "22.12"
3131
# The full version, including alpha/beta/rc tags
3232
release = version
3333

0 commit comments

Comments
 (0)