KSPSetConvergenceTest

Sets the function to be used to determine convergence.

Synopsis

int KSPSetConvergenceTest(KSP ksp,int (*converge)(KSP,int,double,void*),void *cctx)
Collective on KSP

Input Parameters

ksp - iterative context obtained from KSPCreate()
converge - pointer to int function
cctx - context for private data for the convergence routine (may be null)

Calling sequence of converge

    converge (KSP ksp, int it, double rnorm, void *mctx)

ksp - iterative context obtained from KSPCreate()
it - iteration number
rnorm - (estimated) 2-norm of (preconditioned) residual
cctx - optional convergence context, as set by KSPSetConvergenceTest()

Return value of converge

The convergence test should return 0 for not converged, 1 forconverged, and -1 for abort or failure to converge.

Notes

The default convergence test, KSPDefaultConverged(), aborts if theresidual grows to more than 10000 times the initial residual.

The default is a combination of relative and absolute tolerances. The residual value that is tested may be an approximation; routinesthat need exact values should compute them.

Keywords

KSP, set, convergence, test, context

See Also

KSPDefaultConverged(), KSPGetConvergenceContext()

Location: src/ksp/interface/itfunc.c
KSP Index
Table of Contents