def main(): # Create the application. app = Application() dim = 1 # Create the kernel kernel = CubicSpline(dim=dim) # Create the integrator. integrator = EulerIntegrator(fluid=DummyStepper()) solver = Solver(kernel=kernel, dim=dim, integrator=integrator) solver.set_time_step(0.1) solver.set_final_time(0.1) equations = [TotalMass(dest='fluid', sources=['fluid'])] app.setup( solver=solver, equations=equations, particle_factory=create_particles) # There is no need to write any output as the test below # computes the total mass. solver.set_disable_output(True) app.run() fluid = solver.particles[0] err = fluid.total_mass[0] - 10.0 assert abs(err) < 1e-16, "Error: %s" % err
def create_solver(self): dim = 1 # Create the kernel kernel = CubicSpline(dim=dim) # Create the integrator. integrator = EulerIntegrator(fluid=DummyStepper()) solver = Solver(kernel=kernel, dim=dim, integrator=integrator) solver.set_time_step(0.1) solver.set_final_time(0.1) # There is no need to write any output as the test below # computes the total mass. solver.set_disable_output(True) return solver
def stage1(self): pass # Create the application. app = Application() dim = 1 # Create the kernel kernel = CubicSpline(dim=dim) # Create the integrator. integrator = EulerIntegrator(fluid=DummyStepper()) solver = Solver(kernel=kernel, dim=dim, integrator=integrator) solver.set_time_step(0.1) solver.set_final_time(0.1) equations = [TotalMass(dest='fluid', sources=['fluid'])] app.setup(solver=solver, equations=equations, particle_factory=create_particles) # There is no need to write any output as the test below # computes the total mass. solver.set_disable_output(True) app.run() fluid = solver.particles[0] err = fluid.total_mass[0] - 10.0 assert abs(err) < 1e-16, "Error: %s" % err