petsc-3.7.1 2016-05-15
Report Typos and Errors

SNESComputeJacobianDefaultColor

Computes the Jacobian using finite differences and coloring to exploit matrix sparsity.

Synopsis

#include "petscsnes.h"  
#include "petscdm.h"    
PetscErrorCode  SNESComputeJacobianDefaultColor(SNES snes,Vec x1,Mat J,Mat B,void *ctx)
Collective on SNES Many br

Input Parameters

snes - nonlinear solver object Many br
x1 - location at which to evaluate Jacobian Many br
ctx - MatFDColoring context or NULL Many br

Output Parameters

J - Jacobian matrix (not altered in this routine) Many br
B - newly computed Jacobian matrix to use with preconditioner (generally the same as J) Many br

Many br

Options Database Key

-snes_fd_color_use_mat - use a matrix coloring from the explicit matrix nonzero pattern instead of from the DM providing the matrix Many br
-snes_fd_color - Activates SNESComputeJacobianDefaultColor() in SNESSetFromOptions() Many br
-mat_fd_coloring_err <err> - Sets <err> (square root of relative error in the function) Many br
-mat_fd_coloring_umin <umin> - Sets umin, the minimum allowable u-value magnitude Many br
-mat_fd_type - Either wp or ds (see MATMFFD_WP or MATMFFD_DS) Many br

Notes: If the coloring is not provided through the context, this will first try to get the Many brcoloring from the DM. If the DM type has no coloring routine, then it will try to Many brget the coloring from the matrix. This requires that the matrix have nonzero entries Many brprecomputed. This is discouraged, as MatColoringApply() is not parallel by default. Many br

Keywords

SNES, finite differences, Jacobian, coloring, sparse

See Also

SNESSetJacobian(), SNESTestJacobian(), SNESComputeJacobianDefault()
MatFDColoringCreate(), MatFDColoringSetFunction() Many br

Level:intermediate
Location:
src/snes/interface/snesj2.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/snes/examples/tutorials/ex5s.c.html
src/snes/examples/tutorials/ex14.c.html
src/ts/examples/tutorials/ex10.c.html
src/ts/examples/tutorials/ex15.c.html
src/ts/examples/tutorials/ex17.c.html