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.SNESAddOptionsCheckerMethod
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 - the SNES object for which it is checking options

Level: developer

-seealso: , SNES, SNESSetFromOptions()

External Links

source
PETSc.LibPETSc.SNESAppendOptionsPrefixMethod
SNESAppendOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)

Appends to the prefix used for searching for all SNES options in the database.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , SNESGetOptionsPrefix(), SNESSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESApplyNPCMethod
SNESApplyNPC(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, f::PetscVec, y::PetscVec)

Calls SNESSolve() on the preconditioner for the SNES

Collective

Input Parameters:

  • snes - the SNES context
  • x - input vector
  • f - optional; the function evaluation on x

Output Parameter:

  • y - function vector, as set by SNESSetFunction()

Level: developer

-seealso: , SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction()

External Links

source
PETSc.LibPETSc.SNESCompositeAddSNESMethod
SNESCompositeAddSNES(petsclib::PetscLibType,snes::PetscSNES, type::SNESType)

Adds another SNES to the SNESCOMPOSITE

Collective

Input Parameters:

  • snes - the SNES context of type SNESCOMPOSITE
  • type - the SNESType of the new solver

Level: developer

-seealso: , SNES, SNESCOMPOSITE, SNESCompositeGetSNES()

External Links

source
PETSc.LibPETSc.SNESCompositeGetNumberMethod
n::PetscInt = SNESCompositeGetNumber(petsclib::PetscLibType,snes::PetscSNES)

Get the number of subsolvers in the SNESCOMPOSITE

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • n - the number of subsolvers

Level: developer

-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetSNES()

External Links

source
PETSc.LibPETSc.SNESCompositeGetSNESMethod
SNESCompositeGetSNES(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::PetscSNES)

Gets one of the SNES objects in the SNES of SNESType SNESCOMPOSITE

Not Collective

Input Parameters:

  • snes - the SNES context
  • n - the number of the composed SNES requested

Output Parameter:

  • subsnes - the SNES requested

Level: developer

-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetNumber()

External Links

source
PETSc.LibPETSc.SNESCompositeSetDampingMethod
SNESCompositeSetDamping(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, dmp::PetscReal)

Sets the damping of a subsolver when using SNES_COMPOSITE_ADDITIVE with a SNES of SNESType SNESCOMPOSITE

Not Collective

Input Parameters:

  • snes - the SNES context
  • n - the number of the sub-SNES object requested
  • dmp - the damping

Level: intermediate

-seealso: , SNES, SNESCOMPOSITE, SNESCompositeAddSNES(), SNESCompositeGetSNES(), SNES_COMPOSITE_ADDITIVE, SNES_COMPOSITE_MULTIPLICATIVE, SNESCompositeType, SNESCompositeSetType()

External Links

source
PETSc.LibPETSc.SNESCompositeSetTypeMethod
SNESCompositeSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESCompositeType)

Sets the type of composite preconditioner.

Logically Collective

Input Parameters:

  • snes - the preconditioner context
  • type - SNES_COMPOSITE_ADDITIVE (default), SNES_COMPOSITE_MULTIPLICATIVE, or SNES_COMPOSITE_ADDITIVEOPTIMAL

Options Database Key:

  • -snes_composite_type <type: one of multiplicative, additive, additiveoptimal> - Sets composite preconditioner type

Level: developer

-seealso: , SNES_COMPOSITE_ADDITIVE, SNES_COMPOSITE_MULTIPLICATIVE, SNESCompositeType, SNESCOMPOSITE, SNES_COMPOSITE_ADDITIVEOPTIMAL, PCCompositeType

External Links

source
PETSc.LibPETSc.SNESComputeFunctionMethod
SNESComputeFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec)

Calls the function that has been set with SNESSetFunction().

Collective

Input Parameters:

  • snes - the SNES context
  • x - input vector

Output Parameter:

  • y - function vector, as set by SNESSetFunction()

Level: developer

-seealso: , SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeMFFunction()

External Links

source
PETSc.LibPETSc.SNESComputeJacobianMethod
SNESComputeJacobian(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, A::PetscMat, B::PetscMat)

Computes the Jacobian matrix that has been set with SNESSetJacobian().

Collective

Input Parameters:

  • snes - the SNES context
  • X - input vector

Output Parameters:

  • A - Jacobian matrix
  • B - optional matrix for building the preconditioner, usually the same as A

Options Database Keys:

  • -snes_lag_preconditioner <lag> - how often to rebuild preconditioner
  • -snes_lag_jacobian <lag> - how often to rebuild Jacobian
  • -snes_test_jacobian <optional threshold> - compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.
  • -snes_test_jacobian_view - display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian
  • -snes_compare_explicit - Compare the computed Jacobian to the finite difference Jacobian and output the differences
  • -snes_compare_explicit_draw - Compare the computed Jacobian to the finite difference Jacobian and draw the result
  • -snes_compare_explicit_contour - Compare the computed Jacobian to the finite difference Jacobian and draw a contour plot with the result
  • -snes_compare_operator - Make the comparison options above use the operator instead of the matrix used to construct the preconditioner
  • -snes_compare_coloring - Compute the finite difference Jacobian using coloring and display norms of difference
  • -snes_compare_coloring_display - Compute the finite difference Jacobian using coloring and display verbose differences
  • -snes_compare_coloring_threshold - Display only those matrix entries that differ by more than a given threshold
  • -snes_compare_coloring_threshold_atol - Absolute tolerance for difference in matrix entries to be displayed by -snes_compare_coloring_threshold
  • -snes_compare_coloring_threshold_rtol - Relative tolerance for difference in matrix entries to be displayed by -snes_compare_coloring_threshold
  • -snes_compare_coloring_draw - Compute the finite difference Jacobian using coloring and draw differences
  • -snes_compare_coloring_draw_contour - Compute the finite difference Jacobian using coloring and show contours of matrices and differences

Level: developer

-seealso: , SNESSetJacobian(), KSPSetOperators(), MatStructure, SNESSetLagPreconditioner(), SNESSetLagJacobian()

External Links

source
PETSc.LibPETSc.SNESComputeJacobianDefaultMethod
SNESComputeJacobianDefault(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid)

Computes the Jacobian using finite differences.

Collective

Input Parameters:

  • snes - the SNES context
  • x1 - compute Jacobian at this point
  • ctx - application's function context, as set with SNESSetFunction()

Output Parameters:

  • J - Jacobian matrix (not altered in this routine)
  • B - newly computed Jacobian matrix to use with preconditioner (generally the same as J)

Options Database Keys:

  • -snes_fd - Activates SNESComputeJacobianDefault()
  • -snes_fd_coloring - Activates a faster computation that uses a graph coloring of the matrix
  • -snes_test_err - Square root of function error tolerance, default square root of machine

epsilon (1.e-8 in double, 3.e-4 in single)

  • -mat_fd_type - Either wp or ds (see MATMFFD_WP or MATMFFD_DS)

Level: intermediate

-seealso: , SNES, SNESSetJacobian(), SNESComputeJacobianDefaultColor(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.SNESComputeJacobianDefaultColorMethod
SNESComputeJacobianDefaultColor(petsclib::PetscLibType,snes::PetscSNES, x1::PetscVec, J::PetscMat, B::PetscMat, ctx::Cvoid)

Computes the Jacobian using finite differences and coloring to exploit matrix sparsity.

Collective

Input Parameters:

  • snes - nonlinear solver object
  • x1 - location at which to evaluate Jacobian
  • ctx - MatFDColoring context or NULL

Output Parameters:

  • J - Jacobian matrix (not altered in this routine)
  • B - newly computed Jacobian matrix to use with preconditioner (generally the same as J)

Options Database Keys:

  • -snes_fd_color_use_mat - use a matrix coloring from the explicit matrix nonzero pattern instead of from the DM providing the matrix
  • -snes_fd_color - Activates SNESComputeJacobianDefaultColor() in SNESSetFromOptions()
  • -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 (see MATMFFD_WP or MATMFFD_DS)
  • -snes_mf_operator - Use matrix-free application of Jacobian
  • -snes_mf - Use matrix-free Jacobian with no explicit Jacobian representation

-seealso: , SNES, SNESSetJacobian(), SNESTestJacobian(), SNESComputeJacobianDefault(), SNESSetUseMatrixFree(), MatFDColoringCreate(), MatFDColoringSetFunction()

External Links

source
PETSc.LibPETSc.SNESComputeMFFunctionMethod
SNESComputeMFFunction(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec, y::PetscVec)

Calls the function that has been set with DMSNESSetMFFunction().

Collective

Input Parameters:

  • snes - the SNES context
  • x - input vector

Output Parameter:

  • y - output vector

Level: developer

-seealso: , SNES, SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), MatCreateSNESMF(), DMSNESSetMFFunction()

External Links

source
PETSc.LibPETSc.SNESComputeNGSMethod
SNESComputeNGS(petsclib::PetscLibType,snes::PetscSNES, b::PetscVec, x::PetscVec)

Calls the Gauss

Collective

Input Parameters:

  • snes - the SNES context
  • x - input vector
  • b - rhs vector

Output Parameter:

  • x - new solution vector

Level: developer

-seealso: , SNESNGSFn, SNESSetNGS(), SNESComputeFunction(), SNESNGS

External Links

source
PETSc.LibPETSc.SNESComputeObjectiveMethod
ob::PetscReal = SNESComputeObjective(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec)

Computes the objective function that has been provided by SNESSetObjective()

Collective

Input Parameters:

  • snes - the SNES context
  • X - the state vector

Output Parameter:

  • ob - the objective value

Level: developer

-seealso: , SNESLineSearch, SNES, SNESSetObjective(), SNESGetSolution()

External Links

source
PETSc.LibPETSc.SNESConvergedMethod
SNESConverged(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal)

Run the convergence test and update the SNESConvergedReason.

Collective

Input Parameters:

  • snes - the SNES context
  • it - current iteration
  • xnorm - 2-norm of current iterate
  • snorm - 2-norm of current step
  • fnorm - 2-norm of function

Level: developer

-seealso: , SNES, SNESSolve, SNESSetConvergenceTest()

External Links

source
PETSc.LibPETSc.SNESConvergedCorrectPressureMethod
SNESConvergedCorrectPressure(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, gnorm::PetscReal, f::PetscReal, reason::SNESConvergedReason, ctx::Cvoid)

The regular SNES convergence test that, up on convergence, adds a vector in the nullspace to make the continuum integral of the pressure field equal to zero.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • it - the iteration (0 indicates before any Newton steps)
  • xnorm - 2-norm of current iterate
  • gnorm - 2-norm of current step
  • f - 2-norm of function at current iterate
  • ctx - Optional user context

Output Parameter:

  • reason - SNES_CONVERGED_ITERATING, SNES_CONVERGED_ITS, or SNES_DIVERGED_FNORM_NAN

Options Database Key:

  • -snes_convergence_test correct_pressure - see SNESSetFromOptions()

Level: advanced

-seealso: , SNES, DM, SNESConvergedDefault(), SNESSetConvergenceTest(), DMSetNullSpaceConstructor()

External Links

source
PETSc.LibPETSc.SNESConvergedDefaultMethod
SNESConvergedDefault(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid)

Default convergence test for SNESSolve().

Collective

Input Parameters:

  • snes - the SNES context
  • it - the iteration (0 indicates before any Newton steps)
  • xnorm - 2-norm of current iterate
  • snorm - 2-norm of current step
  • fnorm - 2-norm of function at current iterate
  • dummy - unused context

Output Parameter:

  • reason - converged reason, see SNESConvergedReason

Options Database Keys:

  • -snes_convergence_test default - see SNESSetFromOptions()
  • -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, use unlimited for 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 before SNESSolve() stops

Level: developer

-seealso: , SNES, SNESSolve(), SNESSetConvergenceTest(), SNESConvergedSkip(), SNESSetTolerances(), SNESSetDivergenceTolerance(), SNESConvergedReason

External Links

source
PETSc.LibPETSc.SNESConvergedReasonViewMethod
SNESConvergedReasonView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)

Displays the reason a SNES solve converged or diverged to a viewer

Collective

Input Parameters:

  • snes - iterative context obtained from SNESCreate()
  • viewer - the viewer to display the reason

Options Database Keys:

  • -snes_converged_reason - print reason for converged or diverged, also prints number of iterations
  • -snes_converged_reason ::failed - only print reason and number of iterations when diverged

Level: beginner

-seealso: , SNESConvergedReason, PetscViewer, SNES, SNESCreate(), SNESSetUp(), SNESDestroy(), SNESSetTolerances(), SNESConvergedDefault(), SNESGetConvergedReason(), SNESConvergedReasonViewFromOptions(), PetscViewerPushFormat(), PetscViewerPopFormat()

External Links

source
PETSc.LibPETSc.SNESConvergedReasonViewCancelMethod
SNESConvergedReasonViewCancel(petsclib::PetscLibType,snes::PetscSNES)

Clears all the reason view functions for a SNES object provided with SNESConvergedReasonViewSet() also removes the default viewer.

Collective

Input Parameter:

  • snes - the nonlinear iterative solver context obtained from SNESCreate()

Level: intermediate

-seealso: , SNES, SNESCreate(), SNESDestroy(), SNESReset(), SNESConvergedReasonViewSet()

External Links

source
PETSc.LibPETSc.SNESConvergedReasonViewFromOptionsMethod
SNESConvergedReasonViewFromOptions(petsclib::PetscLibType,snes::PetscSNES)

Processes command line options to determine if/how a SNESConvergedReason is to be viewed at the end of SNESSolve() All the user-provided viewer routines set with SNESConvergedReasonViewSet() will be called, if they exist.

Collective

Input Parameter:

  • snes - the SNES object

Level: advanced

-seealso: , SNES, SNESConvergedReason, SNESConvergedReasonViewSet(), SNESCreate(), SNESSetUp(), SNESDestroy(), SNESSetTolerances(), SNESConvergedDefault(), SNESGetConvergedReason(), SNESConvergedReasonView()

External Links

source
PETSc.LibPETSc.SNESConvergedReasonViewSetMethod
SNESConvergedReasonViewSet(petsclib::PetscLibType,snes::PetscSNES, f::external, vctx::Cvoid, reasonviewdestroy::PetscCtxDestroyFn)

Sets an ADDITIONAL function that is to be used at the end of the nonlinear solver to display the convergence reason of the nonlinear solver.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • f - the SNESConvergedReason view function
  • vctx - [optional] user-defined context for private data for the SNESConvergedReason view function (use NULL if no context is desired)
  • reasonviewdestroy - [optional] routine that frees the context (may be NULL), see PetscCtxDestroyFn for the calling sequence

Calling sequence of f:

  • snes - the SNES context
  • vctx - [optional] context for private data for the function

Options Database Keys:

  • -snes_converged_reason - sets a default SNESConvergedReasonView()
  • -snes_converged_reason_view_cancel - cancels all converged reason viewers that have been hardwired into a code by

calls to SNESConvergedReasonViewSet(), but does not cancel those set via the options database.

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESConvergedReason, SNESGetConvergedReason(), SNESConvergedReasonView(), SNESConvergedReasonViewCancel(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.SNESConvergedSkipMethod
SNESConvergedSkip(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, xnorm::PetscReal, snorm::PetscReal, fnorm::PetscReal, reason::SNESConvergedReason, dummy::Cvoid)

Convergence test for SNES that NEVER returns as converged, UNLESS the maximum number of iteration have been reached.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • it - the iteration (0 indicates before any Newton steps)
  • xnorm - 2-norm of current iterate
  • snorm - 2-norm of current step
  • fnorm - 2-norm of function at current iterate
  • dummy - unused context

Output Parameter:

  • reason - SNES_CONVERGED_ITERATING, SNES_CONVERGED_ITS, or SNES_DIVERGED_FNORM_NAN

Options Database Key:

  • -snes_convergence_test skip - see SNESSetFromOptions()

Level: advanced

-seealso: , SNES, SNESSolve(), SNESConvergedDefault(), SNESSetConvergenceTest(), SNESConvergedReason

External Links

source
PETSc.LibPETSc.SNESCreateMethod
outsnes::PetscSNES = SNESCreate(petsclib::PetscLibType,comm::MPI_Comm)

Creates a nonlinear solver context used to manage a set of nonlinear solves

Collective

Input Parameter:

  • comm - MPI communicator

Output Parameter:

  • outsnes - the new SNES context

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 by SNESSetJacobian()
  • -snes_fd_coloring - uses a relative fast computation of the Jacobian using finite differences and a graph coloring
  • -snes_fd - Uses (slow!) finite differences to compute Jacobian

Level: beginner

-seealso: , SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian()

External Links

source
PETSc.LibPETSc.SNESDestroyMethod
SNESDestroy(petsclib::PetscLibType,snes::PetscSNES)

Destroys the nonlinear solver context that was created with SNESCreate().

Collective

Input Parameter:

  • snes - the SNES context

Level: beginner

-seealso: , SNES, SNESCreate(), SNESSolve()

External Links

source
PETSc.LibPETSc.SNESFASCreateCoarseVecMethod
Xcoarse::PetscVec = SNESFASCreateCoarseVec(petsclib::PetscLibType,snes::PetscSNES)

create a Vec corresponding to a state vector on one level coarser than the current level

Collective

Input Parameter:

  • snes - SNESFAS object

Output Parameter:

  • Xcoarse - vector on level one coarser than the current level

Level: developer

-seealso: , SNESFASSetRestriction(), SNESFASRestrict(), SNESFAS

External Links

source
PETSc.LibPETSc.SNESFASCycleGetCorrectionMethod
SNESFASCycleGetCorrection(petsclib::PetscLibType,snes::PetscSNES, correction::PetscSNES)

Gets the coarse correction SNESFAS context for this level

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • correction - the coarse correction solve on this level

Level: advanced

-seealso: , SNES, SNESFAS SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetInjectionMethod
SNESFASCycleGetInjection(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)

Gets the injection on a level

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • mat - the restriction operator on this level

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASGetInjection(), SNESFASCycleGetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetInterpolationMethod
SNESFASCycleGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)

Gets the interpolation on a level

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • mat - the interpolation operator on this level

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetRScaleMethod
SNESFASCycleGetRScale(petsclib::PetscLibType,snes::PetscSNES, vec::PetscVec)

Gets the injection scale

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • vec - the restriction operator on this level

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASCycleGetRestriction(), SNESFASGetRScale()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetRestrictionMethod
SNESFASCycleGetRestriction(petsclib::PetscLibType,snes::PetscSNES, mat::PetscMat)

Gets the restriction on a level

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • mat - the restriction operator on this level

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASGetRestriction(), SNESFASCycleGetInterpolation()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetSmootherMethod
SNESFASCycleGetSmoother(petsclib::PetscLibType,snes::PetscSNES, smooth::PetscSNES)

Gets the smoother on a particular cycle level.

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • smooth - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetSmootherDownMethod
SNESFASCycleGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, smoothd::PetscSNES)

Gets the down smoother on a particular cycle level.

Logically Collective

Input Parameter:

  • snes - SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • smoothd - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASCycleGetSmootherUp(), SNESFASCycleGetSmoother(), SNESFASGetCycleSNES()

External Links

source
PETSc.LibPETSc.SNESFASCycleGetSmootherUpMethod
SNESFASCycleGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, smoothu::PetscSNES)

Gets the up smoother on a particular cycle level.

Logically Collective

Input Parameter:

  • snes - the SNESFAS obtained with SNESFASGetCycleSNES()

Output Parameter:

  • smoothu - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASCycleGetSmoother(), SNESFASCycleGetSmootherDown(), SNESFASGetCycleSNES()

External Links

source
PETSc.LibPETSc.SNESFASCycleIsFineMethod
flg::PetscBool = SNESFASCycleIsFine(petsclib::PetscLibType,snes::PetscSNES)

Determines if a given SNES is the finest level in a SNESFAS

Logically Collective

Input Parameter:

  • snes - the SNESFAS context obtained with SNESFASGetCycleSNES()

Output Parameter:

  • flg - indicates if this is the fine level or not

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetLevels()

External Links

source
PETSc.LibPETSc.SNESFASCycleSetCyclesMethod
SNESFASCycleSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt)

Sets the number of cycles for all levels in a SNESFAS

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • cycles - the number of cycles – 1 for V-cycle, 2 for W-cycle

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetCycles()

External Links

