From 6835652be64603f9e3f1a987113ad02ed814a97a Mon Sep 17 00:00:00 2001 From: Valentin Sulzer Date: Mon, 24 May 2021 11:20:19 -0400 Subject: [PATCH] #1405 changelog and rob comments --- CHANGELOG.md | 8 ++++---- .../models/full_battery_models/lithium_ion/dfn.py | 1 + .../models/full_battery_models/lithium_ion/spm.py | 2 ++ .../models/full_battery_models/lithium_ion/spme.py | 2 ++ .../reaction_driven_active_material.py | 14 +++++++------- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e3d3882b2..1113e2030f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ ## Features -- Added a new "reaction-driven" model for LAM from Reniers et al (2019) -- 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 +- 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)) @@ -12,7 +12,7 @@ ## Optimizations -- Models that mostly use x-averaged quantities (SPM and SPMe) now use x-averaged degradation models +- 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)) @@ -23,7 +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 +- 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)) diff --git a/pybamm/models/full_battery_models/lithium_ion/dfn.py b/pybamm/models/full_battery_models/lithium_ion/dfn.py index d8a66416c3..f57ec0e89d 100644 --- a/pybamm/models/full_battery_models/lithium_ion/dfn.py +++ b/pybamm/models/full_battery_models/lithium_ion/dfn.py @@ -32,6 +32,7 @@ class DFN(BaseModel): def __init__(self, options=None, name="Doyle-Fuller-Newman model", build=True): super().__init__(options, name) + # For degradation models we use the full form since this is a full-order model self.x_average = False self.set_external_circuit_submodel() diff --git a/pybamm/models/full_battery_models/lithium_ion/spm.py b/pybamm/models/full_battery_models/lithium_ion/spm.py index 49b35b5044..5255b4033b 100644 --- a/pybamm/models/full_battery_models/lithium_ion/spm.py +++ b/pybamm/models/full_battery_models/lithium_ion/spm.py @@ -31,6 +31,8 @@ class SPM(BaseModel): def __init__(self, options=None, name="Single Particle Model", build=True): super().__init__(options, name) + # For degradation models we use the "x-average" form since this is a + # reduced-order model with uniform current density in the electrodes self.x_average = True self.set_external_circuit_submodel() diff --git a/pybamm/models/full_battery_models/lithium_ion/spme.py b/pybamm/models/full_battery_models/lithium_ion/spme.py index 91987c5728..35747bd809 100644 --- a/pybamm/models/full_battery_models/lithium_ion/spme.py +++ b/pybamm/models/full_battery_models/lithium_ion/spme.py @@ -34,6 +34,8 @@ def __init__( self, options=None, name="Single Particle Model with electrolyte", build=True ): super().__init__(options, name) + # For degradation models we use the "x-average" form since this is a + # reduced-order model with uniform current density in the electrodes self.x_average = True self.set_external_circuit_submodel() diff --git a/pybamm/models/submodels/active_material/reaction_driven_active_material.py b/pybamm/models/submodels/active_material/reaction_driven_active_material.py index 09730204ab..9f2011feb2 100644 --- a/pybamm/models/submodels/active_material/reaction_driven_active_material.py +++ b/pybamm/models/submodels/active_material/reaction_driven_active_material.py @@ -83,20 +83,20 @@ def get_coupled_variables(self, variables): return variables def set_rhs(self, variables): - Domain = self.domain + " electrode" + domain = self.domain.lower() + " electrode" if self.x_average is True: eps_solid = variables[ - "X-averaged " + Domain.lower() + " active material volume fraction" + "X-averaged " + domain + " active material volume fraction" ] deps_solid_dt = variables[ - "X-averaged " - + Domain.lower() - + " active material volume fraction change" + "X-averaged " + domain + " active material volume fraction change" ] else: - eps_solid = variables[Domain + " active material volume fraction"] + eps_solid = variables[ + self.domain + " electrode active material volume fraction" + ] deps_solid_dt = variables[ - Domain + " active material volume fraction change" + self.domain + " electrode active material volume fraction change" ] self.rhs = {eps_solid: deps_solid_dt}