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

Electrolyte overpotentials #1350

Merged
Show file tree
Hide file tree
Changes from 8 commits
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
10 changes: 4 additions & 6 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,10 @@ def set_voltage_variables(self):

# Battery-wide variables
V_dim = self.variables["Terminal voltage [V]"]
eta_e_av = self.variables.get("X-averaged electrolyte ohmic losses", 0)
eta_c_av = self.variables.get("X-averaged concentration overpotential", 0)
eta_e_av_dim = self.variables.get("X-averaged electrolyte ohmic losses [V]", 0)
eta_c_av_dim = self.variables.get(
"X-averaged concentration overpotential [V]", 0
)
eta_e_av = self.variables["X-averaged electrolyte ohmic losses"]
eta_c_av = self.variables["X-averaged concentration overpotential"]
eta_e_av_dim = self.variables["X-averaged electrolyte ohmic losses [V]"]
eta_c_av_dim = self.variables["X-averaged concentration overpotential [V]"]
num_cells = pybamm.Parameter(
"Number of cells connected in series to make a battery"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ def _get_whole_cell_variables(self, variables):
The variables including the whole-cell electrolyte potentials
and currents.
"""
param = self.param

phi_e_n = variables["Negative electrolyte potential"]
phi_e_s = variables["Separator electrolyte potential"]
Expand All @@ -284,10 +285,52 @@ def _get_whole_cell_variables(self, variables):
i_e_p = variables["Positive electrolyte current density"]
i_e = pybamm.Concatenation(i_e_n, i_e_s, i_e_p)

c_e_n = variables["Negative electrolyte concentration"]
c_e_s = variables["Separator electrolyte concentration"]
c_e_p = variables["Positive electrolyte concentration"]

T_n = variables["Negative electrode temperature"]
T_s = variables["Separator temperature"]
T_p = variables["Positive electrode temperature"]

# concentration overpotential
indef_integral_n = pybamm.IndefiniteIntegral(
param.chi(c_e_n, T_n)
* (1 + param.Theta * T_n)
* pybamm.grad(c_e_n)
/ c_e_n,
pybamm.standard_spatial_vars.x_n,
)
indef_integral_s = pybamm.IndefiniteIntegral(
param.chi(c_e_s, T_s)
* (1 + param.Theta * T_s)
* pybamm.grad(c_e_s)
/ c_e_s,
pybamm.standard_spatial_vars.x_s,
)
indef_integral_p = pybamm.IndefiniteIntegral(
param.chi(c_e_p, T_p)
* (1 + param.Theta * T_p)
* pybamm.grad(c_e_p)
/ c_e_p,
pybamm.standard_spatial_vars.x_p,
)

integral_n = indef_integral_n
integral_s = indef_integral_s + pybamm.boundary_value(integral_n, "right")
integral_p = indef_integral_p + pybamm.boundary_value(integral_s, "right")

eta_c_av = pybamm.x_average(integral_p) - pybamm.x_average(integral_n)

delta_phi_e_av = (
pybamm.x_average(phi_e_p) - pybamm.x_average(phi_e_n) - eta_c_av
)

variables.update(
self._get_standard_potential_variables(phi_e_n, phi_e_s, phi_e_p)
)
variables.update(self._get_standard_current_variables(i_e))
variables.update(self._get_split_overpotential(eta_c_av, delta_phi_e_av))

return variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,50 @@ def get_coupled_variables(self, variables):
c_e = variables["Electrolyte concentration"]
phi_e = variables["Electrolyte potential"]

c_e_n, c_e_s, c_e_p = c_e.orphans
phi_e_n, _, phi_e_p = phi_e.orphans
T_n, T_s, T_p = T.orphans

i_e = (param.kappa_e(c_e, T) * tor * param.gamma_e / param.C_e) * (
param.chi(c_e, T) * (1 + param.Theta * T) * pybamm.grad(c_e) / c_e
- pybamm.grad(phi_e)
)

# concentration overpotential
indef_integral_n = pybamm.IndefiniteIntegral(
param.chi(c_e_n, T_n)
* (1 + param.Theta * T_n)
* pybamm.grad(c_e_n)
/ c_e_n,
pybamm.standard_spatial_vars.x_n,
)
indef_integral_s = pybamm.IndefiniteIntegral(
param.chi(c_e_s, T_s)
* (1 + param.Theta * T_s)
* pybamm.grad(c_e_s)
/ c_e_s,
pybamm.standard_spatial_vars.x_s,
)
indef_integral_p = pybamm.IndefiniteIntegral(
param.chi(c_e_p, T_p)
* (1 + param.Theta * T_p)
* pybamm.grad(c_e_p)
/ c_e_p,
pybamm.standard_spatial_vars.x_p,
)

integral_n = indef_integral_n
integral_s = indef_integral_s + pybamm.boundary_value(integral_n, "right")
integral_p = indef_integral_p + pybamm.boundary_value(integral_s, "right")

eta_c_av = pybamm.x_average(integral_p) - pybamm.x_average(integral_n)

delta_phi_e_av = (
pybamm.x_average(phi_e_p) - pybamm.x_average(phi_e_n) - eta_c_av
)

variables.update(self._get_standard_current_variables(i_e))
variables.update(self._get_split_overpotential(eta_c_av, delta_phi_e_av))

return variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def test_public_functions(self):
param = pybamm.LithiumIonParameters()
a = pybamm.Scalar(1)
surf = "electrode surface area to volume ratio"
a_n = pybamm.FullBroadcast(a, "negative electrode", "current collector")
a_s = pybamm.FullBroadcast(a, "separator", "current collector")
a_p = pybamm.FullBroadcast(a, "positive electrode", "current collector")

variables = {
"Electrolyte tortuosity": a,
"Electrolyte concentration": pybamm.FullBroadcast(
a,
["negative electrode", "separator", "positive electrode"],
"current collector",
),
"Electrolyte concentration": pybamm.Concatenation(a_n, a_s, a_p),
"Negative "
+ surf: pybamm.FullBroadcast(a, "negative electrode", "current collector"),
"Positive "
Expand All @@ -28,7 +28,7 @@ def test_public_functions(self):
["negative electrode", "separator", "positive electrode"],
"current collector",
),
"Cell temperature": a,
"Cell temperature": pybamm.Concatenation(a_n, a_s, a_p),
}
submodel = pybamm.electrolyte_conductivity.Full(param)
std_tests = tests.StandardSubModelTests(submodel, variables)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ def test_public_functions(self):
"Electrolyte potential": pybamm.Concatenation(a_n, a_s, a_p),
"Negative electrode temperature": a_n,
"Separator temperature": a_s,
"Separator electrolyte concentration": a_s,
"Positive electrode temperature": a_p,
"Negative electrode potential": a_n,
"Positive electrode potential": a_p,
"Positive electrolyte concentration": a_p,
}

spf = pybamm.electrolyte_conductivity.surface_potential_form
Expand All @@ -50,8 +52,12 @@ def test_public_functions(self):
),
"Negative electrolyte potential": a_n,
"Negative electrolyte current density": a_n,
"Negative electrolyte concentration": a_n,
"Negative electrode temperature": a_n,
"Separator electrolyte potential": a_s,
"Separator electrolyte current density": a_s,
"Separator electrolyte concentration": a_s,
"Separator temperature": a_s,
"Positive electrode porosity": a_p,
"Positive electrolyte tortuosity": a_p,
"Positive electrode tortuosity": a_p,
Expand Down