Esempio n. 1
0
# import particles from root
fields = [
    "position-x", "position-y", "position-z", "velocity-x", "velocity-y",
    "velocity-z", "mass", "ids"
]

for field in fields:
    phd._comm.Scatterv([particles_root[field], (lengths, disp)],
                       particles[field])

particles["tag"][:] = phd.ParticleTAGS.Real
particles["type"][:] = phd.ParticleTAGS.Undefined

# computation related to boundaries
domain_manager = phd.DomainManager(xmin=[0., 0., 0.],
                                   xmax=[100., 100., 100.],
                                   initial_radius=0.1,
                                   dim=3)

# load balance
load_balance = phd.LoadBalance(factor=0.1, min_in_leaf=0, order=18)

# setup gravity
gravity_tree = phd.GravityTree(barnes_angle=0.4, smoothing_length=0.03)

# computation
integrator = phd.Nbody(dt=0.005)
integrator.set_particles(particles)
integrator.set_domain_manager(domain_manager)
integrator.set_gravity_tree(gravity_tree)
integrator.set_load_balance(load_balance)
Esempio n. 2
0
    particles["velocity-y"][:] = 0.0
    particles["velocity-z"][:] = 0.0

    cells = particles["position-x"] > diaphragm
    particles["density"][cells] = 0.125
    particles["pressure"][cells] = 0.1

    return particles

dim = 3; gamma = 1.4
particles = phd.distribute_initial_particles(
        create_particles, dim=dim, gamma=gamma)

# computation related to boundaries
domain_manager = phd.DomainManager(
        xmin=[0., 0., 0.], xmax=[1., 1., 1.],
        initial_radius=0.1)

# create voronoi mesh
mesh = phd.Mesh(relax_iterations=10)

# computation
integrator = phd.MovingMeshMUSCLHancock()
integrator.set_mesh(mesh)
integrator.set_riemann(phd.HLLC())
integrator.set_particles(particles)
integrator.set_domain_manager(domain_manager)
integrator.set_boundary_condition(phd.Reflective())
integrator.set_reconstruction(phd.PieceWiseLinear())
integrator.set_equation_state(phd.IdealGas(gamma=gamma))
# allocate local particle container
particles = phd.HydroParticleCreator(send)

# import particles from root
fields = ["position-x", "position-y", "density", "velocity-y", "pressure", "ids"]
for field in fields:
    phd._comm.Scatterv([particles_root[field], (lengths, disp)], particles[field])

particles["velocity-x"][:] = 0.0
particles["tag"][:] = phd.ParticleTAGS.Real
particles["type"][:] = phd.ParticleTAGS.Undefined

# computation related to boundaries
domain_manager = phd.DomainManager(
        xmin=[0., 0.], xmax=[3., 3.], initial_radius=0.1,
        search_radius_factor=2)

# create voronoi mesh
mesh = phd.Mesh(regularize=True, relax_iterations=0)

# computation
integrator = phd.MovingMeshMUSCLHancock()
#integrator = phd.StaticMeshMUSCLHancock()
integrator.set_mesh(mesh)
integrator.set_riemann(phd.HLLC(boost=True))
integrator.set_particles(particles)
integrator.set_equation_state(phd.IdealGas())
integrator.set_domain_manager(domain_manager)
integrator.set_load_balance(phd.LoadBalance())
integrator.set_boundary_condition(phd.Reflective())