Skip to content

Commit

Permalink
Merge branch 'develop' into jax_optional
Browse files Browse the repository at this point in the history
  • Loading branch information
priyanshuone6 authored Nov 10, 2021
2 parents 5f7df6e + 884d6e9 commit 243ef8c
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Features

- Half-cell SPM and SPMe have been implemented ( [#1731](https://github.com/pybamm-team/PyBaMM/pull/1731))
- Added surface area to volume ratio as a factor to the SEI equations ([#1790](https://github.com/pybamm-team/PyBaMM/pull/1790))
- Half-cell SPM and SPMe have been implemented ([#1731](https://github.com/pybamm-team/PyBaMM/pull/1731))

## Bug fixes

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ def set_rhs(self, variables):
j_stripping = variables[
"X-averaged lithium plating interfacial current density"
]
# 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:
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,17 @@ def set_rhs(self, variables):
j_stripping = variables[
"X-averaged lithium plating interfacial current density"
]
# 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:
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
9 changes: 8 additions & 1 deletion pybamm/models/submodels/interface/sei/ec_reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,20 @@ 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"]
# 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"]
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 @@ -73,18 +73,25 @@ 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"]
# 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"]
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 @@ -75,19 +75,25 @@ 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"]
# 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"]
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
11 changes: 9 additions & 2 deletions pybamm/models/submodels/interface/sei/reaction_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,25 @@ 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"]
# 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"]
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
13 changes: 10 additions & 3 deletions pybamm/models/submodels/interface/sei/solvent_diffusion_limited.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,25 @@ 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"]
# 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"]
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

0 comments on commit 243ef8c

Please sign in to comment.