Beispiel #1
0
    def create_particles(self):
        # Fluid particles
        hdx = 1.0
        d = 1.0
        dx = 50
        len_fluid_domain = 1400

        x, y = mgrid[0:len_fluid_domain + 1e-4:dx,
                     0:len_fluid_domain + 1e-4:dx]
        x = x.ravel()
        y = y.ravel()

        idx_inner_pa_to_split = []
        for idx, (x_i, y_i) in enumerate(zip(x, y)):
            if ((6 * dx <= x_i <= len_fluid_domain - 6 * dx)
                    and (6 * dx <= y_i <= len_fluid_domain - 6 * dx)):
                idx_inner_pa_to_split.append(idx)
        idx_inner_pa_to_split = array(idx_inner_pa_to_split)

        m = ones_like(x) * dx * dx * rho_w * d
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d

        A = m / rho
        A[idx_inner_pa_to_split] = 3000

        pa = gpa_swe(x=x,
                     y=y,
                     m=m,
                     rho0=rho0,
                     rho=rho,
                     h=h,
                     h0=h0,
                     A=A,
                     name='fluid')

        # Boundary Particles
        x, y = mgrid[-2 * dx:len_fluid_domain + 2 * dx + 1e-4:dx,
                     -2 * dx:len_fluid_domain + 2 * dx + 1e-4:dx]
        x = x.ravel()
        y = y.ravel()
        boun_idx = np.where((x < 0) | (y < 0) | (x > len_fluid_domain)
                            | (y > len_fluid_domain))
        x = x[boun_idx]
        y = y[boun_idx]
        m = ones_like(x) * dx * dx * rho_w * d
        h = ones_like(x) * hdx * dx
        rho = ones_like(x) * rho_w * d

        boundary = gpa_swe(name='boundary', x=x, y=y, m=m, h=h, rho=rho)

        compute_initial_props([pa])
        return [pa, boundary]
