Skip to content

Commit

Permalink
Merge pull request #1490 from pybamm-team/issue-1405-xaverage
Browse files Browse the repository at this point in the history
Issue 1405 xaverage
  • Loading branch information
valentinsulzer authored May 24, 2021
2 parents 8445c27 + 6835652 commit 7d8ec5c
Show file tree
Hide file tree
Showing 73 changed files with 1,219 additions and 1,106 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Features

- Added a new "reaction-driven" model for LAM from Reniers et al (2019) ([#1490](https://github.com/pybamm-team/PyBaMM/pull/1490))
- Some features ("loss of active material" and "particle mechanics") can now be specified separately for the negative electrode and positive electrode by passing a 2-tuple ([#1490](https://github.com/pybamm-team/PyBaMM/pull/1490))
- `plot` and `plot2D` now take and return a matplotlib Axis to allow for easier customization ([#1472](https://github.com/pybamm-team/PyBaMM/pull/1472))
- `ParameterValues.evaluate` can now return arrays to allow function parameters to be easily evaluated ([#1472](https://github.com/pybamm-team/PyBaMM/pull/1472))
- Added Batch Study class ([#1455](https://github.com/pybamm-team/PyBaMM/pull/1455))
Expand All @@ -10,6 +12,7 @@

## Optimizations

- Models that mostly use x-averaged quantities (SPM and SPMe) now use x-averaged degradation models ([#1490](https://github.com/pybamm-team/PyBaMM/pull/1490))
- Improved how the CasADi solver's "safe" mode finds events ([#1450](https://github.com/pybamm-team/PyBaMM/pull/1450))
- Perform more automatic simplifications of the expression tree ([#1449](https://github.com/pybamm-team/PyBaMM/pull/1449))
- Reduce time taken to hash a sparse `Matrix` object ([#1449](https://github.com/pybamm-team/PyBaMM/pull/1449))
Expand All @@ -20,6 +23,7 @@

## Breaking changes

- Changed how options are specified for the "loss of active material" and "particle cracking" submodels. "loss of active material" can now be one of "none", "stress-driven", or "reaction-driven", or a 2-tuple for different options in negative and positive electrode. Similarly "particle cracking" (now called "particle mechanics") can now be "none", "swelling only", "swelling and cracking", or a 2-tuple ([#1490](https://github.com/pybamm-team/PyBaMM/pull/1490))
- Changed the variable in the full diffusion model from "Electrolyte concentration" to "Porosity times concentration" ([#1476](https://github.com/pybamm-team/PyBaMM/pull/1476))
- Renamed `lithium-ion` folder to `lithium_ion` and `lead-acid` folder to `lead_acid` in parameters ([#1464](https://github.com/pybamm-team/PyBaMM/pull/1464))

Expand Down Expand Up @@ -94,11 +98,11 @@ This release introduces:

# [v0.3.0](https://github.com/pybamm-team/PyBaMM/tree/v0.3.0) - 2020-12-01

This release introduces a new aging model for particle swelling and cracking, a new reduced-order model (TSPMe), and a parameter set for A123 LFP cells. Additionally, there have been several backend optimizations to speed up model creation and solving, and other minor features and bug fixes.
This release introduces a new aging model for particle mechanics, a new reduced-order model (TSPMe), and a parameter set for A123 LFP cells. Additionally, there have been several backend optimizations to speed up model creation and solving, and other minor features and bug fixes.

## Features

- Added a submodel for particle swelling and cracking ([#1232](https://github.com/pybamm-team/PyBaMM/pull/1232))
- Added a submodel for particle mechanics ([#1232](https://github.com/pybamm-team/PyBaMM/pull/1232))
- Added a notebook on how to speed up the solver and handle instabilities ([#1223](https://github.com/pybamm-team/PyBaMM/pull/1223))
- Improve string printing of `BinaryOperator`, `Function`, and `Concatenation` objects ([#1223](https://github.com/pybamm-team/PyBaMM/pull/1223))
- Added `Solution.integration_time`, which is the time taken just by the integration subroutine, without extra setups ([#1223](https://github.com/pybamm-team/PyBaMM/pull/1223))
Expand Down
2 changes: 1 addition & 1 deletion docs/source/models/base_models/base_battery_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Base Battery Model
.. autoclass:: pybamm.BaseBatteryModel
:members:

.. autoclass:: pybamm.Options
.. autoclass:: pybamm.BatteryModelOptions
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Base Model
===========

.. autoclass:: pybamm.active_material.BaseModel
:members:

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Constant Active Material
========================

.. autoclass:: pybamm.active_material.Constant
:members:


13 changes: 13 additions & 0 deletions docs/source/models/submodels/active_material/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Active Material
===============

Submodels for (loss of) active material

.. toctree::
:maxdepth: 1

base_active_material
constant_active_material
reaction_driven_active_material
stress_driven_active_material

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Reaction-driven Loss of Active Material
=======================================

.. autoclass:: pybamm.active_material.ReactionDriven
:members:



Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Stress-driven Loss of Active Material
=====================================

.. autoclass:: pybamm.active_material.StressDriven
:members:



1 change: 1 addition & 0 deletions docs/source/models/submodels/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Submodels
:maxdepth: 1

base_submodel
active_material/index
current_collector/index
convection/index
electrode/index
Expand Down
2 changes: 1 addition & 1 deletion docs/source/models/submodels/particle_cracking/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Particle Cracking

base_cracking
crack_propagation
no_cracking
swelling_only

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Swelling Only Model
===================

.. autoclass:: pybamm.particle_cracking.SwellingOnly
:members:

This file was deleted.

3 changes: 1 addition & 2 deletions docs/source/models/submodels/porosity/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ Porosity

base_porosity
constant_porosity
leading_reaction_driven_porosity
full_reaction_driven_porosity
reaction_driven_porosity

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Reaction-driven Model
=====================

.. autoclass:: pybamm.porosity.ReactionDriven
:members:



49 changes: 25 additions & 24 deletions examples/notebooks/Validating_mechanical_models_Enertech_DFN.ipynb

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions examples/notebooks/submodel_cracking_DFN_or_SPM,.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mWARNING: You are using pip version 21.0.1; however, version 21.1.1 is available.\n",
"You should consider upgrading via the '/Users/vsulzer/Documents/Energy_storage/PyBaMM/.tox/dev/bin/python -m pip install --upgrade pip' command.\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
Expand Down Expand Up @@ -48,10 +50,7 @@
"# model = pybamm.lithium_ion.SPMe(\n",
"# model = pybamm.lithium_ion.SPM(\n",
"model = pybamm.lithium_ion.DFN(\n",
" options = {\n",
" \"particle\": \"Fickian diffusion\", \n",
" \"particle cracking\": \"both\", # other options are \"positive\", \"negative\" or \"none\"\n",
" }\n",
" options = {\"particle mechanics\": \"swelling and cracking\"}\n",
")"
]
},
Expand Down Expand Up @@ -90,7 +89,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cefb37faadae47bcb1ddbeb5ea034ad8",
"model_id": "c3b1f934d8e34942a66d8771c0d09d17",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -129,7 +128,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8e09d0af090a45a78fe27f6595821aa9",
"model_id": "232ab4b5fb4b49d6832cc709518ad61a",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -196,7 +195,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4df7bf436fbd4067aee4b16a61793577",
"model_id": "f42ca205ce824664917d70d8ff35bebf",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -269,9 +268,22 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.8"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": true
}
},
"nbformat": 4,
"nbformat_minor": 2
}
}
33 changes: 24 additions & 9 deletions examples/notebooks/submodel_loss_of_active_materials.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/scripts/cycling_ageing_yang.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
]
)
sim = pb.Simulation(model, experiment=experiment)
sim.solve(solver=pb.CasadiSolver(mode="safe"))
sim.solve(solver=pb.CasadiSolver(mode="fast with events"))
sim.plot(
[
"Current [A]",
Expand Down
5 changes: 4 additions & 1 deletion pybamm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def version(formatted=False):
from .models.event import EventType

# Battery models
from .models.full_battery_models.base_battery_model import BaseBatteryModel, Options
from .models.full_battery_models.base_battery_model import (
BaseBatteryModel,
BatteryModelOptions,
)
from .models.full_battery_models import lead_acid
from .models.full_battery_models import lithium_ion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ EC initial concentration in electrolyte [mol.m-3], 4.541E3, Safari paper,
EC diffusivity [m2.s-1], 2E-18, adjusted parameter in Yang paper,
SEI kinetic rate constant [m.s-1], 1e-12, adjusted parameter in Yang paper,
SEI open-circuit potential [V], 0.4, Safari paper,
,,,
# Reaction-driven LAM example,,,
Negative electrode reaction-driven LAM factor [m3.mol-1],0,,
Positive electrode reaction-driven LAM factor [m3.mol-1],0,,

2 changes: 1 addition & 1 deletion pybamm/models/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class BaseModel(object):

def __init__(self, name="Unnamed model"):
self.name = name
self.options = {}
self._options = {}

# Initialise empty model
self._rhs = {}
Expand Down
Loading

0 comments on commit 7d8ec5c

Please sign in to comment.