:orphan:
# SNESCreate
Creates a nonlinear solver context used to manage a set of nonlinear solves
## 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_coloring -*** uses a relative fast computation of the Jacobian using finite differences and a graph coloring
- ***-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
[](ch_snes), `SNES`, `SNESSolve()`, `SNESDestroy()`, `SNES`, `SNESSetLagPreconditioner()`, `SNESSetLagJacobian()`
## Level
beginner
## Location
src/snes/interface/snes.c
## Examples
src/snes/tutorials/ex1.c
src/snes/tutorials/ex12.c
src/snes/tutorials/ex13.c
src/snes/tutorials/ex14.c
src/snes/tutorials/ex15.c
src/snes/tutorials/ex16.c
src/snes/tutorials/ex17.c
src/snes/tutorials/ex18.c
src/snes/tutorials/ex19.c
src/snes/tutorials/ex1f.F90
src/snes/tutorials/ex2.c
## Implementations
SNESCreate_Composite in src/snes/impls/composite/snescomposite.c
SNESCreate_FAS in src/snes/impls/fas/fas.c
SNESCreate_NGS in src/snes/impls/gs/snesgs.c
SNESCreate_KSPONLY in src/snes/impls/ksponly/ksponly.c
SNESCreate_KSPTRANSPOSEONLY in src/snes/impls/ksponly/ksponly.c
SNESCreate_NEWTONLS in src/snes/impls/ls/ls.c
SNESCreate_MS in src/snes/impls/ms/ms.c
SNESCreate_Multiblock in src/snes/impls/multiblock/multiblock.c
SNESCreate_ASPIN in src/snes/impls/nasm/aspin.c
SNESCreate_NASM in src/snes/impls/nasm/nasm.c
SNESCreate_NCG in src/snes/impls/ncg/snesncg.c
SNESCreate_Anderson in src/snes/impls/ngmres/anderson.c
SNESCreate_NGMRES in src/snes/impls/ngmres/snesngmres.c
SNESCreate_NEWTONTRDC in src/snes/impls/ntrdc/ntrdc.c
SNESCreate_Patch in src/snes/impls/patch/snespatch.c
SNESCreate_QN in src/snes/impls/qn/qn.c
SNESCreate_NRichardson in src/snes/impls/richardson/snesrichardson.c
SNESCreate_Shell in src/snes/impls/shell/snesshell.c
SNESCreate_NEWTONTR in src/snes/impls/tr/tr.c
SNESCreate_VINEWTONRSLS in src/snes/impls/vi/rs/virs.c
SNESCreate_VINEWTONSSLS in src/snes/impls/vi/ss/viss.c
---
[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](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)