https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_fm/common/ropp_fm_state2roprof.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_fm/model_ecmwf/ropp_fm_state2state_ecmwf.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_fm/model_ecmwf/ropp_fm_state2state_ecmwf_ad.f90 https://trac.romsaf.org/ropp/changeset/5427/ropp_src/branches/dev/Share/dmi_trunk_9.0/ropp_fm/model_ecmwf/ropp_fm_state2state_ecmwf_tl.f90
Original changesets:
svn merge of jkn_dmi_trunk_8.1 https://trac.romsaf.org/ropp/changeset/5409
Component: | ROPP(all) → ropp_fm |
---|---|
Summary: | svn merge of jkn_dmi_trunk_8.1 [infinite, until adjoint] → svn merge of jkn_dmi_trunk_8.1 [infinite, until adjoint available] |
Version: | 9.0 → 11.0 |
---|
(Note that we have
REAL(wp), PARAMETER :: R_dry = 287.0597_wp ! J K^{-1} kg^{-1} REAL(wp), PARAMETER :: R_vap = 461.5250_wp ! J K^{-1} kg^{-1}
and
REAL(wp), PARAMETER :: mw_dry_air = 28.9648e-3_wp ! kg mol^{-1} REAL(wp), PARAMETER :: mw_water = 18.01528e-3_wp ! kg mol^{-1}
But theoretically R = NA kB / mw, and in fact, from the figures above, R_dry/R_vap = 0.6219808
and mw_water/mw_dry_air = 0.6219715
, so perhaps there is some redundancy here.)
The 1DVAR core test ref files need updating as a result of this. (Actually, most of them were very out of date, so update them even if they didn't need it to pass the core test, e.g. the COSMIC tests, which use Met Office backgrounds.) Done at r6858.
Implement a first version of this change in ropp_fm_state2state_ecmwf.f90. Replace
akk = 0.5_wp * ( x%ak(1:n_hlv-1) + x%ak(2:n_hlv)) bkk = 0.5_wp * ( x%bk(1:n_hlv-1) + x%bk(2:n_hlv)) x%pres = akk + bkk*psfc
by
x%pres(n_flv) = EXP(-1.0_wp) * ( p_hlv(n_hlv-1) - p_hlv(n_hlv) ) DO lvl=n_flv-1,1,-1 x%pres(lvl) = EXP( ( ( p_hlv(lvl ) * LOG(p_hlv(lvl )) - & p_hlv(lvl+1) * LOG(p_hlv(lvl+1)) ) / & (p_hlv(lvl) - p_hlv(lvl+1)) ) - 1.0_wp ) ENDDO
which is a cleaned up version of Joe's
x%pres(n_flv)=1.0_wp/exp(1.0_wp) * (p_hlv(n_hlv-1)-p_hlv(n_hlv)) DO lvl=n_flv-1,1,-1 x%pres(lvl)=exp(1.0_wp*1.0_wp/(p_hlv(lvl)-p_hlv(lvl+1)) & *(p_hlv(lvl)*log(p_hlv(lvl))-p_hlv(lvl+1)*log(p_hlv(lvl+1))) - 1.0_wp) ENDDO
and which matches Eqn 3.18 of Simmons and Burridge (1981) (https://journals.ametsoc.org/view/journals/mwre/109/4/1520-0493_1981_109_0758_aeaamc_2_0_co_2.xml).
Check that we see a difference from the old formula, and that my expression matches Joe's:
NL: state%non_ideal, state%new_ref_op, state%new_bangle_op = F F F Old FM: x%pres = 101269.99138593674 101209.97415781021 101149.95692968369 101089.93970155716 101015.13269403949 100925.53590713069 100835.93912031502 100746.33931443095 100636.05050034821 100505.07871657610 100374.10995066166 100243.13816726208 100086.72280311584 99904.866874217987 99723.010945320129 99541.155016422272 99330.173054337502 99090.065070986748 98849.957075715065 98609.849080443382 98337.932267785072 98034.203594923019 97730.471903085709 97426.743230223656 97089.455959200859 96718.604052066803 96347.749125957489 95976.894199848175 95571.585571765900 95131.823194026947 94692.060768604279 94252.298343181610 93777.984189987183 93269.115290045738 92760.243371129036 92251.374471187592 91708.574330806732 91131.836912035942 90555.096569657326 89978.359341621399 89368.963479995728 88726.902946829796 88084.839203953743 87442.778480052948 86769.911894202232 86066.236236691475 85362.563598155975 84658.890959620476 83926.773789525032 83166.212278604507 82405.647939443588 81645.086619257927 80858.889570832253 80047.053775191307 79235.217979550362 78423.382565379143 77589.089038968086 76732.337400317192 75875.585761666298 75018.833741545677 74143.101927638054 73248.393338918686 72353.684750199318 71458.973142504692 70548.995131254196 69623.750716447830 68698.506301641464 67773.258867859840 66836.615023016930 65888.577786087990 64940.540549159050 63992.502549290657 63037.033995985985 62074.137161672115 61111.241836845875 60148.345002532005 59182.002758979797 58212.214343249798 57242.423655092716 56272.634476423264 55303.340944647789 54334.543059766293 53365.746684372425 52396.948799490929 51432.465043663979 50472.295416891575 49512.124280631542 48551.953890919685 47599.729417264462 46655.450876057148 45711.173097789288 44766.894556581974 43833.937635272741 42912.302333861589 41990.666269510984 41069.030205160379 40161.762145906687 39268.862091749907 38375.961274653673 37483.060457557440 36607.176849991083 35748.310451954603 34889.444816857576 34030.578418821096 33190.908026695251 32370.434403419495 31549.960780143738 30729.487156867981 29929.854602366686 29151.063879579306 28372.273156791925 27593.481671065092 26836.566329002380 26101.527893543243 25366.490409709513 24631.452351622283 23918.648974597454 23228.080278635025 22537.510819733143 21846.942123770714 21178.218981623650 20531.339961756021 19884.460273291916 19237.581253424287 18613.447177596390 18012.057471554726 17410.667049745098 16809.276580763981 16231.263521313667 15676.627871394157 15121.992984414101 14567.358097434044 14036.450912989676 13529.270691727288 13022.090482257772 12514.910642465111 12031.513354484923 11571.899381256662 11112.285789498128 10652.671816269867 10216.598750527191 9804.0665922701010 9391.5340525432839 8979.0015120794124 8589.4722700099010 8222.9467085415308 7856.4215285428872 7489.8959670745171 7145.5562591552734 6823.4027862548828 6501.2493133544922 6179.0960311889648 5879.1055679321289 5601.2775421142578 5323.4493255615234 5045.6211090087891 4788.4050369262695 4551.8011093139648 4315.1973724365234 4078.5936355590820 3864.8078918457031 3673.8403320312500 3482.8727722167969 3291.9053077697754 3119.3550109863281 2965.2217864990234 2811.0885620117188 2656.9553375244141 2517.6869392395020 2393.2832717895508 2268.8795089721680 2144.4757461547852 2032.0696830749512 1931.6613197326660 1831.2529563903809 1730.8445930480957 1640.1196956634521 1559.0782642364502 1478.0367851257324 1396.9953060150146 1323.7696170806885 1258.3596229553223 1192.9496288299561 1127.5396823883057 1068.4379100799561 1015.6443119049072 962.85076141357422 910.05721092224121 862.35508918762207 819.74449157714844 777.13391780853271 734.52332019805908 696.02215290069580 661.63041591644287 627.23870277404785 592.84698963165283 561.77198886871338 534.01374816894531 506.25553131103516 478.49729061126709 453.28738689422607 430.62582015991211 407.96425342559814 385.30269861221313 364.53740596771240 345.66838741302490 326.79936885833740 307.93035030364990 290.53124189376831 274.60204362869263 258.67284536361694 242.74364709854126 228.00470590591431 214.45603370666504 200.90736150741577 187.35868334770203 174.82171654701233 163.29645514488220 151.77119374275208 140.24593234062195 129.62750792503357 119.91592645645142 110.20434498786926 100.49275755882263 91.638317704200745 83.641025424003601 75.643733143806458 67.646440863609314 60.494989156723022 54.189375042915344 47.883759438991547 41.578145325183868 36.122170090675354 31.515835225582123 26.909501850605011 22.303167730569839 10.000000149011612 JKN FM: x%pres = 101269.98990353283 101209.97267505448 101149.95544596070 101089.93821687988 101015.12938281008 100925.53259288461 100835.93580323779 100746.33599402005 100636.04339782870 100505.07160558137 100374.10283008868 100243.13103695579 100086.70903526731 99904.853081330672 99722.997127224764 99541.141173047130 99330.148870686768 99090.040828766432 98849.932774732617 98609.824720094650 98337.893180934756 98034.164385431373 97730.432571705969 97426.703777785558 97089.396937581259 96718.544802241333 96347.689648060987 95976.834492134862 95571.501258413075 95131.738490810530 94691.975672050059 94252.212849572839 93777.869137745336 93268.999607292571 92760.127053780307 92251.257514941040 91708.423207504078 91131.684829152393 90554.943518229178 89978.205312443373 89368.771280972098 88726.709353372091 88084.644199100134 87442.582047308213 86769.674119169344 86065.996517636086 85362.321907145888 84658.647255498421 83926.486608580846 83165.922467036216 82405.355453029566 81644.791412851118 80858.549945760125 80046.710705614241 79234.871394866117 78423.032393486370 77588.694852915272 76731.938813643894 75875.182673570511 75018.426049928210 74142.652057063751 73247.937979377093 72353.223753471029 71458.506373707947 70548.489522108197 69623.238388035883 68697.987072961143 67772.732543598861 66836.054711127144 65888.009411983527 64939.963877419839 63991.917332178964 63036.421138702972 62073.514801366262 61110.609670102800 60147.702711313723 59181.340607476355 58211.541153979466 57241.739060418775 56271.938087565242 55302.633793376888 54333.823303874400 53365.013861638727 52396.202422026290 51431.718157902396 50471.534317270663 49511.348420669863 48551.162689262208 47598.948878500996 46654.654541536082 45710.360312248689 44766.064623266298 43833.130202898894 42911.477556534686 41989.823388544304 41068.168407958874 40160.934978665115 39268.016115241044 38375.095610550714 37482.174173856001 36606.337220921800 35747.450652293221 34888.563850332270 34029.675213663111 33190.062916682487 32369.567871444764 31549.071711911929 30728.574348812384 29929.010213556401 29150.196934015155 28371.382409028738 27592.565780920191 26835.727447806526 26100.665390410966 25365.602912741953 24630.538364150801 23917.818197454410 23227.224796452781 22536.629122186536 21846.032557344075 21177.395665714474 20530.490699450933 19883.583379735272 19236.674873815638 18612.637525167382 18011.220783623728 17409.801453025721 16808.380015662231 16230.473787639439 15675.810197889559 15121.145316503967 14566.478150597617 14035.687278534548 13528.478421530826 13021.267354874501 12514.054148585919 12030.781727016139 11571.138692580773 11111.493632374581 10651.845471701241 10215.904628868448 9803.3432554317933 9390.7789359057479 8978.2116944862901 8588.8205297391596 8222.2659146352471 7855.7089662730787 7489.1485229055543 7144.9510211733905 6822.7689664113650 6500.5840779611599 6178.3961047842695 5878.5584492383950 5600.7032772360744 5322.8450814523221 5044.9835826160561 4787.9178459611148 4551.2885867898312 4314.6567409529762 4078.0216284725943 3864.4146701317936 3673.4266646714882 3482.4364160815198 3291.4436300216498 3119.0376350979705 2964.8879085937292 2810.7363716235013 2656.5827088931687 2517.4307799086973 2393.0137925814051 2268.5952493988957 2144.1749904721460 2031.8629321861201 1931.4438187981291 1831.0235260039344 1730.6018484088102 1639.9528231265624 1558.9027151295527 1477.8516070847104 1396.7993822097123 1323.6349314129891 1258.2179338645228 1192.8001688292277 1127.3815489553963 1068.3292025965802 1015.5299521491312 962.73012970551576 909.92957827485770 862.26734945685223 819.65219021594248 777.03655370138131 734.42030587591660 695.95133690521709 661.55591783404475 627.16011885777164 592.76384512709353 561.71483169498038 533.95361930131696 506.19210450436935 478.43018279830864 453.24017484160646 430.57612264958931 407.91179464365570 385.24715322856230 364.49670466361215 345.62546364570323 326.75396585107057 307.88216404094453 290.49484582409787 274.56353553587149 258.63196497738312 242.70008286693746 227.97115360765849 214.42036091312897 200.86928175037249 187.31784844975076 174.79005025398769 163.26255271685605 151.73471526559587 140.20645398879947 129.59718269265977 119.88314368608759 110.16867086580203 100.45363256181662 91.609225483918294 83.609148927911122 75.608482672097111 67.607017023715485 60.467587328200629 54.158780166767826 47.849128533974820 41.538250134516808 36.097673294186322 31.487750245045444 26.876595109399126 22.263435738208226 7.3575889330654638 IDC FM: x%pres = 101269.98990353265 101209.97267505448 101149.95544596070 101089.93821687970 101015.12938281008 100925.53259288479 100835.93580323762 100746.33599402005 100636.04339782870 100505.07160558137 100374.10283008868 100243.13103695579 100086.70903526731 99904.853081330672 99722.997127224764 99541.141173047130 99330.148870686593 99090.040828766432 98849.932774732617 98609.824720094824 98337.893180934931 98034.164385431548 97730.432571705969 97426.703777785558 97089.396937581259 96718.544802241333 96347.689648060987 95976.834492134862 95571.501258413075 95131.738490810705 94691.975672050059 94252.212849572839 93777.869137745511 93268.999607292746 92760.127053780307 92251.257514941215 91708.423207504078 91131.684829152393 90554.943518229178 89978.205312443373 89368.771280972098 88726.709353372091 88084.644199100134 87442.582047308213 86769.674119169198 86065.996517636086 85362.321907146033 84658.647255498421 83926.486608580846 83165.922467036216 82405.355453029566 81644.791412851118 80858.549945760271 80046.710705614241 79234.871394866263 78423.032393486370 77588.694852915272 76731.938813643763 75875.182673570380 75018.426049928079 74142.652057063620 73247.937979377224 72353.223753471029 71458.506373707831 70548.489522108197 69623.238388035883 68697.987072961259 67772.732543598977 66836.054711127261 65888.009411983643 64939.963877419839 63991.917332179073 63036.421138702863 62073.514801366262 61110.609670102800 60147.702711313614 59181.340607476355 58211.541153979466 57241.739060418877 56271.938087565337 55302.633793376888 54333.823303874400 53365.013861638727 52396.202422026290 51431.718157902396 50471.534317270663 49511.348420669863 48551.162689262288 47598.948878500996 46654.654541536082 45710.360312248689 44766.064623266298 43833.130202898967 42911.477556534686 41989.823388544304 41068.168407958874 40160.934978665115 39268.016115241044 38375.095610550714 37482.174173856067 36606.337220921800 35747.450652293286 34888.563850332335 34029.675213663111 33190.062916682429 32369.567871444706 31549.071711911929 30728.574348812384 29929.010213556401 29150.196934015155 28371.382409028738 27592.565780920191 26835.727447806479 26100.665390410966 25365.602912741997 24630.538364150801 23917.818197454410 23227.224796452781 22536.629122186536 21846.032557344075 21177.395665714474 20530.490699450896 19883.583379735235 19236.674873815638 18612.637525167382 18011.220783623696 17409.801453025753 16808.380015662231 16230.473787639439 15675.810197889559 15121.145316503967 14566.478150597617 14035.687278534548 13528.478421530803 13021.267354874501 12514.054148585919 12030.781727016139 11571.138692580773 11111.493632374581 10651.845471701241 10215.904628868448 9803.3432554317933 9390.7789359057479 8978.2116944862901 8588.8205297391432 8222.2659146352325 7855.7089662730650 7489.1485229055406 7144.9510211733905 6822.7689664113650 6500.5840779611599 6178.3961047842804 5878.5584492383950 5600.7032772360744 5322.8450814523221 5044.9835826160470 4787.9178459611148 4551.2885867898312 4314.6567409529762 4078.0216284725943 3864.4146701317936 3673.4266646714882 3482.4364160815198 3291.4436300216557 3119.0376350979705 2964.8879085937292 2810.7363716235013 2656.5827088931687 2517.4307799086973 2393.0137925814051 2268.5952493988957 2144.1749904721460 2031.8629321861165 1931.4438187981291 1831.0235260039312 1730.6018484088102 1639.9528231265624 1558.9027151295527 1477.8516070847079 1396.7993822097123 1323.6349314129891 1258.2179338645251 1192.8001688292256 1127.3815489553942 1068.3292025965802 1015.5299521491321 962.73012970551667 909.92957827485850 862.26734945685223 819.65219021594248 777.03655370138131 734.42030587591717 695.95133690521777 661.55591783404532 627.16011885777164 592.76384512709399 561.71483169498083 533.95361930131651 506.19210450436890 478.43018279830909 453.24017484160646 430.57612264958931 407.91179464365570 385.24715322856230 364.49670466361215 345.62546364570323 326.75396585107057 307.88216404094453 290.49484582409764 274.56353553587149 258.63196497738312 242.70008286693727 227.97115360765849 214.42036091312897 200.86928175037249 187.31784844975076 174.79005025398769 163.26255271685605 151.73471526559587 140.20645398879947 129.59718269265989 119.88314368608759 110.16867086580203 100.45363256181662 91.609225483918294 83.609148927911122 75.608482672097111 67.607017023715485 60.467587328200629 54.158780166767826 47.849128533974820 41.538250134516808 36.097673294186322 31.487750245045444 26.876595109399126 22.263435738208226 7.3575889330654638
IDC = JKN pretty much exactly, at all heights, and each differs from Old by <~ 0.2%, except at the very top level, which (I think) will be dealt with in #553.
This difference is big enough to cause some failures in the core tests:
************************** SUMMARY OF ROPP_FM TEST RESULTS *************************** -------------------------------------------------------------------------------------- | Test name | Description | Run? | PASS? | -------------------------------------------------------------------------------------- | t_fascod_1 | FM FASCOD 1D | Run | *FAIL* | | t_fascod_tl_1 | FM_TL FASCOD 1D | Run | PASS | | t_fascod_ad_1 | FM_AD FASCOD 1D | Run | PASS | | t_fascod_2 | FM FASCOD 1D -comp | Run | *FAIL* | | t_fascod_tl_2 | FM_TL FASCOD 1D -comp | Run | PASS | | t_fascod_ad_2 | FM_AD FASCOD 1D -comp | Run | PASS | | t_fascod_3 | FM FASCOD 1D -new_op | Run | *FAIL* | | t_fascod_tl_3 | FM_TL FASCOD 1D -new_op | Run | PASS | | t_fascod_ad_3 | FM_AD FASCOD 1D -new_op | Run | PASS | | t_fascod_4 | FM FASCOD 1D -comp -new_op | Run | *FAIL* | | t_fascod_tl_4 | FM_TL FASCOD 1D -comp -new_op | Run | PASS | | t_fascod_ad_4 | FM_AD FASCOD 1D -comp -new_op | Run | PASS | | t_twodop_1 | FM TWOD | Run | PASS | | t_twodtl_1 | FM_TL TWOD | Run | PASS | | t_twodad_1 | FM_AD TWOD | Run | PASS | | t_twodop_2 | FM TWOD -comp | Run | PASS | | t_twodtl_2 | FM_TL TWOD -comp | Run | PASS | | t_twodad_2 | FM_AD TWOD -comp | Run | PASS | | t_iono_1 | FM L1 and L2 | Run | *FAIL* | | t_iono_tl_1 | FM_TL L1 and L2 | Run | PASS | | t_iono_ad_1 | FM_AD L1 and L2 | Run | PASS | | t_fm_1D_1 | FM 1D; default options | Run | *FAIL* | | t_fm_1D_2 | FM 1D; compress factors | Run | *FAIL* | | t_fm_2D_1 | FM 2D; default options | Run | PASS | | t_fm_2D_2 | FM 2D; compress factors | Run | PASS | | t_fm_iono_1 | FM iono; L_neutral | Run | *FAIL* | | t_fm_iono_2 | FM iono; L1 and L2 | Run | *FAIL* | --------------------------------------------------------------------------------------
so we will need to alter the reference files. This has been done at r6871. (The refrac and bangle diffs have a ze-z shape, the z part presumably coming from the steadily increasing difference in the pressure levels, and the e-z part presumably coming from the exponential decrease of the underlying field.)
Now for the Tangent linear. This involves replacing
x_tl%pres = bkk * psfc_tl
by
p_flv (n_flv) = EXP(-1.0_wp) * ( p_hlv (n_hlv-1) - p_hlv (n_hlv) ) p_flv_tl(n_flv) = EXP(-1.0_wp) * ( p_hlv_tl(n_hlv-1) - p_hlv_tl(n_hlv) ) DO lvl=n_flv-1,1,-1 p_flv(lvl) = EXP( ( (p_hlv(lvl ) * LOG(p_hlv(lvl )) - & p_hlv(lvl+1) * LOG(p_hlv(lvl+1))) / del_p(lvl) ) - 1.0_wp ) p_flv_tl(lvl) = (p_flv(lvl) / del_p(lvl) / del_p(lvl)) * & ( del_p(lvl)*del_p_tl(lvl) + & (p_hlv(lvl)*p_hlv_tl(lvl+1) - p_hlv(lvl+1)*p_hlv_tl(lvl)) * & LOG( p_hlv(lvl) / p_hlv(lvl+1) ) ) ENDDO x_tl%pres = p_flv_tl
(the TL of Eqn 3.18 of Simmons and Burridge), which is a cleaned up version of Joe's
p_flv(n_flv)=1.0_wp/exp(1.0_wp) * (p_hlv(n_hlv-1)-p_hlv(n_hlv)) ! Could be written as matrix equation: DO lvl=n_flv-1,1,-1 p_flv(lvl)=exp(1.0_wp/(p_hlv(lvl)-p_hlv(lvl+1)) & *(p_hlv(lvl)*log(p_hlv(lvl))-p_hlv(lvl+1)*log(p_hlv(lvl+1))) - 1.0_wp) ENDDO ! Should probably use p_hlv_tl and del_p_tl p_flv_tl = p_flv/(del_p*del_p)* & (p_hlv(1:n_hlv-1)*log(p_hlv(1:n_hlv-1)/p_hlv(2:n_hlv))*x%bk(2:n_hlv) & + p_hlv(2:n_hlv)* log(p_hlv(2:n_hlv)/p_hlv(1:n_hlv-1))*x%bk(1:n_hlv-1) & - del_p*x%bk(2:n_hlv) + del_p*x%bk(1:n_hlv-1)) !Only return p_flv_tl if psfc_tl different from zero: x_tl%pres=p_flv_tl*psfc_tl
in ropp_fm_state2state_ecmwf_tl.f90.
This seems to check out OK. The fascod TL tests all pass, and the differences between the old formulation and (either of) the new steadily increases with height up to a max frac diff of ~0.1% (1% at the last non-zero one, but see #553), while the difference between the two new ones decreases with height, reaching a max frac diff of ~1e-10 at the bottom (both give delta_pk = 0 at the top, where the Bk are zero and we have fixed, p*-independent levels, and increase downwards as the influence of delta_p* increases through the Bkk):
Old TL: x_tl%pres = 0.83331093069651374 0.83281707253040271 0.83232321436429169 0.83182935619818066 0.83120622047188641 0.83045380718540895 0.82970139389893149 0.82894895577049399 0.82797366041830489 0.82677555752628429 0.82557747947622373 0.82437937658420313 0.82288346827491199 0.82108977939031025 0.81929609050570851 0.81750240162110688 0.81535339818168184 0.81284908018743363 0.81034476219318541 0.80784044419893719 0.80493954915419619 0.80164205221700224 0.79834453043784837 0.79504703350065442 0.79132680092901830 0.78718378303901981 0.78304074030706128 0.77889769757510274 0.77431962243846930 0.76930651489716106 0.76429340735585272 0.75928029981454437 0.75383265670776245 0.74795045319354703 0.74206822483737145 0.73618602132315591 0.72988133059409888 0.72315410296628002 0.71642685049650112 0.70969962286868238 0.70257236515792165 0.69504502768029874 0.68751766536071579 0.67999032788309299 0.67209463382161228 0.66383055833431359 0.65556650768897495 0.64730245704363631 0.63870977210858537 0.62978845288382190 0.62086710881709839 0.61194578959233492 0.60274248927886287 0.59325718303472219 0.58377187679058151 0.57428657054644083 0.56457162522345050 0.55462704082161063 0.54468245641977064 0.53473787201793077 0.52462053662579222 0.51433047508531515 0.50404041354483808 0.49375032716240091 0.48334778122674527 0.47283277573787102 0.46231777024899678 0.45180273991816250 0.44123770272171547 0.43062268350161570 0.42000766428151598 0.40939264506141626 0.39879113986759240 0.38820316112102443 0.37761519479543654 0.36702721604886857 0.35651611074772471 0.34608187889200492 0.33564763461530511 0.32521340275958527 0.31491812440749439 0.30476179955903232 0.29460548713155033 0.28444916228308831 0.27449136195849327 0.26473208615776528 0.25497279793605726 0.24521352213532929 0.23570870253155682 0.22645832670375982 0.21720795087596279 0.20795757504816578 0.19901276153966996 0.19037351035047531 0.18173425916128064 0.17309500797208599 0.16480643831216230 0.15686855018150955 0.14893066205085681 0.14099277392020407 0.13344351341282301 0.12628288052871367 0.11912224764460430 0.11196161476049493 0.10521921490556586 9.8895048079817069E-002 9.2570881254068274E-002 8.6246714428319493E-002 8.0360890198424365E-002 7.4913408564382916E-002 6.9465926930341468E-002 6.4018445296300019E-002 5.9018733781957267E-002 5.4466792387313209E-002 4.9914852545291655E-002 4.5362914255892603E-002 4.1256322442463321E-002 3.7595077105003795E-002 3.3933831767544276E-002 3.0272586430084753E-002 2.7041243632546494E-002 2.4239804151240753E-002 2.1438365446246263E-002 1.8636925964940522E-002 1.6242712195572093E-002 1.4255725690763481E-002 1.2268739574110496E-002 1.0281753069301885E-002 8.6566529822208506E-003 7.3934393128673925E-003 6.1302256435139344E-003 4.8670119741604755E-003 3.8951091021428613E-003 3.2145172215389040E-003 2.5339254379738532E-003 1.8533335573698957E-003 1.3719828329575208E-003 1.0898732647367283E-003 8.0776369651593594E-004 5.2565412829514357E-004 3.4442483660510769E-004 2.6407582144582825E-004 1.8372680628654886E-004 1.0337778506233781E-004 5.5302862490545638E-005 3.9502044636104026E-005 2.3701226781662414E-005 7.9004089272208059E-006 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 JKN TL: x_tl%pres = 0.83331091838649662 0.83281706020108148 0.83232320208912414 0.83182934382726970 0.83120619207351298 0.83045377884395710 0.82970136549605278 0.82894892723150637 0.82797358891570805 0.82677548587857508 0.82557740780293798 0.82437930480097177 0.82288330987347880 0.82108962067270985 0.81929593144701873 0.81750224222481682 0.81535309224090158 0.81284877335327876 0.81034445448722747 0.80784013561625967 0.80493902037391285 0.80164152145564294 0.79834399770808784 0.79504649879895883 0.79132596325085336 0.78718294143207757 0.78303989476914371 0.77889684806911097 0.77431838326359581 0.76930526870291083 0.76429215407293749 0.75927903935429242 0.75383092168240295 0.74794870645027944 0.74206646625414274 0.73618425077269622 0.72987900784418713 0.72315176191024122 0.71642449089592686 0.70969724447559357 0.70256936954020144 0.69504200493278845 0.68751461504660727 0.67998724956621603 0.67209089061945237 0.66382677669108625 0.65556268688956965 0.64729859620127794 0.63870522041652755 0.62978384859128567 0.62086245080577529 0.61194107671016917 0.60273708470770326 0.59325170893386958 0.58376633142999090 0.57428095213615293 0.56456534259039970 0.55462066876737515 0.54467599247861420 0.53473131363336524 0.52461337184968870 0.51432319825580386 0.50403302111525750 0.49374281567044032 0.48333975316984007 0.47282461026197342 0.46230946281384577 0.45179428567231644 0.44122885425392339 0.43061367013378549 0.41999848008492752 0.40938328378558098 0.39878153900623947 0.38819336629211820 0.37760519839239737 0.36701701002762593 0.35650585092636000 0.34607139496724387 0.33563691722781003 0.32520244196173154 0.31490732434467339 0.30475074551424264 0.29459416755109252 0.28443756484231641 0.27448016502584993 0.26472060624672017 0.25496102136984006 0.24520143424781493 0.23569727484153297 0.22644658963829770 0.21719588834656328 0.20794516973406160 0.19900128974128792 0.19036170650903741 0.18172210487104104 0.17308248330998699 0.16479512538958899 0.15685688792341312 0.14891862979917997 0.14098034926521383 0.13343257338502235 0.12627158071983685 0.11911056543414278 0.11194952543364306 0.10520886562758786 9.8884336780332080E-002 9.2559783781342234E-002 8.6235204258128417E-002 8.0351344451644366E-002 7.4903507949050901E-002 6.9455646298907769E-002 6.4007756928450746E-002 5.9010188344014280E-002 5.4457909273535728E-002 4.9905606393431216E-002 4.5353276873998483E-002 4.1248945938482245E-002 3.7587390265295423E-002 3.3925809836204218E-002 3.0264201742431041E-002 2.7035163543821895E-002 2.4233450731202852E-002 2.1431715421803579E-002 1.8629953143253209E-002 1.6238068331701837E-002 1.4250858818937043E-002 1.2263629407551133E-002 1.0276376650671071E-002 8.6534766780641571E-003 7.3901001459542887E-003 6.1267078165190688E-003 4.8632974376038429E-003 3.8932714293623319E-003 3.2125790173990927E-003 2.5318763178913311E-003 1.8511615325583427E-003 1.3711680640081415E-003 1.0890110236505654E-003 8.0684875202410779E-004 5.2468039562429431E-004 3.4417782844981497E-004 2.6381351265762951E-004 1.8344740266072642E-004 1.0307917955414418E-004 5.5250861334538925E-005 3.9446611729481010E-005 2.3641932901019560E-005 7.8367450148164837E-006 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 IDC TL: x_tl%pres = 0.83331091849836036 0.83281706032959824 0.83232320215523026 0.83182934398132058 0.83120619210455959 0.83045377879172988 0.82970136548061846 0.82894892732309244 0.82797358890917949 0.82677548592244177 0.82557740776792343 0.82437930476952848 0.82288330987876324 0.82108962066480362 0.81929593144885526 0.81750224223173340 0.81535309222450636 0.81284877335859396 0.81034445448872461 0.80784013561116252 0.80493902038522935 0.80164152146845780 0.79834399771200892 0.79504649880045242 0.79132596324660143 0.78718294143682166 0.78303989477106883 0.77889684806963244 0.77431838326895275 0.76930526870748350 0.76429215406969364 0.75927903935306362 0.75383092168438348 0.74794870644909717 0.74206646625171779 0.73618425077278371 0.72987900784220650 0.72315176191007435 0.71642449089526661 0.70969724447687066 0.70256936954172200 0.69504200493211843 0.68751461504839928 0.67998724956746182 0.67209089061830685 0.66382677668984091 0.65556268689013242 0.64729859620197683 0.63870522041709554 0.62978384859213654 0.62086245080677671 0.61194107671002351 0.60273708470838550 0.59325170893390511 0.58376633142979917 0.57428095213592656 0.56456534259073077 0.55462066876759253 0.54467599247859944 0.53473131363340420 0.52461337185009482 0.51432319825564521 0.50403302111524340 0.49374281567031497 0.48333975316992406 0.47282461026205092 0.46230946281351659 0.45179428567231356 0.44122885425416958 0.43061367013373714 0.41999848008506058 0.40938328378555527 0.39878153900605318 0.38819336629211781 0.37760519839244050 0.36701701002770287 0.35650585092640635 0.34607139496707101 0.33563691722776851 0.32520244196177550 0.31490732434470781 0.30475074551421172 0.29459416755114842 0.28443756484234223 0.27448016502579198 0.26472060624670662 0.25496102136981957 0.24520143424782051 0.23569727484158653 0.22644658963834297 0.21719588834654649 0.20794516973411808 0.19900128974128148 0.19036170650905485 0.18172210487108417 0.17308248330999612 0.16479512538958718 0.15685688792340124 0.14891862979919132 0.14098034926519878 0.13343257338501593 0.12627158071984423 0.11911056543413306 0.11194952543363923 0.10520886562757560 9.8884336780337534E-002 9.2559783781356264E-002 8.6235204258126391E-002 8.0351344451637524E-002 7.4903507949053663E-002 6.9455646298910517E-002 6.4007756928455881E-002 5.9010188344013489E-002 5.4457909273533833E-002 4.9905606393430904E-002 4.5353276873996380E-002 4.1248945938486936E-002 3.7587390265290975E-002 3.3925809836203184E-002 3.0264201742428814E-002 2.7035163543821027E-002 2.4233450731201176E-002 2.1431715421805084E-002 1.8629953143254861E-002 1.6238068331701643E-002 1.4250858818935640E-002 1.2263629407550802E-002 1.0276376650671999E-002 8.6534766780647174E-003 7.3901001459548560E-003 6.1267078165191365E-003 4.8632974376038212E-003 3.8932714293625223E-003 3.2125790173989093E-003 2.5318763178913311E-003 1.8511615325582625E-003 1.3711680640081619E-003 1.0890110236506073E-003 8.0684875202413587E-004 5.2468039562424465E-004 3.4417782844980483E-004 2.6381351265762756E-004 1.8344740266071743E-004 1.0307917955413555E-004 5.5250861334534053E-005 3.9446611729480481E-005 2.3641932901020912E-005 7.8367450148166819E-006 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
Interestingly, the adjoint tests still pass (they shouldn't, because the AD hasn't been updated yet), e.g:
Checking REFRACTIVITY AD FASCOD_MLS norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3428743591E+08 3.3428743592E+08 9.9999999999E-01 -7.6811396912E-12 Checking BENDING ANGLE AD FASCOD_MLS norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3128553590E+00 3.3128553590E+00 9.9999999999E-01 -7.1754437332E-12
I think this is just because the tolerance for passing the test is too loose at 1e-9. Before these updates, the same AD test returned (see #661):
AD: x%non_ideal, x%new_ref_op, x%new_bangle_op = T T T ... Checking REFRACTIVITY AD FASCOD_MLS norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3429767302E+08 3.3429767302E+08 1.0000000000E+00 -3.5659622897E-16 Checking BENDING ANGLE AD FASCOD_MLS norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3204994934E+00 3.3204994934E+00 1.0000000000E+00 1.0552219245E-13
(The bangle frac diff of 10-13 was too large then anyway, but it is now 70 times bigger. For refrac, it's 20,000 times bigger now.)
Now for the adjoint. This involves the replacement of
bkk = 0.5_wp * ( x%bk(2:n_hlv) + x%bk(1:n_hlv-1) ) ! 6.8 Adjoint of calculating pressure levels psfc_ad = psfc_ad + SUM(x_ad%pres*bkk) x_ad%pres = 0.0_wp ! 6.9 Adjoint of calculating half pressure levels psfc_ad = psfc_ad + SUM(p_hlv_ad*x%bk) p_hlv_ad = 0.0_wp
by
! 6.7 Adjoint of pressures on full levels calculation DO lvl=1,n_flv-1 p_term = (p_flv(lvl)/del_p(lvl)/del_p(lvl)) * LOG( p_hlv(lvl) / p_hlv(lvl+1) ) ! See TL code del_p_ad(lvl) = del_p_ad(lvl) + (p_flv(lvl) / del_p(lvl)) * x_ad%pres(lvl) p_hlv_ad(lvl) = p_hlv_ad(lvl) - p_term * p_hlv(lvl+1) * x_ad%pres(lvl) p_hlv_ad(lvl+1) = p_hlv_ad(lvl+1) + p_term * p_hlv(lvl) * x_ad%pres(lvl) ENDDO p_hlv_ad(n_hlv-1) = p_hlv_ad(n_hlv-1) + EXP(-1.0_wp) * x_ad%pres(n_flv) p_hlv_ad(n_hlv) = p_hlv_ad(n_hlv ) - EXP(-1.0_wp) * x_ad%pres(n_flv) x_ad%pres = 0.0_wp ! 6.8 Adjoint of pressure differences p_hlv_ad(1:n_hlv-1) = p_hlv_ad(1:n_hlv-1) + del_p_ad p_hlv_ad(2:n_hlv) = p_hlv_ad(2:n_hlv) - del_p_ad del_p_ad = 0.0_wp ! 6.9 Adjoint of calculating half pressure levels psfc_ad = psfc_ad + SUM(p_hlv_ad*x%bk) p_hlv_ad = 0.0_wp
(the adjoint of Eqn 3.18 of Simmons and Burridge), which is a cleaned up version of Joe's
! 6.7 Adjoint of pressures on full levels calculation do lvl=1,n_flv-1 p_flv_jkn = exp( ( p_hlv(lvl )*log(p_hlv(lvl )) & - p_hlv(lvl+1)*log(p_hlv(lvl+1)) )/del_p(lvl) - 1.0_wp) c = log(p_hlv(lvl )) + 1.0_wp d = log(p_hlv(lvl+1)) + 1.0_wp e = (p_hlv(lvl)*log(p_hlv(lvl)) - p_hlv(lvl+1)*log(p_hlv(lvl+1))) / del_p(lvl) f = p_flv_jkn/del_p(lvl) a(lvl) = (c-e)*f b(lvl) = (d-e)*f enddo ! a(n_flv) = 0.5_wp a(n_flv) = exp(-1.0_wp) p_hlv_ad(1) = p_hlv_ad(1) + a(1)*x_ad%pres(1) p_hlv_ad(2:n_flv) = p_hlv_ad(2:n_flv) + a(2:n_flv )*x_ad%pres(2:n_flv ) & - b(1:n_flv-1)*x_ad%pres(1:n_flv-1) ! p_hlv_ad(n_hlv) = p_hlv_ad(n_hlv) - 0.5_wp*x_ad%pres(n_flv) p_hlv_ad(n_hlv) = p_hlv_ad(n_hlv) - exp(-1.0_wp)*x_ad%pres(n_flv) ! 6.8 Adjoint of pressure differences p_hlv_ad(1:n_hlv-1) = p_hlv_ad(1:n_hlv-1) + del_p_ad p_hlv_ad(2:n_hlv) = p_hlv_ad(2:n_hlv) - del_p_ad del_p_ad = 0.0_wp ! 6.9 Adjoint of calculating half pressure levels psfc_ad = psfc_ad + SUM(p_hlv_ad*x%bk) p_hlv_ad = 0.0_wp
(lifted from https://trac.romsaf.org/ropp/browser/ropp_src/branches/dev/Share/jkn_dmi_trunk_9.0.2/ropp_fm/tests/t_fascod_ecmwf_ad.f90, but with S&B's C set equal to 1 at the top (see #553).)
(The + 1.0_wp
in Joe's c
and d
have the same
effect as the del_p_ad(lvl) = del_p_ad(lvl) + ...
line
in mine.)
The new formulations agree very closely (frac diffs in
p_hlv_ad
< 10-8 almost everywhere, those in
psfc_ad
are < 10-11), e.g:
JKN AD: p_hlv_ad = -4.6552073964311229E-006 4.1692088715809380E-010 4.1745913361580392E-010 4.1768439077718660E-010 5.2088697734427444E-010 6.2530904951259395E-010 6.2576901234696765E-010 6.2721541134860803E-010 7.7252116080064169E-010 9.1981139597553810E-010 9.2174337239498388E-010 9.2370946001557848E-010 1.1054663403857782E-009 1.2886504666601442E-009 1.2929624257891564E-009 1.2968137390579324E-009 1.5092410723725129E-009 -6.5843633161971439E-007 -4.3000016164808710E-007 3.6087022389091634E-007 1.9290546254818871E-007 9.7198974337748016E-008 5.9953103041226878E-008 4.1735750096822050E-008 3.3124354458111615E-008 1.0598945325635715E-005 4.4127161180108898E-006 -7.2034968689130979E-006 -1.5999364414553269E-006 -9.0369854921902668E-007 2.9953036971600792E-006 2.0211107203266243E-006 -2.2205813843428381E-006 -1.3315330034246314E-006 -1.4815356057421665E-006 -2.1528746791605376E-006 -5.2459333141482642E-007 6.4347212561034935E-007 1.3408806697838809E-006 1.1518418451220581E-006 -6.5006608445732593E-007 -7.4519348208118043E-007 -1.6345528479131245E-006 -7.5674775720530746E-007 7.0846437226826636E-007 2.7927006355943514E-007 8.3524153265691339E-008 -4.4749762113349928E-007 -6.3947422777974484E-007 -1.3462612842411476E-007 -6.9020340275473095E-007 -6.1170825485740241E-007 3.4431009481467609E-007 7.6139920452845803E-009 2.2575502081249128E-007 1.1532021143066489E-006 5.4252892723043351E-007 -1.7634023590559073E-007 4.3777423452924036E-008 -2.4342733128640917E-007 -1.5428257483794433E-007 5.8810140250608369E-008 5.3661208739949249E-008 -4.1102842775282071E-007 -3.1682487902401531E-007 1.3891744880257498E-007 8.7860840572383226E-008 -7.9782084499477839E-008 -4.3563291455823820E-008 4.6029513079133924E-008 2.9658089855766722E-008 3.8970093880105988E-008 1.6565795570862608E-008 -9.9249688496244918E-009 -5.2091459323200175E-008 -2.5569930931672920E-008 6.5519737247529675E-009 -3.4456879799960163E-009 2.7201518224638358E-009 4.2889127090052406E-009 5.6106029975327878E-008 3.2014844276187721E-009 -9.3389667646932135E-008 -5.6264278695106586E-008 -4.2467393673091981E-009 2.8638971447371512E-008 -1.1128823801274361E-008 -5.7180780794329085E-008 2.4236495071808543E-008 1.2074469736360859E-007 6.1849403428085098E-008 4.6914316310345434E-009 -1.8742338263050042E-007 -6.0864510147655556E-008 1.8667927100629274E-007 5.8514692841073104E-008 -6.3183412776876652E-009 -1.1006038670573355E-007 -1.5177325801232788E-007 1.7960637716129846E-008 1.1268531262779443E-007 2.9803052965958672E-008 -3.1145681495143711E-010 4.6024471359844587E-008 7.2175587985552885E-008 -9.4103684876379991E-008 -1.5784231271171833E-007 9.7633167680470968E-008 8.3723410058783815E-008 -1.3012011882851274E-007 -3.4470237249976975E-008 1.3058566902105265E-007 1.0628669069512515E-007 6.5859245613378005E-008 -1.2115277199611465E-008 -8.5138550831318489E-008 -6.7394116289946814E-008 -5.4466068065080309E-008 -1.7130207092358148E-008 4.4873612246575715E-008 4.5200126654789332E-008 2.9311664815049662E-009 -3.1340215528071998E-008 3.5055496659273077E-008 1.0057914494372015E-007 1.8576781043796336E-008 -2.5699806468433740E-008 -1.0742781205564552E-009 -8.4454425539130492E-011 -1.2966738184451551E-009 -4.8004733107762413E-010 8.7609257627034595E-011 1.8914167600080680E-010 7.4633549638830274E-011 4.4653604783477117E-010 2.9109797006619700E-010 -1.7210093543653380E-010 -4.2341229613017178E-011 2.6106362738769059E-010 2.5711764512062257E-010 -4.2996717507747233E-011 5.0181893240948926E-010 -2.3423084974164067E-010 -3.2414879646143176E-009 -8.1383707795947601E-009 -6.0189945444521326E-009 2.8169816998190200E-010 6.8752454835520272E-009 2.3197990451937563E-009 -6.4548770336995940E-009 7.3303493708443606E-010 2.2813399947967112E-009 -5.6708274642941810E-009 -4.5447780540027252E-009 2.4883613160032183E-009 1.5702189312905738E-009 1.9223495755225225E-009 2.1704401546344211E-009 -3.9931358807679019E-009 -2.7261649895797316E-009 1.1286357947899494E-009 2.8114237363883920E-010 2.8389757284130026E-009 1.6295859433212957E-009 -1.7112220424957150E-009 -6.6445486536619883E-010 1.4006897217667375E-009 2.0068645172220964E-009 -1.3982994660657672E-009 -1.8198549641212221E-009 1.1129138002747369E-009 -1.6737863794979815E-009 -5.1404600699665951E-010 3.4565663492039866E-009 6.8302466680094712E-010 -1.4001191401759664E-009 -1.8530491917923228E-009 -1.2915106312077928E-009 1.2189946199463892E-009 1.6052108055194002E-009 -2.8413591374210677E-010 3.4942635532115173E-010 3.8600831787102069E-010 -1.3322230582348153E-009 -2.4141460721600449E-010 1.6191962127243630E-009 6.8246537491305980E-010 -5.6557394683962635E-010 -7.3244860698012416E-010 5.5265045783476720E-010 1.3722183288809407E-009 2.7412721608448782E-010 -9.8411343383816933E-010 -1.4580394306335569E-010 3.0143972498121851E-010 -1.9592701187252420E-010 -1.9341369232132704E-010 -4.4140308976388549E-011 2.3714707781933350E-010 -4.6041271716194268E-011 1.0727990628737051E-010 4.9831275483934258E-010 -1.3282019380968886E-010 6.0851034318709657E-011 4.7830227746964635E-010 -4.9314106337869612E-011 -1.2409672400975542E-010 -1.9934857732278654E-011 4.1263510228948334E-011 1.2968593031801502E-010 -4.9486535662152263E-011 -5.5059876513262385E-011 1.4684857901780538E-010 6.7128952755587220E-011 -1.1435288089019413E-010 -1.0690680379751238E-010 -4.5139227732877226E-012 1.6619938098215521E-010 1.2992659740184052E-011 -2.4732245508559893E-011 1.2061284056909354E-011 3.4091358272680300E-011 7.1450494879971160E-012 -7.2677838347705998E-012 2.7444679450569084E-012 1.6893688721399246E-011 -2.0532668067925533E-011 -4.3338975704780279E-011 -3.5133612908387935E-011 -1.1627963871127410E-011 1.6493801283443702E-011 3.9101777461506020E-011 1.3288055506460131E-011 -2.9936290876467981E-011 -1.2346845772140191E-011 3.3200713365807495E-010 5.8364333930492676E-009 1.5192876122101119E-008 IDC AD: p_hlv_ad = -4.6552073964311297E-006 4.1692088716793157E-010 4.1745913361394297E-010 4.1768439077607705E-010 5.2088697734368404E-010 6.2530904951105012E-010 6.2576901234908286E-010 6.2721541135011991E-010 7.7252116079835950E-010 9.1981139597786693E-010 9.2174337238926372E-010 9.2370946001973858E-010 1.1054663403861802E-009 1.2886504666605932E-009 1.2929624257881356E-009 1.2968137390572667E-009 1.5092410723720765E-009 -6.5843633191555822E-007 -4.3000016181678896E-007 3.6087022461071816E-007 1.9290546227610818E-007 9.7198974336067502E-008 5.9953103059590552E-008 4.1735750100393141E-008 3.3124354459175488E-008 1.0598945323158744E-005 4.4127161209217558E-006 -7.2034968691889190E-006 -1.5999364414188977E-006 -9.0369854958624596E-007 2.9953036977081434E-006 2.0211107196552863E-006 -2.2205813837087966E-006 -1.3315330038231842E-006 -1.4815356055156766E-006 -2.1528746797310448E-006 -5.2459333105443762E-007 6.4347212563528600E-007 1.3408806700357682E-006 1.1518418448945925E-006 -6.5006608457730646E-007 -7.4519348195855716E-007 -1.6345528480697646E-006 -7.5674775722091997E-007 7.0846437243447455E-007 2.7927006353216746E-007 8.3524153291739296E-008 -4.4749762115748725E-007 -6.3947422776489127E-007 -1.3462612842975261E-007 -6.9020340272502381E-007 -6.1170825486271500E-007 3.4431009479207048E-007 7.6139920616221518E-009 2.2575502080544397E-007 1.1532021142944787E-006 5.4252892722414514E-007 -1.7634023588146723E-007 4.3777423442434380E-008 -2.4342733127562135E-007 -1.5428257485168659E-007 5.8810140246742511E-008 5.3661208745356707E-008 -4.1102842774132139E-007 -3.1682487903030368E-007 1.3891744879559543E-007 8.7860840572532304E-008 -7.9782084505911901E-008 -4.3563291446445471E-008 4.6029513077087492E-008 2.9658089862357486E-008 3.8970093873397487E-008 1.6565795568614582E-008 -9.9249688489773586E-009 -5.2091459320388026E-008 -2.5569930932892648E-008 6.5519737257965121E-009 -3.4456879784594985E-009 2.7201518206545735E-009 4.2889127089239254E-009 5.6106029975449851E-008 3.2014844269004882E-009 -9.3389667644072551E-008 -5.6264278700419177E-008 -4.2467393656828948E-009 2.8638971448994427E-008 -1.1128823800702614E-008 -5.7180780797208997E-008 2.4236495071490059E-008 1.2074469736642751E-007 6.1849403427326156E-008 4.6914316308803834E-009 -1.8742338261839801E-007 -6.0864510153266303E-008 1.8667927099985529E-007 5.8514692840815606E-008 -6.3183412772463611E-009 -1.1006038670486703E-007 -1.5177325801522812E-007 1.7960637718606571E-008 1.1268531262662214E-007 2.9803052966514325E-008 -3.1145681470664459E-010 4.6024471357919281E-008 7.2175587987578988E-008 -9.4103684874836697E-008 -1.5784231271395450E-007 9.7633167682607185E-008 8.3723410056717055E-008 -1.3012011882637144E-007 -3.4470237250837561E-008 1.3058566902039535E-007 1.0628669069347174E-007 6.5859245614746810E-008 -1.2115277200568613E-008 -8.5138550830364730E-008 -6.7394116289962061E-008 -5.4466068065441145E-008 -1.7130207092263281E-008 4.4873612246853966E-008 4.5200126654242149E-008 2.9311664817112187E-009 -3.1340215528351942E-008 3.5055496659943080E-008 1.0057914494267153E-007 1.8576781043860711E-008 -2.5699806467901804E-008 -1.0742781209503255E-009 -8.4454425833897957E-011 -1.2966738175947340E-009 -4.8004733114369270E-010 8.7609257760230526E-011 1.8914167526812330E-010 7.4633550133497515E-011 4.4653604770432810E-010 2.9109797021188667E-010 -1.7210093531625512E-010 -4.2341229734989922E-011 2.6106362701160796E-010 2.5711764535779180E-010 -4.2996717260413613E-011 5.0181893226888179E-010 -2.3423084967176045E-010 -3.2414879647515369E-009 -8.1383707793177804E-009 -6.0189945445978223E-009 2.8169816998661362E-010 6.8752454834954878E-009 2.3197990450955005E-009 -6.4548770334497193E-009 7.3303493706326024E-010 2.2813399947268310E-009 -5.6708274643099570E-009 -4.5447780539857846E-009 2.4883613159576903E-009 1.5702189313248786E-009 1.9223495755250107E-009 2.1704401546259508E-009 -3.9931358807795486E-009 -2.7261649895695672E-009 1.1286357947876201E-009 2.8114237364064577E-010 2.8389757283791212E-009 1.6295859433644943E-009 -1.7112220425235612E-009 -6.6445486535201103E-010 1.4006897217757901E-009 2.0068645172161672E-009 -1.3982994660650261E-009 -1.8198549641207986E-009 1.1129138002782309E-009 -1.6737863794969227E-009 -5.1404600701571775E-010 3.4565663492166921E-009 6.8302466679967658E-010 -1.4001191401807839E-009 -1.8530491917961874E-009 -1.2915106312047223E-009 1.2189946199400365E-009 1.6052108055280823E-009 -2.8413591374186523E-010 3.4942635531473943E-010 3.8600831787620877E-010 -1.3322230582336110E-009 -2.4141460721388691E-010 1.6191962127194926E-009 6.8246537491560090E-010 -5.6557394684042045E-010 -7.3244860697906537E-010 5.5265045784102069E-010 1.3722183288712528E-009 2.7412721608771714E-010 -9.8411343383253127E-010 -1.4580394306343510E-010 3.0143972497650689E-010 -1.9592701187285135E-010 -1.9341369232103256E-010 -4.4140308975970409E-011 2.3714707781753356E-010 -4.6041271715506054E-011 1.0727990628694699E-010 4.9831275484087783E-010 -1.3282019381156821E-010 6.0851034314818599E-011 4.7830227747496678E-010 -4.9314106337578445E-011 -1.2409672400875618E-010 -1.9934857733456559E-011 4.1263510229454569E-011 1.2968593031702241E-010 -4.9486535661298612E-011 -5.5059876513695828E-011 1.4684857901773258E-010 6.7128952755798979E-011 -1.1435288089079135E-010 -1.0690680379684401E-010 -4.5139227736864237E-012 1.6619938098259196E-010 1.2992659739998764E-011 -2.4732245508621105E-011 1.2061284057048320E-011 3.4091358273150138E-011 7.1450494871236133E-012 -7.2677838343669356E-012 2.7444679452918276E-012 1.6893688720982347E-011 -2.0532668067783258E-011 -4.3338975704707487E-011 -3.5133612908718807E-011 -1.1627963870829625E-011 1.6493801283327897E-011 3.9101777461631752E-011 1.3288055506274842E-011 -2.9936290876395190E-011 -1.2346845772136883E-011 3.3200713365809150E-010 5.8364333930492684E-009 1.5192876122101119E-008 JKN AD: psfc_ad = -2.6720642631729970E-006 IDC AD: psfc_ad = -2.6720642631882432E-006
and
Note that the new p_hlv_ad
s disagree with the old
formulation, but this is to be
expected since in the old code only about half (roughly
speaking) of the contribution to psfc_ad
is produced by
p_hlv_ad
- the rest is generated by x_ad%pres
(see
above). In the new code, p
k
is given by a
complicated expression involving
p
k-1/2
and p
k+1/2
, and this
gives rise to different p_hlv_ad
s. The key thing is that
psfc_ad
is about the same as the later versions, and it is:
Old AD: p_hlv_ad = -4.6552079466085861E-006 4.1582001738869814E-010 4.1635740812441929E-010 4.1651377266617329E-010 5.1951126114509924E-010 6.2372761767383527E-010 6.2411756103847532E-010 6.2546631836819832E-010 7.7048283073522253E-010 9.1748259079089104E-010 9.1931465520445129E-010 9.2115791012616567E-010 1.1025542982852370E-009 1.2853756469937664E-009 1.2895605991822906E-009 1.2932662723793478E-009 1.5052726875529077E-009 -2.1785356480507421E-006 -1.4263065270503882E-006 1.1889438268494149E-006 6.3470529632948542E-007 3.1799618027160480E-007 1.9480800167551464E-007 1.3450596487204602E-007 1.0538807857579863E-007 3.6679441774449575E-005 1.5403133806404096E-005 -2.4896740016247879E-005 -5.5737059716206086E-006 -3.1680911008623216E-006 1.0865425968382839E-005 7.3412947906581483E-006 -8.0328006852609796E-006 -4.8368706705072956E-006 -5.5071812571609461E-006 -7.9662373408224355E-006 -1.8287967863657786E-006 2.4718317115659215E-006 5.0735185205883881E-006 4.5339441986397711E-006 -2.1319758634581130E-006 -2.6189796622137860E-006 -6.0159723100158965E-006 -2.8130082370628889E-006 2.6465472116875581E-006 1.1118109608136218E-006 3.5512715392181063E-007 -1.7900852074288895E-006 -2.5379933431354416E-006 -4.5208759986818409E-007 -3.0947659798775430E-006 -2.7112933078931320E-006 1.5520513221131053E-006 -3.6160094035196303E-007 4.4312385738087649E-007 4.7795209898956234E-006 2.3151666840492881E-006 -6.5898146036247763E-007 2.4247138640575501E-007 -1.1675412810738879E-006 -7.5139466551375062E-007 3.8406401744204836E-007 3.4224818907803130E-007 -2.8442787619216696E-006 -2.1659137339261319E-006 1.1676027778636313E-006 7.7207055286026497E-007 -9.1096088943216314E-007 -5.1763895038650534E-007 5.7951682749712223E-007 5.7537190965603494E-007 6.6689107982013018E-007 2.8038613116528289E-007 -1.1643595671724616E-007 -6.7326918692065007E-007 -2.6987132789571999E-007 1.8461807414111825E-007 -4.1438952501748426E-007 -1.0928268812809781E-006 -2.9137836168608572E-007 -3.8842434269956616E-007 1.5945924251418466E-007 1.2165930748860189E-006 6.7944123760005105E-007 6.9939661490201410E-008 -3.0059412178508126E-007 9.1591491847389386E-008 6.3364153300785449E-007 -3.2430154876964348E-008 -8.9830437643269252E-007 -4.2779235130561483E-007 -2.3886565777377369E-008 1.2137677286221592E-006 3.2924460259710483E-007 -1.2139582496783677E-006 -3.6702577535331952E-007 5.0465461473448801E-008 6.5870048394929809E-007 8.5542250587405510E-007 -1.3749923571432473E-007 -6.3890840422195093E-007 -1.6673386935669020E-007 -2.8777080876421092E-009 -2.3837583385195253E-007 -3.5559545567757782E-007 5.1681259996645648E-007 7.9634138104012604E-007 -5.2253175567001552E-007 -4.2063473553044522E-007 6.3342607018012289E-007 1.2463094216780935E-007 -6.7724019464274719E-007 -5.2562516402830520E-007 -2.9895059951367049E-007 8.1365731793777517E-008 4.0827188473161883E-007 3.1472300308477555E-007 2.4795538961558274E-007 6.9160623015797272E-008 -2.0493870314509954E-007 -1.9541404640851657E-007 -7.4225087766229514E-009 1.3867668753396223E-007 -1.5268774184068077E-007 -4.1348891300271162E-007 1.5808547497268843E-007 3.8901041554484652E-007 -1.1535800767003908E-007 8.1252193030345886E-008 4.2074517691087851E-007 1.7005718149515161E-007 -5.0112376593555750E-008 -3.1205168140743333E-007 -1.8765462689669646E-007 -3.6898376388767259E-007 -1.7962657504608907E-007 4.5240373579971917E-007 3.4579996269674792E-007 -2.8709559760381695E-007 -2.5988408395506333E-007 2.6892263911657433E-007 1.5857981537786881E-007 9.6981428861562584E-008 -6.3642786784148057E-008 -2.7086971061204721E-007 -1.8617148981985360E-007 2.1230510002115130E-008 2.2874947142216399E-007 7.0478211935204261E-008 -1.8947368913301149E-007 2.7646052775266531E-008 6.4184435489901123E-008 -1.1981297016566423E-007 -7.6970360399353498E-008 8.7090903374636863E-008 5.4823597527620458E-008 6.6396336059843098E-008 6.6404521672338014E-008 -1.1270714979944440E-007 -6.3904329566803389E-008 4.2384619301370524E-008 2.0939713549238330E-008 1.0475054853857151E-007 5.7683246517730989E-008 -4.5985579633293137E-008 -1.1328928182521530E-008 5.7404865308397804E-008 6.8093187083688751E-008 -3.5885851587023766E-008 -4.0898884105110096E-008 3.5396767806345069E-008 -4.0509047726681815E-008 -2.4229808849305792E-009 8.9552501000841022E-008 1.8836342290647121E-008 -2.0442928079669031E-008 -2.6781939408162332E-008 -1.6135936288338551E-008 2.8286329463621917E-008 3.2058810389364061E-008 -8.1561779426063983E-010 1.0158158991198962E-008 1.0025316233709142E-008 -1.7808999497689012E-008 2.2828390689102261E-009 3.1209459694678000E-008 1.4596259357631730E-008 -5.4912946797593063E-009 -6.8370317910992889E-009 1.2573855045234432E-008 2.3694042019173299E-008 6.3128892121474015E-009 -1.1810312302996276E-008 1.3090391920719582E-009 7.5711167392390374E-009 5.1366906874570399E-010 5.4164929190237978E-010 2.7576242203150235E-009 6.9640228836983656E-009 2.5728120032591567E-009 5.0294879882709842E-009 1.0033909522237988E-008 7.7442440818073732E-010 4.3031262209309048E-009 9.5954790542680954E-009 1.5665780631488022E-009 8.8777363669802177E-010 2.5036622208425182E-009 3.4198079120294760E-009 4.4188445038543968E-009 1.9073265069337108E-009 2.0664909539754634E-009 4.9385126534409321E-009 3.4173523047011138E-009 1.1063352544757637E-009 1.4082594214255016E-009 3.2255212659845017E-009 5.4531468282371169E-009 2.9744229628892994E-009 2.6796826840495123E-009 3.7096917860407076E-009 3.8243278938056666E-009 3.4207441060865744E-009 2.1784816929078240E-009 2.8074006666110732E-009 3.1508252467694173E-009 3.6657960764966695E-009 4.3965730872079405E-009 4.0468853939542788E-009 3.1777077918360912E-009 3.2122511785525798E-009 3.3793304281166427E-009 3.5988628067796589E-009 3.8825187373056499E-009 3.9011896442381061E-009 3.4190107463335765E-009 2.1885531790585462E-008 0.0000000000000000 Old AD: x_ad%pres = 1.1004635949948769E-012 1.1012760756531410E-012 1.1021750250859355E-012 1.2390747708525742E-012 1.5124585351213581E-012 1.6504256476445509E-012 1.6524773857764173E-012 1.8457373439853588E-012 2.2311329261072657E-012 2.4265201619403414E-012 2.4309155073860239E-012 2.6722371831629183E-012 3.1522190718269690E-012 3.3974955092737689E-012 3.4061612748611759E-012 3.6888590660520314E-012 4.2484974324243782E-012 3.0414219314613215E-006 -1.0504632457286344E-006 -6.0550401221077760E-007 -2.7799277024681863E-007 -1.6354281331209515E-007 -1.0613740364933190E-007 -7.9389223504226443E-008 -6.5138371747628290E-008 -5.2129094848838875E-005 3.0200961125669810E-005 5.1694578492300653E-006 2.7768759947294889E-006 1.7511246580316324E-006 -1.7506254430504254E-005 6.8847998967251747E-006 4.7385582579729515E-006 2.2698870459881067E-006 5.7846190907046993E-006 5.8421735954044766E-006 -3.2425383603851303E-006 -4.1120990447106515E-007 -7.0611147802101310E-006 3.0474237722041042E-007 2.6619327733694716E-006 1.0837511896784079E-006 7.6871000636077457E-006 -3.5883181480487554E-006 -2.8383103307903867E-007 -1.3827467315561954E-006 8.4258404882985495E-007 1.8439803221478047E-006 1.9534418321928181E-006 -1.3234886518067884E-006 6.1440650836776067E-006 -1.9573999497394473E-006 -4.5579720458921980E-007 1.1970099391940426E-006 -1.6365636573911004E-006 -5.6229486466936078E-006 2.0912378290319318E-006 -1.1319152294159857E-006 7.3802460648667884E-007 1.1109189804794177E-006 8.1347710963732596E-008 -7.3350829565778447E-007 1.5815713492065540E-007 4.7178309521461331E-006 -1.0317771920873095E-006 -1.0255948035104886E-006 -3.4130904480981676E-007 2.0089910487214394E-006 -1.0679423873427668E-006 3.5098402921070927E-009 -1.0976068185404617E-006 -1.5593838489059357E-007 -3.7225994129255382E-007 5.8774695005852188E-007 6.5479586268121088E-007 -1.6836686786060796E-007 -1.8782517913924675E-007 1.0130290772990503E-006 1.1785542332457174E-006 -5.9225554617566291E-007 1.4873484718002847E-006 -1.8095794367360553E-006 -8.0741631904193777E-007 -6.6357608001602304E-007 5.1886461631422910E-007 1.3841636389617871E-007 -3.4540899736094603E-007 -1.0385199774144929E-006 1.1591068632234338E-006 8.7808686966263104E-007 9.8557116808597726E-008 -4.1888705832492767E-008 -2.7700017313365984E-006 2.0066866086164006E-006 7.9024157118446672E-007 5.8148848489712553E-008 -1.7257110419431293E-007 -1.3694682395627724E-006 -6.4217958510326234E-007 9.5939081083027841E-007 5.4207204186120357E-007 -1.5173438099588168E-007 1.5812294564919904E-007 4.1174602163712228E-007 4.4387062223049481E-007 -1.6745730756983281E-006 -2.2765529870577965E-007 1.4755009741620590E-006 -4.7544359403317499E-007 -1.0542364457521083E-006 7.4414114871402493E-007 8.7215660137308509E-007 3.8930031011984355E-007 3.4011515606475621E-007 -5.3123206991089739E-007 -4.5525197641874114E-007 -3.0817325228741885E-007 -2.9663495688572076E-007 1.2617366131257844E-007 3.7476055491830574E-007 1.0500819141200388E-007 -8.5283907496331533E-008 -2.5567362485751776E-007 6.3609311244680293E-007 3.9053397726736110E-007 -6.7539904698305951E-007 -1.5109361034984581E-007 3.8280101980492308E-007 -5.5088862720738535E-007 -2.9173574977375277E-007 -4.7893123728268764E-008 1.4952855782869553E-007 4.7684113149522559E-007 -1.0493013355343753E-007 8.4991679111936265E-007 -4.9898991825529241E-007 -4.0531295801888926E-007 -2.8563841750075305E-007 8.6818570236919204E-007 -3.5648745369310727E-007 -1.8005185874487243E-007 -1.3582265595355269E-007 -5.8066464214246642E-008 1.8066677605407939E-007 3.4583001732673907E-007 1.2077467796980188E-008 -5.4484635198099441E-008 -3.9199393625470645E-007 2.6085257300132791E-007 1.0401143714577693E-007 -1.5997092294743185E-007 3.7827120925650790E-008 1.9161581057816808E-007 -4.8689662218511875E-008 -1.2114814620458593E-007 1.5852760455473603E-008 -1.4613719969823580E-007 1.9050658149367431E-008 2.0001346072549363E-007 -8.0275762564183626E-008 -1.4603919169928962E-009 -4.0188314546528385E-008 -1.6476759039844587E-007 5.4708593185356057E-008 3.3576470594810292E-008 -1.2635603093135621E-008 -1.0016491839114132E-007 -3.1378621016473316E-008 1.0148729552511265E-007 -2.4384130864328437E-008 -4.4369558304353461E-008 1.2362965114124172E-007 -1.2201758212385003E-007 -4.9580829939808930E-008 1.3834172309810185E-008 2.4355398197674018E-008 2.5470620334119298E-008 4.0403832777666307E-009 -5.8740126843359434E-008 -1.6383601772407582E-009 2.7396894769669692E-009 -2.2573076180933180E-008 3.5243958074322987E-009 2.9679394531662858E-008 -3.5306369978284098E-008 -2.3783152032319383E-008 -3.8705509996493651E-009 1.3890258589839716E-008 -1.8322957051513093E-009 -2.2386309978607358E-008 -2.2261529346698374E-008 1.0490287511010982E-008 1.1149888044039784E-008 -1.4274651285724744E-008 -1.4066022301842890E-010 -1.2895198712154753E-009 -1.6933050598410916E-010 -5.4796555758064183E-009 -7.9981039343083382E-009 2.8617914923871743E-009 -1.2839966292011384E-008 -6.1763489331167753E-009 4.4574680822821661E-009 -1.3110546282292781E-008 -5.0362497765757503E-009 1.8652312353611442E-009 -3.9435940938428936E-009 -1.0759126364433004E-009 -5.7215990085124018E-009 -2.8306803330509850E-009 -1.0659477416831305E-009 -3.2004857608693649E-009 -6.4098101635559805E-009 -2.2855672102317532E-010 -2.2350838326067009E-009 -7.7891419451551869E-010 -5.7335823981298227E-009 -4.8321129785341952E-009 -1.0458660638049711E-009 -4.4086524573520012E-009 -2.9612443362328622E-009 -4.6429815856364815E-009 -2.1511561403964218E-009 -2.2229996275600220E-009 -3.3979901874786215E-009 -2.8639200013157112E-009 -4.5399358464422555E-009 -4.3408028426088813E-009 -3.7994010985847174E-009 -2.5597339026295073E-009 -3.8627568757094226E-009 -2.7981757704273636E-009 -4.3898604896245654E-009 -3.4190292297314653E-009 -4.4432271193494338E-009 -1.6523452974937043E-009 -4.1298519084736793E-008 Old AD: SUM(x_ad%pres*bkk) = -3.4436749372796291E-006 Old AD: SUM(p_hlv_ad*x%bk) = 7.7166254951192093E-007 Old AD: psfc_ad = -2.6720123877677080E-006
Frac diffs between old and (either) new psfc_ad
are ~ 2 10-5, which seems believable.
How does it test out? First of all, note that psfc_ad*psfc_tl
usually only makes a small (~10-6) contribution to norm2
=
<HTHdx2|dx1>, so to accentuate the sensitivity to these differences we set all components of dx1 to zero except dx1_psfc, so that
norm2
is just psfc_ad2*psfc_tl1
. The AD tests then give the following results (for t_fascod_ad_4):
Old Code
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.6857016412E+01 5.6857930903E+01 9.9998391621E-01 -1.6083791458E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2065934914E-06 -1.2065649160E-06 1.0000236832E+00 2.3683244647E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.6575772354E+02 1.6576029161E+02 9.9998450735E-01 -1.5492645526E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2248659344E-06 -1.2248421549E-06 1.0000194144E+00 1.9414364025E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1062352054E+02 3.1062866722E+02 9.9998343143E-01 -1.6568572519E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.1259928176E-06 2.1259946010E-06 9.9999916117E-01 -8.3882791130E-07 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.7913644136E+02 1.7913936991E+02 9.9998365211E-01 -1.6347885083E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.7349857643E-07 4.7351490699E-07 9.9996551206E-01 -3.4487943770E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.2483851107E+02 2.2484240763E+02 9.9998266981E-01 -1.7330190163E-05 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.4843213218E-07 1.4842698044E-07 1.0000347090E+00 3.4708973949E-05 **************************** ********** *FAIL* ********** ****************************
This makes sense: inconsistent TL and AD codes. (And is a lot more sensitive to this than suggested by https://trac.romsaf.org/ropp/ticket/552#comment:10.)
JKN code
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.6857016412E+01 5.6857016412E+01 1.0000000000E+00 -4.8738341270E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2065934914E-06 -1.2065934914E-06 1.0000000000E+00 2.1769130930E-12 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.6575772354E+02 1.6575772354E+02 1.0000000000E+00 4.2866342550E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2248659344E-06 -1.2248659344E-06 1.0000000000E+00 5.9450932899E-12 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1062352054E+02 3.1062352054E+02 1.0000000000E+00 -5.3984349075E-14 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.1259928176E-06 2.1259928176E-06 1.0000000000E+00 2.2110184483E-12 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.7913644136E+02 1.7913644136E+02 1.0000000000E+00 -9.8368928809E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.7349857643E-07 4.7349857644E-07 9.9999999999E-01 -1.0167780079E-11 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.2483851107E+02 2.2483851107E+02 1.0000000000E+00 -2.5155477813E-14 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.4843213218E-07 1.4843213218E-07 9.9999999999E-01 -6.1980087889E-12 **************************** ********** PASS ********** ****************************
All pretty good, but getting uncomfortably big, in my opinion.
IDC code
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.6857016412E+01 5.6857016412E+01 1.0000000000E+00 -4.1240134921E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2065934914E-06 -1.2065934914E-06 1.0000000000E+00 -4.7595842537E-13 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.6575772354E+02 1.6575772354E+02 1.0000000000E+00 1.8861190722E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = -1.2248659344E-06 -1.2248659344E-06 1.0000000000E+00 2.3926977763E-13 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1062352054E+02 3.1062352054E+02 1.0000000000E+00 -1.8299779348E-16 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.1259928176E-06 2.1259928176E-06 1.0000000000E+00 -9.5341330694E-13 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.7913644136E+02 1.7913644136E+02 1.0000000000E+00 1.4279360634E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.7349857643E-07 4.7349857644E-07 9.9999999999E-01 -6.7832158674E-12 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 2.2483851107E+02 2.2483851107E+02 1.0000000000E+00 7.5845661747E-16 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.4843213218E-07 1.4843213218E-07 1.0000000000E+00 6.7285380831E-12 **************************** ********** PASS ********** ****************************
Still uncomfortably big, in my opinion, but comparable (a little bit better in fact) to JKN, except in the last case. All 40 AD tests pass, and the largest frac diff in the all the norms is < 7 10-12.
Probably good enough, though, so commit 1st draft of updates to FM, TL and AD at r6873.
Note that when tested on a full norm2
= <HTHdx2|Hdx1>, the fractional errors look a lot better:
norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1767533067E+08 3.1767533067E+08 1.0000000000E+00 7.5051020991E-16 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 7.5849951669E+00 7.5849951669E+00 1.0000000000E+00 -2.1194515017E-14 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3428743591E+08 3.3428743591E+08 1.0000000000E+00 1.0698214477E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3128553590E+00 3.3128553590E+00 1.0000000000E+00 2.5469554426E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.8399569832E+08 4.8399569832E+08 1.0000000000E+00 1.2315118705E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8019129211E+00 5.8019129211E+00 1.0000000000E+00 -2.6942734921E-14 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.0098871424E+08 4.0098871424E+08 1.0000000000E+00 1.4864419536E-15 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8347743181E+00 5.8347743181E+00 1.0000000000E+00 -2.9378760113E-14 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.6809009665E+08 4.6809009665E+08 1.0000000000E+00 2.5467167625E-16 norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.0219616613E+01 1.0219616613E+01 1.0000000000E+00 -3.2330212046E-14 **************************** ********** PASS ********** ****************************
As expected, these changes are enough to break the ECMWF 1dvar tests:
************************** SUMMARY OF ROPP_1DVAR TEST RESULTS ************************ -------------------------------------------------------------------------------------- | Test name | Description | Run? | PASS? | -------------------------------------------------------------------------------------- | t_1dvar_01_refrac | 1DVAR basic; default | Run | *FAIL* | | t_1dvar_01comp_refrac | 1DVAR basic; comp factors | Run | *FAIL* | | t_1dvar_GRAS_05_bangle | 1DVAR GRAS; default | Run | *FAIL* | | t_1dvar_GRAS_05comp_bangle | 1DVAR GRAS; comp factors | Run | *FAIL* | | t_1dvar_GRAS_05newop_bangle | 1DVAR GRAS; new interp | Run | *FAIL* | | t_1dvar_GRAS_05_refrac | 1DVAR GRAS; default | Run | *FAIL* | | t_1dvar_GRAS_05comp_refrac | 1DVAR GRAS; comp factors | Run | *FAIL* | | t_1dvar_GRAS_05newop_refrac | 1DVAR GRAS; new interp | Run | *FAIL* | | t_1dvar_COSMIC_04_bangle | 1DVAR COSMIC; default | Run | PASS | | t_1dvar_COSMIC_04comp_bangle | 1DVAR COSMIC; comp factors | Run | PASS | | t_1dvar_COSMIC_04newop_bangle | 1DVAR COSMIC; new interp | Run | PASS | | t_1dvar_COSMIC_04_refrac | 1DVAR COSMIC; default | Run | PASS | | t_1dvar_COSMIC_04comp_refrac | 1DVAR COSMIC; comp factors | Run | PASS | | t_1dvar_COSMIC_04newop_refrac | 1DVAR COSMIC; new interp | Run | PASS | | t_1dvar_iono_bangle | 1DVAR L1 and L2 | Run | *FAIL* | | t_1dvar_IEEC_08_dbangle | 1DVAR IEEC dbangle; 1 layer | Run | PASS | --------------------------------------------------------------------------------------
Back off fixing them until #553 is done, as that will likely break them too.
For the record, with full dx1 and the #553 bug-fix, we get:
t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1636508472E+08 3.1636508472E+08 1.0000000000E+00 2.0724508620E-15 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 8.0496561115E+00 8.0496561115E+00 1.0000000000E+00 -7.0615959332E-15 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3403923972E+08 3.3403923972E+08 1.0000000000E+00 1.6059245118E-15 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3236204106E+00 3.3236204106E+00 1.0000000000E+00 6.0127246720E-15 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.8207670452E+08 4.8207670452E+08 1.0000000000E+00 -7.4184847618E-16 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.7427036733E+00 5.7427036733E+00 1.0000000000E+00 3.0468427179E-14 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.9901970902E+08 3.9901970902E+08 1.0000000000E+00 -4.4813308788E-16 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 6.6238113303E+00 6.6238113304E+00 1.0000000000E+00 -3.1108584332E-14 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.6233917124E+08 4.6233917124E+08 1.0000000000E+00 5.1567895158E-16 t_fascod_ad_1.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 9.7442293100E+00 9.7442293100E+00 1.0000000000E+00 -6.1981436005E-15 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1774608735E+08 3.1774608735E+08 1.0000000000E+00 2.6262007939E-15 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 7.5799553038E+00 7.5799553038E+00 1.0000000000E+00 4.4292008223E-14 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3450840777E+08 3.3450840777E+08 1.0000000000E+00 1.4254863170E-15 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3169867257E+00 3.3169867257E+00 1.0000000000E+00 3.7888980807E-14 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.8395373567E+08 4.8395373567E+08 1.0000000000E+00 -1.1084567872E-15 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8019312934E+00 5.8019312934E+00 1.0000000000E+00 -3.0616647278E-15 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.0081962309E+08 4.0081962309E+08 1.0000000000E+00 8.9224141746E-16 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8347118206E+00 5.8347118206E+00 1.0000000000E+00 -5.6474801813E-14 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.6714825486E+08 4.6714825486E+08 1.0000000000E+00 -6.3796283252E-16 t_fascod_ad_2.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.0219492466E+01 1.0219492466E+01 1.0000000000E+00 -4.6062420811E-14 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1629094268E+08 3.1629094268E+08 1.0000000000E+00 -1.5075903033E-15 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 8.1855199551E+00 8.1855199551E+00 1.0000000000E+00 2.0833161182E-14 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3380503984E+08 3.3380503984E+08 1.0000000000E+00 1.2499287417E-15 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3030088728E+00 3.3030088728E+00 1.0000000000E+00 1.2692070480E-13 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.8213401325E+08 4.8213401325E+08 1.0000000000E+00 -8.6538701265E-16 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.7426591322E+00 5.7426591322E+00 1.0000000000E+00 -1.0207775588E-14 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.9912653333E+08 3.9912653333E+08 1.0000000000E+00 0.0000000000E+00 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 6.6238703755E+00 6.6238703755E+00 1.0000000000E+00 2.6817506061E-15 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.6320979163E+08 4.6320979163E+08 1.0000000000E+00 1.2867742835E-16 t_fascod_ad_3.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 9.7443078581E+00 9.7443078581E+00 1.0000000000E+00 -2.3698593321E-15 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.1767533031E+08 3.1767533031E+08 1.0000000000E+00 1.8762755269E-16 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 7.5849858916E+00 7.5849858916E+00 1.0000000000E+00 -5.3864579170E-15 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3428743591E+08 3.3428743591E+08 1.0000000000E+00 1.0698214477E-15 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 3.3128581939E+00 3.3128581939E+00 1.0000000000E+00 2.2252328509E-14 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.8399569821E+08 4.8399569821E+08 1.0000000000E+00 7.3890712248E-16 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8018971385E+00 5.8018971385E+00 1.0000000000E+00 -1.4389908931E-14 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.0098871424E+08 4.0098871424E+08 1.0000000000E+00 1.4864419536E-15 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 5.8347728595E+00 5.8347728595E+00 1.0000000000E+00 -3.2575420910E-14 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 4.6809009701E+08 4.6809009701E+08 1.0000000000E+00 1.2733583803E-16 t_fascod_ad_4.log:norm1, norm2, norm1/norm2, (norm1-norm2)/norm2 = 1.0219617818E+01 1.0219617818E+01 1.0000000000E+00 -5.0233495591E-14
The largest fractional difference (for BENDING ANGLE AD FASCOD_MLS
with x%non_ideal, x%new_ref_op, x%new_bangle_op = F T T
) is ~ 10-13, which still seems uncomfortably big to me, but is no worse than what we've lived with for ages.
Cleaned up versions of the state2state codes, which produce exactly the same results as the uncleaned versions, have been committed at r6877.
Resolution: | → fixed |
---|---|
Status: | new → closed |
As foreseen in #comment:17, some of the 1dvar reference files need to be updated as a result of these changes. This has been done at r6878. The 1dvar core tests now give:
-------------------------------------------------------------------------------------- | Test name | Description | Run? | PASS? | -------------------------------------------------------------------------------------- | t_1dvar_01_refrac | 1DVAR basic; default | Run | PASS | | t_1dvar_01comp_refrac | 1DVAR basic; comp factors | Run | PASS | | t_1dvar_GRAS_05_bangle | 1DVAR GRAS; default | Run | PASS | | t_1dvar_GRAS_05comp_bangle | 1DVAR GRAS; comp factors | Run | PASS | | t_1dvar_GRAS_05newop_bangle | 1DVAR GRAS; new interp | Run | PASS | | t_1dvar_GRAS_05_refrac | 1DVAR GRAS; default | Run | PASS | | t_1dvar_GRAS_05comp_refrac | 1DVAR GRAS; comp factors | Run | PASS | | t_1dvar_GRAS_05newop_refrac | 1DVAR GRAS; new interp | Run | PASS | | t_1dvar_COSMIC_04_bangle | 1DVAR COSMIC; default | Run | PASS | | t_1dvar_COSMIC_04comp_bangle | 1DVAR COSMIC; comp factors | Run | PASS | | t_1dvar_COSMIC_04newop_bangle | 1DVAR COSMIC; new interp | Run | PASS | | t_1dvar_COSMIC_04_refrac | 1DVAR COSMIC; default | Run | PASS | | t_1dvar_COSMIC_04comp_refrac | 1DVAR COSMIC; comp factors | Run | PASS | | t_1dvar_COSMIC_04newop_refrac | 1DVAR COSMIC; new interp | Run | PASS | | t_1dvar_iono_bangle | 1DVAR L1 and L2 | Run | PASS | | t_1dvar_IEEC_08_dbangle | 1DVAR IEEC dbangle; 1 layer | Run | PASS | --------------------------------------------------------------------------------------
That'll do. Closing ticket as fixed.
Preliminary work - consistent use of
R_vap/R_dry - 1 = 0.607766607433924023
rather than0.61
throughout, and use ofr_LEO = 830 km
rather than800 km
in the test programs - committed at r6857.