KSPSetType

Builds KSP for a particular solver.

Synopsis

int KSPSetType(KSP ksp,KSPType itmethod)
Collective on KSP

Input Parameters

ksp -the Krylov space context
itmethod -a known method

Options Database Key

-ksp_type <method> -Sets the method; use -help for a list of available methods (for instance, cg or gmres)

Notes

See "petsc/include/ksp.h" for available methods (for instance, KSPCG or KSPGMRES).

Normally, it is best to use the SLESSetFromOptions() command and then set the KSP type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the many different Krylov methods. The KSPSetType() routine is provided for those situations where it is necessary to set the iterative solver independently of the command line or options database. This might be the case, for example, when the choice of iterative solver changes during the execution of the program, and the user's application is taking responsibility for choosing the appropriate method. In other words, this routine is not for beginners.

Keywords

KSP, set, method

See Also

PCSetType()

Examples

src/sles/examples/tutorials/ex7.c

Level:intermediate
Location:src/sles/ksp/interface/itcreate.c
KSP Index
Table of Contents