SNESSetFunctionDomainError#

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

Synopsis#

#include "petscsnes.h"  
#include "petscsnes.h"  
PetscErrorCode SNESSetFunctionDomainError(SNES snes)

Not Collective

Input Parameter#

  • snes - the SNES context

Notes#

This does not need to be called by all processes in the SNES MPI communicator.

A few solvers will try to cut the step size to avoid the domain error but for other solvers SNESSolve() stops iterating and and returns with a SNESConvergedReason of SNES_DIVERGED_FUNCTION_DOMAIN

You can direct SNES to avoid certain steps by using SNESVISetVariableBounds(), SNESVISetComputeVariableBounds() or SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck()

You should always call SNESGetConvergedReason() after each SNESSolve() and verify if the iteration converged (positive result) or diverged (negative result).

You can call SNESSetJacobianDomainError() during a Jacobian computation to indicate the proposed solution is not in the domain.

Developer Note#

This value is used by SNESCheckFunctionDomainError() to determine if the SNESConvergedReason is set to SNES_DIVERGED_FUNCTION_DOMAIN

See Also#

SNES: Nonlinear Solvers, SNESCreate(), SNESSetFunction(), SNESFunctionFn, SNESSetJacobianDomainError(), SNESVISetVariableBounds(), SNESVISetComputeVariableBounds(), SNESLineSearchSetPreCheck(), SNESLineSearchSetPostCheck(), SNESConvergedReason, SNESGetConvergedReason(), SNES_DIVERGED_FUNCTION_DOMAIN, SNESSetObjectiveDomainError()

Level#

advanced

Location#

src/snes/interface/snes.c

Examples#

src/ts/tutorials/ex30.c
src/ts/tutorials/ex10.c


Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages