Skip to content

Commit

Permalink
fix degradation options when one of the phases has no degradation (#4163
Browse files Browse the repository at this point in the history
)

* fix degradation options when one of the phases has no degradation

* skip Newman Tobias test

---------

Co-authored-by: Eric G. Kratz <[email protected]>
Co-authored-by: Arjun Verma <[email protected]>
  • Loading branch information
3 people authored Jul 18, 2024
1 parent 740fa50 commit 27c29df
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ def set_sei_submodel(self):
reaction_loc = "x-average"
else:
reaction_loc = "full electrode"
sei_option = getattr(self.options, domain)["SEI"]
phases = self.options.phases[domain]
for phase in phases:
sei_option = getattr(getattr(self.options, domain), phase)["SEI"]
if sei_option == "none":
submodel = pybamm.sei.NoSEI(self.param, domain, self.options, phase)
elif sei_option == "constant":
Expand Down Expand Up @@ -333,9 +333,11 @@ def set_lithium_plating_submodel(self):
for domain in self.options.whole_cell_domains:
if domain != "separator":
domain = domain.split()[0].lower()
lithium_plating_opt = getattr(self.options, domain)["lithium plating"]
phases = self.options.phases[domain]
for phase in phases:
lithium_plating_opt = getattr(getattr(self.options, domain), phase)[
"lithium plating"
]
if lithium_plating_opt == "none":
submodel = pybamm.lithium_plating.NoPlating(
self.param, domain, self.options, phase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def get_coupled_variables(self, variables):
domain, Domain = self.domain_Domain

deps_solid_dt = 0
lam_option = getattr(self.options, self.domain)["loss of active material"]
lam_option = getattr(getattr(self.options, domain), self.phase)[
"loss of active material"
]
if "stress" in lam_option:
# obtain the rate of loss of active materials (LAM) by stress
# This is loss of active material model by mechanical effects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,28 @@ def test_well_posed_composite_diffusion_hysteresis(self):
"open-circuit potential": (("current sigmoid", "single"), "single"),
}
self.check_well_posedness(options)

def test_well_posed_composite_different_degradation(self):
# phases have same degradation
options = {
"particle phases": ("2", "1"),
"SEI": ("ec reaction limited", "none"),
"lithium plating": ("reversible", "none"),
"open-circuit potential": (("current sigmoid", "single"), "single"),
}
self.check_well_posedness(options)
# phases have different degradation
options = {
"particle phases": ("2", "1"),
"SEI": (("ec reaction limited", "solvent-diffusion limited"), "none"),
"lithium plating": (("reversible", "irreversible"), "none"),
"open-circuit potential": (("current sigmoid", "single"), "single"),
}
self.check_well_posedness(options)
# one of the phases has no degradation
options = {
"particle phases": ("2", "1"),
"SEI": (("none", "solvent-diffusion limited"), "none"),
"lithium plating": (("none", "irreversible"), "none"),
}
self.check_well_posedness(options)
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ def test_well_posed_composite_kinetic_hysteresis(self):
@pytest.mark.skip(reason="Test currently not implemented")
def test_well_posed_composite_diffusion_hysteresis(self):
pass # skip this test

@pytest.mark.skip(reason="Test currently not implemented")
def test_well_posed_composite_different_degradation(self):
pass # skip this test

0 comments on commit 27c29df

Please sign in to comment.