source
PETSc.LibPETSc.SNESFASFullGetTotalMethod
total::PetscBool = SNESFASFullGetTotal(petsclib::PetscLibType,snes::PetscSNES)

Use total residual restriction and total interpolation on the initial down and up sweep of full FAS cycles

Logically Collective

Input Parameter:

  • snes - the SNESFAS nonlinear multigrid context

Output Parameter:

  • total - whether to use total restriction / interpolatiaon or not (the alternative is defect restriction and correction interpolation)

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution(), SNESFullSetTotal()

External Links

source
PETSc.LibPETSc.SNESFASFullSetDownSweepMethod
SNESFASFullSetDownSweep(petsclib::PetscLibType,snes::PetscSNES, swp::PetscBool)

Smooth during the initial downsweep for SNESFAS

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • swp - whether to downsweep or not

Options Database Key:

  • -snes_fas_full_downsweep - Sets whether to smooth on the initial downsweep

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()

External Links

source
PETSc.LibPETSc.SNESFASFullSetTotalMethod
SNESFASFullSetTotal(petsclib::PetscLibType,snes::PetscSNES, total::PetscBool)

Use total residual restriction and total interpolation on the initial down and up sweep of full SNESFAS cycles

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • total - 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 full SNESFAS cycle

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp(), DMInterpolateSolution()

External Links

source
PETSc.LibPETSc.SNESFASGalerkinFunctionDefaultMethod
SNESFASGalerkinFunctionDefault(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid)

Computes the Galerkin FAS function

Collective

Input Parameters:

  • snes - the SNESFAS nonlinear solver context
  • X - input vector
  • ctx - the application context

Output Parameter:

  • F - output vector

Level: developer

-seealso: , SNES, SNESFAS, SNESFASGetGalerkin(), SNESFASSetGalerkin()

External Links

source
PETSc.LibPETSc.SNESFASGetCoarseSolveMethod
SNESFASGetCoarseSolve(petsclib::PetscLibType,snes::PetscSNES, coarse::PetscSNES)

Gets the coarsest level solver.

Input Parameter:

  • snes - the SNESFAS nonlinear multigrid context

Output Parameter:

  • coarse - the coarse-level solver

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASGetCycleSNESMethod
SNESFASGetCycleSNES(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, lsnes::PetscSNES)

Gets the SNES corresponding to a particular level of the SNESFAS hierarchy

Input Parameters:

  • snes - the SNES nonlinear multigrid context
  • level - the level to get

Output Parameter:

  • lsnes - the SNES for the requested level

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetLevels()

External Links

source
PETSc.LibPETSc.SNESFASGetGalerkinMethod
flg::PetscBool = SNESFASGetGalerkin(petsclib::PetscLibType,snes::PetscSNES)

Gets if the coarse problems are formed by projection to the fine problem

Not Collective but the result would be the same on all MPI processes

Input Parameter:

  • snes - the SNESFAS nonlinear solver context

Output Parameter:

  • flg - PETSC_TRUE if the coarse problem is formed by projection

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASSetGalerkin()

External Links

source
PETSc.LibPETSc.SNESFASGetInjectionMethod
SNESFASGetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Gets the matrix used to calculate the injection from l-1 to the lth level

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest) to supply [do not supply 0]

Output Parameter:

  • mat - the injection operator

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASGetRestriction(), SNESFASGetInterpolation(), SNESFASGetRScale()

External Links

source
PETSc.LibPETSc.SNESFASGetInterpolationMethod
SNESFASGetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Gets the matrix used to calculate the interpolation from l-1 to the lth level

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest) to supply [do not supply 0]

Output Parameter:

  • mat - the interpolation operator

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASGetInjection(), SNESFASGetRestriction(), SNESFASGetRScale()

External Links

source
PETSc.LibPETSc.SNESFASGetLevelsMethod
levels::PetscInt = SNESFASGetLevels(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of levels in a SNESFAS, including fine and coarse grids

Input Parameter:

  • snes - the SNES nonlinear solver context of SNESType SNESFAS

Output Parameter:

  • levels - the number of levels

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetLevels(), PCMGGetLevels()

External Links

source
PETSc.LibPETSc.SNESFASGetRestrictionMethod
SNESFASGetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Gets the matrix used to calculate the restriction from l to the l-1th level

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest) to supply [do not supply 0]

Output Parameter:

  • mat - the interpolation operator

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetRestriction(), SNESFASGetInjection(), SNESFASGetInterpolation(), SNESFASGetRScale()

External Links

source
PETSc.LibPETSc.SNESFASGetSmootherMethod
SNESFASGetSmoother(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)

Gets the default smoother on a level.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest) to supply

Output Parameter:

  • smooth - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASGetSmootherDownMethod
SNESFASGetSmootherDown(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)

Gets the downsmoother on a level.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest) to supply

Output Parameter:

  • smooth - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASGetSmootherUpMethod
SNESFASGetSmootherUp(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, smooth::PetscSNES)

Gets the upsmoother on a level.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • level - the level (0 is coarsest)

Output Parameter:

  • smooth - the smoother

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASGetTypeMethod
fastype::SNESFASType = SNESFASGetType(petsclib::PetscLibType,snes::PetscSNES)

Gets the update and correction type used for SNESFAS.

Logically Collective

Input Parameter:

  • snes - SNESFAS context

Output Parameter:

  • fastype - SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, or SNES_FAS_KASKADE

Level: intermediate

-seealso: , SNES, SNESFAS, PCMGSetType(), SNESFASSetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE

External Links

source
PETSc.LibPETSc.SNESFASRestrictMethod
SNESFASRestrict(petsclib::PetscLibType,fine::PetscSNES, Xfine::PetscVec, Xcoarse::PetscVec)

restrict a Vec to the next coarser level

Collective

Input Parameters:

  • fine - SNES from which to restrict
  • Xfine - vector to restrict

Output Parameter:

  • Xcoarse - result of restriction

Level: developer

-seealso: , SNES, SNESFAS, SNESFASSetRestriction(), SNESFASSetInjection(), SNESFASCreateCoarseVec()

External Links

source
PETSc.LibPETSc.SNESFASSetContinuationMethod
SNESFASSetContinuation(petsclib::PetscLibType,snes::PetscSNES, continuation::PetscBool)

Sets the SNESFAS cycle to default to using exact Newton solves on the upsweep

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • continuation - whether to use continuation

Options Database Key:

  • -snes_fas_continuation - sets continuation to true

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()

External Links

source
PETSc.LibPETSc.SNESFASSetCyclesMethod
SNESFASSetCycles(petsclib::PetscLibType,snes::PetscSNES, cycles::PetscInt)

Sets the number of SNESFAS multigrid cycles to use each time a grid is visited. Use SNESFASSetCyclesOnLevel() for more complicated cycling.

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • cycles - the number of cycles – 1 for V-cycle, 2 for W-cycle

Options Database Key:

  • -snes_fas_cycles <1,2> - 1 for V-cycle, 2 for W-cycle

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetCyclesOnLevel()

External Links

source
PETSc.LibPETSc.SNESFASSetGalerkinMethod
SNESFASSetGalerkin(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Sets coarse problems as formed by projection to the fine problem

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear solver context
  • flg - PETSC_TRUE to use the projection process

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetLevels(), SNESFASGetGalerkin()

External Links

source
PETSc.LibPETSc.SNESFASSetInjectionMethod
SNESFASSetInjection(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Sets the matrix to be used to inject the solution from level to level-1.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • mat - the injection matrix
  • level - the level (0 is coarsest) to supply [Do not supply 0]

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASSetInterpolationMethod
SNESFASSetInterpolation(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Sets the Mat to be used to apply the interpolation from l-1 to the lth level

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • mat - the interpolation operator
  • level - the level (0 is coarsest) to supply [do not supply 0]

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction(), SNESFASSetRScale()

External Links

source
PETSc.LibPETSc.SNESFASSetLevelsMethod
SNESFASSetLevels(petsclib::PetscLibType,snes::PetscSNES, levels::PetscInt, comms::MPI_Comm)

Sets the number of levels to use with SNESFAS. Must be called before any other SNESFAS routine.

Input Parameters:

  • snes - the SNES context of SNESType SNESFAS
  • levels - the number of levels
  • comms - optional communicators for each level; this is to allow solving the coarser

problems on smaller sets of processors.

Level: intermediate

-seealso: , SNES, SNESFAS, SNESFASGetLevels()

External Links

source
PETSc.LibPETSc.SNESFASSetLogMethod
SNESFASSetLog(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Sets or unsets time logging for various SNESFAS stages on all levels

Logically Collective

Input Parameters:

  • snes - the SNESFAS context
  • flg - whether to log or not

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetMonitor()

External Links

source
PETSc.LibPETSc.SNESFASSetMonitorMethod
SNESFASSetMonitor(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat, flg::PetscBool)

Sets the method

Logically Collective

Input Parameters:

  • snes - the SNESFAS context
  • vf - viewer and format structure (may be NULL if flg is PETSC_FALSE)
  • flg - monitor or not

Level: advanced

-seealso: , SNES, SNESFAS, SNESMonitorSet(), SNESFASSetCyclesOnLevel()

External Links

source
PETSc.LibPETSc.SNESFASSetNumberSmoothDownMethod
SNESFASSetNumberSmoothDown(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt)

Sets the number of pre use on all levels.

Logically Collective

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • n - the number of smoothing steps to use

Options Database Key:

  • -snes_fas_smoothdown <n> - Sets number of pre-smoothing steps

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothUp()

External Links

source
PETSc.LibPETSc.SNESFASSetNumberSmoothUpMethod
SNESFASSetNumberSmoothUp(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt)

Sets the number of post use on all levels.

Logically Collective

Input Parameters:

  • snes - the SNES nonlinear multigrid context
  • n - the number of smoothing steps to use

Options Database Key:

  • -snes_fas_smoothup <n> - Sets number of pre-smoothing steps

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetNumberSmoothDown()

External Links

source
PETSc.LibPETSc.SNESFASSetRScaleMethod
SNESFASSetRScale(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, rscale::PetscVec)

Sets the scaling factor of the restriction operator from level l to l-1.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • rscale - the restriction scaling
  • level - the level (0 is coarsest) to supply [Do not supply 0]

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInjection(), SNESFASSetRestriction()

External Links

source
PETSc.LibPETSc.SNESFASSetRestrictionMethod
SNESFASSetRestriction(petsclib::PetscLibType,snes::PetscSNES, level::PetscInt, mat::PetscMat)

Sets the matrix to be used to restrict the defect from level l to l-1.

Input Parameters:

  • snes - the SNESFAS nonlinear multigrid context
  • mat - the restriction matrix
  • level - the level (0 is coarsest) to supply [Do not supply 0]

Level: advanced

-seealso: , SNES, SNESFAS, SNESFASSetInterpolation(), SNESFASSetInjection()

External Links

source
PETSc.LibPETSc.SNESFASSetTypeMethod
SNESFASSetType(petsclib::PetscLibType,snes::PetscSNES, fastype::SNESFASType)

Sets the update and correction type used for SNESFAS.

Logically Collective

Input Parameters:

  • snes - SNESFAS context
  • fastype - SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, or SNES_FAS_KASKADE

Level: intermediate

-seealso: , SNES, SNESFAS, PCMGSetType(), SNESFASGetType(), SNES_FAS_ADDITIVE, SNES_FAS_MULTIPLICATIVE, SNES_FAS_FULL, SNES_FAS_KASKADE

External Links

source
PETSc.LibPETSc.SNESGetAlwaysComputesFinalResidualMethod
flg::PetscBool = SNESGetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES)

checks if the SNES always computes the residual at the final solution

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • flg - PETSC_TRUE if the residual is computed

Level: advanced

-seealso: , SNES, SNESFAS, SNESSolve(), SNESSetAlwaysComputesFinalResidual()

External Links

source
PETSc.LibPETSc.SNESGetApplicationContextMethod
SNESGetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::PeCtx)

Gets the user nonlinear solvers set with SNESGetApplicationContext() or SNESSetComputeApplicationContext()

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • ctx - user context

Level: intermediate

-seealso: , SNESSetApplicationContext(), SNESSetComputeApplicationContext()

External Links

source
PETSc.LibPETSc.SNESGetCheckJacobianDomainErrorMethod
flg::PetscBool = SNESGetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)

Get an indicator whether or not SNES is checking Jacobian domain errors after each Jacobian evaluation.

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • flg - PETSC_FALSE indicates that it is not checking Jacobian domain errors after each Jacobian evaluation

Level: advanced

-seealso: , SNES, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESSetCheckJacobianDomainError()

External Links

source
PETSc.LibPETSc.SNESGetConvergedReasonMethod
SNESGetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason)

Gets the reason the SNES iteration was stopped, which may be due to convergence, divergence, or stagnation

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • reason - negative value indicates diverged, positive value converged, see SNESConvergedReason for the individual convergence tests for complete lists

Options Database Key:

  • -snes_converged_reason - prints the reason to standard out

Level: intermediate

-seealso: , SNESSolve(), SNESSetConvergenceTest(), SNESSetConvergedReason(), SNESConvergedReason, SNESGetConvergedReasonString()

External Links

source
PETSc.LibPETSc.SNESGetConvergedReasonStringMethod
SNESGetConvergedReasonString(petsclib::PetscLibType,snes::PetscSNES, strreason::Cchar)

Return a human readable string for SNESConvergedReason

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • strreason - a human readable string that describes SNES converged reason

Level: beginner

-seealso: , SNES, SNESGetConvergedReason()

External Links

source
PETSc.LibPETSc.SNESGetConvergenceHistoryMethod
a::Vector{PetscReal},its::Vector{PetscInt},na::PetscInt = SNESGetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES)

Gets the arrays used to hold the convergence history.

Not Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameters:

  • a - array to hold history, usually was set with SNESSetConvergenceHistory()
  • its - integer array holds the number of linear iterations (or

negative if not converged) for each solve.

  • na - size of a and its

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESSetConvergenceHistory()

External Links

source
PETSc.LibPETSc.SNESGetDMMethod
dm::PetscDM = SNESGetDM(petsclib::PetscLibType,snes::PetscSNES)

Gets the DM that may be used by some SNES nonlinear solvers/preconditioners

Not Collective but dm obtained is parallel on snes

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • dm - the DM

Level: intermediate

-seealso: , DM, SNES, SNESSetDM(), KSPSetDM(), KSPGetDM()

External Links

source
PETSc.LibPETSc.SNESGetDivergenceToleranceMethod
SNESGetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal)

Gets divergence tolerance used in divergence test.

Not Collective

Input Parameters:

  • snes - the SNES context
  • divtol - divergence tolerance

Level: intermediate

-seealso: , SNES, SNESSetDivergenceTolerance()

External Links

source
PETSc.LibPETSc.SNESGetErrorIfNotConvergedMethod
flag::PetscBool = SNESGetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES)

Indicates if SNESSolve() will generate an error if the solver does not converge?

Not Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • flag - PETSC_TRUE if it will generate an error, else PETSC_FALSE

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESSetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()

External Links

source
PETSc.LibPETSc.SNESGetForceIterationMethod
force::PetscBool = SNESGetForceIteration(petsclib::PetscLibType,snes::PetscSNES)

Check whether or not SNESSolve() take at least one iteration regardless of the initial residual norm

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • force - PETSC_TRUE requires at least one iteration.

Level: intermediate

-seealso: , SNES, SNESSetForceIteration(), SNESSetDivergenceTolerance()

External Links

source
PETSc.LibPETSc.SNESGetFunctionMethod
SNESGetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid)

Returns the function that defines the nonlinear system set with SNESSetFunction()

Not Collective, but r is parallel if snes is parallel. Collective if r is requested, but has not been created yet.

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • r - the vector that is used to store residuals (or NULL if you don't want it)
  • f - the function (or NULL if you don't want it); for calling sequence see SNESFunctionFn
  • ctx - the function context (or NULL if you don't want it)

Level: advanced

-seealso: , SNES, SNESSolve(), SNESSetFunction(), SNESGetSolution(), SNESFunctionFn

External Links

source
PETSc.LibPETSc.SNESGetFunctionDomainErrorMethod
domainerror::PetscBool = SNESGetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES)

Gets the status of the domain error after a call to SNESComputeFunction()

Not Collective, different MPI processes may return different values

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • domainerror - Set to PETSC_TRUE if there's a domain error; PETSC_FALSE otherwise.

Level: developer

-seealso: , SNES, SNESSetFunctionDomainError(), SNESComputeFunction()

External Links

source
PETSc.LibPETSc.SNESGetFunctionNormMethod
norm::PetscReal = SNESGetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES)

Gets the last computed norm of the residual

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • norm - the last computed residual norm

Level: developer

-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule

External Links

source
PETSc.LibPETSc.SNESGetFunctionTypeMethod
SNESGetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType)

Gets the SNESFunctionType used in convergence and monitoring set with SNESSetFunctionType() of the SNES method.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • type - the type of the function evaluation, see SNESSetFunctionType()

Level: advanced

-seealso: , SNESSetFunctionType(), SNESFunctionType, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule

External Links

source
PETSc.LibPETSc.SNESGetGridSequenceMethod
steps::PetscInt = SNESGetGridSequence(petsclib::PetscLibType,snes::PetscSNES)

gets the number of steps of grid sequencing that SNES will do

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • steps - the number of refinements to do, defaults to 0

Level: intermediate

-seealso: , SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetGridSequence()

External Links

source
PETSc.LibPETSc.SNESGetIterationNumberMethod
iter::PetscInt = SNESGetIterationNumber(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of nonlinear iterations completed in the current or most recent SNESSolve()

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • iter - iteration number

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESSetLagJacobian(), SNESGetLinearSolveIterations(), SNESSetMonitor()

External Links

source
PETSc.LibPETSc.SNESGetJacobianMethod
SNESGetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)

Returns the Jacobian matrix and optionally the user provided context for evaluating the Jacobian.

Not Collective, but Mat object will be parallel if SNES is

Input Parameter:

  • snes - the nonlinear solver context

Output Parameters:

  • Amat - location to stash (approximate) Jacobian matrix (or NULL)
  • Pmat - location to stash matrix used to compute the preconditioner (or NULL)
  • J - location to put Jacobian function (or NULL), for calling sequence see SNESJacobianFn
  • ctx - location to stash Jacobian ctx (or NULL)

Level: advanced

-seealso: , SNES, Mat, SNESSetJacobian(), SNESComputeJacobian(), SNESJacobianFn, SNESGetFunction()

External Links

source
PETSc.LibPETSc.SNESGetJacobianDomainErrorMethod
domainerror::PetscBool = SNESGetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)

Gets the status of the Jacobian domain error after a call to SNESComputeJacobian()

Not Collective, different MPI processes may return different values

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • domainerror - Set to PETSC_TRUE if there's a Jacobian domain error; PETSC_FALSE otherwise.

Level: advanced

-seealso: , SNES, SNESSetFunctionDomainError(), SNESComputeFunction(), SNESGetFunctionDomainError()

External Links

source
PETSc.LibPETSc.SNESGetKSPMethod
SNESGetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP)

Returns the KSP context for a SNES solver.

Not Collective, but if snes is parallel, then ksp is parallel

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • ksp - the KSP context

Level: beginner

-seealso: , SNES, KSP, PC, KSPGetPC(), SNESCreate(), KSPCreate(), SNESSetKSP()

External Links

source
PETSc.LibPETSc.SNESGetLagJacobianMethod
lag::PetscInt = SNESGetLagJacobian(petsclib::PetscLibType,snes::PetscSNES)

Get how often the Jacobian is rebuilt. See SNESGetLagPreconditioner() to determine when the preconditioner is rebuilt

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • lag - -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time

the Jacobian is built etc.

Level: intermediate

-seealso: , SNES, SNESSetLagJacobian(), SNESSetLagPreconditioner(), SNESGetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()

External Links

source
PETSc.LibPETSc.SNESGetLagPreconditionerMethod
lag::PetscInt = SNESGetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES)

Return how often the preconditioner is rebuilt

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • lag - -1 indicates NEVER rebuild, 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time

the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that

Level: intermediate

-seealso: , SNES, SNESSetLagPreconditioner(), SNESSetLagJacobianPersists(), SNESSetLagPreconditionerPersists()

External Links

source
PETSc.LibPETSc.SNESGetLineSearchMethod
SNESGetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch)

Returns the line search associated with the SNES.

