Exemplo n.º 1
0
    def test_ReplayOfSplittingSolver_IsExact(self, Solver, solver_type, tol):
        """Test that basic and optimised splitting solvers yield
        very comparative results when configured identically."""

        self.tlm_adj_setup(Solver, solver_type)

        info_green("Replaying")
        success = replay_dolfin(tol=tol, stop=True)
        assert success
    def test_replay(self, Solver, solver_type, tol):
        "Test that replay of basic bidomain solver reports success."

        self._setup_solver(Solver, solver_type)
        self._solve()

        # Check replay
        info_green("Running replay basic (%s)" % solver_type)
        success = replay_dolfin(stop=True, tol=tol)
        assert_equal(success, True)
    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)