This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

slepceigensolver preconditioner error

+1 vote

I want to use the slepceigensolver for a matrix from scipy, but i get the following error
PC has not been set up so information may be incomplete
Redundant preconditioner: Not yet setup

Here is my code

        if not has_slepc():
        raise ValueError('FeNICS has no SLEPC support use scipy strategy')

    from petsc4py import PETSc
    self.fullA = self.fullA.tocsr()
    self.fullE = self.fullE.tocsc()


    fullApetsc = PETSc.Mat().createAIJ(size=self.fullA.shape, csr=(self.fullA.indptr, self.fullA.indices, self.fullA.data))
    fullEpetsc = PETSc.Mat().createAIJ(size=self.fullE.shape, csr=(self.fullE.indptr, self.fullE.indices, self.fullE.data))
    fullApetscdolfin = PETScMatrix(fullApetsc)
    fullEpetscdolfin = PETScMatrix(fullEpetsc)

    eigensolver = SLEPcEigenSolver(fullApetscdolfin, fullEpetscdolfin)
    eigensolver.parameters["spectrum"] = "largest real"
    #eigensolver.parameters["solver"] = "subspace"
    eigensolver.parameters["tolerance"] = 1e-13
    eigensolver.parameters["maximum_iterations"] = 10000
    eigensolver.parameters["problem_type"] = "pos_gen_non_hermitian"
    eigensolver.parameters["verbose"] = True

    # first tow desired eigenvalues
    eigensolver.solve(2)
    import ipdb
    ipdb.set_trace()
    a = 2
    eigensolver.get_eigenpair(0)

Is it possible to add a preconditioner?

For furhter Information my System comes up from linearized navier stokes equation around a steady state solution.
My fullA Matrix looks like [A,G;G^T,0] and fullE like [M,0;0,0] where M is positive semidefinite.

asked Apr 14, 2015 by maxb90 FEniCS Novice (770 points)
edited Apr 14, 2015 by maxb90

Hi, the matrices should be assembled. See what happens after

fullApetsc = PETSc.Mat().createAIJ(...)
fullEpetsc = PETSc.Mat().createAIJ(...)

# Make usable
fullApetsc.assemble()
fullEpetsc.assemble()

fullApetscdolfin = PETScMatrix(fullApetsc)
fullEpetscdolfin = PETScMatrix(fullEpetsc)

Hi that did not work,
i ended up with access eps structure and setting parameters

    eps = eigensolver.eps()
    st = eps.getST()
    ksp = st.getKSP()
    ksp.setType("preonly")
    pc = ksp.getPC()
    pc.setType("lu")
    pc.setFactorSolverPackage("mumps")

like in http://fenicsproject.org/qa/6140/set-petsc-solver-package-for-slepceigensolver-object-python?show=6140#q6140

...