KSP - Low-level Interface
This page documents the low-level, automatically wrapped PETSc KSP (Krylov Subspace Methods) functions available through LibPETSc. These functions provide direct access to the PETSc C API.
For the high-level Julia interface, see KSP.
Overview
The KSP interface includes:
- Core KSP operations: Linear solver creation, configuration, and solution (~244 functions in
KSP_wrappers.jl) - KSPGuess: Initial guess generation for iterative solvers (~12 functions in
KSPGuess_wrappers.jl)
Usage
All low-level KSP functions require a petsclib parameter as the first argument:
using PETSc
# Get the library instance
petsclib = PETSc.petsclibs[1]
PETSc.initialize(petsclib)
# Get PETSc types
PetscInt = petsclib.PetscInt
# Assume mat, b, x are already created
# Create KSP solver
ksp = LibPETSc.KSPCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
LibPETSc.KSPSetOperators(petsclib, ksp, mat, mat)
LibPETSc.KSPSetFromOptions(petsclib, ksp)
# Solve Ax = b
LibPETSc.KSPSolve(petsclib, ksp, b, x)
# Get convergence info
reason = LibPETSc.KSPGetConvergedReason(petsclib, ksp)
iterations = LibPETSc.KSPGetIterationNumber(petsclib, ksp)
# Clean up
LibPETSc.KSPDestroy(petsclib, ksp)
PETSc.finalize(petsclib)Function Reference
PETSc.LibPETSc.KSPAppendOptionsPrefix — Method
KSPAppendOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP, prefix::String)Appends to the prefix used for searching for all KSP options in the database.
Logically Collective
Input Parameters:
ksp- the Krylov contextprefix- the prefix string to prepend to allKSPoption requests
Level: intermediate
-seealso: , KSP, KSPSetOptionsPrefix(), KSPGetOptionsPrefix(), KSPSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPAppendOptionsPrefix
PETSc.LibPETSc.KSPBCGSLSetEll — Method
KSPBCGSLSetEll(petsclib::PetscLibType,ksp::PetscKSP, ell::PetscInt)Sets the number of search directions to use in the KSPBCGSL Krylov solver
Logically Collective
Input Parameters:
ksp- iterative context,KSP, of typeKSPBCGSLell- number of search directions to use
Options Database Key:
-ksp_bcgsl_ell ell- Number of Krylov search directions
Level: intermediate
-seealso: , KSPBCGSLSetUsePseudoinverse(), KSP, KSPBCGSL, KSPBCGSLSetPol(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetEll
PETSc.LibPETSc.KSPBCGSLSetPol — Method
KSPBCGSLSetPol(petsclib::PetscLibType,ksp::PetscKSP, uMROR::PetscBool)Sets the type of polynomial part that will be used in the KSPCBGSL KSPSolve()
Logically Collective
Input Parameters:
ksp- iterative context of typeKSPCBGSLuMROR- set toPETSC_TRUEwhen the polynomial is a convex combination of an MR and an OR step.
Options Database Keys:
-ksp_bcgsl_cxpoly- use enhanced polynomial-ksp_bcgsl_mrpoly- use standard polynomial
Level: intermediate
-seealso: , KSP, KSPBCGSL, KSPCreate(), KSPSetType(), KSPCBGSL, KSPBCGSLSetUsePseudoinverse(), KSPBCGSLSetEll(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetPol
PETSc.LibPETSc.KSPBCGSLSetUsePseudoinverse — Method
KSPBCGSLSetUsePseudoinverse(petsclib::PetscLibType,ksp::PetscKSP, use_pinv::PetscBool)Use pseudoinverse (via SVD) to solve polynomial part of the update in KSPCBGSL solver
Logically Collective
Input Parameters:
ksp- iterative context of typeKSPCBGSLuse_pinv- set toPETSC_TRUEwhen using pseudoinverse
Options Database Key:
-ksp_bcgsl_pinv <true,false>- use pseudoinverse
Level: intermediate
-seealso: , KSPBCGSLSetEll(), KSP, KSPCBGSL, KSPBCGSLSetPol(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetUsePseudoinverse
PETSc.LibPETSc.KSPBCGSLSetXRes — Method
KSPBCGSLSetXRes(petsclib::PetscLibType,ksp::PetscKSP, delta::PetscReal)Sets the parameter governing when exact residuals will be used instead of computed residuals for KSPCBGSL.
Logically Collective
Input Parameters:
ksp- iterative context of typeKSPBCGSLdelta- computed residuals are used alone when delta is not positive
Options Database Key:
-ksp_bcgsl_xres delta- Threshold used to decide when to refresh computed residuals
Level: intermediate
-seealso: , KSPBCGSLSetEll(), KSPBCGSLSetPol(), KSP, KSPCBGSL, KSPBCGSLSetUsePseudoinverse()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetXRes
PETSc.LibPETSc.KSPBuildResidual — Method
KSPBuildResidual(petsclib::PetscLibType,ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec)Builds the residual in a vector provided.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
t- work vector. If not provided then one is generated.v- optional location to stash residual. Ifvis not provided, then a location is generated.V- the residual
Level: advanced
-seealso: , KSP, KSPBuildSolution()
External Links
- PETSc Manual:
KSP/KSPBuildResidual
PETSc.LibPETSc.KSPBuildResidualDefault — Method
KSPBuildResidualDefault(petsclib::PetscLibType,ksp::PetscKSP, t::PetscVec, v::PetscVec, V::PetscVec)Default code to compute the residual.
Collecive on ksp
Input Parameters:
ksp- iterative contextt- pointer to temporary vectorv- pointer to user vector
Output Parameter:
V- pointer to a vector containing the residual
Level: advanced
-seealso: , KSP, KSPBuildSolutionDefault()
External Links
- PETSc Manual:
KSP/KSPBuildResidualDefault
PETSc.LibPETSc.KSPBuildSolution — Method
KSPBuildSolution(petsclib::PetscLibType,ksp::PetscKSP, v::PetscVec, V::PetscVec)Builds the approximate solution in a vector provided.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter: Provide exactly one of
v- location to stash solution, optional, otherwise passNULLV- the solution is returned in this location. This vector is created internally. This vector should NOT be destroyed by the user withVecDestroy().
Level: developer
-seealso: , KSPGetSolution(), KSPBuildResidual(), KSP
External Links
- PETSc Manual:
KSP/KSPBuildSolution
PETSc.LibPETSc.KSPBuildSolutionDefault — Method
KSPBuildSolutionDefault(petsclib::PetscLibType,ksp::PetscKSP, v::PetscVec, V::PetscVec)External Links
- PETSc Manual:
KSP/KSPBuildSolutionDefault
PETSc.LibPETSc.KSPCGGetNormD — Method
KSPCGGetNormD(petsclib::PetscLibType,ksp::PetscKSP, norm_d::PetscReal)Get norm of the direction when the solver is used inside SNESNEWTONTR
Not collective
Input Parameters:
ksp- the iterative contextnorm_d- the norm of the direction
Level: advanced
-seealso: , KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGGetNormD
PETSc.LibPETSc.KSPCGGetObjFcn — Method
KSPCGGetObjFcn(petsclib::PetscLibType,ksp::PetscKSP, o_fcn::PetscReal)Get the conjugate gradient objective function value
Not collective
Input Parameters:
ksp- the iterative contexto_fcn- the objective function value
Level: advanced
-seealso: , KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, KSPMonitorSet
External Links
- PETSc Manual:
KSP/KSPCGGetObjFcn
PETSc.LibPETSc.KSPCGSetObjectiveTarget — Method
KSPCGSetObjectiveTarget(petsclib::PetscLibType,ksp::PetscKSP, obj::PetscReal)Sets the target value for the CG quadratic model
Logically Collective
Input Parameters:
ksp- the iterative contextobj- the objective value (0 is the default)
Level: advanced
-seealso: , KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGSetObjectiveTarget
PETSc.LibPETSc.KSPCGSetRadius — Method
KSPCGSetRadius(petsclib::PetscLibType,ksp::PetscKSP, radius::PetscReal)Sets the radius of the trust region used by the KSPCG when the solver is used inside SNESNEWTONTR
Logically Collective
Input Parameters:
ksp- the iterative contextradius- the trust region radius (0 is the default that disable the use of the radius)
Level: advanced
-seealso: , KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGSetRadius
PETSc.LibPETSc.KSPCGSetType — Method
KSPCGSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPCGType)Sets the variant of the conjugate gradient method to use for solving a linear system with a complex coefficient matrix. This option is irrelevant when solving a real system.
Logically Collective
Input Parameters:
ksp- the iterative contexttype- the variant of CG to use, one of
External Links
- PETSc Manual:
KSP/KSPCGSetType
PETSc.LibPETSc.KSPCGUseSingleReduction — Method
KSPCGUseSingleReduction(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Merge the two inner products needed in KSPCG into a single MPI_Allreduce() call.
Logically Collective
Input Parameters:
ksp- the iterative contextflg- turn on or off the single reduction
Options Database Key:
-ksp_cg_single_reduction <bool>- Merge inner products into singleMPI_Allreduce()
Level: intermediate
-seealso: , , KSP, KSPCG, KSPGMRES, KSPPIPECG, KSPPIPECR, and KSPGROPPCG
External Links
- PETSc Manual:
KSP/KSPCGUseSingleReduction
PETSc.LibPETSc.KSPChebyshevEstEigGetKSP — Method
KSPChebyshevEstEigGetKSP(petsclib::PetscLibType,ksp::PetscKSP, kspest::PetscKSP)Get the Krylov method context used to estimate the eigenvalues for the Chebyshev method.
Input Parameter:
ksp- the Krylov space context
Output Parameter:
kspest- the eigenvalue estimation Krylov space context
Level: advanced
-seealso: , KSPCHEBYSHEV, KSPChebyshevEstEigSet()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigGetKSP
PETSc.LibPETSc.KSPChebyshevEstEigSet — Method
KSPChebyshevEstEigSet(petsclib::PetscLibType,ksp::PetscKSP, a::PetscReal, b::PetscReal, c::PetscReal, d::PetscReal)Automatically estimate the eigenvalues to use for Chebyshev
Logically Collective
Input Parameters:
ksp- the Krylov space contexta- multiple of min eigenvalue estimate to use for min Chebyshev bound (orPETSC_DECIDE)b- multiple of max eigenvalue estimate to use for min Chebyshev bound (orPETSC_DECIDE)c- multiple of min eigenvalue estimate to use for max Chebyshev bound (orPETSC_DECIDE)d- multiple of max eigenvalue estimate to use for max Chebyshev bound (orPETSC_DECIDE)
Options Database Key:
-ksp_chebyshev_esteig a,b,c,d- estimate eigenvalues using a Krylov method, then use this transform for Chebyshev eigenvalue bounds
-seealso: , KSPCHEBYSHEV, KSPChebyshevEstEigSetUseNoisy(), KSPChebyshevEstEigGetKSP()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigSet
PETSc.LibPETSc.KSPChebyshevEstEigSetUseNoisy — Method
KSPChebyshevEstEigSetUseNoisy(petsclib::PetscLibType,ksp::PetscKSP, use::PetscBool)use a noisy random number generated right
Logically Collective
Input Parameters:
ksp- linear solver contextuse-PETSC_TRUEto use noisy
Options Database Key:
-ksp_chebyshev_esteig_noisy <true,false>- Use noisy right-hand side for estimate
Level: intermediate
-seealso: , KSPCHEBYSHEV, KSPChebyshevEstEigSet(), KSPChebyshevEstEigGetKSP()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigSetUseNoisy
PETSc.LibPETSc.KSPChebyshevGetKind — Method
KSPChebyshevGetKind(petsclib::PetscLibType,ksp::PetscKSP, kind::KSPChebyshevKind)get the kind of Chebyshev polynomial to use
Logically Collective
Input Parameters:
ksp- Linear solver contextkind- The kind of Chebyshev polynomial used
Level: intermediate
-seealso: , KSPCHEBYSHEV, KSPChebyshevKind, KSPChebyshevSetKind(), KSP_CHEBYSHEV_FIRST, KSP_CHEBYSHEV_FOURTH, KSP_CHEBYSHEV_OPT_FOURTH
External Links
- PETSc Manual:
KSP/KSPChebyshevGetKind
PETSc.LibPETSc.KSPChebyshevSetEigenvalues — Method
KSPChebyshevSetEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, emax::PetscReal, emin::PetscReal)Sets estimates for the extreme eigenvalues of the preconditioned problem.
Logically Collective
Input Parameters:
ksp- the Krylov space contextemax- the eigenvalue maximum estimateemin- the eigenvalue minimum estimate
Options Database Key:
-ksp_chebyshev_eigenvalues emin,emax- extreme eigenvalues
Level: intermediate
-seealso: , KSPCHEBYSHEV, KSPChebyshevEstEigSet(),
External Links
- PETSc Manual:
KSP/KSPChebyshevSetEigenvalues
PETSc.LibPETSc.KSPChebyshevSetKind — Method
KSPChebyshevSetKind(petsclib::PetscLibType,ksp::PetscKSP, kind::KSPChebyshevKind)set the kind of Chebyshev polynomial to use
Logically Collective
Input Parameters:
ksp- Linear solver contextkind- The kind of Chebyshev polynomial to use, seeKSPChebyshevKind, one ofKSP_CHEBYSHEV_FIRST,KSP_CHEBYSHEV_FOURTH, orKSP_CHEBYSHEV_OPT_FOURTH
Options Database Key:
-ksp_chebyshev_kind <kind>- which kind of Chebyshev polynomial to use
Level: intermediate
-seealso: , KSPCHEBYSHEV, KSPChebyshevKind, KSPChebyshevGetKind(), KSP_CHEBYSHEV_FIRST, KSP_CHEBYSHEV_FOURTH, KSP_CHEBYSHEV_OPT_FOURTH
External Links
- PETSc Manual:
KSP/KSPChebyshevSetKind
PETSc.LibPETSc.KSPCheckSolve — Method
KSPCheckSolve(petsclib::PetscLibType,ksp::PetscKSP, pc::PC, vec::PetscVec)Checks if the PCSetUp() or KSPSolve() failed and set the error flag for the outer PC. A KSP_DIVERGED_ITS is not considered a failure in this context
Collective
Input Parameters:
ksp- the linear solverKSPcontext.pc- the preconditioner contextvec- a vector that will be initialized with Inf to indicate lack of convergence
Level: developer
-seealso: , KSP, KSPCreate(), KSPSetType(), KSPCheckNorm(), KSPCheckDot()
External Links
- PETSc Manual:
KSP/KSPCheckSolve
PETSc.LibPETSc.KSPComputeConvergenceRate — Method
cr::PetscReal,rRsq::PetscReal,ce::PetscReal,eRsq::PetscReal = KSPComputeConvergenceRate(petsclib::PetscLibType,ksp::PetscKSP)Compute the convergence rate for the iteration <https:/en.wikipedia.org/wiki/Coefficientofdetermination>
Not Collective
Input Parameter:
ksp- TheKSP
Output Parameters:
cr- The residual contraction raterRsq- The coefficient of determination, R^2, indicating the linearity of the datace- The error contraction rateeRsq- The coefficient of determination, R^2, indicating the linearity of the data
Level: advanced
-seealso: , KSP, KSPConvergedRateView()
External Links
- PETSc Manual:
KSP/KSPComputeConvergenceRate
PETSc.LibPETSc.KSPComputeEigenvalues — Method
r::Vector{PetscReal},c::Vector{PetscReal},neig::PetscInt = KSPComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt)Computes the extreme eigenvalues for the preconditioned operator. Called after or during KSPSolve().
Not Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()n- size of arraysrandc. The number of eigenvalues computedneigwill, in general, be less than this.
Output Parameters:
r- real part of computed eigenvalues, provided by user with a dimension of at leastnc- complex part of computed eigenvalues, provided by user with a dimension of at leastnneig- actual number of eigenvalues computed (will be less than or equal ton)
Options Database Key:
-ksp_view_eigenvalues- Prints eigenvalues to stdout
Level: advanced
-seealso: , KSPSetComputeEigenvalues(), KSPSetComputeSingularValues(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), KSP, KSPComputeRitz()
External Links
- PETSc Manual:
KSP/KSPComputeEigenvalues
PETSc.LibPETSc.KSPComputeEigenvaluesExplicitly — Method
r::Vector{PetscReal},c::Vector{PetscReal} = KSPComputeEigenvaluesExplicitly(petsclib::PetscLibType,ksp::PetscKSP, nmax::PetscInt)Computes all of the eigenvalues of the preconditioned operator using LAPACK.
Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()nmax- size of arraysrandc
Output Parameters:
r- real part of computed eigenvalues, provided by user with a dimension at least ofnc- complex part of computed eigenvalues, provided by user with a dimension at least ofn
Level: advanced
-seealso: , KSP, KSPComputeEigenvalues(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), KSPSetOperators(), KSPSolve()
External Links
- PETSc Manual:
KSP/KSPComputeEigenvaluesExplicitly
PETSc.LibPETSc.KSPComputeExtremeSingularValues — Method
emax::PetscReal,emin::PetscReal = KSPComputeExtremeSingularValues(petsclib::PetscLibType,ksp::PetscKSP)Computes the extreme singular values for the preconditioned operator. Called after or during KSPSolve().
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
emax- maximum estimated singular valueemin- minimum estimated singular value
Options Database Key:
-ksp_view_singularvalues- compute extreme singular values and print whenKSPSolve()completes.
Level: advanced
-seealso: , KSPSetComputeSingularValues(), KSPMonitorSingularValue(), KSPComputeEigenvalues(), KSP, KSPComputeRitz()
External Links
- PETSc Manual:
KSP/KSPComputeExtremeSingularValues
PETSc.LibPETSc.KSPComputeOperator — Method
KSPComputeOperator(petsclib::PetscLibType,ksp::PetscKSP, mattype::MatType, mat::PetscMat)Computes the explicit preconditioned operator, including diagonal scaling and null space removal if applicable.
Collective
Input Parameters:
ksp- the Krylov subspace contextmattype- the matrix type to be used
Output Parameter:
mat- the explicit preconditioned operator
Level: advanced
-seealso: , KSP, KSPSetOperators(), KSPComputeEigenvaluesExplicitly(), PCComputeOperator(), KSPSetDiagonalScale(), KSPSetNullSpace(), MatType
External Links
- PETSc Manual:
KSP/KSPComputeOperator
PETSc.LibPETSc.KSPComputeRitz — Method
nrit::PetscInt,tetar::Vector{PetscReal},tetai::Vector{PetscReal} = KSPComputeRitz(petsclib::PetscLibType,ksp::PetscKSP, ritz::PetscBool, small::PetscBool, S::Vector{PetscVec})Computes the Ritz or harmonic Ritz pairs associated with the smallest or largest in modulus, for the preconditioned operator.
Not Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()ritz-PETSC_TRUEorPETSC_FALSEfor Ritz pairs or harmonic Ritz pairs, respectivelysmall-PETSC_TRUEorPETSC_FALSEfor smallest or largest (harmonic) Ritz values, respectively
Output Parameters:
nrit- On input number of (harmonic) Ritz pairs to compute; on output, actual number of computed (harmonic) Ritz pairsS- an array of the Ritz vectors, pass in an array of vectors of sizenrittetar- real part of the Ritz values, pass in an array of sizenrittetai- imaginary part of the Ritz values, pass in an array of sizenrit
Level: advanced
-seealso: , KSPSetComputeRitz(), KSP, KSPGMRES, KSPComputeEigenvalues(), KSPSetComputeSingularValues(), KSPMonitorSingularValue()
External Links
- PETSc Manual:
KSP/KSPComputeRitz
PETSc.LibPETSc.KSPConvergedDefault — Method
KSPConvergedDefault(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid)Default code to determine convergence of the linear iterative solvers
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- residual norm (may be estimated, depending on the method may be the preconditioned residual norm)ctx- convergence context which must be created byKSPConvergedDefaultCreate()
Output Parameter:
reason- the convergence reason; it is positive if the iteration has converged,
negative if the iteration has diverged, and KSP_CONVERGED_ITERATING otherwise
Options Database Keys:
-ksp_max_it- maximum number of linear iterations-ksp_min_it- minimum number of linear iterations, defaults to 0-ksp_rtol rtol- relative tolerance used in default determination of convergence, i.e. if residual norm decreases by this factor than convergence is declared-ksp_atol abstol- absolute tolerance used in default convergence test, i.e. if residual norm is less than this then convergence is declared-ksp_divtol tol- if residual norm increases by this factor than divergence is declared-ksp_converged_use_initial_residual_norm- seeKSPConvergedDefaultSetUIRNorm()-ksp_converged_use_min_initial_residual_norm- seeKSPConvergedDefaultSetUMIRNorm()-ksp_converged_maxits- seeKSPConvergedDefaultSetConvergedMaxits()
Level: advanced
-seealso: , KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPSetMinimumIterations(), KSPConvergenceTestFn, KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetConvergedMaxits(), KSPConvergedDefaultCreate(), KSPConvergedDefaultDestroy()
External Links
- PETSc Manual:
KSP/KSPConvergedDefault
PETSc.LibPETSc.KSPConvergedDefaultCreate — Method
ctx::Cvoid = KSPConvergedDefaultCreate(petsclib::PetscLibType)Creates and initializes the context used by the KSPConvergedDefault() function
Not Collective
Output Parameter:
ctx- convergence context
Level: intermediate
-seealso: , KSP, KSPConvergedDefault(), KSPConvergedDefaultDestroy(), KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetConvergedMaxits()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultCreate
PETSc.LibPETSc.KSPConvergedDefaultDestroy — Method
KSPConvergedDefaultDestroy(petsclib::PetscLibType,ctx::Cvoid)Frees the space used by the KSPConvergedDefault() function context
Not Collective
Input Parameter:
ctx- convergence context
Level: intermediate
-seealso: , KSP, KSPConvergedDefault(), KSPConvergedDefaultCreate(), KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultDestroy
PETSc.LibPETSc.KSPConvergedDefaultSetConvergedMaxits — Method
KSPConvergedDefaultSetConvergedMaxits(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)allows the default convergence test to declare convergence and return KSP_CONVERGED_ITS if the maximum number of iterations is reached
Collective
Input Parameters:
ksp- iterative contextflg- boolean flag
Options Database Key:
-ksp_converged_maxits <bool>- Declare convergence if the maximum number of iterations is reached
Level: intermediate
-seealso: , KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetUIRNorm()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetConvergedMaxits
PETSc.LibPETSc.KSPConvergedDefaultSetUIRNorm — Method
KSPConvergedDefaultSetUIRNorm(petsclib::PetscLibType,ksp::PetscKSP)makes the default convergence test use || B(b instead of || Bb ||. In the case of right preconditioner or if KSPSetNormType(ksp,KSP_NORM_UNPRECONDITIONED) is used there is no B in the above formula.
Collective
Input Parameters:
ksp- iterative context
Options Database Key:
-ksp_converged_use_initial_residual_norm <bool>- Use initial residual norm for computing relative convergence
Level: intermediate
-seealso: , KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetConvergedMaxits()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetUIRNorm
PETSc.LibPETSc.KSPConvergedDefaultSetUMIRNorm — Method
KSPConvergedDefaultSetUMIRNorm(petsclib::PetscLibType,ksp::PetscKSP)makes the default convergence test use min(|| B*(b In the case of right preconditioner or if KSPSetNormType(ksp,KSP_NORM_UNPRECONDITIONED) is used there is no B in the above formula.
Collective
Input Parameters:
ksp- iterative context
Options Database Key:
-ksp_converged_use_min_initial_residual_norm <bool>- Use minimum of initial residual norm and b for computing relative convergence
Level: intermediate
-seealso: , KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetConvergedMaxits()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetUMIRNorm
PETSc.LibPETSc.KSPConvergedRateView — Method
KSPConvergedRateView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer)Displays the convergence rate https://en.wikipedia.org/wiki/Coefficient_of_determination of KSPSolve() to a viewer
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()viewer- thePetscViewerto display the reason
Options Database Key:
-ksp_converged_rate- print reason for convergence or divergence and the convergence rate (or 0.0 for divergence)
Level: intermediate
-seealso: , KSPConvergedReasonView(), KSPGetConvergedRate(), KSPSetTolerances(), KSPConvergedDefault()
External Links
- PETSc Manual:
KSP/KSPConvergedRateView
PETSc.LibPETSc.KSPConvergedReasonView — Method
KSPConvergedReasonView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer)Displays the reason a KSP solve converged or diverged, KSPConvergedReason to a PetscViewer
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()viewer- thePetscVieweron which to display the reason
Options Database Keys:
-ksp_converged_reason- print reason for converged or diverged, also prints number of iterations-ksp_converged_reason ::failed- only print reason and number of iterations when diverged
Level: beginner
-seealso: , KSPConvergedReasonViewFromOptions(), KSPCreate(), KSPSetUp(), KSPDestroy(), KSPSetTolerances(), KSPConvergedDefault(), KSPSolveTranspose(), KSPGetIterationNumber(), KSP, KSPGetConvergedReason(), PetscViewerPushFormat(), PetscViewerPopFormat()
External Links
- PETSc Manual:
KSP/KSPConvergedReasonView
PETSc.LibPETSc.KSPConvergedReasonViewCancel — Method
KSPConvergedReasonViewCancel(petsclib::PetscLibType,ksp::PetscKSP)Clears all the KSPConvergedReason view functions for a KSP object set with KSPConvergedReasonViewSet() as well as the default viewer.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Level: intermediate
-seealso: , KSPCreate(), KSPDestroy(), KSPReset(), KSPConvergedReasonViewSet()
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewCancel
PETSc.LibPETSc.KSPConvergedReasonViewFromOptions — Method
KSPConvergedReasonViewFromOptions(petsclib::PetscLibType,ksp::PetscKSP)Processes command line options to determine if/how a KSPReason is to be viewed.
Collective
Input Parameter:
ksp- theKSPobject
Level: intermediate
-seealso: , KSPConvergedReasonView(), KSPConvergedReasonViewSet()
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewFromOptions
PETSc.LibPETSc.KSPConvergedReasonViewSet — Method
KSPConvergedReasonViewSet(petsclib::PetscLibType,ksp::PetscKSP, f::KSPConvergedReasonViewFn, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn)Sets an ADDITIONAL function that is to be used at the end of the linear solver to display the convergence reason of the linear solver.
Logically Collective
Input Parameters:
ksp- theKSPcontextf- thekspconverged reason view function, seeKSPConvergedReasonViewFnvctx- [optional] user-defined context for private data for the
KSPConvergedReason view routine (use NULL if no context is desired)
reasonviewdestroy- [optional] routine that freesvctx(may beNULL), seePetscCtxDestroyFnfor the calling sequence
Options Database Keys:
-ksp_converged_reason- sets a defaultKSPConvergedReasonView()-ksp_converged_reason_view_cancel- cancels all converged reason viewers that have been hardwired into a code by
calls to KSPConvergedReasonViewSet(), but does not cancel those set via the options database.
Level: intermediate
-seealso: , KSPConvergedReasonView(), KSPConvergedReasonViewFn, KSPConvergedReasonViewCancel(), PetscCtxDestroyFn
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewSet
PETSc.LibPETSc.KSPConvergedSkip — Method
KSPConvergedSkip(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, dtx::Cvoid)Convergence test that do not return as converged until the maximum number of iterations is reached.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm residual value (may be estimated)dtx- unused convergence context
Output Parameter:
reason-KSP_CONVERGED_ITERATINGorKSP_CONVERGED_ITS
Options Database Key:
-ksp_convergence_test skip- skips the test
Level: advanced
-seealso: , KSP, KSPCG, KSPBCGS, KSPConvergenceTestFn, KSPSetConvergenceTest(), KSPSetTolerances(), KSPSetNormType(), , KSPConvergedReason
External Links
- PETSc Manual:
KSP/KSPConvergedSkip
PETSc.LibPETSc.KSPCreate — Method
inksp::PetscKSP = KSPCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates the KSP context. This KSP context is used in PETSc to solve linear systems with KSPSolve()
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
inksp- location to put theKSPcontext
Level: beginner
-seealso: , KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPGMRES, KSPType, KSPSetType()
External Links
- PETSc Manual:
KSP/KSPCreate
PETSc.LibPETSc.KSPCreateVecs — Method
right::Vector{PetscVec},left::Vector{PetscVec} = KSPCreateVecs(petsclib::PetscLibType,ksp::PetscKSP, rightn::PetscInt, leftn::PetscInt)Gets a number of work vectors suitably sized for the operator in the KSP
Collective
Input Parameters:
ksp- iterative contextrightn- number of right work vectors to allocateleftn- number of left work vectors to allocate
Output Parameters:
right- the array of vectors createdleft- the array of left vectors
Level: advanced
-seealso: , MatCreateVecs(), VecDestroyVecs(), KSPSetWorkVecs()
External Links
- PETSc Manual:
KSP/KSPCreateVecs
PETSc.LibPETSc.KSPDestroy — Method
KSPDestroy(petsclib::PetscLibType,ksp::PetscKSP)Destroys a KSP context.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Level: beginner
-seealso: , KSPCreate(), KSPSetUp(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPDestroy
PETSc.LibPETSc.KSPDestroyDefault — Method
KSPDestroyDefault(petsclib::PetscLibType,ksp::PetscKSP)External Links
- PETSc Manual:
KSP/KSPDestroyDefault
PETSc.LibPETSc.KSPFCGGetMmax — Method
mmax::PetscInt = KSPFCGGetMmax(petsclib::PetscLibType,ksp::PetscKSP)get the maximum number of previous directions KSPFCG will store
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
mmax- the maximum number of previous directions allowed for orthogonalization
Level: intermediate
-seealso: , KSPFCG, KSPFCGGetTruncationType(), KSPFCGGetNprealloc(), KSPFCGSetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGGetMmax
PETSc.LibPETSc.KSPFCGGetNprealloc — Method
nprealloc::PetscInt = KSPFCGGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP)get the number of directions preallocate by KSPFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
nprealloc- the number of directions preallocated
Level: advanced
-seealso: , KSPFCG, KSPFCGGetTruncationType(), KSPFCGSetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGGetNprealloc
PETSc.LibPETSc.KSPFCGGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPFCGGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP)get the truncation strategy employed by KSPFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
Level: intermediate
-seealso: , KSPFCG, KSPFCGSetTruncationType(), KSPFCDTruncationType, KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPFCGGetTruncationType
PETSc.LibPETSc.KSPFCGSetMmax — Method
KSPFCGSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt)set the maximum number of previous directions KSPFCG will store for orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contextmmax- the maximum number of previous directions to orthogonalize against
Options Database Key:
-ksp_fcg_mmax <N>- maximum number of search directions
Level: intermediate
-seealso: , KSPFCG, KSPFCGGetTruncationType(), KSPFCGGetNprealloc(), KSPFCGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGSetMmax
PETSc.LibPETSc.KSPFCGSetNprealloc — Method
KSPFCGSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt)set the number of directions to preallocate with KSPFCG
Logically Collective
Input Parameters:
ksp- the Krylov space contextnprealloc- the number of vectors to preallocate
Options Database Key:
-ksp_fcg_nprealloc <N>- number of directions to preallocate
Level: advanced
-seealso: , KSPFCG, KSPFCGGetTruncationType(), KSPFCGGetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGSetNprealloc
PETSc.LibPETSc.KSPFCGSetTruncationType — Method
KSPFCGSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType)specify how many of its stored previous directions KSPFCG uses during orthoganalization
Logically Collective
Input Parameters:
ksp- the Krylov space contexttruncstrat- the choice of strategy
-seealso: , KSPFCDTruncationType, KSPFCGGetTruncationType(), KSPFCGSetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax(), KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPFCGSetTruncationType
PETSc.LibPETSc.KSPFETIDPGetInnerBDDC — Method
KSPFETIDPGetInnerBDDC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC)Gets the PCBDDC preconditioner used to set up the KSPFETIDP matrix for the Lagrange multipliers
Input Parameter:
ksp- theKSPFETIDPKrylov solver
Output Parameter:
pc- thePCBDDCpreconditioner
Level: advanced
-seealso: , MATIS, PCBDDC, KSPFETIDP, KSPFETIDPSetInnerBDDC(), KSPFETIDPGetInnerKSP()
External Links
- PETSc Manual:
KSP/KSPFETIDPGetInnerBDDC
PETSc.LibPETSc.KSPFETIDPGetInnerKSP — Method
KSPFETIDPGetInnerKSP(petsclib::PetscLibType,ksp::PetscKSP, innerksp::PetscKSP)Gets the KSP object for the Lagrange multipliers from inside a KSPFETIDP
Input Parameter:
ksp- theKSPFETIDP
Output Parameter:
innerksp- theKSPfor the multipliers
Level: advanced
-seealso: , KSPFETIDP, MATIS, PCBDDC, KSPFETIDPSetInnerBDDC(), KSPFETIDPGetInnerBDDC()
External Links
- PETSc Manual:
KSP/KSPFETIDPGetInnerKSP
PETSc.LibPETSc.KSPFETIDPSetInnerBDDC — Method
KSPFETIDPSetInnerBDDC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC)Provides the PCBDDC preconditioner used to set up the KSPFETIDP matrix for the Lagrange multipliers
Collective
Input Parameters:
ksp- theKSPFETIDPKrylov solverpc- thePCBDDCpreconditioner
Level: advanced
-seealso: , MATIS, PCBDDC, KSPFETIDPGetInnerBDDC(), KSPFETIDPGetInnerKSP()
External Links
- PETSc Manual:
KSP/KSPFETIDPSetInnerBDDC
PETSc.LibPETSc.KSPFETIDPSetPressureOperator — Method
KSPFETIDPSetPressureOperator(petsclib::PetscLibType,ksp::PetscKSP, P::PetscMat)Sets the operator used to set up the pressure preconditioner for the saddle point KSPFETIDP solver,
Collective
Input Parameters:
ksp- theKSPFETIDPsolverP- the linear operator to be preconditioned, usually the mass matrix.
Level: advanced
-seealso: , KSPFETIDP, MATIS, PCBDDC, KSPFETIDPGetInnerBDDC(), KSPFETIDPGetInnerKSP(), KSPSetOperators()
External Links
- PETSc Manual:
KSP/KSPFETIDPSetPressureOperator
PETSc.LibPETSc.KSPFGMRESModifyPCKSP — Method
KSPFGMRESModifyPCKSP(petsclib::PetscLibType,ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid)modifies the attributes of the KSPFGMRES preconditioner, see .
Input Parameters:
ksp- the ksp context being used.total_its- the total number ofKSPFGMRESiterations that have occurred.loc_its- the number ofKSPFGMRESiterations since last restart.res_norm- the current residual norm.ctx- context, not used in this routine
Level: intermediate
-seealso: , , KSPFGMRES, KSPFlexibleModifyPCFn, KSPFGMRESSetModifyPC()
External Links
- PETSc Manual:
KSP/KSPFGMRESModifyPCKSP
PETSc.LibPETSc.KSPFGMRESModifyPCNoChange — Method
KSPFGMRESModifyPCNoChange(petsclib::PetscLibType,ksp::PetscKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Cvoid)this is the default used by KSPFMGMRES
Input Parameters:
ksp- the ksp context being used.total_its- the total number ofKSPFGMRESiterations that have occurred.loc_its- the number ofKSPFGMRESiterations since last restart.res_norm- the current residual norm.ctx- context variable, unused in this routine
Level: intermediate
-seealso: , , KSPFGMRES, KSPFlexibleModifyPCFn, KSPFGMRESSetModifyPC(), KSPFGMRESModifyPCKSP()
External Links
- PETSc Manual:
KSP/KSPFGMRESModifyPCNoChange
PETSc.LibPETSc.KSPFGMRESSetModifyPC — Method
KSPFGMRESSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Sets the routine used by KSPFGMRES to modify the preconditioner.
Logically Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()fcn- function to modify thePC, seeKSPFlexibleModifyPCFnctx- optional contextdestroy- optional context destroy routine
Options Database Keys:
-ksp_fgmres_modifypcnochange- do not change thePC-ksp_fgmres_modifypcksp- changes the inner KSP solver tolerances
Level: intermediate
-seealso: , , KSPFGMRES, KSPFlexibleModifyPCFn, KSPFlexibleSetModifyPC(), KSPFGMRESModifyPCNoChange(), KSPFGMRESModifyPCKSP()
External Links
- PETSc Manual:
KSP/KSPFGMRESSetModifyPC
PETSc.LibPETSc.KSPFinalizePackage — Method
KSPFinalizePackage(petsclib::PetscLibType)This function destroys everything in the KSP package. It is called from PetscFinalize().
Level: developer
-seealso: , PetscFinalize(), KSPInitializePackage()
External Links
- PETSc Manual:
KSP/KSPFinalizePackage
PETSc.LibPETSc.KSPFlexibleSetModifyPC — Method
KSPFlexibleSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fcn::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Sets the routine used by flexible KSP methods to modify the preconditioner.
Logically Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()fcn- function to modify thePC, seeKSPFlexibleModifyPCFnctx- optional contextdestroy- optional context destroy routine
Level: intermediate
-seealso: , , KSPFGMRES, KSPFGMRESModifyPCNoChange(), KSPFGMRESModifyPCKSP()
External Links
- PETSc Manual:
KSP/KSPFlexibleSetModifyPC
PETSc.LibPETSc.KSPGCRGetRestart — Method
restart::PetscInt = KSPGCRGetRestart(petsclib::PetscLibType,ksp::PetscKSP)Gets number of iterations at which KSPGCR restarts.
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
restart- integer restart value
Level: intermediate
-seealso: , KSPGCR, KSPSetTolerances(), KSPGCRSetRestart(), KSPGMRESGetRestart()
External Links
- PETSc Manual:
KSP/KSPGCRGetRestart
PETSc.LibPETSc.KSPGCRSetModifyPC — Method
KSPGCRSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Sets the routine used by KSPGCR to modify the preconditioner for each iteration
Logically Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()function- user defined function to modify the preconditioner, seeKSPFlexibleModifyPCFnctx- user provided context for the modify preconditioner functiondestroy- the function to use to destroy the user provided application context.
Level: intermediate
-seealso: , KSP, KSPGCR, KSPFlexibleModifyPCFn, KSPFGMRESModifyPCFn,
External Links
- PETSc Manual:
KSP/KSPGCRSetModifyPC
PETSc.LibPETSc.KSPGCRSetRestart — Method
KSPGCRSetRestart(petsclib::PetscLibType,ksp::PetscKSP, restart::PetscInt)Sets number of iterations at which KSPGCR restarts.
Not Collective
Input Parameters:
ksp- the Krylov space contextrestart- integer restart value
Options Database Key:
-ksp_gcr_restart <restart>- the number of stored vectors to orthogonalize against
Level: intermediate
-seealso: , KSPGCR, KSPSetTolerances(), KSPGCRGetRestart(), KSPGMRESSetRestart()
External Links
- PETSc Manual:
KSP/KSPGCRSetRestart
PETSc.LibPETSc.KSPGLTRGetLambda — Method
lambda::PetscReal = KSPGLTRGetLambda(petsclib::PetscLibType,ksp::PetscKSP)Get the multiplier on the trust
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
lambda- the multiplier
Level: advanced
-seealso: , KSP, KSPGLTR, KSPGLTRGetMinEig()
External Links
- PETSc Manual:
KSP/KSPGLTRGetLambda
PETSc.LibPETSc.KSPGLTRGetMinEig — Method
e_min::PetscReal = KSPGLTRGetMinEig(petsclib::PetscLibType,ksp::PetscKSP)Get minimum eigenvalue computed by KSPGLTR
Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
e_min- the minimum eigenvalue
Level: advanced
-seealso: , KSP, KSPGLTR, KSPGLTRGetLambda()
External Links
- PETSc Manual:
KSP/KSPGLTRGetMinEig
PETSc.LibPETSc.KSPGMRESClassicalGramSchmidtOrthogonalization — Method
KSPGMRESClassicalGramSchmidtOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt)This is the basic orthogonalization routine using classical Gram-Schmidt with possible iterative refinement to improve the stability
Collective, No Fortran Support
Input Parameters:
ksp-KSPobject, must be associated withKSPGMRES,KSPFGMRES, orKSPLGMRESKrylov methodit- one less than the current GMRES restart iteration, i.e. the size of the Krylov space
Options Database Keys:
-ksp_gmres_classicalgramschmidt- ActivatesKSPGMRESClassicalGramSchmidtOrthogonalization()-ksp_gmres_cgs_refinement_type <refine_never,refine_ifneeded,refine_always>- determine if iterative refinement is
used to increase the stability of the classical Gram-Schmidt orthogonalization.
Level: intermediate
-seealso: , KSPGMRESCGSRefinementType, KSPGMRESSetOrthogonalization(), KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSPGMRESGetOrthogonalization(), KSPGMRESModifiedGramSchmidtOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESClassicalGramSchmidtOrthogonalization
PETSc.LibPETSc.KSPGMRESGetCGSRefinementType — Method
type::KSPGMRESCGSRefinementType = KSPGMRESGetCGSRefinementType(petsclib::PetscLibType,ksp::PetscKSP)Gets the type of iterative refinement to use in the classical Gram-Schmidt orthogonalization used by KSPGMRES and other PETSc GMRES implementations.
Not Collective
Input Parameter:
ksp- the Krylov space solver context
Output Parameter:
type- the type of refinement
Level: intermediate
-seealso: , KSPGMRES, KSPGMRESSetOrthogonalization(), KSPGMRESCGSRefinementType, KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetCGSRefinementType(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESGetCGSRefinementType
PETSc.LibPETSc.KSPGMRESGetRestart — Method
restart::PetscInt = KSPGMRESGetRestart(petsclib::PetscLibType,ksp::PetscKSP)Gets number of iterations at which GMRES (KSPGMRES, KSPFGMRES, KSPPGMRES, KSPAGMRES, KSPDGMRES, KSPPIPEFGMRES, and KSPLGMRES) restarts.
Not Collective
Input Parameter:
ksp- the Krylov space solver context
Output Parameter:
restart- integer restart value
Level: intermediate
-seealso: , KSPGMRES, KSPSetTolerances(), KSPGMRESSetOrthogonalization(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetRestart(), KSPFGMRES, KSPLGMRES, KSPPGMRES, KSPAGMRES, KSPDGMRES, KSPPIPEFGMRES
External Links
- PETSc Manual:
KSP/KSPGMRESGetRestart
PETSc.LibPETSc.KSPGMRESModifiedGramSchmidtOrthogonalization — Method
KSPGMRESModifiedGramSchmidtOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt)This is the basic orthogonalization routine using modified Gram-Schmidt.
Collective, No Fortran Support
Input Parameters:
ksp-KSPobject, must be associated withKSPGMRES,KSPFGMRES, orKSPLGMRESKrylov methodit- one less than the current GMRES restart iteration, i.e. the size of the Krylov space
Options Database Key:
-ksp_gmres_modifiedgramschmidt- ActivatesKSPGMRESModifiedGramSchmidtOrthogonalization()
Level: intermediate
-seealso: , KSPGMRESSetOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESModifiedGramSchmidtOrthogonalization
PETSc.LibPETSc.KSPGMRESMonitorKrylov — Method
KSPGMRESMonitorKrylov(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fgnorm::PetscReal, dummy::Cvoid)Calls VecView() to monitor each new direction in the KSPGMRES accumulated Krylov space.
Collective
Input Parameters:
ksp- theKSPcontextits- iteration numberfgnorm- 2-norm of residual (or gradient)dummy- a collection of viewers created withPetscViewersCreate()
Options Database Key:
-ksp_gmres_krylov_monitor <bool>- Plot the Krylov directions
Level: intermediate
-seealso: , KSPGMRES, KSPMonitorSet(), KSPMonitorResidual(), VecView(), PetscViewersCreate(), PetscViewersDestroy()
External Links
- PETSc Manual:
KSP/KSPGMRESMonitorKrylov
PETSc.LibPETSc.KSPGMRESSetBreakdownTolerance — Method
KSPGMRESSetBreakdownTolerance(petsclib::PetscLibType,ksp::PetscKSP, tol::PetscReal)Sets the tolerance for determining divergence breakdown in KSPGMRES at restart.
Logically Collective
Input Parameters:
ksp- the Krylov space solver contexttol- the tolerance
Options Database Key:
-ksp_gmres_breakdown_tolerance <positive real value>- set tolerance for determining divergence breakdown
Level: intermediate
-seealso: , KSPGMRES, KSPSetTolerances(), KSPGMRESSetHapTol(), KSPConvergedReason
External Links
- PETSc Manual:
KSP/KSPGMRESSetBreakdownTolerance
PETSc.LibPETSc.KSPGMRESSetCGSRefinementType — Method
KSPGMRESSetCGSRefinementType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPGMRESCGSRefinementType)Sets the type of iterative refinement to use in the classical Gram-Schmidt orthogonalization used by KSPGMRES and other PETSc GMRES implementations.
Logically Collective
Input Parameters:
ksp- the Krylov space solver contexttype- the type of refinement
-seealso: , KSPGMRES, KSPGMRESSetOrthogonalization(), KSPGMRESCGSRefinementType, KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetCGSRefinementType(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESSetCGSRefinementType
PETSc.LibPETSc.KSPGMRESSetHapTol — Method
KSPGMRESSetHapTol(petsclib::PetscLibType,ksp::PetscKSP, tol::PetscReal)Sets the tolerance for detecting a happy ending in GMRES (KSPGMRES, KSPFGMRES and KSPLGMRES and others)
Logically Collective
Input Parameters:
ksp- the Krylov space solver contexttol- the tolerance for detecting a happy ending
Options Database Key:
-ksp_gmres_haptol <positive real value>- set tolerance for determining happy breakdown
Level: intermediate
-seealso: , KSPGMRES, KSPSetTolerances()
External Links
- PETSc Manual:
KSP/KSPGMRESSetHapTol
PETSc.LibPETSc.KSPGMRESSetOrthogonalization — Method
KSPGMRESSetOrthogonalization(petsclib::PetscLibType,ksp::PetscKSP, fcn::external)Sets the orthogonalization routine used by KSPGMRES and KSPFGMRES.
Logically Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()fcn- orthogonalization function
Calling sequence of fcn:
ksp- the solver contextit- the current iteration
Options Database Keys:
-ksp_gmres_classicalgramschmidt- Activates KSPGMRESClassicalGramSchmidtOrthogonalization() (default)-ksp_gmres_modifiedgramschmidt- Activates KSPGMRESModifiedGramSchmidtOrthogonalization()
Level: intermediate
-seealso: , KSPGMRESSetRestart(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetCGSRefinementType(), KSPGMRESModifiedGramSchmidtOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetCGSRefinementType()
External Links
- PETSc Manual:
KSP/KSPGMRESSetOrthogonalization
PETSc.LibPETSc.KSPGMRESSetPreAllocateVectors — Method
KSPGMRESSetPreAllocateVectors(petsclib::PetscLibType,ksp::PetscKSP)Causes KSPGMRES and KSPFGMRES to preallocate all its needed work vectors at initial setup rather than the default, which is to allocate several at a time when needed.
Logically Collective
Input Parameter:
ksp- iterative context obtained fromKSPCreate()
Options Database Key:
-ksp_gmres_preallocate- ActivatesKSPGmresSetPreAllocateVectors()
Level: intermediate
-seealso: , KSPGMRESSetRestart(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(), VecMDot(), VecMAXPY()
External Links
- PETSc Manual:
KSP/KSPGMRESSetPreAllocateVectors
PETSc.LibPETSc.KSPGMRESSetRestart — Method
KSPGMRESSetRestart(petsclib::PetscLibType,ksp::PetscKSP, restart::PetscInt)Sets number of iterations at which GMRES (KSPGMRES, KSPFGMRES, KSPPGMRES, KSPAGMRES, KSPDGMRES, KSPPIPEFGMRES, and KSPLGMRES) restarts.
Logically Collective
Input Parameters:
ksp- the Krylov space solver contextrestart- integer restart value, this corresponds to the number of iterations of GMRES to perform before restarting
Options Database Key:
-ksp_gmres_restart <positive integer>- integer restart value
Level: intermediate
-seealso: , KSPGMRES, KSPSetTolerances(), KSPGMRESSetOrthogonalization(), KSPGMRESSetPreAllocateVectors(), KSPGMRESGetRestart(), KSPFGMRES, KSPLGMRES, KSPPGMRES, KSPAGMRES, KSPDGMRES, KSPPIPEFGMRES
External Links
- PETSc Manual:
KSP/KSPGMRESSetRestart
PETSc.LibPETSc.KSPGetAndClearConvergenceTest — Method
KSPGetAndClearConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Gets the function to be used to determine convergence. Removes the current test without calling destroy on the test context
Logically Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
converge- pointer to convergence test function, seeKSPConvergenceTestFnctx- context for private data for the convergence routinedestroy- a routine for destroying the context
Level: advanced
-seealso: , KSP, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPSetConvergenceTest(), KSPGetConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetAndClearConvergenceTest
PETSc.LibPETSc.KSPGetApplicationContext — Method
KSPGetApplicationContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::PeCtx)Gets the user
Not Collective
Input Parameter:
ksp-KSPcontext
Output Parameter:
ctx- a pointer to the user context
Level: intermediate
-seealso: , KSP, KSPSetApplicationContext()
External Links
- PETSc Manual:
KSP/KSPGetApplicationContext
PETSc.LibPETSc.KSPGetComputeEigenvalues — Method
flg::PetscBool = KSPGetComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP)Gets the flag indicating that the extreme eigenvalues values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
flg-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , KSPComputeEigenvalues(), KSPComputeEigenvaluesExplicitly(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPGetComputeEigenvalues
PETSc.LibPETSc.KSPGetComputeSingularValues — Method
flg::PetscBool = KSPGetComputeSingularValues(petsclib::PetscLibType,ksp::PetscKSP)Gets the flag indicating whether the extreme singular values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
flg-PETSC_TRUEorPETSC_FALSE
Options Database Key:
-ksp_monitor_singular_value- ActivatesKSPSetComputeSingularValues()
Level: advanced
-seealso: , KSPComputeExtremeSingularValues(), KSPMonitorSingularValue(), KSP
External Links
- PETSc Manual:
KSP/KSPGetComputeSingularValues
PETSc.LibPETSc.KSPGetConvergedNegativeCurvature — Method
flg::PetscBool = KSPGetConvergedNegativeCurvature(petsclib::PetscLibType,ksp::PetscKSP)Get the flag to declare convergence if negative curvature is detected
Collective
Input Parameter:
ksp- iterative context
Output Parameter:
flg- the Boolean value
Level: advanced
-seealso: , KSP, KSPConvergedReason, KSPSetConvergedNegativeCurvature()
External Links
- PETSc Manual:
KSP/KSPGetConvergedNegativeCurvature
PETSc.LibPETSc.KSPGetConvergedReason — Method
reason::KSPConvergedReason = KSPGetConvergedReason(petsclib::PetscLibType,ksp::PetscKSP)Gets the reason the KSP iteration was stopped.
Not Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
reason- negative value indicates diverged, positive value converged, seeKSPConvergedReasonfor the possible values
Options Database Key:
-ksp_converged_reason- prints the reason to standard out when the solve ends
Level: intermediate
-seealso: , KSPConvergedReason, KSP, KSPSetConvergenceTest(), KSPConvergedDefault(), KSPSetTolerances(), KSPConvergedReasonView(), KSPGetConvergedReasonString()
External Links
- PETSc Manual:
KSP/KSPGetConvergedReason
PETSc.LibPETSc.KSPGetConvergedReasonString — Method
KSPGetConvergedReasonString(petsclib::PetscLibType,ksp::PetscKSP, strreason::String)Return a human readable string for a KSPConvergedReason
Not Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
strreason- a human readable string that describes ksp converged reason
Level: beginner
-seealso: , KSP, KSPGetConvergedReason()
External Links
- PETSc Manual:
KSP/KSPGetConvergedReasonString
PETSc.LibPETSc.KSPGetConvergenceContext — Method
KSPGetConvergenceContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid)Gets the convergence context set with KSPSetConvergenceTest().
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
ctx- monitoring context
Level: advanced
-seealso: , KSP, KSPConvergedDefault(), KSPSetConvergenceTest(), KSPGetConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetConvergenceContext
PETSc.LibPETSc.KSPGetConvergenceTest — Method
KSPGetConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Gets the function to be used to determine convergence.
Logically Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
converge- pointer to convergence test function, seeKSPConvergenceTestFnctx- context for private data for the convergence routine (may beNULL)destroy- a routine for destroying the context (may beNULL)
Level: advanced
-seealso: , KSP, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPSetConvergenceTest(), KSPGetAndClearConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetConvergenceTest
PETSc.LibPETSc.KSPGetDM — Method
dm::PetscDM = KSPGetDM(petsclib::PetscLibType,ksp::PetscKSP)Gets the DM that may be used by some preconditioners and that may be used to construct the linear system
Not Collective
Input Parameter:
ksp- theKSP
Output Parameter:
dm- theDM
Level: intermediate
-seealso: , KSP, DM, KSPSetDM(), KSPSetDMActive()
External Links
- PETSc Manual:
KSP/KSPGetDM
PETSc.LibPETSc.KSPGetDiagonalScale — Method
scale::PetscBool = KSPGetDiagonalScale(petsclib::PetscLibType,ksp::PetscKSP)Checks if KSP solver scales the matrix and right
Not Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
scale-PETSC_TRUEorPETSC_FALSE
Level: intermediate
-seealso: , KSP, KSPSetDiagonalScale(), KSPSetDiagonalScaleFix()
External Links
- PETSc Manual:
KSP/KSPGetDiagonalScale
PETSc.LibPETSc.KSPGetDiagonalScaleFix — Method
fix::PetscBool = KSPGetDiagonalScaleFix(petsclib::PetscLibType,ksp::PetscKSP)Determines if KSP diagonally scales the system back after solving. That is KSPSetDiagonalScaleFix() has been called
Not Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
fix-PETSC_TRUEto scale back after the system solve,PETSC_FALSEto not
rescale (default)
Level: intermediate
-seealso: , KSPGetDiagonalScale(), KSPSetDiagonalScale(), KSPSetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPGetDiagonalScaleFix
PETSc.LibPETSc.KSPGetErrorHistory — Method
a::Vector{PetscReal},na::PetscInt = KSPGetErrorHistory(petsclib::PetscLibType,ksp::PetscKSP)Gets the array used to hold the error history and the number of residuals it contains.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
a- pointer to array to hold history (orNULL)na- number of used entries in a (orNULL)
Level: advanced
-seealso: , KSPSetErrorHistory(), KSPGetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPGetErrorHistory
PETSc.LibPETSc.KSPGetErrorIfNotConverged — Method
flag::PetscBool = KSPGetErrorIfNotConverged(petsclib::PetscLibType,ksp::PetscKSP)Will KSPSolve() generate an error if the solver does not converge?
Not Collective
Input Parameter:
ksp- iterative solver obtained from KSPCreate()
Output Parameter:
flag-PETSC_TRUEif it will generate an error, elsePETSC_FALSE
Level: intermediate
-seealso: , KSPSetErrorIfNotConverged(), KSP
External Links
- PETSc Manual:
KSP/KSPGetErrorIfNotConverged
PETSc.LibPETSc.KSPGetGuess — Method
KSPGetGuess(petsclib::PetscLibType,ksp::PetscKSP, guess::KSPGuess)Gets the initial guess generator for the KSP.
Not Collective
Input Parameter:
ksp- the Krylov context
Output Parameter:
guess- the object
Level: developer
-seealso: , KSPGuess, KSP, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetUseFischerGuess(), KSPSetGuess()
External Links
- PETSc Manual:
KSP/KSPGetGuess
PETSc.LibPETSc.KSPGetInitialGuessKnoll — Method
flag::PetscBool = KSPGetInitialGuessKnoll(petsclib::PetscLibType,ksp::PetscKSP)Determines whether the KSP solver is using the Knoll trick (using PCApply(pc,b,...) to compute the initial guess
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
flag-PETSC_TRUEif using Knoll trick, elsePETSC_FALSE
Level: advanced
-seealso: , KSPSetInitialGuessKnoll(), KSPSetInitialGuessNonzero(), KSPGetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPGetInitialGuessKnoll
PETSc.LibPETSc.KSPGetInitialGuessNonzero — Method
flag::PetscBool = KSPGetInitialGuessNonzero(petsclib::PetscLibType,ksp::PetscKSP)Determines whether the KSP solver is using a zero initial guess.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
flag-PETSC_TRUEif guess is nonzero, elsePETSC_FALSE
Level: intermediate
-seealso: , KSPSetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPGetInitialGuessNonzero
PETSc.LibPETSc.KSPGetIterationNumber — Method
its::PetscInt = KSPGetIterationNumber(petsclib::PetscLibType,ksp::PetscKSP)Gets the current iteration number; if the KSPSolve() is complete, returns the number of iterations used.
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
its- number of iterations
Level: intermediate
-seealso: , KSP, KSPGetResidualNorm(), KSPBuildResidual(), KSPGetTotalIterations()
External Links
- PETSc Manual:
KSP/KSPGetIterationNumber
PETSc.LibPETSc.KSPGetMatSolveBatchSize — Method
bs::PetscInt = KSPGetMatSolveBatchSize(petsclib::PetscLibType,ksp::PetscKSP)Gets the maximum number of columns treated simultaneously in KSPMatSolve().
Input Parameter:
ksp- iterative solver context
Output Parameter:
bs- batch size
Level: advanced
-seealso: , KSPMatSolve(), KSPSetMatSolveBatchSize(), -mat_mumps_icntl_27, -matmatmult_Bbn
External Links
- PETSc Manual:
KSP/KSPGetMatSolveBatchSize
PETSc.LibPETSc.KSPGetMinimumIterations — Method
minit::PetscInt = KSPGetMinimumIterations(petsclib::PetscLibType,ksp::PetscKSP)Gets the minimum number of iterations to use, regardless of the tolerances, that was set with KSPSetMinimumIterations() or `
Not Collective
Input Parameter:
ksp- the Krylov subspace context
Output Parameter:
minit- minimum number of iterations to use
Level: intermediate
-seealso: , KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetTolerances(), KSPSetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPGetMinimumIterations
PETSc.LibPETSc.KSPGetMonitorContext — Method
KSPGetMonitorContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid)Gets the monitoring context, as set by KSPMonitorSet() for the FIRST monitor only.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
ctx- monitoring context
Level: intermediate
-seealso: , KSPMonitorResidual(), KSP
External Links
- PETSc Manual:
KSP/KSPGetMonitorContext
PETSc.LibPETSc.KSPGetNestLevel — Method
level::PetscInt = KSPGetNestLevel(petsclib::PetscLibType,ksp::PetscKSP)gets the amount of nesting the KSP has
Not Collective
Input Parameter:
ksp- theKSP
Output Parameter:
level- the nest level
Level: developer
-seealso: , KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPGMRES, KSPType, KSPSetNestLevel(), PCSetKSPNestLevel(), PCGetKSPNestLevel()
External Links
- PETSc Manual:
KSP/KSPGetNestLevel
PETSc.LibPETSc.KSPGetNormType — Method
normtype::KSPNormType = KSPGetNormType(petsclib::PetscLibType,ksp::PetscKSP)Gets the KSPNormType that is used for convergence testing during KSPSolve() for this KSP context
Not Collective
Input Parameter:
ksp- Krylov solver context
Output Parameter:
normtype- theKSPNormTypethat is used for convergence testing
Level: advanced
-seealso: , KSPNormType, KSPSetNormType(), KSPConvergedSkip()
External Links
- PETSc Manual:
KSP/KSPGetNormType
PETSc.LibPETSc.KSPGetOperators — Method
Amat, PMat = KSPGetOperators(petsclib::PetscLibType,ksp::PetscKSP)Gets the matrix associated with the linear system and a (possibly) different one used to construct the preconditioner from the KSP context
Collective
Input Parameter:
ksp- theKSPcontext
Output Parameters:
Amat- the matrix that defines the linear systemPmat- the matrix to be used in constructing the preconditioner, usually the same asAmat.
Level: intermediate
-seealso: , KSP, KSPSolve(), KSPGetPC(), PCSetOperators(), KSPSetOperators(), KSPGetOperatorsSet()
External Links
- PETSc Manual:
KSP/KSPGetOperators
PETSc.LibPETSc.KSPGetOperatorsSet — Method
mat::PetscBool,pmat::PetscBool = KSPGetOperatorsSet(petsclib::PetscLibType,ksp::PetscKSP)Determines if the matrix associated with the linear system and possibly a different one from which the preconditioner will be built have been set in the KSP with KSPSetOperators()
Not Collective, though the results on all processes will be the same
Input Parameter:
ksp- theKSPcontext
Output Parameters:
mat- the matrix associated with the linear system was setpmat- matrix from which the preconditioner will be built, usually the same asmatwas set
Level: intermediate
-seealso: , KSP, PCSetOperators(), KSPGetOperators(), KSPSetOperators(), PCGetOperators(), PCGetOperatorsSet()
External Links
- PETSc Manual:
KSP/KSPGetOperatorsSet
PETSc.LibPETSc.KSPGetOptionsPrefix — Method
prefix::String = KSPGetOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP)Gets the prefix used for searching for all KSP options in the database.
Not Collective
Input Parameter:
ksp- the Krylov context
Output Parameter:
prefix- pointer to the prefix string used is returned
Level: advanced
-seealso: , KSP, KSPSetFromOptions(), KSPSetOptionsPrefix(), KSPAppendOptionsPrefix()
External Links
- PETSc Manual:
KSP/KSPGetOptionsPrefix
PETSc.LibPETSc.KSPGetPC — Method
KSPGetPC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC)Returns a pointer to the preconditioner context with the KSP
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
pc- preconditioner context
Level: beginner
-seealso: , KSPSetPC(), KSP, PC
External Links
- PETSc Manual:
KSP/KSPGetPC
PETSc.LibPETSc.KSPGetPCSide — Method
KSPGetPCSide(petsclib::PetscLibType,ksp::PetscKSP, side::PCSide)Gets the preconditioning side.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
side- the preconditioning side, where side is one of
-seealso: , KSPSetPCSide(), KSP
External Links
- PETSc Manual:
KSP/KSPGetPCSide
PETSc.LibPETSc.KSPGetResidualHistory — Method
a::Vector{PetscReal},na::PetscInt = KSPGetResidualHistory(petsclib::PetscLibType,ksp::PetscKSP)Gets the array used to hold the residual history and the number of residuals it contains.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameters:
a- pointer to array to hold history (orNULL)na- number of used entries in a (orNULL). Note this has different meanings depending on theresetargument toKSPSetResidualHistory()
Level: advanced
-seealso: , KSPSetResidualHistory(), KSP, KSPGetIterationNumber(), KSPSTCG, KSPBCGSL
External Links
- PETSc Manual:
KSP/KSPGetResidualHistory
PETSc.LibPETSc.KSPGetResidualNorm — Method
rnorm::PetscReal = KSPGetResidualNorm(petsclib::PetscLibType,ksp::PetscKSP)Gets the last (possibly approximate and/or preconditioned) residual norm that has been computed.
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
rnorm- residual norm
Level: intermediate
-seealso: , KSP, KSPSetNormType(), KSPBuildResidual(), KSPNormType
External Links
- PETSc Manual:
KSP/KSPGetResidualNorm
PETSc.LibPETSc.KSPGetReusePreconditioner — Method
flag::PetscBool = KSPGetReusePreconditioner(petsclib::PetscLibType,ksp::PetscKSP)Determines if the KSP reuses the current preconditioner even if the Mat operator in the KSP has changed.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
flag- the boolean flag indicating if the current preconditioner should be reused
Level: intermediate
-seealso: , KSPCreate(), KSPSolve(), KSPDestroy(), KSPSetReusePreconditioner(), KSP
External Links
- PETSc Manual:
KSP/KSPGetReusePreconditioner
PETSc.LibPETSc.KSPGetRhs — Method
r::PetscVec = KSPGetRhs(petsclib::PetscLibType,ksp::PetscKSP)Gets the right be solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
r- right-hand-side vector
Level: developer
-seealso: , KSPGetSolution(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPGetRhs
PETSc.LibPETSc.KSPGetSolution — Method
v::PetscVec = KSPGetSolution(petsclib::PetscLibType,ksp::PetscKSP)Gets the location of the solution for the linear system to be solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Return Value:
v- solution vector
Level: developer
-seealso: , KSPGetRhs(), KSPBuildSolution(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPGetSolution
PETSc.LibPETSc.KSPGetTolerances — Method
rtol::PetscReal,abstol::PetscReal,dtol::PetscReal,maxits::PetscInt = KSPGetTolerances(petsclib::PetscLibType,ksp::PetscKSP)Gets the relative, absolute, divergence, and maximum iteration tolerances used by the default KSP convergence tests.
Not Collective
Input Parameter:
ksp- the Krylov subspace context
Output Parameters:
rtol- the relative convergence toleranceabstol- the absolute convergence tolerancedtol- the divergence tolerancemaxits- maximum number of iterations
Level: intermediate
-seealso: , KSPSetTolerances(), KSP, KSPSetMinimumIterations(), KSPGetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPGetTolerances
PETSc.LibPETSc.KSPGetTotalIterations — Method
its::PetscInt = KSPGetTotalIterations(petsclib::PetscLibType,ksp::PetscKSP)Gets the total number of iterations this KSP object has performed since was created, counted over all linear solves
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
its- total number of iterations
Level: intermediate
-seealso: , KSP, KSPBuildResidual(), KSPGetResidualNorm(), KSPGetIterationNumber()
External Links
- PETSc Manual:
KSP/KSPGetTotalIterations
PETSc.LibPETSc.KSPGetType — Method
type::KSPType = KSPGetType(petsclib::PetscLibType,ksp::PetscKSP)Gets the KSP type as a string from the KSP object.
Not Collective
Input Parameter:
ksp- Krylov context
Output Parameter:
type- name of theKSPmethod
Level: intermediate
-seealso: , KSPType, KSP, KSPSetType()
External Links
- PETSc Manual:
KSP/KSPGetType
PETSc.LibPETSc.KSPHPDDMGetDeflationMat — Method
KSPHPDDMGetDeflationMat(petsclib::PetscLibType,ksp::PetscKSP, U::PetscMat)External Links
- PETSc Manual:
KSP/KSPHPDDMGetDeflationMat
PETSc.LibPETSc.KSPHPDDMGetType — Method
type::KSPHPDDMType = KSPHPDDMGetType(petsclib::PetscLibType,ksp::PetscKSP)External Links
- PETSc Manual:
KSP/KSPHPDDMGetType
PETSc.LibPETSc.KSPHPDDMSetDeflationMat — Method
KSPHPDDMSetDeflationMat(petsclib::PetscLibType,ksp::PetscKSP, U::PetscMat)External Links
- PETSc Manual:
KSP/KSPHPDDMSetDeflationMat
PETSc.LibPETSc.KSPHPDDMSetType — Method
KSPHPDDMSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPHPDDMType)External Links
- PETSc Manual:
KSP/KSPHPDDMSetType
PETSc.LibPETSc.KSPInitialResidual — Method
KSPInitialResidual(petsclib::PetscLibType,ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec, vt2::PetscVec, vres::PetscVec, vb::PetscVec)Computes the residual. Either b preconditioning or C(b - Ax) with left preconditioning; the latter residual is often called the "preconditioned residual".
Collective
Input Parameters:
ksp- theKSPsolver objectvsoln- solution to use in computing residualvt1- temporary work vectorvt2- temporary work vectorvb- right-hand-side vector
Output Parameter:
vres- calculated residual
Level: developer
-seealso: , KSP, KSPSolve(), KSPMonitor()
External Links
- PETSc Manual:
KSP/KSPInitialResidual
PETSc.LibPETSc.KSPInitializePackage — Method
KSPInitializePackage(petsclib::PetscLibType)This function initializes everything in the KSP package. It is called from PetscDLLibraryRegister_petscksp() when using dynamic libraries, and on the first call to KSPCreate() when using shared or static libraries.
Level: developer
-seealso: , PetscInitialize(), KSPFinalizePackage()
External Links
- PETSc Manual:
KSP/KSPInitializePackage
PETSc.LibPETSc.KSPLGMRESSetAugDim — Method
KSPLGMRESSetAugDim(petsclib::PetscLibType,ksp::PetscKSP, dim::PetscInt)Set the number of error approximations to include in the approximation space (default is 2) for KSPLGMRES
Collective
Input Parameters:
ksp- theKSPcontextdim- the number of vectors to use
Options Database Key:
-ksp_lgmres_augment dim- the number of error approximations to include
Level: intermediate
-seealso: , KSPLGMRES, KSPLGMRESSetConstant()
External Links
- PETSc Manual:
KSP/KSPLGMRESSetAugDim
PETSc.LibPETSc.KSPLGMRESSetConstant — Method
KSPLGMRESSetConstant(petsclib::PetscLibType,ksp::PetscKSP)keep the error approximation space a constant size for every restart cycle
Collective
Input Parameters:
ksp- theKSPcontext
Options Database Key:
-ksp_lgmres_constant- set the size to be constant
Level: intermediate
-seealso: , KSPLGMRES, KSPLGMRESSetAugDim()
External Links
- PETSc Manual:
KSP/KSPLGMRESSetConstant
PETSc.LibPETSc.KSPLSQRConvergedDefault — Method
KSPLSQRConvergedDefault(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, reason::KSPConvergedReason, ctx::Cvoid)Determines convergence of the KSPLSQR Krylov method, including a check on the residual norm of the normal equations.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm residual value (may be estimated)ctx- convergence context which must have been created byKSPConvergedDefaultCreate()
Output Parameter:
reason- the convergence reason
Level: advanced
-seealso: , KSPLSQR, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultCreate(), KSPConvergedDefaultDestroy(), KSPConvergedDefault(), KSPLSQRGetNorms(), KSPLSQRSetExactMatNorm()
External Links
- PETSc Manual:
KSP/KSPLSQRConvergedDefault
PETSc.LibPETSc.KSPLSQRGetNorms — Method
arnorm::PetscReal,anorm::PetscReal = KSPLSQRGetNorms(petsclib::PetscLibType,ksp::PetscKSP)Get the norm estimates that KSPLSQR computes internally during KSPSolve().
Not Collective
Input Parameter:
ksp- iterative context
Output Parameters:
arnorm- good estimate of (APmat^{-T})r, where r = A x - b, used in specific stopping criterionanorm- poor estimate of A*Pmat^{-T}_{frobenius} used in specific stopping criterion
Level: intermediate
-seealso: , KSPSolve(), KSPLSQR, KSPLSQRSetExactMatNorm()
External Links
- PETSc Manual:
KSP/KSPLSQRGetNorms
PETSc.LibPETSc.KSPLSQRGetStandardErrorVec — Method
KSPLSQRGetStandardErrorVec(petsclib::PetscLibType,ksp::PetscKSP, se::PetscVec)Get vector of standard error estimates. Only available if -ksplsqrsetstandarderror was set to true or KSPLSQRSetComputeStandardErrorVec(ksp, PETSC_TRUE) was called. Otherwise returns NULL.
Not Collective
Input Parameter:
ksp- iterative context
Output Parameter:
se- vector of standard estimates
Level: intermediate
-seealso: , KSPSolve(), KSPLSQR, KSPLSQRSetComputeStandardErrorVec()
External Links
- PETSc Manual:
KSP/KSPLSQRGetStandardErrorVec
PETSc.LibPETSc.KSPLSQRMonitorResidual — Method
KSPLSQRMonitorResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the residual norm, as well as the normal equation residual norm, at each iteration of an iterative solver for the KSPLSQR solver
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_lsqr_monitor- ActivatesKSPLSQRMonitorResidual()
Level: intermediate
-seealso: , KSPLSQR, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), KSPLSQRMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidual
PETSc.LibPETSc.KSPLSQRMonitorResidualDrawLG — Method
KSPLSQRMonitorResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the true residual norm at each iteration of an iterative solver for the KSPLSQR solver
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_lsqr_monitor draw::draw_lg- ActivatesKSPMonitorTrueResidualDrawLG()
Level: intermediate
-seealso: , KSPLSQR, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPLSQRMonitorResidual(), KSPLSQRMonitorResidualDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidualDrawLG
PETSc.LibPETSc.KSPLSQRMonitorResidualDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPLSQRMonitorResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the line graph object for the KSPLSQR residual and normal equation residual norm
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional user context
Output Parameter:
vf- ThePetscViewerAndFormat
Level: intermediate
-seealso: , KSPLSQR, KSPMonitorSet(), KSPLSQRMonitorResidual(), KSPLSQRMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidualDrawLGCreate
PETSc.LibPETSc.KSPLSQRSetComputeStandardErrorVec — Method
KSPLSQRSetComputeStandardErrorVec(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Compute a vector of standard error estimates during KSPSolve() for KSPLSQR.
Logically Collective
Input Parameters:
ksp- iterative contextflg- compute the vector of standard estimates or not
Level: intermediate
-seealso: , KSPSolve(), KSPLSQR, KSPLSQRGetStandardErrorVec()
External Links
- PETSc Manual:
KSP/KSPLSQRSetComputeStandardErrorVec
PETSc.LibPETSc.KSPLSQRSetExactMatNorm — Method
KSPLSQRSetExactMatNorm(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Compute exact matrix norm instead of iteratively refined estimate.
Not Collective
Input Parameters:
ksp- iterative contextflg- compute exact matrix norm or not
Level: intermediate
-seealso: , KSPSolve(), KSPLSQR, KSPLSQRGetNorms(), KSPLSQRConvergedDefault()
External Links
- PETSc Manual:
KSP/KSPLSQRSetExactMatNorm
PETSc.LibPETSc.KSPLoad — Method
KSPLoad(petsclib::PetscLibType,newdm::PetscKSP, viewer::PetscViewer)Loads a KSP that has been stored in a PETSCVIEWERBINARY with KSPView().
Collective
Input Parameters:
newdm- the newly loadedKSP, this needs to have been created withKSPCreate()or
some related function before a call to KSPLoad().
viewer- binary file viewer, obtained fromPetscViewerBinaryOpen()
Level: intermediate
-seealso: , KSP, PetscViewerBinaryOpen(), KSPView(), MatLoad(), VecLoad()
External Links
- PETSc Manual:
KSP/KSPLoad
PETSc.LibPETSc.KSPMINRESGetUseQLP — Method
qlp::PetscBool = KSPMINRESGetUseQLP(petsclib::PetscLibType,ksp::PetscKSP)Get the flag that indicates if the QLP variant is being used
Logically Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
qlp- a Boolean indicating if the QLP variant is used
Level: beginner
-seealso: , KSP, KSPMINRES, KSPMINRESSetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESGetUseQLP
PETSc.LibPETSc.KSPMINRESSetRadius — Method
KSPMINRESSetRadius(petsclib::PetscLibType,ksp::PetscKSP, radius::PetscReal)Set the maximum solution norm allowed for use with trust region methods
Logically Collective
Input Parameters:
ksp- the iterative contextradius- the value
Level: beginner
Options Database Key:
-ksp_minres_radius <real>- maximum allowed solution norm
-seealso: , KSP, KSPMINRES, KSPMINRESSetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESSetRadius
PETSc.LibPETSc.KSPMINRESSetUseQLP — Method
KSPMINRESSetUseQLP(petsclib::PetscLibType,ksp::PetscKSP, qlp::PetscBool)Use the QLP variant of KSPMINRES
Logically Collective
Input Parameters:
ksp- the iterative contextqlp- a Boolean indicating if the QLP variant should be used
Level: beginner
-seealso: , KSP, KSPMINRES, KSPMINRESGetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESSetUseQLP
PETSc.LibPETSc.KSPMatSolve — Method
KSPMatSolve(petsclib::PetscLibType,ksp::PetscKSP, B::PetscMat, X::PetscMat)Solves a linear system with multiple right
Input Parameters:
ksp- iterative solverB- block of right-hand sides
Output Parameter:
X- block of solutions
Level: intermediate
-seealso: , KSPSolve(), MatMatSolve(), KSPMatSolveTranspose(), MATDENSE, KSPHPDDM, PCBJACOBI, PCASM, KSPSetMatSolveBatchSize()
External Links
- PETSc Manual:
KSP/KSPMatSolve
PETSc.LibPETSc.KSPMatSolveTranspose — Method
KSPMatSolveTranspose(petsclib::PetscLibType,ksp::PetscKSP, B::PetscMat, X::PetscMat)Solves a linear system with the transposed matrix with multiple right
Input Parameters:
ksp- iterative solverB- block of right-hand sides
Output Parameter:
X- block of solutions
Level: intermediate
-seealso: , KSPSolveTranspose(), MatMatTransposeSolve(), KSPMatSolve(), MATDENSE, KSPHPDDM, PCBJACOBI, PCASM
External Links
- PETSc Manual:
KSP/KSPMatSolveTranspose
PETSc.LibPETSc.KSPMonitor — Method
KSPMonitor(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt, rnorm::PetscReal)runs the user provided monitor routines, if they exist
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()it- iteration numberrnorm- relative norm of the residual
Level: developer
External Links
- PETSc Manual:
KSP/KSPMonitor
PETSc.LibPETSc.KSPMonitorCancel — Method
KSPMonitorCancel(petsclib::PetscLibType,ksp::PetscKSP)Clears all monitors for a KSP object.
Logically Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Options Database Key:
-ksp_monitor_cancel- Cancels all monitors that have been hardwired into a code by calls toKSPMonitorSet(), but does not cancel those set via the options database.
Level: intermediate
-seealso: , KSPMonitorResidual(), KSPMonitorSet(), KSP
External Links
- PETSc Manual:
KSP/KSPMonitorCancel
PETSc.LibPETSc.KSPMonitorDynamicTolerance — Method
KSPMonitorDynamicTolerance(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, ctx::Cvoid)A monitor that changes the inner tolerance of nested preconditioners in every outer iteration in an adaptive way.
Collective
Input Parameters:
ksp- iterative contextits- iteration number (not used)fnorm- the current residual normctx- context used by monitor
Options Database Key:
-sub_ksp_dynamic_tolerance <coef>- coefficient of dynamic tolerance for inner solver, default is 1.0
Level: advanced
-seealso: , KSP, KSPMonitorDynamicToleranceCreate(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceSetCoefficient()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicTolerance
PETSc.LibPETSc.KSPMonitorDynamicToleranceCreate — Method
ctx::Cvoid = KSPMonitorDynamicToleranceCreate(petsclib::PetscLibType)Creates the context used by KSPMonitorDynamicTolerance()
Logically Collective
Output Parameter:
ctx- a void pointer
Options Database Key:
-sub_ksp_dynamic_tolerance <coef>- coefficient of dynamic tolerance for inner solver, default is 1.0
Level: advanced
-seealso: , KSP, KSPMonitorDynamicTolerance(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceSetCoefficient()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceCreate
PETSc.LibPETSc.KSPMonitorDynamicToleranceDestroy — Method
KSPMonitorDynamicToleranceDestroy(petsclib::PetscLibType,ctx::Cvoid)Destroy the monitor context used in KSPMonitorDynamicTolerance()
Input Parameter:
ctx- the monitor context
Level: advanced
-seealso: , KSP, KSPMonitorDynamicTolerance(), KSPMonitorSet(), KSPMonitorDynamicToleranceCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceDestroy
PETSc.LibPETSc.KSPMonitorDynamicToleranceSetCoefficient — Method
coeff::PetscReal = KSPMonitorDynamicToleranceSetCoefficient(petsclib::PetscLibType,ctx::Cvoid)Sets the coefficient in the context used by KSPMonitorDynamicTolerance()
Logically Collective
Output Parameters:
ctx- the context forKSPMonitorDynamicTolerance()coeff- the coefficient, default is 1.0
Options Database Key:
-sub_ksp_dynamic_tolerance <coef>- coefficient of dynamic tolerance for inner solver, default is 1.0
Level: advanced
-seealso: , KSP, KSPMonitorDynamicTolerance(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceSetCoefficient
PETSc.LibPETSc.KSPMonitorError — Method
KSPMonitorError(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the error norm, as well as the (possibly preconditioned) residual norm, at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_error- ActivatesKSPMonitorError()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm()
External Links
- PETSc Manual:
KSP/KSPMonitorError
PETSc.LibPETSc.KSPMonitorErrorDraw — Method
KSPMonitorErrorDraw(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the error at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_error draw- ActivatesKSPMonitorErrorDraw()
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDraw
PETSc.LibPETSc.KSPMonitorErrorDrawLG — Method
KSPMonitorErrorDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the error and residual norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_error draw::draw_lg- ActivatesKSPMonitorTrueResidualDrawLG()
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDraw()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDrawLG
PETSc.LibPETSc.KSPMonitorErrorDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPMonitorErrorDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the context for the error and preconditioned residual plotter KSPMonitorErrorDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDrawLGCreate
PETSc.LibPETSc.KSPMonitorLGRange — Method
KSPMonitorLGRange(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, monctx::Cvoid)External Links
- PETSc Manual:
KSP/KSPMonitorLGRange
PETSc.LibPETSc.KSPMonitorRegister — Method
KSPMonitorRegister(petsclib::PetscLibType,name::String, vtype::PetscViewerType, format::PetscViewerFormat, monitor::KSPMonitorRegisterFn, create::KSPMonitorRegisterCreateFn, destroy::KSPMonitorRegisterDestroyFn)Registers a Krylov subspace solver monitor routine that may be accessed with KSPMonitorSetFromOptions()
Not Collective
Input Parameters:
name- name of a new monitor typevtype- APetscViewerTypefor the outputformat- APetscViewerFormatfor the outputmonitor- Monitor routine, seeKSPMonitorRegisterFncreate- Creation routine, orNULLdestroy- Destruction routine, orNULL
Level: advanced
-seealso: , KSP, KSPMonitorSet(), KSPMonitorRegisterAll(), KSPMonitorSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPMonitorRegister
PETSc.LibPETSc.KSPMonitorResidual — Method
KSPMonitorResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Print the (possibly preconditioned, possibly approximate) residual norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- (preconditioned) residual norm value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor- ActivatesKSPMonitorResidual()to print the norm value at each iteration
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidualView(), KSPMonitorResidualDrawLG(), KSPMonitorResidualRange(), KSPMonitorTrueResidualDraw(), KSPMonitorTrueResidualDrawLG(), KSPMonitorTrueResidualMax(), KSPMonitorSingularValue(), KSPMonitorSolutionDrawLG(), KSPMonitorSolutionDraw(), KSPMonitorSolution(), KSPMonitorErrorDrawLG(), KSPMonitorErrorDraw(), KSPMonitorError()
External Links
- PETSc Manual:
KSP/KSPMonitorResidual
PETSc.LibPETSc.KSPMonitorResidualDrawLG — Method
KSPMonitorResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the (possibly preconditioned) residual norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor draw::draw_lg- ActivatesKSPMonitorResidualDrawLG()
Level: intermediate
-seealso: , KSP, PETSCVIEWERDRAW, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidualView(), KSPMonitorResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualDrawLG
PETSc.LibPETSc.KSPMonitorResidualDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPMonitorResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the context for the (possibly preconditioned) residual norm monitor KSPMonitorResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerof typePETSCVIEWERDRAWformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , KSP, PETSCVIEWERDRAW, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidualDrawLG(), PetscViewerFormat, PetscViewer, PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorResidualRange — Method
KSPMonitorResidualRange(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the percentage of residual elements that are more than 10 percent of the maximum value.
Collective
Input Parameters:
ksp- iterative contextit- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_range- ActivatesKSPMonitorResidualRange()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualRange
PETSc.LibPETSc.KSPMonitorResidualShort — Method
KSPMonitorResidualShort(petsclib::PetscLibType,ksp::PetscKSP, its::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat)External Links
- PETSc Manual:
KSP/KSPMonitorResidualShort
PETSc.LibPETSc.KSPMonitorResidualView — Method
KSPMonitorResidualView(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the (possibly preconditioned) residual at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor viewertype- ActivatesKSPMonitorResidualView()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidual(), KSPMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualView
PETSc.LibPETSc.KSPMonitorSAWs — Method
KSPMonitorSAWs(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, ctx::Cvoid)monitor KSP solution using SAWs
Logically Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).ctx- created withKSPMonitorSAWsCreate()
Level: advanced
-seealso: , KSP, KSPMonitorSet(), KSPMonitorSAWsCreate(), KSPMonitorSAWsDestroy(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), PetscViewerSAWsOpen()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWs
PETSc.LibPETSc.KSPMonitorSAWsCreate — Method
ctx::Cvoid = KSPMonitorSAWsCreate(petsclib::PetscLibType,ksp::PetscKSP)create an SAWs monitor context for KSP
Collective
Input Parameter:
ksp-KSPto monitor
Output Parameter:
ctx- context for monitor
Level: developer
-seealso: , KSP, KSPMonitorSet(), KSPMonitorSAWs(), KSPMonitorSAWsDestroy()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWsCreate
PETSc.LibPETSc.KSPMonitorSAWsDestroy — Method
KSPMonitorSAWsDestroy(petsclib::PetscLibType,ctx::Cvoid)destroy a monitor context created with KSPMonitorSAWsCreate()
Collective
Input Parameter:
ctx- monitor context
Level: developer
-seealso: , KSP, KSPMonitorSet(), KSPMonitorSAWsCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWsDestroy
PETSc.LibPETSc.KSPMonitorSNESResidual — Method
KSPMonitorSNESResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the SNES residual norm, as well as the KSP residual norm, at each iteration of a KSPSolve() called within a SNESSolve().
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-snes_monitor_ksp- ActivatesKSPMonitorSNESResidual()
Level: intermediate
-seealso: , SNES, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), KSPMonitor(), SNESMonitor(), PetscViewerAndFormat()
External Links
- PETSc Manual:
Snes/KSPMonitorSNESResidual
PETSc.LibPETSc.KSPMonitorSNESResidualDrawLG — Method
KSPMonitorSNESResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the linear KSP residual norm and the SNES residual norm of a KSPSolve() called within a SNESSolve().
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context, created withKSPMonitorSNESResidualDrawLGCreate()
Options Database Key:
-snes_monitor_ksp draw::draw_lg- ActivatesKSPMonitorSNESResidualDrawLG()
Level: intermediate
-seealso: , KSPMonitorSet(), KSPMonitorTrueResidual(), SNESMonitor(), KSPMonitor(), KSPMonitorSNESResidualDrawLGCreate()
External Links
- PETSc Manual:
Snes/KSPMonitorSNESResidualDrawLG
PETSc.LibPETSc.KSPMonitorSNESResidualDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPMonitorSNESResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the PetscViewer used by KSPMonitorSNESResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , KSP, SNES, PetscViewerFormat, PetscViewerAndFormat, KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
Snes/KSPMonitorSNESResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorSet — Method
KSPMonitorSet(petsclib::PetscLibType,ksp::PetscKSP, monitor::KSPMonitorFn, ctx::Cvoid, monitordestroy::PetscCtxDestroyFn)Sets an ADDITIONAL function to be called at every iteration to monitor, i.e. display in some way, perhaps by printing in the terminal, the residual norm computed in a KSPSolve()
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()monitor- pointer to function (if this isNULL, it turns off monitoring, seeKSPMonitorFnctx- [optional] context for private data for the monitor routine (useNULLif no context is needed)monitordestroy- [optional] routine that frees monitor context (may beNULL), seePetscCtxDestroyFnfor the calling sequence
Options Database Keys:
-ksp_monitor- setsKSPMonitorResidual()-ksp_monitor hdf5:filename- setsKSPMonitorResidualView()and saves residual-ksp_monitor draw- setsKSPMonitorResidualView()and plots residual-ksp_monitor draw::draw_lg- setsKSPMonitorResidualDrawLG()and plots residual-ksp_monitor_pause_final- Pauses any graphics when the solve finishes (only works for internal monitors)-ksp_monitor_true_residual- setsKSPMonitorTrueResidual()-ksp_monitor_true_residual draw::draw_lg- setsKSPMonitorTrueResidualDrawLG()and plots residual-ksp_monitor_max- setsKSPMonitorTrueResidualMax()-ksp_monitor_singular_value- setsKSPMonitorSingularValue()-ksp_monitor_cancel- cancels all monitors that have been hardwired into a code by calls toKSPMonitorSet(), but
does not cancel those set via the options database.
Level: beginner
-seealso: , KSPMonitorResidual(), KSPMonitorRegister(), KSPMonitorCancel(), KSP, PetscCtxDestroyFn
External Links
- PETSc Manual:
KSP/KSPMonitorSet
PETSc.LibPETSc.KSPMonitorSetFromOptions — Method
KSPMonitorSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP, opt::String, name::String, ctx::Cvoid)Sets a monitor function and viewer appropriate for the type indicated by the user in the options database
Collective
Input Parameters:
ksp-KSPobject you wish to monitoropt- the command line option for this monitorname- the monitor type one is seekingctx- An optional user context for the monitor, orNULL
Level: developer
-seealso: , KSPMonitorRegister(), KSPMonitorSet(), PetscOptionsCreateViewer(), PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHeadBegin(), PetscOptionsStringArray(), PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), PetscOptionsFList(), PetscOptionsEList()
External Links
- PETSc Manual:
KSP/KSPMonitorSetFromOptions
PETSc.LibPETSc.KSPMonitorSingularValue — Method
KSPMonitorSingularValue(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the two norm of the true residual and estimation of the extreme singular values of the preconditioned problem at each iteration.
Logically Collective
Input Parameters:
ksp- the iterative contextn- the iterationrnorm- the two norm of the residualvf- The viewer context
Options Database Key:
-ksp_monitor_singular_value- ActivatesKSPMonitorSingularValue()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPComputeExtremeSingularValues(), KSPMonitorSingularValueCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSingularValue
PETSc.LibPETSc.KSPMonitorSingularValueCreate — Method
vf::PetscViewerAndFormat = KSPMonitorSingularValueCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the singular value monitor context needed by KSPMonitorSingularValue()
Collective
Input Parameters:
viewer- The PetscViewerformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorSingularValue(), PetscViewer
External Links
- PETSc Manual:
KSP/KSPMonitorSingularValueCreate
PETSc.LibPETSc.KSPMonitorSolution — Method
KSPMonitorSolution(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Print the solution norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_solution- ActivatesKSPMonitorSolution()
Level: intermediate
-seealso: , KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolution
PETSc.LibPETSc.KSPMonitorSolutionDraw — Method
KSPMonitorSolutionDraw(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the solution at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_solution draw- ActivatesKSPMonitorSolutionDraw()
Level: intermediate
-seealso: , KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDraw
PETSc.LibPETSc.KSPMonitorSolutionDrawLG — Method
KSPMonitorSolutionDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the solution norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_solution draw::draw_lg- ActivatesKSPMonitorSolutionDrawLG()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorSolutionDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDrawLG
PETSc.LibPETSc.KSPMonitorSolutionDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPMonitorSolutionDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the context for the KSP monitor KSPMonitorSolutionDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDrawLGCreate
PETSc.LibPETSc.KSPMonitorTrueResidual — Method
KSPMonitorTrueResidual(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the true residual norm, as well as the (possibly preconditioned, possibly approximate) residual norm, at each iteration of a KSPSolve() iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_true_residual- ActivatesKSPMonitorTrueResidual()to print both norm values at each iteration
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidual
PETSc.LibPETSc.KSPMonitorTrueResidualDrawLG — Method
KSPMonitorTrueResidualDrawLG(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the true residual norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_true_residual draw::draw_lg- ActivatesKSPMonitorTrueResidualDrawLG()
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorTrueResidualDraw(), KSPMonitorResidual, KSPMonitorTrueResidualDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualDrawLG
PETSc.LibPETSc.KSPMonitorTrueResidualDrawLGCreate — Method
vf::PetscViewerAndFormat = KSPMonitorTrueResidualDrawLGCreate(petsclib::PetscLibType,viewer::PetscViewer, format::PetscViewerFormat, ctx::Cvoid)Creates the context for the true residual monitor KSPMonitorTrueResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerof typePETSCVIEWERDRAWformat- The viewer formatctx- An optional user context
Output Parameter:
vf- The viewer context
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorTrueResidualMax — Method
KSPMonitorTrueResidualMax(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the true residual max norm at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context
Options Database Key:
-ksp_monitor_true_residual_max- ActivatesKSPMonitorTrueResidualMax()
Level: intermediate
-seealso: , KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm()
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualMax
PETSc.LibPETSc.KSPMonitorTrueResidualView — Method
KSPMonitorTrueResidualView(petsclib::PetscLibType,ksp::PetscKSP, n::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Plots the true residual at each iteration of an iterative solver.
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- The viewer context of typePETSCVIEWERDRAW
Options Database Key:
-ksp_monitor_true_residual viewertype- ActivatesKSPMonitorTrueResidualView()
Level: intermediate
-seealso: , PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidual(), KSPMonitorTrueResidualDrawLG(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualView
PETSc.LibPETSc.KSPPIPEFCGGetMmax — Method
mmax::PetscInt = KSPPIPEFCGGetMmax(petsclib::PetscLibType,ksp::PetscKSP)get the maximum number of previous directions KSPPIPEFCG will store
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
mmax- the maximum number of previous directions allowed for orthogonalization
Level: intermediate
-seealso: , KSPPIPEFCG, KSPPIPEFCGGetTruncationType(), KSPPIPEFCGGetNprealloc(), KSPPIPEFCGSetMmax(), KSPFCGGetMmax(), KSPFCGSetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGGetMmax
PETSc.LibPETSc.KSPPIPEFCGGetNprealloc — Method
nprealloc::PetscInt = KSPPIPEFCGGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP)get the number of directions to preallocate by KSPPIPEFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
nprealloc- the number of directions preallocated
Level: advanced
-seealso: , KSPPIPEFCG, KSPPIPEFCGGetTruncationType(), KSPPIPEFCGSetNprealloc(), KSPPIPEFCGSetMmax(), KSPPIPEFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGGetNprealloc
PETSc.LibPETSc.KSPPIPEFCGGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPPIPEFCGGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP)get the truncation strategy employed by KSPPIPEFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
Level: intermediate
-seealso: , KSPPIPEFCG, KSPPIPEFCGSetTruncationType, KSPFCDTruncationType, KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPPIPEFCGGetTruncationType
PETSc.LibPETSc.KSPPIPEFCGSetMmax — Method
KSPPIPEFCGSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt)set the maximum number of previous directions KSPPIPEFCG will store for orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contextmmax- the maximum number of previous directions to orthogonalize against
Options Database Key:
-ksp_pipefcg_mmax <N>- maximum number of previous directions
Level: intermediate
-seealso: , KSPPIPEFCG, KSPPIPEFCGSetTruncationType(), KSPPIPEFCGSetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGSetMmax
PETSc.LibPETSc.KSPPIPEFCGSetNprealloc — Method
KSPPIPEFCGSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt)set the number of directions to preallocate with KSPPIPEFCG
Logically Collective
Input Parameters:
ksp- the Krylov space contextnprealloc- the number of vectors to preallocate
Options Database Key:
-ksp_pipefcg_nprealloc <N>- the number of vectors to preallocate
Level: advanced
-seealso: , KSPPIPEFCG, KSPPIPEFCGSetTruncationType(), KSPPIPEFCGGetNprealloc(), KSPPIPEFCGSetMmax(), KSPPIPEFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGSetNprealloc
PETSc.LibPETSc.KSPPIPEFCGSetTruncationType — Method
KSPPIPEFCGSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType)specify how many of its stored previous directions KSPPIPEFCG uses during orthoganalization
Logically Collective
Input Parameters:
ksp- the Krylov space contexttruncstrat- the choice of strategy
-seealso: , KSPPIPEFCG, KSPPIPEFCGGetTruncationType, KSPFCDTruncationType, KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPPIPEFCGSetTruncationType
PETSc.LibPETSc.KSPPIPEFGMRESSetShift — Method
KSPPIPEFGMRESSetShift(petsclib::PetscLibType,ksp::PetscKSP, shift::PetscScalar)Set the shift parameter for the flexible, pipelined KSPPIPEFGMRES solver.
Logically Collective
Input Parameters:
ksp- the Krylov space contextshift- the shift
Options Database Key:
-ksp_pipefgmres_shift <shift>- set the shift parameter
Level: intermediate
-seealso: , KSPPIPEFGMRES, KSPComputeEigenvalues()
External Links
- PETSc Manual:
KSP/KSPPIPEFGMRESSetShift
PETSc.LibPETSc.KSPPIPEGCRGetMmax — Method
mmax::PetscInt = KSPPIPEGCRGetMmax(petsclib::PetscLibType,ksp::PetscKSP)get the maximum number of previous directions KSPPIPEGCR will store
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
mmax- the maximum number of previous directions allowed for orthogonalization
Level: intermediate
-seealso: , KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc(), KSPPIPEGCRSetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetMmax
PETSc.LibPETSc.KSPPIPEGCRGetNprealloc — Method
nprealloc::PetscInt = KSPPIPEGCRGetNprealloc(petsclib::PetscLibType,ksp::PetscKSP)get the number of directions preallocate by KSPPIPEGCR
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
nprealloc- the number of directions preallocated
Level: advanced
-seealso: , KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRSetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetNprealloc
PETSc.LibPETSc.KSPPIPEGCRGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPPIPEGCRGetTruncationType(petsclib::PetscLibType,ksp::PetscKSP)get the truncation strategy employed by KSPPIPEGCR
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
-seealso: , KSPPIPEGCR, KSPPIPEGCRSetTruncationType, KSPPIPEGCRTruncationType, KSPFCDTruncationType, KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetTruncationType
PETSc.LibPETSc.KSPPIPEGCRGetUnrollW — Method
unroll_w::PetscBool = KSPPIPEGCRGetUnrollW(petsclib::PetscLibType,ksp::PetscKSP)Get information on KSPPIPEGCR if it uses unrolling the w vector
Logically Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
unroll_w-KSPPIPEGCRuses unrolling (bool)
Level: intermediate
-seealso: , KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc(), KSPPIPEGCRSetUnrollW()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetUnrollW
PETSc.LibPETSc.KSPPIPEGCRSetMmax — Method
KSPPIPEGCRSetMmax(petsclib::PetscLibType,ksp::PetscKSP, mmax::PetscInt)set the maximum number of previous directions KSPPIPEGCR will store for orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contextmmax- the maximum number of previous directions to orthogonalize against
Options Database Key:
-ksp_pipegcr_mmax <mmax>- maximum number of previous directions
Level: intermediate
-seealso: , KSPPIPEGCR, KSPPIPEGCRSetTruncationType(), KSPPIPEGCRSetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetMmax
PETSc.LibPETSc.KSPPIPEGCRSetModifyPC — Method
KSPPIPEGCRSetModifyPC(petsclib::PetscLibType,ksp::PetscKSP, fnc::KSPFlexibleModifyPCFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Sets the routine used by KSPPIPEGCR to modify the preconditioner at each iteration
Logically Collective
Input Parameters:
ksp- iterative context obtained fromKSPCreate()function- user defined function to modify the preconditioner, seeKSPFlexibleModifyPCFnctx- user provided context for the modify preconditioner functiondestroy- the function to use to destroy the user provided application context.
Level: intermediate
-seealso: , KSPFlexibleSetModifyPC(), KSPFlexibleModifyPCFn, KSPPIPEGCR
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetModifyPC
PETSc.LibPETSc.KSPPIPEGCRSetNprealloc — Method
KSPPIPEGCRSetNprealloc(petsclib::PetscLibType,ksp::PetscKSP, nprealloc::PetscInt)set the number of directions to preallocate with KSPPIPEGCR
Logically Collective
Input Parameters:
ksp- the Krylov space contextnprealloc- the number of vectors to preallocate
Level: advanced
Options Database Key:
-ksp_pipegcr_nprealloc <N>- number of vectors to preallocate
-seealso: , KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetNprealloc
PETSc.LibPETSc.KSPPIPEGCRSetTruncationType — Method
KSPPIPEGCRSetTruncationType(petsclib::PetscLibType,ksp::PetscKSP, truncstrat::KSPFCDTruncationType)specify how many of its stored previous directions KSPPIPEGCR uses during orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contexttruncstrat- the choice of strategy
-seealso: , KSPPIPEGCR, KSPPIPEGCRTruncationType, KSPFCDTruncationType, KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetTruncationType
PETSc.LibPETSc.KSPPIPEGCRSetUnrollW — Method
KSPPIPEGCRSetUnrollW(petsclib::PetscLibType,ksp::PetscKSP, unroll_w::PetscBool)Set to PETSC_TRUE to use KSPPIPEGCR with unrolling of the w vector
Logically Collective
Input Parameters:
ksp- the Krylov space contextunroll_w- use unrolling
Level: intermediate
Options Database Key:
-ksp_pipegcr_unroll_w <bool>- use unrolling
-seealso: , KSPPIPEGCR, KSPPIPEGCRSetTruncationType(), KSPPIPEGCRSetNprealloc(), KSPPIPEGCRGetUnrollW()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetUnrollW
PETSc.LibPETSc.KSPPythonGetType — Method
pyname::String = KSPPythonGetType(petsclib::PetscLibType,ksp::PetscKSP)Get the type of a KSP object implemented in Python.
Not Collective
Input Parameter:
ksp- the linear solverKSPcontext.
Output Parameter:
pyname- full dotted Python name [package].module[.{class|function}]
Level: intermediate
-seealso: , KSPCreate(), KSPSetType(), KSPPYTHON, PetscPythonInitialize(), KSPPythonSetType()
External Links
- PETSc Manual:
KSP/KSPPythonGetType
PETSc.LibPETSc.KSPPythonSetType — Method
KSPPythonSetType(petsclib::PetscLibType,ksp::PetscKSP, pyname::String)Initialize a KSP object to a type implemented in Python.
Collective
Input Parameters:
ksp- the linear solverKSPcontext.pyname- full dotted Python name [package].module[.{class|function}]
Options Database Key:
-ksp_python_type <pyname>- python class
Level: intermediate
-seealso: , KSPCreate(), KSPSetType(), KSPPYTHON, PetscPythonInitialize()
External Links
- PETSc Manual:
KSP/KSPPythonSetType
PETSc.LibPETSc.KSPQCGGetQuadratic — Method
quadratic::PetscReal = KSPQCGGetQuadratic(petsclib::PetscLibType,ksp::PetscKSP)Gets the value of the quadratic function, evaluated at the new iterate
Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
quadratic- the quadratic function evaluated at the new iterate
Level: advanced
External Links
- PETSc Manual:
KSP/KSPQCGGetQuadratic
PETSc.LibPETSc.KSPQCGGetTrialStepNorm — Method
tsnorm::PetscReal = KSPQCGGetTrialStepNorm(petsclib::PetscLibType,ksp::PetscKSP)Gets the norm of a trial step vector in KSPQCG. The WCG step may be constrained, so this is not necessarily the length of the ultimate step taken in KSPQCG.
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
tsnorm- the norm
Level: advanced
-seealso: , KSPQCG, KSPQCGSetTrustRegionRadius()
External Links
- PETSc Manual:
KSP/KSPQCGGetTrialStepNorm
PETSc.LibPETSc.KSPQCGSetTrustRegionRadius — Method
KSPQCGSetTrustRegionRadius(petsclib::PetscLibType,ksp::PetscKSP, delta::PetscReal)Sets the radius of the trust region for KSPQCG
Logically Collective
Input Parameters:
ksp- the iterative contextdelta- the trust region radius (Infinity is the default)
Options Database Key:
-ksp_qcg_trustregionradius <delta>- trust region radius
Level: advanced
-seealso: , KSPQCG, KSPQCGGetTrialStepNorm()
External Links
- PETSc Manual:
KSP/KSPQCGSetTrustRegionRadius
PETSc.LibPETSc.KSPRegister — Method
KSPRegister(petsclib::PetscLibType,sname::String, fnc::external)Adds a method, KSPType, to the Krylov subspace solver package.
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunction- routine to create method
Level: advanced
-seealso: , KSP, KSPType, KSPSetType, KSPRegisterAll()
External Links
- PETSc Manual:
KSP/KSPRegister
PETSc.LibPETSc.KSPReset — Method
KSPReset(petsclib::PetscLibType,ksp::PetscKSP)Removes any allocated Vec and Mat from the KSP data structures.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Level: intermediate
-seealso: , KSPCreate(), KSPSetUp(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPReset
PETSc.LibPETSc.KSPResetFromOptions — Method
KSPResetFromOptions(petsclib::PetscLibType,ksp::PetscKSP)Sets KSP parameters from user options ONLY if the KSP was previously set from options
Collective
Input Parameter:
ksp- theKSPcontext
Level: advanced
-seealso: , KSPSetFromOptions(), KSPSetOptionsPrefix()
External Links
- PETSc Manual:
KSP/KSPResetFromOptions
PETSc.LibPETSc.KSPResetViewers — Method
KSPResetViewers(petsclib::PetscLibType,ksp::PetscKSP)Resets all the viewers set from the options database during KSPSetFromOptions()
Collective
Input Parameter:
ksp- theKSPiterative solver context obtained fromKSPCreate()
Level: beginner
-seealso: , KSPCreate(), KSPSetUp(), KSPSolve(), KSPSetFromOptions(), KSP
External Links
- PETSc Manual:
KSP/KSPResetViewers
PETSc.LibPETSc.KSPRichardsonSetScale — Method
KSPRichardsonSetScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscReal)Set the damping factor; if this routine is not called, the factor defaults to 1.0.
Logically Collective
Input Parameters:
ksp- the iterative contextscale- the damping factor
Options Database Key:
-ksp_richardson_scale <scale>- Set the scale factor
Level: intermediate
-seealso: , KSPRICHARDSON, KSPRichardsonSetSelfScale()
External Links
- PETSc Manual:
KSP/KSPRichardsonSetScale
PETSc.LibPETSc.KSPRichardsonSetSelfScale — Method
KSPRichardsonSetSelfScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscBool)Sets Richardson to automatically determine optimal scaling at each iteration to minimize the 2 preconditioned residual
Logically Collective
Input Parameters:
ksp- the iterative contextscale-PETSC_TRUEor the default ofPETSC_FALSE
Options Database Key:
-ksp_richardson_self_scale- Use self-scaling
Level: intermediate
-seealso: , KSPRICHARDSON, KSPRichardsonSetScale()
External Links
- PETSc Manual:
KSP/KSPRichardsonSetSelfScale
PETSc.LibPETSc.KSPSetApplicationContext — Method
KSPSetApplicationContext(petsclib::PetscLibType,ksp::PetscKSP, ctx::Cvoid)Sets the optional user
Logically Collective
Input Parameters:
ksp- theKSPcontextctx- user context
Level: intermediate
-seealso: , KSP, KSPGetApplicationContext()
External Links
- PETSc Manual:
KSP/KSPSetApplicationContext
PETSc.LibPETSc.KSPSetCheckNormIteration — Method
KSPSetCheckNormIteration(petsclib::PetscLibType,ksp::PetscKSP, it::PetscInt)Sets the first iteration at which the norm of the residual will be computed and used in the convergence test of KSPSolve() for the given KSP context
Logically Collective
Input Parameters:
ksp- Krylov solver contextit- use -1 to check at all iterations
Level: advanced
-seealso: , KSP, KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetNormType(), KSPSetLagNorm()
External Links
- PETSc Manual:
KSP/KSPSetCheckNormIteration
PETSc.LibPETSc.KSPSetComputeEigenvalues — Method
KSPSetComputeEigenvalues(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Sets a flag so that the extreme eigenvalues values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , KSPComputeEigenvalues(), KSPComputeEigenvaluesExplicitly(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPSetComputeEigenvalues
PETSc.LibPETSc.KSPSetComputeInitialGuess — Method
KSPSetComputeInitialGuess(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeInitialGuessFn, Ptr}, ctx::Union{Cvoid, Ptr})set routine to compute the initial guess of the linear system
Logically Collective
Input Parameters:
ksp- theKSPcontextfunc- function to compute the initial guess, seeKSPComputeInitialGuessFnfor calling sequencectx- optional context
Level: beginner
-seealso: , KSP, KSPSolve(), KSPSetComputeRHS(), KSPSetComputeOperators(), DMKSPSetComputeInitialGuess(), KSPSetInitialGuessNonzero(), KSPComputeInitialGuessFn
External Links
- PETSc Manual:
KSP/KSPSetComputeInitialGuess
PETSc.LibPETSc.KSPSetComputeOperators — Method
KSPSetComputeOperators(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeOperatorsFn, Ptr}, ctx::Union{Cvoid, Ptr})set routine to compute the linear operators
Logically Collective
Input Parameters:
ksp- theKSPcontextfunc- function to compute the operators, seeKSPComputeOperatorsFnfor the calling sequencectx- optional context
Level: beginner
-seealso: , KSP, KSPSetOperators(), KSPSetComputeRHS(), DMKSPSetComputeOperators(), KSPSetComputeInitialGuess(), KSPComputeOperatorsFn
External Links
- PETSc Manual:
KSP/KSPSetComputeOperators
PETSc.LibPETSc.KSPSetComputeRHS — Method
KSPSetComputeRHS(petsclib::PetscLibType,ksp::PetscKSP, func::Union{KSPComputeRHSFn,Ptr}, ctx::Union{Cvoid, Ptr})set routine to compute the right
Logically Collective
Input Parameters:
ksp- theKSPcontextfunc- function to compute the right-hand side, seeKSPComputeRHSFnfor the calling sequencectx- optional context
Level: beginner
-seealso: , KSP, KSPSolve(), DMKSPSetComputeRHS(), KSPSetComputeOperators(), KSPSetOperators(), KSPComputeRHSFn
External Links
- PETSc Manual:
KSP/KSPSetComputeRHS
PETSc.LibPETSc.KSPSetComputeRitz — Method
KSPSetComputeRitz(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Sets a flag so that the Ritz or harmonic Ritz pairs will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , KSPComputeRitz(), KSP, KSPComputeEigenvalues(), KSPComputeExtremeSingularValues()
External Links
- PETSc Manual:
KSP/KSPSetComputeRitz
PETSc.LibPETSc.KSPSetComputeSingularValues — Method
KSPSetComputeSingularValues(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Sets a flag so that the extreme singular values will be calculated via a Lanczos or Arnoldi process as the linear system is solved.
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEorPETSC_FALSE
Options Database Key:
-ksp_monitor_singular_value- ActivatesKSPSetComputeSingularValues()
Level: advanced
-seealso: , KSPComputeExtremeSingularValues(), KSPMonitorSingularValue(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPSetComputeSingularValues
PETSc.LibPETSc.KSPSetConvergedNegativeCurvature — Method
KSPSetConvergedNegativeCurvature(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Allows to declare convergence and return KSP_CONVERGED_NEG_CURVE when negative curvature is detected
Collective
Input Parameters:
ksp- iterative contextflg- the Boolean value
Options Database Key:
-ksp_converged_neg_curve <bool>- Declare convergence if negative curvature is detected
Level: advanced
-seealso: , KSP, KSPConvergedReason, KSPGetConvergedNegativeCurvature()
External Links
- PETSc Manual:
KSP/KSPSetConvergedNegativeCurvature
PETSc.LibPETSc.KSPSetConvergenceTest — Method
KSPSetConvergenceTest(petsclib::PetscLibType,ksp::PetscKSP, converge::KSPConvergenceTestFn, ctx::Cvoid, destroy::PetscCtxDestroyFn)Sets the function to be used to determine convergence of KSPSolve()
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()converge- pointer to the function, seeKSPConvergenceTestFnctx- context for private data for the convergence routine (may beNULL)destroy- a routine for destroying the context (may beNULL)
Level: advanced
-seealso: , KSP, KSPConvergenceTestFn, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPGetConvergenceTest(), KSPGetAndClearConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPSetConvergenceTest
PETSc.LibPETSc.KSPSetDM — Method
KSPSetDM(petsclib::PetscLibType,ksp::PetscKSP, dm::PetscDM)Sets the DM that may be used by some preconditioners and that may be used to construct the linear system
Logically Collective
Input Parameters:
ksp- theKSPdm- theDM, cannot beNULLto remove a previously setDM
Level: intermediate
-seealso: , KSP, DM, KSPGetDM(), KSPSetDMActive(), KSPSetComputeOperators(), KSPSetComputeRHS(), KSPSetComputeInitialGuess(), DMKSPSetComputeOperators(), DMKSPSetComputeRHS(), DMKSPSetComputeInitialGuess()
External Links
- PETSc Manual:
KSP/KSPSetDM
PETSc.LibPETSc.KSPSetDMActive — Method
KSPSetDMActive(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Indicates the DM should be used to generate the linear system matrix and right
Logically Collective
Input Parameters:
ksp- theKSPflg- use theDM
Level: intermediate
-seealso: , KSP, DM, KSPGetDM(), KSPSetDM(), SNESSetDM(), KSPSetComputeOperators(), KSPSetComputeRHS(), KSPSetComputeInitialGuess()
External Links
- PETSc Manual:
KSP/KSPSetDMActive
PETSc.LibPETSc.KSPSetDiagonalScale — Method
KSPSetDiagonalScale(petsclib::PetscLibType,ksp::PetscKSP, scale::PetscBool)Tells KSP to symmetrically diagonally scale the system before solving. This actually CHANGES the matrix (and right-hand side).
Logically Collective
Input Parameters:
ksp- theKSPcontextscale-PETSC_TRUEorPETSC_FALSE
Options Database Keys:
-ksp_diagonal_scale- perform a diagonal scaling before the solve-ksp_diagonal_scale_fix- scale the matrix back AFTER the solve
Level: advanced
-seealso: , KSPGetDiagonalScale(), KSPSetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPSetDiagonalScale
PETSc.LibPETSc.KSPSetDiagonalScaleFix — Method
KSPSetDiagonalScaleFix(petsclib::PetscLibType,ksp::PetscKSP, fix::PetscBool)Tells KSP to diagonally scale the system back after solving.
Logically Collective
Input Parameters:
ksp- theKSPcontextfix-PETSC_TRUEto scale back after the system solve,PETSC_FALSEto not
rescale (default)
Level: intermediate
-seealso: , KSPGetDiagonalScale(), KSPSetDiagonalScale(), KSPGetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPSetDiagonalScaleFix
PETSc.LibPETSc.KSPSetErrorHistory — Method
KSPSetErrorHistory(petsclib::PetscLibType,ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool)Sets the array used to hold the error history. If set, this array will contain the error norms computed at each iteration of the solver.
Not Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()a- array to hold historyna- size ofareset-PETSC_TRUEindicates the history counter is reset to zero for each new linear solve
Level: advanced
-seealso: , KSPGetErrorHistory(), KSPSetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPSetErrorHistory
PETSc.LibPETSc.KSPSetErrorIfNotConverged — Method
KSPSetErrorIfNotConverged(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Causes KSPSolve() to generate an error if the solver has not converged as soon as the error is detected.
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEindicates you want the error generated
Options Database Key:
-ksp_error_if_not_converged <true,false>- generate an error and stop the program
Level: intermediate
-seealso: , KSPGetErrorIfNotConverged(), KSP
External Links
- PETSc Manual:
KSP/KSPSetErrorIfNotConverged
PETSc.LibPETSc.KSPSetFromOptions — Method
KSPSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP)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.
Collective
Input Parameter:
ksp- the Krylov space context
Options Database Keys:
-ksp_rtol rtol- relative tolerance used in default determination of convergence, i.e.
if residual norm decreases by this factor than convergence is declared
-ksp_atol abstol- absolute tolerance used in default convergence test, i.e. if residual
norm is less than this then convergence is declared
-ksp_divtol tol- if residual norm increases by this factor than divergence is declared-ksp_max_it- maximum number of linear iterations-ksp_min_it- minimum number of linear iterations to use, defaults to zero-ksp_reuse_preconditioner <true,false>- reuse the previously computed preconditioner-ksp_converged_use_initial_residual_norm- seeKSPConvergedDefaultSetUIRNorm()-ksp_converged_use_min_initial_residual_norm- seeKSPConvergedDefaultSetUMIRNorm()-ksp_converged_maxits- seeKSPConvergedDefaultSetConvergedMaxits()-ksp_norm_type <none,preconditioned,unpreconditioned,natural>- seeKSPSetNormType()-ksp_check_norm_iteration it- do not compute residual norm until iteration number it (does compute at 0th iteration)
works only for KSPBCGS, KSPIBCGS, and KSPCG
-ksp_lag_norm- compute the norm of the residual for the ith iteration on the i+1 iteration;
this means that one can use the norm of the residual for convergence test WITHOUT an extra MPI_Allreduce() limiting global synchronizations. This will require 1 more iteration of the solver than usual.
-ksp_guess_type- Type of initial guess generator for repeated linear solves-ksp_fischer_guess <model,size>- uses the Fischer initial guess generator for repeated linear solves-ksp_constant_null_space- assume the operator (matrix) has the constant vector in its null space-ksp_test_null_space- tests the null space set withMatSetNullSpace()to see if it truly is a null space-ksp_knoll- compute initial guess by applying the preconditioner to the right-hand side-ksp_monitor_cancel- cancel all previous convergene monitor routines set-ksp_monitor- print residual norm at each iteration-ksp_monitor draw::draw_lg- plot residual norm at each iteration, seeKSPMonitorResidual()-ksp_monitor_true_residual- print the true l2 residual norm at each iteration, seeKSPMonitorTrueResidual()-all_ksp_monitor <optional filename>- print residual norm at each iteration for ALL KSP solves, regardless of their prefix. This is
useful for PCFIELDSPLIT, PCMG, etc that have inner solvers and you wish to track the convergence of all the solvers
-ksp_monitor_solution [ascii binary or draw][:filename][:format option]- plot solution at each iteration-ksp_monitor_singular_value- monitor extreme singular values at each iteration-ksp_converged_reason- view the convergence state at the end of the solve-ksp_use_explicittranspose- transpose the system explicitly inKSPSolveTranspose()-ksp_error_if_not_converged- stop the program as soon as an error is detected in aKSPSolve(),KSP_DIVERGED_ITS
is not treated as an error on inner solves
-ksp_converged_rate- view the convergence rate at the end of the solve
Level: beginner
-seealso: , KSP, KSPSetOptionsPrefix(), KSPResetFromOptions(), KSPSetUseFischerGuess()
External Links
- PETSc Manual:
KSP/KSPSetFromOptions
PETSc.LibPETSc.KSPSetGuess — Method
KSPSetGuess(petsclib::PetscLibType,ksp::PetscKSP, guess::KSPGuess)Set the initial guess object KSPGuess to be used by the KSP object to generate initial guesses
Logically Collective
Input Parameters:
ksp- the Krylov contextguess- the object created withKSPGuessCreate()
Level: advanced
-seealso: , KSP, KSPGuess, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetUseFischerGuess(), KSPGetGuess()
External Links
- PETSc Manual:
KSP/KSPSetGuess
PETSc.LibPETSc.KSPSetInitialGuessKnoll — Method
KSPSetInitialGuessKnoll(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Tells the iterative solver to use PCApply() on the right hand side vector to compute the initial guess (The Knoll trick)
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , KSPGetInitialGuessKnoll(), KSPGuess, KSPSetInitialGuessNonzero(), KSPGetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPSetInitialGuessKnoll
PETSc.LibPETSc.KSPSetInitialGuessNonzero — Method
KSPSetInitialGuessNonzero(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Tells the iterative solver that the initial guess is nonzero; otherwise KSP assumes the initial guess is to be zero (and thus zeros it out before solving).
Logically Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flg-PETSC_TRUEindicates the guess is non-zero,PETSC_FALSEindicates the guess is zero
Options Database Key:
-ksp_initial_guess_nonzero <true,false>- use nonzero initial guess
Level: beginner
-seealso: , KSPGetInitialGuessNonzero(), KSPGuessSetType(), KSPGuessType, KSP
External Links
- PETSc Manual:
KSP/KSPSetInitialGuessNonzero
PETSc.LibPETSc.KSPSetLagNorm — Method
KSPSetLagNorm(petsclib::PetscLibType,ksp::PetscKSP, flg::PetscBool)Lags the residual norm calculation so that it is computed as part of the MPI_Allreduce() used for computing the inner products needed for the next iteration.
Logically Collective
Input Parameters:
ksp- Krylov solver contextflg-PETSC_TRUEorPETSC_FALSE
Options Database Key:
-ksp_lag_norm- lag the calculated residual norm
Level: advanced
-seealso: , KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetNormType(), KSPSetCheckNormIteration()
External Links
- PETSc Manual:
KSP/KSPSetLagNorm
PETSc.LibPETSc.KSPSetMatSolveBatchSize — Method
KSPSetMatSolveBatchSize(petsclib::PetscLibType,ksp::PetscKSP, bs::PetscInt)Sets the maximum number of columns treated simultaneously in KSPMatSolve().
Logically Collective
Input Parameters:
ksp- theKSPiterative solverbs- batch size
Level: advanced
-seealso: , KSPMatSolve(), KSPGetMatSolveBatchSize(), -mat_mumps_icntl_27, -matmatmult_Bbn
External Links
- PETSc Manual:
KSP/KSPSetMatSolveBatchSize
PETSc.LibPETSc.KSPSetMinimumIterations — Method
KSPSetMinimumIterations(petsclib::PetscLibType,ksp::PetscKSP, minit::PetscInt)Sets the minimum number of iterations to use, regardless of the tolerances
Logically Collective
Input Parameters:
ksp- the Krylov subspace contextminit- minimum number of iterations to use
Options Database Key:
-ksp_min_it <minits>- Setsminit
Level: intermediate
-seealso: , KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetTolerances(), KSPGetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPSetMinimumIterations
PETSc.LibPETSc.KSPSetNestLevel — Method
KSPSetNestLevel(petsclib::PetscLibType,ksp::PetscKSP, level::PetscInt)sets the amount of nesting the KSP has. That is the number of levels of KSP above this KSP in a linear solve.
Collective
Input Parameters:
ksp- theKSPlevel- the nest level
Level: developer
-seealso: , KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPGMRES, KSPType, KSPGetNestLevel(), PCSetKSPNestLevel(), PCGetKSPNestLevel()
External Links
- PETSc Manual:
KSP/KSPSetNestLevel
PETSc.LibPETSc.KSPSetNormType — Method
KSPSetNormType(petsclib::PetscLibType,ksp::PetscKSP, normtype::KSPNormType)Sets the type of residual norm that is used for convergence testing in KSPSolve() for the given KSP context
Logically Collective
Input Parameters:
ksp- Krylov solver contextnormtype- one of
-seealso: , KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetCheckNormIteration(), KSPSetPCSide(), KSPGetPCSide(), KSPNormType
External Links
- PETSc Manual:
KSP/KSPSetNormType
PETSc.LibPETSc.KSPSetOperators — Method
KSPSetOperators(petsclib::PetscLibType,ksp::PetscKSP, Amat::PetscMat, Pmat::PetscMat)Sets the matrix associated with the linear system and a (possibly) different one from which the preconditioner will be built into the KSP context. The matrix will then be used during KSPSolve()
Collective
Input Parameters:
ksp- theKSPcontextAmat- the matrix that defines the linear systemPmat- the matrix to be used in constructing the preconditioner, usually the same asAmat.
Level: beginner
-seealso: , KSP, Mat, KSPSolve(), KSPGetPC(), PCGetOperators(), PCSetOperators(), KSPGetOperators(), KSPSetComputeOperators(), KSPSetComputeInitialGuess(), KSPSetComputeRHS()
External Links
- PETSc Manual:
KSP/KSPSetOperators
PETSc.LibPETSc.KSPSetOptionsPrefix — Method
KSPSetOptionsPrefix(petsclib::PetscLibType,ksp::PetscKSP, prefix::String)Sets the prefix used for searching for all KSP options in the database.
Logically Collective
Input Parameters:
ksp- the Krylov contextprefix- the prefix string to prepend to allKSPoption requests
Level: intermediate
-seealso: , KSP, KSPAppendOptionsPrefix(), KSPGetOptionsPrefix(), KSPSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPSetOptionsPrefix
PETSc.LibPETSc.KSPSetPC — Method
KSPSetPC(petsclib::PetscLibType,ksp::PetscKSP, pc::PC)Sets the preconditioner to be used to calculate the application of the preconditioner on a vector into a KSP.
Collective
Input Parameters:
ksp- theKSPiterative solver obtained fromKSPCreate()pc- the preconditioner object (ifNULLit returns thePCcurrently held by theKSP)
Level: developer
External Links
- PETSc Manual:
KSP/KSPSetPC
PETSc.LibPETSc.KSPSetPCSide — Method
KSPSetPCSide(petsclib::PetscLibType,ksp::PetscKSP, side::PCSide)Sets the preconditioning side.
Logically Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
side- the preconditioning side, where side is one of
-seealso: , KSPGetPCSide(), KSPSetNormType(), KSPGetNormType(), KSP, KSPSetPreSolve(), KSPSetPostSolve()
External Links
- PETSc Manual:
KSP/KSPSetPCSide
PETSc.LibPETSc.KSPSetPostSolve — Method
KSPSetPostSolve(petsclib::PetscLibType,ksp::PetscKSP, postsolve::KSPPSolveFn, ctx::Cvoid)Sets a function that is called at the end of each KSPSolve() (whether it converges or not). Used in conjunction with KSPSetPreSolve().
Logically Collective
Input Parameters:
ksp- the solver objectpostsolve- the function to call after the solve, seeKSPPSolveFnctx- an optional context needed by the function
Level: developer
-seealso: , KSPPSolveFn, KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPSetPreSolve(), PCEISENSTAT
External Links
- PETSc Manual:
KSP/KSPSetPostSolve
PETSc.LibPETSc.KSPSetPreSolve — Method
KSPSetPreSolve(petsclib::PetscLibType,ksp::PetscKSP, presolve::KSPPSolveFn, ctx::Cvoid)Sets a function that is called at the beginning of each KSPSolve(). Used in conjunction with KSPSetPostSolve().
Logically Collective
Input Parameters:
ksp- the solver objectpresolve- the function to call before the solve, seeKSPPSolveFnctx- an optional context needed by the function
Level: developer
-seealso: , KSPPSolveFn, KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPSetPostSolve(), PCEISENSTAT, PCPreSolve(), PCPostSolve()
External Links
- PETSc Manual:
KSP/KSPSetPreSolve
PETSc.LibPETSc.KSPSetResidualHistory — Method
KSPSetResidualHistory(petsclib::PetscLibType,ksp::PetscKSP, a::Vector{PetscReal}, na::PetscCount, reset::PetscBool)Sets the array used to hold the residual history. If set, this array will contain the residual norms computed at each iteration of the solver.
Not Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()a- array to hold historyna- size ofareset-PETSC_TRUEindicates the history counter is reset to zero
for each new linear solve
Level: advanced
-seealso: , KSPGetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPSetResidualHistory
PETSc.LibPETSc.KSPSetReusePreconditioner — Method
KSPSetReusePreconditioner(petsclib::PetscLibType,ksp::PetscKSP, flag::PetscBool)reuse the current preconditioner for future KSPSolve(), do not construct a new preconditioner even if the Mat operator in the KSP has different values
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flag-PETSC_TRUEto reuse the current preconditioner, orPETSC_FALSEto construct a new preconditioner
Options Database Key:
-ksp_reuse_preconditioner <true,false>- reuse the previously computed preconditioner
Level: intermediate
-seealso: , KSPCreate(), KSPSolve(), KSPDestroy(), KSP, KSPGetReusePreconditioner(), SNESSetLagPreconditioner(), SNES
External Links
- PETSc Manual:
KSP/KSPSetReusePreconditioner
PETSc.LibPETSc.KSPSetSkipPCSetFromOptions — Method
KSPSetSkipPCSetFromOptions(petsclib::PetscLibType,ksp::PetscKSP, flag::PetscBool)prevents KSPSetFromOptions() from calling PCSetFromOptions(). This is used if the same PC is shared by more than one KSP so its options are not reset for each KSP
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()flag-PETSC_TRUEto skip calling thePCSetFromOptions()
Level: developer
-seealso: , KSPCreate(), KSPSolve(), KSPDestroy(), PCSetReusePreconditioner(), KSP
External Links
- PETSc Manual:
KSP/KSPSetSkipPCSetFromOptions
PETSc.LibPETSc.KSPSetSupportedNorm — Method
KSPSetSupportedNorm(petsclib::PetscLibType,ksp::PetscKSP, normtype::KSPNormType, pcside::PCSide, priority::PetscInt)Sets a norm and preconditioner side supported by a KSPType
Logically Collective
Input Parameters:
ksp- Krylov methodnormtype- supported norm type of the typeKSPNormTypepcside- preconditioner side, of the typePCSidethat can be used with thisKSPNormTypepriority- positive integer preference for this combination; larger values have higher priority
Level: developer
-seealso: , KSP, KSPNormType, PCSide, KSPSetNormType(), KSPSetPCSide()
External Links
- PETSc Manual:
KSP/KSPSetSupportedNorm
PETSc.LibPETSc.KSPSetTolerances — Method
KSPSetTolerances(petsclib::PetscLibType,ksp::PetscKSP, rtol::PetscReal, abstol::PetscReal, dtol::PetscReal, maxits::PetscInt)Sets the relative, absolute, divergence, and maximum iteration tolerances used by the default KSP convergence testers.
Logically Collective
Input Parameters:
ksp- the Krylov subspace contextrtol- the relative convergence tolerance, relative decrease in the (possibly preconditioned) residual normabstol- the absolute convergence tolerance absolute size of the (possibly preconditioned) residual normdtol- the divergence tolerance, amount (possibly preconditioned) residual norm can increase beforeKSPConvergedDefault()concludes that the method is divergingmaxits- maximum number of iterations to use
Options Database Keys:
-ksp_atol <abstol>- Setsabstol-ksp_rtol <rtol>- Setsrtol-ksp_divtol <dtol>- Setsdtol-ksp_max_it <maxits>- Setsmaxits
Level: intermediate
-seealso: , KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPSetTolerances
PETSc.LibPETSc.KSPSetType — Method
KSPSetType(petsclib::PetscLibType,ksp::PetscKSP, type::KSPType)Sets the algorithm/method to be used to solve the linear system with the given KSP
Logically Collective
Input Parameters:
ksp- the Krylov space contexttype- a known method
Options Database Key:
-ksp_type <method>- Sets the method; seeKSPGTypeor use-helpfor a list of available methods (for instance, cg or gmres)
Level: intermediate
-seealso: , PCSetType(), KSPType, KSPRegister(), KSPCreate(), KSP
External Links
- PETSc Manual:
KSP/KSPSetType
PETSc.LibPETSc.KSPSetUp — Method
KSPSetUp(petsclib::PetscLibType,ksp::PetscKSP)Sets up the internal data structures for the later use KSPSolve() the KSP linear iterative solver.
Collective
Input Parameter:
ksp- iterative solver,KSP, obtained fromKSPCreate()
Level: developer
-seealso: , KSPCreate(), KSPSolve(), KSPDestroy(), KSP, KSPSetUpOnBlocks()
External Links
- PETSc Manual:
KSP/KSPSetUp
PETSc.LibPETSc.KSPSetUpOnBlocks — Method
KSPSetUpOnBlocks(petsclib::PetscLibType,ksp::PetscKSP)Sets up the preconditioner for each block in the block Jacobi PCJACOBI, overlapping Schwarz PCASM, and fieldsplit PCFIELDSPLIT preconditioners
Collective
Input Parameter:
ksp- theKSPcontext
Level: advanced
-seealso: , PCSetUpOnBlocks(), KSPSetUp(), PCSetUp(), KSP
External Links
- PETSc Manual:
KSP/KSPSetUpOnBlocks
PETSc.LibPETSc.KSPSetUseExplicitTranspose — Method
flg::PetscBool = KSPSetUseExplicitTranspose(petsclib::PetscLibType,ksp::PetscKSP)Determines the explicit transpose of the operator is formed in KSPSolveTranspose(). In some configurations (like GPUs) it may be explicitly formed since the solve is much more efficient.
Logically Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
flg-PETSC_TRUEto transpose the system inKSPSolveTranspose(),PETSC_FALSEto not transpose (default)
Level: advanced
-seealso: , KSPSolveTranspose(), KSP
External Links
- PETSc Manual:
KSP/KSPSetUseExplicitTranspose
PETSc.LibPETSc.KSPSetUseFischerGuess — Method
KSPSetUseFischerGuess(petsclib::PetscLibType,ksp::PetscKSP, model::PetscInt, size::PetscInt)Use the Paul Fischer algorithm or its variants to compute initial guesses for a set of solves with related right
Logically Collective
Input Parameters:
ksp- the Krylov contextmodel- use model 1, model 2, model 3, or any other number to turn it offsize- size of subspace used to generate initial guess
Options Database Key:
-ksp_fischer_guess <model,size>- uses the Fischer initial guess generator for repeated linear solves
Level: advanced
-seealso: , KSP, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetGuess(), KSPGetGuess(), KSPGuess
External Links
- PETSc Manual:
KSP/KSPSetUseFischerGuess
PETSc.LibPETSc.KSPSetWorkVecs — Method
KSPSetWorkVecs(petsclib::PetscLibType,ksp::PetscKSP, nw::PetscInt)Sets a number of work vectors into a KSP object
Collective
Input Parameters:
ksp- iterative contextnw- number of work vectors to allocate
Level: developer
-seealso: , KSP, KSPCreateVecs()
External Links
- PETSc Manual:
KSP/KSPSetWorkVecs
PETSc.LibPETSc.KSPSolve — Method
KSPSolve(petsclib::PetscLibType,ksp::PetscKSP, b::PetscVec, x::PetscVec)Solves a linear system associated with KSP object
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()b- the right-hand side vectorx- the solution (this may be the same vector asb, thenbwill be overwritten with the answer)
Options Database Keys:
-ksp_view_eigenvalues- compute preconditioned operators eigenvalues-ksp_view_eigenvalues_explicit- compute the eigenvalues by forming the dense operator and using LAPACK-ksp_view_mat binary- save matrix to the default binary viewer-ksp_view_pmat binary- save matrix used to build preconditioner to the default binary viewer-ksp_view_rhs binary- save right-hand side vector to the default binary viewer-ksp_view_solution binary- save computed solution vector to the default binary viewer
(can be read later with src/ksp/tutorials/ex10.c for testing solvers)
-ksp_view_mat_explicit- for matrix-free operators, computes the matrix entries and views them-ksp_view_preconditioned_operator_explicit- computes the product of the preconditioner and matrix as an explicit matrix and views it-ksp_converged_reason- print reason for converged or diverged, also prints number of iterations-ksp_view_final_residual- print 2-norm of true linear system residual at the end of the solution process-ksp_error_if_not_converged- stop the program as soon as an error is detected in aKSPSolve()-ksp_view_pre- print the ksp data structure before the system solution-ksp_view- print the ksp data structure at the end of the system solution
Level: beginner
-seealso: , KSPCreate(), KSPSetUp(), KSPDestroy(), KSPSetTolerances(), KSPConvergedDefault(), KSPSolveTranspose(), KSPGetIterationNumber(), MatNullSpaceCreate(), MatSetNullSpace(), MatSetTransposeNullSpace(), KSP, KSPConvergedReasonView(), KSPCheckSolve(), KSPSetErrorIfNotConverged()
External Links
- PETSc Manual:
KSP/KSPSolve
PETSc.LibPETSc.KSPSolveTranspose — Method
KSPSolveTranspose(petsclib::PetscLibType,ksp::PetscKSP, b::PetscVec, x::PetscVec)Solves a linear system with the transpose of the matrix associated with the KSP object, A^T x = b.
Collective
Input Parameters:
ksp- iterative solver obtained fromKSPCreate()b- right-hand side vectorx- solution vector
Level: developer
-seealso: , KSPCreate(), KSPSetUp(), KSPDestroy(), KSPSetTolerances(), KSPConvergedDefault(), KSPSolve(), KSP, KSPSetOperators()
External Links
- PETSc Manual:
KSP/KSPSolveTranspose
PETSc.LibPETSc.KSPUnwindPreconditioner — Method
KSPUnwindPreconditioner(petsclib::PetscLibType,ksp::PetscKSP, vsoln::PetscVec, vt1::PetscVec)Unwinds the preconditioning in the solution. That is, takes solution to the preconditioned problem and gets the solution to the original problem from it.
Collective
Input Parameters:
ksp- iterative contextvsoln- solution vectorvt1- temporary work vector
Output Parameter:
vsoln- contains solution on output
Level: advanced
-seealso: , KSP, KSPSetPCSide()
External Links
- PETSc Manual:
KSP/KSPUnwindPreconditioner
PETSc.LibPETSc.KSPView — Method
KSPView(petsclib::PetscLibType,ksp::PetscKSP, viewer::PetscViewer)Prints the various parameters currently set in the KSP object. For example, the convergence tolerances and KSPType. Also views the PC and Mat contained by the KSP with PCView() and MatView().
Collective
Input Parameters:
ksp- the Krylov space contextviewer- visualization context
Options Database Key:
-ksp_view- print theKSPdata structure at the end of eachKSPSolve()call
Level: beginner
-seealso: , KSP, PetscViewer, PCView(), PetscViewerASCIIOpen(), KSPViewFromOptions()
External Links
- PETSc Manual:
KSP/KSPView
PETSc.LibPETSc.KSPViewFromOptions — Method
KSPViewFromOptions(petsclib::PetscLibType,A::PetscKSP, obj::PetscObject, name::String)View (print) a KSP object based on values in the options database. Also views the PC and Mat contained by the KSP with PCView() and MatView().
Collective
Input Parameters:
A- Krylov solver contextobj- Optional object that provides the options prefix used to query the options databasename- command line option
Level: intermediate
-seealso: , KSP, KSPView(), PetscObjectViewFromOptions(), KSPCreate()
External Links
- PETSc Manual:
KSP/KSPViewFromOptions
PETSc.LibPETSc.KSPGuessCreate — Method
guess::KSPGuess = KSPGuessCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a KSPGuess context.
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
guess- location to put theKSPGuesscontext
Options Database Keys:
-ksp_guess_type <method>- Turns on generation of initial guesses and sets the method; use -help for a list of available methods-ksp_guess_view <viewer>- view theKSPGuessobject-ksp_guess_fischer_model <a,b>- set details for the Fischer models-ksp_guess_fischer_monitor- monitor the fischer models-ksp_guess_fischer_tol <tol>- set the tolerance for the Fischer models-ksp_guess_pod_size <size>- Number of snapshots-ksp_guess_pod_monitor true- monitor the pod initial guess processing-ksp_guess_pod_tol <tol>- Tolerance to retain eigenvectors-ksp_guess_pod_Ainner true- Use the operator as inner product (must be SPD)
Level: developer
-seealso: , KSPSolve(), KSPGuessDestroy(), KSPGuess, KSPGuessType, KSP
External Links
- PETSc Manual:
Ksp/KSPGuessCreate
PETSc.LibPETSc.KSPGuessDestroy — Method
KSPGuessDestroy(petsclib::PetscLibType,guess::KSPGuess)Destroys KSPGuess context.
Collective
Input Parameter:
guess- initial guess object
Level: developer
-seealso: , KSPGuessCreate(), KSPGuess, KSPGuessType
External Links
- PETSc Manual:
Ksp/KSPGuessDestroy
PETSc.LibPETSc.KSPGuessFischerSetModel — Method
KSPGuessFischerSetModel(petsclib::PetscLibType,guess::KSPGuess, model::PetscInt, size::PetscInt)Set the Paul Fischer algorithm or its variants to compute the initial guess for a KSPSolve()
Logically Collective
Input Parameters:
guess- the initial guess contextmodel- use model 1, model 2, model 3, or any other number to turn it offsize- size of subspace used to generate initial guess
Options Database Key:
-ksp_guess_fischer_model <model,size>- uses the Fischer initial guess generator for repeated linear solves
Level: advanced
-seealso: , KSPGuess, KSPGuessCreate(), KSPSetUseFischerGuess(), KSPSetGuess(), KSPGetGuess(), KSP
External Links
- PETSc Manual:
Ksp/KSPGuessFischerSetModel
PETSc.LibPETSc.KSPGuessFormGuess — Method
KSPGuessFormGuess(petsclib::PetscLibType,guess::KSPGuess, rhs::PetscVec, sol::PetscVec)Form the initial guess
Collective
Input Parameters:
guess- the initial guess contextrhs- the current right-hand side vectorsol- the initial guess vector
Level: developer
-seealso: , KSPGuessCreate(), KSPGuess
External Links
- PETSc Manual:
Ksp/KSPGuessFormGuess
PETSc.LibPETSc.KSPGuessGetType — Method
type::KSPGuessType = KSPGuessGetType(petsclib::PetscLibType,guess::KSPGuess)Gets the KSPGuessType as a string from the KSPGuess object.
Not Collective
Input Parameter:
guess- the initial guess context
Output Parameter:
type- type ofKSPGuessmethod
Level: developer
-seealso: , KSPGuess, KSPGuessSetType()
External Links
- PETSc Manual:
Ksp/KSPGuessGetType
PETSc.LibPETSc.KSPGuessRegister — Method
KSPGuessRegister(petsclib::PetscLibType,sname::String, fnc::external)Registers a method for initial guess computation in Krylov subspace solver package.
Not Collective, No Fortran Support
Input Parameters:
sname- name of a new user-defined solverfunction- routine to create method context
-seealso: , KSPGuess, KSPGuessRegisterAll()
External Links
- PETSc Manual:
Ksp/KSPGuessRegister
PETSc.LibPETSc.KSPGuessSetFromOptions — Method
KSPGuessSetFromOptions(petsclib::PetscLibType,guess::KSPGuess)Sets the options for a KSPGuess from the options database
Collective
Input Parameter:
guess-KSPGuessobject
Options Database Keys:
-ksp_guess_type <method>- Turns on generation of initial guesses and sets the method; use -help for a list of available methods-ksp_guess_view <viewer>- view theKSPGuessobject-ksp_guess_fischer_model <a,b>- set details for the Fischer models-ksp_guess_fischer_monitor- monitor the Fischer models-ksp_guess_fischer_tol <tol>- set the tolerance for the Fischer models-ksp_guess_pod_size <size>- Number of snapshots-ksp_guess_pod_monitor true- monitor the pod initial guess processing-ksp_guess_pod_tol <tol>- Tolerance to retain eigenvectors-ksp_guess_pod_Ainner true- Use the operator as inner product (must be SPD)
Level: developer
-seealso: , KSPGuess, KSPGetGuess(), KSPGuessSetType(), KSPGuessType
External Links
- PETSc Manual:
Ksp/KSPGuessSetFromOptions
PETSc.LibPETSc.KSPGuessSetTolerance — Method
KSPGuessSetTolerance(petsclib::PetscLibType,guess::KSPGuess, tol::PetscReal)Sets the relative tolerance used in either eigenvalue (POD) or singular value (Fischer type 3) calculations.
Collective
Input Parameters:
guess-KSPGuessobjecttol- the tolerance
Options Database Key:
-ksp_guess_fischer_tol <tol>- set the tolerance for the Fischer models-ksp_guess_pod_tol <tol>- set the tolerance for the Pod models
Level: developer
-seealso: , KSPGuess, KSPGuessType, KSPGuessSetFromOptions()
External Links
- PETSc Manual:
Ksp/KSPGuessSetTolerance
PETSc.LibPETSc.KSPGuessSetType — Method
KSPGuessSetType(petsclib::PetscLibType,guess::KSPGuess, type::KSPGuessType)Sets the type of a KSPGuess. Each KSPGuessType provides a different algorithm for computing the initial guess.
Logically Collective
Input Parameters:
guess- the initial guess object for the Krylov methodtype- a knownKSPGuessType
Options Database Key:
-ksp_guess_type <method>- Turns on generation of initial guesses and sets the method; seeKSPGuessTypefor a list of available types
Level: developer
-seealso: , KSP, KSPGuess, KSPGuessType, KSPGuessRegister(), KSPGuessCreate(), KSPGUESSFISCHER, KSPGUESSPOD
External Links
- PETSc Manual:
Ksp/KSPGuessSetType
PETSc.LibPETSc.KSPGuessSetUp — Method
KSPGuessSetUp(petsclib::PetscLibType,guess::KSPGuess)Setup the initial guess object
Collective
Input Parameter:
guess- the initial guess context
Level: developer
-seealso: , KSPGuessCreate(), KSPGuess
External Links
- PETSc Manual:
Ksp/KSPGuessSetUp
PETSc.LibPETSc.KSPGuessUpdate — Method
KSPGuessUpdate(petsclib::PetscLibType,guess::KSPGuess, rhs::PetscVec, sol::PetscVec)Updates the guess object with the current solution and rhs vector
Collective
Input Parameters:
guess- the initial guess contextrhs- the corresponding rhssol- the computed solution
Level: developer
-seealso: , KSPGuessCreate(), KSPGuess
External Links
- PETSc Manual:
Ksp/KSPGuessUpdate
PETSc.LibPETSc.KSPGuessView — Method
KSPGuessView(petsclib::PetscLibType,guess::KSPGuess, view::PetscViewer)View the KSPGuess object
Logically Collective
Input Parameters:
guess- the initial guess object for the Krylov methodview- the viewer object
Options Database Key:
-ksp_guess_view viewer- view theKSPGuessobject
Level: developer
-seealso: , KSP, KSPGuess, KSPGuessType, KSPGuessRegister(), KSPGuessCreate(), PetscViewer
External Links
- PETSc Manual:
Ksp/KSPGuessView