PCShellSetApplyRichardson#
Sets routine to use as preconditioner in Richardson iteration.
Synopsis#
#include "petscpc.h"
PetscErrorCode PCShellSetApplyRichardson(PC pc, PetscErrorCode (*apply)(PC pc, Vec b, Vec x, Vec r, PetscReal rtol, PetscReal abstol, PetscReal dtol, PetscInt maxits, PetscBool zeroinitialguess, PetscInt *its, PCRichardsonConvergedReason *reason))
Logically Collective
Input Parameters#
pc - the preconditioner context
apply - the application-provided preconditioning routine
Calling sequence of apply#
pc - the preconditioner
b - right-hand side
x - current iterate
r - work space
rtol - relative tolerance of residual norm to stop at
abstol - absolute tolerance of residual norm to stop at
dtol - if residual norm increases by this factor than return
maxits - number of iterations to run
zeroinitialguess -
PETSC_TRUEifxis known to be initially zeroits - returns the number of iterations used
reason - returns the reason the iteration has converged
Notes#
You can get the PCSHELL context set with PCShellSetContext() using PCShellGetContext() if needed by apply.
This is used when one can provide code for multiple steps of Richardson’s method that is more efficient than computing a single step, recomputing the residual via \( r = b - A x \), and then computing the next step. SOR is an algorithm for which this is true.
See Also#
KSP: Linear System Solvers, PCSHELL, PCShellSetApply(), PCShellSetContext(), PCRichardsonConvergedReason(), PCShellGetContext(), KSPRICHARDSON
Level#
advanced
Location#
Implementations#
Index of all PC routines
Table of Contents for all manual pages
Index of all manual pages