# SNESConvergenceTestFunction
functional form used for testing of convergence of nonlinear solver 
## Synopsis
```
#include <petscsnes.h>
$     PetscErrorCode SNESConvergenceTest(SNES snes,PetscInt it,PetscReal xnorm,PetscReal gnorm,PetscReal f,SNESConvergedReason *reason,void *cctx)
```
Collective


## Input Parameters

- ***snes -*** the `SNES` context
- ***it -*** current iteration (0 is the first and is before any Newton step)
- ***xnorm -*** 2-norm of current iterate
- ***gnorm -*** 2-norm of current step
- ***f -*** 2-norm of function
- ***cctx -*** [optional] convergence context



## Output Parameter

- ***reason -*** reason for convergence/divergence, only needs to be set when convergence or divergence is detected





## See Also
 `SNES`, `SNESSolve`, `SNESSetConvergenceTest()`, `SNESGetConvergenceTest()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snes.c.html#SNESConvergenceTestFunction">src/snes/interface/snes.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)


[Index of all SNES routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
