Actual source code: richscale.c

petsc-3.11.3 2019-06-26
Report Typos and Errors

  2:  #include <../src/ksp/ksp/impls/rich/richardsonimpl.h>

  4: /*@
  5:     KSPRichardsonSetScale - Set the damping factor; if this routine is not called, the factor
  6:     defaults to 1.0.

  8:     Logically Collective on KSP

 10:     Input Parameters:
 11: +   ksp - the iterative context
 12: -   scale - the relaxation factor

 14:     Options Database Keys:
 15: . -ksp_richardson_self <scale> - Set the scale factor

 17:     Level: intermediate

 19: .keywords: KSP, Richardson, set, scale
 20: @*/
 21: PetscErrorCode  KSPRichardsonSetScale(KSP ksp,PetscReal scale)
 22: {

 28:   PetscTryMethod(ksp,"KSPRichardsonSetScale_C",(KSP,PetscReal),(ksp,scale));
 29:   return(0);
 30: }

 32: /*@
 33:     KSPRichardsonSetSelfScale - Sets Richardson to automatically determine optimal scaling at each iteration to minimize the 2-norm of the
 34:        preconditioned residual

 36:     Logically Collective on KSP

 38:     Input Parameters:
 39: +   ksp - the iterative context
 40: -   scale - PETSC_TRUE or the default of PETSC_FALSE

 42:     Options Database Keys:
 43: . -ksp_richardson_self_scale - Use self-scaling

 45:     Level: intermediate

 47:     Notes:
 48:     Requires two extra work vectors. Uses an extra VecAXPY() and VecDotNorm2() per iteration.

 50:     Developer Notes:
 51:     Could also minimize the 2-norm of the true residual with one less work vector


 54: .keywords: KSP, Richardson, set, scale
 55: @*/
 56: PetscErrorCode  KSPRichardsonSetSelfScale(KSP ksp,PetscBool scale)
 57: {

 63:   PetscTryMethod(ksp,"KSPRichardsonSetSelfScale_C",(KSP,PetscBool),(ksp,scale));
 64:   return(0);
 65: }