TSForwardSetSensitivities — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# TSForwardSetSensitivities

Sets the initial value of the trajectory sensitivities of solution w.r.t. the problem parameters and initial values.

## Synopsis

    #include <petscts.h>
    PetscErrorCode TSForwardSetSensitivities(TS ts, PetscInt nump, Mat Smat)

Logically Collective

## Input Parameters

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

- nump - number of parameters

- Smat - sensitivities with respect to the parameters, the number of entries in these vectors is the same as the number of parameters

## Notes

Forward sensitivity is also called ‘trajectory sensitivity’ in some fields such as power systems. This function turns on a flag to trigger `TSSolve()` to compute forward sensitivities automatically. You must call this function before `TSSolve()`. The entries in the sensitivity matrix must be correctly initialized with the values S = dy/dp|startingtime.

## See Also

TS: Scalable ODE and DAE Solvers, `TSForwardGetSensitivities()`, `TSForwardSetIntegralGradients()`, `TSForwardGetIntegralGradients()`, `TSForwardStep()`

## Level

beginner

## Location

src/ts/interface/sensitivity/tssen.c

## Examples

src/ts/tutorials/ex16fwd.c
src/ts/tutorials/ex23fwdadj.c
src/ts/tutorials/ex20fwd.c

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