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#

SNES: Nonlinear Solvers, SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian()

Level#

beginner

Location#

src/snes/interface/snes.c

Examples#

src/snes/tutorials/ex26.c
src/snes/tutorials/ex55.c
src/ts/tutorials/ex30.c
src/tao/tutorials/ex2.c
src/tao/tutorials/ex1.c
src/snes/tutorials/ex69.c
src/snes/tutorials/ex48.c
src/snes/tutorials/ex35.c
src/snes/tutorials/ex24.c
src/snes/tutorials/ex77.c

Implementations#

SNESCreate_NEWTONAL() in src/snes/impls/al/al.c
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


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