Beispiel #2
0
    def create_particles(self):
        """Create the Rectangular patch of fluid"""
        # The wall at x = 0 is simulated by applying a symmetry condition
        # in the fluid, i.e., an additional column of fluid to the left of the
        # wall
        dx = self.dx
        hdx = self.hdx
        dw0 = self.dw0
        le = self.le
        w = self.w

        x, y = mgrid[-le:le + 1e-4:dx, -w / 2.:w / 2. + 1e-4:dx]
        x = x.ravel()
        y = y.ravel()

        m = ones_like(x) * dx * dx * rho_w * dw0
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        rho = ones_like(x) * rho_w * dw0
        rho0 = ones_like(x) * rho_w * dw0

        fluid = gpa_swe(x=x,
                        y=y,
                        m=m,
                        rho=rho,
                        rho0=rho0,
                        h=h,
                        h0=h0,
                        name='fluid')

        # Bed props
        dxb = dx / 2.
        left_edge_bed = -3 * le
        right_edge_bed = 3 * le
        top_edge_bed = w + 4 * dxb
        bottom_edge_bed = -w - 4 * dxb
        xb, yb = mgrid[left_edge_bed:+right_edge_bed + 1e-4:dxb,
                       bottom_edge_bed:+top_edge_bed + 1e-4:dxb]
        xb = xb.ravel()
        yb = yb.ravel()

        xb_max = max(xb)
        b = (xb_max - xb) * tan(self.theta * pi / 180.)

        Vb = ones_like(xb) * dxb * dxb
        hb = ones_like(xb) * hdx * dxb

        bed = gpa_swe(name='bed', x=xb, y=yb, V=Vb, b=b, h=hb)

        compute_initial_props([fluid, bed])
        return [fluid, bed]
    def create_particles(self):
        """Create the Rectangular patch of fluid."""
        # The wall at x = 0 is simulated by applying a symmetry condition
        # in the fluid, i.e., an additional column of fluid to the left of the
        # wall
        x, y = mgrid[-self.le:self.le + 1e-4:self.dx,
                     -(self.w) / 2.:(self.w) / 2. + 1e-4:self.dx]
        x = x.ravel()
        y = y.ravel()

        dx = self.dx
        d = self.dw0
        hdx = self.hdx

        m = ones_like(x) * dx * dx * rho_w * d
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d

        pa = gpa_swe(x=x,
                     y=y,
                     m=m,
                     rho0=rho0,
                     rho=rho,
                     h=h,
                     h0=h0,
                     name='fluid')
        compute_initial_props([pa])
        return [pa]
    def create_particles(self):
        # 1D
        hdx = self.hdx
        dx = self.dx
        fluid_surf_hei = self.fluid_surf_hei

        # Bed
        l_bed = 8000.0
        dxb = dx
        xb = arange(0, l_bed + 1e-4, dxb)
        bo = 10.0
        a = 3000.0
        b = bo * ((xb - 0.5 * l_bed) / a)**2

        Vb = ones_like(xb) * dxb
        hb = ones_like(xb) * hdx * dxb

        bed = gpa_swe(name='bed', x=xb, V=Vb, b=b, h=hb)

        # For gradient correction
        len_b = len(bed.x) * 9
        bed.add_constant('m_mat', [0.0] * len_b)

        # Fluid
        x = arange(1000 + 2 * dx, 7000 - 2 * dx + 1e-4, dx)
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        fluid = gpa_swe(x=x, h=h, h0=h0, name='fluid')
        compute_fluid_elevation([fluid, bed])

        dw = fluid_surf_hei - fluid.b
        rho = dw * rho_w
        rho0 = dw * rho_w
        m = rho * dx

        fluid.m = m
        fluid.rho = rho
        fluid.rho0 = rho0
        fluid.dw = dw

        compute_initial_props([fluid])

        return [fluid, bed]
    def create_particles(self):
        n = self.n
        r = self.r
        dr = r / n

        d = self.dw0
        hdx = self.hdx

        x = zeros(0)
        y = zeros(0)

        # Create circular patch of fluid in a radial grid
        rad = 0.0
        for j in range(1, n+1):
                npnts = 4 * j
                dtheta = (2*pi) / npnts

                theta = arange(0, 2*pi-1e-10, dtheta)
                rad = rad + dr

                _x = rad * cos(theta)
                _y = rad * sin(theta)

                x = concatenate((x, _x))
                y = concatenate((y, _y))

        arr_ones = ones_like(x)

        m = arr_ones * (1.56*dr*dr) * rho_w * d

        rho = arr_ones * rho_w * d
        rho0 = arr_ones * rho_w * d

        h = arr_ones * hdx * dr
        h0 = arr_ones * hdx * dr

        # Analytially set fluid bottom height and gradients
        R = self.R
        theta = self.theta
        b = y**2/R + (theta*(pi/180.))*x
        bx = arr_ones * -0.839
        by = 0.909 * y
        byy = 0.909

        # Eccentricity in fluid column from mid section
        x += self.xcen
        y += self.ycen

        fluid = gpa_swe(x=x, y=y, m=m, rho=rho, rho0=rho0, h=h, h0=h0,
                        b=b, bx=bx, by=by, byy=byy, name='fluid')

        compute_initial_props([fluid])
        return [fluid]
Beispiel #6
0
    def create_particles(self):
        n = self.n
        r = self.r
        dr = r / n

        d = self.dw0
        hdx = self.hdx

        x = zeros(0)
        y = zeros(0)

        # Create circular patch of fluid in a radial grid
        rad = 0.0
        for j in range(1, n + 1):
            npnts = 4 * j
            dtheta = (2 * pi) / npnts

            theta = arange(0, 2 * pi - 1e-10, dtheta)
            rad = rad + dr

            _x = rad * cos(theta)
            _y = rad * sin(theta)

            x = concatenate((x, _x))
            y = concatenate((y, _y))

        m = ones_like(x) * (1.56 * dr * dr) * rho_w * d

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d

        h = ones_like(x) * hdx * dr
        h0 = ones_like(x) * hdx * dr

        pa = gpa_swe(x=x,
                     y=y,
                     m=m,
                     rho=rho,
                     rho0=rho0,
                     h=h,
                     h0=h0,
                     name='fluid')

        compute_initial_props([pa])
        return [pa]
