示例#1
0
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
示例#2
0
    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
示例#3
0
            # 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()