petsc-3.12.1 2019-10-22
Report Typos and Errors

# SNESMonitorSet

Sets an ADDITIONAL function that is to be used at every iteration of the nonlinear solver to display the iteration's progress.

### Synopsis

    #include "petscsnes.h"
    PetscErrorCode  SNESMonitorSet(SNES snes,PetscErrorCode (*f)(SNES,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))

Logically Collective on SNES

### Input Parameters

| snes | - the SNES context
| f | - the monitor function, see SNESMonitorFunction for the calling sequence
| mctx | - [optional] user-defined context for private data for the monitor routine (use NULL if no context is desired)
| monitordestroy | - [optional] routine that frees monitor context (may be NULL)

### Options Database Keys

| -snes_monitor | - sets SNESMonitorDefault()
| -snes_monitor_lg_residualnorm | - sets line graph monitor, uses SNESMonitorLGCreate()
| -snes_monitor_cancel | - cancels all monitors that have been hardwired into a code by calls to SNESMonitorSet(), but does not cancel those set via the options database.

### Notes

Several different monitoring routines may be set by calling SNESMonitorSet() multiple times; all will be called in the order in which they were set.

### Fortran Notes

Only a single monitor function can be set for each SNES object

### See Also

SNESMonitorDefault(), SNESMonitorCancel(), SNESMonitorFunction

### Level

intermediate

### Location

src/snes/interface/snes.c

### Examples

src/snes/examples/tutorials/ex2.c.html
src/snes/examples/tutorials/ex3.c.html
src/snes/examples/tutorials/ex12.c.html
src/snes/examples/tutorials/ex21.c.html
src/snes/examples/tutorials/ex22.c.html
src/ts/examples/tutorials/ex7.c.html
src/ts/examples/tutorials/ex12.c.html
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages