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 24 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 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
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 @@ -21,6 +21,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))
- 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
67 changes: 51 additions & 16 deletions src/pybamm/models/submodels/porosity/reaction_driven_porosity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ 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:
Domain = domain.split()[0].capitalize()
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
Expand All @@ -38,23 +40,56 @@ def get_coupled_variables(self, variables):
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_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]"
]
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 @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,14 +569,16 @@
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"),
}
self.check_well_posedness(options)

Check failure on line 576 in tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py

View workflow job for this annotation

GitHub Actions / Tests (ubuntu-latest / Python 3.12)

TestSPM.test_well_posed_composite_different_degradation pybamm.expression_tree.exceptions.ModelError: Missing variable for submodel 'porosity': 'Negative total SEI thickness [m]'. Check the selected submodels provide all of the required variables.

Check failure on line 576 in tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py

View workflow job for this annotation

GitHub Actions / Tests (ubuntu-latest / Python 3.12)

TestDFN.test_well_posed_composite_different_degradation pybamm.expression_tree.exceptions.ModelError: Missing variable for submodel 'porosity': 'Negative total SEI thickness [m]'. Check the selected submodels provide all of the required variables.

Check failure on line 576 in tests/unit/test_models/test_full_battery_models/test_lithium_ion/base_lithium_ion_tests.py

View workflow job for this annotation

GitHub Actions / Tests (ubuntu-latest / Python 3.12)

TestSPMe.test_well_posed_composite_different_degradation pybamm.expression_tree.exceptions.ModelError: Missing variable for submodel 'porosity': 'Negative total SEI thickness [m]'. Check the selected submodels provide all of the required variables.
# phases have different degradation
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