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::AbstractKSP, 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
See also: KSP, KSPSetOptionsPrefix(), KSPGetOptionsPrefix(), KSPSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPAppendOptionsPrefix
PETSc.LibPETSc.KSPBCGSLSetEll — Method
KSPBCGSLSetEll(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPBCGSLSetUsePseudoinverse(), KSP, KSPBCGSL, KSPBCGSLSetPol(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetEll
PETSc.LibPETSc.KSPBCGSLSetPol — Method
KSPBCGSLSetPol(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPBCGSL, KSPCreate(), KSPSetType(), KSPCBGSL, KSPBCGSLSetUsePseudoinverse(), KSPBCGSLSetEll(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetPol
PETSc.LibPETSc.KSPBCGSLSetUsePseudoinverse — Method
KSPBCGSLSetUsePseudoinverse(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPBCGSLSetEll(), KSP, KSPCBGSL, KSPBCGSLSetPol(), KSPBCGSLSetXRes()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetUsePseudoinverse
PETSc.LibPETSc.KSPBCGSLSetXRes — Method
KSPBCGSLSetXRes(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPBCGSLSetEll(), KSPBCGSLSetPol(), KSP, KSPCBGSL, KSPBCGSLSetUsePseudoinverse()
External Links
- PETSc Manual:
KSP/KSPBCGSLSetXRes
PETSc.LibPETSc.KSPBuildResidual — Method
KSPBuildResidual(petsclib::PetscLibType, ksp::AbstractKSP, t::AbstractPetscVec, v::AbstractPetscVec, M_V::AbstractPetscVec)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
See also: KSP, KSPBuildSolution()
External Links
- PETSc Manual:
KSP/KSPBuildResidual
PETSc.LibPETSc.KSPBuildResidualDefault — Method
KSPBuildResidualDefault(petsclib::PetscLibType, ksp::AbstractKSP, t::AbstractPetscVec, v::AbstractPetscVec, M_V::AbstractPetscVec)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
See also: KSP, KSPBuildSolutionDefault()
External Links
- PETSc Manual:
KSP/KSPBuildResidualDefault
PETSc.LibPETSc.KSPBuildSolution — Method
KSPBuildSolution(petsclib::PetscLibType, ksp::AbstractKSP, v::AbstractPetscVec, M_V::AbstractPetscVec)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
See also: KSPGetSolution(), KSPBuildResidual(), KSP
External Links
- PETSc Manual:
KSP/KSPBuildSolution
PETSc.LibPETSc.KSPBuildSolutionDefault — Method
KSPBuildSolutionDefault(petsclib::PetscLibType, ksp::AbstractKSP, v::AbstractPetscVec, M_V::AbstractPetscVec)Default code to build/move the solution.
Collective
Input Parameters:
ksp- iterative contextv- pointer to the user's vector
Output Parameter:
V- pointer to a vector containing the solution
Level: advanced
See also: KSP, KSPGetSolution(), KSPBuildResidualDefault()
External Links
- PETSc Manual:
KSP/KSPBuildSolutionDefault
PETSc.LibPETSc.KSPCGGetNormD — Method
norm_d::PetscReal = KSPCGGetNormD(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGGetNormD
PETSc.LibPETSc.KSPCGGetObjFcn — Method
o_fcn::PetscReal = KSPCGGetObjFcn(petsclib::PetscLibType, ksp::AbstractKSP)Get the conjugate gradient objective function value
Not collective
Input Parameters:
ksp- the iterative contexto_fcn- the objective function value
Level: advanced
See also: KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, KSPMonitorSet
External Links
- PETSc Manual:
KSP/KSPCGGetObjFcn
PETSc.LibPETSc.KSPCGSetObjectiveTarget — Method
KSPCGSetObjectiveTarget(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGSetObjectiveTarget
PETSc.LibPETSc.KSPCGSetRadius — Method
KSPCGSetRadius(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPCG, KSPNASH, KSPSTCG, KSPGLTR, SNESNEWTONTR
External Links
- PETSc Manual:
KSP/KSPCGSetRadius
PETSc.LibPETSc.KSPCGSetType — Method
KSPCGSetType(petsclib::PetscLibType, ksp::AbstractKSP, 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
$KSP_CG_HERMITIAN - complex, Hermitian matrix (default) KSP_CG_SYMMETRIC - complex, symmetric matrix$
Options Database Keys:
-ksp_cg_type hermitian- Indicates Hermitian matrix-ksp_cg_type symmetric- Indicates symmetric matrix
Level: intermediate
See also: KSP, KSPCG
External Links
- PETSc Manual:
KSP/KSPCGSetType
PETSc.LibPETSc.KSPCGUseSingleReduction — Method
KSPCGUseSingleReduction(petsclib::PetscLibType, ksp::AbstractKSP, 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 (true|false)- Merge inner products into singleMPI_Allreduce()
Level: intermediate
See also: KSP, KSPCG, KSPGMRES, KSPPIPECG, KSPPIPECR, KSPGROPPCG
External Links
- PETSc Manual:
KSP/KSPCGUseSingleReduction
PETSc.LibPETSc.KSPChebyshevEstEigGetKSP — Method
kspest::KSP = KSPChebyshevEstEigGetKSP(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPCHEBYSHEV, KSPChebyshevEstEigSet()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigGetKSP
PETSc.LibPETSc.KSPChebyshevEstEigSet — Method
KSPChebyshevEstEigSet(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPCHEBYSHEV, KSPChebyshevEstEigSetUseNoisy(), KSPChebyshevEstEigGetKSP()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigSet
PETSc.LibPETSc.KSPChebyshevEstEigSetUseNoisy — Method
KSPChebyshevEstEigSetUseNoisy(petsclib::PetscLibType, ksp::AbstractKSP, use::PetscBool)use a noisy random number generated right-hand side to estimate the extreme eigenvalues instead of the given right-hand side
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
See also: KSPCHEBYSHEV, KSPChebyshevEstEigSet(), KSPChebyshevEstEigGetKSP()
External Links
- PETSc Manual:
KSP/KSPChebyshevEstEigSetUseNoisy
PETSc.LibPETSc.KSPChebyshevGetKind — Method
kind::KSPChebyshevKind = KSPChebyshevGetKind(petsclib::PetscLibType, ksp::AbstractKSP)get the kind of Chebyshev polynomial to use
Logically Collective
Input Parameters:
ksp- Linear solver contextkind- The kind of Chebyshev polynomial used
Level: intermediate
See also: 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::AbstractKSP, 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
See also: KSPCHEBYSHEV, KSPChebyshevEstEigSet()
External Links
- PETSc Manual:
KSP/KSPChebyshevSetEigenvalues
PETSc.LibPETSc.KSPChebyshevSetKind — Method
KSPChebyshevSetKind(petsclib::PetscLibType, ksp::AbstractKSP, 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 (first|fourth|opt_fourth)- which kind of Chebyshev polynomial to use
Level: intermediate
See also: 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::AbstractKSP, pc::AbstractPC, vec::AbstractPetscVec)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 infinity to indicate lack of convergence
Level: developer
See also: 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::AbstractKSP)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
See also: KSP, KSPConvergedRateView()
External Links
- PETSc Manual:
KSP/KSPComputeConvergenceRate
PETSc.LibPETSc.KSPComputeEigenvalues — Method
neig::PetscInt = KSPComputeEigenvalues(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, r::Vector{PetscReal}, c::Vector{PetscReal})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
See also: KSPSetComputeEigenvalues(), KSPSetComputeSingularValues(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), KSP, KSPComputeRitz()
External Links
- PETSc Manual:
KSP/KSPComputeEigenvalues
PETSc.LibPETSc.KSPComputeEigenvaluesExplicitly — Method
KSPComputeEigenvaluesExplicitly(petsclib::PetscLibType, ksp::AbstractKSP, nmax::PetscInt, r::Vector{PetscReal}, c::Vector{PetscReal})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
See also: KSP, KSPComputeEigenvalues(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), KSPSetOperators(), KSPSolve()
External Links
- PETSc Manual:
KSP/KSPComputeEigenvaluesExplicitly
PETSc.LibPETSc.KSPComputeExtremeSingularValues — Method
emax::PetscReal,emin::PetscReal = KSPComputeExtremeSingularValues(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetComputeSingularValues(), KSPMonitorSingularValue(), KSPComputeEigenvalues(), KSP, KSPComputeRitz()
External Links
- PETSc Manual:
KSP/KSPComputeExtremeSingularValues
PETSc.LibPETSc.KSPComputeOperator — Method
mat::PetscMat = KSPComputeOperator(petsclib::PetscLibType, ksp::AbstractKSP, mattype::String)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
See also: KSP, KSPSetOperators(), KSPComputeEigenvaluesExplicitly(), PCComputeOperator(), KSPSetDiagonalScale(), KSPSetNullSpace(), MatType
External Links
- PETSc Manual:
KSP/KSPComputeOperator
PETSc.LibPETSc.KSPComputeRitz — Method
nrit::PetscInt = KSPComputeRitz(petsclib::PetscLibType, ksp::AbstractKSP, ritz::PetscBool, small::PetscBool, S::Vector{<:AbstractPetscVec}, tetar::Vector{PetscReal}, tetai::Vector{PetscReal})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
See also: KSPSetComputeRitz(), KSP, KSPGMRES, KSPComputeEigenvalues(), KSPSetComputeSingularValues(), KSPMonitorSingularValue()
External Links
- PETSc Manual:
KSP/KSPComputeRitz
PETSc.LibPETSc.KSPConvergedDefault — Method
reason::KSPConvergedReason = KSPConvergedDefault(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, ctx::Ptr{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
See also: KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPSetMinimumIterations(), KSPConvergenceTestFn, KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetConvergedMaxits(), KSPConvergedDefaultCreate(), KSPConvergedDefaultDestroy()
External Links
- PETSc Manual:
KSP/KSPConvergedDefault
PETSc.LibPETSc.KSPConvergedDefaultCreate — Method
ctx::Ptr{Cvoid} = KSPConvergedDefaultCreate(petsclib::PetscLibType)Creates and initializes the context used by the KSPConvergedDefault() function
Not Collective
Output Parameter:
ctx- convergence context
Level: intermediate
See also: 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::Ptr{Cvoid})Frees the space used by the KSPConvergedDefault() function context
Not Collective
Input Parameter:
ctx- convergence context
Level: intermediate
See also: KSP, KSPConvergedDefault(), KSPConvergedDefaultCreate(), KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetUMIRNorm()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultDestroy
PETSc.LibPETSc.KSPConvergedDefaultSetConvergedMaxits — Method
KSPConvergedDefaultSetConvergedMaxits(petsclib::PetscLibType, ksp::AbstractKSP, 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 (true|false)- Declare convergence if the maximum number of iterations is reached
Level: intermediate
See also: KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetUIRNorm()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetConvergedMaxits
PETSc.LibPETSc.KSPConvergedDefaultSetUIRNorm — Method
KSPConvergedDefaultSetUIRNorm(petsclib::PetscLibType, ksp::AbstractKSP)makes the default convergence test use || B(b - A(initial guess))|| instead of || 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_initial_residual_norm (true|false)- Use initial residual norm for computing relative convergence
Level: intermediate
See also: KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUMIRNorm(), KSPConvergedDefaultSetConvergedMaxits()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetUIRNorm
PETSc.LibPETSc.KSPConvergedDefaultSetUMIRNorm — Method
KSPConvergedDefaultSetUMIRNorm(petsclib::PetscLibType, ksp::AbstractKSP)makes the default convergence test use \min(|| B(b - A(initial guess))||,|| 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 (true|false)- Use minimum of initial residual norm and b for computing relative convergence
Level: intermediate
See also: KSP, KSPSetConvergenceTest(), KSPSetTolerances(), KSPConvergedSkip(), KSPConvergedReason, KSPGetConvergedReason(), KSPConvergedDefaultSetUIRNorm(), KSPConvergedDefaultSetConvergedMaxits()
External Links
- PETSc Manual:
KSP/KSPConvergedDefaultSetUMIRNorm
PETSc.LibPETSc.KSPConvergedRateView — Method
KSPConvergedRateView(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPConvergedReasonView(), KSPGetConvergedRate(), KSPSetTolerances(), KSPConvergedDefault()
External Links
- PETSc Manual:
KSP/KSPConvergedRateView
PETSc.LibPETSc.KSPConvergedReasonView — Method
KSPConvergedReasonView(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: 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::AbstractKSP)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
See also: KSPCreate(), KSPDestroy(), KSPReset(), KSPConvergedReasonViewSet()
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewCancel
PETSc.LibPETSc.KSPConvergedReasonViewFromOptions — Method
KSPConvergedReasonViewFromOptions(petsclib::PetscLibType, ksp::AbstractKSP)Processes command line options to determine if/how a KSPConvergedReason is to be viewed.
Collective
Input Parameter:
ksp- theKSPobject
Level: intermediate
See also: KSPConvergedReasonView(), KSPConvergedReasonViewSet()
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewFromOptions
PETSc.LibPETSc.KSPConvergedReasonViewSet — Method
KSPConvergedReasonViewSet(petsclib::PetscLibType, ksp::AbstractKSP, f::Ptr{Cvoid}, ctx::Ptr{Cvoid}, reasonviewdestroy::Ptr{Cvoid})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, seeKSPConvergedReasonViewFnctx- [optional] context for private data for theKSPConvergedReasonview routine (useNULLif context is not needed)reasonviewdestroy- [optional] routine that freesctx(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
See also: KSPConvergedReasonView(), KSPConvergedReasonViewFn, KSPConvergedReasonViewCancel(), PetscCtxDestroyFn
External Links
- PETSc Manual:
KSP/KSPConvergedReasonViewSet
PETSc.LibPETSc.KSPConvergedSkip — Method
reason::KSPConvergedReason = KSPConvergedSkip(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, dtx::Ptr{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
See also: KSP, KSPCG, KSPBCGS, KSPConvergenceTestFn, KSPSetConvergenceTest(), KSPSetTolerances(), KSPSetNormType(), KSPConvergedReason
External Links
- PETSc Manual:
KSP/KSPConvergedSkip
PETSc.LibPETSc.KSPCreate — Method
inksp::KSP = 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
See also: 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::AbstractKSP, 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
See also: MatCreateVecs(), VecDestroyVecs(), KSPSetWorkVecs()
External Links
- PETSc Manual:
KSP/KSPCreateVecs
PETSc.LibPETSc.KSPDestroy — Method
KSPDestroy(petsclib::PetscLibType, ksp::AbstractKSP)Destroys a KSP context.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Level: beginner
See also: KSPCreate(), KSPSetUp(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPDestroy
PETSc.LibPETSc.KSPDestroyDefault — Method
KSPDestroyDefault(petsclib::PetscLibType, ksp::AbstractKSP)Destroys an iterative context variable for methods with no separate context. Preferred calling sequence KSPDestroy().
Collective
Input Parameter:
ksp- the iterative context
Level: advanced
See also: KSP, KSPDestroy()
External Links
- PETSc Manual:
KSP/KSPDestroyDefault
PETSc.LibPETSc.KSPFCGGetMmax — Method
mmax::PetscInt = KSPFCGGetMmax(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPFCG, KSPFCGGetTruncationType(), KSPFCGGetNprealloc(), KSPFCGSetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGGetMmax
PETSc.LibPETSc.KSPFCGGetNprealloc — Method
nprealloc::PetscInt = KSPFCGGetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPFCG, KSPFCGGetTruncationType(), KSPFCGSetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGGetNprealloc
PETSc.LibPETSc.KSPFCGGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPFCGGetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP)get the truncation strategy employed by KSPFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
Level: intermediate
See also: 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::AbstractKSP, 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
See also: KSPFCG, KSPFCGGetTruncationType(), KSPFCDTruncationType, KSPFCGSetTruncationType(), KSPFCGGetNprealloc(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGSetMmax
PETSc.LibPETSc.KSPFCGSetNprealloc — Method
KSPFCGSetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPFCG, KSPFCGGetTruncationType(), KSPFCGGetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPFCGSetNprealloc
PETSc.LibPETSc.KSPFCGSetTruncationType — Method
KSPFCGSetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP, truncstrat::KSPFCDTruncationType)specify how many of its stored previous directions KSPFCG uses during orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contexttruncstrat- the choice of strategy
$KSP_FCD_TRUNC_TYPE_STANDARD uses all (up to `mmax`) stored directions KSP_FCD_TRUNC_TYPE_NOTAY uses the last `max(1,mod(i,mmax))` stored directions at iteration i = 0, 1, ...$
Options Database Key:
-ksp_fcg_truncation_type (standard|notay)- specify how many of its stored previous directionsKSPFCGuses during orthogonalization
Level: intermediate
See also: KSPFCG, 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
pc::PC = KSPFETIDPGetInnerBDDC(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: MATIS, PCBDDC, KSPFETIDP, KSPFETIDPSetInnerBDDC(), KSPFETIDPGetInnerKSP()
External Links
- PETSc Manual:
KSP/KSPFETIDPGetInnerBDDC
PETSc.LibPETSc.KSPFETIDPGetInnerKSP — Method
innerksp::KSP = KSPFETIDPGetInnerKSP(petsclib::PetscLibType, ksp::AbstractKSP)Gets the KSP object for the Lagrange multipliers from inside a KSPFETIDP
Input Parameter:
ksp- theKSPFETIDP
Output Parameter:
innerksp- theKSPfor the multipliers
Level: advanced
See also: KSPFETIDP, MATIS, PCBDDC, KSPFETIDPSetInnerBDDC(), KSPFETIDPGetInnerBDDC()
External Links
- PETSc Manual:
KSP/KSPFETIDPGetInnerKSP
PETSc.LibPETSc.KSPFETIDPSetInnerBDDC — Method
KSPFETIDPSetInnerBDDC(petsclib::PetscLibType, ksp::AbstractKSP, pc::AbstractPC)Provides the PCBDDC preconditioner used to set up the KSPFETIDP matrix for the Lagrange multipliers
Collective
Input Parameters:
ksp- theKSPFETIDPKrylov solverpc- thePCBDDCpreconditioner
Level: advanced
See also: MATIS, PCBDDC, KSPFETIDPGetInnerBDDC(), KSPFETIDPGetInnerKSP()
External Links
- PETSc Manual:
KSP/KSPFETIDPSetInnerBDDC
PETSc.LibPETSc.KSPFETIDPSetPressureOperator — Method
KSPFETIDPSetPressureOperator(petsclib::PetscLibType, ksp::AbstractKSP, P::AbstractPetscMat)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
See also: KSPFETIDP, MATIS, PCBDDC, KSPFETIDPGetInnerBDDC(), KSPFETIDPGetInnerKSP(), KSPSetOperators()
External Links
- PETSc Manual:
KSP/KSPFETIDPSetPressureOperator
PETSc.LibPETSc.KSPFinalizePackage — Method
KSPFinalizePackage(petsclib::PetscLibType)This function destroys everything in the KSP package. It is called from PetscFinalize().
Level: developer
See also: PetscFinalize(), KSPInitializePackage()
External Links
- PETSc Manual:
KSP/KSPFinalizePackage
PETSc.LibPETSc.KSPFlexibleModifyPCKSP — Method
KSPFlexibleModifyPCKSP(petsclib::PetscLibType, ksp::AbstractKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Ptr{Cvoid})modifies the attributes of the PCKSP preconditioner, see .
Input Parameters:
ksp- the ksp context being used.total_its- the total number ofKSPiterations that have occurred.loc_its- the number ofKSPiterations since last restart.res_norm- the current residual norm.ctx- context, unused in this routine
Level: intermediate
See also: KSPFGMRES, KSPFCG, KSPPIPEFCG, KSPGCR, KSPPIPEGCR, KSPFlexibleModifyPCFn, KSPFlexibleSetModifyPC()
External Links
- PETSc Manual:
KSP/KSPFlexibleModifyPCKSP
PETSc.LibPETSc.KSPFlexibleModifyPCNoChange — Method
KSPFlexibleModifyPCNoChange(petsclib::PetscLibType, ksp::AbstractKSP, total_its::PetscInt, loc_its::PetscInt, res_norm::PetscReal, ctx::Ptr{Cvoid})this is the default used by the flexible Krylov methods - it doesn't change the preconditioner.
Input Parameters:
ksp- the ksp context being used.total_its- the total number ofKSPiterations that have occurred.loc_its- the number ofKSPiterations since last restart.res_norm- the current residual norm.ctx- context variable, unused in this routine
Level: intermediate
See also: KSPFGMRES, KSPFCG, KSPPIPEFCG, KSPGCR, KSPPIPEGCR, KSPFlexibleModifyPCFn, KSPFlexibleSetModifyPC(), KSPFlexibleModifyPCKSP()
External Links
- PETSc Manual:
KSP/KSPFlexibleModifyPCNoChange
PETSc.LibPETSc.KSPFlexibleSetModifyPC — Method
KSPFlexibleSetModifyPC(petsclib::PetscLibType, ksp::AbstractKSP, fcn::Ptr{Cvoid}, ctx::Ptr{Cvoid}, destroy::Ptr{Cvoid})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
See also: KSPFGMRES, KSPFCG, KSPPIPEFCG, KSPGCR, KSPPIPEGCR, KSPFlexibleModifyPCFn, KSPFlexibleModifyPCNoChange(), KSPFlexibleModifyPCKSP()
External Links
- PETSc Manual:
KSP/KSPFlexibleSetModifyPC
PETSc.LibPETSc.KSPGCRGetRestart — Method
restart::PetscInt = KSPGCRGetRestart(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPGCR, KSPSetTolerances(), KSPGCRSetRestart(), KSPGMRESGetRestart()
External Links
- PETSc Manual:
KSP/KSPGCRGetRestart
PETSc.LibPETSc.KSPGCRSetRestart — Method
KSPGCRSetRestart(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGCR, KSPSetTolerances(), KSPGCRGetRestart(), KSPGMRESSetRestart()
External Links
- PETSc Manual:
KSP/KSPGCRSetRestart
PETSc.LibPETSc.KSPGLTRGetLambda — Method
lambda::PetscReal = KSPGLTRGetLambda(petsclib::PetscLibType, ksp::AbstractKSP)Get the multiplier on the trust-region constraint when using KSPGLTR
Not Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
lambda- the multiplier
Level: advanced
See also: KSP, KSPGLTR, KSPGLTRGetMinEig()
External Links
- PETSc Manual:
KSP/KSPGLTRGetLambda
PETSc.LibPETSc.KSPGLTRGetMinEig — Method
e_min::PetscReal = KSPGLTRGetMinEig(petsclib::PetscLibType, ksp::AbstractKSP)Get minimum eigenvalue computed by KSPGLTR
Collective
Input Parameter:
ksp- the iterative context
Output Parameter:
e_min- the minimum eigenvalue
Level: advanced
See also: KSP, KSPGLTR, KSPGLTRGetLambda()
External Links
- PETSc Manual:
KSP/KSPGLTRGetMinEig
PETSc.LibPETSc.KSPGMRESClassicalGramSchmidtOrthogonalization — Method
KSPGMRESClassicalGramSchmidtOrthogonalization(petsclib::PetscLibType, ksp::AbstractKSP, 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 (true|false)- 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
See also: KSPGMRESCGSRefinementType, KSPGMRESSetOrthogonalization(), KSPGMRESSetCGSRefinementType(), KSPGMRESGetCGSRefinementType(), KSPGMRESGetOrthogonalization(), KSPGMRESModifiedGramSchmidtOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESClassicalGramSchmidtOrthogonalization
PETSc.LibPETSc.KSPGMRESGetCGSRefinementType — Method
type::KSPGMRESCGSRefinementType = KSPGMRESGetCGSRefinementType(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPGMRES, KSPGMRESSetOrthogonalization(), KSPGMRESCGSRefinementType, KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESSetCGSRefinementType(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESGetCGSRefinementType
PETSc.LibPETSc.KSPGMRESGetOrthogonalization — Method
KSPGMRESGetOrthogonalization(petsclib::PetscLibType, ksp::AbstractKSP, noname::Ptr{Cvoid})Gets the orthogonalization routine used by KSPGMRES and KSPFGMRES.
Not Collective
Input Parameter:
ksp- iterative context obtained fromKSPCreate()
Output Parameter:
fcn- orthogonalization function
Calling sequence of fcn:
ksp- the solver contextit- the current iteration
Level: intermediate
See also: KSPGMRESSetRestart(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetCGSRefinementType(), KSPGMRESSetOrthogonalization(), KSPGMRESModifiedGramSchmidtOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetCGSRefinementType()
External Links
- PETSc Manual:
KSP/KSPGMRESGetOrthogonalization
PETSc.LibPETSc.KSPGMRESGetRestart — Method
restart::PetscInt = KSPGMRESGetRestart(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: 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::AbstractKSP, 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
See also: KSPGMRESSetOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESModifiedGramSchmidtOrthogonalization
PETSc.LibPETSc.KSPGMRESMonitorKrylov — Method
KSPGMRESMonitorKrylov(petsclib::PetscLibType, ksp::AbstractKSP, its::PetscInt, fgnorm::PetscReal, Viewers::Ptr{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)Viewers- a collection of viewers created withPetscViewersCreate()
Options Database Key:
-ksp_gmres_krylov_monitor (true|false)- Plot the Krylov directions
Level: intermediate
See also: KSPGMRES, KSPMonitorSet(), KSPMonitorResidual(), VecView(), PetscViewersCreate(), PetscViewersDestroy()
External Links
- PETSc Manual:
KSP/KSPGMRESMonitorKrylov
PETSc.LibPETSc.KSPGMRESSetBreakdownTolerance — Method
KSPGMRESSetBreakdownTolerance(petsclib::PetscLibType, ksp::AbstractKSP, 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 tol- set tolerance for determining divergence breakdown
Level: intermediate
See also: KSPGMRES, KSPSetTolerances(), KSPGMRESSetHapTol(), KSPConvergedReason
External Links
- PETSc Manual:
KSP/KSPGMRESSetBreakdownTolerance
PETSc.LibPETSc.KSPGMRESSetCGSRefinementType — Method
KSPGMRESSetCGSRefinementType(petsclib::PetscLibType, ksp::AbstractKSP, 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
$KSP_GMRES_CGS_REFINE_NEVER KSP_GMRES_CGS_REFINE_IFNEEDED KSP_GMRES_CGS_REFINE_ALWAYS$
Options Database Key:
-ksp_gmres_cgs_refinement_type (refine_never|refine_ifneeded|refine_always)- refinement type
Level: intermediate
See also: KSPGMRES, KSPGMRESSetOrthogonalization(), KSPGMRESCGSRefinementType, KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetCGSRefinementType(), KSPGMRESGetOrthogonalization()
External Links
- PETSc Manual:
KSP/KSPGMRESSetCGSRefinementType
PETSc.LibPETSc.KSPGMRESSetHapTol — Method
KSPGMRESSetHapTol(petsclib::PetscLibType, ksp::AbstractKSP, tol::PetscReal)Sets the tolerance for detecting a happy breakdown in GMRES (KSPGMRES, KSPFGMRES and KSPLGMRES and others)
Logically Collective
Input Parameters:
ksp- the Krylov space solver contexttol- the tolerance for detecting a happy breakdown
Options Database Key:
-ksp_gmres_haptol tol- set tolerance for determining happy breakdown
Level: intermediate
See also: KSPGMRES, KSPSetTolerances()
External Links
- PETSc Manual:
KSP/KSPGMRESSetHapTol
PETSc.LibPETSc.KSPGMRESSetOrthogonalization — Method
KSPGMRESSetOrthogonalization(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGMRESSetRestart(), KSPGMRESSetPreAllocateVectors(), KSPGMRESSetCGSRefinementType(), KSPGMRESModifiedGramSchmidtOrthogonalization(), KSPGMRESClassicalGramSchmidtOrthogonalization(), KSPGMRESGetCGSRefinementType()
External Links
- PETSc Manual:
KSP/KSPGMRESSetOrthogonalization
PETSc.LibPETSc.KSPGMRESSetPreAllocateVectors — Method
KSPGMRESSetPreAllocateVectors(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPGMRESSetRestart(), KSPGMRESSetOrthogonalization(), KSPGMRESGetOrthogonalization(), VecMDot(), VecMAXPY()
External Links
- PETSc Manual:
KSP/KSPGMRESSetPreAllocateVectors
PETSc.LibPETSc.KSPGMRESSetRestart — Method
KSPGMRESSetRestart(petsclib::PetscLibType, ksp::AbstractKSP, 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 restart- integer restart value
Level: intermediate
See also: KSPGMRES, KSPSetTolerances(), KSPGMRESSetOrthogonalization(), KSPGMRESSetPreAllocateVectors(), KSPGMRESGetRestart(), KSPFGMRES, KSPLGMRES, KSPPGMRES, KSPAGMRES, KSPDGMRES, KSPPIPEFGMRES
External Links
- PETSc Manual:
KSP/KSPGMRESSetRestart
PETSc.LibPETSc.KSPGetAndClearConvergenceTest — Method
converge::Ptr{Cvoid},ctx::Ptr{Cvoid},destroy::Ptr{Cvoid} = KSPGetAndClearConvergenceTest(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPSetConvergenceTest(), KSPGetConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetAndClearConvergenceTest
PETSc.LibPETSc.KSPGetApplicationContext — Method
ctx::Ptr{Cvoid} = KSPGetApplicationContext(petsclib::PetscLibType, ksp::AbstractKSP)Gets the user-defined context for the linear solver set with KSPSetApplicationContext()
Not Collective
Input Parameter:
ksp-KSPcontext
Output Parameter:
ctx- a pointer to the application context
Level: intermediate
See also: KSP, KSPSetApplicationContext()
External Links
- PETSc Manual:
KSP/KSPGetApplicationContext
PETSc.LibPETSc.KSPGetComputeEigenvalues — Method
flg::PetscBool = KSPGetComputeEigenvalues(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPComputeEigenvalues(), KSPComputeEigenvaluesExplicitly(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPGetComputeEigenvalues
PETSc.LibPETSc.KSPGetComputeSingularValues — Method
flg::PetscBool = KSPGetComputeSingularValues(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPComputeExtremeSingularValues(), KSPMonitorSingularValue(), KSP
External Links
- PETSc Manual:
KSP/KSPGetComputeSingularValues
PETSc.LibPETSc.KSPGetConvergedNegativeCurvature — Method
flg::PetscBool = KSPGetConvergedNegativeCurvature(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPConvergedReason, KSPSetConvergedNegativeCurvature()
External Links
- PETSc Manual:
KSP/KSPGetConvergedNegativeCurvature
PETSc.LibPETSc.KSPGetConvergedReason — Method
reason::KSPConvergedReason = KSPGetConvergedReason(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPConvergedReason, KSP, KSPSetConvergenceTest(), KSPConvergedDefault(), KSPSetTolerances(), KSPConvergedReasonView(), KSPGetConvergedReasonString()
External Links
- PETSc Manual:
KSP/KSPGetConvergedReason
PETSc.LibPETSc.KSPGetConvergedReasonString — Method
strreason::String = KSPGetConvergedReasonString(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPGetConvergedReason()
External Links
- PETSc Manual:
KSP/KSPGetConvergedReasonString
PETSc.LibPETSc.KSPGetConvergenceContext — Method
ctx::Ptr{Cvoid} = KSPGetConvergenceContext(petsclib::PetscLibType, ksp::AbstractKSP)Gets the convergence context set with KSPSetConvergenceTest().
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
ctx- monitoring context
Level: advanced
See also: KSP, KSPConvergedDefault(), KSPSetConvergenceTest(), KSPGetConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetConvergenceContext
PETSc.LibPETSc.KSPGetConvergenceTest — Method
converge::Ptr{Cvoid},ctx::Ptr{Cvoid},destroy::Ptr{Cvoid} = KSPGetConvergenceTest(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPSetConvergenceTest(), KSPGetAndClearConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPGetConvergenceTest
PETSc.LibPETSc.KSPGetDM — Method
dm::PetscDM = KSPGetDM(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, DM, KSPSetDM(), KSPSetDMActive()
External Links
- PETSc Manual:
KSP/KSPGetDM
PETSc.LibPETSc.KSPGetDiagonalScale — Method
scale::PetscBool = KSPGetDiagonalScale(petsclib::PetscLibType, ksp::AbstractKSP)Checks if KSP solver scales the matrix and right-hand side, that is if KSPSetDiagonalScale() has been called
Not Collective
Input Parameter:
ksp- theKSPcontext
Output Parameter:
scale-PETSC_TRUEorPETSC_FALSE
Level: intermediate
See also: KSP, KSPSetDiagonalScale(), KSPSetDiagonalScaleFix()
External Links
- PETSc Manual:
KSP/KSPGetDiagonalScale
PETSc.LibPETSc.KSPGetDiagonalScaleFix — Method
fix::PetscBool = KSPGetDiagonalScaleFix(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPGetDiagonalScale(), KSPSetDiagonalScale(), KSPSetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPGetDiagonalScaleFix
PETSc.LibPETSc.KSPGetErrorHistory — Method
a::Vector{PetscReal},na::PetscInt = KSPGetErrorHistory(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetErrorHistory(), KSPGetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPGetErrorHistory
PETSc.LibPETSc.KSPGetErrorIfNotConverged — Method
flag::PetscBool = KSPGetErrorIfNotConverged(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetErrorIfNotConverged(), KSP
External Links
- PETSc Manual:
KSP/KSPGetErrorIfNotConverged
PETSc.LibPETSc.KSPGetGuess — Method
guess::KSPGuess = KSPGetGuess(petsclib::PetscLibType, ksp::AbstractKSP)Gets the initial guess generator for the KSP.
Not Collective
Input Parameter:
ksp- the Krylov context
Output Parameter:
guess- the object
Level: developer
See also: KSPGuess, KSP, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetUseFischerGuess(), KSPSetGuess()
External Links
- PETSc Manual:
KSP/KSPGetGuess
PETSc.LibPETSc.KSPGetInitialGuessKnoll — Method
flag::PetscBool = KSPGetInitialGuessKnoll(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetInitialGuessKnoll(), KSPSetInitialGuessNonzero(), KSPGetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPGetInitialGuessKnoll
PETSc.LibPETSc.KSPGetInitialGuessNonzero — Method
flag::PetscBool = KSPGetInitialGuessNonzero(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPGetInitialGuessNonzero
PETSc.LibPETSc.KSPGetIterationNumber — Method
its::PetscInt = KSPGetIterationNumber(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPGetResidualNorm(), KSPBuildResidual(), KSPGetTotalIterations()
External Links
- PETSc Manual:
KSP/KSPGetIterationNumber
PETSc.LibPETSc.KSPGetMatSolveBatchSize — Method
bs::PetscInt = KSPGetMatSolveBatchSize(petsclib::PetscLibType, ksp::AbstractKSP)Gets the maximum number of columns treated simultaneously in KSPMatSolve().
Input Parameter:
ksp- iterative solver context
Output Parameter:
bs- batch size
Level: advanced
See also: KSPMatSolve(), KSPSetMatSolveBatchSize(), -mat_mumps_icntl_27, -matproduct_batch_size
External Links
- PETSc Manual:
KSP/KSPGetMatSolveBatchSize
PETSc.LibPETSc.KSPGetMinimumIterations — Method
minit::PetscInt = KSPGetMinimumIterations(petsclib::PetscLibType, ksp::AbstractKSP)Gets the minimum number of iterations to use, regardless of the tolerances, that was set with KSPSetMinimumIterations() or -ksp_min_it
Not Collective
Input Parameter:
ksp- the Krylov subspace context
Output Parameter:
minit- minimum number of iterations to use
Level: intermediate
See also: KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetTolerances(), KSPSetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPGetMinimumIterations
PETSc.LibPETSc.KSPGetMonitorContext — Method
ctx::Ptr{Cvoid} = KSPGetMonitorContext(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPMonitorResidual(), KSP
External Links
- PETSc Manual:
KSP/KSPGetMonitorContext
PETSc.LibPETSc.KSPGetNestLevel — Method
level::PetscInt = KSPGetNestLevel(petsclib::PetscLibType, ksp::AbstractKSP)gets the amount of nesting the KSP has
Not Collective
Input Parameter:
ksp- theKSP
Output Parameter:
level- the nest level
Level: developer
See also: 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::AbstractKSP)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
See also: KSPNormType, KSPSetNormType(), KSPConvergedSkip()
External Links
- PETSc Manual:
KSP/KSPGetNormType
PETSc.LibPETSc.KSPGetOperators — Method
Amat::PetscMat,Pmat::PetscMat = KSPGetOperators(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPSolve(), KSPGetPC(), PCSetOperators(), KSPSetOperators(), KSPGetOperatorsSet()
External Links
- PETSc Manual:
KSP/KSPGetOperators
PETSc.LibPETSc.KSPGetOperatorsSet — Method
mat::PetscBool,pmat::PetscBool = KSPGetOperatorsSet(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, PCSetOperators(), KSPGetOperators(), KSPSetOperators(), PCGetOperators(), PCGetOperatorsSet()
External Links
- PETSc Manual:
KSP/KSPGetOperatorsSet
PETSc.LibPETSc.KSPGetOptionsPrefix — Method
prefix::String = KSPGetOptionsPrefix(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPSetFromOptions(), KSPSetOptionsPrefix(), KSPAppendOptionsPrefix()
External Links
- PETSc Manual:
KSP/KSPGetOptionsPrefix
PETSc.LibPETSc.KSPGetPC — Method
pc::PC = KSPGetPC(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetPC(), KSP, PC
External Links
- PETSc Manual:
KSP/KSPGetPC
PETSc.LibPETSc.KSPGetPCSide — Method
side::PCSide = KSPGetPCSide(petsclib::PetscLibType, ksp::AbstractKSP)Gets the preconditioning side.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
side- the preconditioning side, where side is one of
$PC_LEFT - left preconditioning (default) PC_RIGHT - right preconditioning PC_SYMMETRIC - symmetric preconditioning$
Level: intermediate
See also: KSPSetPCSide(), KSP
External Links
- PETSc Manual:
KSP/KSPGetPCSide
PETSc.LibPETSc.KSPGetResidualHistory — Method
a::Vector{PetscReal},na::PetscInt = KSPGetResidualHistory(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSetResidualHistory(), KSP, KSPGetIterationNumber(), KSPSTCG, KSPBCGSL
External Links
- PETSc Manual:
KSP/KSPGetResidualHistory
PETSc.LibPETSc.KSPGetResidualNorm — Method
rnorm::PetscReal = KSPGetResidualNorm(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPSetNormType(), KSPBuildResidual(), KSPNormType
External Links
- PETSc Manual:
KSP/KSPGetResidualNorm
PETSc.LibPETSc.KSPGetReusePreconditioner — Method
flag::PetscBool = KSPGetReusePreconditioner(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPCreate(), KSPSolve(), KSPDestroy(), KSPSetReusePreconditioner(), KSP
External Links
- PETSc Manual:
KSP/KSPGetReusePreconditioner
PETSc.LibPETSc.KSPGetRhs — Method
r::PetscVec = KSPGetRhs(petsclib::PetscLibType, ksp::AbstractKSP)Gets the right-hand-side vector for the linear system to be solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
r- right-hand-side vector
Level: developer
See also: KSPGetSolution(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPGetRhs
PETSc.LibPETSc.KSPGetSolution — Method
v::PetscVec = KSPGetSolution(petsclib::PetscLibType, ksp::AbstractKSP)Gets the location of the solution for the linear system to be solved.
Not Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Output Parameter:
v- solution vector
Level: developer
See also: 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::AbstractKSP)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
See also: KSPSetTolerances(), KSP, KSPSetMinimumIterations(), KSPGetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPGetTolerances
PETSc.LibPETSc.KSPGetTotalIterations — Method
its::PetscInt = KSPGetTotalIterations(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPBuildResidual(), KSPGetResidualNorm(), KSPGetIterationNumber()
External Links
- PETSc Manual:
KSP/KSPGetTotalIterations
PETSc.LibPETSc.KSPGetType — Method
type::String = KSPGetType(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPType, KSP, KSPSetType(), PetscObjectTypeCompare(), PetscObjectTypeCompareAny()
External Links
- PETSc Manual:
KSP/KSPGetType
PETSc.LibPETSc.KSPHPDDMGetDeflationMat — Method
KSPHPDDMGetDeflationMat(petsclib::PetscLibType, ksp::AbstractKSP, U::AbstractPetscMat)External Links
- PETSc Manual:
KSP/KSPHPDDMGetDeflationMat
PETSc.LibPETSc.KSPHPDDMGetType — Method
type::KSPHPDDMType = KSPHPDDMGetType(petsclib::PetscLibType, ksp::AbstractKSP)External Links
- PETSc Manual:
KSP/KSPHPDDMGetType
PETSc.LibPETSc.KSPHPDDMSetDeflationMat — Method
KSPHPDDMSetDeflationMat(petsclib::PetscLibType, ksp::AbstractKSP, U::AbstractPetscMat)External Links
- PETSc Manual:
KSP/KSPHPDDMSetDeflationMat
PETSc.LibPETSc.KSPHPDDMSetType — Method
KSPHPDDMSetType(petsclib::PetscLibType, ksp::AbstractKSP, type::KSPHPDDMType)External Links
- PETSc Manual:
KSP/KSPHPDDMSetType
PETSc.LibPETSc.KSPInitialResidual — Method
KSPInitialResidual(petsclib::PetscLibType, ksp::AbstractKSP, vsoln::AbstractPetscVec, vt1::AbstractPetscVec, vt2::AbstractPetscVec, vres::AbstractPetscVec, vb::AbstractPetscVec)Computes the residual. Either b - ACu = b - Ax with right preconditioning or C(b - A*x) 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
See also: 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
See also: PetscInitialize(), KSPFinalizePackage()
External Links
- PETSc Manual:
KSP/KSPInitializePackage
PETSc.LibPETSc.KSPLGMRESSetAugDim — Method
KSPLGMRESSetAugDim(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPLGMRES, KSPLGMRESSetConstant()
External Links
- PETSc Manual:
KSP/KSPLGMRESSetAugDim
PETSc.LibPETSc.KSPLGMRESSetConstant — Method
KSPLGMRESSetConstant(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPLGMRES, KSPLGMRESSetAugDim()
External Links
- PETSc Manual:
KSP/KSPLGMRESSetConstant
PETSc.LibPETSc.KSPLSQRConvergedDefault — Method
reason::KSPConvergedReason = KSPLSQRConvergedDefault(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, ctx::Ptr{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
See also: 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::AbstractKSP)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
See also: KSPSolve(), KSPLSQR, KSPLSQRSetExactMatNorm()
External Links
- PETSc Manual:
KSP/KSPLSQRGetNorms
PETSc.LibPETSc.KSPLSQRGetStandardErrorVec — Method
se::PetscVec = KSPLSQRGetStandardErrorVec(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPSolve(), KSPLSQR, KSPLSQRSetComputeStandardErrorVec()
External Links
- PETSc Manual:
KSP/KSPLSQRGetStandardErrorVec
PETSc.LibPETSc.KSPLSQRMonitorResidual — Method
KSPLSQRMonitorResidual(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSPLSQR, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), KSPLSQRMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidual
PETSc.LibPETSc.KSPLSQRMonitorResidualDrawLG — Method
KSPLSQRMonitorResidualDrawLG(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSPLSQR, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPLSQRMonitorResidual(), KSPLSQRMonitorResidualDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidualDrawLG
PETSc.LibPETSc.KSPLSQRMonitorResidualDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPLSQRMonitorResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{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 application context
Output Parameter:
vf- ThePetscViewerAndFormat
Level: intermediate
See also: KSPLSQR, KSPMonitorSet(), KSPLSQRMonitorResidual(), KSPLSQRMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPLSQRMonitorResidualDrawLGCreate
PETSc.LibPETSc.KSPLSQRSetComputeStandardErrorVec — Method
KSPLSQRSetComputeStandardErrorVec(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPSolve(), KSPLSQR, KSPLSQRGetStandardErrorVec()
External Links
- PETSc Manual:
KSP/KSPLSQRSetComputeStandardErrorVec
PETSc.LibPETSc.KSPLSQRSetExactMatNorm — Method
KSPLSQRSetExactMatNorm(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPSolve(), KSPLSQR, KSPLSQRGetNorms(), KSPLSQRConvergedDefault()
External Links
- PETSc Manual:
KSP/KSPLSQRSetExactMatNorm
PETSc.LibPETSc.KSPLoad — Method
KSPLoad(petsclib::PetscLibType, newdm::AbstractKSP, 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
See also: KSP, PetscViewerBinaryOpen(), KSPView(), MatLoad(), VecLoad()
External Links
- PETSc Manual:
KSP/KSPLoad
PETSc.LibPETSc.KSPMINRESGetUseQLP — Method
qlp::PetscBool = KSPMINRESGetUseQLP(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSP, KSPMINRES, KSPMINRESSetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESGetUseQLP
PETSc.LibPETSc.KSPMINRESSetRadius — Method
KSPMINRESSetRadius(petsclib::PetscLibType, ksp::AbstractKSP, 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 radius- maximum allowed solution norm
See also: KSP, KSPMINRES, KSPMINRESSetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESSetRadius
PETSc.LibPETSc.KSPMINRESSetUseQLP — Method
KSPMINRESSetUseQLP(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPMINRES, KSPMINRESGetUseQLP()
External Links
- PETSc Manual:
KSP/KSPMINRESSetUseQLP
PETSc.LibPETSc.KSPMatSolve — Method
KSPMatSolve(petsclib::PetscLibType, ksp::AbstractKSP, B::AbstractPetscMat, X::AbstractPetscMat)Solves a linear system with multiple right-hand sides stored as a MATDENSE.
Input Parameters:
ksp- iterative solverB- block of right-hand sides
Output Parameter:
X- block of solutions
Level: intermediate
See also: KSPSolve(), MatMatSolve(), KSPMatSolveTranspose(), MATDENSE, KSPHPDDM, PCBJACOBI, PCASM, KSPSetMatSolveBatchSize()
External Links
- PETSc Manual:
KSP/KSPMatSolve
PETSc.LibPETSc.KSPMatSolveTranspose — Method
KSPMatSolveTranspose(petsclib::PetscLibType, ksp::AbstractKSP, B::AbstractPetscMat, X::AbstractPetscMat)Solves a linear system with the transposed matrix with multiple right-hand sides stored as a MATDENSE.
Input Parameters:
ksp- iterative solverB- block of right-hand sides
Output Parameter:
X- block of solutions
Level: intermediate
See also: KSPSolveTranspose(), MatMatTransposeSolve(), KSPMatSolve(), MATDENSE, KSPHPDDM, PCBJACOBI, PCASM
External Links
- PETSc Manual:
KSP/KSPMatSolveTranspose
PETSc.LibPETSc.KSPMonitor — Method
KSPMonitor(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPMonitorSet()
External Links
- PETSc Manual:
KSP/KSPMonitor
PETSc.LibPETSc.KSPMonitorCancel — Method
KSPMonitorCancel(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPMonitorResidual(), KSPMonitorSet(), KSP
External Links
- PETSc Manual:
KSP/KSPMonitorCancel
PETSc.LibPETSc.KSPMonitorDynamicTolerance — Method
KSPMonitorDynamicTolerance(petsclib::PetscLibType, ksp::AbstractKSP, its::PetscInt, fnorm::PetscReal, ctx::Ptr{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
See also: KSP, KSPMonitorDynamicToleranceCreate(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceSetCoefficient()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicTolerance
PETSc.LibPETSc.KSPMonitorDynamicToleranceCreate — Method
ctx::Ptr{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
See also: KSP, KSPMonitorDynamicTolerance(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceSetCoefficient()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceCreate
PETSc.LibPETSc.KSPMonitorDynamicToleranceDestroy — Method
KSPMonitorDynamicToleranceDestroy(petsclib::PetscLibType, ctx::Ptr{Cvoid})Destroy the monitor context used in KSPMonitorDynamicTolerance()
Input Parameter:
ctx- the monitor context
Level: advanced
See also: KSP, KSPMonitorDynamicTolerance(), KSPMonitorSet(), KSPMonitorDynamicToleranceCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceDestroy
PETSc.LibPETSc.KSPMonitorDynamicToleranceSetCoefficient — Method
ctx::Ptr{Cvoid} = KSPMonitorDynamicToleranceSetCoefficient(petsclib::PetscLibType, coeff::PetscReal)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
See also: KSP, KSPMonitorDynamicTolerance(), KSPMonitorDynamicToleranceDestroy(), KSPMonitorDynamicToleranceCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorDynamicToleranceSetCoefficient
PETSc.LibPETSc.KSPMonitorError — Method
KSPMonitorError(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm()
External Links
- PETSc Manual:
KSP/KSPMonitorError
PETSc.LibPETSc.KSPMonitorErrorDraw — Method
KSPMonitorErrorDraw(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDraw
PETSc.LibPETSc.KSPMonitorErrorDrawLG — Method
KSPMonitorErrorDrawLG(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDraw()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDrawLG
PETSc.LibPETSc.KSPMonitorErrorDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorErrorDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the context for the error and preconditioned residual plotter KSPMonitorErrorDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorErrorDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorErrorDrawLGCreate
PETSc.LibPETSc.KSPMonitorLGRange — Method
KSPMonitorLGRange(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, monctx::Ptr{Cvoid})Prints line graphs summarizing the residual norm, the fraction of elements that dominate the residual, and the convergence factor at each iteration of the KSP solver
Collective
Input Parameters:
ksp- iterative contextn- iteration numberrnorm- the 2-norm of the residual (or an approximation)monctx- aPetscViewer(typically of typePETSCVIEWERDRAW) containing the line graphs to update
Level: intermediate
See also: KSP, KSPMonitorSet(), KSPMonitorResidual(), PETSCVIEWERDRAW, PetscDrawLG
External Links
- PETSc Manual:
KSP/KSPMonitorLGRange
PETSc.LibPETSc.KSPMonitorRegister — Method
KSPMonitorRegister(petsclib::PetscLibType, name::String, vtype::String, format::PetscViewerFormat, monitor::Ptr{Cvoid}, create::Ptr{Cvoid}, destroy::Ptr{Cvoid})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
See also: KSP, KSPMonitorSet(), KSPMonitorRegisterAll(), KSPMonitorSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPMonitorRegister
PETSc.LibPETSc.KSPMonitorResidual — Method
KSPMonitorResidual(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: 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::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, PETSCVIEWERDRAW, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidualView(), KSPMonitorResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualDrawLG
PETSc.LibPETSc.KSPMonitorResidualDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the context for the (possibly preconditioned) residual norm monitor KSPMonitorResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerof typePETSCVIEWERDRAWformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: KSP, PETSCVIEWERDRAW, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidualDrawLG(), PetscViewerFormat, PetscViewer, PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorResidualRange — Method
KSPMonitorResidualRange(petsclib::PetscLibType, ksp::AbstractKSP, it::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualRange
PETSc.LibPETSc.KSPMonitorResidualShort — Method
KSPMonitorResidualShort(petsclib::PetscLibType, ksp::AbstractKSP, its::PetscInt, fnorm::PetscReal, vf::Vector{PetscViewerAndFormat})External Links
- PETSc Manual:
KSP/KSPMonitorResidualShort
PETSc.LibPETSc.KSPMonitorResidualView — Method
KSPMonitorResidualView(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidual(), KSPMonitorResidualDrawLG()
External Links
- PETSc Manual:
KSP/KSPMonitorResidualView
PETSc.LibPETSc.KSPMonitorSAWs — Method
KSPMonitorSAWs(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, ctx::Ptr{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
See also: KSP, KSPMonitorSet(), KSPMonitorSAWsCreate(), KSPMonitorSAWsDestroy(), KSPMonitorSingularValue(), KSPComputeExtremeSingularValues(), PetscViewerSAWsOpen()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWs
PETSc.LibPETSc.KSPMonitorSAWsCreate — Method
ctx::Ptr{Cvoid} = KSPMonitorSAWsCreate(petsclib::PetscLibType, ksp::AbstractKSP)create an SAWs monitor context for KSP
Collective
Input Parameter:
ksp-KSPto monitor
Output Parameter:
ctx- context for monitor
Level: developer
See also: KSP, KSPMonitorSet(), KSPMonitorSAWs(), KSPMonitorSAWsDestroy()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWsCreate
PETSc.LibPETSc.KSPMonitorSAWsDestroy — Method
KSPMonitorSAWsDestroy(petsclib::PetscLibType, ctx::Ptr{Cvoid})destroy a monitor context created with KSPMonitorSAWsCreate()
Collective
Input Parameter:
ctx- monitor context
Level: developer
See also: KSP, KSPMonitorSet(), KSPMonitorSAWsCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSAWsDestroy
PETSc.LibPETSc.KSPMonitorSNESResidual — Method
KSPMonitorSNESResidual(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: SNES, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), KSPMonitor(), SNESMonitor(), PetscViewerAndFormat()
External Links
- PETSc Manual:
SNES/KSPMonitorSNESResidual
PETSc.LibPETSc.KSPMonitorSNESResidualDrawLG — Method
KSPMonitorSNESResidualDrawLG(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSPMonitorSet(), KSPMonitorTrueResidual(), SNESMonitor(), KSPMonitor(), KSPMonitorSNESResidualDrawLGCreate()
External Links
- PETSc Manual:
SNES/KSPMonitorSNESResidualDrawLG
PETSc.LibPETSc.KSPMonitorSNESResidualDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorSNESResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the PetscViewer used by KSPMonitorSNESResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: KSP, SNES, PetscViewerFormat, PetscViewerAndFormat, KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
SNES/KSPMonitorSNESResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorSet — Method
KSPMonitorSet(petsclib::PetscLibType, ksp::AbstractKSP, monitor::Ptr{Cvoid}, ctx::Ptr{Cvoid}, monitordestroy::Ptr{Cvoid})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
See also: KSPMonitorResidual(), KSPMonitorRegister(), KSPMonitorCancel(), KSP, PetscCtxDestroyFn
External Links
- PETSc Manual:
KSP/KSPMonitorSet
PETSc.LibPETSc.KSPMonitorSetFromOptions — Method
KSPMonitorSetFromOptions(petsclib::PetscLibType, ksp::AbstractKSP, opt::String, name::String, ctx::Ptr{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 application context for the monitor, orNULL
Level: developer
See also: 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::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPComputeExtremeSingularValues(), KSPMonitorSingularValueCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSingularValue
PETSc.LibPETSc.KSPMonitorSingularValueCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorSingularValueCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the singular value monitor context needed by KSPMonitorSingularValue()
Collective
Input Parameters:
viewer- The PetscViewerformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: KSP, KSPMonitorSet(), KSPMonitorSingularValue(), PetscViewer
External Links
- PETSc Manual:
KSP/KSPMonitorSingularValueCreate
PETSc.LibPETSc.KSPMonitorSolution — Method
KSPMonitorSolution(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolution
PETSc.LibPETSc.KSPMonitorSolutionDraw — Method
KSPMonitorSolutionDraw(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDraw
PETSc.LibPETSc.KSPMonitorSolutionDrawLG — Method
KSPMonitorSolutionDrawLG(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorSolutionDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDrawLG
PETSc.LibPETSc.KSPMonitorSolutionDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorSolutionDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the context for the KSP monitor KSPMonitorSolutionDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: KSPMonitorSet(), KSPMonitorTrueResidual()
External Links
- PETSc Manual:
KSP/KSPMonitorSolutionDrawLGCreate
PETSc.LibPETSc.KSPMonitorTrueResidual — Method
KSPMonitorTrueResidual(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidual
PETSc.LibPETSc.KSPMonitorTrueResidualDrawLG — Method
KSPMonitorTrueResidualDrawLG(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorTrueResidualDraw(), KSPMonitorResidual, KSPMonitorTrueResidualDrawLGCreate()
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualDrawLG
PETSc.LibPETSc.KSPMonitorTrueResidualDrawLGCreate — Method
vf::Ptr{PetscViewerAndFormat} = KSPMonitorTrueResidualDrawLGCreate(petsclib::PetscLibType, viewer::PetscViewer, format::PetscViewerFormat, ctx::Ptr{Cvoid})Creates the context for the true residual monitor KSPMonitorTrueResidualDrawLG()
Collective
Input Parameters:
viewer- ThePetscViewerof typePETSCVIEWERDRAWformat- The viewer formatctx- An optional application context
Output Parameter:
vf- The viewer context
Level: intermediate
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualDrawLGCreate
PETSc.LibPETSc.KSPMonitorTrueResidualMax — Method
KSPMonitorTrueResidualMax(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: KSP, KSPMonitorSet(), KSPMonitorResidual(), KSPMonitorTrueResidualMaxNorm()
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualMax
PETSc.LibPETSc.KSPMonitorTrueResidualView — Method
KSPMonitorTrueResidualView(petsclib::PetscLibType, ksp::AbstractKSP, n::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: PETSCVIEWERDRAW, KSP, KSPMonitorSet(), KSPMonitorTrueResidual(), KSPMonitorResidual(), KSPMonitorTrueResidualDrawLG(), PetscViewerAndFormat
External Links
- PETSc Manual:
KSP/KSPMonitorTrueResidualView
PETSc.LibPETSc.KSPPIPEFCGGetMmax — Method
mmax::PetscInt = KSPPIPEFCGGetMmax(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPPIPEFCG, KSPPIPEFCGGetTruncationType(), KSPPIPEFCGGetNprealloc(), KSPPIPEFCGSetMmax(), KSPFCGGetMmax(), KSPFCGSetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGGetMmax
PETSc.LibPETSc.KSPPIPEFCGGetNprealloc — Method
nprealloc::PetscInt = KSPPIPEFCGGetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPPIPEFCG, KSPPIPEFCGGetTruncationType(), KSPPIPEFCGSetNprealloc(), KSPPIPEFCGSetMmax(), KSPPIPEFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGGetNprealloc
PETSc.LibPETSc.KSPPIPEFCGGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPPIPEFCGGetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP)get the truncation strategy employed by KSPPIPEFCG
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
Level: intermediate
See also: 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::AbstractKSP, 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
See also: KSPPIPEFCG, KSPPIPEFCGSetTruncationType(), KSPPIPEFCGSetNprealloc(), KSPFCGSetMmax(), KSPFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGSetMmax
PETSc.LibPETSc.KSPPIPEFCGSetNprealloc — Method
KSPPIPEFCGSetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPPIPEFCG, KSPPIPEFCGSetTruncationType(), KSPPIPEFCGGetNprealloc(), KSPPIPEFCGSetMmax(), KSPPIPEFCGGetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEFCGSetNprealloc
PETSc.LibPETSc.KSPPIPEFCGSetTruncationType — Method
KSPPIPEFCGSetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP, truncstrat::KSPFCDTruncationType)specify how many of its stored previous directions KSPPIPEFCG uses during orthogonalization
Logically Collective
Input Parameters:
ksp- the Krylov space contexttruncstrat- the choice of strategy
$KSP_FCD_TRUNC_TYPE_STANDARD uses all (up to `mmax`) stored directions KSP_FCD_TRUNC_TYPE_NOTAY uses `max(1,mod(i,mmax))` stored directions at iteration i = 0, 1, ...$
Options Database Key:
-ksp_pipefcg_truncation_type (standard|notay)- which stored search directions to orthogonalize against
Level: intermediate
See also: 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::AbstractKSP, 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
See also: KSPPIPEFGMRES, KSPComputeEigenvalues()
External Links
- PETSc Manual:
KSP/KSPPIPEFGMRESSetShift
PETSc.LibPETSc.KSPPIPEGCRGetMmax — Method
mmax::PetscInt = KSPPIPEGCRGetMmax(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc(), KSPPIPEGCRSetMmax()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetMmax
PETSc.LibPETSc.KSPPIPEGCRGetNprealloc — Method
nprealloc::PetscInt = KSPPIPEGCRGetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRSetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetNprealloc
PETSc.LibPETSc.KSPPIPEGCRGetTruncationType — Method
truncstrat::KSPFCDTruncationType = KSPPIPEGCRGetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP)get the truncation strategy employed by KSPPIPEGCR
Not Collective
Input Parameter:
ksp- the Krylov space context
Output Parameter:
truncstrat- the strategy type
$KSP_FCD_TRUNC_TYPE_STANDARD uses all (up to `mmax`) stored directions KSP_FCD_TRUNC_TYPE_NOTAY uses the last `max(1,mod(i,mmax))` directions at iteration i =0, 1, ..$
Level: intermediate
See also: KSPPIPEGCR, KSPPIPEGCRSetTruncationType(), 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::AbstractKSP)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
See also: KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc(), KSPPIPEGCRSetUnrollW()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRGetUnrollW
PETSc.LibPETSc.KSPPIPEGCRSetMmax — Method
KSPPIPEGCRSetMmax(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPPIPEGCR, KSPPIPEGCRSetTruncationType(), KSPPIPEGCRSetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetMmax
PETSc.LibPETSc.KSPPIPEGCRSetNprealloc — Method
KSPPIPEGCRSetNprealloc(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPPIPEGCR, KSPPIPEGCRGetTruncationType(), KSPPIPEGCRGetNprealloc()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetNprealloc
PETSc.LibPETSc.KSPPIPEGCRSetTruncationType — Method
KSPPIPEGCRSetTruncationType(petsclib::PetscLibType, ksp::AbstractKSP, 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
$KSP_FCD_TRUNC_TYPE_STANDARD uses all (up to `mmax`) stored directions KSP_FCD_TRUNC_TYPE_NOTAY uses the last `max(1,mod(i,mmax))` directions at iteration i = 0, 1, ..$
Options Database Key:
-ksp_pipegcr_truncation_type (standard|notay)- which stored basis vectors to orthogonalize against
Level: intermediate
See also: KSPPIPEGCR, KSPFCDTruncationType, KSPPIPEGCRGetTruncationType(), KSP_FCD_TRUNC_TYPE_STANDARD, KSP_FCD_TRUNC_TYPE_NOTAY
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetTruncationType
PETSc.LibPETSc.KSPPIPEGCRSetUnrollW — Method
KSPPIPEGCRSetUnrollW(petsclib::PetscLibType, ksp::AbstractKSP, 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 (true|false)- use unrolling
See also: KSPPIPEGCR, KSPPIPEGCRSetTruncationType(), KSPPIPEGCRSetNprealloc(), KSPPIPEGCRGetUnrollW()
External Links
- PETSc Manual:
KSP/KSPPIPEGCRSetUnrollW
PETSc.LibPETSc.KSPPythonGetType — Method
pyname::String = KSPPythonGetType(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPCreate(), KSPSetType(), KSPPYTHON, PetscPythonInitialize(), KSPPythonSetType()
External Links
- PETSc Manual:
KSP/KSPPythonGetType
PETSc.LibPETSc.KSPPythonSetType — Method
KSPPythonSetType(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPCreate(), KSPSetType(), KSPPYTHON, PetscPythonInitialize()
External Links
- PETSc Manual:
KSP/KSPPythonSetType
PETSc.LibPETSc.KSPQCGGetQuadratic — Method
quadratic::PetscReal = KSPQCGGetQuadratic(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPQCG
External Links
- PETSc Manual:
KSP/KSPQCGGetQuadratic
PETSc.LibPETSc.KSPQCGGetTrialStepNorm — Method
tsnorm::PetscReal = KSPQCGGetTrialStepNorm(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPQCG, KSPQCGSetTrustRegionRadius()
External Links
- PETSc Manual:
KSP/KSPQCGGetTrialStepNorm
PETSc.LibPETSc.KSPQCGSetTrustRegionRadius — Method
KSPQCGSetTrustRegionRadius(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: 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
See also: KSP, KSPType, KSPSetType, KSPRegisterAll()
External Links
- PETSc Manual:
KSP/KSPRegister
PETSc.LibPETSc.KSPReset — Method
KSPReset(petsclib::PetscLibType, ksp::AbstractKSP)Removes any allocated Vec and Mat from the KSP data structures.
Collective
Input Parameter:
ksp- iterative solver obtained fromKSPCreate()
Level: intermediate
See also: KSPCreate(), KSPSetUp(), KSPSolve(), KSP
External Links
- PETSc Manual:
KSP/KSPReset
PETSc.LibPETSc.KSPResetFromOptions — Method
KSPResetFromOptions(petsclib::PetscLibType, ksp::AbstractKSP)Sets KSP parameters from user options ONLY if the KSP was previously set from options
Collective
Input Parameter:
ksp- theKSPcontext
Level: advanced
See also: KSPSetFromOptions(), KSPSetOptionsPrefix()
External Links
- PETSc Manual:
KSP/KSPResetFromOptions
PETSc.LibPETSc.KSPResetViewers — Method
KSPResetViewers(petsclib::PetscLibType, ksp::AbstractKSP)Resets all the viewers set from the options database during KSPSetFromOptions()
Collective
Input Parameter:
ksp- theKSPiterative solver context obtained fromKSPCreate()
Level: beginner
See also: KSPCreate(), KSPSetUp(), KSPSolve(), KSPSetFromOptions(), KSP
External Links
- PETSc Manual:
KSP/KSPResetViewers
PETSc.LibPETSc.KSPRichardsonSetScale — Method
KSPRichardsonSetScale(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPRICHARDSON, KSPRichardsonSetSelfScale()
External Links
- PETSc Manual:
KSP/KSPRichardsonSetScale
PETSc.LibPETSc.KSPRichardsonSetSelfScale — Method
KSPRichardsonSetSelfScale(petsclib::PetscLibType, ksp::AbstractKSP, scale::PetscBool)Sets Richardson to automatically determine optimal scaling at each iteration to minimize the 2-norm of the 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
See also: KSPRICHARDSON, KSPRichardsonSetScale()
External Links
- PETSc Manual:
KSP/KSPRichardsonSetSelfScale
PETSc.LibPETSc.KSPSetApplicationContext — Method
KSPSetApplicationContext(petsclib::PetscLibType, ksp::AbstractKSP, ctx::Ptr{Cvoid})Sets the optional user-defined context for the linear solver.
Logically Collective
Input Parameters:
ksp- theKSPcontextctx- application context
Level: intermediate
See also: KSP, KSPGetApplicationContext()
External Links
- PETSc Manual:
KSP/KSPSetApplicationContext
PETSc.LibPETSc.KSPSetCheckNormIteration — Method
KSPSetCheckNormIteration(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetNormType(), KSPSetLagNorm()
External Links
- PETSc Manual:
KSP/KSPSetCheckNormIteration
PETSc.LibPETSc.KSPSetComputeEigenvalues — Method
KSPSetComputeEigenvalues(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPComputeEigenvalues(), KSPComputeEigenvaluesExplicitly(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPSetComputeEigenvalues
PETSc.LibPETSc.KSPSetComputeInitialGuess — Method
KSPSetComputeInitialGuess(petsclib::PetscLibType, ksp::AbstractKSP, func::Ptr{Cvoid}, ctx::Ptr{Cvoid})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
See also: KSP, KSPSolve(), KSPSetComputeRHS(), KSPSetComputeOperators(), DMKSPSetComputeInitialGuess(), KSPSetInitialGuessNonzero(), KSPComputeInitialGuessFn
External Links
- PETSc Manual:
KSP/KSPSetComputeInitialGuess
PETSc.LibPETSc.KSPSetComputeOperators — Method
KSPSetComputeOperators(petsclib::PetscLibType, ksp::AbstractKSP, func::Ptr{Cvoid}, ctx::Ptr{Cvoid})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
See also: KSP, KSPSetOperators(), KSPSetComputeRHS(), DMKSPSetComputeOperators(), KSPSetComputeInitialGuess(), KSPComputeOperatorsFn
External Links
- PETSc Manual:
KSP/KSPSetComputeOperators
PETSc.LibPETSc.KSPSetComputeRHS — Method
KSPSetComputeRHS(petsclib::PetscLibType, ksp::AbstractKSP, func::Ptr{Cvoid}, ctx::Ptr{Cvoid})set routine to compute the right-hand side of the linear system
Logically Collective
Input Parameters:
ksp- theKSPcontextfunc- function to compute the right-hand side, seeKSPComputeRHSFnfor the calling sequencectx- optional context
Level: beginner
See also: KSP, KSPSolve(), DMKSPSetComputeRHS(), KSPSetComputeOperators(), KSPSetOperators(), KSPComputeRHSFn
External Links
- PETSc Manual:
KSP/KSPSetComputeRHS
PETSc.LibPETSc.KSPSetComputeRitz — Method
KSPSetComputeRitz(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPComputeRitz(), KSP, KSPComputeEigenvalues(), KSPComputeExtremeSingularValues()
External Links
- PETSc Manual:
KSP/KSPSetComputeRitz
PETSc.LibPETSc.KSPSetComputeSingularValues — Method
KSPSetComputeSingularValues(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPComputeExtremeSingularValues(), KSPMonitorSingularValue(), KSP, KSPSetComputeRitz()
External Links
- PETSc Manual:
KSP/KSPSetComputeSingularValues
PETSc.LibPETSc.KSPSetConvergedNegativeCurvature — Method
KSPSetConvergedNegativeCurvature(petsclib::PetscLibType, ksp::AbstractKSP, 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 (true|false)- Declare convergence if negative curvature is detected
Level: advanced
See also: KSP, KSPConvergedReason, KSPGetConvergedNegativeCurvature()
External Links
- PETSc Manual:
KSP/KSPSetConvergedNegativeCurvature
PETSc.LibPETSc.KSPSetConvergenceTest — Method
KSPSetConvergenceTest(petsclib::PetscLibType, ksp::AbstractKSP, converge::Ptr{Cvoid}, ctx::Ptr{Cvoid}, destroy::Ptr{Cvoid})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
See also: KSP, KSPConvergenceTestFn, KSPConvergedDefault(), KSPGetConvergenceContext(), KSPSetTolerances(), KSPGetConvergenceTest(), KSPGetAndClearConvergenceTest()
External Links
- PETSc Manual:
KSP/KSPSetConvergenceTest
PETSc.LibPETSc.KSPSetDM — Method
KSPSetDM(petsclib::PetscLibType, ksp::AbstractKSP, dm::AbstractPetscDM)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
See also: KSP, DM, KSPGetDM(), KSPSetDMActive(), KSPSetComputeOperators(), KSPSetComputeRHS(), KSPSetComputeInitialGuess(), DMKSPSetComputeOperators(), DMKSPSetComputeRHS(), DMKSPSetComputeInitialGuess()
External Links
- PETSc Manual:
KSP/KSPSetDM
PETSc.LibPETSc.KSPSetDMActive — Method
KSPSetDMActive(petsclib::PetscLibType, ksp::AbstractKSP, active::KSPDMActive, flg::PetscBool)Indicates the DM should be used to generate the linear system matrix, the right-hand side vector, and the initial guess
Logically Collective
Input Parameters:
ksp- theKSPactive- one ofKSP_DMACTIVE_OPERATOR,KSP_DMACTIVE_RHS, orKSP_DMACTIVE_INITIAL_GUESSflg- use theDM
Level: intermediate
See also: KSP, DM, KSPGetDM(), KSPSetDM(), SNESSetDM(), KSPSetComputeOperators(), KSPSetComputeRHS(), KSPSetComputeInitialGuess()
External Links
- PETSc Manual:
KSP/KSPSetDMActive
PETSc.LibPETSc.KSPSetDiagonalScale — Method
KSPSetDiagonalScale(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetDiagonalScale(), KSPSetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPSetDiagonalScale
PETSc.LibPETSc.KSPSetDiagonalScaleFix — Method
KSPSetDiagonalScaleFix(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetDiagonalScale(), KSPSetDiagonalScale(), KSPGetDiagonalScaleFix(), KSP
External Links
- PETSc Manual:
KSP/KSPSetDiagonalScaleFix
PETSc.LibPETSc.KSPSetErrorHistory — Method
KSPSetErrorHistory(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetErrorHistory(), KSPSetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPSetErrorHistory
PETSc.LibPETSc.KSPSetErrorIfNotConverged — Method
KSPSetErrorIfNotConverged(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetErrorIfNotConverged(), KSP
External Links
- PETSc Manual:
KSP/KSPSetErrorIfNotConverged
PETSc.LibPETSc.KSPSetFromOptions — Method
KSPSetFromOptions(petsclib::PetscLibType, ksp::AbstractKSP)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 maxits- maximum number of linear iterations-ksp_min_it minits- 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
See also: KSP, KSPSetOptionsPrefix(), KSPResetFromOptions(), KSPSetUseFischerGuess()
External Links
- PETSc Manual:
KSP/KSPSetFromOptions
PETSc.LibPETSc.KSPSetGuess — Method
KSPSetGuess(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPGuess, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetUseFischerGuess(), KSPGetGuess()
External Links
- PETSc Manual:
KSP/KSPSetGuess
PETSc.LibPETSc.KSPSetInitialGuessKnoll — Method
KSPSetInitialGuessKnoll(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetInitialGuessKnoll(), KSPGuess, KSPSetInitialGuessNonzero(), KSPGetInitialGuessNonzero(), KSP
External Links
- PETSc Manual:
KSP/KSPSetInitialGuessKnoll
PETSc.LibPETSc.KSPSetInitialGuessNonzero — Method
KSPSetInitialGuessNonzero(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetInitialGuessNonzero(), KSPGuessSetType(), KSPGuessType, KSP
External Links
- PETSc Manual:
KSP/KSPSetInitialGuessNonzero
PETSc.LibPETSc.KSPSetLagNorm — Method
KSPSetLagNorm(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetNormType(), KSPSetCheckNormIteration()
External Links
- PETSc Manual:
KSP/KSPSetLagNorm
PETSc.LibPETSc.KSPSetMatSolveBatchSize — Method
KSPSetMatSolveBatchSize(petsclib::PetscLibType, ksp::AbstractKSP, bs::PetscInt)Sets the maximum number of columns treated simultaneously in KSPMatSolve().
Logically Collective
Input Parameters:
ksp- theKSPiterative solverbs- batch size
Level: advanced
See also: KSPMatSolve(), KSPGetMatSolveBatchSize(), -mat_mumps_icntl_27, -matproduct_batch_size
External Links
- PETSc Manual:
KSP/KSPSetMatSolveBatchSize
PETSc.LibPETSc.KSPSetMinimumIterations — Method
KSPSetMinimumIterations(petsclib::PetscLibType, ksp::AbstractKSP, 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 minit- Setsminit
Level: intermediate
See also: KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetTolerances(), KSPGetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPSetMinimumIterations
PETSc.LibPETSc.KSPSetNestLevel — Method
KSPSetNestLevel(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPGMRES, KSPType, KSPGetNestLevel(), PCSetKSPNestLevel(), PCGetKSPNestLevel()
External Links
- PETSc Manual:
KSP/KSPSetNestLevel
PETSc.LibPETSc.KSPSetNormType — Method
KSPSetNormType(petsclib::PetscLibType, ksp::AbstractKSP, 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
$KSP_NORM_NONE - skips computing the norm, this should generally only be used if you are using the Krylov method as a smoother with a fixed small number of iterations. Implicitly sets `KSPConvergedSkip()` as the `KSP` convergence test. Note that certain algorithms such as `KSPGMRES` ALWAYS require the norm calculation, for these methods the norms are still computed, they are just not used in the convergence test. KSP_NORM_PRECONDITIONED - the default for left-preconditioned solves, uses the 2-norm of the preconditioned residual B^{-1}(b - A x). KSP_NORM_UNPRECONDITIONED - uses the 2-norm of the true b - Ax residual. KSP_NORM_NATURAL - uses the A norm of the true b - Ax residual; supported by `KSPCG`, `KSPCR`, `KSPCGNE`, `KSPCGS`$
Options Database Key:
-ksp_norm_type (none|preconditioned|unpreconditioned|natural)- setKSPnorm type
Level: advanced
See also: KSPSetUp(), KSPSolve(), KSPDestroy(), KSPConvergedSkip(), KSPSetCheckNormIteration(), KSPSetPCSide(), KSPGetPCSide(), KSPNormType
External Links
- PETSc Manual:
KSP/KSPSetNormType
PETSc.LibPETSc.KSPSetOperators — Method
KSPSetOperators(petsclib::PetscLibType, ksp::AbstractKSP, Amat::AbstractPetscMat, Pmat::AbstractPetscMat)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
See also: KSP, Mat, KSPSolve(), KSPGetPC(), PCGetOperators(), PCSetOperators(), KSPGetOperators(), KSPSetComputeOperators(), KSPSetComputeInitialGuess(), KSPSetComputeRHS()
External Links
- PETSc Manual:
KSP/KSPSetOperators
PETSc.LibPETSc.KSPSetOptionsPrefix — Method
KSPSetOptionsPrefix(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPAppendOptionsPrefix(), KSPGetOptionsPrefix(), KSPSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPSetOptionsPrefix
PETSc.LibPETSc.KSPSetPC — Method
KSPSetPC(petsclib::PetscLibType, ksp::AbstractKSP, pc::AbstractPC)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
See also: KSPGetPC(), KSP
External Links
- PETSc Manual:
KSP/KSPSetPC
PETSc.LibPETSc.KSPSetPCSide — Method
KSPSetPCSide(petsclib::PetscLibType, ksp::AbstractKSP, 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
$PC_LEFT - left preconditioning (default) PC_RIGHT - right preconditioning PC_SYMMETRIC - symmetric preconditioning$
Options Database Key:
-ksp_pc_side (right|left|symmetric)-KSPpreconditioner side
Level: intermediate
See also: KSPGetPCSide(), KSPSetNormType(), KSPGetNormType(), KSP, KSPSetPreSolve(), KSPSetPostSolve()
External Links
- PETSc Manual:
KSP/KSPSetPCSide
PETSc.LibPETSc.KSPSetPostSolve — Method
KSPSetPostSolve(petsclib::PetscLibType, ksp::AbstractKSP, postsolve::Ptr{Cvoid}, ctx::Ptr{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
See also: KSPPSolveFn, KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPSetPreSolve(), PCEISENSTAT
External Links
- PETSc Manual:
KSP/KSPSetPostSolve
PETSc.LibPETSc.KSPSetPreSolve — Method
KSPSetPreSolve(petsclib::PetscLibType, ksp::AbstractKSP, presolve::Ptr{Cvoid}, ctx::Ptr{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
See also: KSPPSolveFn, KSPSetUp(), KSPSolve(), KSPDestroy(), KSP, KSPSetPostSolve(), PCEISENSTAT, PCPreSolve(), PCPostSolve()
External Links
- PETSc Manual:
KSP/KSPSetPreSolve
PETSc.LibPETSc.KSPSetResidualHistory — Method
KSPSetResidualHistory(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetResidualHistory(), KSP
External Links
- PETSc Manual:
KSP/KSPSetResidualHistory
PETSc.LibPETSc.KSPSetReusePreconditioner — Method
KSPSetReusePreconditioner(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPCreate(), KSPSolve(), KSPDestroy(), KSP, KSPGetReusePreconditioner(), SNESSetLagPreconditioner(), SNES
External Links
- PETSc Manual:
KSP/KSPSetReusePreconditioner
PETSc.LibPETSc.KSPSetSkipPCSetFromOptions — Method
KSPSetSkipPCSetFromOptions(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPCreate(), KSPSolve(), KSPDestroy(), PCSetReusePreconditioner(), KSP
External Links
- PETSc Manual:
KSP/KSPSetSkipPCSetFromOptions
PETSc.LibPETSc.KSPSetSupportedNorm — Method
KSPSetSupportedNorm(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPNormType, PCSide, KSPSetNormType(), KSPSetPCSide()
External Links
- PETSc Manual:
KSP/KSPSetSupportedNorm
PETSc.LibPETSc.KSPSetTolerances — Method
KSPSetTolerances(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSPGetTolerances(), KSPConvergedDefault(), KSPSetConvergenceTest(), KSP, KSPSetMinimumIterations()
External Links
- PETSc Manual:
KSP/KSPSetTolerances
PETSc.LibPETSc.KSPSetType — Method
KSPSetType(petsclib::PetscLibType, ksp::AbstractKSP, type::String)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 type- Sets the method; seeKSPType
Level: intermediate
See also: PCSetType(), KSPType, KSPRegister(), KSPCreate(), KSP
External Links
- PETSc Manual:
KSP/KSPSetType
PETSc.LibPETSc.KSPSetUp — Method
KSPSetUp(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: KSPCreate(), KSPSolve(), KSPDestroy(), KSP, KSPSetUpOnBlocks()
External Links
- PETSc Manual:
KSP/KSPSetUp
PETSc.LibPETSc.KSPSetUpOnBlocks — Method
KSPSetUpOnBlocks(petsclib::PetscLibType, ksp::AbstractKSP)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
See also: PCSetUpOnBlocks(), KSPSetUp(), PCSetUp(), KSP
External Links
- PETSc Manual:
KSP/KSPSetUpOnBlocks
PETSc.LibPETSc.KSPSetUseExplicitTranspose — Method
KSPSetUseExplicitTranspose(petsclib::PetscLibType, ksp::AbstractKSP, flg::PetscBool)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
See also: KSPSolveTranspose(), KSP
External Links
- PETSc Manual:
KSP/KSPSetUseExplicitTranspose
PETSc.LibPETSc.KSPSetUseFischerGuess — Method
KSPSetUseFischerGuess(petsclib::PetscLibType, ksp::AbstractKSP, model::PetscInt, size::PetscInt)Use the Paul Fischer algorithm or its variants to compute initial guesses for a set of solves with related right-hand sides
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
See also: KSP, KSPSetOptionsPrefix(), KSPAppendOptionsPrefix(), KSPSetGuess(), KSPGetGuess(), KSPGuess
External Links
- PETSc Manual:
KSP/KSPSetUseFischerGuess
PETSc.LibPETSc.KSPSetWorkVecs — Method
KSPSetWorkVecs(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, KSPCreateVecs()
External Links
- PETSc Manual:
KSP/KSPSetWorkVecs
PETSc.LibPETSc.KSPSolve — Method
KSPSolve(petsclib::PetscLibType, ksp::AbstractKSP, b::Union{Ptr, AbstractPetscVec}, x::Union{Ptr, AbstractPetscVec})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_view_final_residual_vec- print true linear system residual vector at the end of the solution process;
-ksp_view_final_residual must to be called first to enable this option
-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
See also: 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::AbstractKSP, b::AbstractPetscVec, x::AbstractPetscVec)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
See also: KSPCreate(), KSPSetUp(), KSPDestroy(), KSPSetTolerances(), KSPConvergedDefault(), KSPSolve(), KSP, KSPSetOperators()
External Links
- PETSc Manual:
KSP/KSPSolveTranspose
PETSc.LibPETSc.KSPUnwindPreconditioner — Method
KSPUnwindPreconditioner(petsclib::PetscLibType, ksp::AbstractKSP, vsoln::AbstractPetscVec, vt1::AbstractPetscVec)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
See also: KSP, KSPSetPCSide()
External Links
- PETSc Manual:
KSP/KSPUnwindPreconditioner
PETSc.LibPETSc.KSPView — Method
KSPView(petsclib::PetscLibType, ksp::AbstractKSP, 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
See also: KSP, PetscViewer, PCView(), PetscViewerASCIIOpen(), KSPViewFromOptions()
External Links
- PETSc Manual:
KSP/KSPView
PETSc.LibPETSc.KSPViewFromOptions — Method
KSPViewFromOptions(petsclib::PetscLibType, A::AbstractKSP, obj, 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
Options Database Key:
-name [viewertype][:...]- option name and values. SeePetscObjectViewFromOptions()for the possible arguments
Level: intermediate
See also: 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 type- Turns on generation of initial guesses and sets the method; seeKSPGuessType-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- monitor the pod initial guess processing-ksp_guess_pod_tol tol- Tolerance to retain eigenvectors-ksp_guess_pod_Ainner (true|false)- Use the operator as inner product (must be SPD)
Level: developer
See also: KSPSolve(), KSPGuessDestroy(), KSPGuess, KSPGuessType, KSP
External Links
- PETSc Manual:
KSP/KSPGuessCreate
PETSc.LibPETSc.KSPGuessDestroy — Method
KSPGuessDestroy(petsclib::PetscLibType, guess::Union{KSPGuess, Ref{KSPGuess}})Destroys KSPGuess context.
Collective
Input Parameter:
guess- initial guess object
Level: developer
See also: 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
See also: KSPGuess, KSPGuessCreate(), KSPSetUseFischerGuess(), KSPSetGuess(), KSPGetGuess(), KSP
External Links
- PETSc Manual:
KSP/KSPGuessFischerSetModel
PETSc.LibPETSc.KSPGuessFormGuess — Method
KSPGuessFormGuess(petsclib::PetscLibType, guess::KSPGuess, rhs::AbstractPetscVec, sol::AbstractPetscVec)Form the initial guess
Collective
Input Parameters:
guess- the initial guess contextrhs- the current right-hand side vectorsol- the initial guess vector
Level: developer
See also: KSPGuessCreate(), KSPGuess
External Links
- PETSc Manual:
KSP/KSPGuessFormGuess
PETSc.LibPETSc.KSPGuessGetType — Method
type::String = 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
See also: 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
See also: 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; seeKSPGuessType-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- monitor the pod initial guess processing-ksp_guess_pod_tol tol- Tolerance to retain eigenvectors-ksp_guess_pod_Ainner (true|false)- Use the operator as inner product (must be SPD)
Level: developer
See also: 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
See also: KSPGuess, KSPGuessType, KSPGuessSetFromOptions()
External Links
- PETSc Manual:
KSP/KSPGuessSetTolerance
PETSc.LibPETSc.KSPGuessSetType — Method
KSPGuessSetType(petsclib::PetscLibType, guess::KSPGuess, type::String)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 type- Turns on generation of initial guesses and sets the method; seeKSPGuessTypefor a list of available types
Level: developer
See also: 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
See also: KSPGuessCreate(), KSPGuess
External Links
- PETSc Manual:
KSP/KSPGuessSetUp
PETSc.LibPETSc.KSPGuessUpdate — Method
KSPGuessUpdate(petsclib::PetscLibType, guess::KSPGuess, rhs::AbstractPetscVec, sol::AbstractPetscVec)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
See also: 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
See also: KSP, KSPGuess, KSPGuessType, KSPGuessRegister(), KSPGuessCreate(), PetscViewer
External Links
- PETSc Manual:
KSP/KSPGuessView