Beispiel #7
0
    def create_particles(self):
        n = self.n
        hdx = self.hdx
        fluid_rad = self.r
        dr = (fluid_rad-100) / n
        zo = self.zo

        # Bed
        dxb = 50.
        xb, yb = mgrid[-5000:5000:dxb, -5000:5000:dxb]
        b = zo * ((xb**2 + yb**2)/fluid_rad**2)

        Vb = ones_like(xb) * dxb * dxb
        hb = ones_like(xb) * hdx * dxb

        bed = gpa_swe(name='bed', x=xb, y=yb, V=Vb, b=b, h=hb)

        # For gradient correction
        len_b = len(bed.x) * 9
        bed.add_constant('m_mat', [0.0] * len_b)

        # Fluid
        x = zeros(0)
        y = zeros(0)

        # Create circular patch in a radial grid
        rad = 0.0
        for j in range(1, n+1):
                npnts = 4 * j
                dtheta = (2*pi) / npnts

                theta = arange(0, 2*pi-1e-10, dtheta)
                rad = rad + dr

                _x = rad * cos(theta)
                _y = rad * sin(theta)

                x = concatenate((x, _x))
                y = concatenate((y, _y))

        x += self.x_cen_fluid
        y += self.y_cen_fluid

        h = ones_like(x) * hdx * dr
        h0 = ones_like(x) * hdx * dr

        # Distance between fluid center and bed center along x-direction
        zeta = self.x_cen_fluid - 0.0

        u = zeros_like(x)
        v = ones_like(x) * -(zeta*self.omega)
        vh = ones_like(x) * -(zeta*self.omega)

        # At t = 0.0s
        fluid_surf_hei = zo + (2*zeta*(zo/fluid_rad)
                               * ((x/fluid_rad) - (zeta/(2.0*fluid_rad))))

        fluid = gpa_swe(x=x, y=y, h=h, h0=h0, u=u, v=v, vh=vh, name='fluid')

        compute_fluid_elevation([fluid, bed])

        dw = fluid_surf_hei - fluid.b

        rho = dw * rho_w
        rho0 = dw * rho_w
        m = rho * (1.56*dr*dr)

        fluid.m = m
        fluid.rho = rho
        fluid.rho0 = rho0
        fluid.dw = dw

        compute_initial_props([fluid])

        return [fluid, bed]
    def create_particles(self):
        # Fluid
        n = self.n
        r = self.r
        dr = r / n

        d = self.dw0
        hdx = self.hdx

        x = zeros(0)
        y = zeros(0)

        # Create circular patch in a radial grid
        rad = 0.0
        for j in range(1, n + 1):
            npnts = 4 * j
            dtheta = (2 * pi) / npnts

            theta = arange(0, 2 * pi - 1e-10, dtheta)
            rad = rad + dr

            _x = rad * cos(theta)
            _y = rad * sin(theta)

            x = concatenate((x, _x))
            y = concatenate((y, _y))

        m = ones_like(x) * (1.56 * dr * dr) * rho_w * d

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d

        h = ones_like(x) * hdx * dr
        h0 = ones_like(x) * hdx * dr

        fluid = gpa_swe(x=x,
                        y=y,
                        m=m,
                        rho=rho,
                        rho0=rho0,
                        h=h,
                        h0=h0,
                        name='fluid')

        compute_initial_props([fluid])

        # Circular Closed Boundary
        inner_r_wall = self.inner_r_wall
        x, y = mgrid[-1.5 * inner_r_wall:1.5 * inner_r_wall:dr,
                     -1.5 * inner_r_wall:1.5 * inner_r_wall:dr]
        x = x.ravel()
        y = y.ravel()
        idx1 = where(inner_r_wall**2 <= (x**2 + y**2))[0]
        idx2 = where((x**2 + y**2) < (inner_r_wall + self.n_wall * dr)**2)
        idx = intersect1d(idx1, idx2)
        x_cb, y_cb = x[idx], y[idx]

        m_cb = ones_like(x_cb) * (1.56 * dr * dr) * rho_w * d
        h_cb = ones_like(x_cb) * hdx * dr
        rho_cb = ones_like(x_cb) * rho_w * d
        dw_cb = ones_like(x_cb) * d
        cs_cb = sqrt(9.8 * dw_cb)
        alpha_cb = dim * rho_cb

        # Tags wall boundary particles to set virtual depth and ignore
        # artificial viscosity interaction
        is_wall_boun_pa = ones_like(x_cb)

        boundary = gpa_swe(name='boundary',
                           x=x_cb,
                           y=y_cb,
                           m=m_cb,
                           h=h_cb,
                           rho=rho_cb,
                           dw=dw_cb,
                           cs=cs_cb,
                           alpha=alpha_cb,
                           is_wall_boun_pa=is_wall_boun_pa)

        return [fluid, boundary]
    def create_particles(self):
        hdx = self.hdx
        dx1 = self.dx1
        dx2 = self.dx2
        l1 = self.l1
        l2 = self.l2
        tot_l = l1 + l2

        d1 = self.dw01
        d2 = self.dw02

        x = concatenate((arange(0, l1, dx1), arange(l1, tot_l + 1e-4, dx2)),
                        axis=0)

        m = ones_like(x)
        h = ones_like(x)
        h0 = ones_like(x)
        rho = ones_like(x)
        rho0 = ones_like(x)

        # Setting first fluid column properties
        idx_fluid_col_1 = where(x < 1000.0)[0]
        m[idx_fluid_col_1] *= dx1 * rho_w * d1
        h[idx_fluid_col_1] *= hdx * dx1
        h0[idx_fluid_col_1] *= hdx * dx1
        rho[idx_fluid_col_1] *= rho_w * d1
        rho0[idx_fluid_col_1] *= rho_w * d1

        # Setting second fluid column properties
        idx_fluid_col_2 = where(x >= 1000.0)[0]
        m[idx_fluid_col_2] *= dx2 * rho_w * d2
        h[idx_fluid_col_2] *= hdx * dx2
        h0[idx_fluid_col_2] *= hdx * dx2
        rho[idx_fluid_col_2] *= rho_w * d2
        rho0[idx_fluid_col_2] *= rho_w * d2

        fluid = gpa_swe(x=x, m=m, rho=rho, rho0=rho0, h=h, h0=h0, name='fluid')

        # Closed Boundary
        x = concatenate((arange(-2 * dx1, l1,
                                dx1), arange(l1, tot_l + 2 * dx2 + 1e-4, dx2)),
                        axis=0)
        idx_cb_left = where((x < 0))[0]
        idx_cb_right = where((x > 2000))[0]

        m_cb = ones_like(x)
        h_cb = ones_like(x)
        rho_cb = ones_like(x)
        dw_cb = ones_like(x)
        cs_cb = ones_like(x)
        alpha_cb = ones_like(x)

        m_cb[idx_cb_left] *= dx1 * rho_w * d1
        h_cb[idx_cb_left] *= hdx * dx1
        rho_cb[idx_cb_left] *= rho_w * d1
        dw_cb[idx_cb_left] *= d1
        cs_cb[idx_cb_left] *= sqrt(9.8 * dw_cb[idx_cb_left])
        alpha_cb[idx_cb_left] *= dim * rho_cb[idx_cb_left]

        m_cb[idx_cb_right] *= dx2 * rho_w * d2
        h_cb[idx_cb_right] *= hdx * dx2
        rho_cb[idx_cb_right] *= rho_w * d2
        dw_cb[idx_cb_right] *= d2
        cs_cb[idx_cb_right] *= sqrt(9.8 * dw_cb[idx_cb_right])
        alpha_cb[idx_cb_right] *= dim * rho_cb[idx_cb_right]

        boundary = gpa_swe(name='boundary',
                           x=x,
                           m=m_cb,
                           h=h_cb,
                           rho=rho_cb,
                           dw=dw_cb,
                           cs=cs_cb,
                           alpha=alpha_cb)

        idx_to_remove = where((x >= 0) & (x <= 2000))[0]
        boundary.remove_particles(idx_to_remove)

        compute_initial_props([fluid, boundary])
        return [fluid, boundary]
