Actual source code: richscale.c

petsc-3.12.5 2020-03-29
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: @*/
 20: PetscErrorCode  KSPRichardsonSetScale(KSP ksp,PetscReal scale)
 21: {

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

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

 35:     Logically Collective on ksp

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

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

 44:     Level: intermediate

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

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


 53: @*/
 54: PetscErrorCode  KSPRichardsonSetSelfScale(KSP ksp,PetscBool scale)
 55: {

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