# KSPGMRESSetHapTol
Sets tolerance for determining happy breakdown in `KSPGMRES`, `KSPFGMRES` and `KSPLGMRES` 
## Synopsis
```
#include "petscksp.h"  
PetscErrorCode KSPGMRESSetHapTol(KSP ksp, PetscReal tol)
```
Logically Collective


## Input Parameters

- ***ksp -*** the Krylov space context
- ***tol -*** the tolerance



## Options Database Key

- ***-ksp_gmres_haptol <positive real value> -*** set tolerance for determining happy breakdown





## Note
Happy breakdown is the rare case in `KSPGMRES` where an 'exact' solution is obtained after
a certain number of iterations. If you attempt more iterations after this point unstable
things can happen hence very occasionally you may need to set this value to detect this condition


## See Also
 [](chapter_ksp), `KSPGMRES`, `KSPSetTolerances()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/gmres/gmres.c.html#KSPGMRESSetHapTol">src/ksp/ksp/impls/gmres/gmres.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/impls/gmres/gmres.c.html#KSPGMRESSetHapTol_GMRES">KSPGMRESSetHapTol_GMRES in src/ksp/ksp/impls/gmres/gmres.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ksp/ksp/impls/gmres/gmres.c)


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