示例#1
0
def DisplayCellQual(meshtype='tet'):
    """
    Displays minimum scaled jacobian of a sample mesh

    For an ANSYS analysis to run properly, the minimum scaled jacobian of each
    cell must be greater than 0.

    Parameters
    ----------
    meshtype string, optional
        Set to 'hex' to display cell quality of a hexahedral meshed beam.

    """

    # load archive file and parse for subsequent FEM queries
    if meshtype == 'hex':
        archive = pyansys.ReadArchive(hexarchivefile)
    else:
        archive = pyansys.ReadArchive(tetarchivefile)

    # create vtk object
    grid = archive.ParseVTK()

    # get cell quality
    qual = pyansys.CellQuality(grid)

    # plot cell quality
    grid.Plot(scalars=qual, stitle='Cell Minimum Scaled\nJacobian', rng=[0, 1])
示例#2
0
def show_cell_qual(meshtype='tet', off_screen=None):
    """Displays minimum scaled jacobian of a sample mesh

    For an ANSYS analysis to run properly, the minimum scaled Jacobian
    of each cell must be greater than 0.

    Parameters
    ----------
    meshtype string, optional
        Set to 'hex' to display cell quality of a hexahedral meshed beam.

    """

    # load archive file and parse for subsequent FEM queries
    if meshtype == 'hex':
        archive = pyansys.Archive(hexarchivefile)
    else:
        archive = pyansys.Archive(tetarchivefile)

    # create vtk object
    grid = archive.parse_vtk()

    # get cell quality
    qual = pyansys.CellQuality(grid)
    assert np.all(qual > 0)

    # plot cell quality
    grid.plot(scalars=qual, stitle='Cell Minimum Scaled\nJacobian', cmap='bwr',
              show_edges=True,
              rng=[0, 1], flip_scalars=True, off_screen=off_screen)
示例#3
0
    def quality(self):
        """
        Returns cell quality using PyANSYS. Computes the minimum scaled
        jacobian of each cell.  Cells that have values below 0 are invalid for
        a finite element analysis.

        Note
        ----
        This casts the input to an unstructured grid

        Returns
        -------
        cellquality : np.ndarray
            Minimum scaled jacobian of each cell.  Ranges from -1 to 1.

        Notes
        -----
        Requires pyansys to be installed.

        """
        try:
            import pyansys
        except:
            raise Exception('Install pyansys for this function')
        if not isinstance(self, pyvista.UnstructuredGrid):
            dataset = self.cast_to_unstructured_grid()
        else:
            dataset = self
        return pyansys.CellQuality(dataset)
示例#4
0
    def CellQuality(self):
        """
        Computes the minimum scaled jacobian of each cell.  Cells that have
        values below 0 are invalid for a finite element analysis.

        Returns
        -------
        cellquality : np.ndarray
            Minimum scaled jacobian of each cell.  Ranges from -1 to 1.

        Notes
        -----
        Requires pyansys to be installed.
        """
        try:
            import pyansys
        except:
            raise Exception('Install pyansys for this function')

        return pyansys.CellQuality(self)