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

# KSPConvergedDefault

Determines convergence of the linear iterative solvers by default

### Synopsis

    #include "petscksp.h"
    PetscErrorCode  KSPConvergedDefault(KSP ksp,PetscInt n,PetscReal rnorm,KSPConvergedReason *reason,void *ctx)

Collective on KSP Many br

### Input Parameters

| ksp | - iterative context Many br
| n | - iteration number Many br
| rnorm | - residual norm (may be estimated, depending on the method may be the preconditioned residual norm) Many br
| ctx | - convergence context which must be created by KSPConvergedDefaultCreate() Many br

### Output Parameter

| positive | - if the iteration has converged; Many br
| negative | - if residual norm exceeds divergence threshold; Many br
| 0 | - otherwise. Many br

### Notes

KSPConvergedDefault() reaches convergence when rnorm < MAX (rtol * rnorm_0, abstol); Many brDivergence is detected if rnorm > dtol * rnorm_0, Many br

### where

| rtol = relative tolerance, | - . abstol = absolute tolerance. Many br
| dtol = divergence tolerance, | - - rnorm_0 is the two norm of the right hand side. When initial guess is non-zero you Many brcan call KSPConvergedDefaultSetUIRNorm() to use the norm of (b - A*(initial guess)) Many bras the starting point for relative norm convergence testing, that is as rnorm_0 Many br

Use KSPSetTolerances() to alter the defaults for rtol, abstol, dtol. Many br

Use KSPSetNormType() (or -ksp_norm_type <none,preconditioned,unpreconditioned,natural>) to change the norm used for computing rnorm Many br

The precise values of reason are macros such as KSP_CONVERGED_RTOL, which are defined in petscksp.h. Many br

This routine is used by KSP by default so the user generally never needs call it directly. Many br

Use KSPSetConvergenceTest() to provide your own test instead of using this one. Many br

Many br

### Keywords

KSP, default, convergence, residual

### See Also

KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(),
KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultCreate(), KSPConvergedDefaultDestroy() Many br

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