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

#861 remove external submodels #862

Merged
merged 2 commits into from
Feb 27, 2020
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# [Unreleased](https://github.com/pybamm-team/PyBaMM)

## Breaking changes

- Removed "set external temperature" and "set external potential" options. Use "external submodels" option instead ([#862](https://github.com/pybamm-team/PyBaMM/pull/862))

# [v0.2.0](https://github.com/pybamm-team/PyBaMM/tree/v0.2.0) - 2020-02-26

This release introduces many new features and optimizations. All models can now be solved using the pip installation - in particular, the DFN can be solved in around 0.1s. Other highlights include an improved user interface, simulations of experimental protocols (GITT, CCCV, etc), new parameter sets for NCA and LGM50, drive cycles, "input parameters" and "external variables" for quickly solving models with different parameter values and coupling with external software, and general bug fixes and optimizations.
Expand Down
1 change: 0 additions & 1 deletion docs/source/models/submodels/current_collector/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ Current Collector
homogeneous_current_collector
potential_pair
quite_conductive_potential_pair
set_potential_single_particle

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/models/submodels/thermal/x_lumped/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ X-lumped
x_lumped_0D_current_collector
x_lumped_1D_current_collector
x_lumped_2D_current_collector
x_lumped_1D_set_temperature

This file was deleted.

42 changes: 3 additions & 39 deletions pybamm/models/full_battery_models/base_battery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,14 @@ class BaseBatteryModel(pybamm.BaseModel):
(default) or "varying". Not currently implemented in any of the models.
* "current collector" : str, optional
Sets the current collector model to use. Can be "uniform" (default),
"potential pair", "potential pair quite conductive", or
"set external potential". The submodel "set external potential" can only
be used with the SPM.
"potential pair" or "potential pair quite conductive".
* "particle" : str, optional
Sets the submodel to use to describe behaviour within the particle.
Can be "Fickian diffusion" (default) or "fast diffusion".
* "thermal" : str, optional
Sets the thermal model to use. Can be "isothermal" (default),
"x-full", "x-lumped", "xyz-lumped", "lumped" or "set external
temperature". Must be "isothermal" for lead-acid models. If the
option "set external temperature" is selected then "dimensionality"
must be 1.
"x-full", "x-lumped", "xyz-lumped" or "lumped". Must be "isothermal" for
lead-acid models.
* "thermal current collector" : bool, optional
Whether to include thermal effects in the current collector in
one-dimensional models (default is False). Note that this option
Expand Down Expand Up @@ -193,7 +189,6 @@ def options(self, extra_options):
"uniform",
"potential pair",
"potential pair quite conductive",
"set external potential",
]:
raise pybamm.OptionError(
"current collector model '{}' not recognised".format(
Expand All @@ -212,7 +207,6 @@ def options(self, extra_options):
"x-lumped",
"xyz-lumped",
"lumped",
"set external temperature",
]:
raise pybamm.OptionError(
"Unknown thermal model '{}'".format(options["thermal"])
Expand Down Expand Up @@ -241,14 +235,6 @@ def options(self, extra_options):
raise pybamm.OptionError(
"thermal effects not implemented for lead-acid models"
)
if options["current collector"] == "set external potential" and not isinstance(
self, pybamm.lithium_ion.SPM
):
raise pybamm.OptionError(
"option {} only compatible with SPM".format(
options["current collector"]
)
)

self._options = options

Expand Down Expand Up @@ -544,14 +530,6 @@ def set_thermal_submodel(self):
self.param
)

elif self.options["thermal"] == "set external temperature":
if self.options["dimensionality"] == 1:
thermal_submodel = pybamm.thermal.x_lumped.SetTemperature1D(self.param)
elif self.options["dimensionality"] in [0, 2]:
raise NotImplementedError(
"""Set temperature model only implemented for 1D current
collectors"""
)
self.submodels["thermal"] = thermal_submodel

def set_current_collector_submodel(self):
Expand All @@ -563,20 +541,6 @@ def set_current_collector_submodel(self):
submodel = pybamm.current_collector.PotentialPair1plus1D(self.param)
elif self.options["dimensionality"] == 2:
submodel = pybamm.current_collector.PotentialPair2plus1D(self.param)
elif self.options["current collector"] == "set external potential":
if self.options["dimensionality"] == 1:
submodel = pybamm.current_collector.SetPotentialSingleParticle1plus1D(
self.param
)
elif self.options["dimensionality"] == 2:
submodel = pybamm.current_collector.SetPotentialSingleParticle2plus1D(
self.param
)
elif self.options["dimensionality"] == 0:
raise NotImplementedError(
"""Set potential model only implemented for 1D or 2D current
collectors"""
)
self.submodels["current collector"] = submodel

def set_voltage_variables(self):
Expand Down
5 changes: 0 additions & 5 deletions pybamm/models/submodels/current_collector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,3 @@
QuiteConductivePotentialPair1plus1D,
QuiteConductivePotentialPair2plus1D,
)
from .set_potential_single_particle import (
BaseSetPotentialSingleParticle,
SetPotentialSingleParticle1plus1D,
SetPotentialSingleParticle2plus1D,
)

This file was deleted.

1 change: 0 additions & 1 deletion pybamm/models/submodels/thermal/x_lumped/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
from .x_lumped_0D_current_collectors import CurrentCollector0D
from .x_lumped_1D_current_collectors import CurrentCollector1D
from .x_lumped_2D_current_collectors import CurrentCollector2D
from .x_lumped_1D_set_temperature import SetTemperature1D

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ def test_bad_options(self):
pybamm.BaseBatteryModel({"surface form": "bad surface form"})
with self.assertRaisesRegex(pybamm.OptionError, "particle model"):
pybamm.BaseBatteryModel({"particle": "bad particle"})
with self.assertRaisesRegex(pybamm.OptionError, "option set external"):
pybamm.BaseBatteryModel({"current collector": "set external potential"})
with self.assertRaisesRegex(pybamm.OptionError, "operating mode"):
pybamm.BaseBatteryModel({"operating mode": "bad operating mode"})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,6 @@ def test_x_lumped_thermal_2D_current_collector(self):
model = pybamm.lithium_ion.DFN(options)
model.check_well_posedness()

def test_x_lumped_thermal_set_temperature_1D(self):
options = {
"current collector": "potential pair",
"dimensionality": 1,
"thermal": "set external temperature",
}
model = pybamm.lithium_ion.DFN(options)
model.check_well_posedness()

options = {
"current collector": "potential pair",
"dimensionality": 2,
"thermal": "set external temperature",
}
with self.assertRaises(NotImplementedError):
model = pybamm.lithium_ion.DFN(options)

def test_particle_fast_diffusion(self):
options = {"particle": "fast diffusion"}
model = pybamm.lithium_ion.DFN(options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ def test_well_posed_2plus1D(self):
model = pybamm.lithium_ion.SPM(options)
model.check_well_posedness()

options = {"current collector": "set external potential", "dimensionality": 0}
with self.assertRaises(NotImplementedError):
pybamm.lithium_ion.SPM(options)

options = {"current collector": "set external potential", "dimensionality": 1}
model = pybamm.lithium_ion.SPM(options)
model.check_well_posedness()

options = {"current collector": "set external potential", "dimensionality": 2}
model = pybamm.lithium_ion.SPM(options)
model.check_well_posedness()

def test_x_full_thermal_model_no_current_collector(self):
options = {"thermal": "x-full"}
model = pybamm.lithium_ion.SPM(options)
Expand Down Expand Up @@ -155,23 +143,6 @@ def test_x_lumped_thermal_2D_current_collector(self):
model = pybamm.lithium_ion.SPM(options)
model.check_well_posedness()

def test_x_lumped_thermal_set_temperature_1D(self):
options = {
"current collector": "potential pair",
"dimensionality": 1,
"thermal": "set external temperature",
}
model = pybamm.lithium_ion.SPM(options)
model.check_well_posedness()

options = {
"current collector": "potential pair",
"dimensionality": 2,
"thermal": "set external temperature",
}
with self.assertRaises(NotImplementedError):
model = pybamm.lithium_ion.SPM(options)

def test_particle_fast_diffusion(self):
options = {"particle": "fast diffusion"}
model = pybamm.lithium_ion.SPM(options)
Expand Down
Loading