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 all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Features

- Added the electrolyte overpotential and Ohmic losses for full conductivity, including surface form ([#1350](https://github.com/pybamm-team/PyBaMM/pull/1350))
- Added functionality to `Citations` to print formatted citations ([#1340](https://github.com/pybamm-team/PyBaMM/pull/1340))
- Updated the way events are handled in `CasadiSolver` for more accurate event location ([#1328](https://github.com/pybamm-team/PyBaMM/pull/1328))
- Added error message if initial conditions are outside the bounds of a variable ([#1326](https://github.com/pybamm-team/PyBaMM/pull/1326))
Expand Down
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 @@ -291,6 +291,74 @@ def _get_whole_cell_variables(self, variables):

return variables

def _get_electrolyte_overpotentials(self, variables):
"""
A private function to obtain the electrolyte overpotential and Ohmic losses.
Note: requires 'variables' to contain the potential, electrolyte concentration
and temperature the subdomains: 'negative electrode', 'separator', and
'positive electrode'.

Parameters
----------
variables : dict
The variables that have been set in the rest of the model.

Returns
-------
variables : dict
The variables including the whole-cell electrolyte potentials
and currents.
"""
param = self.param

phi_e_n = variables["Negative electrolyte potential"]
phi_e_p = variables["Positive electrolyte potential"]

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_split_overpotential(eta_c_av, delta_phi_e_av))

return variables

def set_boundary_conditions(self, variables):
phi_e = variables["Electrolyte potential"]
self.boundary_conditions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def get_coupled_variables(self, variables):
)

variables.update(self._get_standard_current_variables(i_e))
variables.update(self._get_electrolyte_overpotentials(variables))

return variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def get_coupled_variables(self, variables):

if self.domain == "Positive":
variables.update(self._get_whole_cell_variables(variables))
variables.update(self._get_electrolyte_overpotentials(variables))

return variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ 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 electrolyte concentration": a_n,
"Separator electrolyte concentration": a_s,
"Positive electrolyte concentration": a_p,
"Negative electrode temperature": a_n,
"Separator temperature": a_s,
"Positive electrode temperature": a_p,
"Negative "
+ surf: pybamm.FullBroadcast(a, "negative electrode", "current collector"),
"Positive "
Expand All @@ -28,7 +34,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