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

Fix hysteresis option bug #3535

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions pybamm/models/submodels/interface/base_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ def _get_exchange_current_density(self, variables):
c_e = c_e.orphans[0]
T = T.orphans[0]
# Get main reaction exchange-current density (may have empirical hysteresis)
if domain_options["exchange-current density"] == "single":
j0_option = getattr(domain_options, self.phase)["exchange-current density"]
if j0_option == "single":
j0 = phase_param.j0(c_e, c_s_surf, T)
elif domain_options["exchange-current density"] == "current sigmoid":
elif j0_option == "current sigmoid":
current = variables["Total current density [A.m-2]"]
k = 100
if Domain == "Positive":
Expand Down
5 changes: 3 additions & 2 deletions pybamm/models/submodels/particle/base_particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def _get_effective_diffusivity(self, c, T, current):
domain_options = getattr(self.options, domain)

# Get diffusivity (may have empirical hysteresis)
if domain_options["diffusivity"] == "single":
diffusivity_option = getattr(domain_options, self.phase)["diffusivity"]
if diffusivity_option == "single":
D = phase_param.D(c, T)
elif domain_options["diffusivity"] == "current sigmoid":
elif diffusivity_option == "current sigmoid":
k = 100
if Domain == "Positive":
lithiation_current = current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,22 @@ def test_well_posed_current_sigmoid_diffusivity(self):
def test_well_posed_psd(self):
options = {"particle size": "distribution", "surface form": "algebraic"}
self.check_well_posedness(options)

def test_well_posed_composite_kinetic_hysteresis(self):
options = {
"particle phases": ("2", "1"),
"exchange-current density": (
("current sigmoid", "single"),
"current sigmoid",
),
"open-circuit potential": (("current sigmoid", "single"), "single"),
}
self.check_well_posedness(options)

def test_well_posed_composite_diffusion_hysteresis(self):
options = {
"particle phases": ("2", "1"),
"diffusivity": (("current sigmoid", "current sigmoid"), "current sigmoid"),
"open-circuit potential": (("current sigmoid", "single"), "single"),
}
self.check_well_posedness(options)
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ def test_well_posed_particle_phases(self):
def test_well_posed_particle_phases_sei(self):
pass # skip this test

def test_well_posed_composite_kinetic_hysteresis(self):
pass # skip this test

def test_well_posed_composite_diffusion_hysteresis(self):
pass # skip this test


if __name__ == "__main__":
print("Add -v for more debug output")
Expand Down
Loading