SNESSetUp — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# SNESSetUp

Sets up the internal data structures for the later use of a nonlinear solver.

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESSetUp(SNES snes)

Collective

## Input Parameter

- snes - the `SNES` context

## Note

For basic use of the `SNES` solvers the user need not explicitly call `SNESSetUp()`, since these actions will automatically occur during the call to `SNESSolve()`. However, if one wishes to control this phase separately, `SNESSetUp()` should be called after `SNESCreate()` and optional routines of the form SNESSetXXX(), but before `SNESSolve()`.

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESCreate()`, `SNESSolve()`, `SNESDestroy()`

## Level

advanced

## Location

src/snes/interface/snes.c

## Examples

src/ts/tutorials/ex30.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex69.c

## Implementations

SNESSetUp_Composite() in src/snes/impls/composite/snescomposite.c
SNESSetUp_FAS() in src/snes/impls/fas/fas.c
SNESSetUp_NGS() in src/snes/impls/gs/snesgs.c
SNESSetUp_KSPONLY() in src/snes/impls/ksponly/ksponly.c
SNESSetUp_NEWTONLS() in src/snes/impls/ls/ls.c
SNESSetUp_MS() in src/snes/impls/ms/ms.c
SNESSetUp_Multiblock() in src/snes/impls/multiblock/multiblock.c
SNESSetUp_NASM() in src/snes/impls/nasm/nasm.c
SNESSetUp_NCG() in src/snes/impls/ncg/snesncg.c
SNESSetUp_NGMRES() in src/snes/impls/ngmres/snesngmres.c
SNESSetUp_NEWTONTRDC() in src/snes/impls/ntrdc/ntrdc.c
SNESSetUp_Patch() in src/snes/impls/patch/snespatch.c
SNESSetUp_QN() in src/snes/impls/qn/qn.c
SNESSetUp_NRichardson() in src/snes/impls/richardson/snesrichardson.c
SNESSetUp_Shell() in src/snes/impls/shell/snesshell.c
SNESSetUp_NEWTONTR() in src/snes/impls/tr/tr.c
SNESSetUp_VINEWTONRSLS() in src/snes/impls/vi/rs/virs.c
SNESSetUp_VINEWTONSSLS() in src/snes/impls/vi/ss/viss.c
SNESSetUp_VI() in src/snes/impls/vi/vi.c

Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages