[MITgcm-devel] lab_sea default adjoint verif. "broken" since April '11

Fenty, Ian G (3248-Affiliate) Ian.Fenty at jpl.nasa.gov
Thu Oct 20 00:04:56 EDT 2011


Patrick,

Looking at alternatives, the obvious choice seems to be 1D_ocean_ice_column/
But looking at output_adm.txt there shows adj. vs. f.d. gradient accuracies
of E+0 to E+4 i.e. those results can't be taken serious either.

I've been thinking about your remark for a few days now.  I'm going to take a stab at arguing that the 1D_ocean_ice_column adj and f.d. gradients are working fine (great even) and explain my strange findings with the sea ice salinity fraction and the f.d. gradient checks.

I think that before we evaluate the agreement of the adjoint and f.d. tests, we need to consider more than just differences in the magnitudes and signs of the gradients.  We must also take into account 1) possible nonlinearities triggered by the f.d. test,  2) the timescale of response to the perturbation vs. the duration of the f.d. simulation, and 3) the relative magnitudes of the adj and f.d. cost functions in where they disagree.

To point 1, if the perturbation triggers a nonlinear convective response (via KPP or otherwise) then we can't expect that the adj and f.d. tests to agree.  To point 2, if the perturbation is very small and deep within a highly stratified column, we shouldn't be surprised if its signature are the surface just a few hours later is below threshold of numerical noise.  And finally to point 3,  if the adj sensitivities in the column span several orders of magnitude, I don't think we shouldn't care very much about the adj and f.d. gradient differences in those places where the sensitivities are relatively insignificant.

In the 1D setup, the simulation duration is 10 time steps, the initial T,S profiles are essentially unstratified in levels 1-3 and then very strongly stratified thereafter, there is no ice at t=0, and the cost function is the total ice volume over the simulation.  The f.d. test introduces temperature perturbations of magnitude 1e-7 in each of the first n vertical levels.

Adjoint and f.d. gradients agree very well in levels 1 and 4 and their magnitudes fall off by orders of magnitude in the deeper cells.  The large disagreement in adjoint and f.d. gradients in levels 2 and 3 (their signs are opposite) are somehow related to the initially weak stratification in layers 1-3.

For reasons which are not entirely obvious to me, even with very weak initial stratification, the mismatch between the adj and f.d. gradients disappears when the sea ice salinity is set to an arbitrarily small number or zero.  Interestingly, it does not matter whether the ice salinity is set with a small fixed value or  a small (or zero) fractional value (via SIsalFrac).

We can easily show that that the initial stratification affects the agreement between the adj and f.d. gradients by making the initial T,S profile well stratified (I did it in salinity) such that it very little mixing takes place over the first few time steps.  With a stratified column, the adj and f.d. gradients agree very well regardless of how sea ice salinity is specified (fixed or variable) or the initial sea ice salinity value (SIsalFrac=0,0.3 or SIsal0 = 0, 10).  ignoring small numerical differences, the output_adm.txt for the 10 time step intergration becomes:

 grad-res  proc    #    i    j    k   bi   bj iobc               fc ref           fc + eps           fc - eps
 grad-res  proc    #    i    j    k   bi   bj iobc             adj grad            fd grad         1 - fd/adj

grad-res -------------------------------
 grad-res     0    1    1    1    1    1    1    1   7.09046655570E+05  7.09046445311E+05  7.09046865829E+05
 grad-res     0    1    1    1    0    1    1    1  -2.10517724632E+06 -2.10259215673E+06  1.22796766240E-03
grad-res -------------------------------
 grad-res     0    2    1    1    2    1    1    1   7.09046655570E+05  7.09046654415E+05  7.09046656725E+05
 grad-res     0    2    2    2    0    1    1    1  -1.16225154330E+04 -1.15485530114E+04  6.36371893889E-03
grad-res -------------------------------
 grad-res     0    3    1    1    3    1    1    1   7.09046655570E+05  7.09046655571E+05  7.09046655569E+05
 grad-res     0    3    3    3    0    1    1    1  -3.19409336912E-01  1.39197800308E+01  4.45797530700E+01
grad-res -------------------------------
 grad-res     0    4    1    1    4    1    1    1   7.09046655570E+05  7.09046655570E+05  7.09046655570E+05
 grad-res     0    4    4    4    0    1    1    1  -5.92930844968E-06  5.82076609135E-04  9.91693926155E+01
grad-res -------------------------------
 grad-res     0    5    1    1    5    1    1    1   7.09046655570E+05  7.09046655570E+05  7.09046655570E+05
 grad-res     0    5    5    5    0    1    1    1  -8.91011648144E-11  0.00000000000E+00  1.00000000000E+00
grad-res -------------------------------
 grad-res     0    6    1    1    6    1    1    1   7.09046655570E+05  7.09046655570E+05  7.09046655570E+05
 grad-res     0    6    6    6    0    1    1    1   4.54275506101E-13  0.00000000000E+00  1.00000000000E+00

There is excellent agreement in the first two levels (those levels with a chance of communicating with the ice in 10 time steps), the gradient drop off by > 3 orders of magnitude below level 2, and from level 5 and below the f.d. gradient does not change the cost function above the numerical noise level in 10 time steps.

So, I think it's clear that to evaluate the f.d. and adj gradients we need to take into account the stratification and nonlinearities that come up in the perturbation runs due to that stratification.  In any event, I think that the 1D_ice_ocean_column gradients can be taken seriously.

As as aside, I agree that there *is* something fishy with the sea ice salinity and the gradient tests.  To wit, I tried the adj and f.d. gradient comparison again but over a longer time period (100 time steps) using the modified stratified column described above. In that experiment, I find very excellent agreement in gradients in the first 5 levels (they all communicate with the surface over the 100 time steps) -- but only provided that sea ice salinity is > 0.  Even arbitrarily small ice salinities (whether specified using SIsalFrac or with a fixed number) work lead to excellent adj and f.d. gradient agreement.

However, when I set the ice salinity to zero (again using either method) the f.d. gradients suddenly stop agreeing with the adjoint gradients (which basically don't change at all) by changing sign and order of magnitude.

I have absolutely no idea why the results from the f.d. perturbation experiment would be so sensitive to the sea ice salinity fraction - but I agree with you that there is something fishy going on here with the sea ice salinity -- I just don't think it's as straightforward as it first appears.  Setting the ice salinity to zero helps the gradients agree when the column is not well stratified while setting it to zero causes the gradients to disagree when the column is well stratified and the gradient test runs out beyond 10 time steps.

That's all I've got.  If I'm totally missing your point, please elaborate on your claim that started me down this road!

-Ian









-Patrick

---
Patrick Heimbach | heimbach at mit.edu<mailto:heimbach at mit.edu> | http://www.mit.edu/~heimbach
MIT | EAPS 54-1420 | 77 Massachusetts Ave | Cambridge MA 02139 USA
FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach



_______________________________________________
MITgcm-devel mailing list
MITgcm-devel at mitgcm.org<mailto:MITgcm-devel at mitgcm.org>
http://mitgcm.org/mailman/listinfo/mitgcm-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-devel/attachments/20111019/1a0b57e2/attachment.htm>


More information about the MITgcm-devel mailing list