# DMMGSetSNESLocal

Sets the local user function that defines the nonlinear set of equations that will use the grid hierarchy and (optionally) its derivative. Collective on DMMG

### Synopsis

    PetscErrorCode DMMGSetSNESLocal(DMMG *dmmg,DALocalFunction1 function, DALocalFunction1 jacobian,
    DALocalFunction1 ad_function, DALocalFunction1 admf_function);

### Input Parameter

| dmmg | - the context
| function | - the function that defines the nonlinear system
| jacobian | - function defines the local part of the Jacobian
| ad_function | - the name of the function with an ad_ prefix. This is ignored if ADIC is not installed
| admf_function | - the name of the function with an ad_ prefix. This is ignored if ADIC is not installed

### Options Database Keys

| -dmmg_snes_monitor | - . -dmmg_jacobian_fd
| -dmmg_jacobian_ad | - . -dmmg_jacobian_mf_fd_operator
| -dmmg_jacobian_mf_fd | - . -dmmg_jacobian_mf_ad_operator
| -dmmg_jacobian_mf_ad | - - -dmmg_jacobian_period <p> - Indicates how often in the SNES solve the Jacobian is recomputed (on all levels) as suggested by Florin Dobrian if p is -1 then Jacobian is computed only on first SNES iteration (i.e. -1 is equivalent to infinity)

### Notes

If ADIC or ADIFOR have been installed, this routine can use ADIC or ADIFOR to compute the derivative; however, that function cannot call other functions except those in standard C math libraries.

If ADIC/ADIFOR have not been installed and the Jacobian is not provided, this routine uses finite differencing to approximate the Jacobian.

### See Also

DMMGCreate(), DMMGDestroy, DMMGSetKSP(), DMMGSetSNES()

Level:intermediate
Location: src/snes/utils/damgsnes.c
Index of all DA routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/snes/examples/tutorials/ex19.c.html
src/snes/examples/tutorials/ex25.c.html
src/snes/examples/tutorials/ex27.c.html
src/snes/examples/tutorials/ex29.c.html
src/snes/examples/tutorials/ex30.c.html