From 0e70d3e94819c7109aa78c4d87e0029a369cc7b9 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Tue, 27 Aug 2024 10:51:58 +0100 Subject: [PATCH 01/17] Started modifying porosity change submodel to work with phases --- .../porosity/reaction_driven_porosity.py | 71 ++++++++++++------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index fc69d0f1fd..3dceb14eba 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -23,38 +23,61 @@ def __init__(self, param, options, x_average): self.x_average = x_average def get_coupled_variables(self, variables): + param = self.param eps_dict = {} for domain in self.options.whole_cell_domains: + delta_eps_k = 0 if domain == "separator": - delta_eps_k = 0 # separator porosity does not change + pass # separator porosity does not change else: - Domain = domain.split()[0].capitalize() - L_sei_k = variables[f"{Domain} total SEI thickness [m]"] - if Domain == "Negative": - L_sei_0 = self.param.n.prim.L_inner_0 + self.param.n.prim.L_outer_0 - elif Domain == "Positive": - L_sei_0 = self.param.p.prim.L_inner_0 + self.param.p.prim.L_outer_0 - L_pl_k = variables[f"{Domain} lithium plating thickness [m]"] - L_dead_k = variables[f"{Domain} dead lithium thickness [m]"] - L_sei_cr_k = variables[f"{Domain} total SEI on cracks thickness [m]"] + dom = domain.split()[0] + Domain = dom.capitalize() roughness_k = variables[f"{Domain} electrode roughness ratio"] + phases = self.options.phases[dom] + for phase in phases: + L_sei_k = variables[f"{Domain} total {phase} SEI thickness [m]"] + if Domain == "Negative": + if phase == "secondary": + L_sei_0 = ( + param.n.sec.L_inner_0 + param.n.sec.L_outer_0 + ) + else: + L_sei_0 = ( + param.n.prim.L_inner_0 + param.n.prim.L_outer_0 + ) + elif Domain == "Positive": + if phase == "secondary": + L_sei_0 = ( + param.p.sec.L_inner_0 + param.p.sec.L_outer_0 + ) + else: + L_sei_0 = ( + param.p.prim.L_inner_0 + param.p.prim.L_outer_0 + ) + L_pl_k = variables[ + f"{Domain} {phase} lithium plating thickness [m]" + ] + L_dead_k = variables[f"{Domain} {phase} dead lithium thickness [m]"] + L_sei_cr_k = variables[ + f"{Domain} total {phase} SEI on cracks thickness [m]" + ] - L_tot = ( - (L_sei_k - L_sei_0) - + L_pl_k - + L_dead_k - + L_sei_cr_k * (roughness_k - 1) - ) + L_tot = ( + (L_sei_k - L_sei_0) + + L_pl_k + + L_dead_k + + L_sei_cr_k * (roughness_k - 1) + ) - a_k = variables[ - f"{Domain} electrode surface area to volume ratio [m-1]" - ] + a_k = variables[ + f"{Domain} electrode {phase} surface area to volume ratio [m-1]" + ] - # This assumes a thin film so curvature effects are neglected. - # They could be included (e.g. for a sphere it is - # a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2))) - # but it is not clear if it is relevant or not. - delta_eps_k = -a_k * L_tot + # This assumes a thin film so curvature effects are neglected. + # They could be included (e.g. for a sphere it is + # a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2))) + # but it is not clear if it is relevant or not. + delta_eps_k += -a_k * L_tot domain_param = self.param.domain_params[domain.split()[0]] eps_k = domain_param.epsilon_init + delta_eps_k From b8dd0138d134a9f372276b257ae6f76b626fafa3 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Tue, 27 Aug 2024 11:03:22 +0100 Subject: [PATCH 02/17] Porosity now works on composite electrode --- .../models/submodels/porosity/reaction_driven_porosity.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 3dceb14eba..8a9d195878 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -33,7 +33,11 @@ def get_coupled_variables(self, variables): dom = domain.split()[0] Domain = dom.capitalize() roughness_k = variables[f"{Domain} electrode roughness ratio"] - phases = self.options.phases[dom] + phases_option = getattr(self.options, dom)["particle phases"] + if phases_option == "1": + phases = "" + else: + phases = self.options.phases[dom] for phase in phases: L_sei_k = variables[f"{Domain} total {phase} SEI thickness [m]"] if Domain == "Negative": From e8fc8f47764693a7f98dcee898e7bfcd47ccdbd5 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Tue, 27 Aug 2024 11:17:23 +0100 Subject: [PATCH 03/17] Now works for non-composite electrode as well! --- .../porosity/reaction_driven_porosity.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 8a9d195878..700d6dc0c4 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -34,12 +34,13 @@ def get_coupled_variables(self, variables): Domain = dom.capitalize() roughness_k = variables[f"{Domain} electrode roughness ratio"] phases_option = getattr(self.options, dom)["particle phases"] - if phases_option == "1": - phases = "" - else: - phases = self.options.phases[dom] + phases = self.options.phases[dom] for phase in phases: - L_sei_k = variables[f"{Domain} total {phase} SEI thickness [m]"] + if phases_option == "1" and phase == "primary": + phase_name = "" + else: + phase_name = phase + " " + L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] if Domain == "Negative": if phase == "secondary": L_sei_0 = ( @@ -59,11 +60,13 @@ def get_coupled_variables(self, variables): param.p.prim.L_inner_0 + param.p.prim.L_outer_0 ) L_pl_k = variables[ - f"{Domain} {phase} lithium plating thickness [m]" + f"{Domain} {phase_name}lithium plating thickness [m]" + ] + L_dead_k = variables[ + f"{Domain} {phase_name}dead lithium thickness [m]" ] - L_dead_k = variables[f"{Domain} {phase} dead lithium thickness [m]"] L_sei_cr_k = variables[ - f"{Domain} total {phase} SEI on cracks thickness [m]" + f"{Domain} total {phase_name}SEI on cracks thickness [m]" ] L_tot = ( @@ -74,7 +77,7 @@ def get_coupled_variables(self, variables): ) a_k = variables[ - f"{Domain} electrode {phase} surface area to volume ratio [m-1]" + f"{Domain} electrode {phase_name}surface area to volume ratio [m-1]" ] # This assumes a thin film so curvature effects are neglected. From b76a2ca33d2954f4e3990965b857ce59950c68d9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2024 11:04:04 +0000 Subject: [PATCH 04/17] style: pre-commit fixes --- .../porosity/reaction_driven_porosity.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 700d6dc0c4..b9bb898bcb 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -43,22 +43,14 @@ def get_coupled_variables(self, variables): L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] if Domain == "Negative": if phase == "secondary": - L_sei_0 = ( - param.n.sec.L_inner_0 + param.n.sec.L_outer_0 - ) + L_sei_0 = param.n.sec.L_inner_0 + param.n.sec.L_outer_0 else: - L_sei_0 = ( - param.n.prim.L_inner_0 + param.n.prim.L_outer_0 - ) + L_sei_0 = param.n.prim.L_inner_0 + param.n.prim.L_outer_0 elif Domain == "Positive": if phase == "secondary": - L_sei_0 = ( - param.p.sec.L_inner_0 + param.p.sec.L_outer_0 - ) + L_sei_0 = param.p.sec.L_inner_0 + param.p.sec.L_outer_0 else: - L_sei_0 = ( - param.p.prim.L_inner_0 + param.p.prim.L_outer_0 - ) + L_sei_0 = param.p.prim.L_inner_0 + param.p.prim.L_outer_0 L_pl_k = variables[ f"{Domain} {phase_name}lithium plating thickness [m]" ] From 6b870412c2cf9a91488b0fee4af1e92a28f70c48 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Thu, 5 Sep 2024 12:05:48 +0100 Subject: [PATCH 05/17] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5203229bd3..4491e93b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # [Unreleased](https://github.com/pybamm-team/PyBaMM/) +## Features + +- Porosity change now works for composite electrode ([#4417](https://github.com/pybamm-team/PyBaMM/pull/4417)) + ## Optimizations - Removed the `start_step_offset` setting and disabled minimum `dt` warnings for drive cycles with the (`IDAKLUSolver`). ([#4416](https://github.com/pybamm-team/PyBaMM/pull/4416)) From 4758ab88f6ef17c53e094db12a591cba2ae00c48 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Thu, 5 Sep 2024 12:08:44 +0100 Subject: [PATCH 06/17] style fix --- .../models/submodels/porosity/reaction_driven_porosity.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index b9bb898bcb..2998330c45 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -69,7 +69,8 @@ def get_coupled_variables(self, variables): ) a_k = variables[ - f"{Domain} electrode {phase_name}surface area to volume ratio [m-1]" + f"{Domain} electrode {phase_name}" + "surface area to volume ratio [m-1]" ] # This assumes a thin film so curvature effects are neglected. From adcb65284fe57597e81d8e623987340489568bec Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Thu, 5 Sep 2024 12:52:53 +0100 Subject: [PATCH 07/17] Updated tests --- .../test_lithium_ion/base_lithium_ion_tests.py | 1 + .../test_lithium_ion/base_lithium_ion_tests.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/tests/integration/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py b/tests/integration/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py index 60e8dfb819..7e7bed7ea5 100644 --- a/tests/integration/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py +++ b/tests/integration/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py @@ -333,6 +333,7 @@ def test_composite_graphite_silicon_sei(self): "particle phases": ("2", "1"), "open-circuit potential": (("single", "current sigmoid"), "single"), "SEI": "ec reaction limited", + "SEI porosity change": "true", } parameter_values = pybamm.ParameterValues("Chen2020_composite") name = "Negative electrode active material volume fraction" diff --git a/tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py b/tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py index 9c093c0c65..2772fc56a1 100644 --- a/tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py +++ b/tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py @@ -569,6 +569,7 @@ def test_well_posed_composite_different_degradation(self): options = { "particle phases": ("2", "1"), "SEI": ("ec reaction limited", "none"), + "SEI porosity change": "true", "lithium plating": ("reversible", "none"), "open-circuit potential": (("current sigmoid", "single"), "single"), } @@ -577,6 +578,7 @@ def test_well_posed_composite_different_degradation(self): options = { "particle phases": ("2", "1"), "SEI": (("ec reaction limited", "solvent-diffusion limited"), "none"), + "SEI porosity change": "true", "lithium plating": (("reversible", "irreversible"), "none"), "open-circuit potential": (("current sigmoid", "single"), "single"), } From 1985fb169700a88d148f68735fccc69e2f8fd681 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Sat, 7 Sep 2024 22:52:39 +0100 Subject: [PATCH 08/17] Changed how pref is handled --- .../porosity/reaction_driven_porosity.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 2998330c45..17e93879f0 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -23,7 +23,6 @@ def __init__(self, param, options, x_average): self.x_average = x_average def get_coupled_variables(self, variables): - param = self.param eps_dict = {} for domain in self.options.whole_cell_domains: delta_eps_k = 0 @@ -36,21 +35,23 @@ def get_coupled_variables(self, variables): phases_option = getattr(self.options, dom)["particle phases"] phases = self.options.phases[dom] for phase in phases: - if phases_option == "1" and phase == "primary": + if self.options["particle phases"] == "1": phase_name = "" + pref = "" + elif phases_option == "1" and phase == "primary": + phase_name = "" + pref = "Primary: " else: phase_name = phase + " " + pref = phase.capitalize() + ": " L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] - if Domain == "Negative": - if phase == "secondary": - L_sei_0 = param.n.sec.L_inner_0 + param.n.sec.L_outer_0 - else: - L_sei_0 = param.n.prim.L_inner_0 + param.n.prim.L_outer_0 - elif Domain == "Positive": - if phase == "secondary": - L_sei_0 = param.p.sec.L_inner_0 + param.p.sec.L_outer_0 - else: - L_sei_0 = param.p.prim.L_inner_0 + param.p.prim.L_outer_0 + L_inner_0 = pybamm.Parameter( + f"{pref}Initial inner SEI thickness [m]" + ) + L_outer_0 = pybamm.Parameter( + f"{pref}Initial outer SEI thickness [m]" + ) + L_sei_0 = L_inner_0 + L_outer_0 L_pl_k = variables[ f"{Domain} {phase_name}lithium plating thickness [m]" ] From 709d634a62681c11ed4b9be6fe61483f63e2a080 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Sat, 7 Sep 2024 23:12:36 +0100 Subject: [PATCH 09/17] Added comments to the new if statements --- .../models/submodels/porosity/reaction_driven_porosity.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index c7328936c2..00c4251a72 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -36,12 +36,15 @@ def get_coupled_variables(self, variables): phases = self.options.phases[dom] for phase in phases: if self.options["particle phases"] == "1": + # both electrodes have one phase phase_name = "" pref = "" elif phases_option == "1" and phase == "primary": + # `domain` has one phase phase_name = "" pref = "Primary: " else: + # `domain` has more than one phase phase_name = phase + " " pref = phase.capitalize() + ": " L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] From f0a5a7935227beeb6cc466f09cc55a391ff6901c Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Mon, 9 Sep 2024 17:28:00 +0100 Subject: [PATCH 10/17] Why did I not think of this before?! --- .../porosity/reaction_driven_porosity.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 00c4251a72..d2a01b750e 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -32,29 +32,29 @@ def get_coupled_variables(self, variables): dom = domain.split()[0] Domain = dom.capitalize() roughness_k = variables[f"{Domain} electrode roughness ratio"] + SEI_option = getattr(self.options, dom)["SEI"] phases_option = getattr(self.options, dom)["particle phases"] phases = self.options.phases[dom] for phase in phases: - if self.options["particle phases"] == "1": - # both electrodes have one phase - phase_name = "" - pref = "" - elif phases_option == "1" and phase == "primary": + if phases_option == "1" and phase == "primary": # `domain` has one phase phase_name = "" - pref = "Primary: " + pref = "" else: # `domain` has more than one phase phase_name = phase + " " pref = phase.capitalize() + ": " L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] - L_inner_0 = pybamm.Parameter( - f"{pref}Initial inner SEI thickness [m]" - ) - L_outer_0 = pybamm.Parameter( - f"{pref}Initial outer SEI thickness [m]" - ) - L_sei_0 = L_inner_0 + L_outer_0 + if SEI_option == "none": + L_sei_0 = pybamm.Scalar(0) + else: + L_inner_0 = pybamm.Parameter( + f"{pref}Initial inner SEI thickness [m]" + ) + L_outer_0 = pybamm.Parameter( + f"{pref}Initial outer SEI thickness [m]" + ) + L_sei_0 = L_inner_0 + L_outer_0 L_pl_k = variables[ f"{Domain} {phase_name}lithium plating thickness [m]" ] From 252b13262712a543690d03c5910af2bc232253c4 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Mon, 25 Nov 2024 14:03:24 +0000 Subject: [PATCH 11/17] Fixed merge conflict --- .../models/submodels/porosity/reaction_driven_porosity.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index 977e7ae78b..fc9d6938a2 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -31,14 +31,10 @@ def get_coupled_variables(self, variables): else: dom = domain.split()[0] Domain = dom.capitalize() - L_sei_k = variables[f"{Domain} total SEI thickness [m]"] if Domain == "Negative": L_sei_0 = self.param.n.prim.L_sei_0 elif Domain == "Positive": L_sei_0 = self.param.p.prim.L_sei_0 - L_pl_k = variables[f"{Domain} lithium plating thickness [m]"] - L_dead_k = variables[f"{Domain} dead lithium thickness [m]"] - L_sei_cr_k = variables[f"{Domain} total SEI on cracks thickness [m]"] roughness_k = variables[f"{Domain} electrode roughness ratio"] SEI_option = getattr(self.options, dom)["SEI"] phases_option = getattr(self.options, dom)["particle phases"] From 43fc11f737ef7a7bb2f2dcb150971bd509d39795 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Mon, 25 Nov 2024 14:27:53 +0000 Subject: [PATCH 12/17] Removed one last reference to inner and outer --- .../models/submodels/porosity/reaction_driven_porosity.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index fc9d6938a2..bb208ffd47 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -52,13 +52,9 @@ def get_coupled_variables(self, variables): if SEI_option == "none": L_sei_0 = pybamm.Scalar(0) else: - L_inner_0 = pybamm.Parameter( - f"{pref}Initial inner SEI thickness [m]" + L_sei_0 = pybamm.Parameter( + f"{pref}Initial SEI thickness [m]" ) - L_outer_0 = pybamm.Parameter( - f"{pref}Initial outer SEI thickness [m]" - ) - L_sei_0 = L_inner_0 + L_outer_0 L_pl_k = variables[ f"{Domain} {phase_name}lithium plating thickness [m]" ] From d1f99d01c17502e4df7f9b05bee4fae4f0df657e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 14:27:55 +0000 Subject: [PATCH 13/17] style: pre-commit fixes --- .../models/submodels/porosity/reaction_driven_porosity.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index bb208ffd47..88009982eb 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -52,9 +52,7 @@ def get_coupled_variables(self, variables): if SEI_option == "none": L_sei_0 = pybamm.Scalar(0) else: - L_sei_0 = pybamm.Parameter( - f"{pref}Initial SEI thickness [m]" - ) + L_sei_0 = pybamm.Parameter(f"{pref}Initial SEI thickness [m]") L_pl_k = variables[ f"{Domain} {phase_name}lithium plating thickness [m]" ] From 6228dd2a9966b7be1aa1de2a942580a644b67146 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Tue, 3 Dec 2024 11:28:35 +0000 Subject: [PATCH 14/17] Refactored if statement in reaction_driven_porosity.py --- .../models/submodels/porosity/reaction_driven_porosity.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index bb208ffd47..3ac88e4a12 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -26,9 +26,7 @@ def get_coupled_variables(self, variables): eps_dict = {} for domain in self.options.whole_cell_domains: delta_eps_k = 0 - if domain == "separator": - pass # separator porosity does not change - else: + if domain != "separator": # separator porosity does not change dom = domain.split()[0] Domain = dom.capitalize() if Domain == "Negative": From 7b8c0018a94e1c3e73cc6c3c9bd5926528c432f1 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Tue, 3 Dec 2024 11:30:18 +0000 Subject: [PATCH 15/17] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35946b7fec..76ecd90bc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Features - Added two more submodels (options) for the SEI: Lars von Kolzenberg (2020) model and Tunneling Limit model ([#4394](https://github.com/pybamm-team/PyBaMM/pull/4394)) +- Porosity change now works for composite electrode ([#4417](https://github.com/pybamm-team/PyBaMM/pull/4417)) ## Breaking changes @@ -41,7 +42,6 @@ - Added `BasicDFN` model for sodium-ion batteries ([#4451](https://github.com/pybamm-team/PyBaMM/pull/4451)) - Added sensitivity calculation support for `pybamm.Simulation` and `pybamm.Experiment` ([#4415](https://github.com/pybamm-team/PyBaMM/pull/4415)) - Added OpenMP parallelization to IDAKLU solver for lists of input parameters ([#4449](https://github.com/pybamm-team/PyBaMM/pull/4449)) -- Porosity change now works for composite electrode ([#4417](https://github.com/pybamm-team/PyBaMM/pull/4417)) - Added phase-dependent particle options to LAM ([#4369](https://github.com/pybamm-team/PyBaMM/pull/4369)) - Added a lithium ion equivalent circuit model with split open circuit voltages for each electrode (`SplitOCVR`). ([#4330](https://github.com/pybamm-team/PyBaMM/pull/4330)) - Added the `pybamm.DiscreteTimeSum` expression node to sum an expression over a sequence of data times, and accompanying `pybamm.DiscreteTimeData` class to store the data times and values ([#4501](https://github.com/pybamm-team/PyBaMM/pull/4501)) From 8619c4c11f1c6c0ff9cf8e4adc4ffa2425d9a2d5 Mon Sep 17 00:00:00 2001 From: Simon O'Kane Date: Sat, 21 Dec 2024 11:54:15 +0000 Subject: [PATCH 16/17] Added comment for Asher --- .../models/submodels/porosity/reaction_driven_porosity.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index e70e6a84fd..ca9db0a5dc 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -60,6 +60,9 @@ def get_coupled_variables(self, variables): L_sei_cr_k = variables[ f"{Domain} total {phase_name}SEI on cracks thickness [m]" ] + #roughness_k = variables[ + # f"{Domain} electrode {phase_name}roughness ratio" + #] L_tot = ( (L_sei_k - L_sei_0) From cd6077ceec87878b3766d70c6fcc95312bbec5eb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 11:54:33 +0000 Subject: [PATCH 17/17] style: pre-commit fixes --- .../models/submodels/porosity/reaction_driven_porosity.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py index ca9db0a5dc..f05c00a4c5 100644 --- a/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py +++ b/src/pybamm/models/submodels/porosity/reaction_driven_porosity.py @@ -60,9 +60,9 @@ def get_coupled_variables(self, variables): L_sei_cr_k = variables[ f"{Domain} total {phase_name}SEI on cracks thickness [m]" ] - #roughness_k = variables[ + # roughness_k = variables[ # f"{Domain} electrode {phase_name}roughness ratio" - #] + # ] L_tot = ( (L_sei_k - L_sei_0)