# [SciPy-User] preconditioner for GMRES

Joshua Stults joshua.stults@gmail....
Mon Mar 29 17:19:24 CDT 2010

```On Mon, Mar 29, 2010 at 4:54 PM, Darcoux Christine <bouloumag@gmail.com> wrote:
> I am developping a Jacobian-Free Newton-Krylov code to solve the Navier
> Stokes equations. In this code, the product of the Jacobian matrix with a
> given vector is represented by the matvec method of a "LinearOperator"
> object. The scipy.sparse.linalg.isolve.gmres method can takes an optional
> preconditioner as parameter which is either an object "LinearOperator" or a
> matrix. However, the scipy documentation does not explain how one can form
> this preconditioner in a (ideally) matrix-free manner given only the matvec
> method of the jacobian.
>
> Any suggestions on this would be very appreciated.
>

A pretty straight-forward way to precondition these types of problems
in a matrix-free way is with symmetric successive over relaxation (the
symmetric part is important, you need to do a 'forward' and a
'backward' sweep or things won't converge):
http://www.netlib.org/linalg/old_html_templates/subsection2.6.2.4.html

You'll have to derive the update formulas yourself based on the type
of discretization you are using;  if you are using a transform based
method, then you can still precondition based on a low-order scheme.
IIRC Boyd has a pretty decent discussion of this in his spectral
methods book.

Maybe you could construct one of the approximate factorization
preconditioners using only the matvec of your Jacobian, but I've never
gone with this approach, maybe someone else could chime in with
recommendations along those lines?
http://www.netlib.org/linalg/old_html_templates/chapter2.7.html

What sort of spatial discretization are you using?

> Thanks,
>
> Christine
>

HtH,
--
Joshua Stults
Website: http://j-stults.blogspot.com
```