1. petsc
  2. PETSc
  3. petsc


Shrirang Abhyankar  committed 932a70e

TSEvent: Add 'handling of discontinuities' subsection in the manual.

  • Participants
  • Parent commits 1eda64f
  • Branches master

Comments (0)

Files changed (1)

File src/docs/tex/manual/part2.tex

View file
     \>PetscErrorCode (*fjac)(TS,PetscReal,Vec,Mat,Mat,MatStructure*,void*),void *jacP);
   The arguments for the function \trl{fjac()}
-  are the timestep contex, current time, input state $u$, matrix $A$, preconditioning matrix
+  are the timestep context, current time, input state $u$, matrix $A$, preconditioning matrix
   $B$, flag describing structure of preconditioning matrix (see the
   discussion of KSPSetOperators() in Section~\ref{sec_usingsles} for
   details), and the (optional) user-provided context \trl{jacP}.
 \subsection{Error control via variable time-stepping}
+\subsection{Handling of discontinuities}
+For problems that involve discontinuous right hand sides, one can set an ``event'' function 
+$ g(t,u) $ for PETSc to detect and locate the times of discontinuities (zeros of $g(t,u)$). Events can be defined through the
+event monitoring routine
+     TSSetEventMonitor(TS ts,PetscInt nevents,PetscInt *direction,PetscBool *terminate, \\
+     ~~PetscErrorCode (*eventmonitor)(TS,PetscReal,Vec,PetscScalar*,void* eventP), \\
+     ~~PetscErrorCode (*postevent)(TS,PetscInt,PetscInt[],PetscReal,Vec,void* eventP),void *eventP);
+Here, \trl{nevents} denotes the number of events, \trl{direction} sets the type of zero crossing to be detected for 
+an event (+1 for positive zero-crossing, -1 for negative zero-crossing, and 0 for both), \trl{terminate} conveys whether 
+the time-stepping should continue or halt when an event is located, \trl{eventmonitor} is a user-
+defined routine that specifies the event description, \trl{postevent} is an optional user-defined routine to take
+specific actions following an event.
+The arguments to \trl{eventmonitor()} are the timestep context, current time, input state $u$, array of event function
+value, and the (optional) user-provided context \trl{eventP}. 
+The arguments to \trl{posteventmonitor()} routine are
+the timestep context, number of events occured, indices of events occured, current time, input state $u$, and the (optional)
+user-provided context \trl{eventP}. 
+The event monitoring functionality is only available with PETSc's implicit time-stepping solvers TSTHETA, TSARKIMEX, and TSROSW.
 \subsection{Debugging ODE solvers}
 \subsection{Using Sundials from PETSc}
 This may be set in the options
 database with \trl{-ts_sundials_gmres_restart} \trl{restart}. \findex{-ts_sundials_gmres_restart}
-\chapter{Solving Steady-State Problems with Pseudo-Timestepping}
+ \chapter{Solving Steady-State Problems with Pseudo-Timestepping}