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 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
# au, av MomentumEquationWithStress2D( dest='solid', sources=['solid',], n=4, wdeltap=wdeltap), # au, av MonaghanArtificialViscosity( dest='solid', sources=['solid',], alpha=1.0, beta=1.0), # a_s00, a_s01, a_s11 HookesDeviatoricStressRate2D( dest='solid', sources=None, shear_mod=G), # ax, ay, az XSPHCorrection( dest='solid', sources=['solid',], eps=0.5), ] ) # End Acceleration Group ] # End Group list # Setup the application and solver. This also generates the particles. app.setup(solver=solver, equations=equations, particle_factory=create_particles, name='fluid') # run app.run()
# The main accelerations block. The acceleration arrays for the # fluid phase are upadted in this stage for all local particles. Group( equations=[ # Pressure gradient terms MomentumEquationPressureGradient( dest='fluid', sources=['fluid', 'solid'], gx=fx, pb=p0), # fluid viscosity MomentumEquationViscosity( dest='fluid', sources=['fluid'], nu=nu), # No-slip boundary condition. This is effectively a # viscous interaction of the fluid with the ghost # particles. SolidWallNoSlipBC( dest='fluid', sources=['solid'], nu=nu), # Artificial stress for the fluid phase MomentumEquationArtificialStress(dest='fluid', sources=['fluid']), ], real=True), ] # Setup the application and solver. This also generates the particles. app.setup(solver=solver, equations=equations, particle_factory=create_particles) app.run()
# Equation of state Group(equations=[ TaitEOS(dest='fluid', sources=None, rho0=ro, c0=co, gamma=gamma), TaitEOSHGCorrection(dest='boundary', sources=None, rho0=ro, c0=co, gamma=gamma), TaitEOSHGCorrection(dest='obstacle', sources=None, rho0=ro, c0=co, gamma=gamma), ], real=False), # Continuity, momentum and xsph equations Group(equations=[ ContinuityEquation(dest='fluid', sources=['fluid', 'boundary', 'obstacle']), ContinuityEquation(dest='boundary', sources=['fluid']), ContinuityEquation(dest='obstacle', sources=['fluid']), MomentumEquation(dest='fluid', sources=['fluid', 'boundary', 'obstacle'], alpha=alpha, beta=beta, gz=-9.81, c0=co, tensile_correction=True), XSPHCorrection(dest='fluid', sources=['fluid']) ]), ] # Setup the application and solver. This also generates the particles. app.setup(solver=solver, equations=equations, particle_factory=geom.create_particles, hdx=hdx) app.run()
Group( equations=[ PressureSolve( dest='fluid', sources=['fluid'], rho0=ro, tolerance=1e-3, debug=False ), PressureSolveBoundary( dest='fluid', sources=['boundary'], rho0=ro, ), ] ), ], iterate=True, max_iterations=30, min_iterations=2 ), Group( equations=[ PressureForce(dest='fluid', sources=['fluid']), PressureForceBoundary(dest='fluid', sources=['boundary'], rho0=ro), ], ), ] # Setup the application and solver. This also generates the particles. app.setup(solver=solver, equations=equations, particle_factory=create_particles, nboundary_layers=1, nfluid_offset=1) app.run()
Group( equations=[ComputeDIJPJ(dest='fluid', sources=['fluid'])] ), Group( equations=[ PressureSolve( dest='fluid', sources=['fluid'], rho0=ro, tolerance=1e-2, debug=False ), ] ), ], iterate=True, max_iterations=20 ), Group( equations=[ PressureForce(dest='fluid', sources=['fluid']), ], ), ] # Setup the application and solver. app.setup(solver=solver, equations=equations, particle_factory=get_circular_patch) # run the solver... app.run()