SNESSetNGS — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# SNESSetNGS

Sets the user nonlinear Gauss-Seidel routine for use with composed nonlinear solvers.

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESSetNGS(SNES snes, SNESNGSFn *f, void *ctx)

## Input Parameters

- snes - the `SNES` context, usually of the `SNESType` `SNESNGS`

- f - function evaluation routine to apply Gauss-Seidel, see `SNESNGSFn` for calling sequence

- ctx - [optional] user-defined context for private data for the smoother evaluation routine (may be `NULL`)

## Note

The `SNESNGS` routines are used by the composed nonlinear solver to generate a problem appropriate update to the solution, particularly `SNESFAS`.

## See Also

SNES: Nonlinear Solvers, `SNESNGS`, `SNESGetNGS()`, `SNESNCG`, `SNESGetFunction()`, `SNESComputeNGS()`, `SNESNGSFn`

## Level

intermediate

## Location

src/snes/interface/snes.c

## Examples

src/snes/tutorials/ex55.c
src/snes/tutorials/ex15.c
src/snes/tutorials/ex5.c
src/snes/tutorials/ex19.c

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