PETSc version 3.17.4

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 newtontr ). 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
DMAdaptorCreate SNESANDERSON SNESQNSetType
DMAdaptorDestroy SNESConvergedReason SNESResetFromOptions
DMAdaptorSetFromOptions SNESConvergedReasonView SNESSetFromOptions
DMAdaptorSetUp SNESCreate SNESSetFunction
DMAdaptorView SNESDestroy SNESSetJacobian
DMDASNESSetFunctionLocal SNESFASType SNESSetSolution
DMDASNESSetJacobianLocal SNESGetConvergedReasonString SNESSolve
DMDASNESSetObjectiveLocal SNESGetKSP SNESType
DMDASNESSetPicardLocal SNESGetLineSearch SNESVINEWTONRSLS
DMInterpolationCreate SNESKSPONLY SNESVINEWTONSSLS
DMInterpolationDestroy SNESKSPTRANSPOSEONLY SNESView
DMInterpolationEvaluate SNESLineSearch SNES_CONERGED_ITERATING
DMSNESGetFunctionLocal SNESLineSearchType SNES_CONVERGED_FNORM_ABS
DMSNESGetJacobianLocal SNESMS SNES_CONVERGED_FNORM_RELATIVE
DMSNESSetFunctionLocal SNESMSGetType SNES_CONVERGED_SNORM_RELATIVE
DMSNESSetJacobianLocal SNESMSSetType SNES_DIVERGED_DTOL
PetscConvEstCreate SNESMULTIBLOCK SNES_DIVERGED_FNORM_NAN
PetscConvEstDestroy SNESNCG SNES_DIVERGED_FUNCTION_COUNT
PetscConvEstSetFromOptions SNESNEWTONLS SNES_DIVERGED_LINE_SEARCH
PetscConvEstSetUp SNESNGMRES SNES_DIVERGED_LOCAL_MIN
PetscConvEstView SNESNRICHARDSON SNES_DIVERGED_MAX_IT
SNES SNESQN
Intermediate - Setting options for algorithms and data structures
DMAdaptorAdapt SNESGetSolution SNESNASMSetDamping
DMAdaptorGetSequenceLength SNESGetTolerances SNESNASMSetSubdomains
DMAdaptorGetSolver SNESGetType SNESNASMSetType
DMAdaptorSetSequenceLength SNESGetUseMatrixFree SNESNASMSetWeight
DMAdaptorSetSolver SNESJacobianFunction SNESNCGSetType
DMInterpolationAddPoints SNESLineSearchApply SNESNEWTONTR
DMInterpolationGetCoordinates SNESLineSearchBTGetAlpha SNESNEWTONTRDC
DMInterpolationGetDim SNESLineSearchBTSetAlpha SNESNGMRESSetRestartFmRise
DMInterpolationGetDof SNESLineSearchComputeNorms SNESNGMRESSetRestartType
DMInterpolationGetVector SNESLineSearchGetDefaultMonitor SNESNGMRESSetSelectType
DMInterpolationRestoreVector SNESLineSearchGetOrder SNESNGSFunction
DMInterpolationSetDim SNESLineSearchGetPostCheck SNESNGSGetSweeps
DMInterpolationSetDof SNESLineSearchGetPreCheck SNESNGSGetTolerances
DMInterpolationSetUp SNESLineSearchGetReason SNESNGSSetSweeps
DMSNESGetBoundaryLocal SNESLineSearchGetTolerances SNESNGSSetTolerances
DMSNESSetBoundaryLocal SNESLineSearchGetType SNESNewtonTRDCGetPostCheck
KSPMonitorSNESResidual SNESLineSearchMonitorCancel SNESNewtonTRDCGetPreCheck
KSPMonitorSNESResidualDrawLG SNESLineSearchMonitorSet SNESNewtonTRDCSetPostCheck
KSPMonitorSNESResidualDrawLGCreate SNESLineSearchMonitorSolutionUpdate SNESNewtonTRDCSetPreCheck
PetscConvEstGetConvRate SNESLineSearchReason SNESNewtonTRGetPostCheck
PetscConvEstGetSolver SNESLineSearchSetComputeNorms SNESNewtonTRGetPreCheck
PetscConvEstMonitorDefault SNESLineSearchSetDamping SNESNewtonTRSetPostCheck
PetscConvEstSetSolver SNESLineSearchSetDefaultMonitor SNESNewtonTRSetPreCheck
SNESASPIN SNESLineSearchSetFromOptions SNESPATCH
SNESCOMPOSITE SNESLineSearchSetOrder SNESPythonSetType
SNESComputeJacobianDefault SNESLineSearchSetPostCheck SNESQNSetRestartType
SNESComputeJacobianDefaultColor SNESLineSearchSetPreCheck SNESQNSetScaleType
SNESConvergedDefault SNESLineSearchSetTolerances SNESReset
SNESConvergedReasonViewCancel SNESLineSearchSetType SNESSetApplicationContext
SNESConvergedReasonViewFromOptions SNESLineSearchView SNESSetComputeApplicationContext
SNESConvergedReasonViewSet SNESLoad SNESSetComputeInitialGuess
SNESConvergenceTestFunction SNESMSType SNESSetConvergedReason
SNESFunction SNESMonitorCancel SNESSetConvergenceHistory
SNESGetApplicationContext SNESMonitorDefault SNESSetDM
SNESGetConvergedReason SNESMonitorDefaultField SNESSetDivergenceTolerance
SNESGetConvergenceHistory SNESMonitorFields SNESSetErrorIfNotConverged
SNESGetDM SNESMonitorRange SNESSetForceIteration
SNESGetDivergenceTolerance SNESMonitorRatio SNESSetGridSequence
SNESGetErrorIfNotConverged SNESMonitorRatioSetUp SNESSetLagJacobian
SNESGetForceIteration SNESMonitorResidual SNESSetLagPreconditioner
SNESGetGridSequence SNESMonitorScaling SNESSetMaxLinearSolveFailures
SNESGetIterationNumber SNESMonitorSet SNESSetMaxNonlinearStepFailures
SNESGetLagJacobian SNESMonitorSolution SNESSetNGS
SNESGetLagPreconditioner SNESMonitorSolutionUpdate SNESSetNPCSide
SNESGetLinearSolveFailures SNESMultiblockSetBlockSize SNESSetObjective
SNESGetLinearSolveIterations SNESMultiblockSetFields SNESSetPicard
SNESGetMaxLinearSolveFailures SNESMultiblockSetIS SNESSetTolerances
SNESGetMaxNonlinearStepFailures SNESNASMGetDamping SNESSetTrustRegionTolerance
SNESGetNPCSide SNESNASMGetNumber SNESSetType
SNESGetNonlinearStepFailures SNESNASMGetSNES SNESSetUseMatrixFree
SNESGetNumberFunctionEvals SNESNASMGetSubdomains SNESViewFromOptions
SNESGetRhs SNESNASMGetType
Advanced - Setting more advanced options and customization
DMSNESCreateJacobianMF SNESGetOptionsPrefix SNESMSSetDamping
DMSNESGetFunction SNESGetPicard SNESMatrixFreeCreate2
DMSNESGetJacobian SNESGetSolutionUpdate SNESMonitorFunction
DMSNESGetNGS SNESKSPGetParametersEW SNESMonitorSAWs
DMSNESGetObjective SNESKSPGetUseEW SNESMultiblockGetSubSNES
DMSNESGetPicard SNESKSPSetParametersEW SNESNASM
DMSNESSetFunction SNESKSPSetUseEW SNESNGS
DMSNESSetJacobian SNESLINESEARCHBASIC SNESNormSchedule
DMSNESSetMFFunction SNESLINESEARCHBT SNESObjectiveComputeFunctionDefaultFD
DMSNESSetNGS SNESLINESEARCHCP SNESObjectiveFunction
DMSNESSetObjective SNESLINESEARCHL2 SNESRegister
DMSNESSetPicard SNESLINESEARCHNCGLINEAR SNESRegisterAll
MatCreateSNESMF SNESLINESEARCHNLEQERR SNESSHELL
MatSNESMFGetReuseBase SNESLINESEARCHSHELL SNESSetAlwaysComputesFinalResidual
MatSNESMFGetSNES SNESLineSearchAppendOptionsPrefix SNESSetCheckJacobianDomainError
MatSNESMFSetReuseBase SNESLineSearchGetDamping SNESSetConvergenceTest
SNESAppendOptionsPrefix SNESLineSearchGetLambda SNESSetFunctionDomainError
SNESComputeObjective SNESLineSearchGetOptionsPrefix SNESSetJacobianDomainError
SNESConvergedCorrectPressure SNESLineSearchGetVecs SNESSetOptionsPrefix
SNESConvergedSkip SNESLineSearchPreCheckPicard SNESSetUp
SNESDefaultMatrixFreeSetParameters2 SNESLineSearchRegister SNESSetUpdate
SNESFunctionType SNESLineSearchRegisterAll SNESShellGetContext
SNESGetAlwaysComputesFinalResidual SNESLineSearchSetLambda SNESShellSetContext
SNESGetCheckJacobianDomainError SNESLineSearchSetNorms SNESShellSetSolve
SNESGetFunction SNESLineSearchSetUp SNESVISetComputeVariableBounds
SNESGetFunctionDomainError SNESLineSearchSetVecs SNESVISetVariableBounds
SNESGetFunctionType SNESLineSearchShellGetUserFunc SNES_NORM_ALWAYS
SNESGetJacobian SNESLineSearchShellSetUserFunc SNES_NORM_FINAL_ONLY
SNESGetJacobianDomainError SNESMSGetDamping SNES_NORM_INITIAL_FINAL_ONLY
SNESGetNGS SNESMSRegister SNES_NORM_INITIAL_ONLY
SNESGetNormSchedule SNESMSRegisterAll SNES_NORM_NONE
SNESGetObjective SNESMSRegisterDestroy
Developer - Interfaces intended primarily for library developers, not for typical applications programmers
DMCopyDMSNES SNESFinalizePackage SNESMonitorSAWsCreate
DMGetDMSNES SNESGetFunctionNorm SNESMonitorSAWsDestroy
DMGetDMSNESWrite SNESGetNPC SNESMonitorSetFromOptions
DMPlexSNESComputeBoundaryFEM SNESGetNPCFunction SNESMultiblockSetType
DMPlexSNESComputeJacobianFEM SNESGetSolutionNorm SNESNASMGetSubdomainVecs
DMPlexSNESComputeResidualFEM SNESGetUpdateNorm SNESNASMSetComputeFinalJacobian
DMPlexSetSNESLocalFEM SNESHasNPC SNESNewtonTRDCGetRhoFlag
DMSNESCheckDiscretization SNESInitializePackage SNESNewtonTRDCPostCheck
DMSNESCheckFromOptions SNESLineSearchCreate SNESNewtonTRDCPreCheck
DMSNESCheckJacobian SNESLineSearchDestroy SNESNewtonTRPostCheck
DMSNESCheckResidual SNESLineSearchGetNorms SNESNewtonTRPreCheck
DMSNESComputeJacobianAction SNESLineSearchGetSNES SNESSetCountersReset
DMSNESCopy SNESLineSearchGetVIFunctions SNESSetFunctionNorm
MatMFFDComputeJacobian SNESLineSearchMonitor SNESSetFunctionType
PetscConvEstRateView SNESLineSearchMonitorSetFromOptions SNESSetInitialFunction
SNESAddOptionsChecker SNESLineSearchPostCheck SNESSetIterationNumber
SNESApplyNPC SNESLineSearchPreCheck SNESSetKSP
SNESCompositeAddSNES SNESLineSearchReset SNESSetLagJacobianPersists
SNESCompositeGetNumber SNESLineSearchSetFunction SNESSetLagPreconditionerPersists
SNESCompositeGetSNES SNESLineSearchSetReason SNESSetLineSearch
SNESCompositeSetDamping SNESLineSearchSetSNES SNESSetNPC
SNESCompositeSetType SNESLineSearchSetVIFunctions SNESSetNormSchedule
SNESComputeFunction SNESLineSearchSetWorkVecs SNESSetUpMatrices
SNESComputeJacobian SNESMSFinalizePackage SNESSetWorkVecs
SNESComputeMFFunction SNESMSInitializePackage
SNESComputeNGS SNESMonitor
No deprecated routines

Table of Contents