How to use the slepc4py.init 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 jcmgray / quimb / quimb / linalg / slepc_linalg.py View on Github external
def init_petsc_slepc(self, comm):
        import os
        petsc_arch = os.environ.get("PETSC_ARCH", None)

        import petsc4py
        petsc4py.init(args=['-no_signal_handler'], arch=petsc_arch, comm=comm)
        import slepc4py
        slepc4py.init(args=['-no_signal_handler'], arch=petsc_arch)

        self._comm = comm
        self._PETSc = petsc4py.PETSc
        self._SLEPc = slepc4py.SLEPc
github sfepy / sfepy / sfepy / solvers / eigen.py View on Github external
def init_slepc_args():
    try:
        import sys, slepc4py

    except ImportError:
        return

    argv = [arg for arg in sys.argv if arg not in ['-h', '--help']]
    slepc4py.init(argv)
github anstmichaels / emopt / emopt / modes.py View on Github external
conjunction with :class:`emopt.fdfd.FDFD` to simulated waveguide structures
which are particularly interesting for applications in silicon photonics, etc.

References
----------
[1] A. B. Fallahkhair, K. S. Li and T. E. Murphy, "Vector Finite Difference
Modesolver for Anisotropic Dielectric Waveguides", J. Lightwave Technol. 26(11),
1423-1431, (2008).
"""
from __future__ import absolute_import
# Initialize petsc first
from builtins import range
from builtins import object
import sys, slepc4py
from future.utils import with_metaclass
slepc4py.init(sys.argv)

from .defs import FieldComponent
from .misc import info_message, warning_message, error_message, \
NOT_PARALLEL, run_on_master, MathDummy

from . import grid

from abc import ABCMeta, abstractmethod
from petsc4py import PETSc
from slepc4py import SLEPc
from mpi4py import MPI
import numpy as np

__author__ = "Andrew Michaels"
__license__ = "GPL License, Version 3.0"
__version__ = "2019.5.6"
github chaitan3 / adFVM / adFVM / matop_petsc.py View on Github external
def eigenvalues(self):
        import slepc4py
        slepc4py.init()
        from slepc4py import SLEPc
        E = SLEPc.EPS(); E.create()

        E.setOperators(self.A)
        E.setProblemType(SLEPc.EPS.ProblemType.NHEP)
        E.setDimensions(1)
        E.setWhichEigenpairs(SLEPc.EPS.Which.SMALLEST_REAL)
        E.setFromOptions()
        E.solve()
        n = E.getConverged()
        for i in range(0, n):
            print(E.getEigenvalue(0))
        return