Skip to content

Commit d704c9e

Browse files
Merge pull request #862 from pybamm-team/issue-861-remove-set-external
#861 remove external submodels
2 parents 801492b + 7052672 commit d704c9e

File tree

17 files changed

+19
-390
lines changed

17 files changed

+19
-390
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# [Unreleased](https://github.com/pybamm-team/PyBaMM)
2+
3+
## Breaking changes
4+
5+
- Removed "set external temperature" and "set external potential" options. Use "external submodels" option instead ([#862](https://github.com/pybamm-team/PyBaMM/pull/862))
6+
17
# [v0.2.0](https://github.com/pybamm-team/PyBaMM/tree/v0.2.0) - 2020-02-26
28

39
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.

docs/source/models/submodels/current_collector/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ Current Collector
1010
homogeneous_current_collector
1111
potential_pair
1212
quite_conductive_potential_pair
13-
set_potential_single_particle

docs/source/models/submodels/current_collector/set_potential_single_particle.rst

-11
This file was deleted.

docs/source/models/submodels/thermal/x_lumped/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ X-lumped
99
x_lumped_0D_current_collector
1010
x_lumped_1D_current_collector
1111
x_lumped_2D_current_collector
12-
x_lumped_1D_set_temperature

docs/source/models/submodels/thermal/x_lumped/x_lumped_1D_set_temperature.rst

-5
This file was deleted.

pybamm/models/full_battery_models/base_battery_model.py

+3-39
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,14 @@ class BaseBatteryModel(pybamm.BaseModel):
3737
(default) or "varying". Not currently implemented in any of the models.
3838
* "current collector" : str, optional
3939
Sets the current collector model to use. Can be "uniform" (default),
40-
"potential pair", "potential pair quite conductive", or
41-
"set external potential". The submodel "set external potential" can only
42-
be used with the SPM.
40+
"potential pair" or "potential pair quite conductive".
4341
* "particle" : str, optional
4442
Sets the submodel to use to describe behaviour within the particle.
4543
Can be "Fickian diffusion" (default) or "fast diffusion".
4644
* "thermal" : str, optional
4745
Sets the thermal model to use. Can be "isothermal" (default),
48-
"x-full", "x-lumped", "xyz-lumped", "lumped" or "set external
49-
temperature". Must be "isothermal" for lead-acid models. If the
50-
option "set external temperature" is selected then "dimensionality"
51-
must be 1.
46+
"x-full", "x-lumped", "xyz-lumped" or "lumped". Must be "isothermal" for
47+
lead-acid models.
5248
* "thermal current collector" : bool, optional
5349
Whether to include thermal effects in the current collector in
5450
one-dimensional models (default is False). Note that this option
@@ -193,7 +189,6 @@ def options(self, extra_options):
193189
"uniform",
194190
"potential pair",
195191
"potential pair quite conductive",
196-
"set external potential",
197192
]:
198193
raise pybamm.OptionError(
199194
"current collector model '{}' not recognised".format(
@@ -212,7 +207,6 @@ def options(self, extra_options):
212207
"x-lumped",
213208
"xyz-lumped",
214209
"lumped",
215-
"set external temperature",
216210
]:
217211
raise pybamm.OptionError(
218212
"Unknown thermal model '{}'".format(options["thermal"])
@@ -241,14 +235,6 @@ def options(self, extra_options):
241235
raise pybamm.OptionError(
242236
"thermal effects not implemented for lead-acid models"
243237
)
244-
if options["current collector"] == "set external potential" and not isinstance(
245-
self, pybamm.lithium_ion.SPM
246-
):
247-
raise pybamm.OptionError(
248-
"option {} only compatible with SPM".format(
249-
options["current collector"]
250-
)
251-
)
252238

253239
self._options = options
254240

@@ -544,14 +530,6 @@ def set_thermal_submodel(self):
544530
self.param
545531
)
546532

547-
elif self.options["thermal"] == "set external temperature":
548-
if self.options["dimensionality"] == 1:
549-
thermal_submodel = pybamm.thermal.x_lumped.SetTemperature1D(self.param)
550-
elif self.options["dimensionality"] in [0, 2]:
551-
raise NotImplementedError(
552-
"""Set temperature model only implemented for 1D current
553-
collectors"""
554-
)
555533
self.submodels["thermal"] = thermal_submodel
556534

557535
def set_current_collector_submodel(self):
@@ -563,20 +541,6 @@ def set_current_collector_submodel(self):
563541
submodel = pybamm.current_collector.PotentialPair1plus1D(self.param)
564542
elif self.options["dimensionality"] == 2:
565543
submodel = pybamm.current_collector.PotentialPair2plus1D(self.param)
566-
elif self.options["current collector"] == "set external potential":
567-
if self.options["dimensionality"] == 1:
568-
submodel = pybamm.current_collector.SetPotentialSingleParticle1plus1D(
569-
self.param
570-
)
571-
elif self.options["dimensionality"] == 2:
572-
submodel = pybamm.current_collector.SetPotentialSingleParticle2plus1D(
573-
self.param
574-
)
575-
elif self.options["dimensionality"] == 0:
576-
raise NotImplementedError(
577-
"""Set potential model only implemented for 1D or 2D current
578-
collectors"""
579-
)
580544
self.submodels["current collector"] = submodel
581545

582546
def set_voltage_variables(self):

pybamm/models/submodels/current_collector/__init__.py

-5
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,3 @@
1717
QuiteConductivePotentialPair1plus1D,
1818
QuiteConductivePotentialPair2plus1D,
1919
)
20-
from .set_potential_single_particle import (
21-
BaseSetPotentialSingleParticle,
22-
SetPotentialSingleParticle1plus1D,
23-
SetPotentialSingleParticle2plus1D,
24-
)

pybamm/models/submodels/current_collector/set_potential_single_particle.py

-115
This file was deleted.

pybamm/models/submodels/thermal/x_lumped/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
from .x_lumped_0D_current_collectors import CurrentCollector0D
44
from .x_lumped_1D_current_collectors import CurrentCollector1D
55
from .x_lumped_2D_current_collectors import CurrentCollector2D
6-
from .x_lumped_1D_set_temperature import SetTemperature1D

pybamm/models/submodels/thermal/x_lumped/x_lumped_1D_set_temperature.py

-47
This file was deleted.

tests/unit/test_models/test_full_battery_models/test_base_battery_model.py

-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ def test_bad_options(self):
122122
pybamm.BaseBatteryModel({"surface form": "bad surface form"})
123123
with self.assertRaisesRegex(pybamm.OptionError, "particle model"):
124124
pybamm.BaseBatteryModel({"particle": "bad particle"})
125-
with self.assertRaisesRegex(pybamm.OptionError, "option set external"):
126-
pybamm.BaseBatteryModel({"current collector": "set external potential"})
127125
with self.assertRaisesRegex(pybamm.OptionError, "operating mode"):
128126
pybamm.BaseBatteryModel({"operating mode": "bad operating mode"})
129127

tests/unit/test_models/test_full_battery_models/test_lithium_ion/test_dfn.py

-17
Original file line numberDiff line numberDiff line change
@@ -142,23 +142,6 @@ def test_x_lumped_thermal_2D_current_collector(self):
142142
model = pybamm.lithium_ion.DFN(options)
143143
model.check_well_posedness()
144144

145-
def test_x_lumped_thermal_set_temperature_1D(self):
146-
options = {
147-
"current collector": "potential pair",
148-
"dimensionality": 1,
149-
"thermal": "set external temperature",
150-
}
151-
model = pybamm.lithium_ion.DFN(options)
152-
model.check_well_posedness()
153-
154-
options = {
155-
"current collector": "potential pair",
156-
"dimensionality": 2,
157-
"thermal": "set external temperature",
158-
}
159-
with self.assertRaises(NotImplementedError):
160-
model = pybamm.lithium_ion.DFN(options)
161-
162145
def test_particle_fast_diffusion(self):
163146
options = {"particle": "fast diffusion"}
164147
model = pybamm.lithium_ion.DFN(options)

tests/unit/test_models/test_full_battery_models/test_lithium_ion/test_spm.py

-29
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ def test_well_posed_2plus1D(self):
3939
model = pybamm.lithium_ion.SPM(options)
4040
model.check_well_posedness()
4141

42-
options = {"current collector": "set external potential", "dimensionality": 0}
43-
with self.assertRaises(NotImplementedError):
44-
pybamm.lithium_ion.SPM(options)
45-
46-
options = {"current collector": "set external potential", "dimensionality": 1}
47-
model = pybamm.lithium_ion.SPM(options)
48-
model.check_well_posedness()
49-
50-
options = {"current collector": "set external potential", "dimensionality": 2}
51-
model = pybamm.lithium_ion.SPM(options)
52-
model.check_well_posedness()
53-
5442
def test_x_full_thermal_model_no_current_collector(self):
5543
options = {"thermal": "x-full"}
5644
model = pybamm.lithium_ion.SPM(options)
@@ -155,23 +143,6 @@ def test_x_lumped_thermal_2D_current_collector(self):
155143
model = pybamm.lithium_ion.SPM(options)
156144
model.check_well_posedness()
157145

158-
def test_x_lumped_thermal_set_temperature_1D(self):
159-
options = {
160-
"current collector": "potential pair",
161-
"dimensionality": 1,
162-
"thermal": "set external temperature",
163-
}
164-
model = pybamm.lithium_ion.SPM(options)
165-
model.check_well_posedness()
166-
167-
options = {
168-
"current collector": "potential pair",
169-
"dimensionality": 2,
170-
"thermal": "set external temperature",
171-
}
172-
with self.assertRaises(NotImplementedError):
173-
model = pybamm.lithium_ion.SPM(options)
174-
175146
def test_particle_fast_diffusion(self):
176147
options = {"particle": "fast diffusion"}
177148
model = pybamm.lithium_ion.SPM(options)

0 commit comments

Comments
 (0)