Skip to main content
`Ctrl`+`K`

# SNESConvergedDefault

Default convergence test for `SNESSolve()`.

## Synopsis

    #include "petsc/private/snesimpl.h"
    PetscErrorCode SNESConvergedDefault(SNES snes, PetscInt it, PetscReal xnorm, PetscReal snorm, PetscReal fnorm, SNESConvergedReason *reason, void *dummy)

Collective

## Input Parameters

- snes - the `SNES` context

- it - the iteration (0 indicates before any Newton steps)

- xnorm - 2-norm of current iterate

- snorm - 2-norm of current step

- fnorm - 2-norm of function at current iterate

- dummy - unused context

## Output Parameter

- reason - converged reason, see `SNESConvergedReason`

## Options Database Keys

- -snes_convergence_test default - see `SNESSetFromOptions()`

- -snes_stol - convergence tolerance in terms of the norm of the change in the solution between steps

- -snes_atol <abstol> - absolute tolerance of residual norm

- -snes_rtol <rtol> - relative decrease in tolerance norm from the initial 2-norm of the solution

- -snes_divergence_tolerance <divtol> - if the residual goes above divtol*rnorm0, exit with divergence

- -snes_max_funcs <max_funcs> - maximum number of function evaluations, use `unlimited` for no maximum

- -snes_max_fail <max_fail> - maximum number of line search failures allowed before stopping, default is none

- -snes_max_linear_solve_fail - number of linear solver failures before `SNESSolve()` stops

## Notes

This routine is not generally called directly. It is set with `SNESSetConvergenceTest()` automatically before the `SNESSolve()`.

It can be called within a custom convergence test that should also apply the standard convergence tests

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESSolve()`, `SNESSetConvergenceTest()`, `SNESConvergedSkip()`, `SNESSetTolerances()`, `SNESSetDivergenceTolerance()`, `SNESConvergedReason`

## Level

developer

## Location

src/snes/interface/snesut.c

## Examples

src/snes/tutorials/ex69.c
src/snes/tutorials/ex30.c

## Implementations

SNESConvergedDefault_VI() in src/snes/impls/vi/vi.c

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