def test_solve_serial(self): solver = pac.FspSolverMultiSinks(mpi.COMM_SELF) solver.SetModel(self.stoich_mat, tcoeff, propensity) solver.SetFspShape(simple_constr, init_bounds) X0 = np.array([[0, 0]]) p0 = np.array([1.0]) solver.SetInitialDist(X0, p0) solution = solver.Solve(10.0, 1.0E-6) prob = np.asarray(solution.GetProbViewer()) self.assertAlmostEqual(prob.sum(), 1.0, 4)
def test_solve_parallel_krylov(self): solver = pac.FspSolverMultiSinks(mpi.COMM_WORLD) solver.SetModel(self.stoich_mat, tcoeff, propensity) solver.SetFspShape(simple_constr, init_bounds) X0 = np.array([[0, 0]]) p0 = np.array([1.0]) solver.SetInitialDist(X0, p0) solver.SetOdeSolver("Krylov") solution = solver.Solve(10.0, 1.0e-6) prob = np.asarray(solution.GetProbViewer()) psum1 = prob.sum() psum = mpi.COMM_WORLD.allreduce(psum1) self.assertAlmostEqual(psum, 1.0, 4)
if reaction is 12: out[:] = gamma_cyt * X[:, 5] return def t_fun(time, out): if time > t0: out[1] = np.double(max(0.0, k10a - k10b * hog1pstar(time - t0))) else: out[1] = 0.0 init_bounds = np.array([1, 1, 1, 1, 50, 100]) # Create parallel solver object solver = pacmensl.FspSolverMultiSinks(MPI.COMM_WORLD) solver.SetModel(sm, t_fun, propensity, [1]) solver.SetFspShape(constr_fun=None, constr_bound=init_bounds) solver.SetInitialDist(x0, p0) solver.SetVerbosity(2) solver.SetOdeSolver("petsc") solver.SetUp() tspan = np.linspace(0, 60 * 15, 5) solution1 = solver.SolveTspan(tspan, 1.0e-4) solver.ClearState() # Create parallel solver object solver = pacmensl.FspSolverMultiSinks(MPI.COMM_WORLD) solver.SetModel(sm, t_fun, propensity, [1]) solver.SetFspShape(constr_fun=None, constr_bound=init_bounds)
def test_set_shape(self): solver = pac.FspSolverMultiSinks(mpi.COMM_WORLD) solver.SetModel(self.stoich_mat, tcoeff, propensity) solver.SetFspShape(simple_constr, init_bounds)
def test_set_initial_distribution(self): solver = pac.FspSolverMultiSinks(mpi.COMM_WORLD) solver.SetModel(self.stoich_mat, tcoeff, propensity) X0 = np.array([[0, 0]]) p0 = np.array([1.0]) solver.SetInitialDist(X0, p0)
def test_set_model(self): solver = pac.FspSolverMultiSinks(mpi.COMM_WORLD) solver.SetModel(self.stoich_mat, tcoeff, propensity)
def test_serial_constructor(self): solver = pac.FspSolverMultiSinks(mpi.COMM_SELF)