# SNESSetUp
Sets up the internal data structures for the later use of a nonlinear solver. 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESSetUp(SNES snes)
```
Collective on snes


## Input Parameters

- ***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`, `SNESCreate()`, `SNESSolve()`, `SNESDestroy()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snes.c.html#SNESSetUp">src/snes/interface/snes.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex62.c.html">src/snes/tutorials/ex62.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex69.c.html">src/snes/tutorials/ex69.c.html</A><BR>

## Implementations

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


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)


[Index of all SNES routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
