Nonlinear solvers - SNES: Examples

The Scalable Nonlinear Equations Solvers (SNES) component provides an easy-to-use interface to Newton-based 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 KSP and PC) routines (e.g., PCSetType() ).

Beginner - Basic usage
SNES SNESSetFunction SNES_CONVERGED_PNORM_RELATIVE
SNESConvergedReason SNESSetJacobian SNES_DIVERGED_FNORM_NAN
SNESCreate SNESSolve SNES_DIVERGED_FUNCTION_COUNT
SNESDestroy SNESType SNES_DIVERGED_LOCAL_MIN
SNESGetKSP SNESView SNES_DIVERGED_LS_FAILURE
SNESLS SNES_CONERGED_ITERATING SNES_DIVERGED_MAX_IT
SNESPICARD SNES_CONVERGED_FNORM_ABS
SNESSetFromOptions SNES_CONVERGED_FNORM_RELATIVE
Intermediate - Setting options for algorithms and data structures
SNESDAComputeJacobianWithAdic SNESGetNonlinearStepFailures SNESMonitorSolutionUpdate
SNESDefaultComputeJacobian SNESGetNumberFunctionEvals SNESPythonSetType
SNESDefaultComputeJacobianColor SNESGetRhs SNESSetApplicationContext
SNESDefaultConverged SNESGetSolution SNESSetConvergenceHistory
SNESDefaultUpdate SNESGetTolerances SNESSetLagJacobian
SNESGetApplicationContext SNESGetType SNESSetLagPreconditioner
SNESGetConvergedReason SNESLineSearchGetParams SNESSetMaxLinearSolveFailures
SNESGetConvergenceHistory SNESLineSearchSetParams SNESSetMaxNonlinearStepFailures
SNESGetFunctionNorm SNESMonitorCancel SNESSetTolerances
SNESGetIterationNumber SNESMonitorDefault SNESSetTrustRegionTolerance
SNESGetLagJacobian SNESMonitorRange SNESSetType
SNESGetLagPreconditioner SNESMonitorRatio SNESSetUpdate
SNESGetLinearSolveFailures SNESMonitorResidual SNESTEST
SNESGetLinearSolveIterations SNESMonitorSet SNESTR
SNESGetMaxLinearSolveFailures SNESMonitorSetRatio
SNESGetMaxNonlinearStepFailures SNESMonitorSolution
Advanced - Setting more advanced options and customization
MatCreateSNESMF SNESKSPSetUseEW SNESRegisterAll
SNESAppendOptionsPrefix SNESLineSearchCubic SNESRegisterDestroy
SNESDefaultMatrixFreeSetParameters2 SNESLineSearchNo SNESRegisterDynamic
SNESGetFunction SNESLineSearchNoNorms SNESSetConvergenceTest
SNESGetJacobian SNESLineSearchQuadratic SNESSetFunctionDomainError
SNESGetOptionsPrefix SNESLineSearchSet SNESSetOptionsPrefix
SNESGetSolutionUpdate SNESLineSearchSetPostCheck SNESSetUp
SNESKSPGetParametersEW SNESLineSearchSetPreCheck SNESSkipConverged
SNESKSPGetUseEW SNESMatrixFreeCreate2
SNESKSPSetParametersEW SNESRegister
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
MatMFFDComputeJacobian SNESComputeFunction SNESInitializePackage
SNESAddOptionsChecker SNESComputeJacobian SNESSetKSP
No deprecated routines

Table of Contents