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

Added contact resistance #2598

Merged
merged 15 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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 @@ -3,6 +3,7 @@
## Features

- Steps in `Experiment` can now be tagged and cycle numbers be searched based on those tags ([#2593](https://github.com/pybamm-team/PyBaMM/pull/2593)).
- New `contact resistance` option and corresponding parameter `Contact resistance [Ohm]` ([#2598](https://github.com/pybamm-team/PyBaMM/pull/2598)).

# [v22.12](https://github.com/pybamm-team/PyBaMM/tree/v22.12) - 2022-12-31

Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lead_acid/Sulzer2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def get_parameter_values():
"Positive current collector specific heat capacity [J.kg-1.K-1]": 256.0,
"Negative current collector thermal conductivity [W.m-1.K-1]": 35.0,
"Positive current collector thermal conductivity [W.m-1.K-1]": 35.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 4800000.0,
"Negative electrode pore size [m]": 1e-07,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Ai2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 2.28,
"Typical current [A]": 2.28,
"Current function [A]": 2.28,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 100.0,
"Maximum concentration in negative electrode [mol.m-3]": 28700.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Chen2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 5.0,
"Typical current [A]": 5.0,
"Current function [A]": 5.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 215.0,
"Maximum concentration in negative electrode [mol.m-3]": 33133.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Chen2020_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 5.0,
"Typical current [A]": 5.0,
"Current function [A]": 5.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 215.0,
"Primary: Maximum concentration in negative electrode [mol.m-3]": 28700.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Ecker2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 0.15625,
"Typical current [A]": 0.15652,
"Current function [A]": 0.15652,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 14.0,
"Maximum concentration in negative electrode [mol.m-3]": 31920.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Marquis2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 0.680616,
"Typical current [A]": 0.680616,
"Current function [A]": 0.680616,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 100.0,
"Maximum concentration in negative electrode [mol.m-3]": 24983.2619938437,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Mohtat2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 5.0,
"Typical current [A]": 5.0,
"Current function [A]": 5.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 100.0,
"Maximum concentration in negative electrode [mol.m-3]": 28746.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/NCA_Kim2011.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 0.43,
"Typical current [A]": 0.43,
"Current function [A]": 0.43,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 100.0,
"Maximum concentration in negative electrode [mol.m-3]": 28700.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/OKane2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 5.0,
"Typical current [A]": 5.0,
"Current function [A]": 5.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 215.0,
"Maximum concentration in negative electrode [mol.m-3]": 33133.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/ORegan2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 5.0,
"Typical current [A]": 5.0,
"Current function [A]": 5.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 215.0,
"Maximum concentration in negative electrode [mol.m-3]": 29583.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Prada2013.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 1.1,
"Current function [A]": 1.1,
"Typical current [A]": 1.1,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 215.0,
"Maximum concentration in negative electrode [mol.m-3]": 33133.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Ramadass2004.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 1.0,
"Typical current [A]": 1.0,
"Current function [A]": 1.0,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode conductivity [S.m-1]": 100.0,
"Maximum concentration in negative electrode [mol.m-3]": 30555.0,
Expand Down
1 change: 1 addition & 0 deletions pybamm/input/parameters/lithium_ion/Xu2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def get_parameter_values():
"Nominal cell capacity [A.h]": 0.0024,
"Typical current [A]": 0.0024,
"Current function [A]": 0.0024,
"Contact resistance [Ohm]": 0,
# negative electrode
"Negative electrode OCP [V]": 0.0,
"Negative electrode conductivity [S.m-1]": 10776000.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ Positive current collector thermal conductivity [W.m-1.K-1],237,CRC Handbook,alu
# Electrical,,,
Nominal cell capacity [A.h], 2.28,Ai 2020,2.28/34
Typical current [A], 2.28,Ai 2020,
Current function [A], 2.28,default current function,
Current function [A], 2.28,default current function,
Contact resistance [Ohm], 0,,
14 changes: 13 additions & 1 deletion pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ class BatteryModelOptions(pybamm.FuzzyDict):
def __init__(self, extra_options):
self.possible_options = {
"calculate discharge energy": ["false", "true"],
"cell geometry": ["arbitrary", "pouch"],
"calculate heat source for isothermal models": ["false", "true"],
"cell geometry": ["arbitrary", "pouch"],
"contact resistance": ["false", "true"],
"convection": ["none", "uniform transverse", "full transverse"],
"current collector": [
"uniform",
Expand Down Expand Up @@ -406,6 +407,17 @@ def __init__(self, extra_options):
"current density as a state' must be 'true'"
)

# Options not yet compatible with contact resistance
if options["contact resistance"] == "true":
if options["operating mode"] == "explicit power":
raise NotImplementedError(
"Contact resistance not yet supported for explicit power."
)
if options["operating mode"] == "explicit resistance":
raise NotImplementedError(
"Contact resistance not yet supported for explicit resistance."
)

# Options not yet compatible with particle-size distributions
if options["particle size"] == "distribution":
if options["lithium plating"] != "none":
Expand Down
23 changes: 17 additions & 6 deletions pybamm/models/submodels/electrode/base_electrode.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def _get_standard_current_variables(self, i_s):

return variables

def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp):
def _get_standard_current_collector_potential_variables(
self, phi_s_cn, phi_s_cp, delta_phi_contact
):
"""
A private function to obtain the standard variables which
can be derived from the potentials in the current collector.
Expand All @@ -122,6 +124,8 @@ def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp
The potential in the negative current collector.
phi_s_cp : :class:`pybamm.Symbol`
The potential in the positive current collector.
delta_phi_contact : :class:`pybamm.Symbol`
The potential difference due to the contact resistance, if any.

Returns
-------
Expand All @@ -141,8 +145,9 @@ def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp
V = pybamm.boundary_value(phi_s_cp, "positive tab")
V_dim = pybamm.boundary_value(phi_s_cp_dim, "positive tab")

# Voltage is local current collector potential difference at the tabs, in 1D
# this will be equal to the local current collector potential difference
# Voltage is local current collector potential difference at the tabs.
# In 1D this will be equal to the local current collector potential difference.
# The potential drop due to contact resistance (if any) is subtracted.

variables = {
"Negative current collector potential": phi_s_cn,
Expand All @@ -151,8 +156,8 @@ def _get_standard_current_collector_potential_variables(self, phi_s_cn, phi_s_cp
"Positive current collector potential [V]": phi_s_cp_dim,
"Local voltage": V_cc,
"Local voltage [V]": self.param.ocv_ref + V_cc * pot_scale,
"Terminal voltage": V,
"Terminal voltage [V]": V_dim,
"Terminal voltage": V - delta_phi_contact,
Copy link
Member

Choose a reason for hiding this comment

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

why is this minus and not plus?

Copy link
Member

Choose a reason for hiding this comment

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

also would be good to add contact resistance as its own variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Contact resistance [Ohm]" is a parameter. Did you mean make "Contact overpotential [V]" a variable? I can do that if you think it's appropriate.

Copy link
Member

Choose a reason for hiding this comment

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

Yes I meant contact overpotential as a variable. Also smart to ignore my dumb minus vs plus comment, brain fart on my part

"Terminal voltage [V]": V_dim - delta_phi_contact * pot_scale,
}

return variables
Expand Down Expand Up @@ -191,9 +196,15 @@ def _get_standard_whole_cell_variables(self, variables):
phi_s_cn = variables["Negative current collector potential"]
phi_s_p = variables["Positive electrode potential"]
phi_s_cp = pybamm.boundary_value(phi_s_p, "right")
if self.options["contact resistance"] == "true":
param = self.param
I = variables["Current [A]"]
delta_phi_contact = I * param.R_contact / param.potential_scale
else:
delta_phi_contact = pybamm.Scalar(0)
variables.update(
self._get_standard_current_collector_potential_variables(
phi_s_cn, phi_s_cp
phi_s_cn, phi_s_cp, delta_phi_contact
)
)

Expand Down
1 change: 1 addition & 0 deletions pybamm/parameters/electrical_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def _set_dimensional_parameters(self):

self.I_typ = pybamm.Parameter("Typical current [A]")
self.Q = pybamm.Parameter("Nominal cell capacity [A.h]")
self.R_contact = pybamm.Parameter("Contact resistance [Ohm]")
self.C_rate = pybamm.AbsoluteValue(self.I_typ / self.Q)
self.n_electrodes_parallel = pybamm.Parameter(
"Number of electrodes connected in parallel to make a cell"
Expand Down
1 change: 1 addition & 0 deletions pybamm/parameters/lead_acid_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _set_dimensional_parameters(self):
# Electrical
self.I_typ = self.elec.I_typ
self.Q = self.elec.Q
self.R_contact = self.elec.R_contact
self.C_rate = self.elec.C_rate
self.n_electrodes_parallel = self.elec.n_electrodes_parallel
self.n_cells = self.elec.n_cells
Expand Down
1 change: 1 addition & 0 deletions pybamm/parameters/lithium_ion_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def _set_dimensional_parameters(self):
# Electrical
self.I_typ = self.elec.I_typ
self.Q = self.elec.Q
self.R_contact = self.elec.R_contact
self.C_rate = self.elec.C_rate
self.n_electrodes_parallel = self.elec.n_electrodes_parallel
self.n_cells = self.elec.n_cells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@

PRINT_OPTIONS_OUTPUT = """\
'calculate discharge energy': 'false' (possible: ['false', 'true'])
'cell geometry': 'pouch' (possible: ['arbitrary', 'pouch'])
'calculate heat source for isothermal models': 'false' (possible: ['false', 'true'])
'cell geometry': 'pouch' (possible: ['arbitrary', 'pouch'])
'contact resistance': 'false' (possible: ['false', 'true'])
'convection': 'none' (possible: ['none', 'uniform transverse', 'full transverse'])
'current collector': 'uniform' (possible: ['uniform', 'potential pair', 'potential pair quite conductive'])
'dimensionality': 0 (possible: [0, 1, 2])
Expand Down Expand Up @@ -310,7 +311,6 @@ def test_options(self):
# plating model
with self.assertRaisesRegex(pybamm.OptionError, "lithium plating"):
pybamm.BaseBatteryModel({"lithium plating": "bad plating"})

with self.assertRaisesRegex(
pybamm.OptionError, "lithium plating porosity change"
):
Expand All @@ -320,6 +320,25 @@ def test_options(self):
"plating porosity change"
}
)

# contact resistance
with self.assertRaisesRegex(pybamm.OptionError, "contact resistance"):
pybamm.BaseBatteryModel({"contact resistance": "bad contact resistance"})
with self.assertRaisesRegex(NotImplementedError, "Contact resistance not yet"):
pybamm.BaseBatteryModel(
{
"contact resistance": "true",
"operating mode": "explicit power",
}
)
with self.assertRaisesRegex(NotImplementedError, "Contact resistance not yet"):
pybamm.BaseBatteryModel(
{
"contact resistance": "true",
"operating mode": "explicit resistance",
}
)

# stress-induced diffusion
with self.assertRaisesRegex(pybamm.OptionError, "cannot have stress"):
pybamm.BaseBatteryModel({"stress-induced diffusion": "true"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def test_well_posed_thermal_2plus1D(self):
}
self.check_well_posedness(options)

def test_well_posed_contact_resistance(self):
options = {"contact resistance": "true"}
self.check_well_posedness(options)

def test_well_posed_particle_uniform(self):
options = {"particle": "uniform profile"}
self.check_well_posedness(options)
Expand Down