KSPSetType

Builds KSP for a particular solver.

Synopsis

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

Input Parameter

ctx -the Krylov space context
itmethod -a known method

Options Database Command

-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 andthen set the KSP type from the options database rather than by usingthis routine. Using the options database provides the user withmaximum flexibility in evaluating the many different Krylov methods. The KSPSetType() routine is provided for those situations where itis necessary to set the iterative solver independently of the commandline or options database. This might be the case, for example, whenthe choice of iterative solver changes during the execution of theprogram, and the user's application is taking responsibility forchoosing the appropriate method. In other words, this routine isfor the advanced user.

Keywords

KSP, set, method

Examples

src/sles/examples/tutorials/ex7.c

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