Not Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • linesearch - linesearch context

Level: beginner

-seealso: , SNESLineSearch, SNESSetLineSearch(), SNESLineSearchCreate(), SNESLineSearchSetFromOptions()

External Links

source
PETSc.LibPETSc.SNESGetLinearSolveFailuresMethod
nfails::PetscInt = SNESGetLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of failed (non linear solvers in the current or most recent SNESSolve()

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • nfails - number of failed solves

Options Database Key:

  • -snes_max_linear_solve_fail <num> - The number of failures before the solve is terminated

Level: intermediate

-seealso: , SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures()

External Links

source
PETSc.LibPETSc.SNESGetLinearSolveIterationsMethod
lits::PetscInt = SNESGetLinearSolveIterations(petsclib::PetscLibType,snes::PetscSNES)

Gets the total number of linear iterations used by the nonlinear solver in the most recent SNESSolve()

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • lits - number of linear iterations

Level: intermediate

-seealso: , SNES, SNESGetIterationNumber(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESSetCountersReset()

External Links

source
PETSc.LibPETSc.SNESGetMaxLinearSolveFailuresMethod
maxFails::PetscInt = SNESGetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES)

gets the maximum number of linear solve failures that are allowed before SNES returns as unsuccessful

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • maxFails - maximum of unsuccessful solves allowed

Level: intermediate

-seealso: , SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(),

External Links

source
PETSc.LibPETSc.SNESGetMaxNonlinearStepFailuresMethod
maxFails::PetscInt = SNESGetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES)

Gets the maximum number of unsuccessful steps attempted by the nonlinear solver before it gives up and returns unconverged or generates an error

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • maxFails - maximum of unsuccessful steps

Level: intermediate

-seealso: , SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures()

External Links

source
PETSc.LibPETSc.SNESGetNGSMethod
SNESGetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid)

Returns the function and context set with SNESSetNGS()

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • f - the function (or NULL) see SNESNGSFn for calling sequence
  • ctx - the function context (or NULL)

Level: advanced

-seealso: , SNESSetNGS(), SNESGetFunction(), SNESNGSFn

External Links

source
PETSc.LibPETSc.SNESGetNPCMethod
SNESGetNPC(petsclib::PetscLibType,snes::PetscSNES, pc::PetscSNES)

