# SNESConvergedReasonView
Displays the reason a `SNES` solve converged or diverged to a viewer 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESConvergedReasonView(SNES snes, PetscViewer viewer)
```
Collective on snes


## Parameter

- ***snes -*** iterative context obtained from `SNESCreate()`
- ***viewer -*** the viewer to display the reason



## Options Database Keys

- ***-snes_converged_reason -*** print reason for converged or diverged, also prints number of iterations
- ***-snes_converged_reason ::failed -*** only print reason and number of iterations when diverged



## Note
To change the format of the output call `PetscViewerPushFormat`(viewer,format) before this call. Use `PETSC_VIEWER_DEFAULT` for the default,
use `PETSC_VIEWER_FAILED` to only display a reason if it fails.




## See Also
 `SNESConvergedReason`, `PetscViewer`, `SNES`,
`SNESCreate()`, `SNESSetUp()`, `SNESDestroy()`, `SNESSetTolerances()`, `SNESConvergedDefault()`, `SNESGetConvergedReason()`,
`SNESConvergedReasonViewFromOptions()`,
`PetscViewerPushFormat()`, `PetscViewerPopFormat()`

## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex1f.F90.html">src/snes/tutorials/ex1f.F90.html</A><BR>


---
[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)  
