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
See also: SNES, SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESAddOptionsChecker
PETSc.LibPETSc.SNESAppendOptionsPrefix — Method
SNESAppendOptionsPrefix(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESGetOptionsPrefix(), SNESSetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESAppendOptionsPrefix
PETSc.LibPETSc.SNESApplyNPC — Method
SNESApplyNPC(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec, f::AbstractPetscVec, y::AbstractPetscVec)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
See also: SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESApplyNPC
PETSc.LibPETSc.SNESCompositeAddSNES — Method
SNESCompositeAddSNES(petsclib::PetscLibType, snes::AbstractSNES, type::String)Adds another SNES to the SNESCOMPOSITE
Collective
Input Parameters:
snes- theSNEScontext of typeSNESCOMPOSITEtype- theSNESTypeof the new solver
Level: developer
See also: SNES, SNESCOMPOSITE, SNESCompositeGetSNES()
External Links
- PETSc Manual:
SNES/SNESCompositeAddSNES
PETSc.LibPETSc.SNESCompositeGetNumber — Method
n::PetscInt = SNESCompositeGetNumber(petsclib::PetscLibType, snes::AbstractSNES)Get the number of subsolvers in the SNESCOMPOSITE
Logically Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
n- the number of subsolvers
Level: developer
See also: SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetSNES()
External Links
- PETSc Manual:
SNES/SNESCompositeGetNumber
PETSc.LibPETSc.SNESCompositeGetSNES — Method
subsnes::SNES = SNESCompositeGetSNES(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt)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
See also: SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetNumber()
External Links
- PETSc Manual:
SNES/SNESCompositeGetSNES
PETSc.LibPETSc.SNESCompositeSetDamping — Method
SNESCompositeSetDamping(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES, 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 (multiplicative|additive|additive_optimal)- Sets composite preconditioner type
Level: developer
See also: 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::AbstractSNES, x::AbstractPetscVec, f::AbstractPetscVec)Calls the function that has been set with SNESSetFunction().
Collective
Input Parameters:
snes- theSNEScontextx- input vector
Output Parameter:
f- function vector, as set bySNESSetFunction()
Level: developer
See also: SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeMFFunction(), SNESSetFunctionDomainError()
External Links
- PETSc Manual:
SNES/SNESComputeFunction
PETSc.LibPETSc.SNESComputeFunctionDefaultNPC — Method
SNESComputeFunctionDefaultNPC(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, F::AbstractPetscVec)Compute the residual by applying the attached nonlinear preconditioner when one is present, otherwise defer to SNESComputeFunction()
Collective
Input Parameters:
snes- theSNEScontextX- the current iterate
Output Parameter:
F- the residual vector produced by the nonlinear preconditioner (or the standard function evaluation)
Level: developer
See also: SNES, SNESSetNPC(), SNESApplyNPC(), SNESComputeFunction(), SNESGetNPCFunction()
External Links
- PETSc Manual:
SNES/SNESComputeFunctionDefaultNPC
PETSc.LibPETSc.SNESComputeJacobian — Method
SNESComputeJacobian(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, A::AbstractPetscMat, B::AbstractPetscMat)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 [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 [viewer]- 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
See also: SNESSetJacobian(), KSPSetOperators(), MatStructure, SNESSetLagPreconditioner(), SNESSetLagJacobian(), SNESSetJacobianDomainError(), SNESCheckJacobianDomainError(), SNESSetCheckJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESComputeJacobian
PETSc.LibPETSc.SNESComputeJacobianDefault — Method
SNESComputeJacobianDefault(petsclib::PetscLibType, snes::AbstractSNES, x1::AbstractPetscVec, J::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{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 etol- 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 (wp|ds)- SeeMATMFFD_WPandMATMFFD_DS
Level: intermediate
See also: SNES, SNESSetJacobian(), SNESComputeJacobianDefaultColor(), MatCreateSNESMF()
External Links
- PETSc Manual:
SNES/SNESComputeJacobianDefault
PETSc.LibPETSc.SNESComputeJacobianDefaultColor — Method
SNESComputeJacobianDefaultColor(petsclib::PetscLibType, snes::AbstractSNES, x1::AbstractPetscVec, J::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{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
See also: SNES, SNESSetJacobian(), SNESTestJacobian(), SNESComputeJacobianDefault(), SNESSetUseMatrixFree(), MatFDColoringCreate(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
SNES/SNESComputeJacobianDefaultColor
PETSc.LibPETSc.SNESComputeMFFunction — Method
SNESComputeMFFunction(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec, y::AbstractPetscVec)Calls the function that has been set with DMSNESSetMFFunction().
Collective
Input Parameters:
snes- theSNEScontextx- input vector
Output Parameter:
y- output vector
Level: developer
See also: SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), MatCreateSNESMF(), DMSNESSetMFFunction()
External Links
- PETSc Manual:
SNES/SNESComputeMFFunction
PETSc.LibPETSc.SNESComputeNGS — Method
SNESComputeNGS(petsclib::PetscLibType, snes::AbstractSNES, b::AbstractPetscVec, x::AbstractPetscVec)Calls the Gauss-Seidel function that has been set with SNESSetNGS().
Collective
Input Parameters:
snes- theSNEScontextx- input vectorb- rhs vector
Output Parameter:
x- new solution vector
Level: developer
See also: SNESNGSFn, SNESSetNGS(), SNESComputeFunction(), SNESNGS
External Links
- PETSc Manual:
SNES/SNESComputeNGS
PETSc.LibPETSc.SNESComputeObjective — Method
ob::PetscReal = SNESComputeObjective(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec)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
See also: SNESLineSearch, SNES, SNESSetObjective(), SNESGetSolution()
External Links
- PETSc Manual:
SNES/SNESComputeObjective
PETSc.LibPETSc.SNESConverged — Method
SNESConverged(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSolve, SNESSetConvergenceTest()
External Links
- PETSc Manual:
SNES/SNESConverged
PETSc.LibPETSc.SNESConvergedCorrectPressure — Method
reason::SNESConvergedReason = SNESConvergedCorrectPressure(petsclib::PetscLibType, snes::AbstractSNES, it::PetscInt, xnorm::PetscReal, gnorm::PetscReal, f::PetscReal, ctx::Ptr{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 application context
Output Parameter:
reason-SNES_CONVERGED_ITERATING,SNES_CONVERGED_ITS, orSNES_DIVERGED_FUNCTION_NANORINF
Options Database Key:
-snes_convergence_test correct_pressure- seeSNESSetFromOptions()
Level: advanced
See also: SNES, DM, SNESConvergedDefault(), SNESSetConvergenceTest(), DMSetNullSpaceConstructor()
External Links
- PETSc Manual:
SNES/SNESConvergedCorrectPressure
PETSc.LibPETSc.SNESConvergedDefault — Method
reason::SNESConvergedReason = SNESConvergedDefault(petsclib::PetscLibType, snes::AbstractSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, ctx::Ptr{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 iteratectx- 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
See also: SNES, SNESSolve(), SNESSetConvergenceTest(), SNESConvergedSkip(), SNESSetTolerances(), SNESSetDivergenceTolerance(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESConvergedDefault
PETSc.LibPETSc.SNESConvergedReasonView — Method
SNESConvergedReasonView(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES)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
See also: SNES, SNESCreate(), SNESDestroy(), SNESReset(), SNESConvergedReasonViewSet()
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewCancel
PETSc.LibPETSc.SNESConvergedReasonViewFromOptions — Method
SNESConvergedReasonViewFromOptions(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESConvergedReason, SNESConvergedReasonViewSet(), SNESCreate(), SNESSetUp(), SNESDestroy(), SNESSetTolerances(), SNESConvergedDefault(), SNESGetConvergedReason(), SNESConvergedReasonView()
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewFromOptions
PETSc.LibPETSc.SNESConvergedReasonViewSet — Method
SNESConvergedReasonViewSet(petsclib::PetscLibType, snes::AbstractSNES, f::external, vctx::Ptr{Cvoid}, reasonviewdestroy::Ptr{Cvoid})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
See also: SNES, SNESSolve(), SNESConvergedReason, SNESGetConvergedReason(), SNESConvergedReasonView(), SNESConvergedReasonViewCancel(), PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESConvergedReasonViewSet
PETSc.LibPETSc.SNESConvergedSkip — Method
reason::SNESConvergedReason = SNESConvergedSkip(petsclib::PetscLibType, snes::AbstractSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, ctx::Ptr{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 iteratectx- unused context
Output Parameter:
reason-SNES_CONVERGED_ITERATING,SNES_CONVERGED_ITS, orSNES_DIVERGED_FUNCTION_NANORINF
Options Database Key:
-snes_convergence_test skip- seeSNESSetFromOptions()
Level: advanced
See also: SNES, SNESSolve(), SNESConvergedDefault(), SNESSetConvergenceTest(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESConvergedSkip
PETSc.LibPETSc.SNESCreate — Method
outsnes::SNES = 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
See also: SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian()
External Links
- PETSc Manual:
SNES/SNESCreate
PETSc.LibPETSc.SNESDestroy — Method
SNESDestroy(petsclib::PetscLibType, snes::AbstractSNES)Destroys the nonlinear solver context that was created with SNESCreate().
Collective
Input Parameter:
snes- theSNEScontext
Level: beginner
See also: SNES, SNESCreate(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESDestroy
PETSc.LibPETSc.SNESFASCreateCoarseVec — Method
Xcoarse::PetscVec = SNESFASCreateCoarseVec(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESFASSetRestriction(), SNESFASRestrict(), SNESFAS
External Links
- PETSc Manual:
SNESFAS/SNESFASCreateCoarseVec
PETSc.LibPETSc.SNESFASCycleGetCorrection — Method
correction::SNES = SNESFASCycleGetCorrection(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetCorrection
PETSc.LibPETSc.SNESFASCycleGetInjection — Method
mat::PetscMat = SNESFASCycleGetInjection(petsclib::PetscLibType, snes::AbstractSNES)Gets the injection on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the restriction operator on this level
Level: advanced
See also: SNES, SNESFAS, SNESFASGetInjection(), SNESFASCycleGetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetInjection
PETSc.LibPETSc.SNESFASCycleGetInterpolation — Method
mat::PetscMat = SNESFASCycleGetInterpolation(petsclib::PetscLibType, snes::AbstractSNES)Gets the interpolation on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the interpolation operator on this level
Level: advanced
See also: SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetInterpolation
PETSc.LibPETSc.SNESFASCycleGetRScale — Method
vec::PetscVec = SNESFASCycleGetRScale(petsclib::PetscLibType, snes::AbstractSNES)Gets the injection scale-factor on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
vec- the restriction operator on this level
Level: advanced
See also: SNES, SNESFAS, SNESFASCycleGetRestriction(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetRScale
PETSc.LibPETSc.SNESFASCycleGetRestriction — Method
mat::PetscMat = SNESFASCycleGetRestriction(petsclib::PetscLibType, snes::AbstractSNES)Gets the restriction on a level
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
mat- the restriction operator on this level
Level: advanced
See also: SNES, SNESFAS, SNESFASGetRestriction(), SNESFASCycleGetInterpolation()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetRestriction
PETSc.LibPETSc.SNESFASCycleGetSmoother — Method
smooth::SNES = SNESFASCycleGetSmoother(petsclib::PetscLibType, snes::AbstractSNES)Gets the smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smooth- the smoother
Level: advanced
See also: SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetSmoother
PETSc.LibPETSc.SNESFASCycleGetSmootherDown — Method
smoothd::SNES = SNESFASCycleGetSmootherDown(petsclib::PetscLibType, snes::AbstractSNES)Gets the down smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes-SNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smoothd- the smoother
Level: advanced
See also: SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetSmootherDown
PETSc.LibPETSc.SNESFASCycleGetSmootherUp — Method
smoothu::SNES = SNESFASCycleGetSmootherUp(petsclib::PetscLibType, snes::AbstractSNES)Gets the up smoother on a particular cycle level.
Logically Collective
Input Parameter:
snes- theSNESFASobtained withSNESFASGetCycleSNES()
Output Parameter:
smoothu- the smoother
Level: advanced
See also: SNES, SNESFAS, SNESFASCycleGetSmoother(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleGetSmootherUp
PETSc.LibPETSc.SNESFASCycleIsFine — Method
flg::PetscBool = SNESFASCycleIsFine(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESFASSetLevels()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleIsFine
PETSc.LibPETSc.SNESFASCycleSetCycles — Method
SNESFASCycleSetCycles(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetCycles()
External Links
- PETSc Manual:
SNESFAS/SNESFASCycleSetCycles
PETSc.LibPETSc.SNESFASFullGetTotal — Method
total::PetscBool = SNESFASFullGetTotal(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution(), SNESFullSetTotal()
External Links
- PETSc Manual:
SNESFAS/SNESFASFullGetTotal
PETSc.LibPETSc.SNESFASFullSetDownSweep — Method
SNESFASFullSetDownSweep(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNESFAS/SNESFASFullSetDownSweep
PETSc.LibPETSc.SNESFASFullSetTotal — Method
SNESFASFullSetTotal(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution()
External Links
- PETSc Manual:
SNESFAS/SNESFASFullSetTotal
PETSc.LibPETSc.SNESFASGalerkinFunctionDefault — Method
SNESFASGalerkinFunctionDefault(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, F::AbstractPetscVec, ctx::Ptr{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
See also: SNES, SNESFAS, SNESFASGetGalerkin(), SNESFASSetGalerkin()
External Links
- PETSc Manual:
SNESFAS/SNESFASGalerkinFunctionDefault
PETSc.LibPETSc.SNESFASGetCoarseSolve — Method
coarse::SNES = SNESFASGetCoarseSolve(petsclib::PetscLibType, snes::AbstractSNES)Gets the coarsest level solver.
Input Parameter:
snes- theSNESFASnonlinear multigrid context
Output Parameter:
coarse- the coarse-level solver
Level: advanced
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetCoarseSolve
PETSc.LibPETSc.SNESFASGetCycleSNES — Method
lsnes::SNES = SNESFASGetCycleSNES(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetLevels()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetCycleSNES
PETSc.LibPETSc.SNESFASGetGalerkin — Method
flg::PetscBool = SNESFASGetGalerkin(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESFASSetLevels(), SNESFASSetGalerkin()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetGalerkin
PETSc.LibPETSc.SNESFASGetInjection — Method
mat::PetscMat = SNESFASGetInjection(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASGetRestriction(), SNESFASGetInterpolation(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetInjection
PETSc.LibPETSc.SNESFASGetInterpolation — Method
mat::PetscMat = SNESFASGetInterpolation(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASGetInjection(), SNESFASGetRestriction(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetInterpolation
PETSc.LibPETSc.SNESFASGetLevels — Method
levels::PetscInt = SNESFASGetLevels(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESFASSetLevels(), PCMGGetLevels()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetLevels
PETSc.LibPETSc.SNESFASGetRestriction — Method
mat::PetscMat = SNESFASGetRestriction(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetRestriction(), SNESFASGetInjection(), SNESFASGetInterpolation(), SNESFASGetRScale()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetRestriction
PETSc.LibPETSc.SNESFASGetSmoother — Method
smooth::SNES = SNESFASGetSmoother(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetSmoother
PETSc.LibPETSc.SNESFASGetSmootherDown — Method
smooth::SNES = SNESFASGetSmootherDown(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)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
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetSmootherDown
PETSc.LibPETSc.SNESFASGetSmootherUp — Method
smooth::SNES = SNESFASGetSmootherUp(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt)Gets the upsmoother on a level.
Input Parameters:
snes- theSNESFASnonlinear multigrid contextlevel- the level (0 is coarsest)
Output Parameter:
smooth- the smoother
Level: advanced
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASGetSmootherUp
PETSc.LibPETSc.SNESFASGetType — Method
fastype::SNESFASType = SNESFASGetType(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, PCMGSetType(), SNESFASSetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE
External Links
- PETSc Manual:
SNESFAS/SNESFASGetType
PETSc.LibPETSc.SNESFASRestrict — Method
SNESFASRestrict(petsclib::PetscLibType, fine::AbstractSNES, Xfine::AbstractPetscVec, Xcoarse::AbstractPetscVec)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
See also: SNES, SNESFAS, SNESFASSetRestriction(), SNESFASSetInjection(), SNESFASCreateCoarseVec()
External Links
- PETSc Manual:
SNESFAS/SNESFASRestrict
PETSc.LibPETSc.SNESFASSetContinuation — Method
SNESFASSetContinuation(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetContinuation
PETSc.LibPETSc.SNESFASSetCycles — Method
SNESFASSetCycles(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetCyclesOnLevel()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetCycles
PETSc.LibPETSc.SNESFASSetGalerkin — Method
SNESFASSetGalerkin(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetGalerkin()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetGalerkin
PETSc.LibPETSc.SNESFASSetInjection — Method
SNESFASSetInjection(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt, mat::AbstractPetscMat)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
See also: SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetInjection
PETSc.LibPETSc.SNESFASSetInterpolation — Method
SNESFASSetInterpolation(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt, mat::AbstractPetscMat)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
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction(), SNESFASSetRScale()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetInterpolation
PETSc.LibPETSc.SNESFASSetLevels — Method
comms::MPI_Comm = SNESFASSetLevels(petsclib::PetscLibType, snes::AbstractSNES, levels::PetscInt)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
See also: SNES, SNESFAS, SNESFASGetLevels()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetLevels
PETSc.LibPETSc.SNESFASSetLog — Method
SNESFASSetLog(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESFASSetMonitor()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetLog
PETSc.LibPETSc.SNESFASSetMonitor — Method
SNESFASSetMonitor(petsclib::PetscLibType, snes::AbstractSNES, vf::Vector{PetscViewerAndFormat}, flg::PetscBool)Sets the method-specific cycle monitoring
Logically Collective
Input Parameters:
snes- theSNESFAScontextvf- viewer and format structure (may beNULLifflgisPETSC_FALSE)flg- monitor or not
Level: advanced
See also: SNES, SNESFAS, SNESMonitorSet(), SNESFASSetCyclesOnLevel()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetMonitor
PETSc.LibPETSc.SNESFASSetNumberSmoothDown — Method
SNESFASSetNumberSmoothDown(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt)Sets the number of pre-smoothing steps to 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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothUp()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetNumberSmoothDown
PETSc.LibPETSc.SNESFASSetNumberSmoothUp — Method
SNESFASSetNumberSmoothUp(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt)Sets the number of post-smoothing steps to 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
See also: SNES, SNESFAS, SNESFASSetNumberSmoothDown()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetNumberSmoothUp
PETSc.LibPETSc.SNESFASSetRScale — Method
SNESFASSetRScale(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt, rscale::AbstractPetscVec)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
See also: SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetRScale
PETSc.LibPETSc.SNESFASSetRestriction — Method
SNESFASSetRestriction(petsclib::PetscLibType, snes::AbstractSNES, level::PetscInt, mat::AbstractPetscMat)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
See also: SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetInjection()
External Links
- PETSc Manual:
SNESFAS/SNESFASSetRestriction
PETSc.LibPETSc.SNESFASSetType — Method
SNESFASSetType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, PCMGSetType(), SNESFASGetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE
External Links
- PETSc Manual:
SNESFAS/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
See also: SNES, PetscFinalize()
External Links
- PETSc Manual:
SNES/SNESFinalizePackage
PETSc.LibPETSc.SNESGetAlwaysComputesFinalResidual — Method
flg::PetscBool = SNESGetAlwaysComputesFinalResidual(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESFAS, SNESSolve(), SNESSetAlwaysComputesFinalResidual()
External Links
- PETSc Manual:
SNES/SNESGetAlwaysComputesFinalResidual
PETSc.LibPETSc.SNESGetApplicationContext — Method
ctx::Ptr{Cvoid} = SNESGetApplicationContext(petsclib::PetscLibType, snes::AbstractSNES)Gets the user-defined context for the nonlinear solvers set with SNESGetApplicationContext() or SNESSetComputeApplicationContext()
Not Collective
Input Parameter:
snes-SNEScontext
Output Parameter:
ctx- the application context
Level: intermediate
See also: SNESSetApplicationContext(), SNESSetComputeApplicationContext()
External Links
- PETSc Manual:
SNES/SNESGetApplicationContext
PETSc.LibPETSc.SNESGetCheckJacobianDomainError — Method
flg::PetscBool = SNESGetCheckJacobianDomainError(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESSetCheckJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESGetCheckJacobianDomainError
PETSc.LibPETSc.SNESGetConvergedReason — Method
reason::SNESConvergedReason = SNESGetConvergedReason(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSolve(), SNESSetConvergenceTest(), SNESSetConvergedReason(), SNESConvergedReason, SNESGetConvergedReasonString()
External Links
- PETSc Manual:
SNES/SNESGetConvergedReason
PETSc.LibPETSc.SNESGetConvergedReasonString — Method
strreason::String = SNESGetConvergedReasonString(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESGetConvergedReason()
External Links
- PETSc Manual:
SNES/SNESGetConvergedReasonString
PETSc.LibPETSc.SNESGetConvergenceHistory — Method
a::Vector{PetscReal},its::Vector{PetscInt},na::PetscInt = SNESGetConvergenceHistory(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSolve(), SNESSetConvergenceHistory()
External Links
- PETSc Manual:
SNES/SNESGetConvergenceHistory
PETSc.LibPETSc.SNESGetDM — Method
dm::PetscDM = SNESGetDM(petsclib::PetscLibType, snes::AbstractSNES)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
See also: DM, SNES, SNESSetDM(), KSPSetDM(), KSPGetDM()
External Links
- PETSc Manual:
SNES/SNESGetDM
PETSc.LibPETSc.SNESGetDivergenceTolerance — Method
divtol::PetscReal = SNESGetDivergenceTolerance(petsclib::PetscLibType, snes::AbstractSNES)Gets divergence tolerance used in divergence test.
Not Collective
Input Parameters:
snes- theSNEScontextdivtol- divergence tolerance
Level: intermediate
See also: SNES, SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESGetDivergenceTolerance
PETSc.LibPETSc.SNESGetErrorIfNotConverged — Method
flag::PetscBool = SNESGetErrorIfNotConverged(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSolve(), SNESSetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()
External Links
- PETSc Manual:
SNES/SNESGetErrorIfNotConverged
PETSc.LibPETSc.SNESGetForceIteration — Method
force::PetscBool = SNESGetForceIteration(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetForceIteration(), SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESGetForceIteration
PETSc.LibPETSc.SNESGetFunction — Method
r::PetscVec,f::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESGetFunction(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSolve(), SNESSetFunction(), SNESGetSolution(), SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESGetFunction
PETSc.LibPETSc.SNESGetFunctionNorm — Method
norm::PetscReal = SNESGetFunctionNorm(petsclib::PetscLibType, snes::AbstractSNES)Gets the last computed norm of the residual
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
norm- the last computed residual norm
Level: developer
See also: SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetFunctionNorm
PETSc.LibPETSc.SNESGetFunctionType — Method
type::SNESFunctionType = SNESGetFunctionType(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetFunctionType(), SNESFunctionType, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetFunctionType
PETSc.LibPETSc.SNESGetGridSequence — Method
steps::PetscInt = SNESGetGridSequence(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetGridSequence()
External Links
- PETSc Manual:
SNES/SNESGetGridSequence
PETSc.LibPETSc.SNESGetIterationNumber — Method
iter::PetscInt = SNESGetIterationNumber(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSolve(), SNESSetLagJacobian(), SNESGetLinearSolveIterations(), SNESSetMonitor()
External Links
- PETSc Manual:
SNES/SNESGetIterationNumber
PETSc.LibPETSc.SNESGetJacobian — Method
Amat::PetscMat,Pmat::PetscMat,J::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESGetJacobian(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, Mat, SNESSetJacobian(), SNESComputeJacobian(), SNESJacobianFn, SNESGetFunction()
External Links
- PETSc Manual:
SNES/SNESGetJacobian
PETSc.LibPETSc.SNESGetKSP — Method
ksp::KSP = SNESGetKSP(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, KSP, PC, KSPGetPC(), SNESCreate(), KSPCreate(), SNESSetKSP()
External Links
- PETSc Manual:
SNES/SNESGetKSP
PETSc.LibPETSc.SNESGetLagJacobian — Method
lag::PetscInt = SNESGetLagJacobian(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetLagJacobian(), SNESSetLagPreconditioner(), SNESGetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESGetLagJacobian
PETSc.LibPETSc.SNESGetLagPreconditioner — Method
lag::PetscInt = SNESGetLagPreconditioner(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESGetLagPreconditioner
PETSc.LibPETSc.SNESGetLineSearch — Method
linesearch::SNESLineSearch = SNESGetLineSearch(petsclib::PetscLibType, snes::AbstractSNES)Returns the line search associated with the SNES.
Not Collective
Input Parameter:
snes- iterative context obtained fromSNESCreate()
Output Parameter:
linesearch- linesearch context
Level: beginner
See also: SNESLineSearch, SNESSetLineSearch(), SNESLineSearchCreate(), SNESLineSearchSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESGetLineSearch
PETSc.LibPETSc.SNESGetLinearSolveFailures — Method
nfails::PetscInt = SNESGetLinearSolveFailures(petsclib::PetscLibType, snes::AbstractSNES)Gets the number of failed (non-converged) 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
See also: SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures()
External Links
- PETSc Manual:
SNES/SNESGetLinearSolveFailures
PETSc.LibPETSc.SNESGetLinearSolveIterations — Method
lits::PetscInt = SNESGetLinearSolveIterations(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESGetIterationNumber(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESSetCountersReset()
External Links
- PETSc Manual:
SNES/SNESGetLinearSolveIterations
PETSc.LibPETSc.SNESGetMaxLinearSolveFailures — Method
maxFails::PetscInt = SNESGetMaxLinearSolveFailures(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures()
External Links
- PETSc Manual:
SNES/SNESGetMaxLinearSolveFailures
PETSc.LibPETSc.SNESGetMaxNonlinearStepFailures — Method
maxFails::PetscInt = SNESGetMaxNonlinearStepFailures(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures()
External Links
- PETSc Manual:
SNES/SNESGetMaxNonlinearStepFailures
PETSc.LibPETSc.SNESGetNGS — Method
f::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESGetNGS(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetNGS(), SNESGetFunction(), SNESNGSFn
External Links
- PETSc Manual:
SNES/SNESGetNGS
PETSc.LibPETSc.SNESGetNPC — Method
pc::SNES = SNESGetNPC(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetNPC(), SNESHasNPC(), SNES, SNESCreate()
External Links
- PETSc Manual:
SNES/SNESGetNPC
PETSc.LibPETSc.SNESGetNPCFunction — Method
fnorm::PetscReal = SNESGetNPCFunction(petsclib::PetscLibType, snes::AbstractSNES, F::AbstractPetscVec)Gets the current function value (for the callback function provided by SNESSetFunction(), 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
See also: SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction(), SNESApplyNPC(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESGetNPCFunction
PETSc.LibPETSc.SNESGetNPCSide — Method
side::PCSide = SNESGetNPCSide(petsclib::PetscLibType, snes::AbstractSNES)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
$`PC_LEFT` - left preconditioning `PC_RIGHT` - right preconditioning (default for most nonlinear solvers)$
Level: intermediate
See also: 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::AbstractSNES)Gets the number of unsuccessful steps taken 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
See also: SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetMaxNonlinearStepFailures()
External Links
- PETSc Manual:
SNES/SNESGetNonlinearStepFailures
PETSc.LibPETSc.SNESGetNormSchedule — Method
normschedule::SNESNormSchedule = SNESGetNormSchedule(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESGetNormSchedule
PETSc.LibPETSc.SNESGetNumberFunctionEvals — Method
nfuncs::PetscInt = SNESGetNumberFunctionEvals(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetCountersReset()
External Links
- PETSc Manual:
SNES/SNESGetNumberFunctionEvals
PETSc.LibPETSc.SNESGetObjective — Method
obj::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESGetObjective(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetObjective(), SNESGetSolution(), SNESObjectiveFn
External Links
- PETSc Manual:
SNES/SNESGetObjective
PETSc.LibPETSc.SNESGetOptionsPrefix — Method
prefix::String = SNESGetOptionsPrefix(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetOptionsPrefix(), SNESAppendOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESGetOptionsPrefix
PETSc.LibPETSc.SNESGetPicard — Method
r::PetscVec,f::Ptr{Cvoid},Amat::PetscMat,Pmat::PetscMat,J::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESGetPicard(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetFunction(), SNESSetPicard(), SNESGetFunction(), SNESGetJacobian(), SNESGetDM(), SNESFunctionFn, SNESJacobianFn
External Links
- PETSc Manual:
SNES/SNESGetPicard
PETSc.LibPETSc.SNESGetRhs — Method
rhs::PetscVec = SNESGetRhs(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESGetSolution(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetFunction()
External Links
- PETSc Manual:
SNES/SNESGetRhs
PETSc.LibPETSc.SNESGetSolution — Method
x::PetscVec = SNESGetSolution(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetSolution(), SNESSolve(), SNES, SNESGetSolutionUpdate(), SNESGetFunction()
External Links
- PETSc Manual:
SNES/SNESGetSolution
PETSc.LibPETSc.SNESGetSolutionNorm — Method
xnorm::PetscReal = SNESGetSolutionNorm(petsclib::PetscLibType, snes::AbstractSNES)Gets the last computed norm of the solution
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
xnorm- the last computed solution norm
Level: developer
See also: SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm(), SNESGetUpdateNorm()
External Links
- PETSc Manual:
SNES/SNESGetSolutionNorm
PETSc.LibPETSc.SNESGetSolutionUpdate — Method
x::PetscVec = SNESGetSolutionUpdate(petsclib::PetscLibType, snes::AbstractSNES)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
See also: 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::AbstractSNES)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
See also: SNES, SNESSetTolerances()
External Links
- PETSc Manual:
SNES/SNESGetTolerances
PETSc.LibPETSc.SNESGetType — Method
type::String = SNESGetType(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESSetType(), SNESType, SNESSetFromOptions(), SNES, PetscObjectTypeCompare(), PetscObjectTypeCompareAny()
External Links
- PETSc Manual:
SNES/SNESGetType
PETSc.LibPETSc.SNESGetUpdateNorm — Method
ynorm::PetscReal = SNESGetUpdateNorm(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm()
External Links
- PETSc Manual:
SNES/SNESGetUpdateNorm
PETSc.LibPETSc.SNESGetUseMatrixFree — Method
mf_operator::PetscBool,mf::PetscBool = SNESGetUseMatrixFree(petsclib::PetscLibType, snes::AbstractSNES)indicates if the SNES uses matrix-free finite difference matrix vector products to apply the Jacobian.
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
See also: SNES, SNESSetUseMatrixFree(), MatCreateSNESMF()
External Links
- PETSc Manual:
SNES/SNESGetUseMatrixFree
PETSc.LibPETSc.SNESHasNPC — Method
has_npc::PetscBool = SNESHasNPC(petsclib::PetscLibType, snes::AbstractSNES)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
See also: 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
See also: 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::AbstractSNES)Gets parameters for Eisenstat-Walker 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
See also: SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPGetParametersEW
PETSc.LibPETSc.SNESKSPGetUseEW — Method
flag::PetscBool = SNESKSPGetUseEW(petsclib::PetscLibType, snes::AbstractSNES)Gets if SNES is using Eisenstat-Walker method 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
See also: SNESKSPSetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPGetUseEW
PETSc.LibPETSc.SNESKSPSetParametersEW — Method
SNESKSPSetParametersEW(petsclib::PetscLibType, snes::AbstractSNES, version::PetscInt, rtol_0::PetscReal, rtol_max::PetscReal, gamma::PetscReal, alpha::PetscReal, alpha2::PetscReal, threshold::PetscReal)Sets parameters for Eisenstat-Walker 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
See also: SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPGetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPSetParametersEW
PETSc.LibPETSc.SNESKSPSetUseEW — Method
SNESKSPSetUseEW(petsclib::PetscLibType, snes::AbstractSNES, flag::PetscBool)Sets SNES to the use Eisenstat-Walker method for 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
See also: KSP, SNES, SNESKSPGetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()
External Links
- PETSc Manual:
SNES/SNESKSPSetUseEW
PETSc.LibPETSc.SNESLoad — Method
SNESLoad(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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
See also: SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll(), SNESMSInitializePackage(), PetscFinalize()
External Links
- PETSc Manual:
SNES/SNESMSFinalizePackage
PETSc.LibPETSc.SNESMSGetDamping — Method
damping::PetscReal = SNESMSGetDamping(petsclib::PetscLibType, snes::AbstractSNES)Get the damping parameter of SNESMS multistage scheme
Not Collective
Input Parameter:
snes- nonlinear solver context
Output Parameter:
damping- damping parameter
Level: advanced
See also: SNESMSSetDamping(), SNESMS
External Links
- PETSc Manual:
SNES/SNESMSGetDamping
PETSc.LibPETSc.SNESMSGetType — Method
mstype::String = SNESMSGetType(petsclib::PetscLibType, snes::AbstractSNES)Get the type of multistage smoother SNESMS
Not Collective
Input Parameter:
snes- nonlinear solver context
Output Parameter:
mstype- type of multistage method
Level: advanced
See also: 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
See also: SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll(), PetscInitialize()
External Links
- PETSc Manual:
SNES/SNESMSInitializePackage
PETSc.LibPETSc.SNESMSRegister — Method
SNESMSRegister(petsclib::PetscLibType, name::String, 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
See also: SNES, SNESMS
External Links
- PETSc Manual:
SNES/SNESMSRegister
PETSc.LibPETSc.SNESMSRegisterAll — Method
SNESMSRegisterAll(petsclib::PetscLibType)Registers all of the multi-stage methods in SNESMS
Logically Collective
Level: developer
See also: 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
See also: SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll()
External Links
- PETSc Manual:
SNES/SNESMSRegisterDestroy
PETSc.LibPETSc.SNESMSSetDamping — Method
SNESMSSetDamping(petsclib::PetscLibType, snes::AbstractSNES, damping::PetscReal)Set the damping parameter for a SNESMS multistage scheme
Logically Collective
Input Parameters:
snes- nonlinear solver contextdamping- damping parameter
Level: advanced
See also: SNESMSGetDamping(), SNESMS
External Links
- PETSc Manual:
SNES/SNESMSSetDamping
PETSc.LibPETSc.SNESMSSetType — Method
SNESMSSetType(petsclib::PetscLibType, snes::AbstractSNES, mstype::String)Set the type of multistage smoother SNESMS
Logically Collective
Input Parameters:
snes- nonlinear solver contextmstype- type of multistage method
Level: advanced
See also: SNESMS, SNESMSGetType(), SNESMSType
External Links
- PETSc Manual:
SNES/SNESMSSetType
PETSc.LibPETSc.SNESMonitor — Method
SNESMonitor(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESMonitor
PETSc.LibPETSc.SNESMonitorCancel — Method
SNESMonitorCancel(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESMonitorDefault(), SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESMonitorCancel
PETSc.LibPETSc.SNESMonitorDefault — Method
SNESMonitorDefault(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: 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::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorDefaultField
PETSc.LibPETSc.SNESMonitorDefaultSetUp — Method
SNESMonitorDefaultSetUp(petsclib::PetscLibType, snes::AbstractSNES, vf::Vector{PetscViewerAndFormat})Prepare the PetscViewerAndFormat associated with SNESMonitorDefault(), in particular by initializing the underlying PetscDrawLG when the viewer format is PETSC_VIEWER_DRAW_LG
Collective
Input Parameters:
snes- theSNEScontextvf- the viewer/format pair passed toSNESMonitorSet()along withSNESMonitorDefault()
Level: developer
See also: SNES, SNESMonitorSet(), SNESMonitorDefault(), PetscViewerAndFormat, PetscViewerMonitorLGSetUp()
External Links
- PETSc Manual:
SNES/SNESMonitorDefaultSetUp
PETSc.LibPETSc.SNESMonitorDefaultShort — Method
SNESMonitorDefaultShort(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{PetscViewerAndFormat})External Links
- PETSc Manual:
SNES/SNESMonitorDefaultShort
PETSc.LibPETSc.SNESMonitorFields — Method
SNESMonitorFields(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNES, SNESMonitorSet(), SNESMonitorDefault()
External Links
- PETSc Manual:
SNES/SNESMonitorFields
PETSc.LibPETSc.SNESMonitorJacUpdateSpectrum — Method
SNESMonitorJacUpdateSpectrum(petsclib::PetscLibType, snes::AbstractSNES, it::PetscInt, fnorm::PetscReal, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorJacUpdateSpectrum
PETSc.LibPETSc.SNESMonitorLGRange — Method
SNESMonitorLGRange(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt, rnorm::PetscReal, monctx::Ptr{Cvoid})Line-graph monitor that plots the residual norm together with residual-range statistics for a SNESSolve()
Collective
Input Parameters:
snes- theSNEScontextn- the iteration numberrnorm- the 2-norm of the residualmonctx- aPetscViewerof typePETSCVIEWERDRAWset up withPetscViewerMonitorLGSetUp()
Level: intermediate
See also: SNES, SNESMonitorSet(), SNESMonitorDefault(), PetscViewerDrawGetDrawLG(), PetscDrawLG
External Links
- PETSc Manual:
SNES/SNESMonitorLGRange
PETSc.LibPETSc.SNESMonitorRange — Method
SNESMonitorRange(petsclib::PetscLibType, snes::AbstractSNES, it::PetscInt, rnorm::PetscReal, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorDefault(), SNESMonitorLGCreate(), SNESMonitorScaling(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRange
PETSc.LibPETSc.SNESMonitorRatio — Method
SNESMonitorRatio(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNESMonitorRationSetUp(), SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRatio
PETSc.LibPETSc.SNESMonitorRatioSetUp — Method
SNESMonitorRatioSetUp(petsclib::PetscLibType, snes::AbstractSNES, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), SNESMonitorRatio(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorRatioSetUp
PETSc.LibPETSc.SNESMonitorResidual — Method
SNESMonitorResidual(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()
External Links
- PETSc Manual:
SNES/SNESMonitorResidual
PETSc.LibPETSc.SNESMonitorSAWs — Method
SNESMonitorSAWs(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt, rnorm::PetscReal, ctx::Ptr{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
See also: PetscViewerSAWsOpen(), SNESMonitorSAWsDestroy(), SNESMonitorSAWsCreate()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWs
PETSc.LibPETSc.SNESMonitorSAWsCreate — Method
ctx::Ptr{Cvoid} = SNESMonitorSAWsCreate(petsclib::PetscLibType, snes::AbstractSNES)create an SAWs monitor context for SNES
Collective
Input Parameter:
snes-SNESto monitor
Output Parameter:
ctx- context for monitor
Level: developer
See also: SNESMonitorSet(), SNES, SNESMonitorSAWs(), SNESMonitorSAWsDestroy()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWsCreate
PETSc.LibPETSc.SNESMonitorSAWsDestroy — Method
SNESMonitorSAWsDestroy(petsclib::PetscLibType, ctx::Ptr{Cvoid})destroy a monitor context created with SNESMonitorSAWsCreate()
Collective
Input Parameter:
ctx- monitor context
Level: developer
See also: SNESMonitorSAWsCreate()
External Links
- PETSc Manual:
SNES/SNESMonitorSAWsDestroy
PETSc.LibPETSc.SNESMonitorScaling — Method
SNESMonitorScaling(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), SNESMonitorJacUpdateSpectrum(), PetscViewerFormat, PetscViewerAndFormat
External Links
- PETSc Manual:
SNES/SNESMonitorScaling
PETSc.LibPETSc.SNESMonitorSet — Method
SNESMonitorSet(petsclib::PetscLibType, snes::AbstractSNES, f::external, mctx::Ptr{Cvoid}, monitordestroy::Ptr{Cvoid})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
Calling sequence of f:
snes- theSNESobjectit- the current iterationrnorm- norm of the residualmctx- the optional monitor context
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
See also: SNES, SNESSolve(), SNESMonitorDefault(), SNESMonitorCancel(), SNESMonitorFunction, PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESMonitorSet
PETSc.LibPETSc.SNESMonitorSetFromOptions — Method
SNESMonitorSetFromOptions(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView()
External Links
- PETSc Manual:
SNES/SNESMonitorSolution
PETSc.LibPETSc.SNESMonitorSolutionUpdate — Method
SNESMonitorSolutionUpdate(petsclib::PetscLibType, snes::AbstractSNES, its::PetscInt, fgnorm::PetscReal, vf::Vector{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
See also: SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()
External Links
- PETSc Manual:
SNES/SNESMonitorSolutionUpdate
PETSc.LibPETSc.SNESMultiblockGetSubSNES — Method
n::PetscInt,subsnes::Vector{SNES} = SNESMultiblockGetSubSNES(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESMULTIBLOCK, SNESMultiblockSetIS(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockGetSubSNES
PETSc.LibPETSc.SNESMultiblockSetBlockSize — Method
SNESMultiblockSetBlockSize(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetBlockSize
PETSc.LibPETSc.SNESMultiblockSetFields — Method
SNESMultiblockSetFields(petsclib::PetscLibType, snes::AbstractSNES, name::String, n::PetscInt, fields::Vector{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
See also: SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetIS()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetFields
PETSc.LibPETSc.SNESMultiblockSetIS — Method
SNESMultiblockSetIS(petsclib::PetscLibType, snes::AbstractSNES, name::String, is::AbstractIS)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
See also: SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetFields()
External Links
- PETSc Manual:
SNES/SNESMultiblockSetIS
PETSc.LibPETSc.SNESMultiblockSetType — Method
SNESMultiblockSetType(petsclib::PetscLibType, snes::AbstractSNES, 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 (multiplicative|additive|symmetric_multiplicative)- Sets block combination type
Level: advanced
See also: 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::AbstractSNES)Gets the update damping for SNESNASM the nonlinear additive Schwarz solver
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
dmp- damping
Level: intermediate
See also: SNES, SNESNASM, SNESNASMSetDamping()
External Links
- PETSc Manual:
SNES/SNESNASMGetDamping
PETSc.LibPETSc.SNESNASMGetNumber — Method
n::PetscInt = SNESNASMGetNumber(petsclib::PetscLibType, snes::AbstractSNES)Gets number of subsolvers
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
n- the number of subsolvers
Level: intermediate
See also: SNESNASM, SNESNASMGetSNES()
External Links
- PETSc Manual:
SNES/SNESNASMGetNumber
PETSc.LibPETSc.SNESNASMGetSNES — Method
subsnes::SNES = SNESNASMGetSNES(petsclib::PetscLibType, snes::AbstractSNES, i::PetscInt)Gets a subsolver
Not Collective
Input Parameters:
snes- theSNEScontexti- the number of the subsnes to get
Output Parameter:
subsnes- the subsolver context
Level: intermediate
See also: SNESNASM, SNESNASMGetNumber()
External Links
- PETSc Manual:
SNES/SNESNASMGetSNES
PETSc.LibPETSc.SNESNASMGetSubdomainVecs — Method
n::PetscInt,x::Vector{PetscVec},y::Vector{PetscVec},b::Vector{PetscVec},xl::Vector{PetscVec} = SNESNASMGetSubdomainVecs(petsclib::PetscLibType, snes::AbstractSNES)Get the processor-local subdomain vectors for the nonlinear additive Schwarz solver
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
See also: SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMGetSubdomainVecs
PETSc.LibPETSc.SNESNASMGetSubdomains — Method
n::PetscInt,subsnes::Vector{SNES},iscatter::Vector{VecScatter},oscatter::Vector{VecScatter},gscatter::Vector{VecScatter} = SNESNASMGetSubdomains(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESNASM, SNESNASMSetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMGetSubdomains
PETSc.LibPETSc.SNESNASMGetType — Method
type::PCASMType = SNESNASMGetType(petsclib::PetscLibType, snes::AbstractSNES)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
See also: 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::AbstractSNES, 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
See also: SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMSetComputeFinalJacobian
PETSc.LibPETSc.SNESNASMSetDamping — Method
SNESNASMSetDamping(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESNASM, SNESNASMGetDamping()
External Links
- PETSc Manual:
SNES/SNESNASMSetDamping
PETSc.LibPETSc.SNESNASMSetSubdomains — Method
SNESNASMSetSubdomains(petsclib::PetscLibType, snes::AbstractSNES, n::PetscInt, subsnes::Vector{<:AbstractSNES}, 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
See also: SNES, SNESNASM, SNESNASMGetSubdomains()
External Links
- PETSc Manual:
SNES/SNESNASMSetSubdomains
PETSc.LibPETSc.SNESNASMSetType — Method
SNESNASMSetType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES, weight::AbstractPetscVec)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
See also: SNESNASM
External Links
- PETSc Manual:
SNES/SNESNASMSetWeight
PETSc.LibPETSc.SNESNCGSetType — Method
SNESNCGSetType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES)Get whether SNESNGMRES increases the restart count when a step xM increases the residual FM
Not Collective
Input Parameter:
snes- theSNEScontext
Output Parameter:
flg-PETSC_TRUEif the option is enabled
Level: advanced
See also: SNES, SNESNGMRES, SNESNGMRESSetRestartFmRise(), SNESNGMRESSetRestartType()
External Links
- PETSc Manual:
SNES/SNESNGMRESGetRestartFmRise
PETSc.LibPETSc.SNESNGMRESSetRestartFmRise — Method
SNESNGMRESSetRestartFmRise(petsclib::PetscLibType, snes::AbstractSNES, 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 (true|false)- Increase the restart count if the step xM increases the residual FM
Level: advanced
See also: SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartType()
External Links
- PETSc Manual:
SNES/SNESNGMRESSetRestartFmRise
PETSc.LibPETSc.SNESNGMRESSetRestartType — Method
SNESNGMRESSetRestartType(petsclib::PetscLibType, snes::AbstractSNES, 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 restart- sets the number of iterations before restart for periodic
Level: intermediate
See also: SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartFmRise(), SNESNGMRESSetSelectType()
External Links
- PETSc Manual:
SNES/SNESNGMRESSetRestartType
PETSc.LibPETSc.SNESNGMRESSetSelectType — Method
SNESNGMRESSetSelectType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES)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
See also: SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSSetSweeps()
External Links
- PETSc Manual:
SNES/SNESNGSGetSweeps
PETSc.LibPETSc.SNESNGSGetTolerances — Method
atol::PetscReal,rtol::PetscReal,stol::PetscReal,maxit::PetscInt = SNESNGSGetTolerances(petsclib::PetscLibType, snes::AbstractSNES)Gets various parameters used in convergence tests for nonlinear Gauss-Seidel SNESNCG
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
See also: SNES, SNESNCG, SNESSetTolerances()
External Links
- PETSc Manual:
SNES/SNESNGSGetTolerances
PETSc.LibPETSc.SNESNGSSetSweeps — Method
SNESNGSSetSweeps(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSGetSweeps()
External Links
- PETSc Manual:
SNES/SNESNGSSetSweeps
PETSc.LibPETSc.SNESNGSSetTolerances — Method
SNESNGSSetTolerances(petsclib::PetscLibType, snes::AbstractSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt)Sets various parameters used in convergence tests for nonlinear Gauss-Seidel SNESNCG
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
See also: SNES, SNESNCG
External Links
- PETSc Manual:
SNES/SNESNGSSetTolerances
PETSc.LibPETSc.SNESNewtonALComputeFunction — Method
SNESNewtonALComputeFunction(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, Q::AbstractPetscVec)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
See also: SNES, SNESNewtonALSetFunction(), SNESNewtonALGetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALComputeFunction
PETSc.LibPETSc.SNESNewtonALGetFunction — Method
SNESNewtonALGetFunction(petsclib::PetscLibType, snes::AbstractSNES, func::Ptr{Ptr{Cvoid}}, ctx::Ptr{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
See also: SNES, SNESNEWTONAL, SNESNewtonALSetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALGetFunction
PETSc.LibPETSc.SNESNewtonALGetLoadParameter — Method
lambda::PetscReal = SNESNewtonALGetLoadParameter(petsclib::PetscLibType, snes::AbstractSNES)Get the value of the load parameter lambda for the arc-length continuation method.
Logically Collective
Input Parameter:
snes- the nonlinear solver object
Output Parameter:
lambda- the arc-length parameter
Level: intermediate
See also: SNES, SNESNEWTONAL, SNESNewtonALSetFunction()
External Links
- PETSc Manual:
SNES/SNESNewtonALGetLoadParameter
PETSc.LibPETSc.SNESNewtonALSetCorrectionType — Method
SNESNewtonALSetCorrectionType(petsclib::PetscLibType, snes::AbstractSNES, ctype::SNESNewtonALCorrectionType)Set the type of correction to use in the arc-length continuation method.
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
See also: SNES, SNESNEWTONAL, SNESNewtonALCorrectionType
External Links
- PETSc Manual:
SNES/SNESNewtonALSetCorrectionType
PETSc.LibPETSc.SNESNewtonALSetDiagonalScaling — Method
SNESNewtonALSetDiagonalScaling(petsclib::PetscLibType, snes::AbstractSNES, v::AbstractPetscVec)Set the global vector used to rescale DoFs for computation of arc length.
Logically Collective
Input Parameters:
snes- the nonlinear solver objectv- theVeccontaining diagonal scaling for each DoF, must be the same size as the solution vector (may beNULL)
See also: SNES, SNESNEWTONAL, SNESNewtonALSetFunction(), SNESNewtonALGetLoadParameter()
External Links
- PETSc Manual:
SNES/SNESNewtonALSetDiagonalScaling
PETSc.LibPETSc.SNESNewtonALSetFunction — Method
SNESNewtonALSetFunction(petsclib::PetscLibType, snes::AbstractSNES, func::Ptr{Cvoid}, ctx::Ptr{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
See also: SNES, SNESNEWTONAL, SNESNewtonALGetFunction(), SNESNewtonALGetLoadParameter()
External Links
- PETSc Manual:
SNES/SNESNewtonALSetFunction
PETSc.LibPETSc.SNESNewtonTRDCGetPostCheck — Method
SNESNewtonTRDCGetPostCheck(petsclib::PetscLibType, snes::AbstractSNES, noname::Ptr{Cvoid})Gets the post-check function optionally set with SNESNewtonTRDCSetPostCheck()
Not Collective
Input Parameter:
snes- the nonlinear solver context
Output Parameters:
func- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRDCPostCheck()ctx- [optional] context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepW- the tentative new solution valuechanged_y- output, flag indicatedYhas been changed by the post-checkchanged_w- output, flag indicatedWhas been changed by the post-checkctx- the optional application context
Level: intermediate
See also: SNES, SNESNEWTONTRDC, SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCPostCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCGetPostCheck
PETSc.LibPETSc.SNESNewtonTRDCGetPreCheck — Method
SNESNewtonTRDCGetPreCheck(petsclib::PetscLibType, snes::AbstractSNES, noname::Ptr{Cvoid})Gets the pre-check function optionally set with SNESNewtonTRDCSetPreCheck()
Not Collective
Input Parameter:
snes- the nonlinear solver context
Output Parameters:
func- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRDCPreCheck()ctx- [optional] context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepchanged- output, flag indicatingYhas been changed by the pre-checkctx- the optional application context
Level: intermediate
See also: SNES, SNESNEWTONTRDC, SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCGetPreCheck
PETSc.LibPETSc.SNESNewtonTRDCGetRhoFlag — Method
rho_flag::PetscBool = SNESNewtonTRDCGetRhoFlag(petsclib::PetscLibType, snes::AbstractSNES)Get whether the current solution update is within the trust-region.
Logically Collective
Input Parameter:
snes- the nonlinear solver object
Output Parameter:
rho_flag-PETSC_FALSEorPETSC_TRUE
Level: developer
See also: SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCGetRhoFlag
PETSc.LibPETSc.SNESNewtonTRDCSetPostCheck — Method
SNESNewtonTRDCSetPostCheck(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{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] context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepW- the tentative new solution valuechanged_y- output, flag indicatedYhas been changed by the post-checkchanged_w- output, flag indicatedWhas been changed by the post-checkctx- the optional application context
Level: intermediate
See also: SNES, SNESNEWTONTRDC, SNESNewtonTRDCPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCSetPostCheck
PETSc.LibPETSc.SNESNewtonTRDCSetPreCheck — Method
SNESNewtonTRDCSetPreCheck(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{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] application context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepchanged- output, flag indicatingYhas been changed by the pre-checkctx- the optional application context
Level: intermediate
See also: SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCGetRhoFlag()
External Links
- PETSc Manual:
SNES/SNESNewtonTRDCSetPreCheck
PETSc.LibPETSc.SNESNewtonTRGetPostCheck — Method
SNESNewtonTRGetPostCheck(petsclib::PetscLibType, snes::AbstractSNES, noname::Ptr{Cvoid})Gets the post-check function
Not Collective
Input Parameter:
snes- the nonlinear solver context
Output Parameters:
func- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRPostCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepW- the tentative new solution valuechanged_Y- output, flag indicatedYhas been changed by the post-checkchanged_W- output, flag indicatedWhas been changed by the post-checkctx- the optional application context
Level: intermediate
See also: SNESNEWTONTR, SNESNewtonTRSetPostCheck(), SNESNewtonTRPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRGetPostCheck
PETSc.LibPETSc.SNESNewtonTRGetPreCheck — Method
SNESNewtonTRGetPreCheck(petsclib::PetscLibType, snes::AbstractSNES, noname::Ptr{Cvoid})Gets the pre-check function
Not Collective
Input Parameter:
snes- the nonlinear solver context
Output Parameters:
func- [optional] function evaluation routine, for the calling sequence seeSNESNewtonTRPreCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepchanged- output, flag indicatingYhas been changed by the pre-checkctx- the optional application context
Level: intermediate
See also: SNESNEWTONTR, SNESNewtonTRSetPreCheck(), SNESNewtonTRPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRGetPreCheck
PETSc.LibPETSc.SNESNewtonTRGetTolerances — Method
delta_min::PetscReal,delta_max::PetscReal,delta_0::PetscReal = SNESNewtonTRGetTolerances(petsclib::PetscLibType, snes::AbstractSNES)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
See also: 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::AbstractSNES)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
See also: SNES, SNESNEWTONTR, SNESNewtonTRSetUpdateParameters()
External Links
- PETSc Manual:
SNES/SNESNewtonTRGetUpdateParameters
PETSc.LibPETSc.SNESNewtonTRPostCheck — Method
changed_Y::PetscBool,changed_W::PetscBool = SNESNewtonTRPostCheck(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, Y::AbstractPetscVec, W::AbstractPetscVec)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.
See also: SNESNEWTONTR, SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRPostCheck
PETSc.LibPETSc.SNESNewtonTRPreCheck — Method
changed_Y::PetscBool = SNESNewtonTRPreCheck(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, Y::AbstractPetscVec)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
See also: SNESNEWTONTR, SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRPreCheck
PETSc.LibPETSc.SNESNewtonTRSetFallbackType — Method
SNESNewtonTRSetFallbackType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetFallbackType
PETSc.LibPETSc.SNESNewtonTRSetNormType — Method
SNESNewtonTRSetNormType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESNEWTONTR, NormType
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetNormType
PETSc.LibPETSc.SNESNewtonTRSetPostCheck — Method
SNESNewtonTRSetPostCheck(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{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)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepW- the tentative new solution valuechanged_Y- output, flag indicatedYhas been changed by the post-checkchanged_W- output, flag indicatedWhas been changed by the post-checkctx- the optional application context
Level: intermediate
See also: SNESNEWTONTR, SNESNewtonTRPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetPostCheck
PETSc.LibPETSc.SNESNewtonTRSetPreCheck — Method
SNESNewtonTRSetPreCheck(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{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)
Calling sequence of func:
snes- the nonlinear solver objectX- the current solution valueY- the tentative update stepchanged- output, flag indicatingYhas been changed by the pre-checkctx- the optional application context
Level: intermediate
See also: SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetPreCheck
PETSc.LibPETSc.SNESNewtonTRSetQNType — Method
SNESNewtonTRSetQNType(petsclib::PetscLibType, snes::AbstractSNES, use::SNESNewtonTRQNType)Specify to use a quasi-Newton model.
Input Parameters:
snes- the nonlinear solver objectuse- the type of approximations to be used
Level: intermediate
See also: SNESNEWTONTR, SNESNewtonTRQNType, MATLMVM
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetQNType
PETSc.LibPETSc.SNESNewtonTRSetTolerances — Method
SNESNewtonTRSetTolerances(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESNEWTONTR, SNESNewtonTRGetTolerances()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetTolerances
PETSc.LibPETSc.SNESNewtonTRSetUpdateParameters — Method
SNESNewtonTRSetUpdateParameters(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESNEWTONTR, SNESSetObjective(), SNESNewtonTRGetUpdateParameters()
External Links
- PETSc Manual:
SNES/SNESNewtonTRSetUpdateParameters
PETSc.LibPETSc.SNESObjectiveComputeFunctionDefaultFD — Method
SNESObjectiveComputeFunctionDefaultFD(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, F::AbstractPetscVec, ctx::Ptr{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
See also: SNESSetObjective(), SNESSetFunction(), SNESComputeObjective(), SNESComputeJacobianDefault(), SNESObjectiveFn
External Links
- PETSc Manual:
SNES/SNESObjectiveComputeFunctionDefaultFD
PETSc.LibPETSc.SNESParametersInitialize — Method
SNESParametersInitialize(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian(), PetscObjectParameterSetDefault()
External Links
- PETSc Manual:
SNES/SNESParametersInitialize
PETSc.LibPETSc.SNESPatchSetCellNumbering — Method
SNESPatchSetCellNumbering(petsclib::PetscLibType, snes::AbstractSNES, cellNumbering::PetscSection)Set the PetscSection that provides a numbering of the cells used to define patches in a SNESPATCH solver
Logically Collective
Input Parameters:
snes- theSNESPATCHsolvercellNumbering- thePetscSectiongiving the cell numbering; forwarded to the underlyingPCPATCHviaPCPatchSetCellNumbering()
Level: advanced
See also: SNESPATCH, PCPATCH, PCPatchSetCellNumbering(), PetscSection
External Links
- PETSc Manual:
SNES/SNESPatchSetCellNumbering
PETSc.LibPETSc.SNESPatchSetComputeFunction — Method
SNESPatchSetComputeFunction(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{Cvoid})Set the callback used to compute the per-patch nonlinear residual for a SNESPATCH solver
Logically Collective
Input Parameters:
snes- theSNESPATCHsolverfunc- callback that computes the patch residual; forwarded to the underlyingPCPATCHviaPCPatchSetComputeFunction()ctx- optional application context passed tofunc
Calling sequence of func:
pc- thePCassociated with theSNESPATCHsolverpoint- the pointx- the input solution (not used in linear problems)f- the patch residual vectorcellIS- an array of the cell numbersn- the size ofdofsArraydofsArray- the dofmap for the dofs to be solved fordofsArrayWithAll- the dofmap for all dofs on the patchctx- the application context
Level: advanced
See also: SNESPATCH, PCPATCH, PCPatchSetComputeFunction(), SNESPatchSetComputeOperator()
External Links
- PETSc Manual:
SNES/SNESPatchSetComputeFunction
PETSc.LibPETSc.SNESPatchSetComputeOperator — Method
SNESPatchSetComputeOperator(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{Cvoid})Set the callback used to assemble the per-patch Jacobian for a SNESPATCH solver
Logically Collective
Input Parameters:
snes- theSNESPATCHsolverfunc- callback that assembles the patch Jacobian; forwarded to the underlyingPCPATCHviaPCPatchSetComputeOperator()ctx- optional application context passed tofunc
Calling sequence of func:
pc- thePCassociated with theSNESPATCHsolverpoint- the pointx- the input solution (not used in linear problems)mat- the patch matrixcellIS- an array of the cell numbersn- the size ofdofsArraydofsArray- the dofmap for the dofs to be solved fordofsArrayWithAll- the dofmap for all dofs on the patchctx- the application context
Level: advanced
See also: SNESPATCH, PCPATCH, PCPatchSetComputeOperator(), SNESPatchSetComputeFunction()
External Links
- PETSc Manual:
SNES/SNESPatchSetComputeOperator
PETSc.LibPETSc.SNESPatchSetConstructType — Method
SNESPatchSetConstructType(petsclib::PetscLibType, snes::AbstractSNES, ctype::PCPatchConstructType, func::external, ctx::Ptr{Cvoid})Set the way patches are constructed for a SNESPATCH solver
Logically Collective
Input Parameters:
snes- theSNESPATCHsolverctype- thePCPatchConstructTypeselecting the patch construction strategyfunc- user callback that builds the patches, used only whenctypeisPC_PATCH_USERorPC_PATCH_PYTHON; may beNULLotherwisectx- optional application context passed tofunc
Calling sequence of func:
pc- thePCassociated with theSNESPATCHsolvernpatch- number of patchespatches- theISthat define each patchpatchIterationSet- how the patches are iterated overctx- optional application context
Level: advanced
See also: SNESPATCH, PCPATCH, PCPatchSetConstructType(), PCPatchConstructType
External Links
- PETSc Manual:
SNES/SNESPatchSetConstructType
PETSc.LibPETSc.SNESPatchSetDiscretisationInfo — Method
SNESPatchSetDiscretisationInfo(petsclib::PetscLibType, snes::AbstractSNES, nsubspaces::PetscInt, dms::Vector{<:AbstractPetscDM}, bs::Vector{PetscInt}, nodesPerCell::Vector{PetscInt}, cellNodeMap::PetscInt, subspaceOffsets::Vector{PetscInt}, numGhostBcs::PetscInt, ghostBcNodes::Vector{PetscInt}, numGlobalBcs::PetscInt, globalBcNodes::Vector{PetscInt})Provide the per-subspace discretisation information required by a SNESPATCH to build patch problems
Logically Collective
Input Parameters:
snes- theSNESPATCHsolvernsubspaces- the number of discretisation subspaces (e.g. fields)dms- array of lengthnsubspacesofDMs, one per subspacebs- array of lengthnsubspacesgiving the block size of each subspacenodesPerCell- array of lengthnsubspacesgiving the number of nodes per cell for each subspacecellNodeMap- array of lengthnsubspaces; entryiis a cell-to-node map for subspaceisubspaceOffsets- array of lengthnsubspaces + 1giving the starting global dof offset of each subspacenumGhostBcs- number of ghost (off-process) boundary-condition dofsghostBcNodes- array of lengthnumGhostBcsof the ghost boundary-condition dof indicesnumGlobalBcs- number of global boundary-condition dofsglobalBcNodes- array of lengthnumGlobalBcsof the global boundary-condition dof indices
Level: advanced
See also: SNESPATCH, PCPATCH, PCPatchSetDiscretisationInfo(), SNESPatchSetComputeOperator(), SNESPatchSetComputeFunction()
External Links
- PETSc Manual:
SNES/SNESPatchSetDiscretisationInfo
PETSc.LibPETSc.SNESPicardComputeFunction — Method
SNESPicardComputeFunction(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec, f::AbstractPetscVec, ctx::Ptr{Cvoid})Compute the residual A(x) x - b(x) using the callbacks registered by SNESSetPicard()
Collective
Input Parameters:
snes- theSNEScontextx- the current iteratectx- unused application context; the Picard callbacks are retrieved from the attachedDMSNES
Output Parameter:
f- the residual vector
Level: developer
See also: SNES, SNESSetPicard(), SNESPicardComputeMFFunction(), SNESPicardComputeJacobian()
External Links
- PETSc Manual:
SNES/SNESPicardComputeFunction
PETSc.LibPETSc.SNESPicardComputeJacobian — Method
SNESPicardComputeJacobian(petsclib::PetscLibType, snes::AbstractSNES, x1::AbstractPetscVec, J::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{Cvoid})Trivial Jacobian assembly callback used by SNESSetPicard(); the Picard operator is filled in by SNESPicardComputeFunction()
Collective
Input Parameters:
snes- theSNEScontextx1- the current iterate (unused)J- the Jacobian matrix to assembleB- the preconditioning matrix (unused)ctx- unused application context
Level: developer
See also: SNES, SNESSetPicard(), SNESPicardComputeFunction(), SNESPicardComputeMFFunction()
External Links
- PETSc Manual:
SNES/SNESPicardComputeJacobian
PETSc.LibPETSc.SNESPicardComputeMFFunction — Method
SNESPicardComputeMFFunction(petsclib::PetscLibType, snes::AbstractSNES, x::AbstractPetscVec, f::AbstractPetscVec, ctx::Ptr{Cvoid})Matrix-free residual A(x) x - b(x) used by SNESSetPicard() when the operator is applied through -snes_mf_operator
Collective
Input Parameters:
snes- theSNEScontextx- the current iteratectx- unused application context; the Picard callbacks are retrieved from the attachedDMSNES
Output Parameter:
f- the residual vector
Level: developer
See also: SNES, SNESSetPicard(), SNESPicardComputeFunction(), SNESPicardComputeJacobian()
External Links
- PETSc Manual:
SNES/SNESPicardComputeMFFunction
PETSc.LibPETSc.SNESPruneJacobianColor — Method
SNESPruneJacobianColor(petsclib::PetscLibType, snes::AbstractSNES, J::AbstractPetscMat, B::AbstractPetscMat)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
See also: SNESComputeJacobianDefaultColor(), MatEliminateZeros(), MatFDColoringCreate(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
SNES/SNESPruneJacobianColor
PETSc.LibPETSc.SNESPythonGetType — Method
pyname::String = SNESPythonGetType(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonSetType()
External Links
- PETSc Manual:
SNES/SNESPythonGetType
PETSc.LibPETSc.SNESPythonSetType — Method
SNESPythonSetType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonGetType()
External Links
- PETSc Manual:
SNES/SNESPythonSetType
PETSc.LibPETSc.SNESQNSetRestartType — Method
SNESQNSetRestartType(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: 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::AbstractSNES, 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
See also: SNES, SNESQN, SNESLineSearch, SNESQNScaleType, SNESSetJacobian(), SNESQNType, SNESQNRestartType
External Links
- PETSc Manual:
SNES/SNESQNSetScaleType
PETSc.LibPETSc.SNESQNSetType — Method
SNESQNSetType(petsclib::PetscLibType, snes::AbstractSNES, qtype::SNESQNType)Sets the quasi-Newton variant to be used in SNESQN.
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
See also: 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
See also: SNESRegisterAll(), SNESRegisterDestroy()
External Links
- PETSc Manual:
SNES/SNESRegister
PETSc.LibPETSc.SNESReset — Method
SNESReset(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESDestroy(), SNESCreate(), SNESSetUp(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESReset
PETSc.LibPETSc.SNESResetCounters — Method
SNESResetCounters(petsclib::PetscLibType, snes::AbstractSNES)Reset counters for linear iterations and function evaluations.
Logically Collective
Input Parameters:
snes-SNEScontext
Level: developer
See also: SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESResetCounters
PETSc.LibPETSc.SNESResetFromOptions — Method
SNESResetFromOptions(petsclib::PetscLibType, snes::AbstractSNES)Sets various SNES and KSP parameters from user options ONLY if the SNESSetFromOptions() was previously called
Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
See also: SNES, SNESSetFromOptions(), SNESSetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESResetFromOptions
PETSc.LibPETSc.SNESSetAlwaysComputesFinalResidual — Method
SNESSetAlwaysComputesFinalResidual(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESFAS, SNESSolve(), SNESGetAlwaysComputesFinalResidual()
External Links
- PETSc Manual:
SNES/SNESSetAlwaysComputesFinalResidual
PETSc.LibPETSc.SNESSetApplicationContext — Method
SNESSetApplicationContext(petsclib::PetscLibType, snes::AbstractSNES, ctx::Ptr{Cvoid})Sets the optional user-defined context for the nonlinear solvers.
Logically Collective
Input Parameters:
snes- theSNEScontextctx- the application context
Level: intermediate
See also: SNES, SNESSetComputeApplicationContext(), SNESGetApplicationContext()
External Links
- PETSc Manual:
SNES/SNESSetApplicationContext
PETSc.LibPETSc.SNESSetCheckJacobianDomainError — Method
SNESSetCheckJacobianDomainError(petsclib::PetscLibType, snes::AbstractSNES, flg::PetscBool)tells SNESSolve() whether to check if the user called SNESSetJacobianDomainError() to indicate a Jacobian domain error after each Jacobian evaluation.
Logically Collective
Input Parameters:
snes- theSNEScontextflg- indicates if or not to check Jacobian domain error after each Jacobian evaluation
Level: advanced
See also: SNES, SNESConvergedReason, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESGetCheckJacobianDomainError()
External Links
- PETSc Manual:
SNES/SNESSetCheckJacobianDomainError
PETSc.LibPETSc.SNESSetComputeApplicationContext — Method
SNESSetComputeApplicationContext(petsclib::PetscLibType, snes::AbstractSNES, compute::external, destroy::Ptr{Cvoid})Sets an optional function to compute a user-defined context for 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
See also: SNESGetApplicationContext(), SNESSetApplicationContext(), PetscCtxDestroyFn
External Links
- PETSc Manual:
SNES/SNESSetComputeApplicationContext
PETSc.LibPETSc.SNESSetComputeInitialGuess — Method
SNESSetComputeInitialGuess(petsclib::PetscLibType, snes::AbstractSNES, func::Ptr{Cvoid}, ctx::Ptr{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
See also: SNES, SNESSolve(), SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESInitialGuessFn
External Links
- PETSc Manual:
SNES/SNESSetComputeInitialGuess
PETSc.LibPETSc.SNESSetConvergedReason — Method
SNESSetConvergedReason(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESGetConvergedReason(), SNESSetConvergenceTest(), SNESConvergedReason
External Links
- PETSc Manual:
SNES/SNESSetConvergedReason
PETSc.LibPETSc.SNESSetConvergenceHistory — Method
SNESSetConvergenceHistory(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSolve(), SNESGetConvergenceHistory()
External Links
- PETSc Manual:
SNES/SNESSetConvergenceHistory
PETSc.LibPETSc.SNESSetConvergenceTest — Method
SNESSetConvergenceTest(petsclib::PetscLibType, snes::AbstractSNES, func::external, ctx::Ptr{Cvoid}, destroy::Ptr{Cvoid})Sets the function that is to be used to test for convergence of the nonlinear iterative solution.
Logically Collective
Input Parameters:
snes- theSNEScontextfunc- routine to test for convergencectx- [optional] context for private data for the convergence routine (may beNULL)destroy- [optional] destructor for the context (may beNULL;PETSC_NULL_FUNCTIONin Fortran)
Calling sequence of func:
snes- theSNEScontextit- the current iteration numberxnorm- the norm of the new solutionsnorm- the norm of the stepfnorm- the norm of the function valuereason- output, the reason convergence or divergence as declaredctx- the optional convergence test context
Level: advanced
See also: SNES, SNESConvergedDefault(), SNESConvergedSkip()
External Links
- PETSc Manual:
SNES/SNESSetConvergenceTest
PETSc.LibPETSc.SNESSetCountersReset — Method
SNESSetCountersReset(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESSetCountersReset
PETSc.LibPETSc.SNESSetDM — Method
SNESSetDM(petsclib::PetscLibType, snes::AbstractSNES, dm::AbstractPetscDM)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
See also: DM, SNES, SNESGetDM(), KSPSetDM(), KSPGetDM()
External Links
- PETSc Manual:
SNES/SNESSetDM
PETSc.LibPETSc.SNESSetDivergenceTolerance — Method
SNESSetDivergenceTolerance(petsclib::PetscLibType, snes::AbstractSNES, 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) \ge divtol * F(x^0) the solver
is stopped due to divergence.
Options Database Key:
-snes_divergence_tolerance divtol- Setsdivtol
Level: intermediate
See also: SNES, SNESSolve(), SNESSetTolerances(), SNESGetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESSetDivergenceTolerance
PETSc.LibPETSc.SNESSetErrorIfNotConverged — Method
SNESSetErrorIfNotConverged(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESGetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()
External Links
- PETSc Manual:
SNES/SNESSetErrorIfNotConverged
PETSc.LibPETSc.SNESSetForceIteration — Method
SNESSetForceIteration(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, TS, SNESSetDivergenceTolerance()
External Links
- PETSc Manual:
SNES/SNESSetForceIteration
PETSc.LibPETSc.SNESSetFromOptions — Method
SNESSetFromOptions(petsclib::PetscLibType, snes::AbstractSNES)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. correctpressure SNESConvergedCorrectPressure() 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 draw::draw_lg- plots residual norm at each iteration-snes_monitor_lg_range- plots function range 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 [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
See also: SNESType, SNESSetOptionsPrefix(), SNESResetFromOptions(), SNES, SNESCreate(), MatCreateSNESMF(), MatFDColoring
External Links
- PETSc Manual:
SNES/SNESSetFromOptions
PETSc.LibPETSc.SNESSetFunction — Method
SNESSetFunction(petsclib::PetscLibType, snes::AbstractSNES, r::AbstractPetscVec, f::Ptr{Cvoid}, ctx::Ptr{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
See also: SNES, SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetPicard(), SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESSetFunction
PETSc.LibPETSc.SNESSetFunctionDomainError — Method
SNESSetFunctionDomainError(petsclib::PetscLibType, snes::AbstractSNES)tells SNES that the input vector, a proposed new solution, to your function you provided to SNESSetFunction() is not in the function's domain. For example, a step with negative pressure.
Not Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
See also: SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetJacobianDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason(), SNES_DIVERGED_FUNCTION_DOMAIN, SNESSetObjectiveDomainError(), SNES_DIVERGED_OBJECTIVE_DOMAIN
External Links
- PETSc Manual:
SNES/SNESSetFunctionDomainError
PETSc.LibPETSc.SNESSetFunctionNorm — Method
SNESSetFunctionNorm(petsclib::PetscLibType, snes::AbstractSNES, norm::PetscReal)Sets the last computed residual norm.
Logically Collective
Input Parameters:
snes- theSNEScontextnorm- the value of the norm
Level: developer
See also: SNES, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESSetFunctionNorm
PETSc.LibPETSc.SNESSetFunctionType — Method
SNESSetFunctionType(petsclib::PetscLibType, snes::AbstractSNES, 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()
See also: SNES, SNESFunctionType, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule
External Links
- PETSc Manual:
SNES/SNESSetFunctionType
PETSc.LibPETSc.SNESSetGridSequence — Method
SNESSetGridSequence(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetGridSequence(), SNESSetDM(), SNESSolve()
External Links
- PETSc Manual:
SNES/SNESSetGridSequence
PETSc.LibPETSc.SNESSetInitialFunction — Method
SNESSetInitialFunction(petsclib::PetscLibType, snes::AbstractSNES, f::AbstractPetscVec)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
See also: SNES, SNESFAS, SNESSetFunction(), SNESComputeFunction(), SNESSetInitialFunctionNorm()
External Links
- PETSc Manual:
SNES/SNESSetInitialFunction
PETSc.LibPETSc.SNESSetIterationNumber — Method
SNESSetIterationNumber(petsclib::PetscLibType, snes::AbstractSNES, iter::PetscInt)Sets the current iteration number.
Not Collective
Input Parameters:
snes-SNEScontextiter- iteration number
Level: developer
See also: SNESGetLinearSolveIterations()
External Links
- PETSc Manual:
SNES/SNESSetIterationNumber
PETSc.LibPETSc.SNESSetJacobian — Method
SNESSetJacobian(petsclib::PetscLibType, snes::AbstractSNES, Amat::AbstractPetscMat, Pmat::AbstractPetscMat, J::Ptr{Cvoid}, ctx::Ptr{Cvoid})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
See also: SNES, KSPSetOperators(), SNESSetFunction(), MatMFFDComputeJacobian(), SNESComputeJacobianDefaultColor(), MatStructure, SNESSetPicard(), SNESJacobianFn, SNESFunctionFn
External Links
- PETSc Manual:
SNES/SNESSetJacobian
PETSc.LibPETSc.SNESSetJacobianDomainError — Method
SNESSetJacobianDomainError(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason()
External Links
- PETSc Manual:
SNES/SNESSetJacobianDomainError
PETSc.LibPETSc.SNESSetKSP — Method
SNESSetKSP(petsclib::PetscLibType, snes::AbstractSNES, ksp::AbstractKSP)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
See also: SNES, KSP, KSPGetPC(), SNESCreate(), KSPCreate()
External Links
- PETSc Manual:
SNES/SNESSetKSP
PETSc.LibPETSc.SNESSetLagJacobian — Method
SNESSetLagJacobian(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESGetLagPreconditioner(), SNESSetLagPreconditioner(), SNESGetLagJacobianPersists(), SNESSetLagPreconditionerPersists()
External Links
- PETSc Manual:
SNES/SNESSetLagJacobian
PETSc.LibPETSc.SNESSetLagJacobianPersists — Method
SNESSetLagJacobianPersists(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSetLagPreconditionerPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC()
External Links
- PETSc Manual:
SNES/SNESSetLagJacobianPersists
PETSc.LibPETSc.SNESSetLagPreconditioner — Method
SNESSetLagPreconditioner(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetLagPreconditionerPersists(), SNESSetLagJacobianPersists(), SNES, SNESSolve()
External Links
- PETSc Manual:
SNES/SNESSetLagPreconditioner
PETSc.LibPETSc.SNESSetLagPreconditionerPersists — Method
SNESSetLagPreconditionerPersists(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSetLagJacobianPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC(), SNESSetLagPreconditioner()
External Links
- PETSc Manual:
SNES/SNESSetLagPreconditionerPersists
PETSc.LibPETSc.SNESSetLineSearch — Method
SNESSetLineSearch(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESLineSearch, SNESGetLineSearch()
External Links
- PETSc Manual:
SNES/SNESSetLineSearch
PETSc.LibPETSc.SNESSetMaxLinearSolveFailures — Method
SNESSetMaxLinearSolveFailures(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations()
External Links
- PETSc Manual:
SNES/SNESSetMaxLinearSolveFailures
PETSc.LibPETSc.SNESSetMaxNonlinearStepFailures — Method
SNESSetMaxNonlinearStepFailures(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESGetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures(), SNESCheckLineSearchFailure()
External Links
- PETSc Manual:
SNES/SNESSetMaxNonlinearStepFailures
PETSc.LibPETSc.SNESSetNGS — Method
SNESSetNGS(petsclib::PetscLibType, snes::AbstractSNES, f::Ptr{Cvoid}, ctx::Ptr{Cvoid})Sets the user nonlinear Gauss-Seidel routine for 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
See also: SNESNGS, SNESGetNGS(), SNESNCG, SNESGetFunction(), SNESComputeNGS(), SNESNGSFn
External Links
- PETSc Manual:
SNES/SNESSetNGS
PETSc.LibPETSc.SNESSetNPC — Method
SNESSetNPC(petsclib::PetscLibType, snes::AbstractSNES, npc::AbstractSNES)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
See also: SNES, SNESNGS, SNESFAS, SNESGetNPC(), SNESHasNPC()
External Links
- PETSc Manual:
SNES/SNESSetNPC
PETSc.LibPETSc.SNESSetNPCSide — Method
SNESSetNPCSide(petsclib::PetscLibType, snes::AbstractSNES, 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
$PC_LEFT - left preconditioning PC_RIGHT - right preconditioning (default for most nonlinear solvers)$
Options Database Key:
-snes_npc_side (right|left)- nonlinear preconditioner side
Level: intermediate
See also: 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::AbstractSNES, 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
See also: SNESNormSchedule, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction()
External Links
- PETSc Manual:
SNES/SNESSetNormSchedule
PETSc.LibPETSc.SNESSetObjective — Method
SNESSetObjective(petsclib::PetscLibType, snes::AbstractSNES, obj::Ptr{Cvoid}, ctx::Ptr{Cvoid})Sets the objective function minimized by some of the SNES linesearch methods, used instead of the 2-norm of the residual in the line search
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
See also: SNES, SNESLineSearch(), SNESGetObjective(), SNESComputeObjective(), SNESSetFunction(), SNESSetJacobian(), SNESObjectiveFn, SNESSetObjectiveDomainError()
External Links
- PETSc Manual:
SNES/SNESSetObjective
PETSc.LibPETSc.SNESSetObjectiveDomainError — Method
SNESSetObjectiveDomainError(petsclib::PetscLibType, snes::AbstractSNES)tells SNES that the input vector, a proposed new solution, to your function you provided to SNESSetObjective() is not in the function's domain. For example, a step with negative pressure.
Not Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
See also: SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetJacobianDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason(), SNES_DIVERGED_OBJECTIVE_DOMAIN, SNESSetFunctionDomainError(), SNES_DIVERGED_FUNCTION_DOMAIN
External Links
- PETSc Manual:
SNES/SNESSetObjectiveDomainError
PETSc.LibPETSc.SNESSetOptionsPrefix — Method
SNESSetOptionsPrefix(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSetFromOptions(), SNESAppendOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESSetOptionsPrefix
PETSc.LibPETSc.SNESSetPicard — Method
SNESSetPicard(petsclib::PetscLibType, snes::AbstractSNES, r::AbstractPetscVec, bp::Ptr{Cvoid}, Amat::AbstractPetscMat, Pmat::AbstractPetscMat, J::Ptr{Cvoid}, ctx::Ptr{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
See also: SNES, SNESGetFunction(), SNESSetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESGetPicard(), SNESLineSearchPreCheckPicard(), SNESFunctionFn, SNESJacobianFn
External Links
- PETSc Manual:
SNES/SNESSetPicard
PETSc.LibPETSc.SNESSetSolution — Method
SNESSetSolution(petsclib::PetscLibType, snes::AbstractSNES, u::AbstractPetscVec)Sets the solution vector for use by the SNES routines.
Logically Collective
Input Parameters:
snes- theSNEScontext obtained fromSNESCreate()u- the solution vector
Level: beginner
See also: SNES, SNESSolve(), SNESGetSolution(), Vec
External Links
- PETSc Manual:
SNES/SNESSetSolution
PETSc.LibPETSc.SNESSetTolerances — Method
SNESSetTolerances(petsclib::PetscLibType, snes::AbstractSNES, 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) \le abstolrtol- the relative convergence tolerance, F(x^n) \le 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
See also: SNESSolve(), SNES, SNESSetDivergenceTolerance(), SNESSetForceIteration()
External Links
- PETSc Manual:
SNES/SNESSetTolerances
PETSc.LibPETSc.SNESSetType — Method
SNESSetType(petsclib::PetscLibType, snes::AbstractSNES, type::String)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; seeSNESType
Level: intermediate
See also: SNES, SNESSolve(), SNESType, SNESCreate(), SNESDestroy(), SNESGetType(), SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESSetType
PETSc.LibPETSc.SNESSetUp — Method
SNESSetUp(petsclib::PetscLibType, snes::AbstractSNES)Sets up the internal data structures for the later use of a nonlinear solver SNESSolve().
Collective
Input Parameter:
snes- theSNEScontext
Level: advanced
See also: SNES, SNESCreate(), SNESSolve(), SNESDestroy(), SNESSetFromOptions()
External Links
- PETSc Manual:
SNES/SNESSetUp
PETSc.LibPETSc.SNESSetUpMatrices — Method
SNESSetUpMatrices(petsclib::PetscLibType, snes::AbstractSNES)ensures that matrices are available for SNES Newton-like methods, this is called by SNESSetUp_XXX()
Collective
Input Parameter:
snes-SNESobject to configure
Level: developer
See also: SNES, SNESSetUp()
External Links
- PETSc Manual:
SNES/SNESSetUpMatrices
PETSc.LibPETSc.SNESSetUpdate — Method
SNESSetUpdate(petsclib::PetscLibType, snes::AbstractSNES, func::Ptr{Cvoid})Sets the general-purpose update function called 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
See also: SNES, SNESSolve(), SNESSetJacobian(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESMonitorSet()
External Links
- PETSc Manual:
SNES/SNESSetUpdate
PETSc.LibPETSc.SNESSetUseMatrixFree — Method
SNESSetUseMatrixFree(petsclib::PetscLibType, snes::AbstractSNES, mf_operator::PetscBool, mf::PetscBool)indicates that SNES should use matrix-free finite difference matrix-vector products to apply the Jacobian.
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
See also: SNES, SNESGetUseMatrixFree(), MatCreateSNESMF(), SNESComputeJacobianDefaultColor(), MatFDColoring
External Links
- PETSc Manual:
SNES/SNESSetUseMatrixFree
PETSc.LibPETSc.SNESSetWorkVecs — Method
SNESSetWorkVecs(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES
External Links
- PETSc Manual:
SNES/SNESSetWorkVecs
PETSc.LibPETSc.SNESShellGetContext — Method
ctx::Ptr{Cvoid} = SNESShellGetContext(petsclib::PetscLibType, snes::AbstractSNES)Returns the user-provided context associated with a SNESSHELL
Not Collective
Input Parameter:
snes- should have been created withSNESSetType(snes,SNESSHELL);
Output Parameter:
ctx- the user provided context
Level: advanced
See also: SNES, SNESSHELL, SNESCreateShell(), SNESShellSetContext()
External Links
- PETSc Manual:
SNES/SNESShellGetContext
PETSc.LibPETSc.SNESShellSetContext — Method
SNESShellSetContext(petsclib::PetscLibType, snes::AbstractSNES, ctx::Ptr{Cvoid})sets the context for a SNESSHELL
Logically Collective
Input Parameters:
snes- theSNESSHELLctx- the context
Level: advanced
See also: SNES, SNESSHELL, SNESCreateShell(), SNESShellGetContext()
External Links
- PETSc Manual:
SNES/SNESShellSetContext
PETSc.LibPETSc.SNESShellSetSolve — Method
SNESShellSetSolve(petsclib::PetscLibType, snes::AbstractSNES, 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
See also: SNES, SNESSHELL, SNESShellSetContext(), SNESShellGetContext()
External Links
- PETSc Manual:
SNES/SNESShellSetSolve
PETSc.LibPETSc.SNESSolve — Method
SNESSolve(petsclib::PetscLibType, snes::AbstractSNES, b::Union{Ptr, AbstractPetscVec}, x::AbstractPetscVec)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
See also: 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::AbstractSNES, U::AbstractPetscVec, F::AbstractPetscVec, ctx::Ptr{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- application context, must be aTS
Output Parameter:
F- the nonlinear residual
Level: developer
See also: SNESSetFunction(), MatFDColoringSetFunction()
External Links
- PETSc Manual:
TS/SNESTSFormFunction
PETSc.LibPETSc.SNESTSFormJacobian — Method
SNESTSFormJacobian(petsclib::PetscLibType, snes::AbstractSNES, U::AbstractPetscVec, A::AbstractPetscMat, B::AbstractPetscMat, ctx::Ptr{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- application context, must be aTS
Output Parameters:
A- the JacobianB- the matrix used to construct the preconditioner (often the same asA)
Level: developer
See also: SNESSetJacobian()
External Links
- PETSc Manual:
TS/SNESTSFormJacobian
PETSc.LibPETSc.SNESTestFunction — Method
SNESTestFunction(petsclib::PetscLibType, snes::AbstractSNES)Computes the difference between the computed and finite-difference functions
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
See also: SNESTestJacobian(), SNESSetFunction(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESTestFunction
PETSc.LibPETSc.SNESTestJacobian — Method
Jnorm::PetscReal,diffNorm::PetscReal = SNESTestJacobian(petsclib::PetscLibType, snes::AbstractSNES)Computes the difference between the computed and finite-difference Jacobians
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 [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
See also: SNESTestFunction(), SNESSetJacobian(), SNESComputeJacobian()
External Links
- PETSc Manual:
SNES/SNESTestJacobian
PETSc.LibPETSc.SNESTestLocalMin — Method
SNESTestLocalMin(petsclib::PetscLibType, snes::AbstractSNES)Diagnostic that probes each entry of the current SNES solution to check whether the residual norm has a local minimum along the coordinate directions
Collective
Input Parameter:
snes- theSNEScontext
Level: developer
See also: SNES, SNESSolve(), SNESComputeFunction()
External Links
- PETSc Manual:
SNES/SNESTestLocalMin
PETSc.LibPETSc.SNESVIComputeFunction — Method
SNESVIComputeFunction(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, phi::AbstractPetscVec, functx::Ptr{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
See also: SNES, SNESVINEWTONSSLS, SNESVIComputeMeritFunction()
External Links
- PETSc Manual:
SNES/SNESVIComputeFunction
PETSc.LibPETSc.SNESVIComputeInactiveSetFnorm — Method
fnorm::PetscReal = SNESVIComputeInactiveSetFnorm(petsclib::PetscLibType, snes::AbstractSNES, F::AbstractPetscVec, X::AbstractPetscVec)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
See also: SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESLineSearchSetVIFunctions()
External Links
- PETSc Manual:
SNES/SNESVIComputeInactiveSetFnorm
PETSc.LibPETSc.SNESVIComputeInactiveSetFtY — Method
fty::PetscScalar = SNESVIComputeInactiveSetFtY(petsclib::PetscLibType, snes::AbstractSNES, F::AbstractPetscVec, X::AbstractPetscVec, Y::AbstractPetscVec)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
See also: SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS
External Links
- PETSc Manual:
SNES/SNESVIComputeInactiveSetFtY
PETSc.LibPETSc.SNESVIComputeMeritFunction — Method
merit::PetscReal,phinorm::PetscReal = SNESVIComputeMeritFunction(petsclib::PetscLibType, phi::AbstractPetscVec)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
See also: SNES, SNESVINEWTONSSLS, SNESVIComputeFunction()
External Links
- PETSc Manual:
SNES/SNESVIComputeMeritFunction
PETSc.LibPETSc.SNESVIGetActiveSetIS — Method
ISact::IS = SNESVIGetActiveSetIS(petsclib::PetscLibType, snes::AbstractSNES, X::AbstractPetscVec, F::AbstractPetscVec)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
See also: SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS
External Links
- PETSc Manual:
SNES/SNESVIGetActiveSetIS
PETSc.LibPETSc.SNESVIGetInactiveSet — Method
inact::IS = SNESVIGetInactiveSet(petsclib::PetscLibType, snes::AbstractSNES)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
See also: SNES, SNESVINEWTONRSLS
External Links
- PETSc Manual:
SNES/SNESVIGetInactiveSet
PETSc.LibPETSc.SNESVIGetVariableBounds — Method
SNESVIGetVariableBounds(petsclib::PetscLibType, snes::AbstractSNES, xl::AbstractPetscVec, xu::AbstractPetscVec)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
See also: 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::AbstractSNES, 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
See also: 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::AbstractSNES, func::external, ctx::Ptr{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
Calling sequence of func:
snes- theSNEScontextis_act- the set of points in the active setsis_redact- output, the set of points in the non-redundant active setctx- optional context
Level: advanced
See also: SNES, SNESVINEWTONRSLS, SNESVIGetInactiveSet(), DMSetVI()
External Links
- PETSc Manual:
SNES/SNESVISetRedundancyCheck
PETSc.LibPETSc.SNESVISetVariableBounds — Method
SNESVISetVariableBounds(petsclib::PetscLibType, snes::AbstractSNES, xl::AbstractPetscVec, xu::AbstractPetscVec)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
See also: 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::AbstractSNES, 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
See also: SNES, SNESLoad(), SNESCreate(), PetscViewerASCIIOpen()
External Links
- PETSc Manual:
SNES/SNESView
PETSc.LibPETSc.SNESViewFromOptions — Method
SNESViewFromOptions(petsclib::PetscLibType, A::AbstractSNES, obj, 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
Options Database Key:
-name [viewertype][:...]- option name and values. SeePetscObjectViewFromOptions()for the possible arguments
Level: intermediate
See also: 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
See also: SNES, SNESLineSearch(), SNESLineSearchSetFromOptions(), SNESGetOptionsPrefix()
External Links
- PETSc Manual:
SNES/SNESLineSearchAppendOptionsPrefix
PETSc.LibPETSc.SNESLineSearchApply — Method
fnorm::PetscReal = SNESLineSearchApply(petsclib::PetscLibType, linesearch::SNESLineSearch, X::AbstractPetscVec, F::AbstractPetscVec, Y::AbstractPetscVec)Computes the line-search update.
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 (none|basic|bt|secant|cp|nleqerr|bisection|shell)- Line search type, seeSNESLineSearchType-snes_linesearch_monitor [:filename]- Print progress of line searches-snes_linesearch_damping damping- The linesearch damping parameter, default is 1.0 (no damping)-snes_linesearch_norms (true|false)- Turn on/off the linesearch norms computation (SNESLineSearchSetComputeNorms())-snes_linesearch_keeplambda (true|false)- Keep the previouslambdaas the initial guess-snes_linesearch_max_it it- The number of iterations for iterative line searches
Level: advanced
See also: 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
See also: 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
See also: 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 (true|false)- turn norm computation on or off
Level: intermediate
See also: 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
See also: SNES, SNESLineSearch, LineSearchDestroy(), SNESGetLineSearch()
External Links
- PETSc Manual:
SNES/SNESLineSearchCreate
PETSc.LibPETSc.SNESLineSearchDestroy — Method
SNESLineSearchDestroy(petsclib::PetscLibType, linesearch::Union{SNESLineSearch, Ref{SNESLineSearch}})Destroys the line search instance.
Collective
Input Parameter:
linesearch- The line search context
Level: developer
See also: 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
See also: SNES, SNESLineSearchGetStepTolerance(), SNESQN
External Links
- PETSc Manual:
SNES/SNESLineSearchGetDamping
PETSc.LibPETSc.SNESLineSearchGetDefaultMonitor — Method
monitor::PetscViewer = SNESLineSearchGetDefaultMonitor(petsclib::PetscLibType, linesearch::SNESLineSearch)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
See also: 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
See also: 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
See also: SNES, SNESLineSearch, SNESLineSearchSetNorms(), SNESLineSearchGetVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetNorms
PETSc.LibPETSc.SNESLineSearchGetOptionsPrefix — Method
prefix::String = SNESLineSearchGetOptionsPrefix(petsclib::PetscLibType, linesearch::SNESLineSearch)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
See also: 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
See also: SNES, SNESLineSearch, SNESLineSearchSetOrder()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetOrder
PETSc.LibPETSc.SNESLineSearchGetPostCheck — Method
SNESLineSearchGetPostCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, noname::Ptr{Cvoid})Gets the post-check function for the line search routine.
Input Parameter:
linesearch- theSNESLineSearchcontext
Output Parameters:
func- [optional] function evaluation routine, see for the calling sequenceSNESLineSearchSetPostCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
See also: SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchGetPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetPostCheck
PETSc.LibPETSc.SNESLineSearchGetPreCheck — Method
SNESLineSearchGetPreCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, noname::Ptr{Cvoid})Gets the pre-check function for the line search routine.
Input Parameter:
linesearch- theSNESLineSearchcontext
Output Parameters:
func- [optional] function evaluation routine, for calling sequence seeSNESLineSearchSetPreCheck()ctx- [optional] user-defined context for private data for the function evaluation routine (may beNULL)
Level: intermediate
See also: SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPreCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetPreCheck
PETSc.LibPETSc.SNESLineSearchGetReason — Method
reason::SNESLineSearchReason = SNESLineSearchGetReason(petsclib::PetscLibType, linesearch::SNESLineSearch)Gets the success/failure status of the last line search application
Input Parameter:
linesearch- the line search context
Output Parameter:
reason- The success or failure status
Level: developer
See also: SNES, SNESLineSearch, SNESLineSearchSetReason(), SNESLineSearchReason
External Links
- PETSc Manual:
SNES/SNESLineSearchGetReason
PETSc.LibPETSc.SNESLineSearchGetSNES — Method
snes::SNES = SNESLineSearchGetSNES(petsclib::PetscLibType, linesearch::SNESLineSearch)Gets the SNES instance associated with the line search.
Not Collective
Input Parameter:
linesearch- the line search context
Output Parameter:
snes- TheSNESinstance
Level: developer
See also: 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
See also: SNES, SNESLineSearch, SNESLineSearchSetTolerances()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetTolerances
PETSc.LibPETSc.SNESLineSearchGetType — Method
type::String = 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
See also: SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchCreate(), SNESLineSearchSetFromOptions(), SNESLineSearchSetType(), PetscObjectTypeCompare(), PetscObjectTypeCompareAny()
External Links
- PETSc Manual:
SNES/SNESLineSearchGetType
PETSc.LibPETSc.SNESLineSearchGetVIFunctions — Method
projectfunc::Ptr{Cvoid},normfunc::Ptr{Cvoid},dirderivfunc::Ptr{Cvoid} = SNESLineSearchGetVIFunctions(petsclib::PetscLibType, linesearch::SNESLineSearch)Sets VI-specific functions for line search computation.
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
See also: SNES, SNESLineSearch, SNESLineSearchSetVIFunctions(), SNESLineSearchGetPostCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn
External Links
- PETSc Manual:
SNES/SNESLineSearchGetVIFunctions
PETSc.LibPETSc.SNESLineSearchGetVecs — Method
X::PetscVec,F::PetscVec,Y::PetscVec,W::PetscVec,G::PetscVec = SNESLineSearchGetVecs(petsclib::PetscLibType, linesearch::SNESLineSearch)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
See also: 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
See also: 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
See also: SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorDefault(), SNESLineSearchMonitorSet()
External Links
- PETSc Manual:
SNES/SNESLineSearchMonitorCancel
PETSc.LibPETSc.SNESLineSearchMonitorSet — Method
SNESLineSearchMonitorSet(petsclib::PetscLibType, ls::SNESLineSearch, f::external, mctx::Ptr{Cvoid}, monitordestroy::Ptr{Cvoid})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
See also: 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
See also: 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::Vector{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()
See also: 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::AbstractPetscVec, Y::AbstractPetscVec, W::AbstractPetscVec)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
See also: 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::AbstractPetscVec, Y::AbstractPetscVec)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
See also: 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::AbstractPetscVec, Y::AbstractPetscVec, ctx::Ptr{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 (true|false)- activate this routine-snes_linesearch_precheck_picard_angle angle- the angle to use
Level: advanced
See also: 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
See also: 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
See also: 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|false)- Turns on/off computation of the norms for basic (none)SNESLINESEARCHBASICline search
Level: intermediate
See also: 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
See also: 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
See also: 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 (none|basic|bt|secant|cp|nleqerr|bisection|shell)- Line search type, seeSNESLineSearchType-snes_linesearch_order order- 1, 2, 3. Most types only support certain orders (btsupports 1, 2 or 3)-snes_linesearch_norms (true|false)- Turn on/off the linesearch norms for the basic linesearch typem (SNESLineSearchSetComputeNorms())-snes_linesearch_minlambda minlambda- The minimumlambda-snes_linesearch_maxlambda maxlambda- The maximumlambda-snes_linesearch_rtol rtol- Relative tolerance for iterative line searches-snes_linesearch_atol atol- Absolute tolerance for iterative line searches-snes_linesearch_ltol ltol- Change inlambdatolerance for iterative line searches-snes_linesearch_max_it 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 damping- The linesearch damping parameter-snes_linesearch_keeplambda (true|false)- Keep the previouslambdaas the initial guess.-snes_linesearch_precheck_picard (true|false)- Use precheck that speeds up convergence of picard method-snes_linesearch_precheck_picard_angle angle- Angle used in Picard precheck method
Level: intermediate
See also: 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
See also: 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
See also: 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
See also: 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)
See also: SNES, SNESLineSearch, SNESLineSearchGetOrder(), SNESLineSearchSetDamping()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetOrder
PETSc.LibPETSc.SNESLineSearchSetPostCheck — Method
SNESLineSearchSetPostCheck(petsclib::PetscLibType, linesearch::SNESLineSearch, func::external, ctx::Ptr{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
See also: 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::Ptr{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
See also: 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, reason::SNESLineSearchReason)Sets the success/failure reason of the line search application
Logically Collective; No Fortran Support
Input Parameters:
linesearch- the line search contextreason- The success or failure reason
Level: developer
See also: SNES, SNESLineSearch, SNESLineSearchReason, SNESLineSearchGetSResult(), SNESSetFunctionDomainError(), SNESSetFunction()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetReason
PETSc.LibPETSc.SNESLineSearchSetSNES — Method
SNESLineSearchSetSNES(petsclib::PetscLibType, linesearch::SNESLineSearch, snes::AbstractSNES)Sets the SNES for the linesearch for function evaluation.
Input Parameters:
linesearch- the line search contextsnes- TheSNESinstance
Level: developer
See also: 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
See also: SNES, SNESLineSearch, SNESLineSearchGetTolerances()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetTolerances
PETSc.LibPETSc.SNESLineSearchSetType — Method
SNESLineSearchSetType(petsclib::PetscLibType, linesearch::SNESLineSearch, type::String)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 (none|basic|bt|secant|cp|nleqerr|bisection|shell)- Line search type to use, seeSNESLineSearchType
Level: intermediate
See also: 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
See also: SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchReset()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetUp
PETSc.LibPETSc.SNESLineSearchSetVIFunctions — Method
SNESLineSearchSetVIFunctions(petsclib::PetscLibType, linesearch::SNESLineSearch, projectfunc::Ptr{Cvoid}, normfunc::Ptr{Cvoid}, dirderivfunc::Ptr{Cvoid})Sets VI-specific functions for line search computation.
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
See also: SNES, SNESLineSearch, SNESLineSearchGetVIFunctions(), SNESLineSearchSetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn, SNESLineSearchVIDirDerivFn
External Links
- PETSc Manual:
SNES/SNESLineSearchSetVIFunctions
PETSc.LibPETSc.SNESLineSearchSetVecs — Method
SNESLineSearchSetVecs(petsclib::PetscLibType, linesearch::SNESLineSearch, X::AbstractPetscVec, F::AbstractPetscVec, Y::AbstractPetscVec, W::AbstractPetscVec, G::AbstractPetscVec)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
See also: 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
See also: SNES, SNESLineSearch, SNESSetWorkVecs()
External Links
- PETSc Manual:
SNES/SNESLineSearchSetWorkVecs
PETSc.LibPETSc.SNESLineSearchShellGetApply — Method
func::Ptr{Cvoid},ctx::Ptr{Cvoid} = SNESLineSearchShellGetApply(petsclib::PetscLibType, linesearch::SNESLineSearch)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
See also: SNESLineSearchShellSetApply(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch, SNESLineSearchShellApplyFn
External Links
- PETSc Manual:
SNES/SNESLineSearchShellGetApply
PETSc.LibPETSc.SNESLineSearchShellSetApply — Method
SNESLineSearchShellSetApply(petsclib::PetscLibType, linesearch::SNESLineSearch, func::Ptr{Cvoid}, ctx::Ptr{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: `` PetscErrorCode shellfunc(SNESLineSearch linesearch,void * ctx) { Vec X,Y,F,W,G; SNES snes;
PetscFunctionBegin; PetscCall(SNESLineSearchGetSNES(linesearch,&snes)); PetscCall(SNESLineSearchSetReason(linesearch,SNESLINESEARCHSUCCEEDED)); PetscCall(SNESLineSearchGetVecs(linesearch,&X,&F,&Y,&W,&G)); // determine lambda using W and G as work vecs.. PetscCall(VecAXPY(X,-lambda,Y)); PetscCall(SNESComputeFunction(snes,X,F)); PetscCall(SNESLineSearchComputeNorms(linesearch)); PetscFunctionReturn(PETSC_SUCCESS); }
PetscCall(SNESGetLineSearch(snes, &linesearch)); PetscCall(SNESLineSearchSetType(linesearch, SNESLINESEARCHSHELL)); PetscCall(SNESLineSearchShellSetApply(linesearch, shellfunc, NULL)); ``
Level: advanced
See also: 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
See also: SNES, SNESLineSearch, PetscViewer, SNESLineSearchCreate()
External Links
- PETSc Manual:
SNES/SNESLineSearchView
Hand-written helpers
PETSc.LibPETSc.SNESGetJacobianMat — Method
SNESGetJacobianMat(petsclib, snes) -> PetscMatReturn the assembled system (A) matrix from snes, passing NULL for the preconditioner matrix, Jacobian function, and context. Use this when only the system matrix is needed (e.g. to attach a null space via MatSetNullSpace).