[petsc-users] KSPGMRES preconditioned with a MATSHELL

Matthew Knepley knepley at gmail.com
Fri Oct 14 05:26:44 CDT 2011


On Fri, Oct 14, 2011 at 2:42 AM, Thomas Leissing <thomas.leissing at cstb.fr>wrote:

> **
> Dear all,
>
> I need to solve a system of equation Ax = b in which A is a MatShell object
> for which I defined a matrix-vector multiplication routine with
> MatShellSetOperation. Let's call this routine MyMatMult. The MyMatMult
> routine gives me an approximate matrix vector product, and I'm able to tune
> the parameters of MyMatMult so that I can choose a trade-off between
> calculation time and accuracy of the product. I successfully solved this
> problem with a KSPGMRES solver.
> So far so good...
>
> Now I'd like to precondition the system to accelerate the solving stage. To
> do this I'd like to use a lower-order (less accurate but faster) solution of
> Ax=b.
>
> I tried to do this with a PCKSP type preconditioner, but it doesn't seem to
> accept MatShell objects as preconditioning matrix.
>

Could you send the error message?


> I also tried to use a PCSHELL preconditioner for which the PCApply routine
> consists in solving the lower order Ax=b system.
>
> I didn't manage to get this working properly: the outer solver doesn't
> converge to the expected rate. Indeed if I use for the inner loop the same
> accuracy than for the outer loop, the outer loop should converge in one
> iteration, which is not the case...
>
> Is there another way of doing this ?
>

What we normally do is explicitly construct the low-order matrix. Then you
can just pass it as the second Mat argument to
KSPSetOperators(). The PC is built using that Mat, instead of the system Mat
which is a MATSHELL.

  Thanks,

      Matt


> Any hint ?
>
> Thanks for your help,
> Thomas Leissing
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111014/67efc852/attachment.htm>


More information about the petsc-users mailing list