<div dir="ltr"><div><div dir="ltr"><br></div><div>Hi Hong, <br><br></div><div>For the optimal control example, the cost function has an integral term which necessitates the setup of a sub-TS quadrature. The Jacobian with respect to parameter, (henceforth denoted by Jacp) has dimensions that depend upon the number of steps that the TS integrates for. <br><br></div><div>I'm trying to implement a simpler case where the cost function doesn't have an integral term but the parameters are still time dependent. For this, I modified the standard Van der Pol example (ex20adj.c) to make mu a time dependent parameter (though it has the same value at all points in time and I also made the initial conditions & params independent).<br><br> Since the structure of Jacp doesn't depend on time (i.e. it is the same at all points in time, the structure being identical to the time-independent case), is it necessary that I create a Jacp matrix size whose dimensions are [dimensions of time-independent Jacp] * -ts_max_steps ? Keeping Jacp dimensions the same as 
dimensions of time-independent Jacp causes the program to crash (possibly due to the fact that Jacp and adjoint vector can't be multiplied). Ideally, it would be nice to have a Jacp analog of TSRHSJacobianSetReuse whereby I specify the Jacp routine once and TS knows how to reuse that at all times. Is this possible with the current petsc-master ?<br></div><div><br></div><div>Another question I have is regarding exclusive calculation of one adjoint. If I'm not interested in adjoint with respect to initial conditions, can I ask TSAdjoing to not calculate that ? Setting the initialization for adjoint vector with respect to initial conditions to be NULL in TSSetCostGradients doesn't work.<br></div><br></div>Thank You, <br><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div style="font-size:12.8px">Sajid Ali | PhD Candidate<br></div><div style="font-size:12.8px">Applied Physics<br></div><div style="font-size:12.8px">Northwestern University</div><div style="font-size:12.8px"><a href="http://s-sajid-ali.github.io" target="_blank">s-sajid-ali.github.io</a></div></div></div></div></div></div></div></div></div>