Beispiel #10
0
    def create_particles(self):
        hdx = self.hdx
        dx = self.dx
        d = self.dw0
        w = self.w
        le = self.le
        # Inlet Properties
        x, y = np.mgrid[-self.num_inlet_pa * dx + dx / 2.:0:dx,
                        dx / 2:w - (dx / 4.):dx]
        x, y = (np.ravel(t) for t in (x, y))

        u_inlet = self.u_inlet

        m = ones_like(x) * dx * dx * rho_w * d
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d
        alpha = dim * rho
        cs = sqrt(9.8 * rho / rho_w)

        # Note: Both u and uh must be specified when specifying inlet vel
        u = ones_like(x) * u_inlet
        uh = ones_like(x) * u_inlet

        # Need to specify this to inlet open boundary particle (OBP) because
        # when OBP becomes fluid particle, the fluid particle will have this
        # bottom slope (bx)
        bx = ones_like(x) * -0.001

        inlet = gpa_swe(x=x,
                        y=y,
                        m=m,
                        rho0=rho0,
                        rho=rho,
                        h0=h0,
                        h=h,
                        u=u,
                        uh=uh,
                        alpha=alpha,
                        cs=cs,
                        bx=bx,
                        name='inlet')
        boundary_props = [
            'dw_inner_reimann', 'u_inner_reimann', 'v_inner_reimann',
            'shep_corr'
        ]
        inlet.add_output_arrays(boundary_props)
        inlet.add_property('x0')

        # Fluid Properties
        xf, yf = np.mgrid[0.5 * dx:self.x_max_inlet + le:dx,
                          dx / 2:w - (dx / 4.):dx]
        xf, yf = (np.ravel(t) for t in (xf, yf))
        m = ones_like(xf) * dx * dx * rho_w * d
        h = ones_like(xf) * hdx * dx
        h0 = ones_like(xf) * hdx * dx
        rho = ones_like(xf) * rho_w * d
        rho0 = ones_like(xf) * rho_w * d
        uh = ones_like(xf) * u_inlet
        u = ones_like(xf) * u_inlet
        bx = ones_like(xf) * -0.001
        fluid = gpa_swe(name='fluid',
                        x=xf,
                        y=yf,
                        m=m,
                        rho0=rho0,
                        rho=rho,
                        h=h,
                        bx=bx,
                        h0=h0,
                        uh=uh,
                        u=u)

        # Outlet Properties
        xo, yo = np.mgrid[dx / 2.:self.num_outlet_pa * dx:dx,
                          dx / 2:w - (dx / 4.):dx]
        xo, yo = (np.ravel(t) for t in (xo, yo))
        xo += le
        dw = ones_like(xo) * d
        m = ones_like(xo) * dx * dx * rho_w * d
        h = ones_like(xo) * hdx * dx
        h0 = ones_like(xo) * hdx * dx
        rho = ones_like(xo) * rho_w * d
        rho0 = ones_like(xo) * rho_w * d
        cs = sqrt(9.8 * rho / rho_w)
        alpha = dim * rho
        outlet = gpa_swe(name='outlet',
                         x=xo,
                         y=yo,
                         dw=dw,
                         m=m,
                         rho0=rho0,
                         alpha=alpha,
                         rho=rho,
                         h=h,
                         h0=h0,
                         cs=cs)
        outlet.add_output_arrays(boundary_props)
        outlet.add_property('x0')

        # Bed Properties
        xb, yb = np.mgrid[-5 * dx:le * 1.6 + 5 * dx:dx, 0:w + dx / 2.:dx]
        xb = np.ravel(xb)
        yb = np.ravel(yb)

        Vb = ones_like(xb) * dx * dx
        nb = ones_like(xb) * self.n  # Manning Coefficient
        hb = ones_like(xb) * hdx * dx

        bed = gpa_swe(name='bed', x=xb, y=yb, V=Vb, n=nb, h=hb)

        # Closed Boundary
        xcb_top = np.arange(self.x_min_inlet - 2.0 * dx,
                            self.x_max_outlet * 1.6, dx)
        ycb_top = np.concatenate(
            (ones_like(xcb_top) * (w + 0.5 * dx), ones_like(xcb_top) *
             (w + 1.5 * dx)),
            axis=0)
        xcb_top = np.tile(xcb_top, 2)

        xcb_bottom = np.arange(self.x_min_inlet - 2.0 * dx,
                               self.x_max_outlet * 1.6, dx)
        ycb_bottom = np.concatenate((zeros_like(xcb_bottom) - 0.5 * dx,
                                     zeros_like(xcb_bottom) - 1.5 * dx),
                                    axis=0)
        xcb_bottom = np.tile(xcb_bottom, 2)

        xcb_all = np.concatenate((xcb_top, xcb_bottom), axis=0)
        ycb_all = np.concatenate((ycb_top, ycb_bottom), axis=0)
        m_cb = ones_like(xcb_all) * dx * dx * rho_w * d
        h_cb = ones_like(xcb_all) * hdx * dx
        rho_cb = ones_like(xcb_all) * rho_w * d
        dw_cb = ones_like(xcb_all) * d
        cs_cb = sqrt(9.8 * dw_cb)
        alpha_cb = dim * rho_cb
        u_cb = ones_like(xcb_all) * u_inlet
        is_wall_boun_pa = ones_like(xcb_all)

        boundary = gpa_swe(name='boundary',
                           x=xcb_all,
                           y=ycb_all,
                           m=m_cb,
                           h=h_cb,
                           rho=rho_cb,
                           dw=dw_cb,
                           cs=cs_cb,
                           alpha=alpha_cb,
                           u=u_cb,
                           is_wall_boun_pa=is_wall_boun_pa)
        return [inlet, fluid, outlet, bed, boundary]
