# 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 func
```none
func (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
 [](chapter_ts), `TSPSEUDO`, `TSPseudoTimeStepDefault()`, `TSPseudoComputeTimeStep()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/pseudo/posindep.c.html#TSPseudoSetTimeStep">src/ts/impls/pseudo/posindep.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex1.c.html">src/ts/tutorials/ex1.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/pseudo/posindep.c.html#TSPseudoSetTimeStep_Pseudo">TSPseudoSetTimeStep_Pseudo in src/ts/impls/pseudo/posindep.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
