Actual source code: richscale.c

petsc-3.8.3 2017-12-09
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:     Level: intermediate

 16: .keywords: KSP, Richardson, set, scale
 17: @*/
 18: PetscErrorCode  KSPRichardsonSetScale(KSP ksp,PetscReal scale)
 19: {

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

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

 33:     Logically Collective on KSP

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

 39:     Level: intermediate

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

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


 46: .keywords: KSP, Richardson, set, scale
 47: @*/
 48: PetscErrorCode  KSPRichardsonSetSelfScale(KSP ksp,PetscBool scale)
 49: {

 55:   PetscTryMethod(ksp,"KSPRichardsonSetSelfScale_C",(KSP,PetscBool),(ksp,scale));
 56:   return(0);
 57: }