# TSSetFromOptions
Sets various `TS` parameters from user options. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSSetFromOptions(TS ts)
```
Collective


## Input Parameter

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



## Options Database Keys

- ***-ts_type <type> -*** EULER, BEULER, SUNDIALS, PSEUDO, CN, RK, THETA, ALPHA, GLLE,  SSP, GLEE, BSYMP, IRK
- ***-ts_save_trajectory -*** checkpoint the solution at each time-step
- ***-ts_max_time <time> -*** maximum time to compute to
- ***-ts_time_span <t0,...tf> -*** sets the time span, solutions are computed and stored for each indicated time
- ***-ts_max_steps <steps> -*** maximum number of time-steps to take
- ***-ts_init_time <time> -*** initial time to start computation
- ***-ts_final_time <time> -*** final time to compute to (deprecated: use -ts_max_time)
- ***-ts_dt <dt> -*** initial time step
- ***-ts_exact_final_time <stepover,interpolate,matchstep> -*** whether to stop at the exact given final time and how to compute the solution at that time
- ***-ts_max_snes_failures <maxfailures> -*** Maximum number of nonlinear solve failures allowed
- ***-ts_max_reject <maxrejects> -*** Maximum number of step rejections before step fails
- ***-ts_error_if_step_fails <true,false> -*** Error if no step succeeds
- ***-ts_rtol <rtol> -*** relative tolerance for local truncation error
- ***-ts_atol <atol> -*** Absolute tolerance for local truncation error
- ***-ts_rhs_jacobian_test_mult -*** mat_shell_test_mult_view - test the Jacobian at each iteration against finite difference with RHS function
- ***-ts_rhs_jacobian_test_mult_transpose -*** mat_shell_test_mult_transpose_view - test the Jacobian at each iteration against finite difference with RHS function
- ***-ts_adjoint_solve <yes,no> -*** After solving the ODE/DAE solve the adjoint problem (requires -ts_save_trajectory)
- ***-ts_fd_color -*** Use finite differences with coloring to compute IJacobian
- ***-ts_monitor -*** print information at each timestep
- ***-ts_monitor_cancel -*** Cancel all monitors
- ***-ts_monitor_lg_solution -*** Monitor solution graphically
- ***-ts_monitor_lg_error -*** Monitor error graphically
- ***-ts_monitor_error -*** Monitors norm of error
- ***-ts_monitor_lg_timestep -*** Monitor timestep size graphically
- ***-ts_monitor_lg_timestep_log -*** Monitor log timestep size graphically
- ***-ts_monitor_lg_snes_iterations -*** Monitor number nonlinear iterations for each timestep graphically
- ***-ts_monitor_lg_ksp_iterations -*** Monitor number nonlinear iterations for each timestep graphically
- ***-ts_monitor_sp_eig -*** Monitor eigenvalues of linearized operator graphically
- ***-ts_monitor_draw_solution -*** Monitor solution graphically
- ***-ts_monitor_draw_solution_phase  <xleft,yleft,xright,yright> -*** Monitor solution graphically with phase diagram, requires problem with exactly 2 degrees of freedom
- ***-ts_monitor_draw_error -*** Monitor error graphically, requires use to have provided TSSetSolutionFunction()
- ***-ts_monitor_solution [ascii binary draw][:filename][:viewerformat] -*** monitors the solution at each timestep
- ***-ts_monitor_solution_vtk <filename.vts,filename.vtu> -*** Save each time step to a binary file, use filename-%%03" PetscInt_FMT ".vts (filename-%%03" PetscInt_FMT ".vtu)
- ***-ts_monitor_envelope -*** determine maximum and minimum value of each component of the solution over the solution time





## Notes
See `SNESSetFromOptions()` and `KSPSetFromOptions()` for how to control the nonlinear and linear solves used by the time-stepper.

Certain `SNES` options get reset for each new nonlinear solver, for example -snes_lag_jacobian <its> and -snes_lag_preconditioner <its>, in order
to retain them over the multiple nonlinear solves that TS uses you mush also provide -snes_lag_jacobian_persists true and
-snes_lag_preconditioner_persists true


## Developer Note
We should unify all the -ts_monitor options in the way that -xxx_view has been unified


## See Also
 [](chapter_ts), `TS`, `TSGetType()`

## Level
beginner

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex1.c.html">src/ts/tutorials/ex1.c.html</A><BR>
<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/ex11.c.html">src/ts/tutorials/ex11.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11_sa.c.html">src/ts/tutorials/ex11_sa.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/ex13.c.html">src/ts/tutorials/ex13.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/ex16.c.html">src/ts/tutorials/ex16.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex16fwd.c.html">src/ts/tutorials/ex16fwd.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>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/arkimex/arkimex.c.html#TSSetFromOptions_ARKIMEX">TSSetFromOptions_ARKIMEX in src/ts/impls/arkimex/arkimex.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/bdf/bdf.c.html#TSSetFromOptions_BDF">TSSetFromOptions_BDF in src/ts/impls/bdf/bdf.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/eimex/eimex.c.html#TSSetFromOptions_EIMEX">TSSetFromOptions_EIMEX in src/ts/impls/eimex/eimex.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/explicit/euler/euler.c.html#TSSetFromOptions_Euler">TSSetFromOptions_Euler in src/ts/impls/explicit/euler/euler.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/explicit/rk/rk.c.html#TSSetFromOptions_RK">TSSetFromOptions_RK in src/ts/impls/explicit/rk/rk.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/explicit/ssp/ssp.c.html#TSSetFromOptions_SSP">TSSetFromOptions_SSP in src/ts/impls/explicit/ssp/ssp.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/glee/glee.c.html#TSSetFromOptions_GLEE">TSSetFromOptions_GLEE in src/ts/impls/glee/glee.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/alpha/alpha1.c.html#TSSetFromOptions_Alpha">TSSetFromOptions_Alpha in src/ts/impls/implicit/alpha/alpha1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/alpha/alpha2.c.html#TSSetFromOptions_Alpha">TSSetFromOptions_Alpha in src/ts/impls/implicit/alpha/alpha2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/discgrad/tsdiscgrad.c.html#TSSetFromOptions_DiscGrad">TSSetFromOptions_DiscGrad in src/ts/impls/implicit/discgrad/tsdiscgrad.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/glle/glle.c.html#TSSetFromOptions_GLLE">TSSetFromOptions_GLLE in src/ts/impls/implicit/glle/glle.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/irk/irk.c.html#TSSetFromOptions_IRK">TSSetFromOptions_IRK in src/ts/impls/implicit/irk/irk.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/sundials/sundials.c.html#TSSetFromOptions_Sundials">TSSetFromOptions_Sundials in src/ts/impls/implicit/sundials/sundials.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/implicit/theta/theta.c.html#TSSetFromOptions_Theta">TSSetFromOptions_Theta in src/ts/impls/implicit/theta/theta.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/mimex/mimex.c.html#TSSetFromOptions_Mimex">TSSetFromOptions_Mimex in src/ts/impls/mimex/mimex.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/multirate/mprk.c.html#TSSetFromOptions_MPRK">TSSetFromOptions_MPRK in src/ts/impls/multirate/mprk.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/pseudo/posindep.c.html#TSSetFromOptions_Pseudo">TSSetFromOptions_Pseudo in src/ts/impls/pseudo/posindep.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/rosw/rosw.c.html#TSSetFromOptions_RosW">TSSetFromOptions_RosW in src/ts/impls/rosw/rosw.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/impls/symplectic/basicsymplectic/basicsymplectic.c.html#TSSetFromOptions_BasicSymplectic">TSSetFromOptions_BasicSymplectic in src/ts/impls/symplectic/basicsymplectic/basicsymplectic.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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
