SNESDefaultComputeJacobian

Computes the Jacobian using finite differences.

Synopsis

int SNESDefaultComputeJacobian(SNES snes,Vec x1,Mat *J,Mat *B,
                               MatStructure *flag,void *ctx)
Collective on SNES

Input Parameters

x1 - compute Jacobian at this point
ctx - application's function context, as set with SNESSetFunction()

Output Parameters

J - Jacobian matrix (not altered in this routine)
B - newly computed Jacobian matrix to use with preconditioner (generally the same as J)
flag - flag indicating whether the matrix sparsity structure has changed

Options Database Key

-snes_fd -Activates SNESDefaultComputeJacobian()

Notes

This routine is slow and expensive, and is not currently optimizedto take advantage of sparsity in the problem. AlthoughSNESDefaultComputeJacobian() is not recommended for general usein large-scale applications, It can be useful in checking thecorrectness of a user-provided Jacobian.

An alternative routine that uses coloring to explot matrix sparsity isSNESDefaultComputeJacobianWithColoring().

Keywords

SNES, finite differences, Jacobian

See Also

SNESSetJacobian(), SNESDefaultComputeJacobianWithColoring()

Location: src/snes/interface/snesj.c
SNES Index
Table of Contents