SNES - Low-level Interface
This page documents the low-level, automatically wrapped PETSc SNES (Scalable Nonlinear Equations Solvers) functions available through LibPETSc. These functions provide direct access to the PETSc C API.
For the high-level Julia interface, see SNES.
Overview
The SNES interface includes:
- Core SNES operations: Nonlinear solver creation, configuration, and solution (~283 functions in
SNES_wrappers.jl) - SNESLineSearch: Line search methods for nonlinear solvers (~50 functions in
SNESLineSearch_wrappers.jl)
Usage
All low-level SNES 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
# Create SNES solver
snes = LibPETSc.SNESCreate(petsclib, LibPETSc.PETSC_COMM_SELF)
# Set function and Jacobian (callbacks would need to be defined)
# LibPETSc.SNESSetFunction(petsclib, snes, r, compute_function, ctx)
# LibPETSc.SNESSetJacobian(petsclib, snes, J, J, compute_jacobian, ctx)
# Configure from command line
LibPETSc.SNESSetFromOptions(petsclib, snes)
# Solve
# LibPETSc.SNESSolve(petsclib, snes, C_NULL, x)
# Get convergence info
reason = LibPETSc.SNESGetConvergedReason(petsclib, snes)
iterations = LibPETSc.SNESGetIterationNumber(petsclib, snes)
println("SNES reason: $(reason), iterations: $(iterations)")
# Clean up
LibPETSc.SNESDestroy(petsclib, snes)
PETSc.finalize(petsclib)Function Reference
PETSc.LibPETSc.SNESAddOptionsChecker — Method
SNESAddOptionsChecker(petsclib::PetscLibType,snescheck::external)Adds an additional function to check for SNES options.
Not Collective
Input Parameter:
snescheck- function that checks for options
Calling sequence of snescheck:
snes- theSNESobject for which it is checking options
Level: developer
-seealso: , SNES, SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESAddOptionsChecker
PETSc.LibPETSc.SNESAppendOptionsPrefix — Method
SNESAppendOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)Appends to the prefix used for searching for all SNES options in the database.
Logically Collective
Input Parameters:
snes- theSNEScontextprefix- the prefix to prepend to all option names
Level: advanced
-seealso: , SNESGetOptionsPrefix(), SNESSetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESAppendOptionsPrefix
PETSc.LibPETSc.SNESApplyNPC — Method
SNESApplyNPC(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, y::PetscVec)Calls SNESSolve() on the preconditioner for the SNES
Collective
Input Parameters:
snes- theSNEScontextx- input vectorf- optional; the function evaluation onx
Output Parameter:
y- function vector, as set bySNESSetFunction()
Level: developer
-seealso: , SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESApplyNPC
PETSc.LibPETSc.SNESCompositeAddSNES — Method
SNESCompositeAddSNES(petsclib::PetscLibType,snes::PetscSNES, type::SNESType)Adds another SNES to the SNESCOMPOSITE
Collective
Input Parameters:
snes- theSNEScontext of typeSNESCOMPOSITEtype- theSNESTypeof the new solver
Level: developer
-seealso: , SNES, SNESCOMPOSITE, SNESCompositeGetSNES()
External Links
- PETSc Manual:
SNES/SNESCompositeAddSNES
PETSc.LibPETSc.SNESCompositeGetNumber — Method
n::PetscInt = SNESCompositeGetNumber(petsclib::PetscLibType,snes::PetscSNES)Get the number of subsolvers in the SNESCOMPOSITE
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
n- the number of subsolvers
Level: developer
-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetSNES()
External Links
- PETSc Manual:
SNES/SNESCompositeGetNumber
PETSc.LibPETSc.SNESCompositeGetSNES — Method
SNESCompositeGetSNES(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::PetscSNES)Gets one of the SNES objects in the SNES of SNESType SNESCOMPOSITE
Not Collective
Input Parameters:
snes- theSNEScontextn- the number of the composedSNESrequested
Output Parameter:
subsnes- theSNESrequested
Level: developer
-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetNumber()
External Links
- PETSc Manual:
SNES/SNESCompositeGetSNES
PETSc.LibPETSc.SNESCompositeSetDamping — Method
SNESCompositeSetDamping(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, dmp::PetscReal)Sets the damping of a subsolver when using SNES_COMPOSITE_ADDITIVE with a SNES of SNESType SNESCOMPOSITE
Not Collective
Input Parameters:
snes- theSNEScontextn- the number of the sub-SNESobject requesteddmp- the damping
Level: intermediate
-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetSNES(), SNES_COMPOSITE_ADDITIVE, SNES_COMPOSITE_MULTIPLICATIVE, SNESCompositeType, SNESCompositeSetType()
External Links
- PETSc Manual:
SNES/SNESCompositeSetDamping
PETSc.LibPETSc.SNESCompositeSetType — Method
SNESCompositeSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESCompositeType)Sets the type of composite preconditioner.
Logically Collective
Input Parameters:
snes- the preconditioner contexttype-SNES_COMPOSITE_ADDITIVE(default),SNES_COMPOSITE_MULTIPLICATIVE, orSNES_COMPOSITE_ADDITIVEOPTIMAL
Options Database Key:
-snes_composite_type <type: one of multiplicative, additive, additiveoptimal>- Sets composite preconditioner type
Level: developer
-seealso: , SNES_COMPOSITE_ADDITIVE, SNES_COMPOSITE_MULTIPLICATIVE, SNESCompositeType, SNESCOMPOSITE, SNES_COMPOSITE_ADDITIVEOPTIMAL, PCCompositeType
External Links
- PETSc Manual:
SNES/SNESCompositeSetType
PETSc.LibPETSc.SNESComputeFunction — Method
SNESComputeFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec)Calls the function that has been set with SNESSetFunction().
Collective
Input Parameters:
snes- theSNEScontextx- input vector
Output Parameter:
y- function vector, as set bySNESSetFunction()
Level: developer
-seealso: , SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeMFFunction()
External Links
- PETSc Manual:
SNES/SNESComputeFunction
PETSc.LibPETSc.SNESComputeFunctionDefaultNPC — Method
SNESComputeFunctionDefaultNPC(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec)External Links
- PETSc Manual:
SNES/SNESComputeFunctionDefaultNPC
PETSc.LibPETSc.SNESComputeJacobian — Method
SNESComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, A::PetscMat, B::PetscMat)Computes the Jacobian matrix that has been set with SNESSetJacobian().
Collective
Input Parameters:
snes- theSNEScontextX- input vector
Output Parameters:
A- Jacobian matrixB- optional matrix for building the preconditioner, usually the same asA
Options Database Keys:
-snes_lag_preconditioner <lag>- how often to rebuild preconditioner-snes_lag_jacobian <lag>- how often to rebuild Jacobian-snes_test_jacobian <optional threshold>- compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.-snes_test_jacobian_view- display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian-snes_compare_explicit- Compare the computed Jacobian to the finite difference Jacobian and output the differences-snes_compare_explicit_draw- Compare the computed Jacobian to the finite difference Jacobian and draw the result-snes_compare_explicit_contour- Compare the computed Jacobian to the finite difference Jacobian and draw a contour plot with the result-snes_compare_operator- Make the comparison options above use the operator instead of the matrix used to construct the preconditioner-snes_compare_coloring- Compute the finite difference Jacobian using coloring and display norms of difference-snes_compare_coloring_display- Compute the finite difference Jacobian using coloring and display verbose differences-snes_compare_coloring_threshold- Display only those matrix entries that differ by more than a given threshold-snes_compare_coloring_threshold_atol- Absolute tolerance for difference in matrix entries to be displayed by-snes_compare_coloring_threshold-snes_compare_coloring_threshold_rtol- Relative tolerance for difference in matrix entries to be displayed by-snes_compare_coloring_threshold-snes_compare_coloring_draw- Compute the finite difference Jacobian using coloring and draw differences-snes_compare_coloring_draw_contour- Compute the finite difference Jacobian using coloring and show contours of matrices and differences
Level: developer
-seealso: , SNESSetJacobian(), KSPSetOperators(), MatStructure, SNESSetLagPreconditioner(), SNESSetLagJacobian()
External Links
- PETSc Manual:
SNES/SNESComputeJacobian
PETSc.LibPETSc.SNESComputeJacobianDefault — Method
SNESComputeJacobianDefault(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid)Computes the Jacobian using finite differences.
Collective
Input Parameters:
snes- theSNEScontextx1- compute Jacobian at this pointctx- application's function context, as set withSNESSetFunction()
Output Parameters:
J- Jacobian matrix (not altered in this routine)B- newly computed Jacobian matrix to use with preconditioner (generally the same asJ)
Options Database Keys:
-snes_fd- ActivatesSNESComputeJacobianDefault()-snes_fd_coloring- Activates a faster computation that uses a graph coloring of the matrix-snes_test_err- Square root of function error tolerance, default square root of machine
epsilon (1.e-8 in double, 3.e-4 in single)
-mat_fd_type- Either wp or ds (seeMATMFFD_WPorMATMFFD_DS)
Level: intermediate
-seealso: , SNES, SNESSetJacobian(), SNESComputeJacobianDefaultColor(), MatCreateSNESMF()
External Links
- PETSc Manual:
SNES/SNESComputeJacobianDefault
PETSc.LibPETSc.SNESComputeJacobianDefaultColor — Method
SNESComputeJacobianDefaultColor(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid)Computes the Jacobian using finite differences and coloring to exploit matrix sparsity.
Collective
Input Parameters:
snes- nonlinear solver objectx1- location at which to evaluate Jacobianctx-MatFDColoringcontext orNULL
Output Parameters:
J- Jacobian matrix (not altered in this routine)B- newly computed Jacobian matrix to use with preconditioner (generally the same asJ)
Options Database Keys:
-snes_fd_color_use_mat- use a matrix coloring from the explicit matrix nonzero pattern instead of from theDMproviding the matrix-snes_fd_color- ActivatesSNESComputeJacobianDefaultColor()inSNESSetFromOptions()-mat_fd_coloring_err <err>- Sets <err> (square root of relative error in the function)-mat_fd_coloring_umin <umin>- Sets umin, the minimum allowable u-value magnitude-mat_fd_type- Either wp or ds (seeMATMFFD_WPorMATMFFD_DS)-snes_mf_operator- Use matrix-free application of Jacobian-snes_mf- Use matrix-free Jacobian with no explicit Jacobian representation
-seealso: , SNES, SNESSetJacobian(), SNESTestJacobian(), SNESComputeJacobianDefault(), SNESSetUseMatrixFree(), MatFDColoringCreate(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
SNES/SNESComputeJacobianDefaultColor
PETSc.LibPETSc.SNESComputeMFFunction — Method
SNESComputeMFFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec)Calls the function that has been set with DMSNESSetMFFunction().
Collective
Input Parameters:
snes- theSNEScontextx- input vector
Output Parameter:
y- output vector
Level: developer
-seealso: , SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), MatCreateSNESMF(), DMSNESSetMFFunction()
External Links
- PETSc Manual:
SNES/SNESComputeMFFunction
PETSc.LibPETSc.SNESComputeNGS — Method
SNESComputeNGS(petsclib::PetscLibType,snes::PetscSNES, b::PetscVec, x::PetscVec)Calls the Gauss
Collective
Input Parameters:
snes- theSNEScontextx- input vectorb- rhs vector
Output Parameter:
x- new solution vector
Level: developer
-seealso: , SNESNGSFn, SNESSetNGS(), SNESComputeFunction(), SNESNGS
External Links
- PETSc Manual:
SNES/SNESComputeNGS
PETSc.LibPETSc.SNESComputeObjective — Method
ob::PetscReal = SNESComputeObjective(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec)Computes the objective function that has been provided by SNESSetObjective()
Collective
Input Parameters:
snes- theSNEScontextX- the state vector
Output Parameter:
ob- the objective value
Level: developer
-seealso: , SNESLineSearch, SNES, SNESSetObjective(), SNESGetSolution()
External Links
- PETSc Manual:
SNES/SNESComputeObjective
PETSc.LibPETSc.SNESConverged — Method
SNESConverged(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal)Run the convergence test and update the SNESConvergedReason.
Collective
Input Parameters:
snes- theSNEScontextit- current iterationxnorm- 2-norm of current iteratesnorm- 2-norm of current stepfnorm- 2-norm of function
Level: developer
-seealso: , SNES, SNESSolve, SNESSetConvergenceTest()
External Links
- PETSc Manual:
SNES/SNESConverged
PETSc.LibPETSc.SNESConvergedCorrectPressure — Method
SNESConvergedCorrectPressure(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, gnorm::PetscReal, f::PetscReal, reason::SNESConvergedReason, ctx::Cvoid)The regular SNES convergence test that, up on convergence, adds a vector in the nullspace to make the continuum integral of the pressure field equal to zero.
Logically Collective
Input Parameters:
snes- theSNEScontextit- the iteration (0 indicates before any Newton steps)xnorm- 2-norm of current iterategnorm- 2-norm of current stepf- 2-norm of function at current iteratectx- Optional user context
Output Parameter:
reason-SNES_CONVERGED_ITERATING,SNES_CONVERGED_ITS, orSNES_DIVERGED_FNORM_NAN
Options Database Key:
-snes_convergence_test correct_pressure- seeSNESSetFromOptions()
Level: advanced
-seealso: , SNES, DM, SNESConvergedDefault(), SNESSetConvergenceTest(), DMSetNullSpaceConstructor()
External Links
- PETSc Manual:
SNES/SNESConvergedCorrectPressure
PETSc.LibPETSc.SNESConvergedDefault — Method
SNESConvergedDefault(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid)Default convergence test for SNESSolve().
Collective
Input Parameters:
snes- theSNEScontextit- the iteration (0 indicates before any Newton steps)xnorm- 2-norm of current iteratesnorm- 2-norm of current stepfnorm- 2-norm of function at current iteratedummy- unused context
Output Parameter:
reason- converged reason, seeSNESConvergedReason
Options Database Keys:
-snes_convergence_test default- seeSNESSetFromOptions()-snes_stol- convergence tolerance in terms of the norm of the change in the solution between steps-snes_atol <abstol>- absolute tolerance of residual norm-snes_rtol <rtol>- relative decrease in tolerance norm from the initial 2-norm of the solution-snes_divergence_tolerance <divtol>- if the residual goes above divtol*rnorm0, exit with divergence-snes_max_funcs <max_funcs>- maximum number of function evaluations, useunlimitedfor no maximum-snes_max_fail <max_fail>- maximum number of line search failures allowed before stopping, default is none-snes_max_linear_solve_fail- number of linear solver failures beforeSNESSolve()stops
Level: developer
-seealso: , SNES, SNESSolve(), SNESSetConvergenceTest(), SNESConvergedSkip(), SNESSetTolerances(), SNESSetDivergenceTolerance(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESConvergedDefault
PETSc.LibPETSc.SNESConvergedReasonView — Method
SNESConvergedReasonView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)Displays the reason a SNES solve converged or diverged to a viewer
Collective
Input Parameters:
snes- iterative context obtained fromSNESCreate()viewer- the viewer to display the reason
Options Database Keys:
-snes_converged_reason- print reason for converged or diverged, also prints number of iterations-snes_converged_reason ::failed- only print reason and number of iterations when diverged
Level: beginner
-seealso: , SNESConvergedReason, PetscViewer, SNES, SNESCreate(), SNESSetUp(), SNESDestroy(), SNESSetTolerances(), SNESConvergedDefault(), SNESGetConvergedReason(), SNESConvergedReasonViewFromOptions(), PetscViewerPushFormat(), PetscViewerPopFormat()
External Links
- PETSc Manual:
SNES/SNESConvergedReasonView
PETSc.LibPETSc.SNESConvergedReasonViewCancel — Method
SNESConvergedReasonViewCancel(petsclib::PetscLibType,snes::PetscSNES)Clears all the reason view functions for a SNES object provided with SNESConvergedReasonViewSet() also removes the default viewer.
Collective
Input Parameter:
snes- the nonlinear iterative solver context obtained fromSNESCreate()
Level: intermediate
-seealso: , SNES, SNESCreate(), SNESDestroy(), SNESReset(), SNESConvergedReasonViewSet()
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewCancel
PETSc.LibPETSc.SNESConvergedReasonViewFromOptions — Method
SNESConvergedReasonViewFromOptions(petsclib::PetscLibType,snes::PetscSNES)Processes command line options to determine if/how a SNESConvergedReason is to be viewed at the end of SNESSolve() All the user-provided viewer routines set with SNESConvergedReasonViewSet() will be called, if they exist.
Collective
Input Parameter:
snes- theSNESobject
Level: advanced
-seealso: , SNES, SNESConvergedReason, SNESConvergedReasonViewSet(), SNESCreate(), SNESSetUp(), SNESDestroy(), SNESSetTolerances(), SNESConvergedDefault(), SNESGetConvergedReason(), SNESConvergedReasonView()
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewFromOptions
PETSc.LibPETSc.SNESConvergedReasonViewSet — Method
SNESConvergedReasonViewSet(petsclib::PetscLibType,snes::PetscSNES, f::external, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn)Sets an ADDITIONAL function that is to be used at the end of the nonlinear solver to display the convergence reason of the nonlinear solver.
Logically Collective
Input Parameters:
snes- theSNEScontextf- theSNESConvergedReasonview functionvctx- [optional] user-defined context for private data for theSNESConvergedReasonview function (useNULLif no context is desired)reasonviewdestroy- [optional] routine that frees the context (may beNULL), seePetscCtxDestroyFnfor the calling sequence
Calling sequence of f:
snes- theSNEScontextvctx- [optional] context for private data for the function
Options Database Keys:
-snes_converged_reason- sets a defaultSNESConvergedReasonView()-snes_converged_reason_view_cancel- cancels all converged reason viewers that have been hardwired into a code by
calls to SNESConvergedReasonViewSet(), but does not cancel those set via the options database.
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESConvergedReason, SNESGetConvergedReason(), SNESConvergedReasonView(), SNESConvergedReasonViewCancel(), PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewSet
PETSc.LibPETSc.SNESConvergedSkip — Method
SNESConvergedSkip(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid)Convergence test for SNES that NEVER returns as converged, UNLESS the maximum number of iteration have been reached.
Logically Collective
Input Parameters:
snes- theSNEScontextit- the iteration (0 indicates before any Newton steps)xnorm- 2-norm of current iteratesnorm- 2-norm of current stepfnorm- 2-norm of function at current iteratedummy- unused context
Output Parameter:
reason-SNES_CONVERGED_ITERATING,SNES_CONVERGED_ITS, orSNES_DIVERGED_FNORM_NAN
Options Database Key:
-snes_convergence_test skip- seeSNESSetFromOptions()
Level: advanced
-seealso: , SNES, SNESSolve(), SNESConvergedDefault(), SNESSetConvergenceTest(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESConvergedSkip
PETSc.LibPETSc.SNESCreate — Method
outsnes::PetscSNES = SNESCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a nonlinear solver context used to manage a set of nonlinear solves
Collective
Input Parameter:
comm- MPI communicator
Output Parameter:
outsnes- the newSNEScontext
Options Database Keys:
-snes_mf- Activates default matrix-free Jacobian-vector products, and no matrix to construct a preconditioner-snes_mf_operator- Activates default matrix-free Jacobian-vector products, and a user-provided matrix as set bySNESSetJacobian()-snes_fd_coloring- uses a relative fast computation of the Jacobian using finite differences and a graph coloring-snes_fd- Uses (slow!) finite differences to compute Jacobian
Level: beginner
-seealso: , SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian()
External Links
- PETSc Manual:
SNES/SNESCreate
PETSc.LibPETSc.SNESDestroy — Method
SNESDestroy(petsclib::PetscLibType,snes::PetscSNES)Destroys the nonlinear solver context that was created with SNESCreate().
Collective
Input Parameter:
snes- theSNEScontext
Level: beginner
-seealso: , SNES, SNESCreate(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESDestroy
PETSc.LibPETSc.SNESFASCreateCoarseVec — Method
Xcoarse::PetscVec = SNESFASCreateCoarseVec(petsclib::PetscLibType,snes::PetscSNES)create a Vec corresponding to a state vector on one level coarser than the current level
Collective
Input Parameter:
snes-SNESFASobject
Output Parameter:
Xcoarse- vector on level one coarser than the current level
Level: developer
-seealso: , SNESFASSetRestriction(), SNESFASRestrict(), SNESFAS
External Links
- PETSc Manual:
SNES/SNESFASCreateCoarseVec
PETSc.LibPETSc.SNESFASCycleGetCorrection — Method
SNESFASCycleGetCorrection(petsclib::PetscLibType,snes::PetscSNES, correction::PetscSNES)Gets the coarse correction SNESFAS context for this level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
correction- the coarse correction solve on this level
Level: advanced
-seealso: , SNES, SNESFAS SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetCorrection
PETSc.LibPETSc.SNESFASCycleGetInjection — Method
SNESFASCycleGetInjection(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)Gets the injection on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the restriction operator on this level
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASGetInjection(), SNESFASCycleGetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetInjection
PETSc.LibPETSc.SNESFASCycleGetInterpolation — Method
SNESFASCycleGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)Gets the interpolation on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the interpolation operator on this level
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetInterpolation
PETSc.LibPETSc.SNESFASCycleGetRScale — Method
SNESFASCycleGetRScale(petsclib::PetscLibType,snes::PetscSNES, vec::PetscVec)Gets the injection scale
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
vec- the restriction operator on this level
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASCycleGetRestriction(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetRScale
PETSc.LibPETSc.SNESFASCycleGetRestriction — Method
SNESFASCycleGetRestriction(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)Gets the restriction on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the restriction operator on this level
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASGetRestriction(), SNESFASCycleGetInterpolation()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetRestriction
PETSc.LibPETSc.SNESFASCycleGetSmoother — Method
SNESFASCycleGetSmoother(petsclib::PetscLibType,snes::PetscSNES, smooth::PetscSNES)Gets the smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smooth- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetSmoother
PETSc.LibPETSc.SNESFASCycleGetSmootherDown — Method
SNESFASCycleGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, smoothd::PetscSNES)Gets the down smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes-SNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smoothd- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetSmootherDown
PETSc.LibPETSc.SNESFASCycleGetSmootherUp — Method
SNESFASCycleGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, smoothu::PetscSNES)Gets the up smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smoothu- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASCycleGetSmoother(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNES/SNESFASCycleGetSmootherUp
PETSc.LibPETSc.SNESFASCycleIsFine — Method
flg::PetscBool = SNESFASCycleIsFine(petsclib::PetscLibType,snes::PetscSNES)Determines if a given SNES is the finest level in a SNESFAS
Logically Collective
Input Parameter:
snes- theSNESFAScontext obtained withSNESFASGetCycleSNES()
Output Parameter:
flg- indicates if this is the fine level or not
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetLevels()
External Links
- PETSc Manual:
SNES/SNESFASCycleIsFine
PETSc.LibPETSc.SNESFASCycleSetCycles — Method
SNESFASCycleSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt)Sets the number of cycles for all levels in a SNESFAS
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contextcycles- the number of cycles – 1 for V-cycle, 2 for W-cycle
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetCycles()
External Links
- PETSc Manual:
SNES/SNESFASCycleSetCycles
PETSc.LibPETSc.SNESFASFullGetTotal — Method
total::PetscBool = SNESFASFullGetTotal(petsclib::PetscLibType,snes::PetscSNES)Use total residual restriction and total interpolation on the initial down and up sweep of full FAS cycles
Logically Collective
Input Parameter:
snes- theSNESFASnonlinear multigrid context
Output Parameter:
total- whether to use total restriction / interpolatiaon or not (the alternative is defect restriction and correction interpolation)
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution(), SNESFullSetTotal()
External Links
- PETSc Manual:
SNES/SNESFASFullGetTotal
PETSc.LibPETSc.SNESFASFullSetDownSweep — Method
SNESFASFullSetDownSweep(petsclib::PetscLibType,snes::PetscSNES, swp::PetscBool)Smooth during the initial downsweep for SNESFAS
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contextswp- whether to downsweep or not
Options Database Key:
-snes_fas_full_downsweep- Sets whether to smooth on the initial downsweep
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNES/SNESFASFullSetDownSweep
PETSc.LibPETSc.SNESFASFullSetTotal — Method
SNESFASFullSetTotal(petsclib::PetscLibType,snes::PetscSNES, total::PetscBool)Use total residual restriction and total interpolation on the initial down and up sweep of full SNESFAS cycles
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contexttotal- whether to use total restriction / interpolatiaon or not (the alternative is defect restriction and correction interpolation)
Options Database Key:
-snes_fas_full_total- Use total restriction and interpolation on the initial down and up sweeps for the fullSNESFAScycle
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution()
External Links
- PETSc Manual:
SNES/SNESFASFullSetTotal
PETSc.LibPETSc.SNESFASGalerkinFunctionDefault — Method
SNESFASGalerkinFunctionDefault(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid)Computes the Galerkin FAS function
Collective
Input Parameters:
snes- theSNESFASnonlinear solver contextX- input vectorctx- the application context
Output Parameter:
F- output vector
Level: developer
-seealso: , SNES, SNESFAS, SNESFASGetGalerkin(), SNESFASSetGalerkin()
External Links
- PETSc Manual:
SNES/SNESFASGalerkinFunctionDefault
PETSc.LibPETSc.SNESFASGetCoarseSolve — Method
SNESFASGetCoarseSolve(petsclib::PetscLibType,snes::PetscSNES, coarse::PetscSNES)Gets the coarsest level solver.
Input Parameter:
snes- theSNESFASnonlinear multigrid context
Output Parameter:
coarse- the coarse-level solver
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASGetCoarseSolve
PETSc.LibPETSc.SNESFASGetCycleSNES — Method
SNESFASGetCycleSNES(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, lsnes::PetscSNES)Gets the SNES corresponding to a particular level of the SNESFAS hierarchy
Input Parameters:
snes- theSNESnonlinear multigrid contextlevel- the level to get
Output Parameter:
lsnes- theSNESfor the requested level
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetLevels()
External Links
- PETSc Manual:
SNES/SNESFASGetCycleSNES
PETSc.LibPETSc.SNESFASGetGalerkin — Method
flg::PetscBool = SNESFASGetGalerkin(petsclib::PetscLibType,snes::PetscSNES)Gets if the coarse problems are formed by projection to the fine problem
Not Collective but the result would be the same on all MPI processes
Input Parameter:
snes- theSNESFASnonlinear solver context
Output Parameter:
flg-PETSC_TRUEif the coarse problem is formed by projection
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASSetGalerkin()
External Links
- PETSc Manual:
SNES/SNESFASGetGalerkin
PETSc.LibPETSc.SNESFASGetInjection — Method
SNESFASGetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Gets the matrix used to calculate the injection from l-1 to the lth level
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest) to supply [do not supply 0]
Output Parameter:
mat- the injection operator
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASGetRestriction(), SNESFASGetInterpolation(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNES/SNESFASGetInjection
PETSc.LibPETSc.SNESFASGetInterpolation — Method
SNESFASGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Gets the matrix used to calculate the interpolation from l-1 to the lth level
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest) to supply [do not supply 0]
Output Parameter:
mat- the interpolation operator
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASGetInjection(), SNESFASGetRestriction(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNES/SNESFASGetInterpolation
PETSc.LibPETSc.SNESFASGetLevels — Method
levels::PetscInt = SNESFASGetLevels(petsclib::PetscLibType,snes::PetscSNES)Gets the number of levels in a SNESFAS, including fine and coarse grids
Input Parameter:
snes- theSNESnonlinear solver context ofSNESTypeSNESFAS
Output Parameter:
levels- the number of levels
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetLevels(), PCMGGetLevels()
External Links
- PETSc Manual:
SNES/SNESFASGetLevels
PETSc.LibPETSc.SNESFASGetRestriction — Method
SNESFASGetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Gets the matrix used to calculate the restriction from l to the l-1th level
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest) to supply [do not supply 0]
Output Parameter:
mat- the interpolation operator
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetRestriction(), SNESFASGetInjection(), SNESFASGetInterpolation(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNES/SNESFASGetRestriction
PETSc.LibPETSc.SNESFASGetSmoother — Method
SNESFASGetSmoother(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)Gets the default smoother on a level.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest) to supply
Output Parameter:
smooth- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASGetSmoother
PETSc.LibPETSc.SNESFASGetSmootherDown — Method
SNESFASGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)Gets the downsmoother on a level.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest) to supply
Output Parameter:
smooth- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASGetSmootherDown
PETSc.LibPETSc.SNESFASGetSmootherUp — Method
SNESFASGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)Gets the upsmoother on a level.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest)
Output Parameter:
smooth- the smoother
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASGetSmootherUp
PETSc.LibPETSc.SNESFASGetType — Method
fastype::SNESFASType = SNESFASGetType(petsclib::PetscLibType,snes::PetscSNES)Gets the update and correction type used for SNESFAS.
Logically Collective
Input Parameter:
snes-SNESFAScontext
Output Parameter:
fastype-SNES_FAS_ADDITIVE,SNES_FAS_MULTIPLICATIVE,SNES_FAS_FULL, orSNES_FAS_KASKADE
Level: intermediate
-seealso: , SNES, SNESFAS, PCMGSetType(), SNESFASSetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE
External Links
- PETSc Manual:
SNES/SNESFASGetType
PETSc.LibPETSc.SNESFASRestrict — Method
SNESFASRestrict(petsclib::PetscLibType,fine::PetscSNES, Xfine::PetscVec, Xcoarse::PetscVec)restrict a Vec to the next coarser level
Collective
Input Parameters:
fine-SNESfrom which to restrictXfine- vector to restrict
Output Parameter:
Xcoarse- result of restriction
Level: developer
-seealso: , SNES, SNESFAS, SNESFASSetRestriction(), SNESFASSetInjection(), SNESFASCreateCoarseVec()
External Links
- PETSc Manual:
SNES/SNESFASRestrict
PETSc.LibPETSc.SNESFASSetContinuation — Method
SNESFASSetContinuation(petsclib::PetscLibType,snes::PetscSNES, continuation::PetscBool)Sets the SNESFAS cycle to default to using exact Newton solves on the upsweep
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contextcontinuation- whether to use continuation
Options Database Key:
-snes_fas_continuation- sets continuation to true
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNES/SNESFASSetContinuation
PETSc.LibPETSc.SNESFASSetCycles — Method
SNESFASSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt)Sets the number of SNESFAS multigrid cycles to use each time a grid is visited. Use SNESFASSetCyclesOnLevel() for more complicated cycling.
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contextcycles- the number of cycles – 1 for V-cycle, 2 for W-cycle
Options Database Key:
-snes_fas_cycles <1,2>- 1 for V-cycle, 2 for W-cycle
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetCyclesOnLevel()
External Links
- PETSc Manual:
SNES/SNESFASSetCycles
PETSc.LibPETSc.SNESFASSetGalerkin — Method
SNESFASSetGalerkin(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Sets coarse problems as formed by projection to the fine problem
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear solver contextflg-PETSC_TRUEto use the projection process
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetGalerkin()
External Links
- PETSc Manual:
SNES/SNESFASSetGalerkin
PETSc.LibPETSc.SNESFASSetInjection — Method
SNESFASSetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Sets the matrix to be used to inject the solution from level to level-1.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextmat- the injection matrixlevel- the level (0 is coarsest) to supply [Do not supply 0]
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASSetInjection
PETSc.LibPETSc.SNESFASSetInterpolation — Method
SNESFASSetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Sets the Mat to be used to apply the interpolation from l-1 to the lth level
Input Parameters:
snes- theSNESFASnonlinear multigrid contextmat- the interpolation operatorlevel- the level (0 is coarsest) to supply [do not supply 0]
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction(), SNESFASSetRScale()
External Links
- PETSc Manual:
SNES/SNESFASSetInterpolation
PETSc.LibPETSc.SNESFASSetLevels — Method
SNESFASSetLevels(petsclib::PetscLibType,snes::PetscSNES, levels::PetscInt, comms::MPI_Comm)Sets the number of levels to use with SNESFAS. Must be called before any other SNESFAS routine.
Input Parameters:
snes- theSNEScontext ofSNESTypeSNESFASlevels- the number of levelscomms- optional communicators for each level; this is to allow solving the coarser
problems on smaller sets of processors.
Level: intermediate
-seealso: , SNES, SNESFAS, SNESFASGetLevels()
External Links
- PETSc Manual:
SNES/SNESFASSetLevels
PETSc.LibPETSc.SNESFASSetLog — Method
SNESFASSetLog(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Sets or unsets time logging for various SNESFAS stages on all levels
Logically Collective
Input Parameters:
snes- theSNESFAScontextflg- whether to log or not
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetMonitor()
External Links
- PETSc Manual:
SNES/SNESFASSetLog
PETSc.LibPETSc.SNESFASSetMonitor — Method
SNESFASSetMonitor(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat, flg::PetscBool)Sets the method
Logically Collective
Input Parameters:
snes- theSNESFAScontextvf- viewer and format structure (may beNULLifflgisPETSC_FALSE)flg- monitor or not
Level: advanced
-seealso: , SNES, SNESFAS, SNESMonitorSet(), SNESFASSetCyclesOnLevel()
External Links
- PETSc Manual:
SNES/SNESFASSetMonitor
PETSc.LibPETSc.SNESFASSetNumberSmoothDown — Method
SNESFASSetNumberSmoothDown(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt)Sets the number of pre use on all levels.
Logically Collective
Input Parameters:
snes- theSNESFASnonlinear multigrid contextn- the number of smoothing steps to use
Options Database Key:
-snes_fas_smoothdown <n>- Sets number of pre-smoothing steps
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNES/SNESFASSetNumberSmoothDown
PETSc.LibPETSc.SNESFASSetNumberSmoothUp — Method
SNESFASSetNumberSmoothUp(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt)Sets the number of post use on all levels.
Logically Collective
Input Parameters:
snes- theSNESnonlinear multigrid contextn- the number of smoothing steps to use
Options Database Key:
-snes_fas_smoothup <n>- Sets number of pre-smoothing steps
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothDown()
External Links
- PETSc Manual:
SNES/SNESFASSetNumberSmoothUp
PETSc.LibPETSc.SNESFASSetRScale — Method
SNESFASSetRScale(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, rscale::PetscVec)Sets the scaling factor of the restriction operator from level l to l-1.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextrscale- the restriction scalinglevel- the level (0 is coarsest) to supply [Do not supply 0]
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNES/SNESFASSetRScale
PETSc.LibPETSc.SNESFASSetRestriction — Method
SNESFASSetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)Sets the matrix to be used to restrict the defect from level l to l-1.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextmat- the restriction matrixlevel- the level (0 is coarsest) to supply [Do not supply 0]
Level: advanced
-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetInjection()
External Links
- PETSc Manual:
SNES/SNESFASSetRestriction
PETSc.LibPETSc.SNESFASSetType — Method
SNESFASSetType(petsclib::PetscLibType,snes::PetscSNES, fastype::SNESFASType)Sets the update and correction type used for SNESFAS.
Logically Collective
Input Parameters:
snes-SNESFAScontextfastype-SNES_FAS_ADDITIVE,SNES_FAS_MULTIPLICATIVE,SNES_FAS_FULL, orSNES_FAS_KASKADE
Level: intermediate
-seealso: , SNES, SNESFAS, PCMGSetType(), SNESFASGetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE
External Links
- PETSc Manual:
SNES/SNESFASSetType
PETSc.LibPETSc.SNESFinalizePackage — Method
SNESFinalizePackage(petsclib::PetscLibType)This function destroys everything in the PETSc interface to the SNES package. It is called from PetscFinalize().
Level: developer
-seealso: , SNES, PetscFinalize()
External Links
- PETSc Manual:
SNES/SNESFinalizePackage
PETSc.LibPETSc.SNESGetAlwaysComputesFinalResidual — Method
flg::PetscBool = SNESGetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES)checks if the SNES always computes the residual at the final solution
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
flg-PETSC_TRUEif the residual is computed
Level: advanced
-seealso: , SNES, SNESFAS, SNESSolve(), SNESSetAlwaysComputesFinalResidual()
External Links
- PETSc Manual:
SNES/SNESGetAlwaysComputesFinalResidual
PETSc.LibPETSc.SNESGetApplicationContext — Method
SNESGetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::PeCtx)Gets the user nonlinear solvers set with SNESGetApplicationContext() or SNESSetComputeApplicationContext()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
ctx- user context
Level: intermediate
-seealso: , SNESSetApplicationContext(), SNESSetComputeApplicationContext()
External Links
- PETSc Manual:
SNES/SNESGetApplicationContext
PETSc.LibPETSc.SNESGetCheckJacobianDomainError — Method
flg::PetscBool = SNESGetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)Get an indicator whether or not SNES is checking Jacobian domain errors after each Jacobian evaluation.
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
flg-PETSC_FALSEindicates that it is not checking Jacobian domain errors after each Jacobian evaluation
Level: advanced
-seealso: , SNES, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESSetCheckJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESGetCheckJacobianDomainError
PETSc.LibPETSc.SNESGetConvergedReason — Method
SNESGetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason)Gets the reason the SNES iteration was stopped, which may be due to convergence, divergence, or stagnation
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
reason- negative value indicates diverged, positive value converged, seeSNESConvergedReasonfor the individual convergence tests for complete lists
Options Database Key:
-snes_converged_reason- prints the reason to standard out
Level: intermediate
-seealso: , SNESSolve(), SNESSetConvergenceTest(), SNESSetConvergedReason(), SNESConvergedReason, SNESGetConvergedReasonString()
External Links
- PETSc Manual:
SNES/SNESGetConvergedReason
PETSc.LibPETSc.SNESGetConvergedReasonString — Method
SNESGetConvergedReasonString(petsclib::PetscLibType,snes::PetscSNES, strreason::Cchar)Return a human readable string for SNESConvergedReason
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
strreason- a human readable string that describesSNESconverged reason
Level: beginner
-seealso: , SNES, SNESGetConvergedReason()
External Links
- PETSc Manual:
SNES/SNESGetConvergedReasonString
PETSc.LibPETSc.SNESGetConvergenceHistory — Method
a::Vector{PetscReal},its::Vector{PetscInt},na::PetscInt = SNESGetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES)Gets the arrays used to hold the convergence history.
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameters:
a- array to hold history, usually was set withSNESSetConvergenceHistory()its- integer array holds the number of linear iterations (or
negative if not converged) for each solve.
na- size ofaandits
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESSetConvergenceHistory()
External Links
- PETSc Manual:
SNES/SNESGetConvergenceHistory
PETSc.LibPETSc.SNESGetDM — Method
dm::PetscDM = SNESGetDM(petsclib::PetscLibType,snes::PetscSNES)Gets the DM that may be used by some SNES nonlinear solvers/preconditioners
Not Collective but dm obtained is parallel on snes
Input Parameter:
snes- theSNEScontext
Output Parameter:
dm- theDM
Level: intermediate
-seealso: , DM, SNES, SNESSetDM(), KSPSetDM(), KSPGetDM()
External Links
- PETSc Manual:
SNES/SNESGetDM
PETSc.LibPETSc.SNESGetDivergenceTolerance — Method
SNESGetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal)Gets divergence tolerance used in divergence test.
Not Collective
Input Parameters:
snes- theSNEScontextdivtol- divergence tolerance
Level: intermediate
-seealso: , SNES, SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESGetDivergenceTolerance
PETSc.LibPETSc.SNESGetErrorIfNotConverged — Method
flag::PetscBool = SNESGetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES)Indicates if SNESSolve() will generate an error if the solver does not converge?
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
flag-PETSC_TRUEif it will generate an error, elsePETSC_FALSE
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESSetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()
External Links
- PETSc Manual:
SNES/SNESGetErrorIfNotConverged
PETSc.LibPETSc.SNESGetForceIteration — Method
force::PetscBool = SNESGetForceIteration(petsclib::PetscLibType,snes::PetscSNES)Check whether or not SNESSolve() take at least one iteration regardless of the initial residual norm
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
force-PETSC_TRUErequires at least one iteration.
Level: intermediate
-seealso: , SNES, SNESSetForceIteration(), SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESGetForceIteration
PETSc.LibPETSc.SNESGetFunction — Method
SNESGetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid)Returns the function that defines the nonlinear system set with SNESSetFunction()
Not Collective, but r is parallel if snes is parallel. Collective if r is requested, but has not been created yet.
Input Parameter:
snes- theSNEScontext
Output Parameters:
r- the vector that is used to store residuals (orNULLif you don't want it)f- the function (orNULLif you don't want it); for calling sequence seeSNESFunctionFnctx- the function context (orNULLif you don't want it)
Level: advanced
-seealso: , SNES, SNESSolve(), SNESSetFunction(), SNESGetSolution(), SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESGetFunction
PETSc.LibPETSc.SNESGetFunctionDomainError — Method
domainerror::PetscBool = SNESGetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES)Gets the status of the domain error after a call to SNESComputeFunction()
Not Collective, different MPI processes may return different values
Input Parameter:
snes- theSNEScontext
Output Parameter:
domainerror- Set toPETSC_TRUEif there's a domain error;PETSC_FALSEotherwise.
Level: developer
-seealso: , SNES, SNESSetFunctionDomainError(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESGetFunctionDomainError
PETSc.LibPETSc.SNESGetFunctionNorm — Method
norm::PetscReal = SNESGetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES)Gets the last computed norm of the residual
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
norm- the last computed residual norm
Level: developer
-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetFunctionNorm
PETSc.LibPETSc.SNESGetFunctionType — Method
SNESGetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType)Gets the SNESFunctionType used in convergence and monitoring set with SNESSetFunctionType() of the SNES method.
Logically Collective
Input Parameters:
snes- theSNEScontexttype- the type of the function evaluation, seeSNESSetFunctionType()
Level: advanced
-seealso: , SNESSetFunctionType(), SNESFunctionType, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetFunctionType
PETSc.LibPETSc.SNESGetGridSequence — Method
steps::PetscInt = SNESGetGridSequence(petsclib::PetscLibType,snes::PetscSNES)gets the number of steps of grid sequencing that SNES will do
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
steps- the number of refinements to do, defaults to 0
Level: intermediate
-seealso: , SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetGridSequence()
External Links
- PETSc Manual:
SNES/SNESGetGridSequence
PETSc.LibPETSc.SNESGetIterationNumber — Method
iter::PetscInt = SNESGetIterationNumber(petsclib::PetscLibType,snes::PetscSNES)Gets the number of nonlinear iterations completed in the current or most recent SNESSolve()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
iter- iteration number
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESSetLagJacobian(), SNESGetLinearSolveIterations(), SNESSetMonitor()
External Links
- PETSc Manual:
SNES/SNESGetIterationNumber
PETSc.LibPETSc.SNESGetJacobian — Method
SNESGetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)Returns the Jacobian matrix and optionally the user provided context for evaluating the Jacobian.
Not Collective, but Mat object will be parallel if SNES is
Input Parameter:
snes- the nonlinear solver context
Output Parameters:
Amat- location to stash (approximate) Jacobian matrix (orNULL)Pmat- location to stash matrix used to compute the preconditioner (orNULL)J- location to put Jacobian function (orNULL), for calling sequence seeSNESJacobianFnctx- location to stash Jacobian ctx (orNULL)
Level: advanced
-seealso: , SNES, Mat, SNESSetJacobian(), SNESComputeJacobian(), SNESJacobianFn, SNESGetFunction()
External Links
- PETSc Manual:
SNES/SNESGetJacobian
PETSc.LibPETSc.SNESGetJacobianDomainError — Method
domainerror::PetscBool = SNESGetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)Gets the status of the Jacobian domain error after a call to SNESComputeJacobian()
Not Collective, different MPI processes may return different values
Input Parameter:
snes- theSNEScontext
Output Parameter:
domainerror- Set toPETSC_TRUEif there's a Jacobian domain error;PETSC_FALSEotherwise.
Level: advanced
-seealso: , SNES, SNESSetFunctionDomainError(), SNESComputeFunction(), SNESGetFunctionDomainError()
External Links
- PETSc Manual:
SNES/SNESGetJacobianDomainError
PETSc.LibPETSc.SNESGetKSP — Method
SNESGetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP)Returns the KSP context for a SNES solver.
Not Collective, but if snes is parallel, then ksp is parallel
Input Parameter:
snes- theSNEScontext
Output Parameter:
ksp- theKSPcontext
Level: beginner
-seealso: , SNES, KSP, PC, KSPGetPC(), SNESCreate(), KSPCreate(), SNESSetKSP()
External Links
- PETSc Manual:
SNES/SNESGetKSP
PETSc.LibPETSc.SNESGetLagJacobian — Method
lag::PetscInt = SNESGetLagJacobian(petsclib::PetscLibType,snes::PetscSNES)Get how often the Jacobian is rebuilt. See SNESGetLagPreconditioner() to determine when the preconditioner is rebuilt
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
lag- -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time
the Jacobian is built etc.
Level: intermediate
-seealso: , SNES, SNESSetLagJacobian(), SNESSetLagPreconditioner(), SNESGetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESGetLagJacobian
PETSc.LibPETSc.SNESGetLagPreconditioner — Method
lag::PetscInt = SNESGetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES)Return how often the preconditioner is rebuilt
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
lag- -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time
the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that
Level: intermediate
-seealso: , SNES, SNESSetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESGetLagPreconditioner
PETSc.LibPETSc.SNESGetLineSearch — Method
SNESGetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch)Returns the line search associated with the SNES.
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
linesearch- linesearch context
Level: beginner
-seealso: , SNESLineSearch, SNESSetLineSearch(), SNESLineSearchCreate(), SNESLineSearchSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESGetLineSearch
PETSc.LibPETSc.SNESGetLinearSolveFailures — Method
nfails::PetscInt = SNESGetLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES)Gets the number of failed (non linear solvers in the current or most recent SNESSolve()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
nfails- number of failed solves
Options Database Key:
-snes_max_linear_solve_fail <num>- The number of failures before the solve is terminated
Level: intermediate
-seealso: , SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures()
External Links
- PETSc Manual:
SNES/SNESGetLinearSolveFailures
PETSc.LibPETSc.SNESGetLinearSolveIterations — Method
lits::PetscInt = SNESGetLinearSolveIterations(petsclib::PetscLibType,snes::PetscSNES)Gets the total number of linear iterations used by the nonlinear solver in the most recent SNESSolve()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
lits- number of linear iterations
Level: intermediate
-seealso: , SNES, SNESGetIterationNumber(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESSetCountersReset()
External Links
- PETSc Manual:
SNES/SNESGetLinearSolveIterations
PETSc.LibPETSc.SNESGetMaxLinearSolveFailures — Method
maxFails::PetscInt = SNESGetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES)gets the maximum number of linear solve failures that are allowed before SNES returns as unsuccessful
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
maxFails- maximum of unsuccessful solves allowed
Level: intermediate
-seealso: , SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(),
External Links
- PETSc Manual:
SNES/SNESGetMaxLinearSolveFailures
PETSc.LibPETSc.SNESGetMaxNonlinearStepFailures — Method
maxFails::PetscInt = SNESGetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES)Gets the maximum number of unsuccessful steps attempted by the nonlinear solver before it gives up and returns unconverged or generates an error
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
maxFails- maximum of unsuccessful steps
Level: intermediate
-seealso: , SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures()
External Links
- PETSc Manual:
SNES/SNESGetMaxNonlinearStepFailures
PETSc.LibPETSc.SNESGetNGS — Method
SNESGetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid)Returns the function and context set with SNESSetNGS()
Input Parameter:
snes- theSNEScontext
Output Parameters:
f- the function (orNULL) seeSNESNGSFnfor calling sequencectx- the function context (orNULL)
Level: advanced
-seealso: , SNESSetNGS(), SNESGetFunction(), SNESNGSFn
External Links
- PETSc Manual:
SNES/SNESGetNGS
PETSc.LibPETSc.SNESGetNPC — Method
SNESGetNPC(petsclib::PetscLibType,snes::PetscSNES, pc::PetscSNES)Gets a nonlinear preconditioning solver SNES` to be used to precondition the original nonlinear solver.
Not Collective; but any changes to the obtained the pc object must be applied collectively
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
pc- theSNESpreconditioner context
Options Database Key:
-npc_snes_type <type>- set the type of theSNESto use as the nonlinear preconditioner
Level: advanced
-seealso: , SNESSetNPC(), SNESHasNPC(), SNES, SNESCreate()
External Links
- PETSc Manual:
SNES/SNESGetNPC
PETSc.LibPETSc.SNESGetNPCFunction — Method
fnorm::PetscReal = SNESGetNPCFunction(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec)Gets the current function value and its norm from a nonlinear preconditioner after SNESSolve() has been called on that SNES
Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
F- function vectorfnorm- the norm ofF
Level: developer
-seealso: , SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction(), SNESApplyNPC(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESGetNPCFunction
PETSc.LibPETSc.SNESGetNPCSide — Method
SNESGetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide)Gets the preconditioning side used by the nonlinear preconditioner inside SNES.
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
side- the preconditioning side, where side is one of
-seealso: , SNES, SNESGetNPC(), SNESSetNPCSide(), KSPGetPCSide(), PC_LEFT, PC_RIGHT, PCSide
External Links
- PETSc Manual:
SNES/SNESGetNPCSide
PETSc.LibPETSc.SNESGetNonlinearStepFailures — Method
nfails::PetscInt = SNESGetNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES)Gets the number of unsuccessful steps attempted by the nonlinear solver in the current or most recent SNESSolve() .
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
nfails- number of unsuccessful steps attempted
Level: intermediate
-seealso: , SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetMaxNonlinearStepFailures()
External Links
- PETSc Manual:
SNES/SNESGetNonlinearStepFailures
PETSc.LibPETSc.SNESGetNormSchedule — Method
SNESGetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule)Gets the SNESNormSchedule used in convergence and monitoring of the SNES method.
Logically Collective
Input Parameters:
snes- theSNEScontextnormschedule- the type of the norm used
Level: advanced
-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetNormSchedule
PETSc.LibPETSc.SNESGetNumberFunctionEvals — Method
nfuncs::PetscInt = SNESGetNumberFunctionEvals(petsclib::PetscLibType,snes::PetscSNES)Gets the number of user provided function evaluations done by the SNES object in the current or most recent SNESSolve()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
nfuncs- number of evaluations
Level: intermediate
-seealso: , SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetCountersReset()
External Links
- PETSc Manual:
SNES/SNESGetNumberFunctionEvals
PETSc.LibPETSc.SNESGetObjective — Method
SNESGetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid)Returns the objective function set with SNESSetObjective()
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
obj- objective evaluation routine (orNULL); seeSNESObjectiveFnfor the calling sequencectx- the function context (orNULL)
Level: advanced
-seealso: , SNES, SNESSetObjective(), SNESGetSolution(), SNESObjectiveFn
External Links
- PETSc Manual:
SNES/SNESGetObjective
PETSc.LibPETSc.SNESGetOptionsPrefix — Method
SNESGetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)Gets the prefix used for searching for all SNES options in the database.
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
prefix- pointer to the prefix string used
Level: advanced
-seealso: , SNES, SNESSetOptionsPrefix(), SNESAppendOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESGetOptionsPrefix
PETSc.LibPETSc.SNESGetPicard — Method
SNESGetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)Returns the context for the Picard iteration
Not Collective, but Vec is parallel if SNES is parallel. Collective if Vec is requested, but has not been created yet.
Input Parameter:
snes- theSNEScontext
Output Parameters:
r- the function (orNULL)f- the function (orNULL); for calling sequence seeSNESFunctionFnAmat- the matrix used to defined the operation A(x) x - b(x) (orNULL)Pmat- the matrix from which the preconditioner will be constructed (orNULL)J- the function for matrix evaluation (orNULL); for calling sequence seeSNESJacobianFnctx- the function context (orNULL)
Level: advanced
-seealso: , SNESSetFunction(), SNESSetPicard(), SNESGetFunction(), SNESGetJacobian(), SNESGetDM(), SNESFunctionFn, SNESJacobianFn
External Links
- PETSc Manual:
SNES/SNESGetPicard
PETSc.LibPETSc.SNESGetRhs — Method
SNESGetRhs(petsclib::PetscLibType,snes::PetscSNES, rhs::PetscVec)Gets the vector for solving F(x) = rhs. If rhs is not set it assumes a zero right-hand side.
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
rhs- the right-hand side vector orNULLif there is no right-hand side vector
Level: intermediate
-seealso: , SNES, SNESGetSolution(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetFunction()
External Links
- PETSc Manual:
SNES/SNESGetRhs
PETSc.LibPETSc.SNESGetSolution — Method
SNESGetSolution(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec)Returns the vector where the approximate solution is stored. This is the fine grid solution when using SNESSetGridSequence().
Not Collective, but x is parallel if snes is parallel
Input Parameter:
snes- theSNEScontext
Output Parameter:
x- the solution
Level: intermediate
-seealso: , SNESSetSolution(), SNESSolve(), SNES, SNESGetSolutionUpdate(), SNESGetFunction()
External Links
- PETSc Manual:
SNES/SNESGetSolution
PETSc.LibPETSc.SNESGetSolutionNorm — Method
xnorm::PetscReal = SNESGetSolutionNorm(petsclib::PetscLibType,snes::PetscSNES)Gets the last computed norm of the solution
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
xnorm- the last computed solution norm
Level: developer
-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm(), SNESGetUpdateNorm()
External Links
- PETSc Manual:
SNES/SNESGetSolutionNorm
PETSc.LibPETSc.SNESGetSolutionUpdate — Method
SNESGetSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec)Returns the vector where the solution update is stored.
Not Collective, but x is parallel if snes is parallel
Input Parameter:
snes- theSNEScontext
Output Parameter:
x- the solution update
Level: advanced
-seealso: , SNES, SNESGetSolution(), SNESGetFunction()
External Links
- PETSc Manual:
SNES/SNESGetSolutionUpdate
PETSc.LibPETSc.SNESGetTolerances — Method
atol::PetscReal,rtol::PetscReal,stol::PetscReal,maxit::PetscInt,maxf::PetscInt = SNESGetTolerances(petsclib::PetscLibType,snes::PetscSNES)Gets various parameters used in SNES convergence tests.
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
atol- the absolute convergence tolerancertol- the relative convergence tolerancestol- convergence tolerance in terms of the norm of the change in the solution between stepsmaxit- the maximum number of iterations allowedmaxf- the maximum number of function evaluations allowed,PETSC_UNLIMITEDindicates no bound
Level: intermediate
-seealso: , SNES, SNESSetTolerances()
External Links
- PETSc Manual:
SNES/SNESGetTolerances
PETSc.LibPETSc.SNESGetType — Method
type::SNESType = SNESGetType(petsclib::PetscLibType,snes::PetscSNES)Gets the SNES method type and name (as a string).
Not Collective
Input Parameter:
snes- nonlinear solver context
Output Parameter:
type-SNESmethod (a character string)
Level: intermediate
-seealso: , SNESSetType(), SNESType, SNESSetFromOptions(), SNES
External Links
- PETSc Manual:
SNES/SNESGetType
PETSc.LibPETSc.SNESGetUpdateNorm — Method
ynorm::PetscReal = SNESGetUpdateNorm(petsclib::PetscLibType,snes::PetscSNES)Gets the last computed norm of the solution update
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
ynorm- the last computed update norm
Level: developer
-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm()
External Links
- PETSc Manual:
SNES/SNESGetUpdateNorm
PETSc.LibPETSc.SNESGetUseMatrixFree — Method
mf_operator::PetscBool,mf::PetscBool = SNESGetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES)indicates if the SNES uses matrix
Not Collective, but the resulting flags will be the same on all MPI processes
Input Parameter:
snes-SNEScontext
Output Parameters:
mf_operator- use matrix-free only for the Amat used bySNESSetJacobian(), this means the user provided Pmat will continue to be usedmf- use matrix-free for both the Amat and Pmat used bySNESSetJacobian(), both the Amat and Pmat set inSNESSetJacobian()will be ignored
Level: intermediate
-seealso: , SNES, SNESSetUseMatrixFree(), MatCreateSNESMF()
External Links
- PETSc Manual:
SNES/SNESGetUseMatrixFree
PETSc.LibPETSc.SNESHasNPC — Method
has_npc::PetscBool = SNESHasNPC(petsclib::PetscLibType,snes::PetscSNES)Returns whether a nonlinear preconditioner is associated with the given SNES
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
has_npc- whether theSNEShas a nonlinear preconditioner or not
Level: developer
-seealso: , SNESSetNPC(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESHasNPC
PETSc.LibPETSc.SNESInitializePackage — Method
SNESInitializePackage(petsclib::PetscLibType)This function initializes everything in the SNES package. It is called from PetscDLLibraryRegister_petscsnes() when using dynamic libraries, and on the first call to SNESCreate() when using shared or static libraries.
Level: developer
-seealso: , SNES, PetscInitialize()
External Links
- PETSc Manual:
SNES/SNESInitializePackage
PETSc.LibPETSc.SNESKSPGetParametersEW — Method
version::PetscInt,rtol_0::PetscReal,rtol_max::PetscReal,gamma::PetscReal,alpha::PetscReal,alpha2::PetscReal,threshold::PetscReal = SNESKSPGetParametersEW(petsclib::PetscLibType,snes::PetscSNES)Gets parameters for Eisenstat convergence criteria for the linear solvers within an inexact Newton method.
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameters:
version- version 1, 2 (default is 2), 3 or 4rtol_0- initial relative tolerance (0 <= rtol_0 < 1)rtol_max- maximum relative tolerance (0 <= rtol_max < 1)gamma- multiplicative factor for version 2 rtol computation (0 <= gamma2 <= 1)alpha- power for version 2 rtol computation (1 < alpha <= 2)alpha2- power for safeguardthreshold- threshold for imposing safeguard (0 < threshold < 1)
Level: advanced
-seealso: , SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPGetParametersEW
PETSc.LibPETSc.SNESKSPGetUseEW — Method
flag::PetscBool = SNESKSPGetUseEW(petsclib::PetscLibType,snes::PetscSNES)Gets if SNES is using Eisenstat for computing relative tolerance for linear solvers within an inexact Newton method.
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
flag-PETSC_TRUEorPETSC_FALSE
Level: advanced
-seealso: , SNESKSPSetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPGetUseEW
PETSc.LibPETSc.SNESKSPSetParametersEW — Method
SNESKSPSetParametersEW(petsclib::PetscLibType,snes::PetscSNES, version::PetscInt, rtol_0::PetscReal, rtol_max::PetscReal, gamma::PetscReal, alpha::PetscReal, alpha2::PetscReal, threshold::PetscReal)Sets parameters for Eisenstat convergence criteria for the linear solvers within an inexact Newton method.
Logically Collective
Input Parameters:
snes-SNEScontextversion- version 1, 2 (default is 2), 3 or 4rtol_0- initial relative tolerance (0 <= rtol_0 < 1)rtol_max- maximum relative tolerance (0 <= rtol_max < 1)gamma- multiplicative factor for version 2 rtol computation
(0 <= gamma2 <= 1)
alpha- power for version 2 rtol computation (1 < alpha <= 2)alpha2- power for safeguardthreshold- threshold for imposing safeguard (0 < threshold < 1)
Level: advanced
-seealso: , SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPGetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPSetParametersEW
PETSc.LibPETSc.SNESKSPSetUseEW — Method
SNESKSPSetUseEW(petsclib::PetscLibType,snes::PetscSNES, flag::PetscBool)Sets SNES to the use Eisenstat computing relative tolerance for linear solvers within an inexact Newton method.
Logically Collective
Input Parameters:
snes-SNEScontextflag-PETSC_TRUEorPETSC_FALSE
Options Database Keys:
-snes_ksp_ew- use Eisenstat-Walker method for determining linear system convergence-snes_ksp_ew_version ver- version of Eisenstat-Walker method-snes_ksp_ew_rtol0 <rtol0>- Sets rtol0-snes_ksp_ew_rtolmax <rtolmax>- Sets rtolmax-snes_ksp_ew_gamma <gamma>- Sets gamma-snes_ksp_ew_alpha <alpha>- Sets alpha-snes_ksp_ew_alpha2 <alpha2>- Sets alpha2-snes_ksp_ew_threshold <threshold>- Sets threshold
Level: advanced
-seealso: , KSP, SNES, SNESKSPGetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPSetUseEW
PETSc.LibPETSc.SNESLoad — Method
SNESLoad(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)Loads a SNES that has been stored in PETSCVIEWERBINARY with SNESView().
Collective
Input Parameters:
snes- the newly loadedSNES, this needs to have been created withSNESCreate()or
some related function before a call to SNESLoad().
viewer- binary file viewer, obtained fromPetscViewerBinaryOpen()
Level: intermediate
-seealso: , SNES, PetscViewer, SNESCreate(), SNESType, PetscViewerBinaryOpen(), SNESView(), MatLoad(), VecLoad()
External Links
- PETSc Manual:
SNES/SNESLoad
PETSc.LibPETSc.SNESMSFinalizePackage — Method
SNESMSFinalizePackage(petsclib::PetscLibType)This function destroys everything in the SNESMS package. It is called from PetscFinalize().
Level: developer
-seealso: , SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll(), SNESMSInitializePackage(), PetscFinalize()
External Links
- PETSc Manual:
SNES/SNESMSFinalizePackage
PETSc.LibPETSc.SNESMSGetDamping — Method
damping::PetscReal = SNESMSGetDamping(petsclib::PetscLibType,snes::PetscSNES)Get the damping parameter of SNESMS multistage scheme
Not Collective
Input Parameter:
snes- nonlinear solver context
Output Parameter:
damping- damping parameter
Level: advanced
-seealso: , SNESMSSetDamping(), SNESMS
External Links
- PETSc Manual:
SNES/SNESMSGetDamping
PETSc.LibPETSc.SNESMSGetType — Method
mstype::SNESMSType = SNESMSGetType(petsclib::PetscLibType,snes::PetscSNES)Get the type of multistage smoother SNESMS
Not Collective
Input Parameter:
snes- nonlinear solver context
Output Parameter:
mstype- type of multistage method
Level: advanced
-seealso: , SNESMS, SNESMSSetType(), SNESMSType
External Links
- PETSc Manual:
SNES/SNESMSGetType
PETSc.LibPETSc.SNESMSInitializePackage — Method
SNESMSInitializePackage(petsclib::PetscLibType)This function initializes everything in the SNESMS package. It is called from SNESInitializePackage().
Level: developer
-seealso: , SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll(), PetscInitialize()
External Links
- PETSc Manual:
SNES/SNESMSInitializePackage
PETSc.LibPETSc.SNESMSRegister — Method
SNESMSRegister(petsclib::PetscLibType,name::SNESMSType, nstages::PetscInt, nregisters::PetscInt, stability::PetscReal, gamma::Vector{PetscReal}, delta::Vector{PetscReal}, betasub::Vector{PetscReal})register a multistage scheme for SNESMS
Logically Collective, No Fortran Support
Input Parameters:
name- identifier for methodnstages- number of stagesnregisters- number of registers used by low-storage implementationstability- scaled stability regiongamma- coefficients, see Ketcheson's paper {cite}ketcheson2010rungedelta- coefficients, see Ketcheson's paper {cite}ketcheson2010rungebetasub- subdiagonal of Shu-Osher form
Level: advanced
External Links
- PETSc Manual:
SNES/SNESMSRegister
PETSc.LibPETSc.SNESMSRegisterAll — Method
SNESMSRegisterAll(petsclib::PetscLibType)Registers all of the multi
Logically Collective
Level: developer
-seealso: , SNES, SNESMS, SNESMSRegisterDestroy()
External Links
- PETSc Manual:
SNES/SNESMSRegisterAll
PETSc.LibPETSc.SNESMSRegisterDestroy — Method
SNESMSRegisterDestroy(petsclib::PetscLibType)Frees the list of schemes that were registered by SNESMSRegister().
Logically Collective
Level: developer
-seealso: , SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll()
External Links
- PETSc Manual:
SNES/SNESMSRegisterDestroy
PETSc.LibPETSc.SNESMSSetDamping — Method
SNESMSSetDamping(petsclib::PetscLibType,snes::PetscSNES, damping::PetscReal)Set the damping parameter for a SNESMS multistage scheme
Logically Collective
Input Parameters:
snes- nonlinear solver contextdamping- damping parameter
Level: advanced
-seealso: , SNESMSGetDamping(), SNESMS
External Links
- PETSc Manual:
SNES/SNESMSSetDamping
PETSc.LibPETSc.SNESMSSetType — Method
SNESMSSetType(petsclib::PetscLibType,snes::PetscSNES, mstype::SNESMSType)Set the type of multistage smoother SNESMS
Logically Collective
Input Parameters:
snes- nonlinear solver contextmstype- type of multistage method
Level: advanced
-seealso: , SNESMS, SNESMSGetType(), SNESMSType
External Links
- PETSc Manual:
SNES/SNESMSSetType
PETSc.LibPETSc.SNESMonitor — Method
SNESMonitor(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt, rnorm::PetscReal)runs any SNES monitor routines provided with SNESMonitor() or the options database
Collective
Input Parameters:
snes- nonlinear solver context obtained fromSNESCreate()iter- current iteration numberrnorm- current relative norm of the residual
Level: developer
-seealso: , SNES, SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESMonitor
PETSc.LibPETSc.SNESMonitorCancel — Method
SNESMonitorCancel(petsclib::PetscLibType,snes::PetscSNES)Clears all the monitor functions for a SNES object.
Logically Collective
Input Parameter:
snes- theSNEScontext
Options Database Key:
-snes_monitor_cancel- cancels all monitors that have been hardwired
into a code by calls to SNESMonitorSet(), but does not cancel those set via the options database
Level: intermediate
-seealso: , SNES, SNESMonitorDefault(), SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESMonitorCancel
PETSc.LibPETSc.SNESMonitorDefault — Method
SNESMonitorDefault(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNESSolve() (default).
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- viewer and format structure
Options Database Key:
-snes_monitor- use this function to monitor the convergence of the nonlinear solver
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorFunction(), SNESMonitorResidual(), SNESMonitorSolutionUpdate(), SNESMonitorScaling(), SNESMonitorRange(), SNESMonitorRatio(), SNESMonitorDefaultField(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorDefault
PETSc.LibPETSc.SNESMonitorDefaultField — Method
SNESMonitorDefaultField(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNESSolve(), separated into fields.
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- the PetscViewer
Options Database Key:
-snes_monitor_field- activate this monitor
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorDefaultField
PETSc.LibPETSc.SNESMonitorDefaultSetUp — Method
SNESMonitorDefaultSetUp(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat)External Links
- PETSc Manual:
SNES/SNESMonitorDefaultSetUp
PETSc.LibPETSc.SNESMonitorDefaultShort — Method
SNESMonitorDefaultShort(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)External Links
- PETSc Manual:
SNES/SNESMonitorDefaultShort
PETSc.LibPETSc.SNESMonitorFields — Method
SNESMonitorFields(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors the residual for each field separately
Collective
Input Parameters:
snes- theSNEScontext, must have an attachedDMits- iteration numberfgnorm- 2-norm of residualvf-PetscViewerAndFormatofPetscViewerTypePETSCVIEWERASCII
Level: intermediate
-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault()
External Links
- PETSc Manual:
SNES/SNESMonitorFields
PETSc.LibPETSc.SNESMonitorJacUpdateSpectrum — Method
SNESMonitorJacUpdateSpectrum(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat)Monitors the spectrun of the change in the Jacobian from the last Jacobian evaluation of a SNESSolve()
Collective
Input Parameters:
snes- theSNEScontextit- iteration numberfnorm- 2-norm of residualvf- viewer and format structure
Options Database Key:
-snes_monitor_jacupdate_spectrum- activates this monitor
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorJacUpdateSpectrum
PETSc.LibPETSc.SNESMonitorLGRange — Method
SNESMonitorLGRange(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, rnorm::PetscReal, monctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESMonitorLGRange
PETSc.LibPETSc.SNESMonitorRange — Method
SNESMonitorRange(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)Prints the percentage of residual elements that are more than 10 percent of the maximum entry in the residual in each iteration of a SNESSolve()
Collective
Input Parameters:
snes-SNESiterative contextit- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).vf- unused monitor context
Options Database Key:
-snes_monitor_range- ActivatesSNESMonitorRange()
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorDefault(), SNESMonitorLGCreate(), SNESMonitorScaling(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRange
PETSc.LibPETSc.SNESMonitorRatio — Method
SNESMonitorRatio(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNESSolve() by printing the ratio of residual norm at each iteration to the previous.
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residual (or gradient)vf- context of monitor
Options Database Key:
-snes_monitor_ratio- activate this monitor
Level: intermediate
-seealso: , SNESMonitorRationSetUp(), SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRatio
PETSc.LibPETSc.SNESMonitorRatioSetUp — Method
SNESMonitorRatioSetUp(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat)Insures the SNES object is saving its history since this monitor needs access to it
Collective
Input Parameters:
snes- theSNEScontextvf-PetscViewerAndFormat(ignored)
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), SNESMonitorRatio(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRatioSetUp
PETSc.LibPETSc.SNESMonitorResidual — Method
SNESMonitorResidual(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNESSolve() by calling VecView() for the residual at each iteration.
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- a viewer
Options Database Key:
-snes_monitor_residual [ascii binary draw][:filename][:viewer format]- plots residual (not its norm) at each iteration
Level: intermediate
-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()
External Links
- PETSc Manual:
SNES/SNESMonitorResidual
PETSc.LibPETSc.SNESMonitorSAWs — Method
SNESMonitorSAWs(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, rnorm::PetscReal, ctx::Cvoid)monitor solution process of SNES using SAWs
Collective
Input Parameters:
snes- iterative contextn- iteration numberrnorm- 2-norm (preconditioned) residual value (may be estimated).ctx-PetscViewerof typePETSCVIEWERSAWS
Level: advanced
-seealso: , PetscViewerSAWsOpen(), SNESMonitorSAWsDestroy(), SNESMonitorSAWsCreate()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWs
PETSc.LibPETSc.SNESMonitorSAWsCreate — Method
ctx::Cvoid = SNESMonitorSAWsCreate(petsclib::PetscLibType,snes::PetscSNES)create an SAWs monitor context for SNES
Collective
Input Parameter:
snes-SNESto monitor
Output Parameter:
ctx- context for monitor
Level: developer
-seealso: , SNESMonitorSet(), SNES, SNESMonitorSAWs(), SNESMonitorSAWsDestroy()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWsCreate
PETSc.LibPETSc.SNESMonitorSAWsDestroy — Method
SNESMonitorSAWsDestroy(petsclib::PetscLibType,ctx::Cvoid)destroy a monitor context created with SNESMonitorSAWsCreate()
Collective
Input Parameter:
ctx- monitor context
Level: developer
-seealso: , SNESMonitorSAWsCreate()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWsDestroy
PETSc.LibPETSc.SNESMonitorScaling — Method
SNESMonitorScaling(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors the largest value in each row of the Jacobian of a SNESSolve()
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- viewer and format structure
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), SNESMonitorJacUpdateSpectrum(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorScaling
PETSc.LibPETSc.SNESMonitorSet — Method
SNESMonitorSet(petsclib::PetscLibType,snes::PetscSNES, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn)Sets an ADDITIONAL function that is to be used at every iteration of the SNES nonlinear solver to display the iteration's progress.
Logically Collective
Input Parameters:
snes- theSNEScontextf- the monitor function, for the calling sequence seeSNESMonitorFunctionmctx- [optional] user-defined context for private data for the monitor routine (useNULLif no context is desired)monitordestroy- [optional] routine that frees monitor context (may beNULL), seePetscCtxDestroyFnfor the calling sequence
Options Database Keys:
-snes_monitor- setsSNESMonitorDefault()-snes_monitor draw::draw_lg- sets line graph monitor,-snes_monitor_cancel- cancels all monitors that have been hardwired into a code by calls toSNESMonitorSet(), but does not cancel those set via
the options database.
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESMonitorDefault(), SNESMonitorCancel(), SNESMonitorFunction, PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESMonitorSet
PETSc.LibPETSc.SNESMonitorSetFromOptions — Method
SNESMonitorSetFromOptions(petsclib::PetscLibType,snes::PetscSNES, name::String, help::String, manual::String, monitor::external, monitorsetup::external)Sets a monitor function and viewer appropriate for the type indicated by the user
Collective
Input Parameters:
snes-SNESobject you wish to monitorname- the monitor type one is seekinghelp- message indicating what monitoring is donemanual- manual page for the monitormonitor- the monitor function, this must use aPetscViewerFormatas its contextmonitorsetup- a function that is called once ONLY if the user selected this monitor that may set additional features of theSNESorPetscViewerobjects
Calling sequence of monitor:
snes- the nonlinear solver contextit- the current iterationr- the current function normvf- aPetscViewerAndFormatstruct that contains thePetscViewerandPetscViewerFormatto use
Calling sequence of monitorsetup:
snes- the nonlinear solver contextvf- aPetscViewerAndFormatstruct that contains thePetscViewerandPetscViewerFormatto use
Options Database Key:
-name- trigger the use of this monitor inSNESSetFromOptions()
Level: advanced
-seealso: , 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:
SNES/SNESMonitorSetFromOptions
PETSc.LibPETSc.SNESMonitorSolution — Method
SNESMonitorSolution(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNES SNESSolve() by calling VecView() for the approximate solution at each iteration.
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- a viewer
Options Database Key:
-snes_monitor_solution [ascii binary draw][:filename][:viewer format]- plots solution at each iteration
Level: intermediate
-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView()
External Links
- PETSc Manual:
SNES/SNESMonitorSolution
PETSc.LibPETSc.SNESMonitorSolutionUpdate — Method
SNESMonitorSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)Monitors progress of a SNESSolve() by calling VecView() for the UPDATE to the solution at each iteration.
Collective
Input Parameters:
snes- theSNEScontextits- iteration numberfgnorm- 2-norm of residualvf- a viewer
Options Database Key:
-snes_monitor_solution_update [ascii binary draw][:filename][:viewer format]- plots update to solution at each iteration
Level: intermediate
-seealso: , SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()
External Links
- PETSc Manual:
SNES/SNESMonitorSolutionUpdate
PETSc.LibPETSc.SNESMultiblockGetSubSNES — Method
n::PetscInt = SNESMultiblockGetSubSNES(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES})Gets the SNES contexts for all blocks in a SNESMULTIBLOCK solver.
Not Collective but each SNES obtained is parallel
Input Parameter:
snes- the solver context
Output Parameters:
n- the number of blockssubsnes- the array ofSNEScontexts
Level: advanced
-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockSetIS(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockGetSubSNES
PETSc.LibPETSc.SNESMultiblockSetBlockSize — Method
SNESMultiblockSetBlockSize(petsclib::PetscLibType,snes::PetscSNES, bs::PetscInt)Sets the block size for structured block division in a SNESMULTIBLOCK solver. If not set the matrix block size is used.
Logically Collective
Input Parameters:
snes- the solver contextbs- the block size
Level: intermediate
-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetBlockSize
PETSc.LibPETSc.SNESMultiblockSetFields — Method
SNESMultiblockSetFields(petsclib::PetscLibType,snes::PetscSNES, name::String, n::PetscInt, fields::PetscInt)Sets the fields for one particular block in a SNESMULTIBLOCK solver
Logically Collective
Input Parameters:
snes- the solvername- name of this block, ifNULLthe number of the block is usedn- the number of fields in this blockfields- the fields in this block
Level: intermediate
-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetIS()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetFields
PETSc.LibPETSc.SNESMultiblockSetIS — Method
SNESMultiblockSetIS(petsclib::PetscLibType,snes::PetscSNES, name::String, is::IS)Sets the global row indices for one particular block in a SNESMULTIBLOCK solver
Logically Collective
Input Parameters:
snes- the solver contextname- name of this block, ifNULLthe number of the block is usedis- the index set that defines the global row indices in this block
Level: intermediate
-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetIS
PETSc.LibPETSc.SNESMultiblockSetType — Method
SNESMultiblockSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCCompositeType)Sets the type of block combination used for a SNESMULTIBLOCK solver
Logically Collective
Input Parameters:
snes- the solver contexttype-PC_COMPOSITE_ADDITIVE,PC_COMPOSITE_MULTIPLICATIVE(default),PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE
Options Database Key:
-snes_multiblock_type <type: one of multiplicative, additive, symmetric_multiplicative>- Sets block combination type
Level: advanced
-seealso: , SNES, SNESMULTIBLOCK, PCCompositeSetType(), PC_COMPOSITE_ADDITIVE, PC_COMPOSITE_MULTIPLICATIVE, PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE, PCCompositeType, SNESCOMPOSITE, SNESCompositeSetType()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetType
PETSc.LibPETSc.SNESNASMGetDamping — Method
dmp::PetscReal = SNESNASMGetDamping(petsclib::PetscLibType,snes::PetscSNES)Gets the update damping for SNESNASM the nonlinear additive Schwarz solver
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
dmp- damping
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMSetDamping()
External Links
- PETSc Manual:
SNES/SNESNASMGetDamping
PETSc.LibPETSc.SNESNASMGetNumber — Method
n::PetscInt = SNESNASMGetNumber(petsclib::PetscLibType,snes::PetscSNES)Gets number of subsolvers
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
n- the number of subsolvers
Level: intermediate
-seealso: , SNESNASM, SNESNASMGetSNES()
External Links
- PETSc Manual:
SNES/SNESNASMGetNumber
PETSc.LibPETSc.SNESNASMGetSNES — Method
SNESNASMGetSNES(petsclib::PetscLibType,snes::PetscSNES, i::PetscInt, subsnes::PetscSNES)Gets a subsolver
Not Collective
Input Parameters:
snes- theSNEScontexti- the number of the subsnes to get
Output Parameter:
subsnes- the subsolver context
Level: intermediate
-seealso: , SNESNASM, SNESNASMGetNumber()
External Links
- PETSc Manual:
SNES/SNESNASMGetSNES
PETSc.LibPETSc.SNESNASMGetSubdomainVecs — Method
n::PetscInt = SNESNASMGetSubdomainVecs(petsclib::PetscLibType,snes::PetscSNES, x::Vector{PetscVec}, y::Vector{PetscVec}, b::Vector{PetscVec}, xl::Vector{PetscVec})Get the processor
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
n- the number of local subdomainsx- The subdomain solution vectory- The subdomain step vectorb- The subdomain RHS vectorxl- The subdomain local vectors (ghosted)
Level: developer
-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMGetSubdomainVecs
PETSc.LibPETSc.SNESNASMGetSubdomains — Method
n::PetscInt = SNESNASMGetSubdomains(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter})Get the local subdomain contexts for the nonlinear additive Schwarz solver
Not Collective but some of the objects returned will be parallel
Input Parameter:
snes- theSNEScontext
Output Parameters:
n- the number of local subdomainssubsnes- solvers defined on the local subdomainsiscatter- scatters into the nonoverlapping portions of the local subdomainsoscatter- scatters into the overlapping portions of the local subdomainsgscatter- scatters into the (ghosted) local vector of the local subdomain
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMSetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMGetSubdomains
PETSc.LibPETSc.SNESNASMGetType — Method
type::PCASMType = SNESNASMGetType(petsclib::PetscLibType,snes::PetscSNES)Get the type of subdomain update used for the nonlinear additive Schwarz solver SNESNASM
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
type- the type of update
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMSetType(), PCASMGetType(), PC_ASM_BASIC, PC_ASM_RESTRICT, PCASMType
External Links
- PETSc Manual:
SNES/SNESNASMGetType
PETSc.LibPETSc.SNESNASMSetComputeFinalJacobian — Method
SNESNASMSetComputeFinalJacobian(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Schedules the computation of the global and subdomain Jacobians upon convergence for the nonlinear additive Schwarz solver
Collective
Input Parameters:
snes- the SNES contextflg-PETSC_TRUEto compute the Jacobians
Level: developer
-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMSetComputeFinalJacobian
PETSc.LibPETSc.SNESNASMSetDamping — Method
SNESNASMSetDamping(petsclib::PetscLibType,snes::PetscSNES, dmp::PetscReal)Sets the update damping for SNESNASM the nonlinear additive Schwarz solver
Logically Collective
Input Parameters:
snes- theSNEScontextdmp- damping
Options Database Key:
-snes_nasm_damping <dmp>- the new solution is obtained as old solution plusdmptimes (sum of the solutions on the subdomains)
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMGetDamping()
External Links
- PETSc Manual:
SNES/SNESNASMSetDamping
PETSc.LibPETSc.SNESNASMSetSubdomains — Method
SNESNASMSetSubdomains(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter})Manually Set the context required to restrict and solve subdomain problems in the nonlinear additive Schwarz solver
Logically Collective
Input Parameters:
snes- theSNEScontextn- the number of local subdomainssubsnes- solvers defined on the local subdomainsiscatter- scatters into the nonoverlapping portions of the local subdomainsoscatter- scatters into the overlapping portions of the local subdomainsgscatter- scatters into the (ghosted) local vector of the local subdomain
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMSetSubdomains
PETSc.LibPETSc.SNESNASMSetType — Method
SNESNASMSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCASMType)Set the type of subdomain update used for the nonlinear additive Schwarz solver SNESNASM
Logically Collective
Input Parameters:
snes- theSNEScontexttype- the type of update,PC_ASM_BASICorPC_ASM_RESTRICT
Options Database Key:
-snes_nasm_type <basic,restrict>- type of subdomain update used
Level: intermediate
-seealso: , SNES, SNESNASM, SNESNASMGetType(), PCASMSetType(), PC_ASM_BASIC, PC_ASM_RESTRICT, PCASMType
External Links
- PETSc Manual:
SNES/SNESNASMSetType
PETSc.LibPETSc.SNESNASMSetWeight — Method
SNESNASMSetWeight(petsclib::PetscLibType,snes::PetscSNES, weight::PetscVec)Sets weight to use when adding overlapping updates
Collective
Input Parameters:
snes- theSNEScontextweight- the weights to use (typically 1/N for each dof, where N is the number of patches it appears in)
Level: intermediate
External Links
- PETSc Manual:
SNES/SNESNASMSetWeight
PETSc.LibPETSc.SNESNCGSetType — Method
SNESNCGSetType(petsclib::PetscLibType,snes::PetscSNES, btype::SNESNCGType)Sets the conjugate update type for nonlinear CG SNESNCG.
Logically Collective
Input Parameters:
snes- the iterative contextbtype- update type, seeSNESNCGType
Options Database Key:
-snes_ncg_type <prp,fr,hs,dy,cd>- strategy for selecting algorithm for computing beta
Level: intermediate
-seealso: , SNES, SNESNCG, SNESNCGType, SNES_NCG_FR, SNES_NCG_PRP, SNES_NCG_HS, SNES_NCG_DY, SNES_NCG_CD
External Links
- PETSc Manual:
SNES/SNESNCGSetType
PETSc.LibPETSc.SNESNGMRESGetRestartFmRise — Method
flg::PetscBool = SNESNGMRESGetRestartFmRise(petsclib::PetscLibType,snes::PetscSNES)External Links
- PETSc Manual:
SNES/SNESNGMRESGetRestartFmRise
PETSc.LibPETSc.SNESNGMRESSetRestartFmRise — Method
SNESNGMRESSetRestartFmRise(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Increase the restart count if the step xM increases the residual FM inside a SNESNGMRES solve
Input Parameters:
snes- theSNEScontext.flg- boolean value deciding whether to use the option or not, default isPETSC_FALSE
Options Database Key:
-snes_ngmres_restart_fm_rise- Increase the restart count if the step xM increases the residual FM
Level: advanced
-seealso: , SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartType()
External Links
- PETSc Manual:
SNES/SNESNGMRESSetRestartFmRise
PETSc.LibPETSc.SNESNGMRESSetRestartType — Method
SNESNGMRESSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESNGMRESRestartType)Sets the restart type for SNESNGMRES.
Logically Collective
Input Parameters:
snes- the iterative contextrtype- restart type, seeSNESNGMRESRestartType
Options Database Keys:
-snes_ngmres_restart_type<difference,periodic,none>- set the restart type-snes_ngmres_restart <30>- sets the number of iterations before restart for periodic
Level: intermediate
-seealso: , SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartFmRise(), SNESNGMRESSetSelectType()
External Links
- PETSc Manual:
SNES/SNESNGMRESSetRestartType
PETSc.LibPETSc.SNESNGMRESSetSelectType — Method
SNESNGMRESSetSelectType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESNGMRESSelectType)Sets the selection type for SNESNGMRES. This determines how the candidate solution and combined solution are used to create the next iterate.
Logically Collective
Input Parameters:
snes- the iterative contextstype- selection type, seeSNESNGMRESSelectType
Options Database Key:
-snes_ngmres_select_type<difference,none,linesearch>- select type
Level: intermediate
-seealso: , SNES, SNESNGMRES, SNESNGMRESSelectType, SNES_NGMRES_SELECT_NONE, SNES_NGMRES_SELECT_DIFFERENCE, SNES_NGMRES_SELECT_LINESEARCH, SNESNGMRESSetRestartType()
External Links
- PETSc Manual:
SNES/SNESNGMRESSetSelectType
PETSc.LibPETSc.SNESNGSGetSweeps — Method
sweeps::PetscInt = SNESNGSGetSweeps(petsclib::PetscLibType,snes::PetscSNES)Gets the number of sweeps nonlinear GS will use in SNESNCG
Input Parameter:
snes- theSNEScontext
Output Parameter:
sweeps- the number of sweeps of nonlinear GS to perform.
Level: intermediate
-seealso: , SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSSetSweeps()
External Links
- PETSc Manual:
SNES/SNESNGSGetSweeps
PETSc.LibPETSc.SNESNGSGetTolerances — Method
SNESNGSGetTolerances(petsclib::PetscLibType,snes::PetscSNES, atol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt)Gets various parameters used in convergence tests for nonlinear Gauss
Not Collective
Input Parameters:
snes- theSNEScontextatol- absolute convergence tolerancertol- relative convergence tolerancestol- convergence tolerance in terms of the norm
of the change in the solution between steps
maxit- maximum number of iterations
Level: intermediate
-seealso: , SNES, SNESNCG, SNESSetTolerances()
External Links
- PETSc Manual:
SNES/SNESNGSGetTolerances
PETSc.LibPETSc.SNESNGSSetSweeps — Method
SNESNGSSetSweeps(petsclib::PetscLibType,snes::PetscSNES, sweeps::PetscInt)Sets the number of sweeps of nonlinear GS to use in SNESNCG
Logically Collective
Input Parameters:
snes- theSNEScontextsweeps- the number of sweeps of nonlinear GS to perform.
Options Database Key:
-snes_ngs_sweeps <n>- Number of sweeps of nonlinear GS to apply
Level: intermediate
-seealso: , SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSGetSweeps()
External Links
- PETSc Manual:
SNES/SNESNGSSetSweeps
PETSc.LibPETSc.SNESNGSSetTolerances — Method
SNESNGSSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt)Sets various parameters used in convergence tests for nonlinear Gauss
Logically Collective
Input Parameters:
snes- theSNEScontextabstol- absolute convergence tolerancertol- relative convergence tolerancestol- convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||maxit- maximum number of iterations
Options Database Keys:
-snes_ngs_atol <abstol>- Sets abstol-snes_ngs_rtol <rtol>- Sets rtol-snes_ngs_stol <stol>- Sets stol-snes_max_it <maxit>- Sets maxit
Level: intermediate
External Links
- PETSc Manual:
SNES/SNESNGSSetTolerances
PETSc.LibPETSc.SNESNewtonALComputeFunction — Method
SNESNewtonALComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Q::PetscVec)Calls the function that has been set with SNESNewtonALSetFunction().
Collective
Input Parameters:
snes- theSNEScontextX- input vector
Output Parameter:
Q- tangent load vector, as set bySNESNewtonALSetFunction()
Level: developer
-seealso: , SNES, SNESNewtonALSetFunction(), SNESNewtonALGetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALComputeFunction
PETSc.LibPETSc.SNESNewtonALGetFunction — Method
SNESNewtonALGetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid)Get the user function and context set with SNESNewtonALSetFunction
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] tangent load function evaluation routine, seeSNESNewtonALSetFunction()for the call sequencectx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESNEWTONAL, SNESNewtonALSetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALGetFunction
PETSc.LibPETSc.SNESNewtonALGetLoadParameter — Method
lambda::PetscReal = SNESNewtonALGetLoadParameter(petsclib::PetscLibType,snes::PetscSNES)Get the value of the load parameter lambda for the arc
Logically Collective
Input Parameter:
snes- the nonlinear solver object
Output Parameter:
lambda- the arc-length parameter
Level: intermediate
-seealso: , SNES, SNESNEWTONAL, SNESNewtonALSetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALGetLoadParameter
PETSc.LibPETSc.SNESNewtonALSetCorrectionType — Method
SNESNewtonALSetCorrectionType(petsclib::PetscLibType,snes::PetscSNES, ctype::SNESNewtonALCorrectionType)Set the type of correction to use in the arc
Logically Collective
Input Parameters:
snes- the nonlinear solver objectctype- the type of correction to use
Options Database Key:
-snes_newtonal_correction_type <type>- Set the type of correction to use; use -help for a list of available types
Level: intermediate
-seealso: , SNES, SNESNEWTONAL, SNESNewtonALCorrectionType
External Links
- PETSc Manual:
SNES/SNESNewtonALSetCorrectionType
PETSc.LibPETSc.SNESNewtonALSetFunction — Method
SNESNewtonALSetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid)Sets a user function that is called at each function evaluation to compute the tangent load vector for the arc-length continuation method.
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] tangent load function evaluation routine, seeSNESFunctionFnfor the calling sequence.Uis the current solution vector,Qis the output tangent load vectorctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESNEWTONAL, SNESNewtonALGetFunction(), SNESNewtonALGetLoadParameter()
External Links
- PETSc Manual:
SNES/SNESNewtonALSetFunction
PETSc.LibPETSc.SNESNewtonTRDCGetRhoFlag — Method
rho_flag::PetscBool = SNESNewtonTRDCGetRhoFlag(petsclib::PetscLibType,snes::PetscSNES)Get whether the current solution update is within the trust
Logically Collective
Input Parameter:
snes- the nonlinear solver object
Output Parameter:
rho_flag-PETSC_FALSEorPETSC_TRUE
Level: developer
-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCGetRhoFlag
PETSc.LibPETSc.SNESNewtonTRDCSetPostCheck — Method
SNESNewtonTRDCSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)Sets a user function that is called after the search step has been determined but before the next function evaluation. Allows the user a chance to change or override the decision of the line search routine
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRDCPostCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCSetPostCheck
PETSc.LibPETSc.SNESNewtonTRDCSetPreCheck — Method
SNESNewtonTRDCSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)Sets a user function that is called before the search step has been determined. Allows the user a chance to change or override the trust region decision.
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRDCPreCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCGetRhoFlag()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCSetPreCheck
PETSc.LibPETSc.SNESNewtonTRGetTolerances — Method
delta_min::PetscReal,delta_max::PetscReal,delta_0::PetscReal = SNESNewtonTRGetTolerances(petsclib::PetscLibType,snes::PetscSNES)Gets the trust region parameter tolerances.
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
delta_min- minimum allowed trust region size orNULLdelta_max- maximum allowed trust region size orNULLdelta_0- initial trust region size orNULL
Level: intermediate
-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRSetTolerances()
External Links
- PETSc Manual:
SNES/SNESNewtonTRGetTolerances
PETSc.LibPETSc.SNESNewtonTRGetUpdateParameters — Method
eta1::PetscReal,eta2::PetscReal,eta3::PetscReal,t1::PetscReal,t2::PetscReal = SNESNewtonTRGetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES)Gets the trust region update parameters.
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
eta1- acceptance toleranceeta2- shrinking toleranceeta3- enlarging tolerancet1- shrink factort2- enlarge factor
Level: intermediate
-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRSetUpdateParameters()
External Links
- PETSc Manual:
SNES/SNESNewtonTRGetUpdateParameters
PETSc.LibPETSc.SNESNewtonTRPostCheck — Method
changed_Y::PetscBool,changed_W::PetscBool = SNESNewtonTRPostCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec, W::PetscVec)Runs the postcheck routine
Logically Collective
Input Parameters:
snes- the solverX- The last solutionY- The full step directionW- The updated solution, W = X - Y
Output Parameters:
changed_Y- indicator if step has been changedchanged_W- Indicator if the new candidate solution W has been changed.
-seealso: , SNESNEWTONTR, SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRPostCheck
PETSc.LibPETSc.SNESNewtonTRPreCheck — Method
changed_Y::PetscBool = SNESNewtonTRPreCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec)Runs the precheck routine
Logically Collective
Input Parameters:
snes- the solverX- The last solutionY- The step direction
Output Parameter:
changed_Y- Indicator that the step directionYhas been changed.
Level: intermediate
-seealso: , SNESNEWTONTR, SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRPreCheck
PETSc.LibPETSc.SNESNewtonTRSetFallbackType — Method
SNESNewtonTRSetFallbackType(petsclib::PetscLibType,snes::PetscSNES, ftype::SNESNewtonTRFallbackType)Set the type of fallback to use if the solution of the trust region subproblem is outside the radius
Input Parameters:
snes- the nonlinear solver objectftype- the fallback type, seeSNESNewtonTRFallbackType
Level: intermediate
-seealso: , SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetFallbackType
PETSc.LibPETSc.SNESNewtonTRSetNormType — Method
SNESNewtonTRSetNormType(petsclib::PetscLibType,snes::PetscSNES, norm::NormType)Specify the type of norm to use for the computation of the trust region.
Input Parameters:
snes- the nonlinear solver objectnorm- the norm type
Level: intermediate
-seealso: SNESNEWTONTR, NormType
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetNormType
PETSc.LibPETSc.SNESNewtonTRSetPostCheck — Method
SNESNewtonTRSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)Sets a user function that is called after the search step has been determined but before the next function evaluation. Allows the user a chance to change or override the internal decision of the solver
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRPostCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNESNEWTONTR, SNESNewtonTRPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetPostCheck
PETSc.LibPETSc.SNESNewtonTRSetPreCheck — Method
SNESNewtonTRSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)Sets a user function that is called before the search step has been determined. Allows the user a chance to change or override the trust region decision.
Logically Collective
Input Parameters:
snes- the nonlinear solver objectfunc- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRPreCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(),
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetPreCheck
PETSc.LibPETSc.SNESNewtonTRSetQNType — Method
SNESNewtonTRSetQNType(petsclib::PetscLibType,snes::PetscSNES, use::SNESNewtonTRQNType)Specify to use a quasi
Input Parameters:
snes- the nonlinear solver objectuse- the type of approximations to be used
Level: intermediate
-seealso: SNESNEWTONTR, SNESNewtonTRQNType, MATLMVM
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetQNType
PETSc.LibPETSc.SNESNewtonTRSetTolerances — Method
SNESNewtonTRSetTolerances(petsclib::PetscLibType,snes::PetscSNES, delta_min::PetscReal, delta_max::PetscReal, delta_0::PetscReal)Sets the trust region parameter tolerances.
Logically Collective
Input Parameters:
snes- theSNEScontextdelta_min- minimum allowed trust region sizedelta_max- maximum allowed trust region sizedelta_0- initial trust region size
Options Database Key:
-snes_tr_deltamin <tol>- Set minimum size-snes_tr_deltamax <tol>- Set maximum size-snes_tr_delta0 <tol>- Set initial size
-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRGetTolerances()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetTolerances
PETSc.LibPETSc.SNESNewtonTRSetUpdateParameters — Method
SNESNewtonTRSetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES, eta1::PetscReal, eta2::PetscReal, eta3::PetscReal, t1::PetscReal, t2::PetscReal)Sets the trust region update parameters.
Logically Collective
Input Parameters:
snes- theSNEScontexteta1- acceptance toleranceeta2- shrinking toleranceeta3- enlarging tolerancet1- shrink factort2- enlarge factor
Options Database Key:
-snes_tr_eta1 <tol>- Seteta1-snes_tr_eta2 <tol>- Seteta2-snes_tr_eta3 <tol>- Seteta3-snes_tr_t1 <tol>- Sett1-snes_tr_t2 <tol>- Sett2
-seealso: , SNES, SNESNEWTONTR, SNESSetObjective(), SNESNewtonTRGetUpdateParameters()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetUpdateParameters
PETSc.LibPETSc.SNESObjectiveComputeFunctionDefaultFD — Method
SNESObjectiveComputeFunctionDefaultFD(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid)Computes the gradient of a user provided objective function
Collective
Input Parameters:
snes- theSNEScontextX- the state vectorctx- the (ignored) function context
Output Parameter:
F- the function value
Options Database Keys:
-snes_fd_function_eps- Tolerance for including non-zero entries into the gradient, default is 1.e-6-snes_fd_function- Computes function from user provided objective function (set withSNESSetObjective()) with finite difference
Level: advanced
-seealso: , SNESSetObjective(), SNESSetFunction(), SNESComputeObjective(), SNESComputeJacobianDefault(), SNESObjectiveFn
External Links
- PETSc Manual:
SNES/SNESObjectiveComputeFunctionDefaultFD
PETSc.LibPETSc.SNESParametersInitialize — Method
SNESParametersInitialize(petsclib::PetscLibType,snes::PetscSNES)Sets all the parameters in snes to their default value (when SNESCreate() was called) if they currently contain default values
Collective
Input Parameter:
snes- theSNESobject
Level: developer
-seealso: , SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian(), PetscObjectParameterSetDefault()
External Links
- PETSc Manual:
SNES/SNESParametersInitialize
PETSc.LibPETSc.SNESPatchSetCellNumbering — Method
SNESPatchSetCellNumbering(petsclib::PetscLibType,snes::PetscSNES, cellNumbering::PetscSection)External Links
- PETSc Manual:
SNES/SNESPatchSetCellNumbering
PETSc.LibPETSc.SNESPatchSetComputeFunction — Method
SNESPatchSetComputeFunction(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESPatchSetComputeFunction
PETSc.LibPETSc.SNESPatchSetComputeOperator — Method
SNESPatchSetComputeOperator(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESPatchSetComputeOperator
PETSc.LibPETSc.SNESPatchSetConstructType — Method
ctx::Cvoid = SNESPatchSetConstructType(petsclib::PetscLibType,snes::PetscSNES, ctype::PCPatchConstructType, func::external)External Links
- PETSc Manual:
SNES/SNESPatchSetConstructType
PETSc.LibPETSc.SNESPatchSetDiscretisationInfo — Method
bs::PetscInt,nodesPerCell::PetscInt,subspaceOffsets::PetscInt,ghostBcNodes::PetscInt,globalBcNodes::PetscInt = SNESPatchSetDiscretisationInfo(petsclib::PetscLibType,snes::PetscSNES, nsubspaces::PetscInt, dms::PetscDM, cellNodeMap::PetscInt, numGhostBcs::PetscInt, numGlobalBcs::PetscInt)External Links
- PETSc Manual:
SNES/SNESPatchSetDiscretisationInfo
PETSc.LibPETSc.SNESPicardComputeFunction — Method
SNESPicardComputeFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESPicardComputeFunction
PETSc.LibPETSc.SNESPicardComputeJacobian — Method
SNESPicardComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESPicardComputeJacobian
PETSc.LibPETSc.SNESPicardComputeMFFunction — Method
SNESPicardComputeMFFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, ctx::Cvoid)External Links
- PETSc Manual:
SNES/SNESPicardComputeMFFunction
PETSc.LibPETSc.SNESPruneJacobianColor — Method
SNESPruneJacobianColor(petsclib::PetscLibType,snes::PetscSNES, J::PetscMat, B::PetscMat)Remove nondiagonal zeros in the Jacobian matrix and update the MatMFFD coloring information based on the new nonzero structure
Collective
Input Parameters:
snes- theSNEScontextJ- Jacobian matrix (not altered in this routine)B- newly computed Jacobian matrix to use with preconditioner (generally the same asJ)
Level: intermediate
-seealso: , SNESComputeJacobianDefaultColor(), MatEliminateZeros(), MatFDColoringCreate(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
SNES/SNESPruneJacobianColor
PETSc.LibPETSc.SNESPythonGetType — Method
pyname::String = SNESPythonGetType(petsclib::PetscLibType,snes::PetscSNES)Get the type of a SNES object implemented in Python set with SNESPythonSetType()
Not Collective
Input Parameter:
snes- the nonlinear solver (SNES) context.
Output Parameter:
pyname- full dotted Python name [package].module[.{class|function}]
Level: intermediate
-seealso: , SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonSetType()
External Links
- PETSc Manual:
SNES/SNESPythonGetType
PETSc.LibPETSc.SNESPythonSetType — Method
SNESPythonSetType(petsclib::PetscLibType,snes::PetscSNES, pyname::String)Initialize a SNES object implemented in Python.
Collective
Input Parameters:
snes- the nonlinear solver (SNES) context.pyname- full dotted Python name [package].module[.{class|function}]
Options Database Key:
-snes_python_type <pyname>- python class
Level: intermediate
-seealso: , SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonGetType()
External Links
- PETSc Manual:
SNES/SNESPythonSetType
PETSc.LibPETSc.SNESQNSetRestartType — Method
SNESQNSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESQNRestartType)Sets the restart type for SNESQN.
Logically Collective
Input Parameters:
snes- the iterative contextrtype- restart type, seeSNESQNRestartType
Options Database Keys:
-snes_qn_restart_type <powell,periodic,none>- set the restart type-snes_qn_m <m>- sets the number of stored updates and the restart period for periodic
Level: intermediate
-seealso: , SNES, SNESQN, SNESQNRestartType, SNES_QN_RESTART_NONE, SNES_QN_RESTART_POWELL, SNES_QN_RESTART_PERIODIC, SNESQNType, SNESQNScaleType
External Links
- PETSc Manual:
SNES/SNESQNSetRestartType
PETSc.LibPETSc.SNESQNSetScaleType — Method
SNESQNSetScaleType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESQNScaleType)Sets the scaling type for the inner inverse Jacobian in SNESQN.
Logically Collective
Input Parameters:
snes- the nonlinear solver contextstype- scale type, seeSNESQNScaleType
Options Database Key:
-snes_qn_scale_type <diagonal,none,scalar,jacobian>- Scaling type
Level: intermediate
-seealso: , SNES, SNESQN, SNESLineSearch, SNESQNScaleType, SNESSetJacobian(), SNESQNType, SNESQNRestartType
External Links
- PETSc Manual:
SNES/SNESQNSetScaleType
PETSc.LibPETSc.SNESQNSetType — Method
SNESQNSetType(petsclib::PetscLibType,snes::PetscSNES, qtype::SNESQNType)Sets the quasi
Logically Collective
Input Parameters:
snes- the iterative contextqtype- variant type, seeSNESQNType
Options Database Key:
-snes_qn_type <lbfgs,broyden,badbroyden>- quasi-Newton type
Level: intermediate
-seealso: , SNESQN, SNES_QN_LBFGS, SNES_QN_BROYDEN, SNES_QN_BADBROYDEN, SNESQNType, SNESQNScaleType, TAOLMVM, TAOBLMVM
External Links
- PETSc Manual:
SNES/SNESQNSetType
PETSc.LibPETSc.SNESRegister — Method
SNESRegister(petsclib::PetscLibType,sname::String, fnc::external)Adds a method to the nonlinear solver package.
Not Collective
Input Parameters:
sname- name of a new user-defined solverfunction- routine to create method context
Level: advanced
-seealso: , SNESRegisterAll(), SNESRegisterDestroy()
External Links
- PETSc Manual:
SNES/SNESRegister
PETSc.LibPETSc.SNESReset — Method
SNESReset(petsclib::PetscLibType,snes::PetscSNES)Resets a SNES context to the state it was in before SNESSetUp() was called and removes any allocated Vec and Mat from its data structures
Collective
Input Parameter:
snes- the nonlinear iterative solver context obtained fromSNESCreate()
Level: intermediate
-seealso: , SNES, SNESDestroy(), SNESCreate(), SNESSetUp(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESReset
PETSc.LibPETSc.SNESResetCounters — Method
SNESResetCounters(petsclib::PetscLibType,snes::PetscSNES)Reset counters for linear iterations and function evaluations.
Logically Collective
Input Parameters:
snes-SNEScontext
Level: developer
-seealso: , SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESResetCounters
PETSc.LibPETSc.SNESResetFromOptions — Method
SNESResetFromOptions(petsclib::PetscLibType,snes::PetscSNES)Sets various SNES and KSP parameters from user options ONLY if the SNESSetFromOptions() was previously called
Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
-seealso: , SNES, SNESSetFromOptions(), SNESSetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESResetFromOptions
PETSc.LibPETSc.SNESSetAlwaysComputesFinalResidual — Method
SNESSetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)tells the SNES to always compute the residual (nonlinear function value) at the final solution
Logically Collective
Input Parameters:
snes- the shellSNESflg-PETSC_TRUEto always compute the residual
Level: advanced
-seealso: , SNES, SNESFAS, SNESSolve(), SNESGetAlwaysComputesFinalResidual()
External Links
- PETSc Manual:
SNES/SNESSetAlwaysComputesFinalResidual
PETSc.LibPETSc.SNESSetApplicationContext — Method
SNESSetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)Sets the optional user
Logically Collective
Input Parameters:
snes- theSNEScontextctx- the user context
Level: intermediate
-seealso: , SNES, SNESSetComputeApplicationContext(), SNESGetApplicationContext()
External Links
- PETSc Manual:
SNES/SNESSetApplicationContext
PETSc.LibPETSc.SNESSetCheckJacobianDomainError — Method
SNESSetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)tells SNESSolve() whether to check if the user called SNESSetJacobianDomainError() Jacobian domain error after each Jacobian evaluation. By default, it checks for the Jacobian domain error in the debug mode, and does not check it in the optimized mode.
Logically Collective
Input Parameters:
snes- theSNEScontextflg- indicates if or not to check Jacobian domain error after each Jacobian evaluation
Level: advanced
-seealso: , SNES, SNESConvergedReason, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESGetCheckJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESSetCheckJacobianDomainError
PETSc.LibPETSc.SNESSetComputeApplicationContext — Method
SNESSetComputeApplicationContext(petsclib::PetscLibType,snes::PetscSNES, compute::external, destroy::PetscCtxDestroyFn)Sets an optional function to compute a user the nonlinear solvers.
Logically Collective; No Fortran Support
Input Parameters:
snes- theSNEScontextcompute- function to compute the contextdestroy- function to destroy the context, seePetscCtxDestroyFnfor the calling sequence
Calling sequence of compute:
snes- theSNEScontextctx- context to be computed
Level: intermediate
-seealso: , SNESGetApplicationContext(), SNESSetApplicationContext(), PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESSetComputeApplicationContext
PETSc.LibPETSc.SNESSetComputeInitialGuess — Method
SNESSetComputeInitialGuess(petsclib::PetscLibType,snes::PetscSNES, func::SNESInitialGuessFn, ctx::Cvoid)Sets a routine used to compute an initial guess for the nonlinear problem
Logically Collective
Input Parameters:
snes- theSNEScontextfunc- function evaluation routine, seeSNESInitialGuessFnfor the calling sequencectx- [optional] user-defined context for private data for the
function evaluation routine (may be NULL)
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESInitialGuessFn
External Links
- PETSc Manual:
SNES/SNESSetComputeInitialGuess
PETSc.LibPETSc.SNESSetConvergedReason — Method
SNESSetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason)Sets the reason the SNES iteration was stopped.
Not Collective
Input Parameters:
snes- theSNEScontextreason- negative value indicates diverged, positive value converged, seeSNESConvergedReasonor the
manual pages for the individual convergence tests for complete lists
Level: developer
-seealso: , SNESGetConvergedReason(), SNESSetConvergenceTest(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESSetConvergedReason
PETSc.LibPETSc.SNESSetConvergenceHistory — Method
SNESSetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES, a::Vector{PetscReal}, its::Vector{PetscInt}, na::PetscInt, reset::PetscBool)Sets the arrays used to hold the convergence history.
Logically Collective
Input Parameters:
snes- iterative context obtained fromSNESCreate()a- array to hold history, this array will contain the function norms computed at each stepits- integer array holds the number of linear iterations for each solve.na- size ofaanditsreset-PETSC_TRUEindicates each new nonlinear solve resets the history counter to zero,
else it continues storing new values for new nonlinear solves after the old ones
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESGetConvergenceHistory()
External Links
- PETSc Manual:
SNES/SNESSetConvergenceHistory
PETSc.LibPETSc.SNESSetConvergenceTest — Method
SNESSetConvergenceTest(petsclib::PetscLibType,snes::PetscSNES, SNESConvergenceTestFunction::external, cctx::Cvoid, destroy::external)Sets the function that is to be used to test for convergence of the nonlinear iterative solution.
Logically Collective
Input Parameters:
snes- theSNEScontextSNESConvergenceTestFunction- routine to test for convergencecctx- [optional] context for private data for the convergence routine (may beNULL)destroy- [optional] destructor for the context (may beNULL;PETSC_NULL_FUNCTIONin Fortran)
Level: advanced
-seealso: , SNES, SNESConvergedDefault(), SNESConvergedSkip(), SNESConvergenceTestFunction
External Links
- PETSc Manual:
SNES/SNESSetConvergenceTest
PETSc.LibPETSc.SNESSetCountersReset — Method
SNESSetCountersReset(petsclib::PetscLibType,snes::PetscSNES, reset::PetscBool)Sets whether or not the counters for linear iterations and function evaluations are reset every time SNESSolve() is called.
Logically Collective
Input Parameters:
snes-SNEScontextreset- whether to reset the counters or not, defaults toPETSC_TRUE
Level: developer
-seealso: , SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESSetCountersReset
PETSc.LibPETSc.SNESSetDM — Method
SNESSetDM(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM)Sets the DM that may be used by some SNES nonlinear solvers or their underlying preconditioners
Logically Collective
Input Parameters:
snes- the nonlinear solver contextdm- theDM, cannot beNULL
Level: intermediate
-seealso: , DM, SNES, SNESGetDM(), KSPSetDM(), KSPGetDM()
External Links
- PETSc Manual:
SNES/SNESSetDM
PETSc.LibPETSc.SNESSetDivergenceTolerance — Method
SNESSetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal)Sets the divergence tolerance used for the SNES divergence test.
Logically Collective
Input Parameters:
snes- theSNEScontextdivtol- the divergence tolerance. UsePETSC_UNLIMITEDto deactivate the test. If the residual norm F(x^n) ≥ divtol * F(x^0) the solver
is stopped due to divergence.
Options Database Key:
-snes_divergence_tolerance <divtol>- Setsdivtol
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESSetTolerances(), SNESGetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESSetDivergenceTolerance
PETSc.LibPETSc.SNESSetErrorIfNotConverged — Method
SNESSetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Causes SNESSolve() to generate an error immediately if the solver has not converged.
Logically Collective
Input Parameters:
snes- iterative context obtained fromSNESCreate()flg-PETSC_TRUEindicates you want the error generated
Options Database Key:
-snes_error_if_not_converged <true,false>- cause an immediate error condition and stop the program if the solver does not converge
Level: intermediate
-seealso: , SNES, SNESGetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()
External Links
- PETSc Manual:
SNES/SNESSetErrorIfNotConverged
PETSc.LibPETSc.SNESSetForceIteration — Method
SNESSetForceIteration(petsclib::PetscLibType,snes::PetscSNES, force::PetscBool)force SNESSolve() to take at least one iteration regardless of the initial residual norm
Logically Collective
Input Parameters:
snes- theSNEScontextforce-PETSC_TRUErequire at least one iteration
Options Database Key:
-snes_force_iteration <force>- Sets forcing an iteration
Level: intermediate
-seealso: , SNES, TS, SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESSetForceIteration
PETSc.LibPETSc.SNESSetFromOptions — Method
SNESSetFromOptions(petsclib::PetscLibType,snes::PetscSNES)Sets various SNES and KSP parameters from user options.
Collective
Input Parameter:
snes- theSNEScontext
Options Database Keys:
-snes_type <type>- newtonls, newtontr, ngmres, ncg, nrichardson, qn, vi, fas,SNESTypefor complete list-snes_rtol <rtol>- relative decrease in tolerance norm from initial-snes_atol <abstol>- absolute tolerance of residual norm-snes_stol <stol>- convergence tolerance in terms of the norm of the change in the solution between steps-snes_divergence_tolerance <divtol>- if the residual goes above divtol*rnorm0, exit with divergence-snes_max_it <max_it>- maximum number of iterations-snes_max_funcs <max_funcs>- maximum number of function evaluations-snes_force_iteration <force>- forceSNESSolve()to take at least one iteration-snes_max_fail <max_fail>- maximum number of line search failures allowed before stopping, default is none-snes_max_linear_solve_fail- number of linear solver failures before SNESSolve() stops-snes_lag_preconditioner <lag>- how often preconditioner is rebuilt (use -1 to never rebuild)-snes_lag_preconditioner_persists <true,false>- retains the -sneslagpreconditioner information across multiple SNESSolve()-snes_lag_jacobian <lag>- how often Jacobian is rebuilt (use -1 to never rebuild)-snes_lag_jacobian_persists <true,false>- retains the -sneslagjacobian information across multiple SNESSolve()-snes_convergence_test <default,skip,correct_pressure>- convergence test in nonlinear solver. defaultSNESConvergedDefault(). skipSNESConvergedSkip()means continue iterating until maxit or some other criterion is reached, saving expense of convergence test. correctpressureSNESConvergedCorrectPressure()has special handling of a pressure null space.-snes_monitor [ascii][:filename][:viewer format]- prints residual norm at each iteration. if no filename given prints to stdout-snes_monitor_solution [ascii binary draw][:filename][:viewer format]- plots solution at each iteration-snes_monitor_residual [ascii binary draw][:filename][:viewer format]- plots residual (not its norm) at each iteration-snes_monitor_solution_update [ascii binary draw][:filename][:viewer format]- plots update to solution at each iteration-snes_monitor_lg_residualnorm- plots residual norm at each iteration-snes_monitor_lg_range- plots residual norm at each iteration-snes_monitor_pause_final- Pauses all monitor drawing after the solver ends-snes_fd- use finite differences to compute Jacobian; very slow, only for testing-snes_fd_color- use finite differences with coloring to compute Jacobian-snes_mf_ksp_monitor- if using matrix-free multiply then print h at eachKSPiteration-snes_converged_reason- print the reason for convergence/divergence after each solve-npc_snes_type <type>- theSNEStype to use as a nonlinear preconditioner-snes_test_jacobian <optional threshold>- compare the user provided Jacobian with one computed via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.-snes_test_jacobian_view- display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian.
Options Database Keys for Eisenstat-Walker method:
-snes_ksp_ew- use Eisenstat-Walker method for determining linear system convergence-snes_ksp_ew_version ver- version of Eisenstat-Walker method-snes_ksp_ew_rtol0 <rtol0>- Sets rtol0-snes_ksp_ew_rtolmax <rtolmax>- Sets rtolmax-snes_ksp_ew_gamma <gamma>- Sets gamma-snes_ksp_ew_alpha <alpha>- Sets alpha-snes_ksp_ew_alpha2 <alpha2>- Sets alpha2-snes_ksp_ew_threshold <threshold>- Sets threshold
Level: beginner
-seealso: , SNESType, SNESSetOptionsPrefix(), SNESResetFromOptions(), SNES, SNESCreate(), MatCreateSNESMF(), MatFDColoring
External Links
- PETSc Manual:
SNES/SNESSetFromOptions
PETSc.LibPETSc.SNESSetFunction — Method
SNESSetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid)Sets the function evaluation routine and function vector for use by the SNES routines in solving systems of nonlinear equations.
Logically Collective
Input Parameters:
snes- theSNEScontextr- vector to store function values, may beNULLf- function evaluation routine; for calling sequence seeSNESFunctionFnctx- [optional] user-defined context for private data for the
function evaluation routine (may be NULL)
Level: beginner
-seealso: , SNES, SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetPicard(), SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESSetFunction
PETSc.LibPETSc.SNESSetFunctionDomainError — Method
SNESSetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES)tells SNES that the input vector, a proposed new solution, to your function you provided to SNESSetFunction() is not in the functions domain. For example, a step with negative pressure.
Not Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
-seealso: , SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetJacobianDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason(), SNES_DIVERGED_FUNCTION_DOMAIN
External Links
- PETSc Manual:
SNES/SNESSetFunctionDomainError
PETSc.LibPETSc.SNESSetFunctionNorm — Method
SNESSetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES, norm::PetscReal)Sets the last computed residual norm.
Logically Collective
Input Parameters:
snes- theSNEScontextnorm- the value of the norm
Level: developer
-seealso: , SNES, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESSetFunctionNorm
PETSc.LibPETSc.SNESSetFunctionType — Method
SNESSetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType)Sets the SNESFunctionType of the SNES method.
Logically Collective
Input Parameters:
snes- theSNEScontexttype- the function type
Level: developer
Values of the function type:
SNES_FUNCTION_DEFAULT- the default for the givenSNESTypeSNES_FUNCTION_UNPRECONDITIONED- an unpreconditioned function evaluation (this is the function provided withSNESSetFunction()SNES_FUNCTION_PRECONDITIONED- a transformation of the function provided withSNESSetFunction()
-seealso: , SNES, SNESFunctionType, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESSetFunctionType
PETSc.LibPETSc.SNESSetGridSequence — Method
SNESSetGridSequence(petsclib::PetscLibType,snes::PetscSNES, steps::PetscInt)sets the number of steps of grid sequencing that SNES will do
Logically Collective
Input Parameters:
snes- theSNEScontextsteps- the number of refinements to do, defaults to 0
Options Database Key:
-snes_grid_sequence <steps>- Use grid sequencing to generate initial guess
Level: intermediate
-seealso: , SNES, SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetGridSequence(), SNESSetDM(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESSetGridSequence
PETSc.LibPETSc.SNESSetInitialFunction — Method
SNESSetInitialFunction(petsclib::PetscLibType,snes::PetscSNES, f::PetscVec)Set an already computed function evaluation at the initial guess to be reused by SNESSolve().
Logically Collective
Input Parameters:
snes- theSNEScontextf- vector to store function value
Level: developer
-seealso: , SNES, SNESFAS, SNESSetFunction(), SNESComputeFunction(), SNESSetInitialFunctionNorm()
External Links
- PETSc Manual:
SNES/SNESSetInitialFunction
PETSc.LibPETSc.SNESSetIterationNumber — Method
SNESSetIterationNumber(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt)Sets the current iteration number.
Not Collective
Input Parameters:
snes-SNEScontextiter- iteration number
Level: developer
-seealso: , SNESGetLinearSolveIterations()
External Links
- PETSc Manual:
SNES/SNESSetIterationNumber
PETSc.LibPETSc.SNESSetJacobian — Method
SNESSetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::Union{SNESJacobianFn,Ptr}, ctx::Union{Cvoid,Ptr})Sets the function to compute Jacobian as well as the location to store the matrix.
Logically Collective
Input Parameters:
snes- theSNEScontextAmat- the matrix that defines the (approximate) JacobianPmat- the matrix to be used in constructing the preconditioner, usually the same asAmat.J- Jacobian evaluation routine (ifNULLthenSNESretains any previously set value), seeSNESJacobianFnfor detailsctx- [optional] user-defined context for private data for the
Jacobian evaluation routine (may be NULL) (if NULL then SNES retains any previously set value)
Level: beginner
-seealso: , SNES, KSPSetOperators(), SNESSetFunction(), MatMFFDComputeJacobian(), SNESComputeJacobianDefaultColor(), MatStructure, SNESSetPicard(), SNESJacobianFn, SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESSetJacobian
PETSc.LibPETSc.SNESSetJacobianDomainError — Method
SNESSetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)tells SNES that the function you provided to SNESSetJacobian() at the proposed step. For example there is a negative element transformation.
Logically Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
-seealso: , SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason()
External Links
- PETSc Manual:
SNES/SNESSetJacobianDomainError
PETSc.LibPETSc.SNESSetKSP — Method
SNESSetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP)Sets a KSP context for the SNES object to use
Not Collective, but the SNES and KSP objects must live on the same MPI_Comm
Input Parameters:
snes- theSNEScontextksp- theKSPcontext
Level: developer
-seealso: , SNES, KSP, KSPGetPC(), SNESCreate(), KSPCreate()
External Links
- PETSc Manual:
SNES/SNESSetKSP
PETSc.LibPETSc.SNESSetLagJacobian — Method
SNESSetLagJacobian(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt)Set when the Jacobian is rebuilt in the nonlinear solve. See SNESSetLagPreconditioner() for determining how often the preconditioner is rebuilt.
Logically Collective
Input Parameters:
snes- theSNEScontextlag- -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time
the Jacobian is built etc. -2 means rebuild at next chance but then never again
Options Database Keys:
-snes_lag_jacobian_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_jacobian <-2,1,2,...>- sets the lag-snes_lag_preconditioner_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_preconditioner <-2,1,2,...>- sets the lag.
Level: intermediate
-seealso: , SNES, SNESGetLagPreconditioner(), SNESSetLagPreconditioner(), SNESGetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESSetLagJacobian
PETSc.LibPETSc.SNESSetLagJacobianPersists — Method
SNESSetLagJacobianPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Set whether or not the Jacobian lagging persists through multiple nonlinear solves
Logically collective
Input Parameters:
snes- theSNEScontextflg- jacobian lagging persists if true
Options Database Keys:
-snes_lag_jacobian_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_jacobian <-2,1,2,...>- sets the lag-snes_lag_preconditioner_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_preconditioner <-2,1,2,...>- sets the lag
Level: advanced
-seealso: , SNES, SNESSetLagPreconditionerPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESSetLagJacobianPersists
PETSc.LibPETSc.SNESSetLagPreconditioner — Method
SNESSetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt)Sets when the preconditioner is rebuilt in the nonlinear solve SNESSolve().
Logically Collective
Input Parameters:
snes- theSNEScontextlag- 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time
the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that
Options Database Keys:
-snes_lag_jacobian_persists <true,false>- sets the persistence through multipleSNESSolve()-snes_lag_jacobian <-2,1,2,...>- sets the lag-snes_lag_preconditioner_persists <true,false>- sets the persistence through multipleSNESSolve()-snes_lag_preconditioner <-2,1,2,...>- sets the lag
Level: intermediate
-seealso: , SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetLagPreconditionerPersists(), SNESSetLagJacobianPersists(), SNES, SNESSolve()
External Links
- PETSc Manual:
SNES/SNESSetLagPreconditioner
PETSc.LibPETSc.SNESSetLagPreconditionerPersists — Method
SNESSetLagPreconditionerPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)Set whether or not the preconditioner lagging persists through multiple nonlinear solves
Logically Collective
Input Parameters:
snes- theSNEScontextflg- preconditioner lagging persists if true
Options Database Keys:
-snes_lag_jacobian_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_jacobian <-2,1,2,...>- sets the lag-snes_lag_preconditioner_persists <true,false>- sets the persistence through multiple SNES solves-snes_lag_preconditioner <-2,1,2,...>- sets the lag
Level: developer
-seealso: , SNES, SNESSetLagJacobianPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC(), SNESSetLagPreconditioner()
External Links
- PETSc Manual:
SNES/SNESSetLagPreconditionerPersists
PETSc.LibPETSc.SNESSetLineSearch — Method
SNESSetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch)Sets the SNESLineSearch to be used for a given SNES
Collective
Input Parameters:
snes- iterative context obtained fromSNESCreate()linesearch- the linesearch object
Level: developer
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch()
External Links
- PETSc Manual:
SNES/SNESSetLineSearch
PETSc.LibPETSc.SNESSetMaxLinearSolveFailures — Method
SNESSetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt)the number of failed linear solve attempts allowed before SNES returns with a diverged reason of SNES_DIVERGED_LINEAR_SOLVE
Logically Collective
Input Parameters:
snes-SNEScontextmaxFails- maximum allowed linear solve failures, usePETSC_UNLIMITEDto have no limit on the number of failures
Options Database Key:
-snes_max_linear_solve_fail <num>- The number of failures before the solve is terminated
Level: intermediate
-seealso: , SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations()
External Links
- PETSc Manual:
SNES/SNESSetMaxLinearSolveFailures
PETSc.LibPETSc.SNESSetMaxNonlinearStepFailures — Method
SNESSetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt)Sets the maximum number of unsuccessful steps attempted by the nonlinear solver before it gives up and returns unconverged or generates an error
Not Collective
Input Parameters:
snes-SNEScontextmaxFails- maximum of unsuccessful steps allowed, usePETSC_UNLIMITEDto have no limit on the number of failures
Options Database Key:
-snes_max_fail <n>- maximum number of unsuccessful steps allowed
Level: intermediate
-seealso: , SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESGetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures()
External Links
- PETSc Manual:
SNES/SNESSetMaxNonlinearStepFailures
PETSc.LibPETSc.SNESSetNGS — Method
SNESSetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid)Sets the user nonlinear Gauss use with composed nonlinear solvers.
Input Parameters:
snes- theSNEScontext, usually of theSNESTypeSNESNGSf- function evaluation routine to apply Gauss-Seidel, seeSNESNGSFnfor calling sequencectx- [optional] user-defined context for private data for the smoother evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNESNGS, SNESGetNGS(), SNESNCG, SNESGetFunction(), SNESComputeNGS(), SNESNGSFn
External Links
- PETSc Manual:
SNES/SNESSetNGS
PETSc.LibPETSc.SNESSetNPC — Method
SNESSetNPC(petsclib::PetscLibType,snes::PetscSNES, npc::PetscSNES)Sets the nonlinear preconditioner to be used.
Collective
Input Parameters:
snes- iterative context obtained fromSNESCreate()npc- theSNESnonlinear preconditioner object
Options Database Key:
-npc_snes_type <type>- set the type of theSNESto use as the nonlinear preconditioner
Level: developer
-seealso: , SNES, SNESNGS, SNESFAS, SNESGetNPC(), SNESHasNPC()
External Links
- PETSc Manual:
SNES/SNESSetNPC
PETSc.LibPETSc.SNESSetNPCSide — Method
SNESSetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide)Sets the nonlinear preconditioning side used by the nonlinear preconditioner inside SNES.
Logically Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
side- the preconditioning side, where side is one of
-seealso: , SNES, SNESGetNPC(), SNESNRICHARDSON, SNESNCG, SNESType, SNESGetNPCSide(), KSPSetPCSide(), PC_LEFT, PC_RIGHT, PCSide
External Links
- PETSc Manual:
SNES/SNESSetNPCSide
PETSc.LibPETSc.SNESSetNormSchedule — Method
SNESSetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule)Sets the SNESNormSchedule used in convergence and monitoring of the SNES method, when norms are computed in the solving process
Logically Collective
Input Parameters:
snes- theSNEScontextnormschedule- the frequency of norm computation
Options Database Key:
-snes_norm_schedule <none, always, initialonly, finalonly, initialfinalonly>- set the schedule
Level: advanced
-seealso: , SNESNormSchedule, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction()
External Links
- PETSc Manual:
SNES/SNESSetNormSchedule
PETSc.LibPETSc.SNESSetObjective — Method
SNESSetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid)Sets the objective function minimized by some of the SNES linesearch methods, used instead of the 2
Logically Collective
Input Parameters:
snes- theSNEScontextobj- objective evaluation routine; seeSNESObjectiveFnfor the calling sequencectx- [optional] user-defined context for private data for the objective evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESLineSearch(), SNESGetObjective(), SNESComputeObjective(), SNESSetFunction(), SNESSetJacobian(), SNESObjectiveFn
External Links
- PETSc Manual:
SNES/SNESSetObjective
PETSc.LibPETSc.SNESSetOptionsPrefix — Method
SNESSetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)Sets the prefix used for searching for all SNES options in the database.
Logically Collective
Input Parameters:
snes- theSNEScontextprefix- the prefix to prepend to all option names
Level: advanced
-seealso: , SNES, SNESSetFromOptions(), SNESAppendOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESSetOptionsPrefix
PETSc.LibPETSc.SNESSetPicard — Method
SNESSetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, bp::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)Use SNES to solve the system A(x) x = bp(x) + b via a Picard type iteration (Picard linearization)
Logically Collective
Input Parameters:
snes- theSNEScontextr- vector to store function values, may beNULLbp- function evaluation routine, may beNULL, for the calling sequence seeSNESFunctionFnAmat- matrix with which A(x) x - bp(x) - b is to be computedPmat- matrix from which preconditioner is computed (usually the same asAmat)J- function to compute matrix values, for the calling sequence seeSNESJacobianFnctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
-seealso: , SNES, SNESGetFunction(), SNESSetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESGetPicard(), SNESLineSearchPreCheckPicard(), SNESFunctionFn, SNESJacobianFn
External Links
- PETSc Manual:
SNES/SNESSetPicard
PETSc.LibPETSc.SNESSetSolution — Method
SNESSetSolution(petsclib::PetscLibType,snes::PetscSNES, u::PetscVec)Sets the solution vector for use by the SNES routines.
Logically Collective
Input Parameters:
snes- theSNEScontext obtained fromSNESCreate()u- the solution vector
Level: beginner
-seealso: , SNES, SNESSolve(), SNESGetSolution(), Vec
External Links
- PETSc Manual:
SNES/SNESSetSolution
PETSc.LibPETSc.SNESSetTolerances — Method
SNESSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt, maxf::PetscInt)Sets various parameters used in SNES convergence tests.
Logically Collective
Input Parameters:
snes- theSNEScontextabstol- the absolute convergence tolerance, F(x^n) ≤ abstolrtol- the relative convergence tolerance, F(x^n) ≤ reltol * F(x^0)stol- convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||maxit- the maximum number of iterations allowed in the solver, default 50.maxf- the maximum number of function evaluations allowed in the solver (usePETSC_UNLIMITEDindicates no limit), default 10,000
Options Database Keys:
-snes_atol <abstol>- Setsabstol-snes_rtol <rtol>- Setsrtol-snes_stol <stol>- Setsstol-snes_max_it <maxit>- Setsmaxit-snes_max_funcs <maxf>- Setsmaxf(useunlimitedto have no maximum)
Level: intermediate
-seealso: , SNESSolve(), SNES, SNESSetDivergenceTolerance(), SNESSetForceIteration()
External Links
- PETSc Manual:
SNES/SNESSetTolerances
PETSc.LibPETSc.SNESSetType — Method
SNESSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESType)Sets the algorithm/method to be used to solve the nonlinear system with the given SNES
Collective
Input Parameters:
snes- theSNEScontexttype- a known method
Options Database Key:
-snes_type <type>- Sets the method; use -help for a list
of available methods (for instance, newtonls or newtontr)
Level: intermediate
-seealso: , SNES, SNESSolve(), SNESType, SNESCreate(), SNESDestroy(), SNESGetType(), SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESSetType
PETSc.LibPETSc.SNESSetUp — Method
SNESSetUp(petsclib::PetscLibType,snes::PetscSNES)Sets up the internal data structures for the later use of a nonlinear solver SNESSolve().
Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
-seealso: , SNES, SNESCreate(), SNESSolve(), SNESDestroy(), SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESSetUp
PETSc.LibPETSc.SNESSetUpMatrices — Method
SNESSetUpMatrices(petsclib::PetscLibType,snes::PetscSNES)ensures that matrices are available for SNES Newton
Collective
Input Parameter:
snes-SNESobject to configure
Level: developer
External Links
- PETSc Manual:
SNES/SNESSetUpMatrices
PETSc.LibPETSc.SNESSetUpdate — Method
SNESSetUpdate(petsclib::PetscLibType,snes::PetscSNES, func::SNESUpdateFn)Sets the general at the beginning of every iteration of the nonlinear solve. Specifically it is called just before the Jacobian is "evaluated" and after the function evaluation.
Logically Collective
Input Parameters:
snes- The nonlinear solver contextfunc- The update function; for calling sequence seeSNESUpdateFn
Level: advanced
-seealso: , SNES, SNESSolve(), SNESSetJacobian(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESSetUpdate
PETSc.LibPETSc.SNESSetUseMatrixFree — Method
SNESSetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES, mf_operator::PetscBool, mf::PetscBool)indicates that SNES should use matrix
Logically Collective
Input Parameters:
snes-SNEScontextmf_operator- use matrix-free only for the Amat used bySNESSetJacobian(), this means the user provided Pmat will continue to be usedmf- use matrix-free for both the Amat and Pmat used bySNESSetJacobian(), both the Amat and Pmat set inSNESSetJacobian()will be ignored. With
this option no matrix-element based preconditioners can be used in the linear solve since the matrix won't be explicitly available
Options Database Keys:
-snes_mf_operator- use matrix-free only for the mat operator-snes_mf- use matrix-free for both the mat and pmat operator-snes_fd_color- compute the Jacobian via coloring and finite differences.-snes_fd- compute the Jacobian via finite differences (slow)
Level: intermediate
-seealso: , SNES, SNESGetUseMatrixFree(), MatCreateSNESMF(), SNESComputeJacobianDefaultColor(), MatFDColoring
External Links
- PETSc Manual:
SNES/SNESSetUseMatrixFree
PETSc.LibPETSc.SNESSetWorkVecs — Method
SNESSetWorkVecs(petsclib::PetscLibType,snes::PetscSNES, nw::PetscInt)Allocates a number of work vectors to be used internally by the SNES solver
Input Parameters:
snes- theSNEScontextnw- number of work vectors to allocate
Level: developer
External Links
- PETSc Manual:
SNES/SNESSetWorkVecs
PETSc.LibPETSc.SNESShellGetContext — Method
SNESShellGetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)Returns the user
Not Collective
Input Parameter:
snes- should have been created withSNESSetType(snes,SNESSHELL);
Output Parameter:
ctx- the user provided context
Level: advanced
-seealso: , SNES, SNESSHELL, SNESCreateShell(), SNESShellSetContext()
External Links
- PETSc Manual:
SNES/SNESShellGetContext
PETSc.LibPETSc.SNESShellSetContext — Method
SNESShellSetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)sets the context for a SNESSHELL
Logically Collective
Input Parameters:
snes- theSNESSHELLctx- the context
Level: advanced
-seealso: , SNES, SNESSHELL, SNESCreateShell(), SNESShellGetContext()
External Links
- PETSc Manual:
SNES/SNESShellSetContext
PETSc.LibPETSc.SNESShellSetSolve — Method
SNESShellSetSolve(petsclib::PetscLibType,snes::PetscSNES, solve::external)Sets routine to apply as solver to a SNESSHELL SNES object
Logically Collective
Input Parameters:
snes- theSNESnonlinear solver contextsolve- the application-provided solver routine
Calling sequence of apply:
snes- the preconditioner, get the application context withSNESShellGetContext()provided withSNESShellSetContext()xout- solution vector
Level: advanced
-seealso: , SNES, SNESSHELL, SNESShellSetContext(), SNESShellGetContext()
External Links
- PETSc Manual:
SNES/SNESShellSetSolve
PETSc.LibPETSc.SNESSolve — Method
SNESSolve(petsclib::PetscLibType,snes::PetscSNES, b::Union{PetscVec,Ptr}, x::PetscVec)Solves a nonlinear system F(x) = b associated with a SNES object
Collective
Input Parameters:
snes- theSNEScontextb- the constant part of the equation F(x) = b, orNULLto use zero.x- the solution vector.
Level: beginner
-seealso: , SNES, SNESCreate(), SNESDestroy(), SNESSetFunction(), SNESSetJacobian(), SNESSetGridSequence(), SNESGetSolution(), SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESSolve
PETSc.LibPETSc.SNESTSFormFunction — Method
SNESTSFormFunction(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, F::PetscVec, ctx::Cvoid)Function to evaluate nonlinear residual defined by an ODE solver algorithm implemented within TS
Logically Collective
Input Parameters:
snes- nonlinear solverU- the current state at which to evaluate the residualctx- user context, must be aTS
Output Parameter:
F- the nonlinear residual
Level: developer
-seealso: , SNESSetFunction(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
Ts/SNESTSFormFunction
PETSc.LibPETSc.SNESTSFormJacobian — Method
SNESTSFormJacobian(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, A::PetscMat, B::PetscMat, ctx::Cvoid)Function to evaluate the Jacobian defined by an ODE solver algorithm implemented within TS
Collective
Input Parameters:
snes- nonlinear solverU- the current state at which to evaluate the residualctx- user context, must be aTS
Output Parameters:
A- the JacobianB- the matrix used to construct the preconditioner (often the same asA)
Level: developer
External Links
- PETSc Manual:
Ts/SNESTSFormJacobian
PETSc.LibPETSc.SNESTestFunction — Method
SNESTestFunction(petsclib::PetscLibType,snes::PetscSNES)Computes the difference between the computed and finite
Collective
Input Parameter:
snes- theSNEScontext
Options Database Keys:
-snes_test_function- compare the user provided function with one compute via finite differences to check for errors.-snes_test_function_view- display the user provided function, the finite difference function and the difference
Level: developer
-seealso: , SNESTestJacobian(), SNESSetFunction(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESTestFunction
PETSc.LibPETSc.SNESTestJacobian — Method
Jnorm::PetscReal,diffNorm::PetscReal = SNESTestJacobian(petsclib::PetscLibType,snes::PetscSNES)Computes the difference between the computed and finite
Collective
Input Parameter:
snes- theSNEScontext
Output Parameters:
Jnorm- the Frobenius norm of the computed Jacobian, orNULLdiffNorm- the Frobenius norm of the difference of the computed and finite-difference Jacobians, orNULL
Options Database Keys:
-snes_test_jacobian <optional threshold>- compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.-snes_test_jacobian_view- display the user provided Jacobian, the finite difference Jacobian and the difference
Level: developer
-seealso: , SNESTestFunction(), SNESSetJacobian(), SNESComputeJacobian()
External Links
- PETSc Manual:
SNES/SNESTestJacobian
PETSc.LibPETSc.SNESTestLocalMin — Method
SNESTestLocalMin(petsclib::PetscLibType,snes::PetscSNES)External Links
- PETSc Manual:
SNES/SNESTestLocalMin
PETSc.LibPETSc.SNESVIComputeFunction — Method
SNESVIComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, phi::PetscVec, functx::Cvoid)Provides the function that reformulates a system of nonlinear equations in mixed complementarity form to a system of nonlinear equations in semismooth form.
Input Parameters:
snes- theSNEScontextX- current iteratefunctx- user defined function context
Output Parameter:
phi- the evaluation of semismooth function atX
Level: developer
-seealso: , SNES, SNESVINEWTONSSLS, SNESVIComputeMeritFunction()
External Links
- PETSc Manual:
SNES/SNESVIComputeFunction
PETSc.LibPETSc.SNESVIComputeInactiveSetFnorm — Method
fnorm::PetscReal = SNESVIComputeInactiveSetFnorm(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec)Computes the function norm for variational inequalities on the inactive set
Input Parameters:
snes- theSNEScontextF- the nonlinear function vectorX- theSNESsolution vector
Output Parameter:
fnorm- the function norm
Level: developer
-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESLineSearchSetVIFunctions()
External Links
- PETSc Manual:
SNES/SNESVIComputeInactiveSetFnorm
PETSc.LibPETSc.SNESVIComputeInactiveSetFtY — Method
fty::PetscScalar = SNESVIComputeInactiveSetFtY(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec, Y::PetscVec)Computes the directional derivative for variational inequalities on the inactive set, assuming that there exists some G(x) for which the SNESFunctionFn F(x) = grad G(x) (relevant for some line search algorithms)
Input Parameters:
snes- theSNEScontextF- the nonlinear function vectorX- theSNESsolution vectorY- the direction vector
Output Parameter:
fty- the directional derivative
Level: developer
-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS
External Links
- PETSc Manual:
SNES/SNESVIComputeInactiveSetFtY
PETSc.LibPETSc.SNESVIComputeMeritFunction — Method
merit::PetscReal,phinorm::PetscReal = SNESVIComputeMeritFunction(petsclib::PetscLibType,phi::PetscVec)Evaluates the merit function for the mixed complementarity problem.
Input Parameter:
phi- theVecholding the evaluation of the semismooth function
Output Parameters:
merit- the merit function 1/2 ||phi||^2phinorm- the two-norm of the vector, ||phi||
Level: developer
-seealso: , SNES, SNESVINEWTONSSLS, SNESVIComputeFunction()
External Links
- PETSc Manual:
SNES/SNESVIComputeMeritFunction
PETSc.LibPETSc.SNESVIGetActiveSetIS — Method
SNESVIGetActiveSetIS(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ISact::IS)Gets the global indices for the active set variables
Input Parameters:
snes- theSNEScontextX- thesnessolution vectorF- the nonlinear function vector
Output Parameter:
ISact- active set index set
Level: developer
-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS
External Links
- PETSc Manual:
SNES/SNESVIGetActiveSetIS
PETSc.LibPETSc.SNESVIGetInactiveSet — Method
SNESVIGetInactiveSet(petsclib::PetscLibType,snes::PetscSNES, inact::IS)Gets the global indices for the inactive set variables (these correspond to the degrees of freedom the linear system is solved on)
Input Parameter:
snes- theSNEScontext
Output Parameter:
inact- inactive set index set
Level: advanced
-seealso: , SNES, SNESVINEWTONRSLS
External Links
- PETSc Manual:
SNES/SNESVIGetInactiveSet
PETSc.LibPETSc.SNESVIGetVariableBounds — Method
SNESVIGetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec)Gets the lower and upper bounds for the solution vector. xl <= x <= xu. These are used in solving (differential) variable inequalities.
Input Parameters:
snes- theSNEScontext.xl- lower bound (may beNULL)xu- upper bound (may beNULL)
Level: advanced
-seealso: , SNES, SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY
External Links
- PETSc Manual:
SNES/SNESVIGetVariableBounds
PETSc.LibPETSc.SNESVISetComputeVariableBounds — Method
SNESVISetComputeVariableBounds(petsclib::PetscLibType,snes::PetscSNES, compute::external)Sets a function that is called to compute the bounds on variable for (differential) variable inequalities.
Input Parameters:
snes- theSNEScontextcompute- function that computes the bounds
Calling sequence of compute:
snes- theSNEScontextlower- vector to hold lower boundshigher- vector to hold upper bounds
Level: advanced
-seealso: , SNES, SNESVISetVariableBounds(), DMSetVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY
External Links
- PETSc Manual:
SNES/SNESVISetComputeVariableBounds
PETSc.LibPETSc.SNESVISetRedundancyCheck — Method
SNESVISetRedundancyCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)Provide a function to check for any redundancy in the VI active set
Logically Collective
Input Parameters:
snes- theSNESVINEWTONRSLScontextfunc- the function to check of redundanciesctx- optional context used by the function
Level: advanced
-seealso: , SNES, SNESVINEWTONRSLS, SNESVIGetInactiveSet(), DMSetVI()
External Links
- PETSc Manual:
SNES/SNESVISetRedundancyCheck
PETSc.LibPETSc.SNESVISetVariableBounds — Method
SNESVISetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec)Sets the lower and upper bounds for the solution vector. xl <= x <= xu. This allows solving (differential) variable inequalities.
Input Parameters:
snes- theSNEScontext.xl- lower bound.xu- upper bound.
Level: advanced
-seealso: , SNES, SNESVIGetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY
External Links
- PETSc Manual:
SNES/SNESVISetVariableBounds
PETSc.LibPETSc.SNESView — Method
SNESView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)Prints or visualizes the SNES data structure.
Collective
Input Parameters:
snes- theSNEScontextviewer- thePetscViewer
Options Database Key:
-snes_view- CallsSNESView()at end ofSNESSolve()
Level: beginner
-seealso: , SNES, SNESLoad(), SNESCreate(), PetscViewerASCIIOpen()
External Links
- PETSc Manual:
SNES/SNESView
PETSc.LibPETSc.SNESViewFromOptions — Method
SNESViewFromOptions(petsclib::PetscLibType,A::PetscSNES, obj::PetscObject, name::String)View a SNES based on values in the options database
Collective
Input Parameters:
A- theSNEScontextobj- Optional object that provides the options prefix for the checksname- command line option
Level: intermediate
-seealso: , SNES, SNESView, PetscObjectViewFromOptions(), SNESCreate()
External Links
- PETSc Manual:
SNES/SNESViewFromOptions
PETSc.LibPETSc.SNESLineSearchAppendOptionsPrefix — Method
SNESLineSearchAppendOptionsPrefix(petsclib::PetscLibType,linesearch::SNESLineSearch, prefix::String)Appends to the prefix used for searching for all SNESLineSearch options in the database.
Logically Collective
Input Parameters:
linesearch- theSNESLineSearchcontextprefix- the prefix to prepend to all option names
Level: advanced
-seealso: , SNES, SNESLineSearch(), SNESLineSearchSetFromOptions(), SNESGetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESLineSearchAppendOptionsPrefix
PETSc.LibPETSc.SNESLineSearchApply — Method
fnorm::PetscReal = SNESLineSearchApply(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec)Computes the line
Collective
Input Parameter:
linesearch- The line search context
Input/Output Parameters:
X- The current solution, on output the new solutionF- The current function value, on output the new function value at the solution valueXfnorm- The current norm ofF, on output the new norm ofFY- The current search direction, on output the direction determined by the linesearch, i.e.Xnew = Xold - lambda*Y
Options Database Keys:
-snes_linesearch_type- basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell-snes_linesearch_monitor [:filename]- Print progress of line searches-snes_linesearch_damping- The linesearch damping parameter, default is 1.0 (no damping)-snes_linesearch_norms- Turn on/off the linesearch norms computation (SNESLineSearchSetComputeNorms())-snes_linesearch_keeplambda- Keep the previouslambdaas the initial guess-snes_linesearch_max_it- The number of iterations for iterative line searches
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchGetLambda(), SNESLineSearchPreCheck(), SNESLineSearchPostCheck(), SNESSolve(), SNESComputeFunction(), SNESLineSearchSetComputeNorms(), SNESLineSearchType, SNESLineSearchSetType()
External Links
- PETSc Manual:
SNES/SNESLineSearchApply
PETSc.LibPETSc.SNESLineSearchBTGetAlpha — Method
alpha::PetscReal = SNESLineSearchBTGetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the descent parameter, alpha, in the SNESLINESEARCHBT variant that was set with SNESLineSearchBTSetAlpha()
Input Parameter:
linesearch- linesearch context
Output Parameter:
alpha- The descent parameter
Level: intermediate
-seealso: , SNESLineSearch, SNESLineSearchGetLambda(), SNESLineSearchGetTolerances(), SNESLINESEARCHBT, SNESLineSearchBTSetAlpha()
External Links
- PETSc Manual:
SNES/SNESLineSearchBTGetAlpha
PETSc.LibPETSc.SNESLineSearchBTSetAlpha — Method
SNESLineSearchBTSetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch, alpha::PetscReal)Sets the descent parameter, alpha, in the SNESLINESEARCHBT SNESLineSearch variant.
Input Parameters:
linesearch- linesearch contextalpha- The descent parameter
Level: intermediate
-seealso: , SNESLineSearch, SNESLineSearchSetLambda(), SNESLineSearchGetTolerances(), SNESLINESEARCHBT, SNESLineSearchBTGetAlpha()
External Links
- PETSc Manual:
SNES/SNESLineSearchBTSetAlpha
PETSc.LibPETSc.SNESLineSearchComputeNorms — Method
SNESLineSearchComputeNorms(petsclib::PetscLibType,linesearch::SNESLineSearch)Explicitly computes the norms of the current solution X, the current update Y, and the current function value F.
Input Parameter:
linesearch- the line search context
Options Database Key:
-snes_linesearch_norms- turn norm computation on or off
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms, SNESLineSearchSetNorms(), SNESLineSearchSetComputeNorms()
External Links
- PETSc Manual:
SNES/SNESLineSearchComputeNorms
PETSc.LibPETSc.SNESLineSearchCreate — Method
outlinesearch::SNESLineSearch = SNESLineSearchCreate(petsclib::PetscLibType,comm::MPI_Comm)Creates a SNESLineSearch context.
Logically Collective
Input Parameter:
comm- MPI communicator for the line search (typically from the associatedSNEScontext).
Output Parameter:
outlinesearch- the new line search context
Level: developer
-seealso: , SNES, SNESLineSearch, LineSearchDestroy(), SNESGetLineSearch()
External Links
- PETSc Manual:
SNES/SNESLineSearchCreate
PETSc.LibPETSc.SNESLineSearchDestroy — Method
SNESLineSearchDestroy(petsclib::PetscLibType,linesearch::SNESLineSearch)Destroys the line search instance.
Collective
Input Parameter:
linesearch- The line search context
Level: developer
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchReset(), SNESDestroy()
External Links
- PETSc Manual:
SNES/SNESLineSearchDestroy
PETSc.LibPETSc.SNESLineSearchGetDamping — Method
damping::PetscReal = SNESLineSearchGetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the line search damping parameter.
Input Parameter:
linesearch- the line search context
Output Parameter:
damping- The damping parameter
Level: advanced
-seealso: , SNES, SNESLineSearchGetStepTolerance(), SNESQN
External Links
- PETSc Manual:
SNES/SNESLineSearchGetDamping
PETSc.LibPETSc.SNESLineSearchGetDefaultMonitor — Method
SNESLineSearchGetDefaultMonitor(petsclib::PetscLibType,linesearch::SNESLineSearch, monitor::PetscViewer)Gets the PetscViewer instance for the default line search monitor that is turned on with SNESLineSearchSetDefaultMonitor()
Logically Collective
Input Parameter:
linesearch- the line search context
Output Parameter:
monitor- monitor context
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchSetDefaultMonitor(), PetscViewer
External Links
- PETSc Manual:
SNES/SNESLineSearchGetDefaultMonitor
PETSc.LibPETSc.SNESLineSearchGetLambda — Method
lambda::PetscReal = SNESLineSearchGetLambda(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the last line search lambda used
Not Collective
Input Parameter:
linesearch- the line search context
Output Parameter:
lambda- The lastlambda(scaling of the solution update) computed duringSNESLineSearchApply()
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetLambda(), SNESLineSearchGetDamping(), SNESLineSearchApply()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetLambda
PETSc.LibPETSc.SNESLineSearchGetNorms — Method
xnorm::PetscReal,fnorm::PetscReal,ynorm::PetscReal = SNESLineSearchGetNorms(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the norms for the current solution X, the current update Y, and the current function value F.
Not Collective
Input Parameter:
linesearch- the line search context
Output Parameters:
xnorm- The norm of the current solutionfnorm- The norm of the current function, this is thenorm(function(X))whereXis the current solution.ynorm- The norm of the current update (after scaling by the linesearch computedlambda)
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetNorms(), SNESLineSearchGetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetNorms
PETSc.LibPETSc.SNESLineSearchGetOptionsPrefix — Method
SNESLineSearchGetOptionsPrefix(petsclib::PetscLibType,linesearch::SNESLineSearch, prefix::String)Gets the prefix used for searching for all SNESLineSearch options in the database.
Not Collective
Input Parameter:
linesearch- theSNESLineSearchcontext
Output Parameter:
prefix- pointer to the prefix string used
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESAppendOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetOptionsPrefix
PETSc.LibPETSc.SNESLineSearchGetOrder — Method
order::PetscInt = SNESLineSearchGetOrder(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the line search approximation order.
Input Parameter:
linesearch- the line search context
Output Parameter:
order- The order
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetOrder()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetOrder
PETSc.LibPETSc.SNESLineSearchGetReason — Method
SNESLineSearchGetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason)Gets the success/failure status of the last line search application
Input Parameter:
linesearch- the line search context
Output Parameter:
result- The success or failure status
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetReason(), SNESLineSearchReason
External Links
- PETSc Manual:
SNES/SNESLineSearchGetReason
PETSc.LibPETSc.SNESLineSearchGetSNES — Method
SNESLineSearchGetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES)Gets the SNES instance associated with the line search.
Not Collective
Input Parameter:
linesearch- the line search context
Output Parameter:
snes- TheSNESinstance
Level: developer
-seealso: , SNES, SNESLineSearch, SNESType, SNESLineSearchSetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetSNES
PETSc.LibPETSc.SNESLineSearchGetTolerances — Method
minlambda::PetscReal,maxlambda::PetscReal,rtol::PetscReal,atol::PetscReal,ltol::PetscReal,max_it::PetscInt = SNESLineSearchGetTolerances(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the tolerances for the line search.
Not Collective
Input Parameter:
linesearch- the line search context
Output Parameters:
minlambda- The minimumlambdaallowedmaxlambda- The maximumlambdaallowedrtol- The relative tolerance for iterative line searchesatol- The absolute tolerance for iterative line searchesltol- The change inlambdatolerance for iterative line searchesmax_it- The maximum number of iterations of the line search
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetTolerances()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetTolerances
PETSc.LibPETSc.SNESLineSearchGetType — Method
type::SNESLineSearchType = SNESLineSearchGetType(petsclib::PetscLibType,linesearch::SNESLineSearch)Gets the SNESLinesearchType of a SNESLineSearch
Logically Collective
Input Parameter:
linesearch- the line search context
Output Parameter:
type- The type of line search, orNULLif not set
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchCreate(), SNESLineSearchSetFromOptions(), SNESLineSearchSetType()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetType
PETSc.LibPETSc.SNESLineSearchGetVIFunctions — Method
SNESLineSearchGetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn)Sets VI
Not Collective
Input Parameter:
linesearch- the line search context, obtain withSNESGetLineSearch()
Output Parameters:
projectfunc- function for projecting the function to the bounds, seeSNESLineSearchVIProjectFnfor calling sequencenormfunc- function for computing the norm of an active set, seeSNESLineSearchVINormFnfor calling sequencedirderivfunc- function for computing the directional derivative of an active set, seeSNESLineSearchVIDirDerivFnfor calling sequence
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetVIFunctions(), SNESLineSearchGetPostCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn
External Links
- PETSc Manual:
SNES/SNESLineSearchGetVIFunctions
PETSc.LibPETSc.SNESLineSearchGetVecs — Method
SNESLineSearchGetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec)Gets the vectors from the SNESLineSearch context
Not Collective but the vectors are parallel
Input Parameter:
linesearch- the line search context
Output Parameters:
X- Solution vectorF- Function vectorY- Search direction vectorW- Solution work vectorG- Function work vector
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetVecs
PETSc.LibPETSc.SNESLineSearchMonitor — Method
SNESLineSearchMonitor(petsclib::PetscLibType,ls::SNESLineSearch)runs the user provided monitor routines, if they exist
Collective
Input Parameter:
ls- the linesearch object
Level: developer
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorSet()
External Links
- PETSc Manual:
SNES/SNESLineSearchMonitor
PETSc.LibPETSc.SNESLineSearchMonitorCancel — Method
SNESLineSearchMonitorCancel(petsclib::PetscLibType,ls::SNESLineSearch)Clears all the monitor functions for a SNESLineSearch object.
Logically Collective
Input Parameter:
ls- theSNESLineSearchcontext
Options Database Key:
-snes_linesearch_monitor_cancel- cancels all monitors that have been hardwired
into a code by calls to SNESLineSearchMonitorSet(), but does not cancel those set via the options database
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorDefault(), SNESLineSearchMonitorSet()
External Links
- PETSc Manual:
SNES/SNESLineSearchMonitorCancel
PETSc.LibPETSc.SNESLineSearchMonitorSet — Method
SNESLineSearchMonitorSet(petsclib::PetscLibType,ls::SNESLineSearch, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn)Sets an ADDITIONAL function that is to be used at every iteration of the nonlinear solver to display the iteration's progress.
Logically Collective
Input Parameters:
ls- theSNESLineSearchcontextf- the monitor functionmctx- [optional] user-defined context for private data for the monitor routine (useNULLif no context is desired)monitordestroy- [optional] routine that frees monitor context (may beNULL), seePetscCtxDestroyFnfor the calling sequence
Calling sequence of f:
ls- theSNESLineSearchcontextmctx- [optional] user-defined context for private data for the monitor routine
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorDefault(), SNESLineSearchMonitorCancel(), PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESLineSearchMonitorSet
PETSc.LibPETSc.SNESLineSearchMonitorSetFromOptions — Method
SNESLineSearchMonitorSetFromOptions(petsclib::PetscLibType,ls::SNESLineSearch, name::String, help::String, manual::String, monitor::external, monitorsetup::external)Sets a monitor function and viewer appropriate for the type indicated in the options database
Collective
Input Parameters:
ls-SNESLineSearchobject to monitorname- the monitor typehelp- message indicating what monitoring is donemanual- manual page for the monitormonitor- the monitor function, must usePetscViewerAndFormatas its contextmonitorsetup- a function that is called once ONLY if the user selected this monitor that may set additional features of theSNESLineSearchorPetscViewer
Calling sequence of monitor:
ls-SNESLineSearchobject being monitoredvf- aPetscViewerAndFormatstruct that provides thePetscViewerandPetscViewerFormatbeing used
Calling sequence of monitorsetup:
ls-SNESLineSearchobject being monitoredvf- aPetscViewerAndFormatstruct that provides thePetscViewerandPetscViewerFormatbeing used
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetMonitor(), 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:
SNES/SNESLineSearchMonitorSetFromOptions
PETSc.LibPETSc.SNESLineSearchMonitorSolutionUpdate — Method
SNESLineSearchMonitorSolutionUpdate(petsclib::PetscLibType,ls::SNESLineSearch, vf::PetscViewerAndFormat)Monitors each update of the function value the linesearch tries
Collective
Input Parameters:
ls- theSNESLineSearchobjectvf- the context for the monitor, in this case it is anPetscViewerAndFormat
Options Database Key:
-snes_linesearch_monitor_solution_update [viewer:filename:format]- view each update tried by line search routine
Level: developer
This is not normally called directly but is passed to SNESLineSearchMonitorSet()
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorSet(), SNESMonitorSolution()
External Links
- PETSc Manual:
SNES/SNESLineSearchMonitorSolutionUpdate
PETSc.LibPETSc.SNESLineSearchPostCheck — Method
changed_Y::PetscBool,changed_W::PetscBool = SNESLineSearchPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, W::PetscVec)Hook to modify step direction or updated solution after a successful linesearch
Logically Collective
Input Parameters:
linesearch- The line search contextX- The last solutionY- The step directionW- The updated solution,W = X - lambda * Yfor some lambda
Output Parameters:
changed_Y- Indicator if the directionYhas been changed.changed_W- Indicator if the new candidate solutionWhas been changed.
Level: developer
-seealso: , SNES, SNESGetLineSearch(), SNESLineSearchPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchSetPrecheck(), SNESLineSearchGetPrecheck()
External Links
- PETSc Manual:
SNES/SNESLineSearchPostCheck
PETSc.LibPETSc.SNESLineSearchPreCheck — Method
changed::PetscBool = SNESLineSearchPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec)Prepares the line search for being applied.
Logically Collective
Input Parameters:
linesearch- The linesearch instance.X- The current solutionY- The step direction
Output Parameter:
changed- Indicator that the precheck routine has changedY
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESLineSearchPreCheck
PETSc.LibPETSc.SNESLineSearchPreCheckPicard — Method
changed::PetscBool = SNESLineSearchPreCheckPicard(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, ctx::Cvoid)Implements a correction that is sometimes useful to improve the convergence rate of Picard iteration {cite}hindmarsh1996time
Logically Collective
Input Parameters:
linesearch- the line search contextX- base state for this stepctx- context for this function
Input/Output Parameter:
Y- correction, possibly modified
Output Parameter:
changed- flag indicating thatYwas modified
Options Database Keys:
-snes_linesearch_precheck_picard- activate this routine-snes_linesearch_precheck_picard_angle- angle
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESSetPicard(), SNESGetLineSearch(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck()
External Links
- PETSc Manual:
SNES/SNESLineSearchPreCheckPicard
PETSc.LibPETSc.SNESLineSearchRegister — Method
SNESLineSearchRegister(petsclib::PetscLibType,sname::String, fnc::external)register a line search type SNESLineSearchType
Logically Collective, No Fortran Support
Input Parameters:
sname- name of theSNESLineSearchType()function- the creation function for that type
Calling sequence of function:
ls- the line search context
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchSetType()
External Links
- PETSc Manual:
SNES/SNESLineSearchRegister
PETSc.LibPETSc.SNESLineSearchReset — Method
SNESLineSearchReset(petsclib::PetscLibType,linesearch::SNESLineSearch)Undoes the SNESLineSearchSetUp() and deletes any Vecs or Mats allocated by the line search.
Collective
Input Parameter:
linesearch- TheSNESLineSearchinstance.
Level: developer
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchSetUp()
External Links
- PETSc Manual:
SNES/SNESLineSearchReset
PETSc.LibPETSc.SNESLineSearchSetComputeNorms — Method
SNESLineSearchSetComputeNorms(petsclib::PetscLibType,linesearch::SNESLineSearch, flg::PetscBool)Turns on or off the computation of final norms in the line search.
Input Parameters:
linesearch- the line search contextflg- indicates whether or not to compute norms
Options Database Key:
-snes_linesearch_norms <true>- Turns on/off computation of the norms for basic (none)SNESLINESEARCHBASICline search
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetNorms(), SNESLineSearchComputeNorms(), SNESLINESEARCHBASIC
External Links
- PETSc Manual:
SNES/SNESLineSearchSetComputeNorms
PETSc.LibPETSc.SNESLineSearchSetDamping — Method
SNESLineSearchSetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch, damping::PetscReal)Sets the line search damping parameter.
Input Parameters:
linesearch- the line search contextdamping- The damping parameter
Options Database Key:
-snes_linesearch_damping <damping>- the damping value
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetDamping()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetDamping
PETSc.LibPETSc.SNESLineSearchSetDefaultMonitor — Method
SNESLineSearchSetDefaultMonitor(petsclib::PetscLibType,linesearch::SNESLineSearch, viewer::PetscViewer)Turns on/off printing useful information and debugging output about the line search.
Logically Collective
Input Parameters:
linesearch- the linesearch objectviewer- anPETSCVIEWERASCIIPetscViewerorNULLto turn off monitor
Options Database Key:
-snes_linesearch_monitor [:filename]- enables the monitor
Level: intermediate
-seealso: , SNES, SNESLineSearch, PETSCVIEWERASCII, SNESGetLineSearch(), SNESLineSearchGetDefaultMonitor(), PetscViewer, SNESLineSearchSetMonitor(), SNESLineSearchMonitorSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetDefaultMonitor
PETSc.LibPETSc.SNESLineSearchSetFromOptions — Method
SNESLineSearchSetFromOptions(petsclib::PetscLibType,linesearch::SNESLineSearch)Sets options for the line search
Logically Collective
Input Parameter:
linesearch- aSNESLineSearchline search context
Options Database Keys:
-snes_linesearch_type <type>- basic (or equivalently none),bt,secant,cp,nleqerr,bisection,shell-snes_linesearch_order <order>- 1, 2, 3. Most types only support certain orders (btsupports 1, 2 or 3)-snes_linesearch_norms- Turn on/off the linesearch norms for the basic linesearch typem (SNESLineSearchSetComputeNorms())-snes_linesearch_minlambda- The minimumlambda-snes_linesearch_maxlambda- The maximumlambda-snes_linesearch_rtol- Relative tolerance for iterative line searches-snes_linesearch_atol- Absolute tolerance for iterative line searches-snes_linesearch_ltol- Change inlambdatolerance for iterative line searches-snes_linesearch_max_it- The number of iterations for iterative line searches-snes_linesearch_monitor [:filename]- Print progress of line searches-snes_linesearch_monitor_solution_update [viewer:filename:format]- view each update tried by line search routine-snes_linesearch_damping- The linesearch damping parameter-snes_linesearch_keeplambda- Keep the previouslambdaas the initial guess.-snes_linesearch_precheck_picard- Use precheck that speeds up convergence of picard method-snes_linesearch_precheck_picard_angle- Angle used in Picard precheck method
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchSetOrder(), SNESLineSearchSetType(), SNESLineSearchSetTolerances(), SNESLineSearchSetDamping(), SNESLineSearchPreCheckPicard(), SNESLineSearchType, SNESLineSearchSetComputeNorms()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetFromOptions
PETSc.LibPETSc.SNESLineSearchSetFunction — Method
SNESLineSearchSetFunction(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external)Sets the function evaluation used by the SNES line search `
Input Parameters:
linesearch- theSNESLineSearchcontextfunc- function evaluation routine, this is usually the function provided withSNESSetFunction()
Calling sequence of func:
snes- theSNESwith which theSNESLineSearchcontext is associated withx- the input vectorf- the computed value of the function
Level: developer
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESSetFunction()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetFunction
PETSc.LibPETSc.SNESLineSearchSetLambda — Method
SNESLineSearchSetLambda(petsclib::PetscLibType,linesearch::SNESLineSearch, lambda::PetscReal)Sets the line search lambda (scaling of the solution update)
Input Parameters:
linesearch- line search contextlambda- Thelambdato use
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetLambda()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetLambda
PETSc.LibPETSc.SNESLineSearchSetNorms — Method
SNESLineSearchSetNorms(petsclib::PetscLibType,linesearch::SNESLineSearch, xnorm::PetscReal, fnorm::PetscReal, ynorm::PetscReal)Sets the computed norms for the current solution X, the current update Y, and the current function value F.
Collective
Input Parameters:
linesearch- the line search contextxnorm- The norm of the current solutionfnorm- The norm of the current function, this is thenorm(function(X))whereXis the current solutionynorm- The norm of the current update (after scaling by the linesearch computedlambda)
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetNorms
PETSc.LibPETSc.SNESLineSearchSetOrder — Method
SNESLineSearchSetOrder(petsclib::PetscLibType,linesearch::SNESLineSearch, order::PetscInt)Sets the maximum order of the polynomial fit used in the line search
Input Parameters:
linesearch- the line search contextorder- The order
Level: intermediate
Values for order:
1 orSNESLINESEARCHORDER_LINEAR` - linear order2 orSNESLINESEARCHORDER_QUADRATIC` - quadratic order3 orSNESLINESEARCHORDER_CUBIC` - cubic order
Options Database Key:
-snes_linesearch_order <order>- 1, 2, 3. Most types only support certain orders (SNESLINESEARCHBTsupports 2 or 3)
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetOrder(), SNESLineSearchSetDamping()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetOrder
PETSc.LibPETSc.SNESLineSearchSetPostCheck — Method
SNESLineSearchSetPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid)Sets a user function that is called after the line search has been applied to determine the step direction and length. Allows the user a chance to change or override the decision of the line search routine
Logically Collective
Input Parameters:
linesearch- theSNESLineSearchcontextfunc- [optional] function evaluation routinectx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
ls- theSNESLineSearchcontextx- the current solutiond- the current search directionw- w = x + lambda*d for some lambdachanged_d- indicates if the search directiondhas been changedchanged_w- indicateswhas been changedctx- the context passed toSNESLineSearchSetPreCheck()
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchGetPostCheck(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetPostCheck
PETSc.LibPETSc.SNESLineSearchSetPreCheck — Method
SNESLineSearchSetPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid)Sets a function that is called after the initial search direction has been computed but before the line search routine has been applied. Allows adjusting the result of (usually a linear solve) that determined the search direction.
Logically Collective
Input Parameters:
linesearch- theSNESLineSearchcontextfunc- [optional] function evaluation routinectx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
ls- theSNESLineSearchcontextx- the current solutiond- the current search directionchanged_d- indicates if the search direction has been changedctx- the context passed toSNESLineSearchSetPreCheck()
Level: intermediate
-seealso: , SNES, SNESGetLineSearch(), SNESLineSearchPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchGetPreCheck(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetPreCheck
PETSc.LibPETSc.SNESLineSearchSetReason — Method
SNESLineSearchSetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason)Sets the success/failure status of the line search application
Logically Collective; No Fortran Support
Input Parameters:
linesearch- the line search contextresult- The success or failure status
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchReason, SNESLineSearchGetSResult()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetReason
PETSc.LibPETSc.SNESLineSearchSetSNES — Method
SNESLineSearchSetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES)Sets the SNES for the linesearch for function evaluation.
Input Parameters:
linesearch- the line search contextsnes- TheSNESinstance
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetSNES(), SNESLineSearchSetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetSNES
PETSc.LibPETSc.SNESLineSearchSetTolerances — Method
SNESLineSearchSetTolerances(petsclib::PetscLibType,linesearch::SNESLineSearch, minlambda::PetscReal, maxlambda::PetscReal, rtol::PetscReal, atol::PetscReal, ltol::PetscReal, max_it::PetscInt)Sets the tolerances for the linesearch.
Collective
Input Parameters:
linesearch- the line search contextminlambda- The minimumlambdaallowedmaxlambda- The maximumlambdaallowedrtol- The relative tolerance for iterative line searchesatol- The absolute tolerance for iterative line searchesltol- The change inlambdatolerance for iterative line searchesmax_it- The maximum number of iterations of the line search
Options Database Keys:
-snes_linesearch_minlambda- The minimumlambdaallowed-snes_linesearch_maxlambda- The maximumlambdaallowed-snes_linesearch_rtol- Relative tolerance for iterative line searches-snes_linesearch_atol- Absolute tolerance for iterative line searches-snes_linesearch_ltol- Change inlambdatolerance for iterative line searches-snes_linesearch_max_it- The number of iterations for iterative line searches
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetTolerances()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetTolerances
PETSc.LibPETSc.SNESLineSearchSetType — Method
SNESLineSearchSetType(petsclib::PetscLibType,linesearch::SNESLineSearch, type::SNESLineSearchType)Sets the SNESLinesearchType of a SNESLineSearch object to indicate the line search algorithm that should be used by a given SNES solver
Logically Collective
Input Parameters:
linesearch- the line search contexttype- The type of line search to be used, seeSNESLineSearchType
Options Database Key:
-snes_linesearch_type <type>- basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell
Level: intermediate
-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchCreate(), SNESLineSearchSetFromOptions(), SNESLineSearchGetType(), SNESGetLineSearch()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetType
PETSc.LibPETSc.SNESLineSearchSetUp — Method
SNESLineSearchSetUp(petsclib::PetscLibType,linesearch::SNESLineSearch)Prepares the line search for being applied by allocating any required vectors.
Collective
Input Parameter:
linesearch- TheSNESLineSearchinstance.
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchReset()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetUp
PETSc.LibPETSc.SNESLineSearchSetVIFunctions — Method
SNESLineSearchSetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn)Sets VI
Logically Collective
Input Parameters:
linesearch- the linesearch objectprojectfunc- function for projecting the function to the bounds, seeSNESLineSearchVIProjectFnfor calling sequencenormfunc- function for computing the norm of an active set, seeSNESLineSearchVINormFnfor calling sequencedirderivfunc- function for computing the directional derivative of an active set, seeSNESLineSearchVIDirDerivFnfor calling sequence
Level: advanced
-seealso: , SNES, SNESLineSearch, SNESLineSearchGetVIFunctions(), SNESLineSearchSetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn, SNESLineSearchVIDirDerivFn
External Links
- PETSc Manual:
SNES/SNESLineSearchSetVIFunctions
PETSc.LibPETSc.SNESLineSearchSetVecs — Method
SNESLineSearchSetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec)Sets the vectors on the SNESLineSearch context
Logically Collective
Input Parameters:
linesearch- the line search contextX- Solution vectorF- Function vectorY- Search direction vectorW- Solution work vectorG- Function work vector
Level: developer
-seealso: , SNES, SNESLineSearch, SNESLineSearchSetNorms(), SNESLineSearchGetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetVecs
PETSc.LibPETSc.SNESLineSearchSetWorkVecs — Method
SNESLineSearchSetWorkVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, nwork::PetscInt)Sets work vectors for the line search.
Input Parameters:
linesearch- theSNESLineSearchcontextnwork- the number of work vectors
Level: developer
-seealso: , SNES, SNESLineSearch, SNESSetWorkVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetWorkVecs
PETSc.LibPETSc.SNESLineSearchShellGetApply — Method
SNESLineSearchShellGetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid)Gets the apply function and context for the SNESLINESEARCHSHELL
Not Collective
Input Parameter:
linesearch- the line search object
Output Parameters:
func- the user function; can beNULLif it is not needed, seeSNESLineSearchShellApplyFnfor calling sequencectx- the user function context; can beNULLif it is not needed
Level: advanced
-seealso: , SNESLineSearchShellSetApply(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch, SNESLineSearchShellApplyFn
External Links
- PETSc Manual:
SNES/SNESLineSearchShellGetApply
PETSc.LibPETSc.SNESLineSearchShellSetApply — Method
SNESLineSearchShellSetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid)Sets the apply function for the SNESLINESEARCHSHELL implementation.
Not Collective
Input Parameters:
linesearch-SNESLineSearchcontextfunc- function implementing the linesearch shell, seeSNESLineSearchShellApplyFnfor calling sequencectx- context for func
Usage: -seealso: , SNESLineSearchShellGetApply(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch, SNESLineSearchShellApplyFn
External Links
- PETSc Manual:
SNES/SNESLineSearchShellSetApply
PETSc.LibPETSc.SNESLineSearchView — Method
SNESLineSearchView(petsclib::PetscLibType,linesearch::SNESLineSearch, viewer::PetscViewer)Prints useful information about the line search
Logically Collective
Input Parameters:
linesearch- line search contextviewer- thePetscViewerto display the line search information to
Level: intermediate
-seealso: , SNES, SNESLineSearch, PetscViewer, SNESLineSearchCreate()
External Links
- PETSc Manual:
SNES/SNESLineSearchView