petsc-3.7.7 2017-09-25
Report Typos and Errors

# TSSetCostGradients

Sets the initial value of the gradients of the cost function w.r.t. initial conditions 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

### Keywords

TS, timestep, set, sensitivity, initial conditions

Level:beginner
Location:src/ts/interface/ts.c
Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages

### 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