:orphan:
# TSSetI2Function
Set the function to compute F(t,U,U_t,U_tt) where F = 0 is the DAE to be solved. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSSetI2Function(TS ts, Vec F, TSI2Function fun, void *ctx)
```
Logically Collective


## Input Parameters

- ***ts  -*** the `TS` context obtained from `TSCreate()`
- ***F   -*** vector to hold the residual (or `NULL` to have it created internally)
- ***fun -*** the function evaluation routine
- ***ctx -*** user-defined context for private data for the function evaluation routine (may be `NULL`)



## Calling sequence of `fun`
```none
PetscErrorCode fun(TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, Vec F,void *ctx);
```

- ***ts  -*** the `TS` context obtained from `TSCreate()`
- ***t    -*** time at step/stage being solved
- ***U    -*** state vector
- ***U_t  -*** time derivative of state vector
- ***U_tt -*** second time derivative of state vector
- ***F    -*** function vector
- ***ctx  -*** [optional] user-defined context for matrix evaluation routine (may be `NULL`)





## See Also
 [](ch_ts), `TS`, `TSSetI2Jacobian()`, `TSSetIFunction()`, `TSCreate()`, `TSSetRHSFunction()`

## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex43.c.html">src/ts/tutorials/ex43.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex44.c.html">src/ts/tutorials/ex44.c</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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
