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

KSPMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the residual/error etc.

Synopsis

#include "petscksp.h" 
PetscErrorCode  KSPMonitorSet(KSP ksp,PetscErrorCode (*monitor)(KSP,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on KSP Many br

Input Parameters

ksp - iterative context obtained from KSPCreate() Many br
monitor - pointer to function (if this is NULL, it turns off monitoring Many br
mctx - [optional] context for private data for the Many brmonitor routine (use NULL if no context is desired) Many br
monitordestroy - [optional] routine that frees monitor context Many br(may be NULL) Many br

Calling Sequence of monitor

    monitor (KSP ksp, int it, PetscReal rnorm, void *mctx)

ksp - iterative context obtained from KSPCreate() Many br
it - iteration number Many br
rnorm - (estimated) 2-norm of (preconditioned) residual Many br
mctx - optional monitoring context, as set by KSPMonitorSet() Many br

Options Database Keys

-ksp_monitor - sets KSPMonitorDefault() Many br
-ksp_monitor_true_residual - sets KSPMonitorTrueResidualNorm() Many br
-ksp_monitor_max - sets KSPMonitorTrueResidualMaxNorm() Many br
-ksp_monitor_lg_residualnorm - sets line graph monitor, Many bruses KSPMonitorLGResidualNormCreate() Many br
-ksp_monitor_lg_true_residualnorm - sets line graph monitor, Many bruses KSPMonitorLGResidualNormCreate() Many br
-ksp_monitor_singular_value - sets KSPMonitorSingularValue() Many br
-ksp_monitor_cancel - cancels all monitors that have Many brbeen hardwired into a code by Many brcalls to KSPMonitorSet(), but Many brdoes not cancel those set via Many brthe options database. Many br

Notes

The default is to do nothing. To print the residual, or preconditioned Many brresidual if KSPSetNormType(ksp,KSP_NORM_PRECONDITIONED) was called, use Many brKSPMonitorDefault() as the monitoring routine, with a ASCII viewer as the Many brcontext. Many br

Several different monitoring routines may be set by calling Many brKSPMonitorSet() multiple times; all will be called in the Many brorder in which they were set. Many br

Fortran notes: Only a single monitor function can be set for each KSP object Many br

Many br

Keywords

KSP, set, monitor

See Also

KSPMonitorDefault(), KSPMonitorLGResidualNormCreate(), KSPMonitorCancel()

Level:beginner
Location:
src/ksp/ksp/interface/itfunc.c
Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ksp/ksp/examples/tutorials/ex9.c.html
src/ksp/ksp/examples/tutorials/ex42.c.html
src/ksp/ksp/examples/tutorials/ex2f.F.html
src/snes/examples/tutorials/ex12.c.html
src/snes/examples/tutorials/ex30.c.html