How to use the slepc4py.SLEPc.EPS.ProblemType function in slepc4py

To help you get started, we’ve selected a few slepc4py examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anstmichaels / emopt / emopt / modes.py View on Github external
def solve(self):
        """Solve for the modes of the structure.

        In addition to solving for the modes, this function saves the results
        to the master node so that they can be easily retrieved for
        visualization, etc.

        Notes
        -----
        This function is run on all nodes.
        """
        self._solver.setOperators(self._A, self._B)
        self._solver.setProblemType(SLEPc.EPS.ProblemType.GNHEP)
        self._solver.setDimensions(self.neigs, PETSc.DECIDE)
        self._solver.setTarget(self.n0)
        self._solver.setFromOptions()

        self._solver.solve()
        nconv = self._solver.getConverged()

        if(nconv < self.neigs):
            warning_message('%d eigenmodes were requested, however only %d ' \
                            'eigenmodes were found.' % (self.neigs, nconv), \
                            module='emopt.modes')

        # nconv can be bigger than the desired number of eigen values
        if(nconv > self.neigs):
            neigs = self.neigs
        else: