TSSetPostStep — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# TSSetPostStep

Sets the general-purpose function called once at the end of each successful time step.

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetPostStep(TS ts, PetscErrorCode (*func)(TS ts))

Logically Collective

## Input Parameters

- ts - The `TS` context obtained from `TSCreate()`

- func - The function

## Calling sequence of `func`

- ts - the `TS` context

## Note

The function set by `TSSetPostStep()` is called after each successful step. If the event handler locates an event at the given step, and `postevent()` modifies the solution vector, the solution vector obtained by `TSGetSolution()` inside `func` will contain the changes. To get the solution without these changes, use `TSSetPostEvaluate()` to set the appropriate callback. The scheme of the relevant function calls in `TSSolve()` is shown below

      ...
      Step()
      PostEvaluate()
      EventHandling()
      step_rollback ? PostEvaluate() : PostStep()
      ...

where EventHandling() may result in one of the following three outcomes

      (1) | successful step | solution intact
      (2) | successful step | solution modified by `postevent()`
      (3) | step_rollback   | solution rolled back

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSSetPreStep()`, `TSSetPreStage()`, `TSSetPostEvaluate()`, `TSGetTimeStep()`, `TSGetStepNumber()`, `TSGetTime()`, `TSRestartStep()`

## Level

intermediate

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex77.c

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