[MITgcm-devel] storing policy for taf
Martin Losch
Martin.Losch at awi.de
Wed Dec 2 11:28:33 EST 2020
Hi there,
before I make this an issue, I’d like to ask all of ye adjointers:
I noticed that in many cases we insert store directives for comlev1 (inner checkpointing loop) for fields ***before*** calling a subroutine that updates them. As a consequence (?) TAF stores the field and then in the “_ad” routine restores the field, and updates it with the forward code. This doesn’t make too much sense to me. Wouldn’t it make much more sense to store the field after updating it, and then TAF just restores the updated field rather and does not recompute the update?
for example in seaice_model.F
we have
CADJ store uice, vice = complev1, .
[…]
CALL seaice_dynsolver (updates uice, vice)
[…]
CALL seaice_advdiff( uses uice,vice)
This leads to code in seaice_modelmd:
comlev1_uice_ = uice, etc (store uice(n-1))
call seaice_dynsolvermd (compute uice(n))
call seaice_advdiffmd (use(uice(n))
and in seaice_model_ad
uice = comlev1_uice_ etc, (restore uice(n-1)
call seaice_dynsolver (compute uice(n))
call seaice_advdiff (use uice(n))
when I first compute the update and then store it:
CALL seaice_dynsolver (updates uice, vice)
CADJ store uice, vice = complev1, .
I have in seaice_modelmd
CALL seaice_dynsolvermd
comlev1_uice_ = uice (store uice(n))
call seaice_advidff (use uice(n))
and in seaice_model_ad just
uice=comlev1_uice_ (resotre(uice(n))
call seaice_advdiff (use(uice(n))
In this way I can (probably) avoid recomputing many parts of the timestep. Besides the unnecessary recomputation (which we may want to avoid excessive storage), this has consequences for subtle tricks that we do. For example, these interesting flags
SEAICEuseFREEDRIFTswitchInAd
SEAICEuseDYNAMICSswitchInAd
if set to true will lead to different values of SEAICEuseDynamics/useLSR/useFreeDrift values in seaice_modelmd and seaice_model_ad, so that the tapes are computed correctly, but in seaice_model_ad the timestep is recomputed with a different set of flags, so that seaice_dynsolver is called with, e.g. useDynamics = T from seaice_model, but with useDYnamics = F in seaice_model_ad leading to different updated states. That can’t be right, and I am a little concerned that this hampers the regularisation efforts of the AD-seaice model.
What do you think about that?
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1665 bytes
Desc: not available
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-devel/attachments/20201202/75b0dca8/attachment.p7s>
More information about the MITgcm-devel
mailing list