Skip to content

Commit

Permalink
pybamm-team#718 changed default geometry depending on the thermal mod…
Browse files Browse the repository at this point in the history
…el and added check
  • Loading branch information
brosaplanella committed May 28, 2020
1 parent bf33460 commit 5afdbd1
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,25 @@ def options(self, extra_options):
"current collector": "uniform",
"particle": "Fickian diffusion",
"thermal": "isothermal",
"geometry": "arbitrary",
"cell_geometry": None,
"external submodels": [],
"sei": None,
}
# Change the default for cell geometry based on which thermal option is provided
extra_options = extra_options or {}
thermal_option = extra_options.get(
"thermal", None
) # return None if option not given
if thermal_option is None or thermal_option in ["isothermal", "lumped"]:
default_options["cell_geometry"] = "arbitrary"
else:
default_options["cell_geometry"] = "pouch"
# The "cell_geometry" option will still be overridden by extra_options if
# provided

# Change the default for SEI film resistance based on which sei option is
# provided
extra_options = extra_options or {}
# extra_options = extra_options or {}
sei_option = extra_options.get("sei", None) # return None if option not given
if sei_option is None:
default_options["sei film resistance"] = None
Expand All @@ -214,6 +226,13 @@ def options(self, extra_options):
raise pybamm.OptionError(
"convection not implemented for lithium-ion models"
)
if (
options["thermal"] in ["x-lumped", "x-full"]
and options["cell_geometry"] != "pouch"
):
raise pybamm.OptionError(
options["thermal"] + " model must have pouch geometry."
)
if isinstance(self, pybamm.lead_acid.BaseModel):
if options["thermal"] != "isothermal" and options["dimensionality"] != 0:
raise pybamm.OptionError(
Expand Down Expand Up @@ -274,9 +293,9 @@ def options(self, extra_options):
raise pybamm.OptionError(
"Unknown thermal model '{}'".format(options["thermal"])
)
if options["geometry"] not in ["arbitrary", "pouch"]:
if options["cell_geometry"] not in ["arbitrary", "pouch"]:
raise pybamm.OptionError(
"Unknown geometry '{}'".format(options["geometry"])
"Unknown geometry '{}'".format(options["cell_geometry"])
)
if options["sei"] not in [
None,
Expand Down Expand Up @@ -553,7 +572,9 @@ def set_thermal_submodel(self):

elif self.options["thermal"] == "lumped":
thermal_submodel = pybamm.thermal.Lumped(
self.param, self.options["dimensionality"], self.options["geometry"]
self.param,
self.options["dimensionality"],
self.options["cell_geometry"],
)

elif self.options["thermal"] == "x-lumped":
Expand Down

0 comments on commit 5afdbd1

Please sign in to comment.