petsc-3.7.1 2016-05-15
Report Typos and Errors

# KSPSetFromOptions

Sets KSP options from the options database. This routine must be called before KSPSetUp() if the user is to be allowed to set the Krylov type.

### Synopsis

    #include "petscksp.h"
    PetscErrorCode  KSPSetFromOptions(KSP ksp)

Collective on KSP Many br

### Input Parameters

ksp -the Krylov space context Many br

### Options Database Keys

| -ksp_max_it | - maximum number of linear iterations Many br
| -ksp_rtol rtol | - relative tolerance used in default determination of convergence, i.e. Many brif residual norm decreases by this factor than convergence is declared Many br
| -ksp_atol abstol | - absolute tolerance used in default convergence test, i.e. if residual Many brnorm is less than this then convergence is declared Many br
| -ksp_divtol tol | - if residual norm increases by this factor than divergence is declared Many br
| -ksp_converged_use_initial_residual_norm | - see KSPConvergedDefaultSetUIRNorm() Many br
| -ksp_converged_use_min_initial_residual_norm | - see KSPConvergedDefaultSetUMIRNorm() Many br
| -ksp_norm_type | - none - skip norms used in convergence tests (useful only when not using Many brconvergence test (say you always want to run with 5 iterations) to Many brsave on communication overhead Many brpreconditioned - default for left preconditioning Many brunpreconditioned - see KSPSetNormType() Many brnatural - see KSPSetNormType() Many br
| -ksp_check_norm_iteration it | - do not compute residual norm until iteration number it (does compute at 0th iteration) Many brworks only for PCBCGS, PCIBCGS and and PCCG Many br
| -ksp_lag_norm | - compute the norm of the residual for the ith iteration on the i+1 iteration; this means that one can use Many brthe norm of the residual for convergence test WITHOUT an extra MPI_Allreduce() limiting global synchronizations. Many brThis will require 1 more iteration of the solver than usual. Many br
| -ksp_fischer_guess <model,size> | - uses the Fischer initial guess generator for repeated linear solves Many br
| -ksp_constant_null_space | - assume the operator (matrix) has the constant vector in its null space Many br
| -ksp_test_null_space | - tests the null space set with MatSetNullSpace() to see if it truly is a null space Many br
| -ksp_knoll | - compute initial guess by applying the preconditioner to the right hand side Many br
| -ksp_monitor_cancel | - cancel all previous convergene monitor routines set Many br
| -ksp_monitor <optional filename> | - print residual norm at each iteration Many br
| -ksp_monitor_lg_residualnorm | - plot residual norm at each iteration Many br
| -ksp_monitor_solution [ascii binary or draw][:filename][:format option] | - plot solution at each iteration Many br
| -ksp_monitor_singular_value | - monitor extreme singular values at each iteration Many br

### Notes

To see all options, run your program with the -help option Many bror consult Users-Manual: Chapter 4 KSP: Linear Equations Solvers Many br

Many br

### Keywords

KSP, set, from, options, database

### See Also

KSPSetUseFischerGuess()

Level:beginner
Location:src/ksp/ksp/interface/itcl.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/ksp/pc/examples/tutorials/ex1.c.html
src/ksp/pc/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex1.c.html
src/ksp/ksp/examples/tutorials/ex2.c.html
src/ksp/ksp/examples/tutorials/ex3.c.html
src/ksp/ksp/examples/tutorials/ex4.c.html
src/ksp/ksp/examples/tutorials/ex5.c.html
src/ksp/ksp/examples/tutorials/ex6.c.html
src/ksp/ksp/examples/tutorials/ex7.c.html
src/ksp/ksp/examples/tutorials/ex8.c.html
src/ksp/ksp/examples/tutorials/ex9.c.html