<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Feb 25, 2020, at 10:37 AM, Sajid Ali <<a href="mailto:sajidsyed2021@u.northwestern.edu" class="">sajidsyed2021@u.northwestern.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">Hi PETSc-developers, <br class="">
<br class="">
</div>
Could the code used for section 5.1 of the recent paper "PETSc TSAdjoint: a discrete adjoint ODE solver for first-order and second-order sensitivity analysis" be shared ? Are there more examples that deal with time dependent parameters in the git repository
 ?<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
The code is in the master branch. See ts/examples/tutorials/optimal_control/ex1.c. This is the only example that deals with time-varying parameters.</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">Another question I have is regarding the equations used to introduce adjoints in section 7.1 of the manual where for the state of the solution vector is denoted by y and the parameters by p.
<br class="">
<br class="">
[1] I'm unsure about what the partial derivative of y0 with respect to p means since I understand y0 to be the initial conditions used to solve the TS which would not depend on the parameters (since the parameters are related to the equations TS tries to solve
 for which should not dependent on the initialization used). Could someone clarify what this means ?
<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div> There exist applications that initial condition depends on the design parameters. </div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">[2] The manual described that a user has to set the correct initialization for the adjoint variables when calling TSSetCostGradients. The initialization for mu vector is whereby given to be dΦi/dp at t=tF. If p is time dependent, does one evaluate
 this derivative with respect to p(t) at t=tF ?<br class="">
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
Yes<br class="">
<div><br class="">
</div>
<div>The adjoint solvers are designed to handle as many cases as possible. In your case, you may have simpler dependencies than those supported. If the initial condition and the objective function do not depend on the parameters directly, their partial derivatives
 wrt to p will be zero and you can simply ignore them.</div>
<div><br class="">
</div>
<div>Hong (Mr.)</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">Thank You,<br class="">
</div>
<div class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div style="font-size:12.8px" class="">Sajid Ali | PhD Candidate<br class="">
</div>
<div style="font-size:12.8px" class="">Applied Physics<br class="">
</div>
<div style="font-size:12.8px" class="">Northwestern University</div>
<div style="font-size:12.8px" class=""><a href="http://s-sajid-ali.github.io/" target="_blank" class="">s-sajid-ali.github.io</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>