PETSc version 3.17.4
Fix/Edit manual page

# SNESSetPicard

Use SNES to solve the system A(x) x = bp(x) + b via a Picard type iteration (Picard linearization)

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode  SNESSetPicard(SNES snes,Vec r,PetscErrorCode (*bp)(SNES,Vec,Vec,void*),Mat Amat, Mat Pmat, PetscErrorCode (*J)(SNES,Vec,Mat,Mat,void*),void *ctx)

Logically Collective on SNES

### Input Parameters

| snes | - the SNES context
| r | - vector to store function values, may be NULL
| bp | - function evaluation routine, may be NULL
| Amat | - matrix with which A(x) x - bp(x) - b is to be computed
| Pmat | - matrix from which preconditioner is computed (usually the same as Amat)
| J | - function to compute matrix values, see SNESJacobianFunction() for details on its calling sequence
| ctx | - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

### Notes

It is often better to provide the nonlinear function F() and some approximation to its Jacobian directly and use an approximate Newton solver. This interface is provided to allow porting/testing a previous Picard based code in PETSc before converting it to approximate Newton.

One can call SNESSetPicard() or SNESSetFunction() (and possibly SNESSetJacobian()) but cannot call both

        Solves the equation A(x) x = bp(x) - b via the defect correction algorithm A(x^{n}) (x^{n+1} - x^{n}) = bp(x^{n}) + b - A(x^{n})x^{n}

        Note that when an exact solver is used this corresponds to the "classic" Picard A(x^{n}) x^{n+1} = bp(x^{n}) + b iteration.

Run with -snes_mf_operator to solve the system with Newton's method using A(x^{n}) to construct the preconditioner.

We implement the defect correction form of the Picard iteration because it converges much more generally when inexact linear solvers are used then the direct Picard iteration A(x^n) x^{n+1} = bp(x^n) + b

There is some controversity over the definition of a Picard iteration for nonlinear systems but almost everyone agrees that it involves a linear solve and some believe it is the iteration A(x^{n}) x^{n+1} = b(x^{n}) hence we use the name Picard. If anyone has an authoritative reference that defines the Picard iteration different please contact us at petsc-dev@mcs.anl.gov and we'll have an entirely new argument :-).

When used with -snes_mf_operator this will run matrix-free Newton's method where the matrix-vector product is of the true Jacobian of A(x)x - bp(x) -b.

When used with -snes_fd this will compute the true Jacobian (very slowly one column at at time) and thus represent Newton's method.

When used with -snes_fd_coloring this will compute the Jacobian via coloring and thus represent a faster implementation of Newton's method. But the the nonzero structure of the Jacobian is, in general larger than that of the Picard matrix A so you must provide in A the needed nonzero structure for the correct coloring. When using DMDA this may mean creating the matrix A with DMCreateMatrix() using a wider stencil than strictly needed for A or with a DMDA_STENCIL_BOX. See the commment in src/snes/tutorials/ex15.c.

### See Also

SNESGetFunction(), SNESSetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESGetPicard(), SNESLineSearchPreCheckPicard(), SNESJacobianFunction

### Level

intermediate

### Location

src/snes/interface/snes.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages