Sets the function to compute Jacobian as well as the location to store the matrix.
snes - the
Amat - the matrix that defines the (approximate) Jacobian
Pmat - the matrix to be used in constructing the preconditioner, usually the same as Amat.
ctx - [optional] user-defined context for private data for the Jacobian evaluation routine (may be NULL) (if NULL then SNES retains any previously set value)
If you know the operator Amat has a null space you can use
MatSetTransposeNullSpace() to supply the null
space to Amat and the KSP solvers will automatically use that null space as needed during the solution process.
Other defect-correction schemes can be used by computing a different matrix in place of the Jacobian. One common
example is to use the “Picard linearization” which only differentiates through the highest order parts of each term using