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

#1489 add surface area to volume ratio factor #1790

Merged
merged 4 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions examples/scripts/compare_lithium_ion.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

# load models
models = [
pybamm.lithium_ion.SPM(),
pybamm.lithium_ion.SPMe(),
# pybamm.lithium_ion.SPM(),
# pybamm.lithium_ion.SPMe(),
pybamm.lithium_ion.DFN(),
pybamm.lithium_ion.NewmanTobias(),
# pybamm.lithium_ion.NewmanTobias(),
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should restore this script to its previous version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yes

]

# create and run simulations
Expand All @@ -21,4 +21,4 @@
sims.append(sim)

# plot
pybamm.dynamic_plot(sims)
pybamm.dynamic_plot(sims, ["Negative electrode surface area to volume ratio"])
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ def set_rhs(self, variables):
j_stripping = variables[
"X-averaged lithium plating interfacial current density"
]
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
c_plated_Li = variables["Lithium plating concentration"]
j_stripping = variables["Lithium plating interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]

Gamma_plating = self.param.Gamma_plating
self.rhs = {c_plated_Li: -Gamma_plating * j_stripping}

self.rhs = {c_plated_Li: -Gamma_plating * a * j_stripping}

def set_initial_conditions(self, variables):
if self.x_average is True:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ def set_rhs(self, variables):
j_stripping = variables[
"X-averaged lithium plating interfacial current density"
]
a = variables["X-averaged negative electrode surface area to volume ratio"]
else:
c_plated_Li = variables["Lithium plating concentration"]
j_stripping = variables["Lithium plating interfacial current density"]
a = variables["Negative electrode surface area to volume ratio"]

Gamma_plating = self.param.Gamma_plating
self.rhs = {c_plated_Li: -Gamma_plating * j_stripping}

self.rhs = {c_plated_Li: -Gamma_plating * a * j_stripping}

def set_initial_conditions(self, variables):
if self.x_average is True:
Expand Down
7 changes: 6 additions & 1 deletion pybamm/models/submodels/interface/sei/ec_reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,14 @@ def set_rhs(self, variables):
L_sei = variables["Outer SEI thickness"]
j_sei = variables["Outer SEI interfacial current density"]

if self.reaction_loc == "interface":
a = 1
else:
a = variables["Negative electrode surface area to volume ratio"]

Gamma_SEI = self.param.Gamma_SEI

self.rhs = {L_sei: -Gamma_SEI * j_sei / 2}
self.rhs = {L_sei: -Gamma_SEI * a * j_sei / 2}

def set_initial_conditions(self, variables):
if self.reaction_loc == "x-average":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@ def set_rhs(self, variables):
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]

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

self.rhs = {
L_inner: -Gamma_SEI * j_inner,
L_outer: -v_bar * Gamma_SEI * j_outer,
L_inner: -Gamma_SEI * a * j_inner,
L_outer: -v_bar * Gamma_SEI * a * j_outer,
}

def set_initial_conditions(self, variables):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,17 @@ def set_rhs(self, variables):
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]

v_bar = self.param.v_bar
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

self.rhs = {
L_inner: -Gamma_SEI * j_inner,
L_outer: -v_bar * Gamma_SEI * j_outer,
L_inner: -Gamma_SEI * a * j_inner,
L_outer: -v_bar * Gamma_SEI * a * j_outer,
}

def set_initial_conditions(self, variables):
Expand Down
9 changes: 7 additions & 2 deletions pybamm/models/submodels/interface/sei/reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,17 @@ def set_rhs(self, variables):
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]

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

self.rhs = {
L_inner: -Gamma_SEI * j_inner,
L_outer: -v_bar * Gamma_SEI * j_outer,
L_inner: -Gamma_SEI * a * j_inner,
L_outer: -v_bar * Gamma_SEI * a * j_outer,
}

def set_initial_conditions(self, variables):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,18 @@ def set_rhs(self, variables):
L_outer = variables["Outer SEI thickness"]
j_inner = variables["Inner SEI interfacial current density"]
j_outer = variables["Outer SEI interfacial current density"]
v_bar = self.param.v_bar

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

self.rhs = {
L_inner: -Gamma_SEI * j_inner,
L_outer: -v_bar * Gamma_SEI * j_outer,
L_inner: -Gamma_SEI * a * j_inner,
L_outer: -v_bar * Gamma_SEI * a * j_outer,
}

def set_initial_conditions(self, variables):
Expand Down
5 changes: 4 additions & 1 deletion pybamm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ def load_function(filename):

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

return getattr(module_object, tail)

Expand Down