<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Yes, that is the case I am considering. The special case I am concerned about is as following: the heat equation in variational form and in firedrake/UFL notation is as follows: p*u_t*v*dx + inner(grad(u), grad(v))*dx = 0, where u is the
 temperature, u_t is its time derivative, v is just the test function, dx is the integration domain and p is the design parameter. If “p” were discontinuous, one can’t just factor “p” into the second term due to the divergence theorem. Meaning that p*u_t*v*dx
 + inner(grad(u), grad(v))*dx = 0 is different than u_t*v*dx + inner(1.0 / p * grad(u), grad(v))*dx = 0, which is what ideally one would obtain in order to adapt to the current interface in TSAdjoint.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks<o:p></o:p></p>
<p class="MsoNormal">Miguel<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">"Zhang, Hong" <hongzhang@anl.gov><br>
<b>Date: </b>Thursday, December 17, 2020 at 7:25 PM<br>
<b>To: </b>"Salazar De Troya, Miguel" <salazardetro1@llnl.gov><br>
<b>Cc: </b>Satish Balay via petsc-users <petsc-users@mcs.anl.gov><br>
<b>Subject: </b>Re: [petsc-users] Support for full jacobianP in TSSetIJacobianP<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-left:.5in">Hi Miguel, <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thank you for the nice work. I do not understand what you propose to do here. What is the obstacle to using current TSSetIJacobianP() for the corner case you mentioned? Are you considering a case in which the mass
 matrix is parameterized, e.g. M(p) udot - f(t,u) = g(t,u) ?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thanks,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Hong <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin-left:.5in">On Dec 17, 2020, at 3:38 PM, Salazar De Troya, Miguel via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span lang="ES">Hello,</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span lang="ES"> </span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I am working on hooking up TSAdjoint with pyadjoint through the firedrake-ts interface (<a href="https://github.com/IvanYashchuk/firedrake-ts"><span style="color:#0563C1">https://github.com/IvanYashchuk/firedrake-ts</span></a>).
 I have done most of the implementation and now I am just testing for corner cases. One of them is when the design variable is multiplying the first derivative term. It would be the case ofF(Udot,U,P,t) = G(U,P,t) in<span class="apple-converted-space"> </span><a href="https://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/Sensitivity/TSSetIJacobianP.html"><span style="color:#0563C1">https://www.mcs.anl.gov/petsc/petsc-master/docs/manualpages/Sensitivity/TSSetIJacobianP.html</span></a><span class="apple-converted-space"> </span>.
 I imagine that one could think of refactoring the “P” in the left hand side to the right hand side, but this is not trivial when “P” is a discontinuous field over the domain. I think it would be better to include the case of F(Udot,U,P,t) = G(U,P,t) in TSSetIJacobianP
 and I am volunteering to do it. Given the current implementation of TSAdjoint, is this something feasible?<span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> <span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thanks<span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Miguel<span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"> <span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span lang="ES" style="font-size:9.0pt;font-family:Consolas">Miguel A. Salazar de Troya</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:Consolas">Postdoctoral Researcher, Lawrence Livermore National Laboratory</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:Consolas">B141</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:Consolas">Rm: 1085-5</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><span style="font-size:9.0pt;font-family:Consolas">Ph: 1(925) 422-6411</span><span style="font-size:12.0pt"><o:p></o:p></span></p>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
</div>
</body>
</html>