[petsc-users] using preconditioner with SLEPc
Matthew Knepley
knepley at gmail.com
Mon Feb 8 07:22:42 CST 2021
On Mon, Feb 8, 2021 at 7:04 AM Florian Bruckner <e0425375 at gmail.com> wrote:
> Dear PETSc / SLEPc Users,
>
> my question is very similar to the one posted here:
> https://lists.mcs.anl.gov/pipermail/petsc-users/2018-August/035878.html
>
> The eigensystem I would like to solve looks like:
> B0 v = 1/omega A0 v
> B0 and A0 are both hermitian, A0 is positive definite, but only given as a
> linear operator (matshell). I am looking for the largest eigenvalues
> (=smallest omega).
>
> I also have a sparse approximation P0 of the A0 operator, which i would
> like to use as precondtioner, using something like this:
>
> es = SLEPc.EPS().create(comm=fd.COMM_WORLD)
> st = es.getST()
> ksp = st.getKSP()
> ksp.setOperators(self.A0, self.P0)
>
> Unfortunately PETSc still complains that it cannot create a preconditioner
> for a type 'python' matrix although P0.type == 'seqaij' (but A0.type ==
> 'python').
> By the way, should P0 be an approximation of A0 or does it have to include
> B0?
>
> Right now I am using the krylov-schur method. Are there any alternatives
> if A0 is only given as an operator?
>
Jose can correct me if I say something wrong.
When I did this, I made a shell operator for the action of A0^{-1} B0 which
has a KSPSolve() in it, so you can use your P0 preconditioning matrix, and
then handed that to EPS. You can see me do it here:
https://gitlab.com/knepley/bamg/-/blob/master/src/coarse/bamgCoarseSpace.c#L123
I had a hard time getting the embedded solver to work the way I wanted, but
maybe that is the better way.
Thanks,
Matt
> thanks for any advice
> best wishes
> Florian
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210208/e18f59cf/attachment.html>
More information about the petsc-users
mailing list