PETSc version 3.15.5
Fix/Edit manual page

# SNESCreate

Creates a nonlinear solver context.

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode  SNESCreate(MPI_Comm comm,SNES *outsnes)

Collective

### Input Parameters

| 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

SNESSolve(), SNESDestroy(), SNES, SNESSetLagPreconditioner(), SNESSetLagJacobian()

### Level

beginner

### Location

src/snes/interface/snes.c

### Examples

src/snes/tutorials/ex1.c.html
src/snes/tutorials/ex2.c.html
src/snes/tutorials/ex3.c.html
src/snes/tutorials/ex5.c.html
src/snes/tutorials/ex6.c.html
src/snes/tutorials/ex9.c.html
src/snes/tutorials/ex12.c.html
src/snes/tutorials/ex14.c.html
src/snes/tutorials/ex15.c.html
src/snes/tutorials/ex17.c.html
src/snes/tutorials/ex18.c.html

### 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_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
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages