Пример #1
0
def get_boundary_particles():
    """ Get the particles corresponding to the dam and fluids """
    
    xb1, yb1 = geom.create_2D_tank(x1=0, y1=0,
                                   x2=container_width, y2=container_height,
                                   dx=dx)
    
    xb2, yb2 = geom.create_2D_tank(x1=-dx/2, y1=-dx/2,
                                   x2=container_width, y2=container_height,
                                   dx=dx)

    xb = numpy.concatenate((xb1, xb2))
    yb = numpy.concatenate((yb1, yb2))

    hb = numpy.ones_like(xb)*h
    mb = numpy.ones_like(xb)*dx*dy*ro*0.5
    rhob = numpy.ones_like(xb) * ro

    cb = numpy.ones_like(xb)*co

    boundary = base.get_particle_array(cl_precision="single",
                                       name="boundary", type=Solid, 
                                       x=xb, y=yb, h=hb, rho=rhob, cs=cb,
                                       m=mb)

    print 'Number of Boundary particles: ', len(xb)

    return boundary
Пример #2
0
def get_boundary_particles():
    """ Get the particles corresponding to the dam and fluids """

    # get the tank
    xt1, yt1 = geom.create_2D_tank(x1=0, y1=0,
                                   x2=tank_length, y2=tank_height,
                                   dx=dx)

    xt2,  yt2 = geom.create_2D_tank(x1=-dx/2, y1=-dx/2,
                                    x2=tank_length + dx/2, y2=tank_height+dx/2,
                                    dx=dx)

    x = numpy.concatenate( (xt1, xt2) )
    y = numpy.concatenate( (yt1, yt2) )

    h = numpy.ones_like(x) * h0
    m = numpy.ones_like(x) * ro*dx*dx*0.5
    rho = numpy.ones_like(x) * ro
    cs = numpy.ones_like(x) * co

    tank = base.get_particle_array(cl_precision="single", name="tank",
                                   type=Solid, x=x,y=y,m=m,rho=rho,h=h,cs=cs)
    np = tank.get_number_of_particles()

    # create the gate
    y1 = numpy.arange(dx/2, tank_height+1e-4, dx/2)
    x1 = numpy.ones_like(y1)*(0.38-dx/2)

    y2 = numpy.arange(dx/2+dx/4, tank_height+1e-4, dx/2)
    x2 = numpy.ones_like(y2)*(0.38-dx)

    y3 = numpy.arange(dx/2, tank_height+1e-4, dx/2)
    x3 = numpy.ones_like(y3)*(0.38-1.5*dx)

    x = numpy.concatenate( (x1, x2, x3) )
    y = numpy.concatenate( (y1, y2, y3) )

    h = numpy.ones_like(x) * h0
    m = numpy.ones_like(x) * 0.5 * dx/2 * dx/2 * ro
    rho = numpy.ones_like(x) * ro
    cs = numpy.ones_like(x) * co
    v = numpy.ones_like(x) * 1.5

    gate = base.get_particle_array(cl_precision="single", name="gate",
                                   x=x, y=y, m=m, rho=rho, h=h, cs=cs,
                                   v=v,
                                   type=Solid)

    np += gate.get_number_of_particles()
    print "Number of solid particles = %d"%(np)

    return [tank, gate]