:orphan:
# TSPseudoSetTimeStep
Sets the user-defined routine to be called at each pseudo-timestep to update the timestep.
## Synopsis
```
#include "petscts.h"
PetscErrorCode TSPseudoSetTimeStep(TS ts, PetscErrorCode (*dt)(TS, PetscReal *, void *), void *ctx)
```
Logically Collective
## Input Parameters
- ***ts -*** timestep context
- ***dt -*** function to compute timestep
- ***ctx -*** [optional] user-defined context for private data required by the function (may be `NULL`)
## Calling sequence of `dt`
```none
PetscErrorCode dt(TS ts, PetscReal *newdt, void *ctx);
```
- ***newdt -*** the newly computed timestep
- ***ctx -*** [optional] timestep context
## Notes
The routine set here will be called by `TSPseudoComputeTimeStep()`
during the timestepping process.
If not set then `TSPseudoTimeStepDefault()` is automatically used
## See Also
[](ch_ts), `TSPSEUDO`, `TSPseudoTimeStepDefault()`, `TSPseudoComputeTimeStep()`
## Level
intermediate
## Location
src/ts/impls/pseudo/posindep.c
## Examples
src/ts/tutorials/ex1.c
## Implementations
TSPseudoSetTimeStep_Pseudo in src/ts/impls/pseudo/posindep.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ts/impls/pseudo/posindep.c)
[Index of all TS routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)