Skip to content

Commit

Permalink
Raise error when basic half cell model is used with simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
molel-gt committed Jun 21, 2021
1 parent 0476d91 commit 12f88ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def __init__(
):
self.parameter_values = parameter_values or model.default_parameter_values

if isinstance(model, pybamm.lithium_ion.BasicDFNHalfCell):
if experiment is not None:
raise NotImplementedError("BasicDFNHalfCell is not compatible with experiment simulations yet.")

if experiment is None:
# Check to see if the current is provided as data (i.e. drive cycle)
current = self._parameter_values.get("Current function [A]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ def test_dfn_half_cell_well_posed(self):
copy = model.new_copy()
copy.check_well_posedness()

def test_dfn_half_cell_simulation_with_experiment_error(self):
options = {"working electrode": "negative"}
model = pybamm.lithium_ion.BasicDFNHalfCell(options=options)
experiment = pybamm.Experiment([("Discharge at C/10 for 10 hours or until 3.5 V")])
with self.assertRaisesRegex(
NotImplementedError, "BasicDFNHalfCell is not compatible with experiment simulations yet."):
pybamm.Simulation(model, experiment=experiment)

def basic_dfn_half_cell_simulation(self):
model = pybamm.lithium_ion.BasicDFNHalfCell(options={"working electrode": "positive"})
sim = pybamm.Simulation(model=model)
sim.solve([0, 3600])

def test_dfn_half_cell_defaults(self):
# test default geometry
var = half_cell_spatial_vars
Expand Down

0 comments on commit 12f88ca

Please sign in to comment.