[petsc-users] ksppreonly question

Jed Brown jedbrown at mcs.anl.gov
Sat Sep 22 00:42:48 CDT 2012


On Sat, Sep 22, 2012 at 12:33 AM, Shao-Ching Huang <huangsc at gmail.com>wrote:

> Is this equivalent to setting up a SNES where the (constant) Jacobian
> is my A1 matrix, similar to ex35.c in the snes directory (despite with
> different PC type)?
>

Sure, make your residual function

F(x) = A x - b

and "Jacobian"

J = A1

This is the defect correction version of your algorithm. You can make it
better by bringing in the concept of orthogonality/spectral adaptivity
either in via -snes_type ngmres or, recognizing that this system is linear,
by making the operator A available to the linear solver. You can do that by
(a) -snes_mf_operator which will finite difference F to compute the action
or (b) by filling the first Jacobian slot in the SNES compute Jacobian
callback with a MATSHELL that applies the entire A. I would start with (a)
because it is simpler, especially if your underlying problem is nonlinear.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120922/fec8a724/attachment.html>


More information about the petsc-users mailing list