Ejemplo n.º 1
0
def get_wavespaddle_geometry(hdx=1.,
                             dx_f=0.02,
                             dx_s=0.02,
                             r_f=100.,
                             r_s=100.,
                             length=13.,
                             height=0.8,
                             flat_l=1.48,
                             h_fluid=0.43,
                             angle=2.8624):
    x1, y1, x2, y2 = get_beach_geometry_2d(dx_s, length, height, flat_l, angle,
                                           3)
    theta = np.pi * angle / 180.0
    p1x = flat_l - 9.605
    p1y = 0.40625
    p2x = flat_l - 10.065
    p2y = 0.6085
    theta1 = np.arctan((p2y - p1y) / (p2x - p1x))
    p3x = flat_l - 10.28
    p3y = 0.6085
    theta2 = np.arctan((p3y - p2y) / (p3x - p2x))
    p4x = flat_l - 10.62
    p4y = 0.457
    theta3 = np.arctan((p4y - p3y) / (p4x - p3x))
    obs_x1 = np.arange(p2x, p1x, dx_s / 2.0)
    obs_y1 = p1y + (obs_x1 - p1x) * np.tan(theta1)
    obs_x2 = np.arange(p3x, p2x, dx_s / 2.0)
    obs_y2 = p2y + (obs_x2 - p2x) * np.tan(-theta2)
    obs_x3 = np.arange(p4x, p3x, dx_s / 2.0)
    obs_y3 = p3y + (obs_x3 - p3x) * np.tan(theta3)
    x1 = np.concatenate([x1, obs_x1, obs_x2, obs_x3])
    y1 = np.concatenate([y1, obs_y1, obs_y2, obs_y3])
    r1 = np.ones_like(x1) * r_s
    m1 = r1 * dx_s * dx_s
    h1 = np.ones_like(x1) * hdx * dx_s
    wall = get_particle_array(name='wall', x=x1, y=y1, rho=r1, m=m1, h=h1)
    r2 = np.ones_like(x2) * r_s
    m2 = r2 * dx_s * dx_s
    h2 = np.ones_like(x2) * hdx * dx_s
    paddle = get_particle_array(name='paddle', x=x2, y=y2, rho=r2, m=m2, h=h2)
    fluid_center = np.array([flat_l - length / 2.0, h_fluid / 2.0])
    x_fluid, y_fluid = get_2d_block(dx_f, length, h_fluid, fluid_center)
    x3 = []
    y3 = []
    for i, xi in enumerate(x_fluid):
        if y_fluid[i] >= np.tan(-theta) * xi:
            x3.append(xi)
            y3.append(y_fluid[i])
    x3 = np.array(x3)
    y3 = np.array(y3)
    r3 = np.ones_like(x3) * r_f
    m3 = r3 * dx_f * dx_f
    h3 = np.ones_like(x3) * hdx * dx_f
    fluid = get_particle_array(name='fluid', x=x3, y=y3, rho=r3, m=m3, h=h3)
    remove_overlap_particles(fluid, wall, dx_s, 2)
    remove_overlap_particles(fluid, paddle, dx_s, 2)
    return fluid, wall, paddle
