<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
thanks martin, i think this is a reasonable idea then.</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
from what i have seen, if tapenade is passed a subroutine, it does not care if there is a flow file entry or not. one difference is that the flow file for tapenade does not tell the tool which manual subroutines to use. one has to make sure they are defined
somewhere (e.g. stubs_tap_adj.F).</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
thanks</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
dan</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> MITgcm-devel <mitgcm-devel-bounces@mitgcm.org> on behalf of Martin Losch <Martin.Losch@awi.de><br>
<b>Sent:</b> Monday, December 15, 2025 13:54<br>
<b>To:</b> MITgcm-devel <MITgcm-devel@mitgcm.org><br>
<b>Subject:</b> Re: [MITgcm-devel] restoring tapenade-tangent linear for STREAMICE: proposed solution</font>
<div> </div>
</div>
<div style="line-break:after-white-space">Hi Dan,
<div><br>
</div>
<div>there is a similar problem for verification/bottom_ctrl_5x5 where we test the manual AD routine of cg2d (cg2d_mad.F), which does not work for the TLM (there is none) and hence the TLM gradients are totally wrong. An optional model_tlm_diff.list could be
useful in this context, too. I am not sure how TAF handles that because when flow directives describing the interfact are given, then usually TAF ignores the corresponding files.</div>
<div><br>
</div>
<div>Martin<br id="x_lineBreakAtBeginningOfMessage">
<div><br>
<blockquote type="cite">
<div>On 15. Dec 2025, at 13:46, Daniel Goldberg <Dan.Goldberg@ed.ac.uk> wrote:</div>
<br class="x_Apple-interchange-newline">
<div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
Dear J-M and all:</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
Upon the merging of<span class="x_Apple-converted-space"> </span><a title="https://github.com/MITgcm/MITgcm/pull/927" class="x_OWAAutoLink" id="OWAb06708f2-a2c2-f221-5c03-811cdd3c4c64" href="https://github.com/MITgcm/MITgcm/pull/927" originalsrc="https://github.com/MITgcm/MITgcm/pull/927">927</a>(which
was a good thing!), the tangent linear test of STREAMICE under Tapenade no longer worked, whereas it seemed to be giving accurate values. I am writing this email to run a proposed solution by the team, rather than submitting a PR unannounced, to get a feel
for whether it would be welcomed, and looked at.</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
The reason is that streamice_cg_solve.f is no longer passed to Tapenade, instead using a "manual" approach as with cg2d.f. This is necessary for large problems where the ad-generated adjoint code would be very slow and/or memory intensive and would preclude
external library solvers. These issues would not apply as much to the TLM — but no "manual" solution exists.</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
My idea for a solution, is to pass streamice_cg_solve.f through tapenade only when the TLM is compiled. I propose to do this by modifying genmake2 to look for "supplemental" files *_tlm_diff.list (in addition to *_ad_diff.list). A list of S/Rs called $(TLM_FILES)
(or something) will be created and passed as an argument to tapenade, only for the TLM call. The *_tlm_diff.list files (e.g. streamice_tlm_diff.list) files will be optional, and only need contain files that are passed to the TLM but not adjoint. I think this
is justified as in general the set of functions that the TLM can parse easily is larger than that of the adjoint.</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
All the best</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
Dan</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" id="x_Signature" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div class="x_elementToProof" style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif; font-size:12pt">
<br>
</div>
<div class="x_elementToProof" style="background-color:rgb(255,255,255); margin:0px; font-family:Arial,Helvetica,sans-serif; font-size:9.75pt; color:rgb(136,136,136)">
<span style="background-color:rgb(255,255,255)">--</span></div>
<div class="x_elementToProof" style="background-color:rgb(255,255,255); margin:0px">
<div class="x_elementToProof" style="background-color:rgb(255,255,255); margin:0px">
<div class="x_elementToProof" style="direction:ltr; text-align:left; text-indent:0px; margin:0px; font-family:Arial,Helvetica,sans-serif; font-size:12.8px; color:rgb(136,136,136)">
Daniel Goldberg, PhD (he/him)</div>
<div class="x_elementToProof" style="direction:ltr; text-align:left; text-indent:0px; margin:0px; font-family:Arial,Helvetica,sans-serif; font-size:12.8px; color:rgb(136,136,136)">
Reader in Glaciology</div>
<div class="x_elementToProof" style="direction:ltr; text-align:left; text-indent:0px; margin:0px; font-family:Arial,Helvetica,sans-serif; font-size:12.8px; color:rgb(136,136,136)">
School of Geosciences, University of Edinburgh<br>
<span style="font-family:arial,helvetica,clean,sans-serif; line-height:15px">Geography Building, Drummond Street, Edinburgh EH8 9XP</span></div>
<div class="x_elementToProof" style="direction:ltr; text-align:left; text-indent:0px; margin:0px; font-family:arial,helvetica,clean,sans-serif; font-size:12.8px">
<span style="line-height:15px"><a class="x_OWAAutoLink" id="OWAde05217b-7960-6449-a3fc-0fef949b6bd2" href="https://dngoldberg.github.io/" originalsrc="https://dngoldberg.github.io/">https://dngoldberg.github.io/</a></span></div>
</div>
</div>
</div>
<span style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">The
University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th’ ann an Oilthigh Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336. _______________________________________________</span><br style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<span style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none; float:none; display:inline!important">MITgcm-devel
mailing list</span><br style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="mailto:MITgcm-devel@mitgcm.org" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">MITgcm-devel@mitgcm.org</a><br style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel" originalsrc="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel</a></div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>