Skip to content

Commit

Permalink
#1489 fix half-cell models
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Nov 9, 2021
1 parent 5b160d4 commit 1de9c11
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 52 deletions.
12 changes: 9 additions & 3 deletions examples/scripts/compare_lithium_ion_half_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@

# load models
models = [
pybamm.lithium_ion.SPM({"working electrode": "positive"}),
pybamm.lithium_ion.SPMe({"working electrode": "positive"}),
pybamm.lithium_ion.DFN({"working electrode": "positive"}),
pybamm.lithium_ion.SPM(
{"working electrode": "positive", "SEI": "ec reaction limited"}
),
pybamm.lithium_ion.SPMe(
{"working electrode": "positive", "SEI": "ec reaction limited"}
),
pybamm.lithium_ion.DFN(
{"working electrode": "positive", "SEI": "ec reaction limited"}
),
]

chemistry = pybamm.parameter_sets.Xu2019
Expand Down
16 changes: 7 additions & 9 deletions pybamm/models/submodels/interface/sei/ec_reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,16 @@ def set_rhs(self, variables):
if self.reaction_loc == "x-average":
L_sei = variables["X-averaged outer SEI thickness"]
j_sei = variables["X-averaged outer SEI interfacial current density"]
if self.reaction_loc == "interface":
a = 1
else:
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables[
"X-averaged negative electrode surface area to volume ratio"
]
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
L_sei = variables["Outer SEI thickness"]
j_sei = variables["Outer SEI interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]
if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

Gamma_SEI = self.param.Gamma_SEI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,18 @@ def set_rhs(self, variables):
L_outer = variables["X-averaged outer SEI thickness"]
j_inner = variables["X-averaged inner SEI interfacial current density"]
j_outer = variables["X-averaged outer SEI interfacial current density"]
if self.reaction_loc == "interface":
a = 1
else:
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables[
"X-averaged negative electrode surface area to volume ratio"
]
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
L_inner = variables["Inner SEI thickness"]
L_outer = variables["Outer SEI thickness"]
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]
if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

v_bar = self.param.v_bar
Gamma_SEI = self.param.Gamma_SEI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,18 @@ def set_rhs(self, variables):
L_outer = variables["X-averaged outer SEI thickness"]
j_inner = variables["X-averaged inner SEI interfacial current density"]
j_outer = variables["X-averaged outer SEI interfacial current density"]
if self.reaction_loc == "interface":
a = 1
else:
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables[
"X-averaged negative electrode surface area to volume ratio"
]
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
L_inner = variables["Inner SEI thickness"]
L_outer = variables["Outer SEI thickness"]
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]
if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

v_bar = self.param.v_bar
Gamma_SEI = self.param.Gamma_SEI
Expand Down
16 changes: 7 additions & 9 deletions pybamm/models/submodels/interface/sei/reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,18 @@ def set_rhs(self, variables):
L_outer = variables["X-averaged outer SEI thickness"]
j_inner = variables["X-averaged inner SEI interfacial current density"]
j_outer = variables["X-averaged outer SEI interfacial current density"]
if self.reaction_loc == "interface":
a = 1
else:
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables[
"X-averaged negative electrode surface area to volume ratio"
]
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
L_inner = variables["Inner SEI thickness"]
L_outer = variables["Outer SEI thickness"]
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]
if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

v_bar = self.param.v_bar
Gamma_SEI = self.param.Gamma_SEI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,18 @@ def set_rhs(self, variables):
L_outer = variables["X-averaged outer SEI thickness"]
j_inner = variables["X-averaged inner SEI interfacial current density"]
j_outer = variables["X-averaged outer SEI interfacial current density"]
if self.reaction_loc == "interface":
a = 1
else:
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables[
"X-averaged negative electrode surface area to volume ratio"
]
# Note a is dimensionless (has a constant value of 1 if the surface
# area does not change)
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
L_inner = variables["Inner SEI thickness"]
L_outer = variables["Outer SEI thickness"]
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]
if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

v_bar = self.param.v_bar
Gamma_SEI = self.param.Gamma_SEI
Expand Down
5 changes: 1 addition & 4 deletions pybamm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,7 @@ def load_function(filename):

path = root_path.replace("/", ".")
path = path.replace("\\", ".")
try:
module_object = importlib.import_module(path)
except ModuleNotFoundError:
module_object = importlib.import_module("pybamm.input.parameters." + path)
module_object = importlib.import_module(path)

return getattr(module_object, tail)

Expand Down

0 comments on commit 1de9c11

Please sign in to comment.