marbl-ecosys / MARBL

Marine Biogeochemistry Library
https://marbl-ecosys.github.io
Other
14 stars 25 forks source link

Bug in new bot_flux_to_tend code #385

Closed mnlevy1981 closed 3 years ago

mnlevy1981 commented 3 years ago

There are are a few outstanding dzr_loc terms in the k == kmt block of compute_particulate_terms()... namely the sed_denitrif and other_remin computations. This is affecting the O2 terms in the MOM6 driver

mnlevy1981 commented 3 years ago

(It's probably also affecting the nitrogen terms, but I haven't looked at those yet -- it was O2 going off the rails that caught my eye)

mnlevy1981 commented 3 years ago

I thought this was fixed in #386 but CESM's test suite found a bug in the CISO update:

15:At line 1258 of file /glade/scratch/mlevy/SMS_Ld2_D.T62_g37.C1850ECO.cheyenne_gnu.pop-ciso_daily_r4_tavg.GC.20210909_173200_6yfir7/bld/ocn/source/marbl_ciso_interior_tendency_mod.F90
15:Fortran runtime error: Array bound mismatch for dimension 1 of array 'other_remin' (60/53)
15:
15:Error termination. Backtrace:
15:#0  0xaad9e3 in compute_particulate_terms
15:     at /glade/scratch/mlevy/SMS_Ld2_D.T62_g37.C1850ECO.cheyenne_gnu.pop-ciso_daily_r4_tavg.GC.20210909_173200_6yfir7/bld/ocn/source/marbl_ciso_interior_tendency_mod.F90:1258

I think this is an easy fix:

@@ -1255,10 +1255,10 @@ subroutine compute_particulate_terms(k, domain, bot_flux_to_tend, tracer_local,
                               (0.06_r8 + 0.19_r8 * 0.99_r8**(O2_loc-NO3_loc))

           flux_alt = POC_ciso%to_floor*1.0e-6_r8*spd*365.0_r8 ! convert to mmol/cm^2/year
-          other_remin = min(bot_flux_to_tend(1:k) * &
-                            min(0.1_r8 + flux_alt,0.5_r8) * (POC_ciso%to_floor - POC_ciso%sed_loss(k)), &
-                            bot_flux_to_tend(1:k) * (POC_ciso%to_floor - POC_ciso%sed_loss(k)) - &
-                            sed_denitrif(1:k) * denitrif_C_N)
+          other_remin(1:k) = min(bot_flux_to_tend(1:k) * &
+                                 min(0.1_r8 + flux_alt,0.5_r8) * (POC_ciso%to_floor - POC_ciso%sed_loss(k)), &
+                                 bot_flux_to_tend(1:k) * (POC_ciso%to_floor - POC_ciso%sed_loss(k)) - &
+                                 sed_denitrif(1:k) * denitrif_C_N)

Testing it now...

mnlevy1981 commented 3 years ago

fixed by #386 and #390