Nonlinear solvers - SNES: Examples

The Scalable Nonlinear Equations Solvers (SNES) component provides an easy-to-use interface to Newton-type, quasi-Newton, full approximation scheme (FAS) multigrid, and other methods for solving systems of nonlinear equations. SNES users can set various algorithmic options at runtime via the options database (e.g., specifying a trust region method via -snes_type tr ). SNES internally employs KSP for the solution of its linear systems. SNES users can also set KSP options directly in application codes by first extracting the KSP context from the SNES context via SNESGetKSP() and then directly calling various KSP (and PC) routines (e.g., PCSetType() ).

Beginner - Basic usage
SNES SNESNGMRES SNESVISS
SNESConvergedReason SNESNRICHARDSON SNESView
SNESCreate SNESQN SNES_CONERGED_ITERATING
SNESDestroy SNESSORQN SNES_CONVERGED_FNORM_ABS
SNESGetKSP SNESSetFromOptions SNES_CONVERGED_FNORM_RELATIVE
SNESKSPONLY SNESSetFunction SNES_CONVERGED_PNORM_RELATIVE
SNESLS SNESSetJacobian SNES_DIVERGED_FNORM_NAN
SNESLineSearchType SNESSetPicard SNES_DIVERGED_FUNCTION_COUNT
SNESMS SNESSolve SNES_DIVERGED_LINE_SEARCH
SNESMSSetType SNESType SNES_DIVERGED_LOCAL_MIN
SNESNCG SNESVIRS SNES_DIVERGED_MAX_IT
Intermediate - Setting options for algorithms and data structures
SNESDMDAComputeJacobianWithAdic SNESGetNonlinearStepFailures SNESReset
SNESDefaultComputeJacobian SNESGetNumberFunctionEvals SNESSetApplicationContext
SNESDefaultComputeJacobianColor SNESGetRhs SNESSetComputeApplicationContext
SNESDefaultConverged SNESGetSolution SNESSetComputeInitialGuess
SNESDefaultUpdate SNESGetTolerances SNESSetConvergenceHistory
SNESFASSetLevels SNESGetType SNESSetDM
SNESGetApplicationContext SNESLineSearchGetParams SNESSetErrorIfNotConverged
SNESGetConvergedReason SNESLineSearchSetMonitor SNESSetGS
SNESGetConvergenceHistory SNESLineSearchSetParams SNESSetGSSweeps
SNESGetDM SNESMSType SNESSetGridSequence
SNESGetErrorIfNotConverged SNESMonitorCancel SNESSetLagJacobian
SNESGetFunctionNorm SNESMonitorDefault SNESSetLagPreconditioner
SNESGetGSSweeps SNESMonitorRange SNESSetMaxLinearSolveFailures
SNESGetIterationNumber SNESMonitorRatio SNESSetMaxNonlinearStepFailures
SNESGetLagJacobian SNESMonitorResidual SNESSetTolerances
SNESGetLagPreconditioner SNESMonitorSet SNESSetTrustRegionTolerance
SNESGetLinearSolveFailures SNESMonitorSetRatio SNESSetType
SNESGetLinearSolveIterations SNESMonitorSolution SNESTEST
SNESGetMaxLinearSolveFailures SNESMonitorSolutionUpdate SNESTR
SNESGetMaxNonlinearStepFailures SNESPythonSetType
Advanced - Setting more advanced options and customization
MatCreateSNESMF SNESGetOptionsPrefix SNESMSRegisterDestroy
SNESAppendOptionsPrefix SNESGetSolutionUpdate SNESMatrixFreeCreate2
SNESDefaultMatrixFreeSetParameters2 SNESKSPGetParametersEW SNESRegister
SNESFASGetLevels SNESKSPGetUseEW SNESRegisterAll
SNESFASGetSNES SNESKSPSetParametersEW SNESRegisterDestroy
SNESFASSetCycles SNESKSPSetUseEW SNESRegisterDynamic
SNESFASSetCyclesOnLevel SNESLineSearchCubic SNESSHELL
SNESFASSetGS SNESLineSearchNo SNESSetConvergenceTest
SNESFASSetGSOnLevel SNESLineSearchNoNorms SNESSetFunctionDomainError
SNESFASSetInjection SNESLineSearchPreCheckPicard SNESSetOptionsPrefix
SNESFASSetInterpolation SNESLineSearchQuadraticSecant SNESSetUp
SNESFASSetNumberSmoothDown SNESLineSearchQuadratic_LS SNESSetUpdate
SNESFASSetNumberSmoothUp SNESLineSearchSecant SNESShellGetContext
SNESFASSetRScale SNESLineSearchSet SNESShellSetContext
SNESFASSetRestriction SNESLineSearchSetPostCheck SNESShellSetSolve
SNESGS SNESLineSearchSetPreCheck SNESSkipConverged
SNESGetFunction SNESLineSearchSetType SNESVISetComputeVariableBounds
SNESGetGS SNESMSRegister SNESVISetVariableBounds
SNESGetJacobian SNESMSRegisterAll
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
MatMFFDComputeJacobian SNESFASRestrict SNESMSFinalizePackage
SNESAddOptionsChecker SNESFinalizePackage SNESMSInitializePackage
SNESComputeFunction SNESGetPC SNESMonitor
SNESComputeGS SNESInitializePackage SNESSetFunctionNorm
SNESComputeJacobian SNESLineSearchApply SNESSetIterationNumber
SNESDefaultGetWork SNESLineSearchPostCheckApply SNESSetKSP
SNESFASCreateCoarseVec SNESLineSearchPreCheckApply SNESSetPC
No deprecated routines
None: Not yet cataloged
SNESFAS SNESFASSetType

Table of Contents