TSSetSaveTrajectory — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# TSSetSaveTrajectory

Causes the `TS` to save its solutions as it iterates forward in time in a `TSTrajectory` object

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetSaveTrajectory(TS ts)

Collective

## Input Parameter

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

## Options Database Keys

- -ts_save_trajectory - saves the trajectory to a file

- -ts_trajectory_type (basic|singlefile|memory|visualization) - set trajectory type

## Notes

This routine should be called after all `TS` options have been set

The `TSTRAJECTORYVISUALIZATION` files can be loaded into Python with \(PETSC_DIR/lib/petsc/bin/PetscBinaryIOTrajectory.py and MATLAB with \)PETSC_DIR/share/petsc/matlab/PetscReadBinaryTrajectory.m

## See Also

TS: Scalable ODE and DAE Solvers, `TS`, `TSTrajectoryType`, `TSTrajectory`, `TSGetTrajectory()`, `TSAdjointSolve()`

## Level

intermediate

## Location

src/ts/interface/ts.c

## Examples

src/ts/tutorials/ex20td.c
src/ts/tutorials/ex20adj.c
src/ts/tutorials/ex51.c
src/tao/unconstrained/tutorials/burgers_spectral.c
src/ts/tutorials/ex20opt_p.c
src/ts/tutorials/ex20opt_ic.c
src/ts/tutorials/ex40.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/ts/tutorials/ex41.c
src/ts/tutorials/ex23fwdadj.c

Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages