Skip to main content
`Ctrl`+`K`

# TSSetExactFinalTime

Determines whether to adapt the final time step to match the exact final time, to interpolate the solution to the exact final time, or to just return at the final time `TS` computed (which may be slightly larger than the requested final time).

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetExactFinalTime(TS ts, TSExactFinalTimeOption eftopt)

Logically Collective

## Input Parameters

- ts - the time-step context

- eftopt - exact final time option

      TS_EXACTFINALTIME_STEPOVER    - Don't do anything if final time is exceeded, just use it
      TS_EXACTFINALTIME_INTERPOLATE - Interpolate back to final time if the final time is exceeded
      TS_EXACTFINALTIME_MATCHSTEP   - Adapt final time step to ensure the computed final time exactly equals the requested final time

## Options Database Key

- -ts_exact_final_time <stepover,interpolate,matchstep> - select the final step approach at runtime

## Note

If you use the option `TS_EXACTFINALTIME_STEPOVER` the solution may be at a very different time then the final time you selected.

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSExactFinalTimeOption`, `TSGetExactFinalTime()`

## Level

beginner

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex12.c
src/ts/tutorials/ex11_sa.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/ts/tutorials/ex15.c
src/ts/tutorials/ex11.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/ts/tutorials/ex13.c
src/ts/tutorials/ex14.c
src/ts/tutorials/ex1.c
src/ts/tutorials/ex10.c

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