Skip to content

Commit

Permalink
(*)Initialize halos for 7 intent out arrays
Browse files Browse the repository at this point in the history
  Initialize the halos of 7 intent out arrays to 0 so that they will not have
uninitialized data in their halo regions.  The impacted arrays are u_cor and
v_cor in continuity_PPM, h_MLD in convert_MLD_to_ML_thickness, MLD in
energetic_PBL_get_MLD and LmixScale, bottomFac2 and barotrFac2 in
MEKE_lengthScales.  This does not change solutions in any of the MOM6-examples
test cases, but it is conceivable that could, and it does change the values
in the debugging checksum output for some cases to more nearly reproduce
under dimensional rescaling and rotation.
  • Loading branch information
Hallberg-NOAA committed Mar 3, 2025
1 parent 3142c3f commit 6d5fbc2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/MOM_continuity_PPM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ subroutine zonal_mass_flux(u, h_in, h_W, h_E, uh, dt, G, GV, US, CS, OBC, por_fa
local_open_BC = OBC%open_u_BCs_exist_globally
endif ; endif

if (present(u_cor)) u_cor(:,:,:) = 0.0
if (present(du_cor)) du_cor(:,:) = 0.0

if (present(LB_in)) then
Expand Down Expand Up @@ -1491,6 +1492,7 @@ subroutine meridional_mass_flux(v, h_in, h_S, h_N, vh, dt, G, GV, US, CS, OBC, p
local_open_BC = OBC%open_v_BCs_exist_globally
endif ; endif

if (present(v_cor)) v_cor(:,:,:) = 0.0
if (present(dv_cor)) dv_cor(:,:) = 0.0

if (present(LB_in)) then
Expand Down
2 changes: 2 additions & 0 deletions src/core/MOM_interface_heights.F90
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,8 @@ subroutine convert_MLD_to_ML_thickness(MLD_in, h, h_MLD, tv, G, GV, halo)

is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = GV%ke

h_MLD(:,:) = 0.0

halos = 0 ; if (present(halo)) halos = halo
if (present(halo)) then
is = G%isc-halo ; ie = G%iec+halo ; js = G%jsc-halo ; je = G%jec+halo
Expand Down
5 changes: 5 additions & 0 deletions src/parameterizations/lateral/MOM_MEKE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,11 @@ subroutine MEKE_lengthScales(CS, MEKE, G, GV, US, SN_u, SN_v, EKE, depth_tot, &
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec
h_neglect = GV%H_subroundoff

! This code sets the halo regions for these intent(out) variables.
LmixScale(:,:) = 0.0
bottomFac2(:,:) = 0.0
barotrFac2(:,:) = 0.0

!$OMP do
do j=js,je ; do i=is,ie
if (.not.CS%use_old_lscale) then
Expand Down
1 change: 1 addition & 0 deletions src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3384,6 +3384,7 @@ subroutine energetic_PBL_get_MLD(CS, MLD, G, US, m_to_MLD_units)

scale = 1.0 ; if (present(m_to_MLD_units)) scale = US%Z_to_m * m_to_MLD_units

MLD(:,:) = 0.0 ! This ensures that the halos have appropriate values for land.
do j=G%jsc,G%jec ; do i=G%isc,G%iec
MLD(i,j) = scale*CS%ML_depth(i,j)
enddo ; enddo
Expand Down

0 comments on commit 6d5fbc2

Please sign in to comment.