def test_replay(self): "Test that replay reports success for basic single cell solver" set_dolfin_parameters() model = Model() # Initialize solver params = BasicSingleCellSolver.default_parameters() params["theta"] = theta time = Constant(0.0) solver = BasicSingleCellSolver(model, time, params=params) info_green("Running %s with theta %g" % (model, theta)) ics = project(model.initial_conditions(), solver.VS).copy(deepcopy=True, name="ics") self._run(solver, model, ics) info_green("Replaying") success = replay_dolfin(tol=0.0, stop=True) assert_true(success)
def test_replay(self, cell_model, Scheme): mesh = UnitIntervalMesh(3) Model = cell_model.__class__ if isinstance(cell_model, fails_with_RK4) and Scheme == "RK4": pytest.xfail("RK4 is unstable for some models with this timestep (0.01)") # Initiate solver, with model and Scheme params = Model.default_parameters() model = Model(params=params) solver = self._setup_solver(model, Scheme, mesh) ics = project(model.initial_conditions(), solver.VS) info_green("Running forward %s with %s (replay)" % (model, Scheme)) self._run(solver, ics) print solver.solution_fields()[0].vector().array() info_green("Replaying") success = replay_dolfin(tol=0, stop=True) assert_true(success)