Skip to content

Commit

Permalink
Merge branch 'develop' into issue-1575-discharge-energy
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer authored Mar 9, 2022
2 parents 7bdb620 + abba68e commit 7d28451
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
## Features

- Added "Discharge energy [W.h]", which is the integral of the power in Watts, as an optional output. Set the option "calculate discharge energy" to "true" to get this output ("false" by default, since it can slow down some of the simple models) ([#1969](https://github.com/pybamm-team/PyBaMM/pull/1969)))
- Added an option "calculate heat source for isothermal models" to choose whether or not the heat generation terms are computed when running models with the option `thermal="isothermal"` ([#1958](https://github.com/pybamm-team/PyBaMM/pull/1958))

## Bug fixes

- Fixed a bug where isothermal models did not compute any heat source terms ([#1958](https://github.com/pybamm-team/PyBaMM/pull/1958))

## Breaking changes

Expand All @@ -12,7 +17,7 @@

## Features

- Isothermal models now compute heat source terms (but the temperature remains constant). The models now also account for current collector heating when `dimensionality=0` ([#1929](https://github.com/pybamm-team/PyBaMM/pull/1929)))
- Isothermal models now calculate heat source terms (but the temperature remains constant). The models now also account for current collector heating when `dimensionality=0` ([#1929](https://github.com/pybamm-team/PyBaMM/pull/1929))
- Added new models for power control and resistance control ([#1917](https://github.com/pybamm-team/PyBaMM/pull/1917))
- Initial concentrations can now be provided as a function of `r` as well as `x` ([#1866](https://github.com/pybamm-team/PyBaMM/pull/1866))

Expand Down
6 changes: 6 additions & 0 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class BatteryModelOptions(pybamm.FuzzyDict):
model with prescribed cell volume and cross-sectional area, and
(if thermal effects are included) solves a lumped thermal model
with prescribed surface area for cooling.
* "calculate heat source for isothermal models" : str
Whether to calculate the heat source terms during isothermal operation.
Can be "true" or "false". If "false", the heat source terms are set
to zero. Default is "false" since this option may require additional
parameters not needed by the electrochemical model.
* "convection" : str
Whether to include the effects of convection in the model. Can be
"none" (default), "uniform transverse" or "full transverse".
Expand Down Expand Up @@ -169,6 +174,7 @@ 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"],
"convection": ["none", "uniform transverse", "full transverse"],
"current collector": [
"uniform",
Expand Down
36 changes: 36 additions & 0 deletions pybamm/models/submodels/thermal/isothermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,39 @@ def get_fundamental_variables(self):
)

return variables

def get_coupled_variables(self, variables):
if self.options["calculate heat source for isothermal models"] == "true":
variables.update(self._get_standard_coupled_variables(variables))
else:
ieh = "irreversible electrochemical heating"
variables.update(
{
"Ohmic heating": pybamm.Scalar(0),
"Ohmic heating [W.m-3]": pybamm.Scalar(0),
"X-averaged Ohmic heating": pybamm.Scalar(0),
"X-averaged Ohmic heating [W.m-3]": pybamm.Scalar(0),
"Volume-averaged Ohmic heating": pybamm.Scalar(0),
"Volume-averaged Ohmic heating [W.m-3]": pybamm.Scalar(0),
"Irreversible electrochemical heating": pybamm.Scalar(0),
"Irreversible electrochemical heating [W.m-3]": pybamm.Scalar(0),
"X-averaged " + ieh: pybamm.Scalar(0),
"X-averaged " + ieh + " [W.m-3]": pybamm.Scalar(0),
"Volume-averaged " + ieh: pybamm.Scalar(0),
"Volume-averaged " + ieh + "[W.m-3]": pybamm.Scalar(0),
"Reversible heating": pybamm.Scalar(0),
"Reversible heating [W.m-3]": pybamm.Scalar(0),
"X-averaged reversible heating": pybamm.Scalar(0),
"X-averaged reversible heating [W.m-3]": pybamm.Scalar(0),
"Volume-averaged reversible heating": pybamm.Scalar(0),
"Volume-averaged reversible heating [W.m-3]": pybamm.Scalar(0),
"Total heating": pybamm.Scalar(0),
"Total heating [W.m-3]": pybamm.Scalar(0),
"X-averaged total heating": pybamm.Scalar(0),
"X-averaged total heating [W.m-3]": pybamm.Scalar(0),
"Volume-averaged total heating": pybamm.Scalar(0),
"Volume-averaged total heating [W.m-3]": pybamm.Scalar(0),
}
)

return variables
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
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'])
'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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ def test_well_posed(self):
options = {"thermal": "isothermal"}
self.check_well_posedness(options)

def test_well_posed_isothermal_heat_source(self):
options = {
"calculate heat source for isothermal models": "true",
"thermal": "isothermal",
}
self.check_well_posedness(options)

def test_well_posed_2plus1D(self):
options = {"current collector": "potential pair", "dimensionality": 1}
self.check_well_posedness(options)
Expand Down

0 comments on commit 7d28451

Please sign in to comment.