Skip to content

Commit

Permalink
#2418 merge external variable removal
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Dec 13, 2022
2 parents a0fbd0a + 3ce5439 commit 173027c
Show file tree
Hide file tree
Showing 49 changed files with 574 additions and 1,461 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
exclude: assets/js/webapp\.js

- repo: https://github.com/psf/black
rev: 22.10.0
rev: 22.12.0
hooks:
- id: black

Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
## Breaking changes

- Renamed "Negative/Positive electrode SOC" to "Negative/Positive electrode filling fraction" to avoid confusion with cell SOC ([#2529](https://github.com/pybamm-team/PyBaMM/pull/2529))
- Removed external variables and submodels. InputParameter should now be used in all cases ([#2502](https://github.com/pybamm-team/PyBaMM/pull/2502))
- Trying to use a solver to solve multiple models results in a RuntimeError exception ([#2481](https://github.com/pybamm-team/PyBaMM/pull/2481))
- 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))
- All PyBaMM models are now dimensional. This has been benchmarked against dimensionless models and found to give around the same solve time. Implementing dimensional models greatly reduces the barrier to entry for adding new models. However, this comes with several breaking changes: (i) the `timescale` and `length_scales` attributes of a model have been removed (they are no longer needed) (ii) several dimensionless variables are no longer defined, but the corresponding dimensional variables can still be accessed by adding the units to the name (iii) some parameters used only for non-dimensionalization, such as "Typical current [A]", have been removed ([#2419](https://github.com/pybamm-team/PyBaMM/pull/2419))

# [v22.11](https://github.com/pybamm-team/PyBaMM/tree/v22.11) - 2022-11-30

Expand All @@ -40,7 +43,6 @@

## Breaking changes

- All PyBaMM models are now dimensional. This has been benchmarked against dimensionless models and found to give around the same solve time. Implementing dimensional models greatly reduces the barrier to entry for adding new models. However, this comes with several breaking changes: (i) the `timescale` and `length_scales` attributes of a model have been removed (they are no longer needed) (ii) several dimensionless variables are no longer defined, but the corresponding dimensional variables can still be accessed by adding the units to the name (iii) some parameters used only for non-dimensionalization, such as "Typical current [A]", have been removed ([#2419](https://github.com/pybamm-team/PyBaMM/pull/2419))
- Interpolants created from parameter data are now "linear" by default (was "cubic") ([#2494](https://github.com/pybamm-team/PyBaMM/pull/2494))
- Renamed entry point for parameter sets to `pybamm_parameter_sets` ([#2475](https://github.com/pybamm-team/PyBaMM/pull/2475))
- Removed code for generating `ModelingToolkit` problems ([#2432](https://github.com/pybamm-team/PyBaMM/pull/2432))
Expand Down
1 change: 1 addition & 0 deletions casadi-headers
Submodule casadi-headers added at c31bbf
3 changes: 0 additions & 3 deletions docs/source/expression_tree/variable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,3 @@ Variable
.. autoclass:: pybamm.VariableDot
:members:

.. autoclass:: pybamm.ExternalVariable
:members:

Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
"\u001b[33mWARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.\n",
"You should consider upgrading via the '/home/mrobins/git/PyBaMM/env/bin/python -m pip install --upgrade pip' command.\u001b[0m\u001b[33m\n",
"\u001b[0mNote: you may need to restart the kernel to use updated packages.\n"
]
}
],
Expand All @@ -75,7 +77,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -91,7 +93,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -111,7 +113,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -128,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -162,7 +164,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -197,7 +199,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -221,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -244,7 +246,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -285,21 +287,21 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2021-11-19 15:29:38,512 - [WARNING] processed_variable.get_spatial_scale(520): No length scale set for negative particle. Using default of 1 [m].\n",
"2021-11-19 15:29:38,541 - [WARNING] processed_variable.get_spatial_scale(520): No length scale set for negative particle. Using default of 1 [m].\n"
"2022-12-12 12:41:59.589 - [WARNING] processed_variable.get_spatial_scale(518): No length scale set for negative particle. Using default of 1 [m].\n",
"2022-12-12 12:41:59.609 - [WARNING] processed_variable.get_spatial_scale(518): No length scale set for negative particle. Using default of 1 [m].\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c7ec6d3f5bf14206a6ec219f10583c46",
"model_id": "6fa9ebee57924ba5b79a2c51313fba25",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -313,10 +315,10 @@
],
"source": [
"# loop over models to solve\n",
"solver = pybamm.ScipySolver()\n",
"t = np.linspace(0, 3600, 600)\n",
"solutions = [None] * len(models) # create list to hold solutions\n",
"for i, model in enumerate(models):\n",
" solver = pybamm.ScipySolver()\n",
" solutions[i] = solver.solve(model, t)\n",
"\n",
"# post-process the solution of the full model\n",
Expand Down Expand Up @@ -386,7 +388,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand All @@ -408,7 +410,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "env",
"language": "python",
"name": "python3"
},
Expand All @@ -422,7 +424,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0"
"version": "3.9.15"
},
"toc": {
"base_numbering": 1,
Expand All @@ -436,6 +438,11 @@
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
},
"vscode": {
"interpreter": {
"hash": "19e5ebaa8d5a3277b4deed2928f02ad0cad6c3ab0b2beced644d557f155bce64"
}
}
},
"nbformat": 4,
Expand Down
200 changes: 106 additions & 94 deletions examples/notebooks/change-settings.ipynb

Large diffs are not rendered by default.

51 changes: 29 additions & 22 deletions examples/notebooks/models/compare-lithium-ion.ipynb

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions examples/notebooks/models/lead-acid.ipynb

Large diffs are not rendered by default.

43 changes: 23 additions & 20 deletions examples/notebooks/solvers/dae-solver.ipynb

Large diffs are not rendered by default.

39 changes: 21 additions & 18 deletions examples/notebooks/solvers/ode-solver.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 173027c

Please sign in to comment.