Skip to content

Commit

Permalink
Merge pull request pybamm-team#3535 from pybamm-team/option-bug
Browse files Browse the repository at this point in the history
Fix hysteresis option bug
  • Loading branch information
rtimms authored Nov 17, 2023
2 parents ca4f5ea + 797eb9c commit 2c17416
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
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

0 comments on commit 2c17416

Please sign in to comment.