Ejemplo n.º 1
0
# 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))

sim_name = "sod"
if phd._in_parallel:
    integrator.set_load_balance(phd.LoadBalance())
    sim_name = "mpi_sod"

# add finish criteria
simulation_time_manager = phd.SimulationTimeManager()
simulation_time_manager.add_finish(phd.Time(time_max=0.15))

# output last step
output = phd.FinalOutput()
output.set_writer(phd.Hdf5())
simulation_time_manager.add_output(output)
Ejemplo n.º 2
0
    pc['velocity-x'][:] = 0.0
    pc['velocity-y'][:] = 0.0
    pc['tag'][:] = phd.ParticleTAGS.Real
    pc['type'][:] = phd.ParticleTAGS.Undefined

    return pc


# simulation driver
sim = phd.Simulation(cfl=0.5,
                     tf=2.5,
                     pfreq=25,
                     relax_num_iterations=0,
                     output_relax=False,
                     fname='implosion')

sim.add_component(
    create_particles(1.4))  # create inital state of the simulation
sim.add_component(phd.DomainLimits(dim=2, xmin=0.,
                                   xmax=1.))  # spatial size of problem
sim.add_component(phd.Boundary(boundary_type=phd.BoundaryType.Reflective)
                  )  # reflective boundary condition
sim.add_component(phd.Mesh())  # tesselation algorithm
sim.add_component(phd.PieceWiseLinear())  # Linear reconstruction
#sim.add_component(phd.PieceWiseConstant())                                   # Linear reconstruction
sim.add_component(phd.HLLC(gamma=1.4))  # riemann solver
sim.add_component(phd.MovingMesh(regularize=1))  # Integrator

# run the simulation
sim.solve()
Ejemplo n.º 3
0
        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())
integrator.set_reconstruction(phd.PieceWiseLinear(limiter="arepo", gizmo_limiter=True))

# source term
integrator.add_source_term(phd.ConstantGravity())

# add finish criteria
simulation_time_manager = phd.SimulationTimeManager()
simulation_time_manager.add_finish(phd.Time(time_max=2.0))

# output last step
output = phd.FinalOutput()
output.set_writer(phd.Hdf5())
simulation_time_manager.add_output(output)

output = phd.IterationInterval(iteration_interval=100)
output.set_writer(phd.Hdf5())
Ejemplo n.º 4
0
    # computation related to boundaries
    domain_manager = phd.DomainManager(xmin=[0., 0.],
                                       xmax=[1., 1.],
                                       initial_radius=0.1)

    # create voronoi mesh
    mesh = phd.Mesh(regularize=False)

    # 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.Periodic())
    integrator.set_reconstruction(phd.PieceWiseLinear(gizmo_limiter=False))
    integrator.set_equation_state(phd.IdealGas(gamma=gamma))

    # add finish criteria
    simulation_time_manager = phd.SimulationTimeManager()
    simulation_time_manager.add_finish(phd.Time(time_max=1.0))

    # output last step
    output = phd.FinalOutput()
    output.set_writer(phd.Hdf5())
    simulation_time_manager.add_output(output)

    # output initial data
    output = phd.InitialOutput()
    output.set_writer(phd.Hdf5())
    simulation_time_manager.add_output(output)
Ejemplo n.º 5
0
    r = 0.1
    cells = ((pc['position-x']-.5)**2 + (pc['position-y']-.5)**2) <= r**2
    pc['pressure'][cells] = 1.0/(np.pi*r**2)*(gamma-1)

    # zero out the velocities and set particle type
    pc['velocity-x'][:] = 0.0
    pc['velocity-y'][:] = 0.0
    pc['tag'][:] = phd.ParticleTAGS.Real
    pc['type'][:] = phd.ParticleTAGS.Undefined

    return pc

# simulation driver
sim = phd.Simulation(
        cfl=0.5, tf=0.1, pfreq=1,
        relax_num_iterations=10,
        output_relax=False,
        fname='sedov_2d_uniform')

sim.add_particles(create_particles(1.4))                                  # create inital state of the simulation
sim.add_domain(phd.DomainLimits(dim=2, xmin=0., xmax=1.))                 # spatial size of problem 
sim.add_boundary(phd.Boundary(boundary_type=phd.BoundaryType.Reflective)) # reflective boundary condition
sim.add_mesh(phd.Mesh())                                                  # tesselation algorithm
sim.add_reconstruction(phd.PieceWiseLinear(limiter=1))                    # Linear reconstruction
#sim.add_reconstruction(phd.PieceWiseConstant(limiter=1))                    # Linear reconstruction
sim.add_riemann(phd.HLLC(gamma=1.4, boost=0))                             # riemann solver
sim.add_integrator(phd.MovingMesh(regularize=1))                          # Integrator

# run the simulation
sim.solve()