# TSGetSNES
Returns the `SNES` (nonlinear solver) associated with a `TS` (timestepper) context. Valid only for nonlinear problems. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSGetSNES(TS ts, SNES *snes)
```
Not Collective, but snes is parallel if ts is parallel


## Input Parameter

- ***ts -*** the `TS` context obtained from `TSCreate()`



## Output Parameter

- ***snes -*** the nonlinear solver context





## Notes
The user can then directly manipulate the `SNES` context to set various
options, etc.  Likewise, the user can then extract and manipulate the
`KSP`, and `PC` contexts as well.

`TSGetSNES()` does not work for integrators that do not use `SNES`; in
this case `TSGetSNES()` returns NULL in snes.


## See Also
 [](chapter_ts), `TS`, `SNES`, `TSCreate()`, `TSSetUp()`, `TSSolve()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/interface/ts.c.html#TSGetSNES">src/ts/interface/ts.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/ex12.c.html">src/ts/tutorials/ex12.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/ex15.c.html">src/ts/tutorials/ex15.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/ex22.c.html">src/ts/tutorials/ex22.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex22f.F90.html">src/ts/tutorials/ex22f.F90.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex24.c.html">src/ts/tutorials/ex24.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex27.c.html">src/ts/tutorials/ex27.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex4.c.html">src/ts/tutorials/ex4.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex47.c.html">src/ts/tutorials/ex47.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)  
