# SNESCreate
Creates a nonlinear solver context. 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESCreate(MPI_Comm comm, SNES *outsnes)
```
Collective


## Input Parameter

- ***comm -*** MPI communicator



## Output Parameter

- ***outsnes -*** the new SNES context



## Options Database Keys

- ***-snes_mf -*** Activates default matrix-free Jacobian-vector products,
and no preconditioning matrix
- ***-snes_mf_operator -*** Activates default matrix-free Jacobian-vector
products, and a user-provided preconditioning matrix
as set by SNESSetJacobian()
- ***-snes_fd -*** Uses (slow!) finite differences to compute Jacobian





## Developer Notes
`SNES` always creates a `KSP` object even though many `SNES` methods do not use it. This is
unfortunate and should be fixed at some point. The flag snes->usesksp indicates if the
particular method does use `KSP` and regulates if the information about the `KSP` is printed
in `SNESView()`.

`TSSetFromOptions()` does call `SNESSetFromOptions()` which can lead to users being confused
by help messages about meaningless `SNES` options.

`SNES` always creates the snes->kspconvctx even though it is used by only one type. This should
be fixed.


## See Also
 `SNES`, `SNESSolve()`, `SNESDestroy()`, `SNES`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobian()`

## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex1.c.html">src/snes/tutorials/ex1.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex12.c.html">src/snes/tutorials/ex12.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex13.c.html">src/snes/tutorials/ex13.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex14.c.html">src/snes/tutorials/ex14.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex15.c.html">src/snes/tutorials/ex15.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex16.c.html">src/snes/tutorials/ex16.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex17.c.html">src/snes/tutorials/ex17.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex18.c.html">src/snes/tutorials/ex18.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex19.c.html">src/snes/tutorials/ex19.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex1f.F90.html">src/snes/tutorials/ex1f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex2.c.html">src/snes/tutorials/ex2.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/composite/snescomposite.c.html#SNESCreate_Composite">SNESCreate_Composite in src/snes/impls/composite/snescomposite.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/fas/fas.c.html#SNESCreate_FAS">SNESCreate_FAS in src/snes/impls/fas/fas.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/gs/snesgs.c.html#SNESCreate_NGS">SNESCreate_NGS in src/snes/impls/gs/snesgs.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ksponly/ksponly.c.html#SNESCreate_KSPONLY">SNESCreate_KSPONLY in src/snes/impls/ksponly/ksponly.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ksponly/ksponly.c.html#SNESCreate_KSPTRANSPOSEONLY">SNESCreate_KSPTRANSPOSEONLY in src/snes/impls/ksponly/ksponly.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ls/ls.c.html#SNESCreate_NEWTONLS">SNESCreate_NEWTONLS in src/snes/impls/ls/ls.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ms/ms.c.html#SNESCreate_MS">SNESCreate_MS in src/snes/impls/ms/ms.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/multiblock/multiblock.c.html#SNESCreate_Multiblock">SNESCreate_Multiblock in src/snes/impls/multiblock/multiblock.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/nasm/aspin.c.html#SNESCreate_ASPIN">SNESCreate_ASPIN in src/snes/impls/nasm/aspin.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/nasm/nasm.c.html#SNESCreate_NASM">SNESCreate_NASM in src/snes/impls/nasm/nasm.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ncg/snesncg.c.html#SNESCreate_NCG">SNESCreate_NCG in src/snes/impls/ncg/snesncg.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ngmres/anderson.c.html#SNESCreate_Anderson">SNESCreate_Anderson in src/snes/impls/ngmres/anderson.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ngmres/snesngmres.c.html#SNESCreate_NGMRES">SNESCreate_NGMRES in src/snes/impls/ngmres/snesngmres.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/ntrdc/ntrdc.c.html#SNESCreate_NEWTONTRDC">SNESCreate_NEWTONTRDC in src/snes/impls/ntrdc/ntrdc.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/patch/snespatch.c.html#SNESCreate_Patch">SNESCreate_Patch in src/snes/impls/patch/snespatch.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/qn/qn.c.html#SNESCreate_QN">SNESCreate_QN in src/snes/impls/qn/qn.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/richardson/snesrichardson.c.html#SNESCreate_NRichardson">SNESCreate_NRichardson in src/snes/impls/richardson/snesrichardson.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/shell/snesshell.c.html#SNESCreate_Shell">SNESCreate_Shell in src/snes/impls/shell/snesshell.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/tr/tr.c.html#SNESCreate_NEWTONTR">SNESCreate_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#SNESCreate_VINEWTONRSLS">SNESCreate_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#SNESCreate_VINEWTONSSLS">SNESCreate_VINEWTONSSLS in src/snes/impls/vi/ss/viss.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)  
