petsc-3.6.1 2015-08-06
Report Typos and Errors

SNESTEST

Test hand-coded Jacobian against finite difference Jacobian

Options Database

-snes_type test - use a SNES solver that evaluates the difference between hand-code and finite-difference Jacobians
-snes_test_display - display the elements of the matrix, the difference between the Jacobian approximated by finite-differencing and hand-coded Jacobian

Notes: This solver is not a solver and does not converge to a solution. SNESTEST checks the Jacobian at three points: the 0, 1, and -1 solution vectors. At each point the following is reported.

Output

difference - ||J - Jd||, the norm of the difference of the hand-coded Jacobian J and the approximate Jacobian Jd obtained by finite-differencing the residual,
ratio - ||J - Jd||/||J||, the ratio of the norms of the above difference and the hand-coded Jacobian.

Frobenius norm is used in the above throughout. After doing these three tests, it always aborts with the error message "SNESTest aborts after Jacobian test". No other behavior is to be expected. It may be similarly used to check if a SNES function is the gradient of an objective function set with SNESSetObjective().

See Also

SNESCreate(), SNES, SNESSetType(), SNESUpdateCheckJacobian(), SNESNEWTONLS, SNESNEWTONTR

Level:intermediate
Location:
src/snes/impls/test/snestest.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages