[petsc-users] Using external matrix as ILU preconditioner

Mark Adams mfadams at lbl.gov
Fri Aug 6 08:02:56 CDT 2021


PCSHELL is for adding your own preconditioner method (mat->ops->solve).
Pmat is the matrix that you want the PC to use to compute the
preconditioner.
This is usually the same as Amat, the matrix that you want to use to apply
the operator, but if you want to use say a matrix-free Amat, then you need
to provide some sort of explicit matrix approximation of Amat for most
preconditioners.
If you have a matrix that is an approximation of the inverse of Amat that
you simply want to apply then you would need to make a PCSHELL with a
method that does that.
Mark

On Fri, Aug 6, 2021 at 8:51 AM Milan Pelletier via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Dear PETSc users,
>
> I would like to know if it is possible to provide PETSc with a
> ILU-preconditioner matrix computed externally beforehand.
> I tried and built a PCSHELL, to which I pass the externally-computed
> preconditioner matrix as "Pmat" using the KSPSetOperators function. Then I
> wanted to use that Pmat in PCApply by calling MatSolve as it seems to be
> done in the ILU case. Though, this fails since the mat->ops->solve (with
> mat being my PC Matrix) is a null pointer.
>
> I guess the way I set the matrix (as a MATSEQAIJ) is not sufficient for
> PETSc to know what function to use as MatSolve.
>
> How could I achieve providing my own ILU-decomposed matrix and feed
> PETSc's PCG with it? Is it actually possible?
>
> Thanks for your help,
>
> Milan Pelletier
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210806/b4f15f86/attachment.html>


More information about the petsc-users mailing list