Ejemplo n.º 2
0
def get_tsunami_geometry(dx_solid=0.01, dx_fluid=0.01, r_solid=100.0,
                         r_fluid=100.0, hdx=1.3, l_wall=9.5, h_wall=4.0,
                         angle=26.565051, h_fluid=3.5, l_obstacle=0.91,
                         flat_l=2.25):
    x1, y1, x2, y2 = get_beach_geometry_2d(dx_solid, l_wall, h_wall, flat_l,
                                           angle, 4)
    wall_x = np.concatenate([x1, x2])
    wall_y = np.concatenate([y1, y2])
    r_wall = np.ones_like(wall_x) * r_solid
    m_wall = r_wall * dx_solid * dx_solid
    h_w = np.ones_like(wall_x) * dx_solid * hdx
    wall = get_particle_array(name='wall', x=wall_x, y=wall_y, h=h_w,
                              rho=r_wall, m=m_wall)
    theta = np.pi * angle / 180.0
    h_obstacle = l_obstacle * np.tan(theta)
    obstacle_x1, obstacle_y1 = get_2d_block(dx_solid, l_obstacle, h_obstacle)
    obstacle_x = []
    obstacle_y = []
    for x, y in zip(obstacle_x1, obstacle_y1):
        if (y >= (-x * np.tan(theta))):
            obstacle_x.append(x)
            obstacle_y.append(y)
    x_translate = (l_wall - flat_l) * 0.8
    y_translate = x_translate * np.tan(theta)
    obstacle_x = np.asarray(obstacle_x) - x_translate
    obstacle_y = np.asarray(obstacle_y) + y_translate + dx_solid
    h_obstacle = np.ones_like(obstacle_x) * dx_solid * hdx
    r_obstacle = np.ones_like(obstacle_x) * r_solid
    m_obstacle = r_obstacle * dx_solid * dx_solid
    obstacle = get_particle_array(name='obstacle', x=obstacle_x,
                                  y=obstacle_y, rho=r_obstacle,
                                  m=m_obstacle, h=h_obstacle)
    fluid_center = np.array([flat_l - l_wall / 2.0, h_fluid / 2.0])
    x_fluid, y_fluid = get_2d_block(dx_fluid, l_wall, h_fluid, fluid_center)
    x3 = []
    y3 = []
    for i, xi in enumerate(x_fluid):
        if y_fluid[i] >= np.tan(-theta) * xi:
            x3.append(xi)
            y3.append(y_fluid[i])
    fluid_x = np.array(x3)
    fluid_y = np.array(y3)
    h_f = np.ones_like(fluid_x) * dx_fluid * hdx
    r_f = np.ones_like(fluid_x) * r_fluid
    m_f = r_f * dx_fluid * dx_fluid
    fluid = get_particle_array(name='fluid', x=fluid_x, y=fluid_y,
                               h=h_f, m=m_f, rho=r_f)
    remove_overlap_particles(fluid, obstacle, dx_solid * 1.1, 2)
    remove_overlap_particles(fluid, wall, dx_solid * 1.1, 2)
    return fluid, wall, obstacle
Ejemplo n.º 3
0
def get_wavespaddle_geometry(hdx=1.5,
                             dx_f=0.1,
                             dx_s=0.1,
                             r_f=100.,
                             r_s=100.,
                             length=3.75,
                             height=0.3,
                             flat_l=1.,
                             angle=4.2364,
                             h_fluid=0.2):
    x1, y1, x2, y2 = get_beach_geometry_2d(dx_s, length, height, flat_l, angle,
                                           5)
    r1 = np.ones_like(x1) * r_s
    m1 = r1 * dx_s * dx_s
    h1 = np.ones_like(x1) * hdx * dx_s
    wall = get_particle_array(name='wall', x=x1, y=y1, rho=r1, m=m1, h=h1)
    r2 = np.ones_like(x2) * r_s
    m2 = r2 * dx_s * dx_s
    h2 = np.ones_like(x2) * hdx * dx_s
    paddle = get_particle_array(name='paddle', x=x2, y=y2, rho=r2, m=m2, h=h2)
    fluid_center = np.array([flat_l - length / 2.0, h_fluid / 2.0])
    x_fluid, y_fluid = get_2d_block(dx_f, length, h_fluid, fluid_center)
    x3 = []
    y3 = []
    theta = np.pi * angle / 180.0
    for i, xi in enumerate(x_fluid):
        if y_fluid[i] >= np.tan(-theta) * xi:
            x3.append(xi)
            y3.append(y_fluid[i])
    x3 = np.array(x3)
    y3 = np.array(y3)
    r3 = np.ones_like(x3) * r_f
    m3 = r3 * dx_f * dx_f
    h3 = np.ones_like(x3) * hdx * dx_f
    fluid = get_particle_array(name='fluid', x=x3, y=y3, rho=r3, m=m3, h=h3)
    remove_overlap_particles(fluid, wall, dx_s, 2)
    remove_overlap_particles(fluid, paddle, dx_s, 2)
    return fluid, wall, paddle
