#include "petscksp.h" PetscErrorCode KSPDefaultConverged(KSP ksp,PetscInt n,PetscReal rnorm,KSPConvergedReason *reason,void *ctx)Collective on KSP
ksp | - iterative context | |
n | - iteration number | |
rnorm | - 2-norm residual value (may be estimated) | |
ctx | - convergence context which must be created by KSPDefaultConvergedCreate() |
positive | - if the iteration has converged; | |
negative | - if residual norm exceeds divergence threshold; | |
0 | - otherwise. |
rnorm < MAX (rtol * rnorm_0, abstol);Divergence is detected if
rnorm > dtol * rnorm_0,
where
rtol = relative tolerance, | - . abstol = absolute tolerance. | |
dtol = divergence tolerance, | - - rnorm_0 is the two norm of the right hand side. When initial guess is non-zero you can call KSPDefaultConvergedSetUIRNorm() to use the norm of (b - A*(initial guess)) as the starting point for relative norm convergence testing. |