petsc-3.7.1 2016-05-15
Report Typos and Errors

KSPSetConvergenceTest

Sets the function to be used to determine convergence.

Synopsis

#include "petscksp.h" 
PetscErrorCode  KSPSetConvergenceTest(KSP ksp,PetscErrorCode (*converge)(KSP,PetscInt,PetscReal,KSPConvergedReason*,void*),void *cctx,PetscErrorCode (*destroy)(void*))
Logically Collective on KSP Many br

Input Parameters

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

Calling sequence of converge

    converge (KSP ksp, int it, PetscReal rnorm, KSPConvergedReason *reason,void *mctx)

ksp - iterative context obtained from KSPCreate() Many br
it - iteration number Many br
rnorm - (estimated) 2-norm of (preconditioned) residual Many br
reason - the reason why it has converged or diverged Many br
cctx - optional convergence context, as set by KSPSetConvergenceTest() Many br

Notes

Must be called after the KSP type has been set so put this after Many bra call to KSPSetType(), or KSPSetFromOptions(). Many br

The default convergence test, KSPConvergedDefault(), aborts if the Many brresidual grows to more than 10000 times the initial residual. Many br

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

In the default PETSc convergence test, the precise values of reason Many brare macros such as KSP_CONVERGED_RTOL, which are defined in petscksp.h. Many br

Many br

Keywords

KSP, set, convergence, test, context

See Also

KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances()

Level:advanced
Location:
src/ksp/ksp/interface/itfunc.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ksp/ksp/examples/tutorials/ex2f.F.html