KSPPREONLY — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# KSPPREONLY

This implements a method that applies ONLY the preconditioner exactly once. It is commonly used with the direct solver preconditioners like `PCLU` and `PCCHOLESKY`, but it may also be used when a single iteration of the preconditioner is needed for smoothing in multigrid, `PCMG` or `PCGAMG` or within some other nested linear solve such as `PCFIELDSPLIT` or `PCBJACOBI`.

There is an alias of this with the name `KSPNONE`.

## Options Database Key

- -ksp_type preonly - use a single application of the preconditioner only

## Notes

Since this does not involve an iteration the basic `KSP` parameters such as tolerances and maximum iteration counts do not apply

To apply the preconditioner multiple times in a simple iteration use `KSPRICHARDSON`

This `KSPType` cannot be used with the flag `-ksp_initial_guess_nonzero` or the call `KSPSetInitialGuessNonzero()` since it simply applies the preconditioner to the given right-hand side during `KSPSolve()`. Except when the `PCType` is `PCREDISTRIBUTE`; in that situation pass the nonzero initial guess flag with `-ksp_initial_guess_nonzero` or `KSPSetInitialGuessNonzero()` both to the outer `KSP` (which is `KSPPREONLY`) and the inner `KSP` object obtained with `KSPGetPC()` followed by `PCRedistributedGetKSP()` followed by `KSPSetInitialGuessNonzero()` or the option `-redistribute_ksp_initial_guess_nonzero`.

## Developer Note

Even though this method does not use any norms, the user is allowed to set the `KSPNormType` to any value. This is so the users does not have to change `KSPNormType` options when they switch from other `KSP` methods to this one.

## See Also

KSP: Linear System Solvers, `KSPCreate()`, `KSPSetType()`, `KSPType`, `KSP`, `KSPRICHARDSON`, `KSPCHEBYSHEV`, `KSPGetPC()`, `KSPSetInitialGuessNonzero()`, `PCREDISTRIBUTE`, `PCRedistributeGetKSP()`, `KSPNONE`

## Level

beginner

## Location

src/ksp/ksp/impls/preonly/preonly.c

## Examples

src/ksp/ksp/tutorials/ex57f.F90
src/ksp/ksp/tutorials/ex52f.F90
src/tao/constrained/tutorials/ex1.c
src/tao/constrained/tutorials/maros.c
src/ksp/ksp/tutorials/ex52.c
src/snes/tutorials/ex31.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages