Skip to content

Commit

Permalink
#2193 add test
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinsulzer committed Jul 29, 2022
1 parent 3535a6e commit 56cae9b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/test_experiments/test_simulation_with_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ def test_run_experiment(self):
self.assertEqual(len(sol3.cycles), 2)
os.remove("test_experiment.sav")

def test_run_experiment_multiple_times(self):
experiment = pybamm.Experiment(
[
(
"Discharge at C/20 for 1 hour",
"Charge at C/20 until 4.1 V",
)
]
* 3
)
model = pybamm.lithium_ion.DFN()
sim = pybamm.Simulation(model, experiment=experiment)

# Test that solving twice gives the same solution (see #2193)
sol1 = sim.solve()
sol2 = sim.solve()
np.testing.assert_array_equal(
sol1["Terminal voltage [V]"].data, sol2["Terminal voltage [V]"].data
)

def test_run_experiment_cccv_ode(self):
experiment_2step = pybamm.Experiment(
[
Expand Down

0 comments on commit 56cae9b

Please sign in to comment.