# TSTHETA
DAE solver using the implicit Theta method 


## Options Database Keys

- ***-ts_theta_theta <Theta> -*** Location of stage (0<Theta<=1)
- ***-ts_theta_endpoint <flag> -*** Use the endpoint (like Crank-Nicholson) instead of midpoint form of the Theta method
- ***-ts_theta_initial_guess_extrapolate <flg> -*** Extrapolate stage initial guess from previous solution (sometimes unstable)



## Notes
```none
-ts_type theta -ts_theta_theta 1.0 corresponds to backward Euler (`TSBEULER`)
```
```none
-ts_type theta -ts_theta_theta 0.5 corresponds to the implicit midpoint rule
```
```none
-ts_type theta -ts_theta_theta 0.5 -ts_theta_endpoint corresponds to Crank-Nicholson (`TSCN`)
```

The endpoint variant of the Theta method and backward Euler can be applied to DAE. The midpoint variant is not suitable for DAEs because it is not stiffly accurate.

The midpoint variant is cast as a 1-stage implicit Runge-Kutta method.

```none
  Theta | Theta
  -------------
        |  1
```


For the default Theta=0.5, this is also known as the implicit midpoint rule.


## When the endpoint variant is chosen, the method becomes a 2-stage method with first stage explicit

```none
  0 | 0         0
  1 | 1-Theta   Theta
  -------------------
    | 1-Theta   Theta
```


For the default Theta=0.5, this is the trapezoid rule (also known as Crank-Nicolson, see TSCN).

To apply a diagonally implicit RK method to DAE, the stage formula

```none
Y_i = X + h sum_j a_ij Y'_j
```

is interpreted as a formula for Y'_i in terms of Y_i and known values (Y'_j, j<i)


## See Also
 [](chapter_ts), `TSCreate()`, `TS`, `TSSetType()`, `TSCN`, `TSBEULER`, `TSThetaSetTheta()`, `TSThetaSetEndpoint()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/theta/theta.c.html#TSTHETA">src/ts/impls/implicit/theta/theta.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex10.c.html">src/ts/tutorials/ex10.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex14.c.html">src/ts/tutorials/ex14.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex17.c.html">src/ts/tutorials/ex17.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex31.c.html">src/ts/tutorials/ex31.c.html</A><BR>


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