# DMTSSetTransientVariable
sets function to transform from state to transient variables 
## Synopsis
```
#include "petscts.h" 
PetscErrorCode DMTSSetTransientVariable(DM dm, TSTransientVariable tvar, void *ctx)
```
Logically Collective


## Input Parameters

- ***dm -*** `DM` to be used with `TS`
- ***tvar -*** a function that transforms to transient variables
- ***ctx -*** a context for tvar



## Calling sequence of tvar
```none
PetscErrorCode tvar(TS ts,Vec p,Vec c,void *ctx);
```


- ***ts -*** timestep context
- ***p -*** input vector (primitive form)
- ***c -*** output vector, transient variables (conservative form)
- ***ctx -*** [optional] user-defined function context





## Notes
This is typically used to transform from primitive to conservative variables so that a time integrator (e.g., `TSBDF`)
can be conservative.  In this context, primitive variables P are used to model the state (e.g., because they lead to
well-conditioned formulations even in limiting cases such as low-Mach or zero porosity).  The transient variable is
C(P), specified by calling this function.  An IFunction thus receives arguments (P, Cdot) and the IJacobian must be
evaluated via the chain rule, as in

dF/dP + shift * dF/dCdot dC/dP.


## See Also
 [](chapter_ts), `TS`, `TSBDF`, `TSSetTransientVariable()`, `DMTSGetTransientVariable()`, `DMTSSetIFunction()`, `DMTSSetIJacobian()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmts.c.html#DMTSSetTransientVariable">src/ts/utils/dmts.c</A>


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