TSSetStepNumber — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# TSSetStepNumber

Sets the number of steps completed.

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetStepNumber(TS ts, PetscInt steps)

Logically Collective

## Input Parameters

- ts - the `TS` context

- steps - number of steps completed so far

## Note

For most uses of the `TS` solvers the user need not explicitly call `TSSetStepNumber()`, as the step counter is appropriately updated in `TSSolve()`/`TSStep()`/`TSRollBack()`. Power users may call this routine to reinitialize timestepping by setting the step counter to zero (and time to the initial time) to solve a similar problem with different initial conditions or parameters. Other possible use case is to continue timestepping from a previously interrupted run in such a way that `TS` monitors will be called with a initial nonzero step counter.

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSGetStepNumber()`, `TSSetTime()`, `TSSetTimeStep()`, `TSSetSolution()`

## Level

developer

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex40.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/ts/tutorials/ex41.c
src/ts/utils/dmplexlandau/tutorials/ex2.c
src/ts/utils/dmplexlandau/tutorials/ex1.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/ts/tutorials/ex20opt_p.c
src/ts/tutorials/ex50.c
src/ts/tutorials/ex20opt_ic.c

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