Skip to content

Commit

Permalink
Issue 4123 fix: SEI + Composite Integrations and lithium plating func…
Browse files Browse the repository at this point in the history
…tions updated (#4153)

* #4123 fix

* Updated plating.py with same bug fix from issue 4123

* Bug fix combined to one line

* style: pre-commit fixes

---------

Co-authored-by: Caitlin Parke <cat@Caitlins-MacBook-Pro.local>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 7, 2024
1 parent 6c01787 commit 8200b8f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions pybamm/models/submodels/interface/lithium_plating/plating.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def get_coupled_variables(self, variables):
alpha_stripping = phase_param.alpha_stripping
alpha_plating = phase_param.alpha_plating

lithium_plating_option = getattr(self.options, domain)["lithium plating"]
lithium_plating_option = getattr(getattr(self.options, domain), self.phase)[
"lithium plating"
]
if lithium_plating_option in ["reversible", "partially reversible"]:
j_stripping = j0_stripping * pybamm.exp(
F_RT * alpha_stripping * eta_stripping
Expand Down Expand Up @@ -132,7 +134,9 @@ def set_rhs(self, variables):
]
L_sei = variables[f"{Domain} total {phase_name}SEI thickness [m]"]

lithium_plating_option = getattr(self.options, domain)["lithium plating"]
lithium_plating_option = getattr(getattr(self.options, domain), self.phase)[
"lithium plating"
]
if lithium_plating_option == "reversible":
# In the reversible plating model, there is no dead lithium
dc_plated_Li = -a_j_stripping / self.param.F
Expand Down
8 changes: 4 additions & 4 deletions pybamm/models/submodels/interface/sei/sei_growth.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def get_fundamental_variables(self):

L_inner, L_outer = Ls

SEI_option = getattr(self.options, domain)["SEI"]
SEI_option = getattr(getattr(self.options, domain), self.phase)["SEI"]
if SEI_option.startswith("ec reaction limited"):
L_inner = 0 * L_inner # Set L_inner to zero, copying domains

Expand All @@ -83,7 +83,7 @@ def get_coupled_variables(self, variables):
param = self.param
phase_param = self.phase_param
domain, Domain = self.domain_Domain
SEI_option = getattr(self.options, domain)["SEI"]
SEI_option = getattr(getattr(self.options, domain), self.phase)["SEI"]
T = variables[f"{Domain} electrode temperature [K]"]
# delta_phi = phi_s - phi_e
if self.reaction_loc == "interface":
Expand Down Expand Up @@ -256,7 +256,7 @@ def set_rhs(self, variables):
)

# we have to add the spreading rate to account for cracking
SEI_option = getattr(self.options, domain)["SEI"]
SEI_option = getattr(getattr(self.options, domain), self.phase)["SEI"]
if SEI_option.startswith("ec reaction limited"):
self.rhs = {L_outer: -dLdt_SEI_outer + spreading_outer}
else:
Expand Down Expand Up @@ -284,7 +284,7 @@ def set_initial_conditions(self, variables):
else:
L_inner_0 = self.phase_param.L_inner_0
L_outer_0 = self.phase_param.L_outer_0
SEI_option = getattr(self.options, domain)["SEI"]
SEI_option = getattr(getattr(self.options, domain), self.phase)["SEI"]
if SEI_option.startswith("ec reaction limited"):
self.initial_conditions = {L_outer: L_inner_0 + L_outer_0}
else:
Expand Down

0 comments on commit 8200b8f

Please sign in to comment.