예제 #1
0
파일: dam_break.py 프로젝트: sabago/pysph
def get_fluid_particles():
    
    xf1, yf1 = geom.create_2D_filled_region(x1=dx, y1=dx,
                                            x2=fluid_column_width,
                                            y2=fluid_column_height,
                                            dx=dx)

    xf2, yf2 = geom.create_2D_filled_region(x1=dx/2, y1=dx/2,
                                            x2=fluid_column_width,
                                            y2=fluid_column_height,
                                            dx=dx)
    

    x = numpy.concatenate((xf1, xf2))
    y = numpy.concatenate((yf1, yf2))

    print 'Number of fluid particles: ', len(x)

    hf = numpy.ones_like(x) * h
    mf = numpy.ones_like(x) * dx * dy * ro * 0.5
    rhof = numpy.ones_like(x) * ro
    csf = numpy.ones_like(x) * co
    
    fluid = base.get_particle_array(cl_precision="single",
                                    name="fluid", type=Fluid,
                                    x=x, y=y, h=hf, m=mf, rho=rhof,
                                    cs=csf)

    return fluid
예제 #2
0
def get_fluid_particles():
    
    # create the dam
    xf1, yf1 = geom.create_2D_filled_region(x1=dx, y1=dx,
                                            x2=0.38-2*dx,
                                            y2=0.15,
                                            dx=dx)

    xf2, yf2 = geom.create_2D_filled_region(x1=dx/2, y1=dx/2,
                                            x2=0.38-2*dx,
                                            y2=0.15,
                                            dx=dx)

    # create the bed
    xf3, yf3 = geom.create_2D_filled_region(x1=0.38+dx/2, y1=dx/2,
                                            x2=tank_length-dx, y2=d,
                                            dx=dx)

    xf4, yf4 = geom.create_2D_filled_region(x1=0.38, y1=dx,
                                            x2=tank_length-dx/2, y2=d,
                                            dx=dx)
    

    x = numpy.concatenate( (xf1, xf2, xf3, xf4) )
    y = numpy.concatenate( (yf1, yf2, yf3, yf4) )

    hf = numpy.ones_like(x) * h0
    mf = numpy.ones_like(x) * dx * dx * ro * 0.5
    rhof = numpy.ones_like(x) * ro
    csf = numpy.ones_like(x) * co
    rhop = numpy.ones_like(x) * ro
    
    fluid = base.get_particle_array(cl_precision="single",
                                    name="fluid", type=Fluid,
                                    x=x, y=y, h=hf, m=mf, rho=rhof,
                                    cs=csf, rhop=rhop)

    np = fluid.get_number_of_particles()
    print "Number of fluid particles = %d"%(np)

    return fluid