Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite porosity #4417

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0e70d3e
Started modifying porosity change submodel to work with phases
DrSOKane Aug 27, 2024
b8dd013
Porosity now works on composite electrode
DrSOKane Aug 27, 2024
e8fc8f4
Now works for non-composite electrode as well!
DrSOKane Aug 27, 2024
b2825de
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Sep 5, 2024
b76a2ca
style: pre-commit fixes
pre-commit-ci[bot] Sep 5, 2024
6b87041
changelog
DrSOKane Sep 5, 2024
cd4aa54
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane Sep 5, 2024
4758ab8
style fix
DrSOKane Sep 5, 2024
adcb652
Updated tests
DrSOKane Sep 5, 2024
1985fb1
Changed how pref is handled
DrSOKane Sep 7, 2024
9352297
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Sep 7, 2024
709d634
Added comments to the new if statements
DrSOKane Sep 7, 2024
96d960d
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Sep 9, 2024
f0a5a79
Why did I not think of this before?!
DrSOKane Sep 9, 2024
3937c54
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Sep 10, 2024
7e87880
Merge branch 'develop' into composite-porosity
brosaplanella Sep 11, 2024
47949e7
changelog
DrSOKane Sep 24, 2024
b1b225a
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane Sep 24, 2024
04d0d7a
Merge branch 'develop' into composite-porosity
kratman Sep 30, 2024
35df164
changelog
DrSOKane Oct 22, 2024
69b366d
changelog
DrSOKane Oct 22, 2024
447d435
Merge branch 'develop' into composite-porosity
brosaplanella Oct 30, 2024
05ce7b3
Merged singe-layer SEI
DrSOKane Nov 22, 2024
8930dd3
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane Nov 22, 2024
252b132
Fixed merge conflict
DrSOKane Nov 25, 2024
c89419a
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Nov 25, 2024
43fc11f
Removed one last reference to inner and outer
DrSOKane Nov 25, 2024
d1f99d0
style: pre-commit fixes
pre-commit-ci[bot] Nov 25, 2024
18551aa
Merge branch 'develop' into composite-porosity
brosaplanella Nov 26, 2024
6228dd2
Refactored if statement in reaction_driven_porosity.py
DrSOKane Dec 3, 2024
72f945b
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Dec 3, 2024
7b8c001
changelog
DrSOKane Dec 3, 2024
58b0006
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane Dec 3, 2024
d339967
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Dec 3, 2024
5509022
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Dec 4, 2024
9ca1efa
Merge branch 'develop' into composite-porosity
DrSOKane Dec 9, 2024
3df0d80
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Dec 19, 2024
ae5f0f8
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane Dec 19, 2024
8619c4c
Added comment for Asher
DrSOKane Dec 21, 2024
d3a88a9
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane Dec 21, 2024
cd6077c
style: pre-commit fixes
pre-commit-ci[bot] Dec 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
- 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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be moved to the unreleased section

- 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))
Expand Down
65 changes: 45 additions & 20 deletions src/pybamm/models/submodels/porosity/reaction_driven_porosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,61 @@ def __init__(self, param, options, x_average):
def get_coupled_variables(self, variables):
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be refactored to use

if domain != "separator"

Domain = domain.split()[0].capitalize()
L_sei_k = variables[f"{Domain} total SEI thickness [m]"]
dom = domain.split()[0]
Domain = dom.capitalize()
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"]
phases = self.options.phases[dom]
for phase in phases:
if phases_option == "1" and phase == "primary":
# `domain` has one phase
phase_name = ""
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]"]
if SEI_option == "none":
L_sei_0 = pybamm.Scalar(0)
else:
L_sei_0 = pybamm.Parameter(f"{pref}Initial SEI thickness [m]")
L_pl_k = variables[
f"{Domain} {phase_name}lithium plating thickness [m]"
]
L_dead_k = variables[
f"{Domain} {phase_name}dead lithium thickness [m]"
]
L_sei_cr_k = variables[
f"{Domain} total {phase_name}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_name}"
"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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,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"),
}
Expand All @@ -589,6 +590,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"),
}
Expand Down
Loading