예제 #1
0
    def _get_boundary_elems(self):
        #
        # boundary elements are defined as cells that are
        # contain both positive and negative values of the level set function
        # and are crossed with the domain boundary.
        #
        b_elems_grid = logical_and(nfabs(self.bls_elem_grid) < 4,
                                   nfabs(self.ls_elem_grid) < 4)

        return self._get_elems_from_elem_grid(b_elems_grid)
예제 #2
0
    def _get_boundary_elems(self):
        #
        # boundary elements are defined as cells that are
        # contain both positive and negative values of the level set function
        # and are crossed with the domain boundary.
        #
        b_elems_grid = logical_and(
            nfabs(self.bls_elem_grid) < 4,
            nfabs(self.ls_elem_grid) < 4)

        return self._get_elems_from_elem_grid(b_elems_grid)
예제 #3
0
    def __call__(self, points):
        '''Return the global coordinates of the supplied local points.
        '''

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1
        # xi, yi, zi = points[:,0], points[:,1], points[:,2]

        X = points[:, 0]

        dist = X - self.C

        R = X[1] - X[0]

        c = 0.1

        alpha = c + (1 - c) / R * dist

        Xn = X - sign(dist) * alpha * dist

        X_idx = where(nfabs(dist) > self.R)[0]
        Xn[X_idx] = X[X_idx]

        p = copy(points)
        p[:, 0] = Xn
        return points
예제 #4
0
    def _get_ls_mask(self):

        # make the intersection
        #
        # Three conditions must be fulfilled:
        # 1) The absolute value of the level summation on the element is less than
        # the number of the corner nodes
        #
        # 2) At least one value of the boundary level set must be positive within the element
        # i.e. the sum within the element is greater than -(number of corner nodes)
        #
        # 3) The element must be valid also in the parent grid
        #
        # True - are the masked elements, False are the active elements
        #
        ls_mask = logical_and(
            nfabs(self.ls_edge_sum_grid) < 4,
            self.bls_edge_sum_grid > -4) == False

        if isinstance(self.fe_grid, FEGrid):
            n_grid_elems = self.fe_grid.n_grid_elems
            parent_ls_mask = repeat(False,
                                    n_grid_elems).reshape(self.fe_grid.shape)
        else:
            parent_ls_mask = self.fe_grid.ls_mask

        return logical_or(parent_ls_mask, ls_mask)
예제 #5
0
    def __call__(self, points):
        """Return the global coordinates of the supplied local points.
        """

        # number of local grid points for each coordinate direction
        # values must range between 0 and 1
        # xi, yi, zi = points[:,0], points[:,1], points[:,2]

        X = points[:, 0]

        dist = X - self.C

        R = X[1] - X[0]

        c = 0.1

        alpha = c + (1 - c) / R * dist

        Xn = X - sign(dist) * alpha * dist

        X_idx = where(nfabs(dist) > self.R)[0]
        Xn[X_idx] = X[X_idx]

        p = copy(points)
        p[:, 0] = Xn
        return points
예제 #6
0
    def _get_ls_mask(self):

        # make the intersection
        #
        # Three conditions must be fulfilled:
        # 1) The absolute value of the level summation on the element is less than
        # the number of the corner nodes
        #
        # 2) At least one value of the boundary level set must be positive within the element
        # i.e. the sum within the element is greater than -(number of corner nodes)
        #
        # 3) The element must be valid also in the parent grid
        #
        # True - are the masked elements, False are the active elements
        #
        ls_mask = logical_and(nfabs(self.ls_edge_sum_grid) < 4,
                              self.bls_edge_sum_grid > -4) == False

        if isinstance(self.fe_grid, FEGrid):
            n_grid_elems = self.fe_grid.n_grid_elems
            parent_ls_mask = repeat(
                False, n_grid_elems).reshape(self.fe_grid.shape)
        else:
            parent_ls_mask = self.fe_grid.ls_mask

        return logical_or(parent_ls_mask, ls_mask)
예제 #7
0
    def _get_interior_elems(self):

        # evaluate the boundary operator - with a result boolean array
        # in the corner nodes.
        #
        b_elem_grid = self.bls_elem_grid

        ls_elem_grid = self.ls_elem_grid

        # make the intersection
        #
        elem_grid = logical_and(nfabs(ls_elem_grid) < 4, b_elem_grid == 4)

        return self._get_elems_from_elem_grid(elem_grid)
예제 #8
0
    def _get_interior_elems(self):

        # evaluate the boundary operator - with a result boolean array
        # in the corner nodes.
        #
        b_elem_grid = self.bls_elem_grid

        ls_elem_grid = self.ls_elem_grid

        # make the intersection
        #
        elem_grid = logical_and(nfabs(ls_elem_grid) < 4, b_elem_grid == 4)

        return self._get_elems_from_elem_grid(elem_grid)