Beispiel #11
0
    def create_particles(self):
        # 1D
        hdx = self.hdx
        dx = self.dx
        fluid_surf_hei = self.fluid_surf_hei
        le = self.le

        # Bed
        dxb = 0.25 * dx
        xb = arange(-dx, le + dx + 1e-4, dxb)
        b = zeros_like(xb)
        b[where(xb > self.step_loc)] = self.step_hei

        Vb = ones_like(xb) * dxb
        hb = ones_like(xb) * hdx * dxb

        bed = gpa_swe(name='bed', x=xb, V=Vb, b=b, h=hb)

        # For gradient correction
        len_b = len(bed.x) * 9
        bed.add_constant('m_mat', [0.0] * len_b)

        # Fluid
        x = arange(0, le + 1e-4, dx)
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        fluid = gpa_swe(x=x, h=h, h0=h0, name='fluid')
        compute_fluid_elevation([fluid, bed])

        dw = fluid_surf_hei - fluid.b
        rho = dw * rho_w
        rho0 = dw * rho_w
        m = rho * dx

        fluid.m = m
        fluid.rho = rho
        fluid.rho0 = rho0
        fluid.dw = dw

        compute_initial_props([fluid])

        # Boundary
        x_cb = array([-2 * dx, -dx, 1 + dx, 1 + 2 * dx])
        h_cb = ones_like(x_cb) * hdx * dx
        dw_cb = array([
            fluid_surf_hei, fluid_surf_hei, 0.5 * fluid_surf_hei,
            0.5 * fluid_surf_hei
        ])
        m_cb = ones_like(x_cb) * rho_w * dx * dw_cb
        rho_cb = ones_like(x_cb) * rho_w * dw_cb
        cs_cb = sqrt(9.8 * dw_cb)
        alpha_cb = dim * rho_cb
        no_art_visc = ones_like(x_cb, dtype=int)

        boundary = gpa_swe(name='boundary',
                           x=x_cb,
                           m=m_cb,
                           h=h_cb,
                           rho=rho_cb,
                           dw=dw_cb,
                           cs=cs_cb,
                           alpha=alpha_cb,
                           no_art_visc=no_art_visc)

        return [fluid, bed, boundary]
