Skip to content

Commit 6547b2a

Browse files
Hallberg-NOAAmarshallward
authored andcommitted
(*)Use conversion factor for masscello diagnostic
Use a conversion factor to rescale the units of masscello, just like every other diagnostic. This does not change the diagnostic itself, but it changes the order of the rescaling and the vertical remapping of this diagnostic onto other coordinates (like z) or spatial averaging of this diagnostic, which can change values in the last bits for this diagnostic for Boussinesq models (but not for non-Boussinesq models, for which the conversion factor is an integer power of 2). As a result some of the diagnostics derived from masscello can differ and this commit nominally fails the TC testing for reproducibility across code versions. All solutions and primary diagnostics, however, are bitwise identical, and even the derived diagnostic calculations are mathematically equivalent.
1 parent 4038d69 commit 6547b2a

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/diagnostics/MOM_diagnostics.F90

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,7 @@ subroutine calculate_diagnostic_fields(u, v, h, uh, vh, tv, ADp, CDp, p_surf, &
324324

325325
! mass per area of grid cell (for Boussinesq, use Rho0)
326326
if (CS%id_masscello > 0) then
327-
do k=1,nz ; do j=js,je ; do i=is,ie
328-
work_3d(i,j,k) = GV%H_to_kg_m2*h(i,j,k)
329-
enddo ; enddo ; enddo
330-
call post_data(CS%id_masscello, work_3d, CS%diag)
331-
!### If the registration call has conversion=GV%H_to_kg_m2, the mathematically equivalent form would be:
332-
! call post_data(CS%id_masscello, h, CS%diag)
327+
call post_data(CS%id_masscello, h, CS%diag)
333328
endif
334329

335330
! mass of liquid ocean (for Bouss, use Rho0). The reproducing sum requires the use of MKS units.
@@ -1638,7 +1633,7 @@ subroutine MOM_diagnostics_init(MIS, ADp, CDp, Time, G, GV, US, param_file, diag
16381633
convert_H = GV%H_to_MKS
16391634

16401635
CS%id_masscello = register_diag_field('ocean_model', 'masscello', diag%axesTL, &
1641-
Time, 'Mass per unit area of liquid ocean grid cell', 'kg m-2', & !### , conversion=GV%H_to_kg_m2, &
1636+
Time, 'Mass per unit area of liquid ocean grid cell', 'kg m-2', conversion=GV%H_to_kg_m2, &
16421637
standard_name='sea_water_mass_per_unit_area', v_extensive=.true.)
16431638

16441639
CS%id_masso = register_scalar_field('ocean_model', 'masso', Time, &

0 commit comments

Comments
 (0)