SNESObjectiveComputeFunctionDefaultFD#

Computes the gradient of a user provided objective function

Synopsis#

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

Notes#

This function can be used with SNESSetFunction() to have the nonlinear function solved for with SNES defined by the gradient of an objective function SNESObjectiveComputeFunctionDefaultFD() is similar in character to SNESComputeJacobianDefault(). Therefore, it should be used for debugging purposes only. Using it in conjunction with SNESComputeJacobianDefault() is excessively costly and produces a Jacobian that is quite noisy. This is often necessary, but should be done with care, even when debugging small problems.

Note that this uses quadratic interpolation of the objective to form each value in the function.

See Also#

SNESSetObjective(), SNESSetFunction(), SNESComputeObjective(), SNESComputeJacobianDefault()

Level#

advanced

Location#

src/snes/interface/snesob.c


Edit on GitLab

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