petsc-3.13.6 2020-09-29
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

Input Parameters

ts - the TS context obtained from TSCreate()
numcost - number of gradients to be computed, this is the number of cost functions
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

See Also

TSGetCostGradients()

Level

beginner

Location

src/ts/interface/sensitivity/tssen.c

Examples

src/ts/tutorials/extchem.c.html
src/ts/tutorials/ex20adj.c.html
src/ts/tutorials/ex20opt_p.c.html
src/ts/tutorials/ex20opt_ic.c.html
src/tao/unconstrained/tutorials/spectraladjointassimilation.c.html

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