Gets a nonlinear preconditioning solver SNES` to be used to precondition the original nonlinear solver.

Not Collective; but any changes to the obtained the pc object must be applied collectively

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • pc - the SNES preconditioner context

Options Database Key:

  • -npc_snes_type <type> - set the type of the SNES to use as the nonlinear preconditioner

Level: advanced

-seealso: , SNESSetNPC(), SNESHasNPC(), SNES, SNESCreate()

External Links

source
PETSc.LibPETSc.SNESGetNPCFunctionMethod
fnorm::PetscReal = SNESGetNPCFunction(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec)

Gets the current function value and its norm from a nonlinear preconditioner after SNESSolve() has been called on that SNES

Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • F - function vector
  • fnorm - the norm of F

Level: developer

-seealso: , SNES, SNESGetNPC(), SNESSetNPC(), SNESComputeFunction(), SNESApplyNPC(), SNESSolve()

External Links

source
PETSc.LibPETSc.SNESGetNPCSideMethod
SNESGetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide)

Gets the preconditioning side used by the nonlinear preconditioner inside SNES.

Not Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • side - the preconditioning side, where side is one of

-seealso: , SNES, SNESGetNPC(), SNESSetNPCSide(), KSPGetPCSide(), PC_LEFT, PC_RIGHT, PCSide

External Links

source
PETSc.LibPETSc.SNESGetNonlinearStepFailuresMethod
nfails::PetscInt = SNESGetNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of unsuccessful steps attempted by the nonlinear solver in the current or most recent SNESSolve() .

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • nfails - number of unsuccessful steps attempted

Level: intermediate

-seealso: , SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetMaxNonlinearStepFailures(), SNESGetMaxNonlinearStepFailures()

External Links

source
PETSc.LibPETSc.SNESGetNormScheduleMethod
SNESGetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule)

Gets the SNESNormSchedule used in convergence and monitoring of the SNES method.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • normschedule - the type of the norm used

Level: advanced

-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule

External Links

source
PETSc.LibPETSc.SNESGetNumberFunctionEvalsMethod
nfuncs::PetscInt = SNESGetNumberFunctionEvals(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of user provided function evaluations done by the SNES object in the current or most recent SNESSolve()

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • nfuncs - number of evaluations

Level: intermediate

-seealso: , SNES, SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESSetCountersReset()

External Links

source
PETSc.LibPETSc.SNESGetObjectiveMethod
SNESGetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid)

Returns the objective function set with SNESSetObjective()

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • obj - objective evaluation routine (or NULL); see SNESObjectiveFn for the calling sequence
  • ctx - the function context (or NULL)

Level: advanced

-seealso: , SNES, SNESSetObjective(), SNESGetSolution(), SNESObjectiveFn

External Links

source
PETSc.LibPETSc.SNESGetOptionsPrefixMethod
SNESGetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)

Gets the prefix used for searching for all SNES options in the database.

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • prefix - pointer to the prefix string used

Level: advanced

-seealso: , SNES, SNESSetOptionsPrefix(), SNESAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESGetPicardMethod
SNESGetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)

Returns the context for the Picard iteration

Not Collective, but Vec is parallel if SNES is parallel. Collective if Vec is requested, but has not been created yet.

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • r - the function (or NULL)
  • f - the function (or NULL); for calling sequence see SNESFunctionFn
  • Amat - the matrix used to defined the operation A(x) x - b(x) (or NULL)
  • Pmat - the matrix from which the preconditioner will be constructed (or NULL)
  • J - the function for matrix evaluation (or NULL); for calling sequence see SNESJacobianFn
  • ctx - the function context (or NULL)

Level: advanced

-seealso: , SNESSetFunction(), SNESSetPicard(), SNESGetFunction(), SNESGetJacobian(), SNESGetDM(), SNESFunctionFn, SNESJacobianFn

External Links

source
PETSc.LibPETSc.SNESGetRhsMethod
SNESGetRhs(petsclib::PetscLibType,snes::PetscSNES, rhs::PetscVec)

Gets the vector for solving F(x) = rhs. If rhs is not set it assumes a zero right-hand side.

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • rhs - the right-hand side vector or NULL if there is no right-hand side vector

Level: intermediate

-seealso: , SNES, SNESGetSolution(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetFunction()

External Links

source
PETSc.LibPETSc.SNESGetSolutionMethod
SNESGetSolution(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec)

Returns the vector where the approximate solution is stored. This is the fine grid solution when using SNESSetGridSequence().

Not Collective, but x is parallel if snes is parallel

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • x - the solution

Level: intermediate

-seealso: , SNESSetSolution(), SNESSolve(), SNES, SNESGetSolutionUpdate(), SNESGetFunction()

External Links

source
PETSc.LibPETSc.SNESGetSolutionNormMethod
xnorm::PetscReal = SNESGetSolutionNorm(petsclib::PetscLibType,snes::PetscSNES)

Gets the last computed norm of the solution

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • xnorm - the last computed solution norm

Level: developer

-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm(), SNESGetUpdateNorm()

External Links

source
PETSc.LibPETSc.SNESGetSolutionUpdateMethod
SNESGetSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, x::PetscVec)

Returns the vector where the solution update is stored.

Not Collective, but x is parallel if snes is parallel

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • x - the solution update

Level: advanced

-seealso: , SNES, SNESGetSolution(), SNESGetFunction()

External Links

source
PETSc.LibPETSc.SNESGetTolerancesMethod
atol::PetscReal,rtol::PetscReal,stol::PetscReal,maxit::PetscInt,maxf::PetscInt = SNESGetTolerances(petsclib::PetscLibType,snes::PetscSNES)

Gets various parameters used in SNES convergence tests.

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • atol - the absolute convergence tolerance
  • rtol - the relative convergence tolerance
  • stol - convergence tolerance in terms of the norm of the change in the solution between steps
  • maxit - the maximum number of iterations allowed
  • maxf - the maximum number of function evaluations allowed, PETSC_UNLIMITED indicates no bound

Level: intermediate

-seealso: , SNES, SNESSetTolerances()

External Links

source
PETSc.LibPETSc.SNESGetTypeMethod
type::SNESType = SNESGetType(petsclib::PetscLibType,snes::PetscSNES)

Gets the SNES method type and name (as a string).

Not Collective

Input Parameter:

  • snes - nonlinear solver context

Output Parameter:

  • type - SNES method (a character string)

Level: intermediate

-seealso: , SNESSetType(), SNESType, SNESSetFromOptions(), SNES

External Links

source
PETSc.LibPETSc.SNESGetUpdateNormMethod
ynorm::PetscReal = SNESGetUpdateNorm(petsclib::PetscLibType,snes::PetscSNES)

Gets the last computed norm of the solution update

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • ynorm - the last computed update norm

Level: developer

-seealso: , SNES, SNESSetNormSchedule(), SNESComputeFunction(), SNESGetFunctionNorm()

External Links

source
PETSc.LibPETSc.SNESGetUseMatrixFreeMethod
mf_operator::PetscBool,mf::PetscBool = SNESGetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES)

indicates if the SNES uses matrix

Not Collective, but the resulting flags will be the same on all MPI processes

Input Parameter:

  • snes - SNES context

Output Parameters:

  • mf_operator - use matrix-free only for the Amat used by SNESSetJacobian(), this means the user provided Pmat will continue to be used
  • mf - use matrix-free for both the Amat and Pmat used by SNESSetJacobian(), both the Amat and Pmat set in SNESSetJacobian() will be ignored

Level: intermediate

-seealso: , SNES, SNESSetUseMatrixFree(), MatCreateSNESMF()

External Links

source
PETSc.LibPETSc.SNESHasNPCMethod
has_npc::PetscBool = SNESHasNPC(petsclib::PetscLibType,snes::PetscSNES)

Returns whether a nonlinear preconditioner is associated with the given SNES

Not Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • has_npc - whether the SNES has a nonlinear preconditioner or not

Level: developer

-seealso: , SNESSetNPC(), SNESGetNPC()

External Links

source
PETSc.LibPETSc.SNESInitializePackageMethod
SNESInitializePackage(petsclib::PetscLibType)

This function initializes everything in the SNES package. It is called from PetscDLLibraryRegister_petscsnes() when using dynamic libraries, and on the first call to SNESCreate() when using shared or static libraries.

Level: developer

-seealso: , SNES, PetscInitialize()

External Links

source
PETSc.LibPETSc.SNESKSPGetParametersEWMethod
version::PetscInt,rtol_0::PetscReal,rtol_max::PetscReal,gamma::PetscReal,alpha::PetscReal,alpha2::PetscReal,threshold::PetscReal = SNESKSPGetParametersEW(petsclib::PetscLibType,snes::PetscSNES)

Gets parameters for Eisenstat convergence criteria for the linear solvers within an inexact Newton method.

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameters:

  • version - version 1, 2 (default is 2), 3 or 4
  • rtol_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 safeguard
  • threshold - threshold for imposing safeguard (0 < threshold < 1)

Level: advanced

-seealso: , SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPSetParametersEW()

External Links

source
PETSc.LibPETSc.SNESKSPGetUseEWMethod
flag::PetscBool = SNESKSPGetUseEW(petsclib::PetscLibType,snes::PetscSNES)

Gets if SNES is using Eisenstat for computing relative tolerance for linear solvers within an inexact Newton method.

Not Collective

Input Parameter:

  • snes - SNES context

Output Parameter:

  • flag - PETSC_TRUE or PETSC_FALSE

Level: advanced

-seealso: , SNESKSPSetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()

External Links

source
PETSc.LibPETSc.SNESKSPSetParametersEWMethod
SNESKSPSetParametersEW(petsclib::PetscLibType,snes::PetscSNES, version::PetscInt, rtol_0::PetscReal, rtol_max::PetscReal, gamma::PetscReal, alpha::PetscReal, alpha2::PetscReal, threshold::PetscReal)

Sets parameters for Eisenstat convergence criteria for the linear solvers within an inexact Newton method.

Logically Collective

Input Parameters:

  • snes - SNES context
  • version - version 1, 2 (default is 2), 3 or 4
  • rtol_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 safeguard
  • threshold - threshold for imposing safeguard (0 < threshold < 1)

Level: advanced

-seealso: , SNES, SNESKSPSetUseEW(), SNESKSPGetUseEW(), SNESKSPGetParametersEW()

External Links

source
PETSc.LibPETSc.SNESKSPSetUseEWMethod
SNESKSPSetUseEW(petsclib::PetscLibType,snes::PetscSNES, flag::PetscBool)

Sets SNES to the use Eisenstat computing relative tolerance for linear solvers within an inexact Newton method.

Logically Collective

Input Parameters:

  • snes - SNES context
  • flag - PETSC_TRUE or PETSC_FALSE

Options Database Keys:

  • -snes_ksp_ew - use Eisenstat-Walker method for determining linear system convergence
  • -snes_ksp_ew_version ver - version of Eisenstat-Walker method
  • -snes_ksp_ew_rtol0 <rtol0> - Sets rtol0
  • -snes_ksp_ew_rtolmax <rtolmax> - Sets rtolmax
  • -snes_ksp_ew_gamma <gamma> - Sets gamma
  • -snes_ksp_ew_alpha <alpha> - Sets alpha
  • -snes_ksp_ew_alpha2 <alpha2> - Sets alpha2
  • -snes_ksp_ew_threshold <threshold> - Sets threshold

Level: advanced

-seealso: , KSP, SNES, SNESKSPGetUseEW(), SNESKSPGetParametersEW(), SNESKSPSetParametersEW()

External Links

source
PETSc.LibPETSc.SNESLoadMethod
SNESLoad(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)

Loads a SNES that has been stored in PETSCVIEWERBINARY with SNESView().

Collective

Input Parameters:

  • snes - the newly loaded SNES, this needs to have been created with SNESCreate() or

some related function before a call to SNESLoad().

  • viewer - binary file viewer, obtained from PetscViewerBinaryOpen()

Level: intermediate

-seealso: , SNES, PetscViewer, SNESCreate(), SNESType, PetscViewerBinaryOpen(), SNESView(), MatLoad(), VecLoad()

External Links

source
PETSc.LibPETSc.SNESMSFinalizePackageMethod
SNESMSFinalizePackage(petsclib::PetscLibType)

This function destroys everything in the SNESMS package. It is called from PetscFinalize().

Level: developer

-seealso: , SNES, SNESMS, SNESMSRegister(), SNESMSRegisterAll(), SNESMSInitializePackage(), PetscFinalize()

External Links

source
PETSc.LibPETSc.SNESMSGetDampingMethod
damping::PetscReal = SNESMSGetDamping(petsclib::PetscLibType,snes::PetscSNES)

Get the damping parameter of SNESMS multistage scheme

Not Collective

Input Parameter:

  • snes - nonlinear solver context

Output Parameter:

  • damping - damping parameter

Level: advanced

-seealso: , SNESMSSetDamping(), SNESMS

External Links

source
PETSc.LibPETSc.SNESMSGetTypeMethod
mstype::SNESMSType = SNESMSGetType(petsclib::PetscLibType,snes::PetscSNES)

Get the type of multistage smoother SNESMS

Not Collective

Input Parameter:

  • snes - nonlinear solver context

Output Parameter:

  • mstype - type of multistage method

Level: advanced

-seealso: , SNESMS, SNESMSSetType(), SNESMSType

External Links

source
PETSc.LibPETSc.SNESMSRegisterMethod
SNESMSRegister(petsclib::PetscLibType,name::SNESMSType, nstages::PetscInt, nregisters::PetscInt, stability::PetscReal, gamma::Vector{PetscReal}, delta::Vector{PetscReal}, betasub::Vector{PetscReal})

register a multistage scheme for SNESMS

Logically Collective, No Fortran Support

Input Parameters:

  • name - identifier for method
  • nstages - number of stages
  • nregisters - number of registers used by low-storage implementation
  • stability - scaled stability region
  • gamma - coefficients, see Ketcheson's paper {cite}ketcheson2010runge
  • delta - coefficients, see Ketcheson's paper {cite}ketcheson2010runge
  • betasub - subdiagonal of Shu-Osher form

Level: advanced

-seealso: , SNES, SNESMS

External Links

source
PETSc.LibPETSc.SNESMSSetDampingMethod
SNESMSSetDamping(petsclib::PetscLibType,snes::PetscSNES, damping::PetscReal)

Set the damping parameter for a SNESMS multistage scheme

Logically Collective

Input Parameters:

  • snes - nonlinear solver context
  • damping - damping parameter

Level: advanced

-seealso: , SNESMSGetDamping(), SNESMS

External Links

source
PETSc.LibPETSc.SNESMSSetTypeMethod
SNESMSSetType(petsclib::PetscLibType,snes::PetscSNES, mstype::SNESMSType)

Set the type of multistage smoother SNESMS

Logically Collective

Input Parameters:

  • snes - nonlinear solver context
  • mstype - type of multistage method

Level: advanced

-seealso: , SNESMS, SNESMSGetType(), SNESMSType

External Links

source
PETSc.LibPETSc.SNESMonitorMethod
SNESMonitor(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt, rnorm::PetscReal)

runs any SNES monitor routines provided with SNESMonitor() or the options database

Collective

Input Parameters:

  • snes - nonlinear solver context obtained from SNESCreate()
  • iter - current iteration number
  • rnorm - current relative norm of the residual

Level: developer

-seealso: , SNES, SNESMonitorSet()

External Links

source
PETSc.LibPETSc.SNESMonitorCancelMethod
SNESMonitorCancel(petsclib::PetscLibType,snes::PetscSNES)

Clears all the monitor functions for a SNES object.

Logically Collective

Input Parameter:

  • snes - the SNES context

Options Database Key:

  • -snes_monitor_cancel - cancels all monitors that have been hardwired

into a code by calls to SNESMonitorSet(), but does not cancel those set via the options database

Level: intermediate

-seealso: , SNES, SNESMonitorDefault(), SNESMonitorSet()

External Links

source
PETSc.LibPETSc.SNESMonitorDefaultMethod
SNESMonitorDefault(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNESSolve() (default).

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - viewer and format structure

Options Database Key:

  • -snes_monitor - use this function to monitor the convergence of the nonlinear solver

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorFunction(), SNESMonitorResidual(), SNESMonitorSolutionUpdate(), SNESMonitorScaling(), SNESMonitorRange(), SNESMonitorRatio(), SNESMonitorDefaultField(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorDefaultFieldMethod
SNESMonitorDefaultField(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNESSolve(), separated into fields.

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - the PetscViewer

Options Database Key:

  • -snes_monitor_field - activate this monitor

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorFieldsMethod
SNESMonitorFields(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors the residual for each field separately

Collective

Input Parameters:

  • snes - the SNES context, must have an attached DM
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - PetscViewerAndFormat of PetscViewerType PETSCVIEWERASCII

Level: intermediate

-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault()

External Links

source
PETSc.LibPETSc.SNESMonitorJacUpdateSpectrumMethod
SNESMonitorJacUpdateSpectrum(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, fnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors the spectrun of the change in the Jacobian from the last Jacobian evaluation of a SNESSolve()

Collective

Input Parameters:

  • snes - the SNES context
  • it - iteration number
  • fnorm - 2-norm of residual
  • vf - viewer and format structure

Options Database Key:

  • -snes_monitor_jacupdate_spectrum - activates this monitor

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorRangeMethod
SNESMonitorRange(petsclib::PetscLibType,snes::PetscSNES, it::PetscInt, rnorm::PetscReal, vf::PetscViewerAndFormat)

Prints the percentage of residual elements that are more than 10 percent of the maximum entry in the residual in each iteration of a SNESSolve()

Collective

Input Parameters:

  • snes - SNES iterative context
  • it - iteration number
  • rnorm - 2-norm (preconditioned) residual value (may be estimated).
  • vf - unused monitor context

Options Database Key:

  • -snes_monitor_range - Activates SNESMonitorRange()

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorDefault(), SNESMonitorLGCreate(), SNESMonitorScaling(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorRatioMethod
SNESMonitorRatio(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNESSolve() by printing the ratio of residual norm at each iteration to the previous.

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual (or gradient)
  • vf - context of monitor

Options Database Key:

  • -snes_monitor_ratio - activate this monitor

Level: intermediate

-seealso: , SNESMonitorRationSetUp(), SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorRatioSetUpMethod
SNESMonitorRatioSetUp(petsclib::PetscLibType,snes::PetscSNES, vf::PetscViewerAndFormat)

Insures the SNES object is saving its history since this monitor needs access to it

Collective

Input Parameters:

  • snes - the SNES context
  • vf - PetscViewerAndFormat (ignored)

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorDefault(), SNESMonitorRatio(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorResidualMethod
SNESMonitorResidual(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNESSolve() by calling VecView() for the residual at each iteration.

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - a viewer

Options Database Key:

  • -snes_monitor_residual [ascii binary draw][:filename][:viewer format] - plots residual (not its norm) at each iteration

Level: intermediate

-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()

External Links

source
PETSc.LibPETSc.SNESMonitorSAWsMethod
SNESMonitorSAWs(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, rnorm::PetscReal, ctx::Cvoid)

monitor solution process of SNES using SAWs

Collective

Input Parameters:

  • snes - iterative context
  • n - iteration number
  • rnorm - 2-norm (preconditioned) residual value (may be estimated).
  • ctx - PetscViewer of type PETSCVIEWERSAWS

Level: advanced

-seealso: , PetscViewerSAWsOpen(), SNESMonitorSAWsDestroy(), SNESMonitorSAWsCreate()

External Links

source
PETSc.LibPETSc.SNESMonitorSAWsCreateMethod
ctx::Cvoid = SNESMonitorSAWsCreate(petsclib::PetscLibType,snes::PetscSNES)

create an SAWs monitor context for SNES

Collective

Input Parameter:

  • snes - SNES to monitor

Output Parameter:

  • ctx - context for monitor

Level: developer

-seealso: , SNESMonitorSet(), SNES, SNESMonitorSAWs(), SNESMonitorSAWsDestroy()

External Links

source
PETSc.LibPETSc.SNESMonitorScalingMethod
SNESMonitorScaling(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors the largest value in each row of the Jacobian of a SNESSolve()

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - viewer and format structure

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorSolution(), SNESMonitorRange(), SNESMonitorJacUpdateSpectrum(), PetscViewerFormat, PetscViewerAndFormat

External Links

source
PETSc.LibPETSc.SNESMonitorSetMethod
SNESMonitorSet(petsclib::PetscLibType,snes::PetscSNES, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn)

Sets an ADDITIONAL function that is to be used at every iteration of the SNES nonlinear solver to display the iteration's progress.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • f - the monitor function, for the calling sequence see SNESMonitorFunction
  • mctx - [optional] user-defined context for private data for the monitor routine (use NULL if no context is desired)
  • monitordestroy - [optional] routine that frees monitor context (may be NULL), see PetscCtxDestroyFn for the calling sequence

Options Database Keys:

  • -snes_monitor - sets SNESMonitorDefault()
  • -snes_monitor draw::draw_lg - sets line graph monitor,
  • -snes_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to SNESMonitorSet(), but does not cancel those set via

the options database.

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESMonitorDefault(), SNESMonitorCancel(), SNESMonitorFunction, PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.SNESMonitorSetFromOptionsMethod
SNESMonitorSetFromOptions(petsclib::PetscLibType,snes::PetscSNES, name::String, help::String, manual::String, monitor::external, monitorsetup::external)

Sets a monitor function and viewer appropriate for the type indicated by the user

Collective

Input Parameters:

  • snes - SNES object you wish to monitor
  • name - the monitor type one is seeking
  • help - message indicating what monitoring is done
  • manual - manual page for the monitor
  • monitor - the monitor function, this must use a PetscViewerFormat as its context
  • monitorsetup - a function that is called once ONLY if the user selected this monitor that may set additional features of the SNES or PetscViewer objects

Calling sequence of monitor:

  • snes - the nonlinear solver context
  • it - the current iteration
  • r - the current function norm
  • vf - a PetscViewerAndFormat struct that contains the PetscViewer and PetscViewerFormat to use

Calling sequence of monitorsetup:

  • snes - the nonlinear solver context
  • vf - a PetscViewerAndFormat struct that contains the PetscViewer and PetscViewerFormat to use

Options Database Key:

  • -name - trigger the use of this monitor in SNESSetFromOptions()

Level: advanced

-seealso: , PetscOptionsCreateViewer(), PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHeadBegin(), PetscOptionsStringArray(), PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), PetscOptionsFList(), PetscOptionsEList()

External Links

source
PETSc.LibPETSc.SNESMonitorSolutionMethod
SNESMonitorSolution(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNES SNESSolve() by calling VecView() for the approximate solution at each iteration.

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - a viewer

Options Database Key:

  • -snes_monitor_solution [ascii binary draw][:filename][:viewer format] - plots solution at each iteration

Level: intermediate

-seealso: , SNES, SNESMonitorSet(), SNESMonitorDefault(), VecView()

External Links

source
PETSc.LibPETSc.SNESMonitorSolutionUpdateMethod
SNESMonitorSolutionUpdate(petsclib::PetscLibType,snes::PetscSNES, its::PetscInt, fgnorm::PetscReal, vf::PetscViewerAndFormat)

Monitors progress of a SNESSolve() by calling VecView() for the UPDATE to the solution at each iteration.

Collective

Input Parameters:

  • snes - the SNES context
  • its - iteration number
  • fgnorm - 2-norm of residual
  • vf - a viewer

Options Database Key:

  • -snes_monitor_solution_update [ascii binary draw][:filename][:viewer format] - plots update to solution at each iteration

Level: intermediate

-seealso: , SNESMonitorSet(), SNESMonitorDefault(), VecView(), SNESMonitor()

External Links

source
PETSc.LibPETSc.SNESMultiblockGetSubSNESMethod
n::PetscInt = SNESMultiblockGetSubSNES(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES})

Gets the SNES contexts for all blocks in a SNESMULTIBLOCK solver.

Not Collective but each SNES obtained is parallel

Input Parameter:

  • snes - the solver context

Output Parameters:

  • n - the number of blocks
  • subsnes - the array of SNES contexts

Level: advanced

-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockSetIS(), SNESMultiblockSetFields()

External Links

source
PETSc.LibPETSc.SNESMultiblockSetBlockSizeMethod
SNESMultiblockSetBlockSize(petsclib::PetscLibType,snes::PetscSNES, bs::PetscInt)

Sets the block size for structured block division in a SNESMULTIBLOCK solver. If not set the matrix block size is used.

Logically Collective

Input Parameters:

  • snes - the solver context
  • bs - the block size

Level: intermediate

-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetFields()

External Links

source
PETSc.LibPETSc.SNESMultiblockSetFieldsMethod
SNESMultiblockSetFields(petsclib::PetscLibType,snes::PetscSNES, name::String, n::PetscInt, fields::PetscInt)

Sets the fields for one particular block in a SNESMULTIBLOCK solver

Logically Collective

Input Parameters:

  • snes - the solver
  • name - name of this block, if NULL the number of the block is used
  • n - the number of fields in this block
  • fields - the fields in this block

Level: intermediate

-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetIS()

External Links

source
PETSc.LibPETSc.SNESMultiblockSetISMethod
SNESMultiblockSetIS(petsclib::PetscLibType,snes::PetscSNES, name::String, is::IS)

Sets the global row indices for one particular block in a SNESMULTIBLOCK solver

Logically Collective

Input Parameters:

  • snes - the solver context
  • name - name of this block, if NULL the number of the block is used
  • is - the index set that defines the global row indices in this block

Level: intermediate

-seealso: , SNES, SNESMULTIBLOCK, SNESMultiblockGetSubSNES(), SNESMultiblockSetBlockSize(), SNESMultiblockSetFields()

External Links

source
PETSc.LibPETSc.SNESMultiblockSetTypeMethod
SNESMultiblockSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCCompositeType)

Sets the type of block combination used for a SNESMULTIBLOCK solver

Logically Collective

Input Parameters:

  • snes - the solver context
  • type - PC_COMPOSITE_ADDITIVE, PC_COMPOSITE_MULTIPLICATIVE (default), PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE

Options Database Key:

  • -snes_multiblock_type <type: one of multiplicative, additive, symmetric_multiplicative> - Sets block combination type

Level: advanced

-seealso: , SNES, SNESMULTIBLOCK, PCCompositeSetType(), PC_COMPOSITE_ADDITIVE, PC_COMPOSITE_MULTIPLICATIVE, PC_COMPOSITE_SYMMETRIC_MULTIPLICATIVE, PCCompositeType, SNESCOMPOSITE, SNESCompositeSetType()

External Links

source
PETSc.LibPETSc.SNESNASMGetDampingMethod
dmp::PetscReal = SNESNASMGetDamping(petsclib::PetscLibType,snes::PetscSNES)

Gets the update damping for SNESNASM the nonlinear additive Schwarz solver

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • dmp - damping

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMSetDamping()

External Links

source
PETSc.LibPETSc.SNESNASMGetNumberMethod
n::PetscInt = SNESNASMGetNumber(petsclib::PetscLibType,snes::PetscSNES)

Gets number of subsolvers

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • n - the number of subsolvers

Level: intermediate

-seealso: , SNESNASM, SNESNASMGetSNES()

External Links

source
PETSc.LibPETSc.SNESNASMGetSNESMethod
SNESNASMGetSNES(petsclib::PetscLibType,snes::PetscSNES, i::PetscInt, subsnes::PetscSNES)

Gets a subsolver

Not Collective

Input Parameters:

  • snes - the SNES context
  • i - the number of the subsnes to get

Output Parameter:

  • subsnes - the subsolver context

Level: intermediate

-seealso: , SNESNASM, SNESNASMGetNumber()

External Links

source
PETSc.LibPETSc.SNESNASMGetSubdomainVecsMethod
n::PetscInt = SNESNASMGetSubdomainVecs(petsclib::PetscLibType,snes::PetscSNES, x::Vector{PetscVec}, y::Vector{PetscVec}, b::Vector{PetscVec}, xl::Vector{PetscVec})

Get the processor

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • n - the number of local subdomains
  • x - The subdomain solution vector
  • y - The subdomain step vector
  • b - The subdomain RHS vector
  • xl - The subdomain local vectors (ghosted)

Level: developer

-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()

External Links

source
PETSc.LibPETSc.SNESNASMGetSubdomainsMethod
n::PetscInt = SNESNASMGetSubdomains(petsclib::PetscLibType,snes::PetscSNES, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter})

Get the local subdomain contexts for the nonlinear additive Schwarz solver

Not Collective but some of the objects returned will be parallel

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • n - the number of local subdomains
  • subsnes - solvers defined on the local subdomains
  • iscatter - scatters into the nonoverlapping portions of the local subdomains
  • oscatter - scatters into the overlapping portions of the local subdomains
  • gscatter - scatters into the (ghosted) local vector of the local subdomain

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMSetSubdomains()

External Links

source
PETSc.LibPETSc.SNESNASMGetTypeMethod
type::PCASMType = SNESNASMGetType(petsclib::PetscLibType,snes::PetscSNES)

Get the type of subdomain update used for the nonlinear additive Schwarz solver SNESNASM

Logically Collective

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • type - the type of update

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMSetType(), PCASMGetType(), PC_ASM_BASIC, PC_ASM_RESTRICT, PCASMType

External Links

source
PETSc.LibPETSc.SNESNASMSetComputeFinalJacobianMethod
SNESNASMSetComputeFinalJacobian(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Schedules the computation of the global and subdomain Jacobians upon convergence for the nonlinear additive Schwarz solver

Collective

Input Parameters:

  • snes - the SNES context
  • flg - PETSC_TRUE to compute the Jacobians

Level: developer

-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()

External Links

source
PETSc.LibPETSc.SNESNASMSetDampingMethod
SNESNASMSetDamping(petsclib::PetscLibType,snes::PetscSNES, dmp::PetscReal)

Sets the update damping for SNESNASM the nonlinear additive Schwarz solver

Logically Collective

Input Parameters:

  • snes - the SNES context
  • dmp - damping

Options Database Key:

  • -snes_nasm_damping <dmp> - the new solution is obtained as old solution plus dmp times (sum of the solutions on the subdomains)

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMGetDamping()

External Links

source
PETSc.LibPETSc.SNESNASMSetSubdomainsMethod
SNESNASMSetSubdomains(petsclib::PetscLibType,snes::PetscSNES, n::PetscInt, subsnes::Vector{PetscSNES}, iscatter::Vector{VecScatter}, oscatter::Vector{VecScatter}, gscatter::Vector{VecScatter})

Manually Set the context required to restrict and solve subdomain problems in the nonlinear additive Schwarz solver

Logically Collective

Input Parameters:

  • snes - the SNES context
  • n - the number of local subdomains
  • subsnes - solvers defined on the local subdomains
  • iscatter - scatters into the nonoverlapping portions of the local subdomains
  • oscatter - scatters into the overlapping portions of the local subdomains
  • gscatter - scatters into the (ghosted) local vector of the local subdomain

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMGetSubdomains()

External Links

source
PETSc.LibPETSc.SNESNASMSetTypeMethod
SNESNASMSetType(petsclib::PetscLibType,snes::PetscSNES, type::PCASMType)

Set the type of subdomain update used for the nonlinear additive Schwarz solver SNESNASM

Logically Collective

Input Parameters:

  • snes - the SNES context
  • type - the type of update, PC_ASM_BASIC or PC_ASM_RESTRICT

Options Database Key:

  • -snes_nasm_type <basic,restrict> - type of subdomain update used

Level: intermediate

-seealso: , SNES, SNESNASM, SNESNASMGetType(), PCASMSetType(), PC_ASM_BASIC, PC_ASM_RESTRICT, PCASMType

External Links

source
PETSc.LibPETSc.SNESNASMSetWeightMethod
SNESNASMSetWeight(petsclib::PetscLibType,snes::PetscSNES, weight::PetscVec)

Sets weight to use when adding overlapping updates

Collective

Input Parameters:

  • snes - the SNES context
  • weight - the weights to use (typically 1/N for each dof, where N is the number of patches it appears in)

Level: intermediate

-seealso: , SNESNASM

External Links

source
PETSc.LibPETSc.SNESNCGSetTypeMethod
SNESNCGSetType(petsclib::PetscLibType,snes::PetscSNES, btype::SNESNCGType)

Sets the conjugate update type for nonlinear CG SNESNCG.

Logically Collective

Input Parameters:

  • snes - the iterative context
  • btype - update type, see SNESNCGType

Options Database Key:

  • -snes_ncg_type <prp,fr,hs,dy,cd> - strategy for selecting algorithm for computing beta

Level: intermediate

-seealso: , SNES, SNESNCG, SNESNCGType, SNES_NCG_FR, SNES_NCG_PRP, SNES_NCG_HS, SNES_NCG_DY, SNES_NCG_CD

External Links

source
PETSc.LibPETSc.SNESNGMRESSetRestartFmRiseMethod
SNESNGMRESSetRestartFmRise(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Increase the restart count if the step xM increases the residual FM inside a SNESNGMRES solve

Input Parameters:

  • snes - the SNES context.
  • flg - boolean value deciding whether to use the option or not, default is PETSC_FALSE

Options Database Key:

  • -snes_ngmres_restart_fm_rise - Increase the restart count if the step xM increases the residual FM

Level: advanced

-seealso: , SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartType()

External Links

source
PETSc.LibPETSc.SNESNGMRESSetRestartTypeMethod
SNESNGMRESSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESNGMRESRestartType)

Sets the restart type for SNESNGMRES.

Logically Collective

Input Parameters:

  • snes - the iterative context
  • rtype - restart type, see SNESNGMRESRestartType

Options Database Keys:

  • -snes_ngmres_restart_type<difference,periodic,none> - set the restart type
  • -snes_ngmres_restart <30> - sets the number of iterations before restart for periodic

Level: intermediate

-seealso: , SNES, SNES_NGMRES_RESTART_DIFFERENCE, SNESNGMRES, SNESNGMRESRestartType, SNESNGMRESSetRestartFmRise(), SNESNGMRESSetSelectType()

External Links

source
PETSc.LibPETSc.SNESNGMRESSetSelectTypeMethod
SNESNGMRESSetSelectType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESNGMRESSelectType)

Sets the selection type for SNESNGMRES. This determines how the candidate solution and combined solution are used to create the next iterate.

Logically Collective

Input Parameters:

  • snes - the iterative context
  • stype - selection type, see SNESNGMRESSelectType

Options Database Key:

  • -snes_ngmres_select_type<difference,none,linesearch> - select type

Level: intermediate

-seealso: , SNES, SNESNGMRES, SNESNGMRESSelectType, SNES_NGMRES_SELECT_NONE, SNES_NGMRES_SELECT_DIFFERENCE, SNES_NGMRES_SELECT_LINESEARCH, SNESNGMRESSetRestartType()

External Links

source
PETSc.LibPETSc.SNESNGSGetSweepsMethod
sweeps::PetscInt = SNESNGSGetSweeps(petsclib::PetscLibType,snes::PetscSNES)

Gets the number of sweeps nonlinear GS will use in SNESNCG

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • sweeps - the number of sweeps of nonlinear GS to perform.

Level: intermediate

-seealso: , SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSSetSweeps()

External Links

source
PETSc.LibPETSc.SNESNGSGetTolerancesMethod
SNESNGSGetTolerances(petsclib::PetscLibType,snes::PetscSNES, atol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt)

Gets various parameters used in convergence tests for nonlinear Gauss

Not Collective

Input Parameters:

  • snes - the SNES context
  • atol - absolute convergence tolerance
  • rtol - relative convergence tolerance
  • stol - convergence tolerance in terms of the norm

of the change in the solution between steps

  • maxit - maximum number of iterations

Level: intermediate

-seealso: , SNES, SNESNCG, SNESSetTolerances()

External Links

source
PETSc.LibPETSc.SNESNGSSetSweepsMethod
SNESNGSSetSweeps(petsclib::PetscLibType,snes::PetscSNES, sweeps::PetscInt)

Sets the number of sweeps of nonlinear GS to use in SNESNCG

Logically Collective

Input Parameters:

  • snes - the SNES context
  • sweeps - the number of sweeps of nonlinear GS to perform.

Options Database Key:

  • -snes_ngs_sweeps <n> - Number of sweeps of nonlinear GS to apply

Level: intermediate

-seealso: , SNES, SNESNCG, SNESSetNGS(), SNESGetNGS(), SNESSetNPC(), SNESNGSGetSweeps()

External Links

source
PETSc.LibPETSc.SNESNGSSetTolerancesMethod
SNESNGSSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt)

Sets various parameters used in convergence tests for nonlinear Gauss

Logically Collective

Input Parameters:

  • snes - the SNES context
  • abstol - absolute convergence tolerance
  • rtol - relative convergence tolerance
  • stol - 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

-seealso: , SNES, SNESNCG

External Links

source
PETSc.LibPETSc.SNESNewtonALComputeFunctionMethod
SNESNewtonALComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Q::PetscVec)

Calls the function that has been set with SNESNewtonALSetFunction().

Collective

Input Parameters:

  • snes - the SNES context
  • X - input vector

Output Parameter:

  • Q - tangent load vector, as set by SNESNewtonALSetFunction()

Level: developer

-seealso: , SNES, SNESNewtonALSetFunction(), SNESNewtonALGetFunction()

External Links

source
PETSc.LibPETSc.SNESNewtonALGetFunctionMethod
SNESNewtonALGetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid)

Get the user function and context set with SNESNewtonALSetFunction

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] tangent load function evaluation routine, see SNESNewtonALSetFunction() for the call sequence
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESNEWTONAL, SNESNewtonALSetFunction()

External Links

source
PETSc.LibPETSc.SNESNewtonALGetLoadParameterMethod
lambda::PetscReal = SNESNewtonALGetLoadParameter(petsclib::PetscLibType,snes::PetscSNES)

Get the value of the load parameter lambda for the arc

Logically Collective

Input Parameter:

  • snes - the nonlinear solver object

Output Parameter:

  • lambda - the arc-length parameter

Level: intermediate

-seealso: , SNES, SNESNEWTONAL, SNESNewtonALSetFunction()

External Links

source
PETSc.LibPETSc.SNESNewtonALSetCorrectionTypeMethod
SNESNewtonALSetCorrectionType(petsclib::PetscLibType,snes::PetscSNES, ctype::SNESNewtonALCorrectionType)

Set the type of correction to use in the arc

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • ctype - the type of correction to use

Options Database Key:

  • -snes_newtonal_correction_type <type> - Set the type of correction to use; use -help for a list of available types

Level: intermediate

-seealso: , SNES, SNESNEWTONAL, SNESNewtonALCorrectionType

External Links

source
PETSc.LibPETSc.SNESNewtonALSetFunctionMethod
SNESNewtonALSetFunction(petsclib::PetscLibType,snes::PetscSNES, func::SNESFunctionFn, ctx::Cvoid)

Sets a user function that is called at each function evaluation to compute the tangent load vector for the arc-length continuation method.

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] tangent load function evaluation routine, see SNESFunctionFn for the calling sequence. U is the current solution vector, Q is the output tangent load vector
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESNEWTONAL, SNESNewtonALGetFunction(), SNESNewtonALGetLoadParameter()

External Links

source
PETSc.LibPETSc.SNESNewtonTRDCGetRhoFlagMethod
rho_flag::PetscBool = SNESNewtonTRDCGetRhoFlag(petsclib::PetscLibType,snes::PetscSNES)

Get whether the current solution update is within the trust

Logically Collective

Input Parameter:

  • snes - the nonlinear solver object

Output Parameter:

  • rho_flag - PETSC_FALSE or PETSC_TRUE

Level: developer

-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRDCSetPostCheckMethod
SNESNewtonTRDCSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)

Sets a user function that is called after the search step has been determined but before the next function evaluation. Allows the user a chance to change or override the decision of the line search routine

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] function evaluation routine, for the calling sequence see SNESNewtonTRDCPostCheck()
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCSetPreCheck(), SNESNewtonTRDCGetPreCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRDCSetPreCheckMethod
SNESNewtonTRDCSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)

Sets a user function that is called before the search step has been determined. Allows the user a chance to change or override the trust region decision.

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] function evaluation routine, for the calling sequence see SNESNewtonTRDCPreCheck()
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESNEWTONTRDC, SNESNewtonTRDCPreCheck(), SNESNewtonTRDCGetPreCheck(), SNESNewtonTRDCSetPostCheck(), SNESNewtonTRDCGetPostCheck(), SNESNewtonTRDCGetRhoFlag()

External Links

source
PETSc.LibPETSc.SNESNewtonTRGetTolerancesMethod
delta_min::PetscReal,delta_max::PetscReal,delta_0::PetscReal = SNESNewtonTRGetTolerances(petsclib::PetscLibType,snes::PetscSNES)

Gets the trust region parameter tolerances.

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • delta_min - minimum allowed trust region size or NULL
  • delta_max - maximum allowed trust region size or NULL
  • delta_0 - initial trust region size or NULL

Level: intermediate

-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRSetTolerances()

External Links

source
PETSc.LibPETSc.SNESNewtonTRGetUpdateParametersMethod
eta1::PetscReal,eta2::PetscReal,eta3::PetscReal,t1::PetscReal,t2::PetscReal = SNESNewtonTRGetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES)

Gets the trust region update parameters.

Not Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • eta1 - acceptance tolerance
  • eta2 - shrinking tolerance
  • eta3 - enlarging tolerance
  • t1 - shrink factor
  • t2 - enlarge factor

Level: intermediate

-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRSetUpdateParameters()

External Links

source
PETSc.LibPETSc.SNESNewtonTRPostCheckMethod
changed_Y::PetscBool,changed_W::PetscBool = SNESNewtonTRPostCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec, W::PetscVec)

Runs the postcheck routine

Logically Collective

Input Parameters:

  • snes - the solver
  • X - The last solution
  • Y - The full step direction
  • W - The updated solution, W = X - Y

Output Parameters:

  • changed_Y - indicator if step has been changed
  • changed_W - Indicator if the new candidate solution W has been changed.

-seealso: , SNESNEWTONTR, SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRPreCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRPreCheckMethod
changed_Y::PetscBool = SNESNewtonTRPreCheck(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, Y::PetscVec)

Runs the precheck routine

Logically Collective

Input Parameters:

  • snes - the solver
  • X - The last solution
  • Y - The step direction

Output Parameter:

  • changed_Y - Indicator that the step direction Y has been changed.

Level: intermediate

-seealso: , SNESNEWTONTR, SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRPostCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetFallbackTypeMethod
SNESNewtonTRSetFallbackType(petsclib::PetscLibType,snes::PetscSNES, ftype::SNESNewtonTRFallbackType)

Set the type of fallback to use if the solution of the trust region subproblem is outside the radius

Input Parameters:

  • snes - the nonlinear solver object
  • ftype - the fallback type, see SNESNewtonTRFallbackType

Level: intermediate

-seealso: , SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetNormTypeMethod
SNESNewtonTRSetNormType(petsclib::PetscLibType,snes::PetscSNES, norm::NormType)

Specify the type of norm to use for the computation of the trust region.

Input Parameters:

  • snes - the nonlinear solver object
  • norm - the norm type

Level: intermediate

-seealso: SNESNEWTONTR, NormType

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetPostCheckMethod
SNESNewtonTRSetPostCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)

Sets a user function that is called after the search step has been determined but before the next function evaluation. Allows the user a chance to change or override the internal decision of the solver

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] function evaluation routine, for the calling sequence see SNESNewtonTRPostCheck()
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNESNEWTONTR, SNESNewtonTRPostCheck(), SNESNewtonTRGetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck()

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetPreCheckMethod
SNESNewtonTRSetPreCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)

Sets a user function that is called before the search step has been determined. Allows the user a chance to change or override the trust region decision.

Logically Collective

Input Parameters:

  • snes - the nonlinear solver object
  • func - [optional] function evaluation routine, for the calling sequence see SNESNewtonTRPreCheck()
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNESNEWTONTR, SNESNewtonTRPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(),

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetQNTypeMethod
SNESNewtonTRSetQNType(petsclib::PetscLibType,snes::PetscSNES, use::SNESNewtonTRQNType)

Specify to use a quasi

Input Parameters:

  • snes - the nonlinear solver object
  • use - the type of approximations to be used

Level: intermediate

-seealso: SNESNEWTONTR, SNESNewtonTRQNType, MATLMVM

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetTolerancesMethod
SNESNewtonTRSetTolerances(petsclib::PetscLibType,snes::PetscSNES, delta_min::PetscReal, delta_max::PetscReal, delta_0::PetscReal)

Sets the trust region parameter tolerances.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • delta_min - minimum allowed trust region size
  • delta_max - maximum allowed trust region size
  • delta_0 - initial trust region size

Options Database Key:

  • -snes_tr_deltamin <tol> - Set minimum size
  • -snes_tr_deltamax <tol> - Set maximum size
  • -snes_tr_delta0 <tol> - Set initial size

-seealso: , SNES, SNESNEWTONTR, SNESNewtonTRGetTolerances()

External Links

source
PETSc.LibPETSc.SNESNewtonTRSetUpdateParametersMethod
SNESNewtonTRSetUpdateParameters(petsclib::PetscLibType,snes::PetscSNES, eta1::PetscReal, eta2::PetscReal, eta3::PetscReal, t1::PetscReal, t2::PetscReal)

Sets the trust region update parameters.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • eta1 - acceptance tolerance
  • eta2 - shrinking tolerance
  • eta3 - enlarging tolerance
  • t1 - shrink factor
  • t2 - enlarge factor

Options Database Key:

  • -snes_tr_eta1 <tol> - Set eta1
  • -snes_tr_eta2 <tol> - Set eta2
  • -snes_tr_eta3 <tol> - Set eta3
  • -snes_tr_t1 <tol> - Set t1
  • -snes_tr_t2 <tol> - Set t2

-seealso: , SNES, SNESNEWTONTR, SNESSetObjective(), SNESNewtonTRGetUpdateParameters()

External Links

source
PETSc.LibPETSc.SNESObjectiveComputeFunctionDefaultFDMethod
SNESObjectiveComputeFunctionDefaultFD(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ctx::Cvoid)

Computes the gradient of a user provided objective function

Collective

Input Parameters:

  • snes - the SNES context
  • X - the state vector
  • ctx - 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 with SNESSetObjective()) with finite difference

Level: advanced

-seealso: , SNESSetObjective(), SNESSetFunction(), SNESComputeObjective(), SNESComputeJacobianDefault(), SNESObjectiveFn

External Links

source
PETSc.LibPETSc.SNESParametersInitializeMethod
SNESParametersInitialize(petsclib::PetscLibType,snes::PetscSNES)

Sets all the parameters in snes to their default value (when SNESCreate() was called) if they currently contain default values

Collective

Input Parameter:

  • snes - the SNES object

Level: developer

-seealso: , SNES, SNESSolve(), SNESDestroy(), SNESSetLagPreconditioner(), SNESSetLagJacobian(), PetscObjectParameterSetDefault()

External Links

source
PETSc.LibPETSc.SNESPruneJacobianColorMethod
SNESPruneJacobianColor(petsclib::PetscLibType,snes::PetscSNES, J::PetscMat, B::PetscMat)

Remove nondiagonal zeros in the Jacobian matrix and update the MatMFFD coloring information based on the new nonzero structure

Collective

Input Parameters:

  • snes - the SNES context
  • J - Jacobian matrix (not altered in this routine)
  • B - newly computed Jacobian matrix to use with preconditioner (generally the same as J)

Level: intermediate

-seealso: , SNESComputeJacobianDefaultColor(), MatEliminateZeros(), MatFDColoringCreate(), MatFDColoringSetFunction()

External Links

source
PETSc.LibPETSc.SNESPythonGetTypeMethod
pyname::String = SNESPythonGetType(petsclib::PetscLibType,snes::PetscSNES)

Get the type of a SNES object implemented in Python set with SNESPythonSetType()

Not Collective

Input Parameter:

  • snes - the nonlinear solver (SNES) context.

Output Parameter:

  • pyname - full dotted Python name [package].module[.{class|function}]

Level: intermediate

-seealso: , SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonSetType()

External Links

source
PETSc.LibPETSc.SNESPythonSetTypeMethod
SNESPythonSetType(petsclib::PetscLibType,snes::PetscSNES, pyname::String)

Initialize a SNES object implemented in Python.

Collective

Input Parameters:

  • snes - the nonlinear solver (SNES) context.
  • pyname - full dotted Python name [package].module[.{class|function}]

Options Database Key:

  • -snes_python_type <pyname> - python class

Level: intermediate

-seealso: , SNES, SNESCreate(), SNESSetType(), SNESPYTHON, PetscPythonInitialize(), SNESPythonGetType()

External Links

source
PETSc.LibPETSc.SNESQNSetRestartTypeMethod
SNESQNSetRestartType(petsclib::PetscLibType,snes::PetscSNES, rtype::SNESQNRestartType)

Sets the restart type for SNESQN.

Logically Collective

Input Parameters:

  • snes - the iterative context
  • rtype - restart type, see SNESQNRestartType

Options Database Keys:

  • -snes_qn_restart_type <powell,periodic,none> - set the restart type
  • -snes_qn_m <m> - sets the number of stored updates and the restart period for periodic

Level: intermediate

-seealso: , SNES, SNESQN, SNESQNRestartType, SNES_QN_RESTART_NONE, SNES_QN_RESTART_POWELL, SNES_QN_RESTART_PERIODIC, SNESQNType, SNESQNScaleType

External Links

source
PETSc.LibPETSc.SNESQNSetScaleTypeMethod
SNESQNSetScaleType(petsclib::PetscLibType,snes::PetscSNES, stype::SNESQNScaleType)

Sets the scaling type for the inner inverse Jacobian in SNESQN.

Logically Collective

Input Parameters:

  • snes - the nonlinear solver context
  • stype - scale type, see SNESQNScaleType

Options Database Key:

  • -snes_qn_scale_type <diagonal,none,scalar,jacobian> - Scaling type

Level: intermediate

-seealso: , SNES, SNESQN, SNESLineSearch, SNESQNScaleType, SNESSetJacobian(), SNESQNType, SNESQNRestartType

External Links

source
PETSc.LibPETSc.SNESQNSetTypeMethod
SNESQNSetType(petsclib::PetscLibType,snes::PetscSNES, qtype::SNESQNType)

Sets the quasi

Logically Collective

Input Parameters:

  • snes - the iterative context
  • qtype - variant type, see SNESQNType

Options Database Key:

  • -snes_qn_type <lbfgs,broyden,badbroyden> - quasi-Newton type

Level: intermediate

-seealso: , SNESQN, SNES_QN_LBFGS, SNES_QN_BROYDEN, SNES_QN_BADBROYDEN, SNESQNType, SNESQNScaleType, TAOLMVM, TAOBLMVM

External Links

source
PETSc.LibPETSc.SNESRegisterMethod
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 solver
  • function - routine to create method context

Level: advanced

-seealso: , SNESRegisterAll(), SNESRegisterDestroy()

External Links

source
PETSc.LibPETSc.SNESResetMethod
SNESReset(petsclib::PetscLibType,snes::PetscSNES)

Resets a SNES context to the state it was in before SNESSetUp() was called and removes any allocated Vec and Mat from its data structures

Collective

Input Parameter:

  • snes - the nonlinear iterative solver context obtained from SNESCreate()

Level: intermediate

-seealso: , SNES, SNESDestroy(), SNESCreate(), SNESSetUp(), SNESSolve()

External Links

source
PETSc.LibPETSc.SNESResetCountersMethod
SNESResetCounters(petsclib::PetscLibType,snes::PetscSNES)

Reset counters for linear iterations and function evaluations.

Logically Collective

Input Parameters:

  • snes - SNES context

Level: developer

-seealso: , SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()

External Links

source
PETSc.LibPETSc.SNESResetFromOptionsMethod
SNESResetFromOptions(petsclib::PetscLibType,snes::PetscSNES)

Sets various SNES and KSP parameters from user options ONLY if the SNESSetFromOptions() was previously called

Collective

Input Parameter:

  • snes - the SNES context

Level: advanced

-seealso: , SNES, SNESSetFromOptions(), SNESSetOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESSetAlwaysComputesFinalResidualMethod
SNESSetAlwaysComputesFinalResidual(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

tells the SNES to always compute the residual (nonlinear function value) at the final solution

Logically Collective

Input Parameters:

  • snes - the shell SNES
  • flg - PETSC_TRUE to always compute the residual

Level: advanced

-seealso: , SNES, SNESFAS, SNESSolve(), SNESGetAlwaysComputesFinalResidual()

External Links

source
PETSc.LibPETSc.SNESSetApplicationContextMethod
SNESSetApplicationContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)

Sets the optional user

Logically Collective

Input Parameters:

  • snes - the SNES context
  • ctx - the user context

Level: intermediate

-seealso: , SNES, SNESSetComputeApplicationContext(), SNESGetApplicationContext()

External Links

source
PETSc.LibPETSc.SNESSetCheckJacobianDomainErrorMethod
SNESSetCheckJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

tells SNESSolve() whether to check if the user called SNESSetJacobianDomainError() Jacobian domain error after each Jacobian evaluation. By default, it checks for the Jacobian domain error in the debug mode, and does not check it in the optimized mode.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • flg - indicates if or not to check Jacobian domain error after each Jacobian evaluation

Level: advanced

-seealso: , SNES, SNESConvergedReason, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESGetCheckJacobianDomainError()

External Links

source
PETSc.LibPETSc.SNESSetComputeApplicationContextMethod
SNESSetComputeApplicationContext(petsclib::PetscLibType,snes::PetscSNES, compute::external, destroy::PetscCtxDestroyFn)

Sets an optional function to compute a user the nonlinear solvers.

Logically Collective; No Fortran Support

Input Parameters:

  • snes - the SNES context
  • compute - function to compute the context
  • destroy - function to destroy the context, see PetscCtxDestroyFn for the calling sequence

Calling sequence of compute:

  • snes - the SNES context
  • ctx - context to be computed

Level: intermediate

-seealso: , SNESGetApplicationContext(), SNESSetApplicationContext(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.SNESSetComputeInitialGuessMethod
SNESSetComputeInitialGuess(petsclib::PetscLibType,snes::PetscSNES, func::SNESInitialGuessFn, ctx::Cvoid)

Sets a routine used to compute an initial guess for the nonlinear problem

Logically Collective

Input Parameters:

  • snes - the SNES context
  • func - function evaluation routine, see SNESInitialGuessFn for the calling sequence
  • ctx - [optional] user-defined context for private data for the

function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESSetFunction(), SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESInitialGuessFn

External Links

source
PETSc.LibPETSc.SNESSetConvergedReasonMethod
SNESSetConvergedReason(petsclib::PetscLibType,snes::PetscSNES, reason::SNESConvergedReason)

Sets the reason the SNES iteration was stopped.

Not Collective

Input Parameters:

  • snes - the SNES context
  • reason - negative value indicates diverged, positive value converged, see SNESConvergedReason or the

manual pages for the individual convergence tests for complete lists

Level: developer

-seealso: , SNESGetConvergedReason(), SNESSetConvergenceTest(), SNESConvergedReason

External Links

source
PETSc.LibPETSc.SNESSetConvergenceHistoryMethod
SNESSetConvergenceHistory(petsclib::PetscLibType,snes::PetscSNES, a::Vector{PetscReal}, its::Vector{PetscInt}, na::PetscInt, reset::PetscBool)

Sets the arrays used to hold the convergence history.

Logically Collective

Input Parameters:

  • snes - iterative context obtained from SNESCreate()
  • a - array to hold history, this array will contain the function norms computed at each step
  • its - integer array holds the number of linear iterations for each solve.
  • na - size of a and its
  • reset - PETSC_TRUE indicates each new nonlinear solve resets the history counter to zero,

else it continues storing new values for new nonlinear solves after the old ones

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESGetConvergenceHistory()

External Links

source
PETSc.LibPETSc.SNESSetConvergenceTestMethod
SNESSetConvergenceTest(petsclib::PetscLibType,snes::PetscSNES, SNESConvergenceTestFunction::external, cctx::Cvoid, destroy::external)

Sets the function that is to be used to test for convergence of the nonlinear iterative solution.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • SNESConvergenceTestFunction - routine to test for convergence
  • cctx - [optional] context for private data for the convergence routine (may be NULL)
  • destroy - [optional] destructor for the context (may be NULL; PETSC_NULL_FUNCTION in Fortran)

Level: advanced

-seealso: , SNES, SNESConvergedDefault(), SNESConvergedSkip(), SNESConvergenceTestFunction

External Links

source
PETSc.LibPETSc.SNESSetCountersResetMethod
SNESSetCountersReset(petsclib::PetscLibType,snes::PetscSNES, reset::PetscBool)

Sets whether or not the counters for linear iterations and function evaluations are reset every time SNESSolve() is called.

Logically Collective

Input Parameters:

  • snes - SNES context
  • reset - whether to reset the counters or not, defaults to PETSC_TRUE

Level: developer

-seealso: , SNESGetNumberFunctionEvals(), SNESGetLinearSolveIterations(), SNESGetNPC()

External Links

source
PETSc.LibPETSc.SNESSetDMMethod
SNESSetDM(petsclib::PetscLibType,snes::PetscSNES, dm::PetscDM)

Sets the DM that may be used by some SNES nonlinear solvers or their underlying preconditioners

Logically Collective

Input Parameters:

  • snes - the nonlinear solver context
  • dm - the DM, cannot be NULL

Level: intermediate

-seealso: , DM, SNES, SNESGetDM(), KSPSetDM(), KSPGetDM()

External Links

source
PETSc.LibPETSc.SNESSetDivergenceToleranceMethod
SNESSetDivergenceTolerance(petsclib::PetscLibType,snes::PetscSNES, divtol::PetscReal)

Sets the divergence tolerance used for the SNES divergence test.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • divtol - the divergence tolerance. Use PETSC_UNLIMITED to deactivate the test. If the residual norm F(x^n) ≥ divtol * F(x^0) the solver

is stopped due to divergence.

Options Database Key:

  • -snes_divergence_tolerance <divtol> - Sets divtol

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESSetTolerances(), SNESGetDivergenceTolerance()

External Links

source
PETSc.LibPETSc.SNESSetErrorIfNotConvergedMethod
SNESSetErrorIfNotConverged(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Causes SNESSolve() to generate an error immediately if the solver has not converged.

Logically Collective

Input Parameters:

  • snes - iterative context obtained from SNESCreate()
  • flg - PETSC_TRUE indicates you want the error generated

Options Database Key:

  • -snes_error_if_not_converged <true,false> - cause an immediate error condition and stop the program if the solver does not converge

Level: intermediate

-seealso: , SNES, SNESGetErrorIfNotConverged(), KSPGetErrorIfNotConverged(), KSPSetErrorIfNotConverged()

External Links

source
PETSc.LibPETSc.SNESSetForceIterationMethod
SNESSetForceIteration(petsclib::PetscLibType,snes::PetscSNES, force::PetscBool)

force SNESSolve() to take at least one iteration regardless of the initial residual norm

Logically Collective

Input Parameters:

  • snes - the SNES context
  • force - PETSC_TRUE require at least one iteration

Options Database Key:

  • -snes_force_iteration <force> - Sets forcing an iteration

Level: intermediate

-seealso: , SNES, TS, SNESSetDivergenceTolerance()

External Links

source
PETSc.LibPETSc.SNESSetFromOptionsMethod
SNESSetFromOptions(petsclib::PetscLibType,snes::PetscSNES)

Sets various SNES and KSP parameters from user options.

Collective

Input Parameter:

  • snes - the SNES context

Options Database Keys:

  • -snes_type <type> - newtonls, newtontr, ngmres, ncg, nrichardson, qn, vi, fas, SNESType for 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> - force SNESSolve() 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. default SNESConvergedDefault(). skip SNESConvergedSkip() 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_lg_residualnorm - plots residual norm at each iteration
  • -snes_monitor_lg_range - plots residual norm at each iteration
  • -snes_monitor_pause_final - Pauses all monitor drawing after the solver ends
  • -snes_fd - use finite differences to compute Jacobian; very slow, only for testing
  • -snes_fd_color - use finite differences with coloring to compute Jacobian
  • -snes_mf_ksp_monitor - if using matrix-free multiply then print h at each KSP iteration
  • -snes_converged_reason - print the reason for convergence/divergence after each solve
  • -npc_snes_type <type> - the SNES type to use as a nonlinear preconditioner
  • -snes_test_jacobian <optional threshold> - compare the user provided Jacobian with one computed via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.
  • -snes_test_jacobian_view - display the user provided Jacobian, the finite difference Jacobian and the difference between them to help users detect the location of errors in the user provided Jacobian.

Options Database Keys for Eisenstat-Walker method:

  • -snes_ksp_ew - use Eisenstat-Walker method for determining linear system convergence
  • -snes_ksp_ew_version ver - version of Eisenstat-Walker method
  • -snes_ksp_ew_rtol0 <rtol0> - Sets rtol0
  • -snes_ksp_ew_rtolmax <rtolmax> - Sets rtolmax
  • -snes_ksp_ew_gamma <gamma> - Sets gamma
  • -snes_ksp_ew_alpha <alpha> - Sets alpha
  • -snes_ksp_ew_alpha2 <alpha2> - Sets alpha2
  • -snes_ksp_ew_threshold <threshold> - Sets threshold

Level: beginner

-seealso: , SNESType, SNESSetOptionsPrefix(), SNESResetFromOptions(), SNES, SNESCreate(), MatCreateSNESMF(), MatFDColoring

External Links

source
PETSc.LibPETSc.SNESSetFunctionMethod
SNESSetFunction(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, f::SNESFunctionFn, ctx::Cvoid)

Sets the function evaluation routine and function vector for use by the SNES routines in solving systems of nonlinear equations.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • r - vector to store function values, may be NULL
  • f - function evaluation routine; for calling sequence see SNESFunctionFn
  • ctx - [optional] user-defined context for private data for the

function evaluation routine (may be NULL)

Level: beginner

-seealso: , SNES, SNESGetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESSetPicard(), SNESFunctionFn

External Links

source
PETSc.LibPETSc.SNESSetFunctionDomainErrorMethod
SNESSetFunctionDomainError(petsclib::PetscLibType,snes::PetscSNES)

tells SNES that the input vector, a proposed new solution, to your function you provided to SNESSetFunction() is not in the functions domain. For example, a step with negative pressure.

Not Collective

Input Parameter:

  • snes - the SNES context

Level: advanced

-seealso: , SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetJacobianDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason(), SNES_DIVERGED_FUNCTION_DOMAIN

External Links

source
PETSc.LibPETSc.SNESSetFunctionNormMethod
SNESSetFunctionNorm(petsclib::PetscLibType,snes::PetscSNES, norm::PetscReal)

Sets the last computed residual norm.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • norm - the value of the norm

Level: developer

-seealso: , SNES, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule

External Links

source
PETSc.LibPETSc.SNESSetFunctionTypeMethod
SNESSetFunctionType(petsclib::PetscLibType,snes::PetscSNES, type::SNESFunctionType)

Sets the SNESFunctionType of the SNES method.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • type - the function type

Level: developer

Values of the function type:

  • SNES_FUNCTION_DEFAULT - the default for the given SNESType
  • SNES_FUNCTION_UNPRECONDITIONED - an unpreconditioned function evaluation (this is the function provided with SNESSetFunction()
  • SNES_FUNCTION_PRECONDITIONED - a transformation of the function provided with SNESSetFunction()

-seealso: , SNES, SNESFunctionType, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction(), SNESNormSchedule

External Links

source
PETSc.LibPETSc.SNESSetGridSequenceMethod
SNESSetGridSequence(petsclib::PetscLibType,snes::PetscSNES, steps::PetscInt)

sets the number of steps of grid sequencing that SNES will do

Logically Collective

Input Parameters:

  • snes - the SNES context
  • steps - the number of refinements to do, defaults to 0

Options Database Key:

  • -snes_grid_sequence <steps> - Use grid sequencing to generate initial guess

Level: intermediate

-seealso: , SNES, SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetGridSequence(), SNESSetDM(), SNESSolve()

External Links

source
PETSc.LibPETSc.SNESSetInitialFunctionMethod
SNESSetInitialFunction(petsclib::PetscLibType,snes::PetscSNES, f::PetscVec)

Set an already computed function evaluation at the initial guess to be reused by SNESSolve().

Logically Collective

Input Parameters:

  • snes - the SNES context
  • f - vector to store function value

Level: developer

-seealso: , SNES, SNESFAS, SNESSetFunction(), SNESComputeFunction(), SNESSetInitialFunctionNorm()

External Links

source
PETSc.LibPETSc.SNESSetIterationNumberMethod
SNESSetIterationNumber(petsclib::PetscLibType,snes::PetscSNES, iter::PetscInt)

Sets the current iteration number.

Not Collective

Input Parameters:

  • snes - SNES context
  • iter - iteration number

Level: developer

-seealso: , SNESGetLinearSolveIterations()

External Links

source
PETSc.LibPETSc.SNESSetJacobianMethod
SNESSetJacobian(petsclib::PetscLibType,snes::PetscSNES, Amat::PetscMat, Pmat::PetscMat, J::Union{SNESJacobianFn,Ptr}, ctx::Union{Cvoid,Ptr})

Sets the function to compute Jacobian as well as the location to store the matrix.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • Amat - the matrix that defines the (approximate) Jacobian
  • Pmat - the matrix to be used in constructing the preconditioner, usually the same as Amat.
  • J - Jacobian evaluation routine (if NULL then SNES retains any previously set value), see SNESJacobianFn for details
  • ctx - [optional] user-defined context for private data for the

Jacobian evaluation routine (may be NULL) (if NULL then SNES retains any previously set value)

Level: beginner

-seealso: , SNES, KSPSetOperators(), SNESSetFunction(), MatMFFDComputeJacobian(), SNESComputeJacobianDefaultColor(), MatStructure, SNESSetPicard(), SNESJacobianFn, SNESFunctionFn

External Links

source
PETSc.LibPETSc.SNESSetJacobianDomainErrorMethod
SNESSetJacobianDomainError(petsclib::PetscLibType,snes::PetscSNES)

tells SNES that the function you provided to SNESSetJacobian() at the proposed step. For example there is a negative element transformation.

Logically Collective

Input Parameter:

  • snes - the SNES context

Level: advanced

-seealso: , SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetFunctionDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason()

External Links

source
PETSc.LibPETSc.SNESSetKSPMethod
SNESSetKSP(petsclib::PetscLibType,snes::PetscSNES, ksp::PetscKSP)

Sets a KSP context for the SNES object to use

Not Collective, but the SNES and KSP objects must live on the same MPI_Comm

Input Parameters:

  • snes - the SNES context
  • ksp - the KSP context

Level: developer

-seealso: , SNES, KSP, KSPGetPC(), SNESCreate(), KSPCreate()

External Links

source
PETSc.LibPETSc.SNESSetLagJacobianMethod
SNESSetLagJacobian(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt)

Set when the Jacobian is rebuilt in the nonlinear solve. See SNESSetLagPreconditioner() for determining how often the preconditioner is rebuilt.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • 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 means rebuild at next chance but then never again

Options Database Keys:

  • -snes_lag_jacobian_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_jacobian <-2,1,2,...> - sets the lag
  • -snes_lag_preconditioner_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_preconditioner <-2,1,2,...> - sets the lag.

Level: intermediate

-seealso: , SNES, SNESGetLagPreconditioner(), SNESSetLagPreconditioner(), SNESGetLagJacobianPersists(), SNESSetLagPreconditionerPersists()

External Links

source
PETSc.LibPETSc.SNESSetLagJacobianPersistsMethod
SNESSetLagJacobianPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Set whether or not the Jacobian lagging persists through multiple nonlinear solves

Logically collective

Input Parameters:

  • snes - the SNES context
  • flg - jacobian lagging persists if true

Options Database Keys:

  • -snes_lag_jacobian_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_jacobian <-2,1,2,...> - sets the lag
  • -snes_lag_preconditioner_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_preconditioner <-2,1,2,...> - sets the lag

Level: advanced

-seealso: , SNES, SNESSetLagPreconditionerPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC()

External Links

source
PETSc.LibPETSc.SNESSetLagPreconditionerMethod
SNESSetLagPreconditioner(petsclib::PetscLibType,snes::PetscSNES, lag::PetscInt)

Sets when the preconditioner is rebuilt in the nonlinear solve SNESSolve().

Logically Collective

Input Parameters:

  • snes - the SNES context
  • lag - 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 multiple SNESSolve()
  • -snes_lag_jacobian <-2,1,2,...> - sets the lag
  • -snes_lag_preconditioner_persists <true,false> - sets the persistence through multiple SNESSolve()
  • -snes_lag_preconditioner <-2,1,2,...> - sets the lag

Level: intermediate

-seealso: , SNESGetLagPreconditioner(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESSetLagPreconditionerPersists(), SNESSetLagJacobianPersists(), SNES, SNESSolve()

External Links

source
PETSc.LibPETSc.SNESSetLagPreconditionerPersistsMethod
SNESSetLagPreconditionerPersists(petsclib::PetscLibType,snes::PetscSNES, flg::PetscBool)

Set whether or not the preconditioner lagging persists through multiple nonlinear solves

Logically Collective

Input Parameters:

  • snes - the SNES context
  • flg - preconditioner lagging persists if true

Options Database Keys:

  • -snes_lag_jacobian_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_jacobian <-2,1,2,...> - sets the lag
  • -snes_lag_preconditioner_persists <true,false> - sets the persistence through multiple SNES solves
  • -snes_lag_preconditioner <-2,1,2,...> - sets the lag

Level: developer

-seealso: , SNES, SNESSetLagJacobianPersists(), SNESSetLagJacobian(), SNESGetLagJacobian(), SNESGetNPC(), SNESSetLagPreconditioner()

External Links

source
PETSc.LibPETSc.SNESSetLineSearchMethod
SNESSetLineSearch(petsclib::PetscLibType,snes::PetscSNES, linesearch::SNESLineSearch)

Sets the SNESLineSearch to be used for a given SNES

Collective

Input Parameters:

  • snes - iterative context obtained from SNESCreate()
  • linesearch - the linesearch object

Level: developer

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch()

External Links

source
PETSc.LibPETSc.SNESSetMaxLinearSolveFailuresMethod
SNESSetMaxLinearSolveFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt)

the number of failed linear solve attempts allowed before SNES returns with a diverged reason of SNES_DIVERGED_LINEAR_SOLVE

Logically Collective

Input Parameters:

  • snes - SNES context
  • maxFails - maximum allowed linear solve failures, use PETSC_UNLIMITED to have no limit on the number of failures

Options Database Key:

  • -snes_max_linear_solve_fail <num> - The number of failures before the solve is terminated

Level: intermediate

-seealso: , SNESSetErrorIfNotConverged(), SNESGetLinearSolveFailures(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations()

External Links

source
PETSc.LibPETSc.SNESSetMaxNonlinearStepFailuresMethod
SNESSetMaxNonlinearStepFailures(petsclib::PetscLibType,snes::PetscSNES, maxFails::PetscInt)

Sets the maximum number of unsuccessful steps attempted by the nonlinear solver before it gives up and returns unconverged or generates an error

Not Collective

Input Parameters:

  • snes - SNES context
  • maxFails - maximum of unsuccessful steps allowed, use PETSC_UNLIMITED to have no limit on the number of failures

Options Database Key:

  • -snes_max_fail <n> - maximum number of unsuccessful steps allowed

Level: intermediate

-seealso: , SNESSetErrorIfNotConverged(), SNESGetMaxLinearSolveFailures(), SNESGetLinearSolveIterations(), SNESSetMaxLinearSolveFailures(), SNESGetLinearSolveFailures(), SNESGetMaxNonlinearStepFailures(), SNESGetNonlinearStepFailures()

External Links

source
PETSc.LibPETSc.SNESSetNGSMethod
SNESSetNGS(petsclib::PetscLibType,snes::PetscSNES, f::SNESNGSFn, ctx::Cvoid)

Sets the user nonlinear Gauss use with composed nonlinear solvers.

Input Parameters:

  • snes - the SNES context, usually of the SNESType SNESNGS
  • f - function evaluation routine to apply Gauss-Seidel, see SNESNGSFn for calling sequence
  • ctx - [optional] user-defined context for private data for the smoother evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNESNGS, SNESGetNGS(), SNESNCG, SNESGetFunction(), SNESComputeNGS(), SNESNGSFn

External Links

source
PETSc.LibPETSc.SNESSetNPCMethod
SNESSetNPC(petsclib::PetscLibType,snes::PetscSNES, npc::PetscSNES)

Sets the nonlinear preconditioner to be used.

Collective

Input Parameters:

  • snes - iterative context obtained from SNESCreate()
  • npc - the SNES nonlinear preconditioner object

Options Database Key:

  • -npc_snes_type <type> - set the type of the SNES to use as the nonlinear preconditioner

Level: developer

-seealso: , SNES, SNESNGS, SNESFAS, SNESGetNPC(), SNESHasNPC()

External Links

source
PETSc.LibPETSc.SNESSetNPCSideMethod
SNESSetNPCSide(petsclib::PetscLibType,snes::PetscSNES, side::PCSide)

Sets the nonlinear preconditioning side used by the nonlinear preconditioner inside SNES.

Logically Collective

Input Parameter:

  • snes - iterative context obtained from SNESCreate()

Output Parameter:

  • side - the preconditioning side, where side is one of

-seealso: , SNES, SNESGetNPC(), SNESNRICHARDSON, SNESNCG, SNESType, SNESGetNPCSide(), KSPSetPCSide(), PC_LEFT, PC_RIGHT, PCSide

External Links

source
PETSc.LibPETSc.SNESSetNormScheduleMethod
SNESSetNormSchedule(petsclib::PetscLibType,snes::PetscSNES, normschedule::SNESNormSchedule)

Sets the SNESNormSchedule used in convergence and monitoring of the SNES method, when norms are computed in the solving process

Logically Collective

Input Parameters:

  • snes - the SNES context
  • normschedule - the frequency of norm computation

Options Database Key:

  • -snes_norm_schedule <none, always, initialonly, finalonly, initialfinalonly> - set the schedule

Level: advanced

-seealso: , SNESNormSchedule, SNESGetNormSchedule(), SNESComputeFunction(), VecNorm(), SNESSetFunction(), SNESSetInitialFunction()

External Links

source
PETSc.LibPETSc.SNESSetObjectiveMethod
SNESSetObjective(petsclib::PetscLibType,snes::PetscSNES, obj::SNESObjectiveFn, ctx::Cvoid)

Sets the objective function minimized by some of the SNES linesearch methods, used instead of the 2

Logically Collective

Input Parameters:

  • snes - the SNES context
  • obj - objective evaluation routine; see SNESObjectiveFn for the calling sequence
  • ctx - [optional] user-defined context for private data for the objective evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESLineSearch(), SNESGetObjective(), SNESComputeObjective(), SNESSetFunction(), SNESSetJacobian(), SNESObjectiveFn

External Links

source
PETSc.LibPETSc.SNESSetOptionsPrefixMethod
SNESSetOptionsPrefix(petsclib::PetscLibType,snes::PetscSNES, prefix::String)

Sets the prefix used for searching for all SNES options in the database.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , SNES, SNESSetFromOptions(), SNESAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESSetPicardMethod
SNESSetPicard(petsclib::PetscLibType,snes::PetscSNES, r::PetscVec, bp::SNESFunctionFn, Amat::PetscMat, Pmat::PetscMat, J::SNESJacobianFn, ctx::Cvoid)

Use SNES to solve the system A(x) x = bp(x) + b via a Picard type iteration (Picard linearization)

Logically Collective

Input Parameters:

  • snes - the SNES context
  • r - vector to store function values, may be NULL
  • bp - function evaluation routine, may be NULL, for the calling sequence see SNESFunctionFn
  • Amat - matrix with which A(x) x - bp(x) - b is to be computed
  • Pmat - matrix from which preconditioner is computed (usually the same as Amat)
  • J - function to compute matrix values, for the calling sequence see SNESJacobianFn
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Level: intermediate

-seealso: , SNES, SNESGetFunction(), SNESSetFunction(), SNESComputeFunction(), SNESSetJacobian(), SNESGetPicard(), SNESLineSearchPreCheckPicard(), SNESFunctionFn, SNESJacobianFn

External Links

source
PETSc.LibPETSc.SNESSetSolutionMethod
SNESSetSolution(petsclib::PetscLibType,snes::PetscSNES, u::PetscVec)

Sets the solution vector for use by the SNES routines.

Logically Collective

Input Parameters:

  • snes - the SNES context obtained from SNESCreate()
  • u - the solution vector

Level: beginner

-seealso: , SNES, SNESSolve(), SNESGetSolution(), Vec

External Links

source
PETSc.LibPETSc.SNESSetTolerancesMethod
SNESSetTolerances(petsclib::PetscLibType,snes::PetscSNES, abstol::PetscReal, rtol::PetscReal, stol::PetscReal, maxit::PetscInt, maxf::PetscInt)

Sets various parameters used in SNES convergence tests.

Logically Collective

Input Parameters:

  • snes - the SNES context
  • abstol - the absolute convergence tolerance, F(x^n) ≤ abstol
  • rtol - the relative convergence tolerance, F(x^n) ≤ reltol * F(x^0)
  • stol - convergence tolerance in terms of the norm of the change in the solution between steps, || delta x || < stol*|| x ||
  • maxit - the maximum number of iterations allowed in the solver, default 50.
  • maxf - the maximum number of function evaluations allowed in the solver (use PETSC_UNLIMITED indicates no limit), default 10,000

Options Database Keys:

  • -snes_atol <abstol> - Sets abstol
  • -snes_rtol <rtol> - Sets rtol
  • -snes_stol <stol> - Sets stol
  • -snes_max_it <maxit> - Sets maxit
  • -snes_max_funcs <maxf> - Sets maxf (use unlimited to have no maximum)

Level: intermediate

-seealso: , SNESSolve(), SNES, SNESSetDivergenceTolerance(), SNESSetForceIteration()

External Links

source
PETSc.LibPETSc.SNESSetTypeMethod
SNESSetType(petsclib::PetscLibType,snes::PetscSNES, type::SNESType)

Sets the algorithm/method to be used to solve the nonlinear system with the given SNES

Collective

Input Parameters:

  • snes - the SNES context
  • type - a known method

Options Database Key:

  • -snes_type <type> - Sets the method; use -help for a list

of available methods (for instance, newtonls or newtontr)

Level: intermediate

-seealso: , SNES, SNESSolve(), SNESType, SNESCreate(), SNESDestroy(), SNESGetType(), SNESSetFromOptions()

External Links

source
PETSc.LibPETSc.SNESSetUpMethod
SNESSetUp(petsclib::PetscLibType,snes::PetscSNES)

Sets up the internal data structures for the later use of a nonlinear solver SNESSolve().

Collective

Input Parameter:

  • snes - the SNES context

Level: advanced

-seealso: , SNES, SNESCreate(), SNESSolve(), SNESDestroy(), SNESSetFromOptions()

External Links

source
PETSc.LibPETSc.SNESSetUpMatricesMethod
SNESSetUpMatrices(petsclib::PetscLibType,snes::PetscSNES)

ensures that matrices are available for SNES Newton

Collective

Input Parameter:

  • snes - SNES object to configure

Level: developer

-seealso: , SNES, SNESSetUp()

External Links

source
PETSc.LibPETSc.SNESSetUpdateMethod
SNESSetUpdate(petsclib::PetscLibType,snes::PetscSNES, func::SNESUpdateFn)

Sets the general at the beginning of every iteration of the nonlinear solve. Specifically it is called just before the Jacobian is "evaluated" and after the function evaluation.

Logically Collective

Input Parameters:

  • snes - The nonlinear solver context
  • func - The update function; for calling sequence see SNESUpdateFn

Level: advanced

-seealso: , SNES, SNESSolve(), SNESSetJacobian(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESNewtonTRSetPreCheck(), SNESNewtonTRSetPostCheck(), SNESMonitorSet()

External Links

source
PETSc.LibPETSc.SNESSetUseMatrixFreeMethod
SNESSetUseMatrixFree(petsclib::PetscLibType,snes::PetscSNES, mf_operator::PetscBool, mf::PetscBool)

indicates that SNES should use matrix

Logically Collective

Input Parameters:

  • snes - SNES context
  • mf_operator - use matrix-free only for the Amat used by SNESSetJacobian(), this means the user provided Pmat will continue to be used
  • mf - use matrix-free for both the Amat and Pmat used by SNESSetJacobian(), both the Amat and Pmat set in SNESSetJacobian() will be ignored. With

this option no matrix-element based preconditioners can be used in the linear solve since the matrix won't be explicitly available

Options Database Keys:

  • -snes_mf_operator - use matrix-free only for the mat operator
  • -snes_mf - use matrix-free for both the mat and pmat operator
  • -snes_fd_color - compute the Jacobian via coloring and finite differences.
  • -snes_fd - compute the Jacobian via finite differences (slow)

Level: intermediate

-seealso: , SNES, SNESGetUseMatrixFree(), MatCreateSNESMF(), SNESComputeJacobianDefaultColor(), MatFDColoring

External Links

source
PETSc.LibPETSc.SNESSetWorkVecsMethod
SNESSetWorkVecs(petsclib::PetscLibType,snes::PetscSNES, nw::PetscInt)

Allocates a number of work vectors to be used internally by the SNES solver

Input Parameters:

  • snes - the SNES context
  • nw - number of work vectors to allocate

Level: developer

-seealso: , SNES

External Links

source
PETSc.LibPETSc.SNESShellGetContextMethod
SNESShellGetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)

Returns the user

Not Collective

Input Parameter:

  • snes - should have been created with SNESSetType(snes,SNESSHELL);

Output Parameter:

  • ctx - the user provided context

Level: advanced

-seealso: , SNES, SNESSHELL, SNESCreateShell(), SNESShellSetContext()

External Links

source
PETSc.LibPETSc.SNESShellSetContextMethod
SNESShellSetContext(petsclib::PetscLibType,snes::PetscSNES, ctx::Cvoid)

sets the context for a SNESSHELL

Logically Collective

Input Parameters:

  • snes - the SNESSHELL
  • ctx - the context

Level: advanced

-seealso: , SNES, SNESSHELL, SNESCreateShell(), SNESShellGetContext()

External Links

source
PETSc.LibPETSc.SNESShellSetSolveMethod
SNESShellSetSolve(petsclib::PetscLibType,snes::PetscSNES, solve::external)

Sets routine to apply as solver to a SNESSHELL SNES object

Logically Collective

Input Parameters:

  • snes - the SNES nonlinear solver context
  • solve - the application-provided solver routine

Calling sequence of apply:

  • snes - the preconditioner, get the application context with SNESShellGetContext() provided with SNESShellSetContext()
  • xout - solution vector

Level: advanced

-seealso: , SNES, SNESSHELL, SNESShellSetContext(), SNESShellGetContext()

External Links

source
PETSc.LibPETSc.SNESSolveMethod
SNESSolve(petsclib::PetscLibType,snes::PetscSNES, b::Union{PetscVec,Ptr}, x::PetscVec)

Solves a nonlinear system F(x) = b associated with a SNES object

Collective

Input Parameters:

  • snes - the SNES context
  • b - the constant part of the equation F(x) = b, or NULL to use zero.
  • x - the solution vector.

Level: beginner

-seealso: , SNES, SNESCreate(), SNESDestroy(), SNESSetFunction(), SNESSetJacobian(), SNESSetGridSequence(), SNESGetSolution(), SNESNewtonTRSetPreCheck(), SNESNewtonTRGetPreCheck(), SNESNewtonTRSetPostCheck(), SNESNewtonTRGetPostCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck()

External Links

source
PETSc.LibPETSc.SNESTSFormFunctionMethod
SNESTSFormFunction(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, F::PetscVec, ctx::Cvoid)

Function to evaluate nonlinear residual defined by an ODE solver algorithm implemented within TS

Logically Collective

Input Parameters:

  • snes - nonlinear solver
  • U - the current state at which to evaluate the residual
  • ctx - user context, must be a TS

Output Parameter:

  • F - the nonlinear residual

Level: developer

-seealso: , SNESSetFunction(), MatFDColoringSetFunction()

External Links

source
PETSc.LibPETSc.SNESTSFormJacobianMethod
SNESTSFormJacobian(petsclib::PetscLibType,snes::PetscSNES, U::PetscVec, A::PetscMat, B::PetscMat, ctx::Cvoid)

Function to evaluate the Jacobian defined by an ODE solver algorithm implemented within TS

Collective

Input Parameters:

  • snes - nonlinear solver
  • U - the current state at which to evaluate the residual
  • ctx - user context, must be a TS

Output Parameters:

  • A - the Jacobian
  • B - the matrix used to construct the preconditioner (often the same as A)

Level: developer

-seealso: , SNESSetJacobian()

External Links

source
PETSc.LibPETSc.SNESTestFunctionMethod
SNESTestFunction(petsclib::PetscLibType,snes::PetscSNES)

Computes the difference between the computed and finite

Collective

Input Parameter:

  • snes - the SNES context

Options Database Keys:

  • -snes_test_function - compare the user provided function with one compute via finite differences to check for errors.
  • -snes_test_function_view - display the user provided function, the finite difference function and the difference

Level: developer

-seealso: , SNESTestJacobian(), SNESSetFunction(), SNESComputeFunction()

External Links

source
PETSc.LibPETSc.SNESTestJacobianMethod
Jnorm::PetscReal,diffNorm::PetscReal = SNESTestJacobian(petsclib::PetscLibType,snes::PetscSNES)

Computes the difference between the computed and finite

Collective

Input Parameter:

  • snes - the SNES context

Output Parameters:

  • Jnorm - the Frobenius norm of the computed Jacobian, or NULL
  • diffNorm - the Frobenius norm of the difference of the computed and finite-difference Jacobians, or NULL

Options Database Keys:

  • -snes_test_jacobian <optional threshold> - compare the user provided Jacobian with one compute via finite differences to check for errors. If a threshold is given, display only those entries whose difference is greater than the threshold.
  • -snes_test_jacobian_view - display the user provided Jacobian, the finite difference Jacobian and the difference

Level: developer

-seealso: , SNESTestFunction(), SNESSetJacobian(), SNESComputeJacobian()

External Links

source
PETSc.LibPETSc.SNESVIComputeFunctionMethod
SNESVIComputeFunction(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, phi::PetscVec, functx::Cvoid)

Provides the function that reformulates a system of nonlinear equations in mixed complementarity form to a system of nonlinear equations in semismooth form.

Input Parameters:

  • snes - the SNES context
  • X - current iterate
  • functx - user defined function context

Output Parameter:

  • phi - the evaluation of semismooth function at X

Level: developer

-seealso: , SNES, SNESVINEWTONSSLS, SNESVIComputeMeritFunction()

External Links

source
PETSc.LibPETSc.SNESVIComputeInactiveSetFnormMethod
fnorm::PetscReal = SNESVIComputeInactiveSetFnorm(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec)

Computes the function norm for variational inequalities on the inactive set

Input Parameters:

  • snes - the SNES context
  • F - the nonlinear function vector
  • X - the SNES solution vector

Output Parameter:

  • fnorm - the function norm

Level: developer

-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESLineSearchSetVIFunctions()

External Links

source
PETSc.LibPETSc.SNESVIComputeInactiveSetFtYMethod
fty::PetscScalar = SNESVIComputeInactiveSetFtY(petsclib::PetscLibType,snes::PetscSNES, F::PetscVec, X::PetscVec, Y::PetscVec)

Computes the directional derivative for variational inequalities on the inactive set, assuming that there exists some G(x) for which the SNESFunctionFn F(x) = grad G(x) (relevant for some line search algorithms)

Input Parameters:

  • snes - the SNES context
  • F - the nonlinear function vector
  • X - the SNES solution vector
  • Y - the direction vector

Output Parameter:

  • fty - the directional derivative

Level: developer

-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS

External Links

source
PETSc.LibPETSc.SNESVIComputeMeritFunctionMethod
merit::PetscReal,phinorm::PetscReal = SNESVIComputeMeritFunction(petsclib::PetscLibType,phi::PetscVec)

Evaluates the merit function for the mixed complementarity problem.

Input Parameter:

  • phi - the Vec holding the evaluation of the semismooth function

Output Parameters:

  • merit - the merit function 1/2 ||phi||^2
  • phinorm - the two-norm of the vector, ||phi||

Level: developer

-seealso: , SNES, SNESVINEWTONSSLS, SNESVIComputeFunction()

External Links

source
PETSc.LibPETSc.SNESVIGetActiveSetISMethod
SNESVIGetActiveSetIS(petsclib::PetscLibType,snes::PetscSNES, X::PetscVec, F::PetscVec, ISact::IS)

Gets the global indices for the active set variables

Input Parameters:

  • snes - the SNES context
  • X - the snes solution vector
  • F - the nonlinear function vector

Output Parameter:

  • ISact - active set index set

Level: developer

-seealso: , SNES, SNESVINEWTONRSLS, SNESVINEWTONSSLS

External Links

source
PETSc.LibPETSc.SNESVIGetInactiveSetMethod
SNESVIGetInactiveSet(petsclib::PetscLibType,snes::PetscSNES, inact::IS)

Gets the global indices for the inactive set variables (these correspond to the degrees of freedom the linear system is solved on)

Input Parameter:

  • snes - the SNES context

Output Parameter:

  • inact - inactive set index set

Level: advanced

-seealso: , SNES, SNESVINEWTONRSLS

External Links

source
PETSc.LibPETSc.SNESVIGetVariableBoundsMethod
SNESVIGetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec)

Gets the lower and upper bounds for the solution vector. xl <= x <= xu. These are used in solving (differential) variable inequalities.

Input Parameters:

  • snes - the SNES context.
  • xl - lower bound (may be NULL)
  • xu - upper bound (may be NULL)

Level: advanced

-seealso: , SNES, SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY

External Links

source
PETSc.LibPETSc.SNESVISetComputeVariableBoundsMethod
SNESVISetComputeVariableBounds(petsclib::PetscLibType,snes::PetscSNES, compute::external)

Sets a function that is called to compute the bounds on variable for (differential) variable inequalities.

Input Parameters:

  • snes - the SNES context
  • compute - function that computes the bounds

Calling sequence of compute:

  • snes - the SNES context
  • lower - vector to hold lower bounds
  • higher - vector to hold upper bounds

Level: advanced

-seealso: , SNES, SNESVISetVariableBounds(), DMSetVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY

External Links

source
PETSc.LibPETSc.SNESVISetRedundancyCheckMethod
SNESVISetRedundancyCheck(petsclib::PetscLibType,snes::PetscSNES, func::external, ctx::Cvoid)

Provide a function to check for any redundancy in the VI active set

Logically Collective

Input Parameters:

  • snes - the SNESVINEWTONRSLS context
  • func - the function to check of redundancies
  • ctx - optional context used by the function

Level: advanced

-seealso: , SNES, SNESVINEWTONRSLS, SNESVIGetInactiveSet(), DMSetVI()

External Links

source
PETSc.LibPETSc.SNESVISetVariableBoundsMethod
SNESVISetVariableBounds(petsclib::PetscLibType,snes::PetscSNES, xl::PetscVec, xu::PetscVec)

Sets the lower and upper bounds for the solution vector. xl <= x <= xu. This allows solving (differential) variable inequalities.

Input Parameters:

  • snes - the SNES context.
  • xl - lower bound.
  • xu - upper bound.

Level: advanced

-seealso: , SNES, SNESVIGetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError(), SNESVINEWTONRSLS, SNESVINEWTONSSLS, SNESSetType(), PETSC_NINFINITY, PETSC_INFINITY

External Links

source
PETSc.LibPETSc.SNESViewMethod
SNESView(petsclib::PetscLibType,snes::PetscSNES, viewer::PetscViewer)

Prints or visualizes the SNES data structure.

Collective

Input Parameters:

  • snes - the SNES context
  • viewer - the PetscViewer

Options Database Key:

  • -snes_view - Calls SNESView() at end of SNESSolve()

Level: beginner

-seealso: , SNES, SNESLoad(), SNESCreate(), PetscViewerASCIIOpen()

External Links

source
PETSc.LibPETSc.SNESViewFromOptionsMethod
SNESViewFromOptions(petsclib::PetscLibType,A::PetscSNES, obj::PetscObject, name::String)

View a SNES based on values in the options database

Collective

Input Parameters:

  • A - the SNES context
  • obj - Optional object that provides the options prefix for the checks
  • name - command line option

Level: intermediate

-seealso: , SNES, SNESView, PetscObjectViewFromOptions(), SNESCreate()

External Links

source
PETSc.LibPETSc.SNESLineSearchAppendOptionsPrefixMethod
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 - the SNESLineSearch context
  • prefix - the prefix to prepend to all option names

Level: advanced

-seealso: , SNES, SNESLineSearch(), SNESLineSearchSetFromOptions(), SNESGetOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESLineSearchApplyMethod
fnorm::PetscReal = SNESLineSearchApply(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec)

Computes the line

Collective

Input Parameter:

  • linesearch - The line search context

Input/Output Parameters:

  • X - The current solution, on output the new solution
  • F - The current function value, on output the new function value at the solution value X
  • fnorm - The current norm of F, on output the new norm of F
  • Y - The current search direction, on output the direction determined by the linesearch, i.e. Xnew = Xold - lambda*Y

Options Database Keys:

  • -snes_linesearch_type - basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell
  • -snes_linesearch_monitor [:filename] - Print progress of line searches
  • -snes_linesearch_damping - The linesearch damping parameter, default is 1.0 (no damping)
  • -snes_linesearch_norms - Turn on/off the linesearch norms computation (SNESLineSearchSetComputeNorms())
  • -snes_linesearch_keeplambda - Keep the previous lambda as the initial guess
  • -snes_linesearch_max_it - The number of iterations for iterative line searches

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchGetLambda(), SNESLineSearchPreCheck(), SNESLineSearchPostCheck(), SNESSolve(), SNESComputeFunction(), SNESLineSearchSetComputeNorms(), SNESLineSearchType, SNESLineSearchSetType()

External Links

source
PETSc.LibPETSc.SNESLineSearchBTGetAlphaMethod
alpha::PetscReal = SNESLineSearchBTGetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch)

Gets the descent parameter, alpha, in the SNESLINESEARCHBT variant that was set with SNESLineSearchBTSetAlpha()

Input Parameter:

  • linesearch - linesearch context

Output Parameter:

  • alpha - The descent parameter

Level: intermediate

-seealso: , SNESLineSearch, SNESLineSearchGetLambda(), SNESLineSearchGetTolerances(), SNESLINESEARCHBT, SNESLineSearchBTSetAlpha()

External Links

source
PETSc.LibPETSc.SNESLineSearchBTSetAlphaMethod
SNESLineSearchBTSetAlpha(petsclib::PetscLibType,linesearch::SNESLineSearch, alpha::PetscReal)

Sets the descent parameter, alpha, in the SNESLINESEARCHBT SNESLineSearch variant.

Input Parameters:

  • linesearch - linesearch context
  • alpha - The descent parameter

Level: intermediate

-seealso: , SNESLineSearch, SNESLineSearchSetLambda(), SNESLineSearchGetTolerances(), SNESLINESEARCHBT, SNESLineSearchBTGetAlpha()

External Links

source
PETSc.LibPETSc.SNESLineSearchComputeNormsMethod
SNESLineSearchComputeNorms(petsclib::PetscLibType,linesearch::SNESLineSearch)

Explicitly computes the norms of the current solution X, the current update Y, and the current function value F.

Input Parameter:

  • linesearch - the line search context

Options Database Key:

  • -snes_linesearch_norms - turn norm computation on or off

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms, SNESLineSearchSetNorms(), SNESLineSearchSetComputeNorms()

External Links

source
PETSc.LibPETSc.SNESLineSearchCreateMethod
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 associated SNES context).

Output Parameter:

  • outlinesearch - the new line search context

Level: developer

-seealso: , SNES, SNESLineSearch, LineSearchDestroy(), SNESGetLineSearch()

External Links

source
PETSc.LibPETSc.SNESLineSearchDestroyMethod
SNESLineSearchDestroy(petsclib::PetscLibType,linesearch::SNESLineSearch)

Destroys the line search instance.

Collective

Input Parameter:

  • linesearch - The line search context

Level: developer

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchReset(), SNESDestroy()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetDampingMethod
damping::PetscReal = SNESLineSearchGetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch)

Gets the line search damping parameter.

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • damping - The damping parameter

Level: advanced

-seealso: , SNES, SNESLineSearchGetStepTolerance(), SNESQN

External Links

source
PETSc.LibPETSc.SNESLineSearchGetDefaultMonitorMethod
SNESLineSearchGetDefaultMonitor(petsclib::PetscLibType,linesearch::SNESLineSearch, monitor::PetscViewer)

Gets the PetscViewer instance for the default line search monitor that is turned on with SNESLineSearchSetDefaultMonitor()

Logically Collective

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • monitor - monitor context

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchSetDefaultMonitor(), PetscViewer

External Links

source
PETSc.LibPETSc.SNESLineSearchGetLambdaMethod
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 last lambda (scaling of the solution update) computed during SNESLineSearchApply()

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetLambda(), SNESLineSearchGetDamping(), SNESLineSearchApply()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetNormsMethod
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 solution
  • fnorm - The norm of the current function, this is the norm(function(X)) where X is the current solution.
  • ynorm - The norm of the current update (after scaling by the linesearch computed lambda)

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetNorms(), SNESLineSearchGetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetOptionsPrefixMethod
SNESLineSearchGetOptionsPrefix(petsclib::PetscLibType,linesearch::SNESLineSearch, prefix::String)

Gets the prefix used for searching for all SNESLineSearch options in the database.

Not Collective

Input Parameter:

  • linesearch - the SNESLineSearch context

Output Parameter:

  • prefix - pointer to the prefix string used

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESAppendOptionsPrefix()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetOrderMethod
order::PetscInt = SNESLineSearchGetOrder(petsclib::PetscLibType,linesearch::SNESLineSearch)

Gets the line search approximation order.

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • order - The order

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetOrder()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetReasonMethod
SNESLineSearchGetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason)

Gets the success/failure status of the last line search application

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • result - The success or failure status

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetReason(), SNESLineSearchReason

External Links

source
PETSc.LibPETSc.SNESLineSearchGetSNESMethod
SNESLineSearchGetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES)

Gets the SNES instance associated with the line search.

Not Collective

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • snes - The SNES instance

Level: developer

-seealso: , SNES, SNESLineSearch, SNESType, SNESLineSearchSetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetTolerancesMethod
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 minimum lambda allowed
  • maxlambda - The maximum lambda allowed
  • rtol - The relative tolerance for iterative line searches
  • atol - The absolute tolerance for iterative line searches
  • ltol - The change in lambda tolerance for iterative line searches
  • max_it - The maximum number of iterations of the line search

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetTolerances()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetTypeMethod
type::SNESLineSearchType = SNESLineSearchGetType(petsclib::PetscLibType,linesearch::SNESLineSearch)

Gets the SNESLinesearchType of a SNESLineSearch

Logically Collective

Input Parameter:

  • linesearch - the line search context

Output Parameter:

  • type - The type of line search, or NULL if not set

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchCreate(), SNESLineSearchSetFromOptions(), SNESLineSearchSetType()

External Links

source
PETSc.LibPETSc.SNESLineSearchGetVIFunctionsMethod
SNESLineSearchGetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn)

Sets VI

Not Collective

Input Parameter:

  • linesearch - the line search context, obtain with SNESGetLineSearch()

Output Parameters:

  • projectfunc - function for projecting the function to the bounds, see SNESLineSearchVIProjectFn for calling sequence
  • normfunc - function for computing the norm of an active set, see SNESLineSearchVINormFn for calling sequence
  • dirderivfunc - function for computing the directional derivative of an active set, see SNESLineSearchVIDirDerivFn for calling sequence

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetVIFunctions(), SNESLineSearchGetPostCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn

External Links

source
PETSc.LibPETSc.SNESLineSearchGetVecsMethod
SNESLineSearchGetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec)

Gets the vectors from the SNESLineSearch context

Not Collective but the vectors are parallel

Input Parameter:

  • linesearch - the line search context

Output Parameters:

  • X - Solution vector
  • F - Function vector
  • Y - Search direction vector
  • W - Solution work vector
  • G - Function work vector

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchMonitorMethod
SNESLineSearchMonitor(petsclib::PetscLibType,ls::SNESLineSearch)

runs the user provided monitor routines, if they exist

Collective

Input Parameter:

  • ls - the linesearch object

Level: developer

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorSet()

External Links

source
PETSc.LibPETSc.SNESLineSearchMonitorCancelMethod
SNESLineSearchMonitorCancel(petsclib::PetscLibType,ls::SNESLineSearch)

Clears all the monitor functions for a SNESLineSearch object.

Logically Collective

Input Parameter:

  • ls - the SNESLineSearch context

Options Database Key:

  • -snes_linesearch_monitor_cancel - cancels all monitors that have been hardwired

into a code by calls to SNESLineSearchMonitorSet(), but does not cancel those set via the options database

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorDefault(), SNESLineSearchMonitorSet()

External Links

source
PETSc.LibPETSc.SNESLineSearchMonitorSetMethod
SNESLineSearchMonitorSet(petsclib::PetscLibType,ls::SNESLineSearch, f::external, mctx::Cvoid, monitordestroy::PetscCtxDestroyFn)

Sets an ADDITIONAL function that is to be used at every iteration of the nonlinear solver to display the iteration's progress.

Logically Collective

Input Parameters:

  • ls - the SNESLineSearch context
  • f - the monitor function
  • mctx - [optional] user-defined context for private data for the monitor routine (use NULL if no context is desired)
  • monitordestroy - [optional] routine that frees monitor context (may be NULL), see PetscCtxDestroyFn for the calling sequence

Calling sequence of f:

  • ls - the SNESLineSearch context
  • mctx - [optional] user-defined context for private data for the monitor routine

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorDefault(), SNESLineSearchMonitorCancel(), PetscCtxDestroyFn

External Links

source
PETSc.LibPETSc.SNESLineSearchMonitorSetFromOptionsMethod
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 - SNESLineSearch object to monitor
  • name - the monitor type
  • help - message indicating what monitoring is done
  • manual - manual page for the monitor
  • monitor - the monitor function, must use PetscViewerAndFormat as its context
  • monitorsetup - a function that is called once ONLY if the user selected this monitor that may set additional features of the SNESLineSearch or PetscViewer

Calling sequence of monitor:

  • ls - SNESLineSearch object being monitored
  • vf - a PetscViewerAndFormat struct that provides the PetscViewer and PetscViewerFormat being used

Calling sequence of monitorsetup:

  • ls - SNESLineSearch object being monitored
  • vf - a PetscViewerAndFormat struct that provides the PetscViewer and PetscViewerFormat being used

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetMonitor(), PetscOptionsCreateViewer(), PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(), PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() PetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHeadBegin(), PetscOptionsStringArray(), PetscOptionsRealArray(), PetscOptionsScalar(), PetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), PetscOptionsFList(), PetscOptionsEList()

External Links

source
PETSc.LibPETSc.SNESLineSearchMonitorSolutionUpdateMethod
SNESLineSearchMonitorSolutionUpdate(petsclib::PetscLibType,ls::SNESLineSearch, vf::PetscViewerAndFormat)

Monitors each update of the function value the linesearch tries

Collective

Input Parameters:

  • ls - the SNESLineSearch object
  • vf - the context for the monitor, in this case it is an PetscViewerAndFormat

Options Database Key:

  • -snes_linesearch_monitor_solution_update [viewer:filename:format] - view each update tried by line search routine

Level: developer

This is not normally called directly but is passed to SNESLineSearchMonitorSet()

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchMonitorSet(), SNESMonitorSolution()

External Links

source
PETSc.LibPETSc.SNESLineSearchPostCheckMethod
changed_Y::PetscBool,changed_W::PetscBool = SNESLineSearchPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, W::PetscVec)

Hook to modify step direction or updated solution after a successful linesearch

Logically Collective

Input Parameters:

  • linesearch - The line search context
  • X - The last solution
  • Y - The step direction
  • W - The updated solution, W = X - lambda * Y for some lambda

Output Parameters:

  • changed_Y - Indicator if the direction Y has been changed.
  • changed_W - Indicator if the new candidate solution W has been changed.

Level: developer

-seealso: , SNES, SNESGetLineSearch(), SNESLineSearchPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchSetPrecheck(), SNESLineSearchGetPrecheck()

External Links

source
PETSc.LibPETSc.SNESLineSearchPreCheckMethod
changed::PetscBool = SNESLineSearchPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec)

Prepares the line search for being applied.

Logically Collective

Input Parameters:

  • linesearch - The linesearch instance.
  • X - The current solution
  • Y - The step direction

Output Parameter:

  • changed - Indicator that the precheck routine has changed Y

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck()

External Links

source
PETSc.LibPETSc.SNESLineSearchPreCheckPicardMethod
changed::PetscBool = SNESLineSearchPreCheckPicard(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, Y::PetscVec, ctx::Cvoid)

Implements a correction that is sometimes useful to improve the convergence rate of Picard iteration {cite}hindmarsh1996time

Logically Collective

Input Parameters:

  • linesearch - the line search context
  • X - base state for this step
  • ctx - context for this function

Input/Output Parameter:

  • Y - correction, possibly modified

Output Parameter:

  • changed - flag indicating that Y was modified

Options Database Keys:

  • -snes_linesearch_precheck_picard - activate this routine
  • -snes_linesearch_precheck_picard_angle - angle

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESSetPicard(), SNESGetLineSearch(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck()

External Links

source
PETSc.LibPETSc.SNESLineSearchRegisterMethod
SNESLineSearchRegister(petsclib::PetscLibType,sname::String, fnc::external)

register a line search type SNESLineSearchType

Logically Collective, No Fortran Support

Input Parameters:

  • sname - name of the SNESLineSearchType()
  • function - the creation function for that type

Calling sequence of function:

  • ls - the line search context

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchSetType()

External Links

source
PETSc.LibPETSc.SNESLineSearchResetMethod
SNESLineSearchReset(petsclib::PetscLibType,linesearch::SNESLineSearch)

Undoes the SNESLineSearchSetUp() and deletes any Vecs or Mats allocated by the line search.

Collective

Input Parameter:

  • linesearch - The SNESLineSearch instance.

Level: developer

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchSetUp()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetComputeNormsMethod
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 context
  • flg - indicates whether or not to compute norms

Options Database Key:

  • -snes_linesearch_norms <true> - Turns on/off computation of the norms for basic (none) SNESLINESEARCHBASIC line search

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetNorms(), SNESLineSearchComputeNorms(), SNESLINESEARCHBASIC

External Links

source
PETSc.LibPETSc.SNESLineSearchSetDampingMethod
SNESLineSearchSetDamping(petsclib::PetscLibType,linesearch::SNESLineSearch, damping::PetscReal)

Sets the line search damping parameter.

Input Parameters:

  • linesearch - the line search context
  • damping - The damping parameter

Options Database Key:

  • -snes_linesearch_damping <damping> - the damping value

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetDamping()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetDefaultMonitorMethod
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 object
  • viewer - an PETSCVIEWERASCII PetscViewer or NULL to turn off monitor

Options Database Key:

  • -snes_linesearch_monitor [:filename] - enables the monitor

Level: intermediate

-seealso: , SNES, SNESLineSearch, PETSCVIEWERASCII, SNESGetLineSearch(), SNESLineSearchGetDefaultMonitor(), PetscViewer, SNESLineSearchSetMonitor(), SNESLineSearchMonitorSetFromOptions()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetFromOptionsMethod
SNESLineSearchSetFromOptions(petsclib::PetscLibType,linesearch::SNESLineSearch)

Sets options for the line search

Logically Collective

Input Parameter:

  • linesearch - a SNESLineSearch line search context

Options Database Keys:

  • -snes_linesearch_type <type> - basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell
  • -snes_linesearch_order <order> - 1, 2, 3. Most types only support certain orders (bt supports 1, 2 or 3)
  • -snes_linesearch_norms - Turn on/off the linesearch norms for the basic linesearch typem (SNESLineSearchSetComputeNorms())
  • -snes_linesearch_minlambda - The minimum lambda
  • -snes_linesearch_maxlambda - The maximum lambda
  • -snes_linesearch_rtol - Relative tolerance for iterative line searches
  • -snes_linesearch_atol - Absolute tolerance for iterative line searches
  • -snes_linesearch_ltol - Change in lambda tolerance for iterative line searches
  • -snes_linesearch_max_it - The number of iterations for iterative line searches
  • -snes_linesearch_monitor [:filename] - Print progress of line searches
  • -snes_linesearch_monitor_solution_update [viewer:filename:format] - view each update tried by line search routine
  • -snes_linesearch_damping - The linesearch damping parameter
  • -snes_linesearch_keeplambda - Keep the previous lambda as the initial guess.
  • -snes_linesearch_precheck_picard - Use precheck that speeds up convergence of picard method
  • -snes_linesearch_precheck_picard_angle - Angle used in Picard precheck method

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchCreate(), SNESLineSearchSetOrder(), SNESLineSearchSetType(), SNESLineSearchSetTolerances(), SNESLineSearchSetDamping(), SNESLineSearchPreCheckPicard(), SNESLineSearchType, SNESLineSearchSetComputeNorms()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetFunctionMethod
SNESLineSearchSetFunction(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external)

Sets the function evaluation used by the SNES line search `

