Skip to content

Commit

Permalink
#2304 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjrobins committed Nov 23, 2022
1 parent 23603d0 commit bff61b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pybamm/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ def build(self, check_model=True, initial_soc=None):
self._built_model = self._disc.process_model(
self._model_with_set_params, inplace=False, check_model=check_model
)
# rebuilt model so clear solver setup
self._solver.models_set_up = {}

def build_for_experiment(self, check_model=True, initial_soc=None):
"""
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/test_plotting/test_quick_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,15 @@ def test_model_with_inputs(self):
timescale = parameter_values.evaluate(pybamm.LithiumIonParameters().timescale)
model = pybamm.lithium_ion.SPMe({"timescale": timescale})
parameter_values.update({"Electrode height [m]": "[input]"})
solver = pybamm.CasadiSolver(mode="safe")
solver1 = pybamm.CasadiSolver(mode="safe")
sim1 = pybamm.Simulation(
model, parameter_values=parameter_values, solver=solver
model, parameter_values=parameter_values, solver=solver1
)
inputs1 = {"Electrode height [m]": 1.00}
sol1 = sim1.solve(t_eval=np.linspace(0, 1000, 101), inputs=inputs1)
solver2 = pybamm.CasadiSolver(mode="safe")
sim2 = pybamm.Simulation(
model, parameter_values=parameter_values, solver=solver
model, parameter_values=parameter_values, solver=solver2
)
inputs2 = {"Electrode height [m]": 2.00}
sol2 = sim2.solve(t_eval=np.linspace(0, 1000, 101), inputs=inputs2)
Expand Down

0 comments on commit bff61b4

Please sign in to comment.