petsc-3.6.3 2015-12-03
Report Typos and Errors


Sets a monitoring function used for detecting events


#include "petscts.h" 
PetscErrorCode TSSetEventMonitor(TS ts,PetscInt nevents,PetscInt *direction,PetscBool *terminate,PetscErrorCode (*eventmonitor)(TS,PetscReal,Vec,PetscScalar*,void*),PetscErrorCode (*postevent)(TS,PetscInt,PetscInt[],PetscReal,Vec,PetscBool,void*),void *mectx)
Logically Collective on TS

Input Parameters

ts - the TS context obtained from TSCreate()
nevents - number of local events
direction - direction of zero crossing to be detected. -1 => Zero crossing in negative direction, +1 => Zero crossing in positive direction, 0 => both ways (one for each event)
terminate - flag to indicate whether time stepping should be terminated after event is detected (one for each event)
eventmonitor - event monitoring routine
postevent - [optional] post-event function
mectx - [optional] user-defined context for private data for the event monitor and post event routine (use NULL if no context is desired)

Calling sequence of eventmonitor

PetscErrorCode EventMonitor(TS ts,PetscReal t,Vec U,PetscScalar *fvalue,void* mectx)

Input Parameters

ts - the TS context
t - current time
U - current iterate
ctx - [optional] context passed with eventmonitor

Output parameters

fvalue -function value of events at time t

Calling sequence of postevent

PetscErrorCode PostEvent(TS ts,PetscInt nevents_zero, PetscInt events_zero, PetscReal t,Vec U,PetscBool forwardsolve,void* ctx)

Input Parameters

ts - the TS context
nevents_zero - number of local events whose event function is zero
events_zero - indices of local events which have reached zero
t - current time
U - current solution
forwardsolve - Flag to indicate whether TS is doing a forward solve (1) or adjoint solve (0)
ctx - the context passed with eventmonitor


TS, event, set, monitor

See Also

TSCreate(), TSSetTimeStep(), TSSetConvergedReason()

Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages