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 TS
adjoint routines.
Synopsis#
#include "petscts.h"
PetscErrorCode TSSetCostGradients(TS ts, PetscInt numcost, Vec *lambda, Vec *mu)
Logically Collective
Input Parameters#
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 lambda_i = df/dy|finaltime mu_i = df/dp|finaltime
After TSAdjointSolve()
is called the lambda and the mu contain the computed sensitivities
See Also#
Level#
beginner
Location#
Examples#
src/tao/unconstrained/tutorials/burgers_spectral.c
src/tao/unconstrained/tutorials/spectraladjointassimilation.c
src/ts/tutorials/ex20adj.c
src/ts/tutorials/ex20opt_ic.c
src/ts/tutorials/ex20opt_p.c
src/ts/tutorials/ex20td.c
src/ts/tutorials/ex23fwdadj.c
src/ts/tutorials/extchem.c
src/ts/tutorials/extchemfield.c
Index of all Sensitivity routines
Table of Contents for all manual pages
Index of all manual pages