Skip to content

Commit 4c0604e

Browse files
DrSOKanepre-commit-ci[bot]brosaplanellakratman
authored
Composite porosity (#4417)
* Started modifying porosity change submodel to work with phases * Porosity now works on composite electrode * Now works for non-composite electrode as well! * style: pre-commit fixes * changelog * style fix * Updated tests * Changed how pref is handled * Added comments to the new if statements * Why did I not think of this before?! * Fixed merge conflict * Removed one last reference to inner and outer * style: pre-commit fixes * Refactored if statement in reaction_driven_porosity.py * changelog * Added comment for Asher * style: pre-commit fixes * Fixed roughness error in reaction_driven_porosity.py * style: pre-commit fixes * Should now work for composite SEI on cracks... * style: pre-commit fixes * Deleted mechanics_option as it's not needed * style: pre-commit fixes --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ferran Brosa Planella <[email protected]> Co-authored-by: Eric G. Kratz <[email protected]>
1 parent 6e79798 commit 4c0604e

File tree

5 files changed

+97
-52
lines changed

5 files changed

+97
-52
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
## Features
44

55
- Added a `dt_min` option to the (`IDAKLUSolver`). ([#4736](https://github.com/pybamm-team/PyBaMM/pull/4736))
6+
- Automatically add state variables of the model to the output variables if they are not already present ([#4700](https://github.com/pybamm-team/PyBaMM/pull/4700))
67
- Enabled using SEI models with particle size distributions. ([#4693](https://github.com/pybamm-team/PyBaMM/pull/4693))
78
- Added symbolic mesh which allows for using InputParameters for geometric parameters ([#4665](https://github.com/pybamm-team/PyBaMM/pull/4665))
89
- Enhanced the `search` method to accept multiple search terms in the form of a string or a list. ([#4650](https://github.com/pybamm-team/PyBaMM/pull/4650))
910
- Made composite electrode model compatible with particle size distribution ([#4687](https://github.com/pybamm-team/PyBaMM/pull/4687))
1011
- Added `Symbol.post_order()` method to return an iterable that steps through the tree in post-order fashion. ([#4684](https://github.com/pybamm-team/PyBaMM/pull/4684))
12+
- Porosity change now works for composite electrode ([#4417](https://github.com/pybamm-team/PyBaMM/pull/4417))
1113
- 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))
12-
- Automatically add state variables of the model to the output variables if they are not already present ([#4700](https://github.com/pybamm-team/PyBaMM/pull/4700))
1314

1415
## Breaking changes
1516

docs/source/examples/notebooks/models/coupled-degradation.ipynb

Lines changed: 44 additions & 28 deletions
Large diffs are not rendered by default.

src/pybamm/models/submodels/porosity/reaction_driven_porosity.py

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,61 @@ def __init__(self, param, options, x_average):
2525
def get_coupled_variables(self, variables):
2626
eps_dict = {}
2727
for domain in self.options.whole_cell_domains:
28-
if domain == "separator":
29-
delta_eps_k = 0 # separator porosity does not change
30-
else:
31-
Domain = domain.split()[0].capitalize()
32-
L_sei_k = variables[f"{Domain} total SEI thickness [m]"]
28+
delta_eps_k = 0
29+
if domain != "separator": # separator porosity does not change
30+
dom = domain.split()[0]
31+
Domain = dom.capitalize()
3332
if Domain == "Negative":
3433
L_sei_0 = self.param.n.prim.L_sei_0
3534
elif Domain == "Positive":
3635
L_sei_0 = self.param.p.prim.L_sei_0
37-
L_pl_k = variables[f"{Domain} lithium plating thickness [m]"]
38-
L_dead_k = variables[f"{Domain} dead lithium thickness [m]"]
39-
L_sei_cr_k = variables[f"{Domain} total SEI on cracks thickness [m]"]
40-
roughness_k = variables[f"{Domain} electrode roughness ratio"]
36+
SEI_option = getattr(self.options, dom)["SEI"]
37+
phases_option = getattr(self.options, dom)["particle phases"]
38+
phases = self.options.phases[dom]
39+
for phase in phases:
40+
if phases_option == "1" and phase == "primary":
41+
# `domain` has one phase
42+
phase_name = ""
43+
pref = ""
44+
else:
45+
# `domain` has more than one phase
46+
phase_name = phase + " "
47+
pref = phase.capitalize() + ": "
48+
L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"]
49+
if SEI_option == "none":
50+
L_sei_0 = pybamm.Scalar(0)
51+
else:
52+
L_sei_0 = pybamm.Parameter(f"{pref}Initial SEI thickness [m]")
53+
L_pl_k = variables[
54+
f"{Domain} {phase_name}lithium plating thickness [m]"
55+
]
56+
L_dead_k = variables[
57+
f"{Domain} {phase_name}dead lithium thickness [m]"
58+
]
59+
L_sei_cr_k = variables[
60+
f"{Domain} total {phase_name}SEI on cracks thickness [m]"
61+
]
62+
roughness_k = variables[
63+
f"{Domain} {phase_name}electrode roughness ratio"
64+
]
4165

42-
L_tot = (
43-
(L_sei_k - L_sei_0)
44-
+ L_pl_k
45-
+ L_dead_k
46-
+ L_sei_cr_k * (roughness_k - 1)
47-
)
66+
L_tot = (
67+
(L_sei_k - L_sei_0)
68+
+ L_pl_k
69+
+ L_dead_k
70+
+ L_sei_cr_k * (roughness_k - 1)
71+
)
4872

49-
a_k = variables[
50-
f"{Domain} electrode surface area to volume ratio [m-1]"
51-
]
73+
a_k = variables[
74+
f"{Domain} electrode {phase_name}"
75+
"surface area to volume ratio [m-1]"
76+
]
5277

53-
# This assumes a thin film so curvature effects are neglected.
54-
# They could be included (e.g. for a sphere it is
55-
# a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2)))
56-
# but it is not clear if it is relevant or not.
57-
delta_eps_k = -a_k * L_tot
78+
# This assumes a thin film so curvature effects are neglected.
79+
# They could be included (e.g. for a sphere it is
80+
# a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2)))
81+
# but it is not clear if it is relevant or not.
82+
delta_eps_k += -a_k * L_tot
5883

5984
domain_param = self.param.domain_params[domain.split()[0]]
6085
eps_k = domain_param.epsilon_init + delta_eps_k

tests/integration/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ def test_composite_graphite_silicon_sei(self):
350350
"particle phases": ("2", "1"),
351351
"open-circuit potential": (("single", "current sigmoid"), "single"),
352352
"SEI": "ec reaction limited",
353+
"SEI porosity change": "true",
353354
}
354355
parameter_values = pybamm.ParameterValues("Chen2020_composite")
355356
name = "Negative electrode active material volume fraction"

tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ def test_well_posed_composite_different_degradation(self):
581581
options = {
582582
"particle phases": ("2", "1"),
583583
"SEI": ("ec reaction limited", "none"),
584+
"SEI porosity change": "true",
584585
"lithium plating": ("reversible", "none"),
585586
"open-circuit potential": (("current sigmoid", "single"), "single"),
586587
}
@@ -589,6 +590,7 @@ def test_well_posed_composite_different_degradation(self):
589590
options = {
590591
"particle phases": ("2", "1"),
591592
"SEI": (("ec reaction limited", "solvent-diffusion limited"), "none"),
593+
"SEI porosity change": "true",
592594
"lithium plating": (("reversible", "irreversible"), "none"),
593595
"open-circuit potential": (("current sigmoid", "single"), "single"),
594596
}

0 commit comments

Comments
 (0)