Skip to main content
`Ctrl`+`K`

# SNESSetTolerances

Sets various parameters used in `SNES` convergence tests.

## Synopsis

    #include "petscsnes.h"
    #include "petscsnes.h"
    PetscErrorCode SNESSetTolerances(SNES snes, PetscReal abstol, PetscReal rtol, PetscReal stol, PetscInt maxit, PetscInt maxf)

Logically Collective

## Input Parameters

- snes - the `SNES` context

- abstol - the absolute convergence tolerance, \( F(x^n) \le abstol \)

- rtol - the relative convergence tolerance, \( F(x^n) \le reltol * F(x^0) \)

- stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||

- maxit - the maximum number of iterations allowed in the solver, default 50.

- maxf - the maximum number of function evaluations allowed in the solver (use `PETSC_UNLIMITED` indicates no limit), default 10,000

## Options Database Keys

- -snes_atol abstol - Sets `abstol`

- -snes_rtol rtol - Sets `rtol`

- -snes_stol stol - Sets `stol`

- -snes_max_it maxit - Sets `maxit`

- -snes_max_funcs maxf - Sets `maxf` (use `unlimited` to have no maximum)

## Note

All parameters must be non-negative

Use `PETSC_CURRENT` to retain the current value of any parameter and `PETSC_DETERMINE` to use the default value for the given `SNES`. The default value is the value in the object when its type is set.

Use `PETSC_UNLIMITED` on `maxit` or `maxf` to indicate there is no bound on the number of iterations or number of function evaluations.

## Fortran Note

Use `PETSC_CURRENT_INTEGER`, `PETSC_CURRENT_REAL`, `PETSC_UNLIMITED_INTEGER`, `PETSC_DETERMINE_INTEGER`, or `PETSC_DETERMINE_REAL`

## See Also

SNES: Nonlinear Solvers, `SNESSolve()`, `SNES`, `SNESSetDivergenceTolerance()`, `SNESSetForceIteration()`

## Level

intermediate

## Location

src/snes/interface/snes.c

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