Beispiel #12
0
    def create_particles(self):
        hdx = self.hdx
        dx = self.dx
        d = self.dw0
        w = self.w
        y_max = w
        l_domain = self.le

        # Inlet Properties
        y = arange(dx / 2, w - (dx / 4.), dx)
        x = zeros_like(y) - 0.5 * dx

        m = ones_like(x) * dx * dx * rho_w * d
        h = ones_like(x) * hdx * dx
        h0 = ones_like(x) * hdx * dx

        # Stores the time-varying depth field imposed at inlet
        dw_at_t = ones_like(x) * d

        rho = ones_like(x) * rho_w * d
        rho0 = ones_like(x) * rho_w * d
        alpha = dim * rho
        cs = sqrt(9.8 * rho / rho_w)

        inlet = gpa_swe(x=x,
                        y=y,
                        m=m,
                        rho0=rho0,
                        rho=rho,
                        h0=h0,
                        h=h,
                        dw_at_t=dw_at_t,
                        alpha=alpha,
                        cs=cs,
                        name='inlet')
        boundary_props = [
            'dw_inner_reimann', 'u_inner_reimann', 'v_inner_reimann',
            'shep_corr'
        ]
        inlet.add_output_arrays(boundary_props)

        # Bed Properties
        bed_fname = os.path.join(self.dir_input_files, 'tsunami_bed.txt.bz2')
        xb, yb, b = loadtxt(bed_fname, delimiter=' ', unpack=True)

        Vb = ones_like(xb) * self.Vb
        nb = ones_like(xb) * self.n  # Manning Coefficient
        hb = ones_like(xb) * self.hb

        bed = gpa_swe(name='bed', x=xb, y=yb, V=Vb, n=nb, h=hb, b=b)
        len_b = len(bed.x) * 9
        bed.add_constant('m_mat', [0.0] * len_b)

        # Fluid Properties
        xf, yf = mgrid[0.5 * dx:self.x_max_inlet + l_domain:dx,
                       dx / 2:y_max - (dx / 4.):dx]
        xf, yf = (ravel(t) for t in (xf, yf))
        h = ones_like(xf) * hdx * dx
        h0 = ones_like(xf) * hdx * dx
        fluid = gpa_swe(name='fluid', x=xf, y=yf, h=h, h0=h0)

        compute_fluid_elevation([fluid, bed])

        fluid_surf_hei = d
        dw = fluid_surf_hei - fluid.b
        rho = dw * rho_w
        rho0 = dw * rho_w
        m = rho * dx**2

        fluid.m = m
        fluid.rho = rho
        fluid.rho0 = rho0
        fluid.dw = dw

        # Removes fluid particles with depth less than d_min
        d_min = 7e-5
        idx = where(fluid.dw < d_min)[0]
        fluid.remove_particles(idx)

        # Closed Boundary
        # Note: 5 layers of wall boundary particles
        xcb_top = arange(self.x_min_inlet - 5 * dx, l_domain + 5 * dx, dx / 2.)
        ycb_top = zeros(0)
        for i in arange(-0.5, 2, 0.5):
            ycb_top = concatenate(
                (ycb_top, ones_like(xcb_top) * (y_max + i * dx)), axis=0)

        xcb_top = concatenate(
            (xcb_top, xcb_top + dx / 4., xcb_top, xcb_top + dx / 4., xcb_top),
            axis=0)

        xcb_bottom = arange(self.x_min_inlet - 5 * dx, l_domain + 5 * dx,
                            dx / 2.)
        ycb_bottom = zeros(0)
        for i in arange(0, -2.5, -0.5):
            ycb_bottom = concatenate(
                (ycb_bottom, zeros_like(xcb_bottom) + i * dx), axis=0)

        xcb_bottom = concatenate((xcb_bottom, xcb_bottom + dx / 4., xcb_bottom,
                                  xcb_bottom + dx / 4., xcb_bottom),
                                 axis=0)

        ycb_right = arange(dx / 4., y_max - (dx / 4.), dx / 2.)
        xcb_right = zeros(0)
        for i in arange(0.5, 3.0, 0.5):
            xcb_right = concatenate(
                (xcb_right, zeros_like(ycb_right) + (l_domain + i * dx)),
                axis=0)

        ycb_right = concatenate((ycb_right, ycb_right + dx / 4., ycb_right,
                                 ycb_right + dx / 4, ycb_right),
                                axis=0)

        xcb_all = concatenate((xcb_top, xcb_bottom, xcb_right), axis=0)
        ycb_all = concatenate((ycb_top, ycb_bottom, ycb_right), axis=0)

        m_cb = ones_like(xcb_all) * dx / 2. * dx / 2. * rho_w * d
        h_cb = ones_like(xcb_all) * hdx * dx / 2.
        rho_cb = ones_like(xcb_all) * rho_w * d
        dw_cb = ones_like(xcb_all) * d
        cs_cb = sqrt(9.8 * dw_cb)
        alpha_cb = dim * rho_cb
        is_wall_boun_pa = ones_like(xcb_all)

        boundary = gpa_swe(name='boundary',
                           x=xcb_all,
                           y=ycb_all,
                           m=m_cb,
                           h=h_cb,
                           rho=rho_cb,
                           dw=dw_cb,
                           cs=cs_cb,
                           is_wall_boun_pa=is_wall_boun_pa,
                           alpha=alpha_cb)

        return [inlet, fluid, bed, boundary]