Ejemplo n.º 4
0
def get_wavespaddle_geometry(hdx=1.5,
                             dx_f=0.1,
                             dx_s=0.05,
                             r_f=100.,
                             r_s=100.,
                             length=3.75,
                             height=0.3,
                             flat_l=1.,
                             angle=4.2364,
                             h_fluid=0.2,
                             obstacle_side=0.06):
    x1, y1, x2, y2 = get_beach_geometry_2d(dx_s, length, height, flat_l, angle,
                                           3)
    r1 = np.ones_like(x1) * r_s
    m1 = r1 * dx_s * dx_s
    h1 = np.ones_like(x1) * hdx * dx_s
    cs1 = np.zeros_like(x1)
    rad1 = np.ones_like(x1) * dx_s
    wall = get_particle_array(name='wall',
                              x=x1,
                              y=y1,
                              rho=r1,
                              m=m1,
                              h=h1,
                              cs=cs1,
                              rad_s=rad1)
    r2 = np.ones_like(x2) * r_s
    m2 = r2 * dx_s * dx_s
    h2 = np.ones_like(x2) * hdx * dx_s
    paddle = get_particle_array(name='paddle', x=x2, y=y2, rho=r2, m=m2, h=h2)
    fluid_center = np.array([flat_l - length / 2.0, h_fluid / 2.0])
    x_fluid, y_fluid = get_2d_block(dx_f, length, h_fluid, fluid_center)
    x3 = []
    y3 = []
    theta = np.pi * angle / 180.0
    for i, xi in enumerate(x_fluid):
        if y_fluid[i] >= np.tan(-theta) * xi:
            x3.append(xi)
            y3.append(y_fluid[i])
    x3 = np.array(x3)
    y3 = np.array(y3)
    r3 = np.ones_like(x3) * r_f
    m3 = r3 * dx_f * dx_f
    h3 = np.ones_like(x3) * hdx * dx_f
    cs3 = np.zeros_like(x3)
    rad3 = np.ones_like(x3) * dx_f
    fluid = get_particle_array(name='fluid', x=x3, y=y3, rho=r3, m=m3, h=h3)
    square_center = np.array([-0.38, 0.16])
    x4, y4 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center)
    b1 = np.zeros_like(x4, dtype=int)
    square_center = np.array([-0.7, 0.16])
    x5, y5 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center)
    b2 = np.ones_like(x5, dtype=int)
    square_center = np.array([-1.56, 0.22])
    x6, y6 = get_2d_block(dx_s, obstacle_side, obstacle_side, square_center)
    b3 = np.ones_like(x5, dtype=int) * 2
    b = np.concatenate([b1, b2, b3])
    x4 = np.concatenate([x4, x5, x6])
    y4 = np.concatenate([y4, y5, y6])
    r4 = np.ones_like(x4) * r_s * 0.5
    m4 = r4 * dx_s * dx_s
    h4 = np.ones_like(x4) * hdx * dx_s
    cs4 = np.zeros_like(x4)
    rad4 = np.ones_like(x4) * dx_s
    obstacle = get_particle_array_rigid_body(name='obstacle',
                                             x=x4,
                                             y=y4,
                                             h=h4,
                                             rho=r4,
                                             m=m4,
                                             cs=cs4,
                                             rad_s=rad4,
                                             body_id=b)
    remove_overlap_particles(fluid, wall, dx_s, 2)
    remove_overlap_particles(fluid, paddle, dx_s, 2)
    remove_overlap_particles(fluid, obstacle, dx_s, 2)
    return fluid, wall, paddle, obstacle