Input Parameters:

  • linesearch - the SNESLineSearch context
  • func - function evaluation routine, this is usually the function provided with SNESSetFunction()

Calling sequence of func:

  • snes - the SNES with which the SNESLineSearch context is associated with
  • x - the input vector
  • f - the computed value of the function

Level: developer

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESSetFunction()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetLambdaMethod
SNESLineSearchSetLambda(petsclib::PetscLibType,linesearch::SNESLineSearch, lambda::PetscReal)

Sets the line search lambda (scaling of the solution update)

Input Parameters:

  • linesearch - line search context
  • lambda - The lambda to use

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetLambda()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetNormsMethod
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 context
  • xnorm - The norm of the current solution
  • fnorm - The norm of the current function, this is the norm(function(X)) where X is the current solution
  • ynorm - The norm of the current update (after scaling by the linesearch computed lambda)

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetNorms(), SNESLineSearchSetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetOrderMethod
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 context
  • order - The order

Level: intermediate

Values for order:

  • 1 orSNESLINESEARCHORDER_LINEAR` - linear order
  • 2 orSNESLINESEARCHORDER_QUADRATIC` - quadratic order
  • 3 orSNESLINESEARCHORDER_CUBIC` - cubic order

Options Database Key:

  • -snes_linesearch_order <order> - 1, 2, 3. Most types only support certain orders (SNESLINESEARCHBT supports 2 or 3)

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetOrder(), SNESLineSearchSetDamping()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetPostCheckMethod
SNESLineSearchSetPostCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid)

Sets a user function that is called after the line search has been applied to determine the step direction and length. Allows the user a chance to change or override the decision of the line search routine

Logically Collective

Input Parameters:

  • linesearch - the SNESLineSearch context
  • func - [optional] function evaluation routine
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Calling sequence of func:

  • ls - the SNESLineSearch context
  • x - the current solution
  • d - the current search direction
  • w - w = x + lambda*d for some lambda
  • changed_d - indicates if the search direction d has been changed
  • changed_w - indicates w has been changed
  • ctx - the context passed to SNESLineSearchSetPreCheck()

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchGetPreCheck(), SNESLineSearchGetPostCheck(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetPreCheckMethod
SNESLineSearchSetPreCheck(petsclib::PetscLibType,linesearch::SNESLineSearch, func::external, ctx::Cvoid)

Sets a function that is called after the initial search direction has been computed but before the line search routine has been applied. Allows adjusting the result of (usually a linear solve) that determined the search direction.

Logically Collective

Input Parameters:

  • linesearch - the SNESLineSearch context
  • func - [optional] function evaluation routine
  • ctx - [optional] user-defined context for private data for the function evaluation routine (may be NULL)

Calling sequence of func:

  • ls - the SNESLineSearch context
  • x - the current solution
  • d - the current search direction
  • changed_d - indicates if the search direction has been changed
  • ctx - the context passed to SNESLineSearchSetPreCheck()

Level: intermediate

-seealso: , SNES, SNESGetLineSearch(), SNESLineSearchPreCheck(), SNESLineSearchSetPostCheck(), SNESLineSearchGetPostCheck(), SNESLineSearchGetPreCheck(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESSetFunctionDomainError(), SNESSetJacobianDomainError()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetReasonMethod
SNESLineSearchSetReason(petsclib::PetscLibType,linesearch::SNESLineSearch, result::SNESLineSearchReason)

Sets the success/failure status of the line search application

Logically Collective; No Fortran Support

Input Parameters:

  • linesearch - the line search context
  • result - The success or failure status

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchReason, SNESLineSearchGetSResult()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetSNESMethod
SNESLineSearchSetSNES(petsclib::PetscLibType,linesearch::SNESLineSearch, snes::PetscSNES)

Sets the SNES for the linesearch for function evaluation.

Input Parameters:

  • linesearch - the line search context
  • snes - The SNES instance

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetSNES(), SNESLineSearchSetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetTolerancesMethod
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 context
  • minlambda - The minimum lambda allowed
  • maxlambda - The maximum lambda allowed
  • rtol - The relative tolerance for iterative line searches
  • atol - The absolute tolerance for iterative line searches
  • ltol - The change in lambda tolerance for iterative line searches
  • max_it - The maximum number of iterations of the line search

Options Database Keys:

  • -snes_linesearch_minlambda - The minimum lambda allowed
  • -snes_linesearch_maxlambda - The maximum lambda allowed
  • -snes_linesearch_rtol - Relative tolerance for iterative line searches
  • -snes_linesearch_atol - Absolute tolerance for iterative line searches
  • -snes_linesearch_ltol - Change in lambda tolerance for iterative line searches
  • -snes_linesearch_max_it - The number of iterations for iterative line searches

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetTolerances()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetTypeMethod
SNESLineSearchSetType(petsclib::PetscLibType,linesearch::SNESLineSearch, type::SNESLineSearchType)

Sets the SNESLinesearchType of a SNESLineSearch object to indicate the line search algorithm that should be used by a given SNES solver

Logically Collective

Input Parameters:

  • linesearch - the line search context
  • type - The type of line search to be used, see SNESLineSearchType

Options Database Key:

  • -snes_linesearch_type <type> - basic (or equivalently none), bt, secant, cp, nleqerr, bisection, shell

Level: intermediate

-seealso: , SNES, SNESLineSearch, SNESLineSearchType, SNESLineSearchCreate(), SNESLineSearchSetFromOptions(), SNESLineSearchGetType(), SNESGetLineSearch()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetUpMethod
SNESLineSearchSetUp(petsclib::PetscLibType,linesearch::SNESLineSearch)

Prepares the line search for being applied by allocating any required vectors.

Collective

Input Parameter:

  • linesearch - The SNESLineSearch instance.

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESGetLineSearch(), SNESLineSearchReset()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetVIFunctionsMethod
SNESLineSearchSetVIFunctions(petsclib::PetscLibType,linesearch::SNESLineSearch, projectfunc::SNESLineSearchVIProjectFn, normfunc::SNESLineSearchVINormFn, dirderivfunc::SNESLineSearchVIDirDerivFn)

Sets VI

Logically Collective

Input Parameters:

  • linesearch - the linesearch object
  • projectfunc - function for projecting the function to the bounds, see SNESLineSearchVIProjectFn for calling sequence
  • normfunc - function for computing the norm of an active set, see SNESLineSearchVINormFn for calling sequence
  • dirderivfunc - function for computing the directional derivative of an active set, see SNESLineSearchVIDirDerivFn for calling sequence

Level: advanced

-seealso: , SNES, SNESLineSearch, SNESLineSearchGetVIFunctions(), SNESLineSearchSetPostCheck(), SNESLineSearchSetPreCheck(), SNESLineSearchVIProjectFn, SNESLineSearchVINormFn, SNESLineSearchVIDirDerivFn

External Links

source
PETSc.LibPETSc.SNESLineSearchSetVecsMethod
SNESLineSearchSetVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, X::PetscVec, F::PetscVec, Y::PetscVec, W::PetscVec, G::PetscVec)

Sets the vectors on the SNESLineSearch context

Logically Collective

Input Parameters:

  • linesearch - the line search context
  • X - Solution vector
  • F - Function vector
  • Y - Search direction vector
  • W - Solution work vector
  • G - Function work vector

Level: developer

-seealso: , SNES, SNESLineSearch, SNESLineSearchSetNorms(), SNESLineSearchGetVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchSetWorkVecsMethod
SNESLineSearchSetWorkVecs(petsclib::PetscLibType,linesearch::SNESLineSearch, nwork::PetscInt)

Sets work vectors for the line search.

Input Parameters:

  • linesearch - the SNESLineSearch context
  • nwork - the number of work vectors

Level: developer

-seealso: , SNES, SNESLineSearch, SNESSetWorkVecs()

External Links

source
PETSc.LibPETSc.SNESLineSearchShellGetApplyMethod
SNESLineSearchShellGetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid)

Gets the apply function and context for the SNESLINESEARCHSHELL

Not Collective

Input Parameter:

  • linesearch - the line search object

Output Parameters:

  • func - the user function; can be NULL if it is not needed, see SNESLineSearchShellApplyFn for calling sequence
  • ctx - the user function context; can be NULL if it is not needed

Level: advanced

-seealso: , SNESLineSearchShellSetApply(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch, SNESLineSearchShellApplyFn

External Links

source
PETSc.LibPETSc.SNESLineSearchShellSetApplyMethod
SNESLineSearchShellSetApply(petsclib::PetscLibType,linesearch::SNESLineSearch, func::SNESLineSearchShellApplyFn, ctx::Cvoid)

Sets the apply function for the SNESLINESEARCHSHELL implementation.

Not Collective

Input Parameters:

  • linesearch - SNESLineSearch context
  • func - function implementing the linesearch shell, see SNESLineSearchShellApplyFn for calling sequence
  • ctx - context for func

Usage: -seealso: , SNESLineSearchShellGetApply(), SNESLINESEARCHSHELL, SNESLineSearchType, SNESLineSearch, SNESLineSearchShellApplyFn

External Links

source
PETSc.LibPETSc.SNESLineSearchViewMethod
SNESLineSearchView(petsclib::PetscLibType,linesearch::SNESLineSearch, viewer::PetscViewer)

Prints useful information about the line search

Logically Collective

Input Parameters:

  • linesearch - line search context
  • viewer - the PetscViewer to display the line search information to

Level: intermediate

-seealso: , SNES, SNESLineSearch, PetscViewer, SNESLineSearchCreate()

External Links

source