petsc-3.10.5 2019-03-28
Report Typos and Errors

# TSSetCostGradients

Sets the initial value of the gradients of the cost function w.r.t. initial values and w.r.t. the problem parameters for use by the TSAdjoint routines.

### Synopsis

    #include "petscts.h"
    PetscErrorCode TSSetCostGradients(TS ts,PetscInt numcost,Vec *lambda,Vec *mu)

Logically Collective on TS and Vec

### Input Parameters

| ts | - the TS context obtained from TSCreate()
| lambda | - gradients with respect to the initial condition variables, the dimension and parallel layout of these vectors is the same as the ODE solution vector
| mu | - gradients with respect to the parameters, the number of entries in these vectors is the same as the number of parameters

### Notes

the entries in these vectors must be correctly initialized with the values lamda_i = df/dy|finaltime mu_i = df/dp|finaltime

After TSAdjointSolve() is called the lamba and the mu contain the computed sensitivities

### Keywords

TS, timestep, set, sensitivity, initial values

### Level

beginner

### Location

src/ts/interface/sensitivity/tssen.c

### Examples

src/ts/examples/tutorials/extchem.c.html
src/ts/examples/tutorials/ex16adj.c.html
src/ts/examples/tutorials/ex16opt_p.c.html
src/ts/examples/tutorials/ex16opt_ic.c.html
src/ts/examples/tutorials/ex20adj.c.html
src/ts/examples/tutorials/ex20opt_p.c.html
src/ts/examples/tutorials/ex20opt_ic.c.html
src/tao/unconstrained/examples/tutorials/spectraladjointassimilation.c.html
Index of all Sensitivity routines
Table of Contents for all manual pages
Index of all manual pages