[MITgcm-devel] restoring tapenade-tangent linear for STREAMICE: proposed solution

Martin Losch Martin.Losch at awi.de
Mon Dec 15 08:54:17 EST 2025


Hi Dan,

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.

Martin

> On 15. Dec 2025, at 13:46, Daniel Goldberg <Dan.Goldberg at ed.ac.uk> wrote:
> 
> Dear J-M and all:
> 
> Upon the merging of 927 <https://github.com/MITgcm/MITgcm/pull/927>(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.
> 
> 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.
> 
> 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.
> 
> All the best
> Dan
> 
> 
> 
> --
> Daniel Goldberg, PhD (he/him)
> Reader in Glaciology
> School of Geosciences, University of Edinburgh
> Geography Building, Drummond Street, Edinburgh EH8 9XP
> https://dngoldberg.github.io/
> 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. _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org <mailto:MITgcm-devel at mitgcm.org>
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-devel/attachments/20251215/1251f64d/attachment-0001.html>


More information about the MITgcm-devel mailing list