changes in KSP convergence tests

Lisandro Dalcin dalcinl at
Fri Oct 19 18:17:57 CDT 2007

I've fixed KSPDestroy() to use user provided destroy routine for
convergence context. Please review.

BTW, from some time ago in petsc4py I hack things to use the default
convergence test as below. Does it make sense to use this on
KSPDefaultConverged? If not, I thing an error should be generated if
the norm type is KSP_NORM_NO. What do you think?

#undef __FUNCT__
#define __FUNCT__ "KSPDefaultConverged_Safe"
static PetscErrorCode
KSPDefaultConverged_Safe(KSP ksp,
			 PetscInt its, PetscReal rnorm,
			 KSPConvergedReason* reason, void* ctx)
  KSPNormType    normtype;
  PetscErrorCode ierr;
  ierr = KSPGetNormType(ksp, &normtype); CHKERRQ(ierr);
  if (normtype == KSP_NORM_NO) {
    ierr = KSPSkipConverged(ksp,its,rnorm,reason,ctx);CHKERRQ(ierr);
  } else {
    ierr = KSPDefaultConverged(ksp,its,rnorm,reason,ctx);CHKERRQ(ierr);

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list