Skip to main content
`Ctrl`+`K`

# TSSetMaxTime

Sets the maximum (or final) time for timestepping.

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetMaxTime(TS ts, PetscReal maxtime)

Logically Collective

## Input Parameters

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

- maxtime - final time to step to

## Options Database Key

- -ts_max_time maxtime - Sets maxtime

## Notes

Use `PETSC_DETERMINE` to reset the maximum time to the default from when the object’s type was set

The default maximum time is 5.0

## Fortran Note

Use `PETSC_DETERMINE_REAL`

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSGetMaxTime()`, `TSSetMaxSteps()`, `TSSetExactFinalTime()`

## Level

intermediate

## Location

src/ts/interface/ts.c

## Examples

src/tao/unconstrained/tutorials/burgers_spectral.c
src/ts/tutorials/ex27.c
src/ts/tutorials/ex26.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/ts/tutorials/ex1.c
src/ts/tutorials/ex10.c
src/ts/tutorials/ex11.c
src/ts/tutorials/ex12.c
src/ts/tutorials/ex51.c
src/ts/tutorials/ex9.c

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