# TSSetTolerances
Set tolerances for local truncation error when using adaptive controller 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSSetTolerances(TS ts, PetscReal atol, Vec vatol, PetscReal rtol, Vec vrtol)
```
Logically Collective


## Input Parameters

- ***ts -*** time integration context
- ***atol -*** scalar absolute tolerances, `PETSC_DECIDE` to leave current value
- ***vatol -*** vector of absolute tolerances or NULL, used in preference to atol if present
- ***rtol -*** scalar relative tolerances, `PETSC_DECIDE` to leave current value
- ***vrtol -*** vector of relative tolerances or NULL, used in preference to atol if present



## Options Database keys

- ***-ts_rtol <rtol> -*** relative tolerance for local truncation error
- ***-ts_atol <atol> -*** Absolute tolerance for local truncation error





## Notes
With PETSc's implicit schemes for DAE problems, the calculation of the local truncation error
(LTE) includes both the differential and the algebraic variables. If one wants the LTE to be
computed only for the differential or the algebraic part then this can be done using the vector of
tolerances vatol. For example, by setting the tolerance vector with the desired tolerance for the
differential part and infinity for the algebraic part, the LTE calculation will include only the
differential variables.


## See Also
 [](chapter_ts), `TS`, `TSAdapt`, `TSErrorWeightedNorm()`, `TSGetTolerances()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/interface/ts.c.html#TSSetTolerances">src/ts/interface/ts.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex49.c.html">src/ts/tutorials/ex49.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex50.c.html">src/ts/tutorials/ex50.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/burgers_spectral.c.html">src/tao/unconstrained/tutorials/burgers_spectral.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html">src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ts/interface/ts.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)  
