Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ALE/MOM_ALE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ subroutine ALE_initThicknessToCoord( CS, G, GV, h, height_units )
scale = GV%Z_to_H
if (present(height_units)) then ; if (height_units) scale = 1.0 ; endif
do j = G%jsd,G%jed ; do i = G%isd,G%ied
h(i,j,:) = scale * getStaticThickness( CS%regridCS, 0., G%bathyT(i,j)+G%Z_ref )
h(i,j,:) = scale * getStaticThickness( CS%regridCS, 0., max(G%meanSL(i,j)+G%bathyT(i,j), 0.0) )
enddo ; enddo

end subroutine ALE_initThicknessToCoord
Expand Down
12 changes: 6 additions & 6 deletions src/ALE/MOM_hybgen_unmix.F90
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,18 @@ subroutine hybgen_unmix(G, GV, US, CS, tv, Reg, ntr, h)
do k=1,nk
dz_tot = dz_tot + GV%H_to_RZ * tv%SpV_avg(i,j,k) * h_col(k)
enddo
if (dz_tot <= CS%min_dilate*(G%bathyT(i,j)+G%Z_ref)) then
if (dz_tot <= CS%min_dilate * (G%meanSL(i,j) + G%bathyT(i,j))) then
dilate = CS%min_dilate
elseif (dz_tot >= CS%max_dilate*(G%bathyT(i,j)+G%Z_ref)) then
elseif (dz_tot >= CS%max_dilate * (G%meanSL(i,j) + G%bathyT(i,j))) then
dilate = CS%max_dilate
else
dilate = dz_tot / (G%bathyT(i,j)+G%Z_ref)
dilate = dz_tot / (G%meanSL(i,j) + G%bathyT(i,j))
endif
else
nominalDepth = (G%bathyT(i,j)+G%Z_ref)*GV%Z_to_H
if (h_tot <= CS%min_dilate*nominalDepth) then
nominalDepth = (G%meanSL(i,j) + G%bathyT(i,j)) * GV%Z_to_H
if (h_tot <= CS%min_dilate * nominalDepth) then
dilate = CS%min_dilate
elseif (h_tot >= CS%max_dilate*nominalDepth) then
elseif (h_tot >= CS%max_dilate * nominalDepth) then
dilate = CS%max_dilate
else
dilate = h_tot / nominalDepth
Expand Down
8 changes: 4 additions & 4 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ subroutine initialize_regridding(CS, G, GV, US, max_depth, param_file, mdl, &
endif
do i=G%isc-1,G%iec+1; do j=G%jsc-1,G%jec+1
if (G%mask2dT(i,j)>0.) then
nominalDepth = (G%bathyT(i,j)+G%Z_ref)*US%Z_to_m
nominalDepth = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * US%Z_to_m
if (nominalDepth <= depth_s) then
do k= 1,n_sigma
dz_3d(i,j,k) = dz_shallow(k)
Expand Down Expand Up @@ -1243,15 +1243,15 @@ subroutine regridding_main( remapCS, CS, G, GV, US, h, tv, h_new, dzInterface, &
tot_dz(i,j) = tot_dz(i,j) + GV%H_to_RZ * tv%SpV_avg(i,j,k) * h(i,j,k)
enddo ; enddo ; enddo
do j=G%jsc-1,G%jec+1 ; do i=G%isc-1,G%iec+1
if ((tot_dz(i,j) > 0.0) .and. (G%bathyT(i,j)+G%Z_ref > 0.0)) then
nom_depth_H(i,j) = (G%bathyT(i,j)+G%Z_ref) * (tot_h(i,j) / tot_dz(i,j))
if (tot_dz(i,j) > 0.0) then
nom_depth_H(i,j) = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * (tot_h(i,j) / tot_dz(i,j))
else
nom_depth_H(i,j) = 0.0
endif
enddo ; enddo
else
do j=G%jsc-1,G%jec+1 ; do i=G%isc-1,G%iec+1
nom_depth_H(i,j) = max((G%bathyT(i,j)+G%Z_ref) * Z_to_H, 0.0)
nom_depth_H(i,j) = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * Z_to_H
enddo ; enddo
endif

Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4286,8 +4286,8 @@ subroutine extract_surface_state(CS, sfc_state_in)
do j=js,je ; do i=is,ie
if (G%mask2dT(i,j)>0.) then
localError = sfc_state%sea_lev(i,j) < -G%bathyT(i,j) - G%Z_ref &
.or. sfc_state%sea_lev(i,j) >= CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) <= -CS%bad_val_ssh_max &
.or. sfc_state%sea_lev(i,j) >= CS%bad_val_ssh_max + (G%meanSL(i,j) - G%Z_ref) &
.or. sfc_state%sea_lev(i,j) <= -CS%bad_val_ssh_max + (G%meanSL(i,j) - G%Z_ref) &
.or. sfc_state%sea_lev(i,j) + G%bathyT(i,j) + G%Z_ref < CS%bad_val_col_thick
if (use_temperature) localError = localError &
.or. sfc_state%SSS(i,j)<0. &
Expand Down
13 changes: 8 additions & 5 deletions src/core/MOM_PressureForce_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,9 @@ subroutine PressureForce_FV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, AD
else
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
SSH(i,j) = (za(i,j,1) - alpha_ref*p(i,j,1)) * I_gEarth - G%Z_ref &
- max(-G%bathyT(i,j)-G%Z_ref, 0.0)
SSH(i,j) = (za(i,j,1) - alpha_ref*p(i,j,1)) * I_gEarth - G%Z_ref
! Remove above sea level topography at floodable cells
SSH(i,j) = SSH(i,j) - max(-G%bathyT(i,j)-G%meanSL(i,j), 0.0)
enddo ; enddo
call calc_SAL(SSH, e_sal, G, CS%SAL_CSp, tmp_scale=US%Z_to_m)
endif
Expand Down Expand Up @@ -1163,7 +1164,7 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, ADp,
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1
do i=Isq,Ieq+1
SSH(i,j) = min(-G%bathyT(i,j) - G%Z_ref, 0.0)
SSH(i,j) = min(-G%bathyT(i,j) - G%meanSL(i,j), 0.0)
enddo
do k=1,nz ; do i=Isq,Ieq+1
SSH(i,j) = SSH(i,j) + h(i,j,k)*GV%H_to_Z
Expand Down Expand Up @@ -1275,7 +1276,7 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, ADp,
enddo ; enddo
else
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
Z_0p(i,j) = G%Z_ref
Z_0p(i,j) = G%meanSL(i,j)
enddo ; enddo
endif

Expand Down Expand Up @@ -1359,7 +1360,9 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, ADp,
else
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
SSH(i,j) = e(i,j,1) - max(-G%bathyT(i,j) - G%Z_ref, 0.0) ! Remove topography above sea level
SSH(i,j) = e(i,j,1) - G%Z_ref
! Remove above sea level topography at floodable cells
SSH(i,j) = SSH(i,j) - max(-G%bathyT(i,j)-G%meanSL(i,j), 0.0)
enddo ; enddo
call calc_SAL(SSH, e_sal, G, CS%SAL_CSp, tmp_scale=US%Z_to_m)
endif
Expand Down
8 changes: 4 additions & 4 deletions src/core/MOM_PressureForce_Montgomery.F90
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ subroutine PressureForce_Mont_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, p_atm, pb
! of self-attraction and loading.
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1 ; do i=Isq,Ieq+1
SSH(i,j) = min(-G%bathyT(i,j) - G%Z_ref, 0.0)
SSH(i,j) = min(-G%bathyT(i,j) - G%meanSL(i,j), 0.0)
enddo ; enddo
if (use_EOS) then
!$OMP parallel do default(shared)
Expand Down Expand Up @@ -476,7 +476,7 @@ subroutine PressureForce_Mont_Bouss(h, tv, PFu, PFv, G, GV, US, CS, p_atm, pbce,
! barotropic tides.
!$OMP parallel do default(shared)
do j=Jsq,Jeq+1
do i=Isq,Ieq+1 ; SSH(i,j) = min(-G%bathyT(i,j) - G%Z_ref, 0.0) ; enddo
do i=Isq,Ieq+1 ; SSH(i,j) = min(-G%bathyT(i,j) - G%meanSL(i,j), 0.0) ; enddo
do k=1,nz ; do i=Isq,Ieq+1
SSH(i,j) = SSH(i,j) + h(i,j,k)*GV%H_to_Z
enddo ; enddo
Expand Down Expand Up @@ -707,7 +707,7 @@ subroutine Set_pbce_Bouss(e, tv, G, GV, US, Rho0, GFS_scale, pbce, rho_star)
do j=Jsq,Jeq+1
do i=Isq,Ieq+1
Ihtot(i) = GV%H_to_Z / ((e(i,j,1)-e(i,j,nz+1)) + dz_neglect)
press(i) = -Rho0xG*(e(i,j,1) - G%Z_ref)
press(i) = -Rho0xG*(e(i,j,1) - G%meanSL(i,j))
enddo
call calculate_density(tv%T(:,j,1), tv%S(:,j,1), press, rho_in_situ, &
tv%eqn_of_state, EOSdom)
Expand All @@ -716,7 +716,7 @@ subroutine Set_pbce_Bouss(e, tv, G, GV, US, Rho0, GFS_scale, pbce, rho_star)
enddo
do k=2,nz
do i=Isq,Ieq+1
press(i) = -Rho0xG*(e(i,j,K) - G%Z_ref)
press(i) = -Rho0xG*(e(i,j,K) - G%meanSL(i,j))
T_int(i) = 0.5*(tv%T(i,j,k-1)+tv%T(i,j,k))
S_int(i) = 0.5*(tv%S(i,j,k-1)+tv%S(i,j,k))
enddo
Expand Down
51 changes: 27 additions & 24 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5358,14 +5358,14 @@ subroutine find_face_areas(Datu, Datv, G, GV, US, CS, MS, halo, eta, add_max)
H1 = CS%bathyT(i,j)*GV%Z_to_H + eta(i,j) ; H2 = CS%bathyT(i+1,j)*GV%Z_to_H + eta(i+1,j)
Datu(I,j) = 0.0 ; if ((H1 > 0.0) .and. (H2 > 0.0)) &
Datu(I,j) = CS%dy_Cu(I,j) * (2.0 * H1 * H2) / (H1 + H2)
! Datu(I,j) = CS%dy_Cu(I,j) * 0.5 * (H1 + H2)
! Datu(I,j) = CS%dy_Cu(I,j) * 0.5 * (H1 + H2)
enddo ; enddo
!$OMP do
do J=js-1-hs,je+hs ; do i=is-hs,ie+hs
H1 = CS%bathyT(i,j)*GV%Z_to_H + eta(i,j) ; H2 = CS%bathyT(i,j+1)*GV%Z_to_H + eta(i,j+1)
Datv(i,J) = 0.0 ; if ((H1 > 0.0) .and. (H2 > 0.0)) &
Datv(i,J) = CS%dx_Cv(i,J) * (2.0 * H1 * H2) / (H1 + H2)
! Datv(i,J) = CS%dy_v(i,J) * 0.5 * (H1 + H2)
! Datv(i,J) = CS%dy_v(i,J) * 0.5 * (H1 + H2)
enddo ; enddo
else
!$OMP do
Expand All @@ -5388,27 +5388,31 @@ subroutine find_face_areas(Datu, Datv, G, GV, US, CS, MS, halo, eta, add_max)

!$OMP do
do j=js-hs,je+hs ; do I=is-1-hs,ie+hs
Datu(I,j) = CS%dy_Cu(I,j) * Z_to_H * &
max(max(CS%bathyT(i+1,j), CS%bathyT(i,j)) + (G%Z_ref + add_max), 0.0)
H1 = max((G%meanSL(i+1,j) + add_max) + G%bathyT(i+1,j), 0.0)
H2 = max((G%meanSL(i,j) + add_max) + G%bathyT(i,j), 0.0)
Datu(I,j) = CS%dy_Cu(I,j) * Z_to_H * max(H1, H2)
enddo ; enddo
!$OMP do
do J=js-1-hs,je+hs ; do i=is-hs,ie+hs
Datv(i,J) = CS%dx_Cv(i,J) * Z_to_H * &
max(max(CS%bathyT(i,j+1), CS%bathyT(i,j)) + (G%Z_ref + add_max), 0.0)
H1 = max((G%meanSL(i,j+1) + add_max) + G%bathyT(i,j+1), 0.0)
H2 = max((G%meanSL(i,j) + add_max) + G%bathyT(i,j), 0.0)
Datv(i,J) = CS%dx_Cv(i,J) * Z_to_H * max(H1, H2)
enddo ; enddo
else
Z_to_H = GV%Z_to_H ; if (.not.GV%Boussinesq) Z_to_H = GV%RZ_to_H * CS%Rho_BT_lin

!$OMP do
do j=js-hs,je+hs ; do I=is-1-hs,ie+hs
H1 = (CS%bathyT(i,j) + G%Z_ref) * Z_to_H ; H2 = (CS%bathyT(i+1,j) + G%Z_ref) * Z_to_H
H1 = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * Z_to_H
H2 = max(G%meanSL(i+1,j) + G%bathyT(i+1,j), 0.0) * Z_to_H
Datu(I,j) = 0.0
if ((H1 > 0.0) .and. (H2 > 0.0)) &
Datu(I,j) = CS%dy_Cu(I,j) * (2.0 * H1 * H2) / (H1 + H2)
enddo ; enddo
!$OMP do
do J=js-1-hs,je+hs ; do i=is-hs,ie+hs
H1 = (CS%bathyT(i,j) + G%Z_ref) * Z_to_H ; H2 = (CS%bathyT(i,j+1) + G%Z_ref) * Z_to_H
H1 = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * Z_to_H
H2 = max(G%meanSL(i,j+1) + G%bathyT(i,j+1), 0.0) * Z_to_H
Datv(i,J) = 0.0
if ((H1 > 0.0) .and. (H2 > 0.0)) &
Datv(i,J) = CS%dx_Cv(i,J) * (2.0 * H1 * H2) / (H1 + H2)
Expand Down Expand Up @@ -5531,8 +5535,6 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
! name in wave_drag_file.
character(len=80) :: wave_drag_v ! The wave drag piston velocity variable
! name in wave_drag_file.
real :: mean_SL ! The mean sea level that is used along with the bathymetry to estimate the
! geometry when LINEARIZED_BT_CORIOLIS is true or BT_NONLIN_STRESS is false [Z ~> m].
real :: htot ! Total column thickness used when BT_NONLIN_STRESS is false [Z ~> m].
real :: Z_to_H ! A local unit conversion factor [H Z-1 ~> nondim or kg m-3]
real :: H_to_Z ! A local unit conversion factor [Z H-1 ~> nondim or m3 kg-1]
Expand Down Expand Up @@ -6135,36 +6137,38 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &

Z_to_H = GV%Z_to_H ; if (.not.GV%Boussinesq) Z_to_H = GV%RZ_to_H * CS%Rho_BT_lin

Mean_SL = G%Z_ref
do j=js,je ; do I=is-1,ie
CS%D_u_Cor(I,j) = 0.5 * (max(Mean_SL+G%bathyT(i+1,j),0.0) + max(Mean_SL+G%bathyT(i,j),0.0)) * Z_to_H
CS%D_u_Cor(I,j) = 0.5 * ( max(G%meanSL(i+1,j) + G%bathyT(i+1,j), 0.0) &
+ max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) ) * Z_to_H
enddo ; enddo
if (CS%interior_OBC_PV .and. CS%BT_OBC%u_OBCs_on_PE) then ; do j=js,je ; do I=is-1,ie
if (CS%BT_OBC%u_OBC_type(I,j) < 0) & ! Western boundary condition
CS%D_u_Cor(I,j) = max(Mean_SL+G%bathyT(i+1,j),0.0) * Z_to_H
CS%D_u_Cor(I,j) = max(G%meanSL(i+1,j) + G%bathyT(i+1,j), 0.0) * Z_to_H
if (CS%BT_OBC%u_OBC_type(I,j) > 0) & ! Eastern boundary condition
CS%D_u_Cor(I,j) = max(Mean_SL+G%bathyT(i,j),0.0) * Z_to_H
CS%D_u_Cor(I,j) = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * Z_to_H
enddo ; enddo ; endif

do J=js-1,je ; do i=is,ie
CS%D_v_Cor(i,J) = 0.5 * (max(Mean_SL+G%bathyT(i,j+1),0.0) + max(Mean_SL+G%bathyT(i,j),0.0)) * Z_to_H
CS%D_v_Cor(i,J) = 0.5 * ( max(G%meanSL(i,j+1) + G%bathyT(i,j+1), 0.0) &
+ max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) ) * Z_to_H
enddo ; enddo
if (CS%interior_OBC_PV .and. CS%BT_OBC%v_OBCs_on_PE) then ; do J=js-1,je ; do i=is,ie
if (CS%BT_OBC%v_OBC_type(i,J) < 0) & ! Southern boundary condition
CS%D_v_Cor(i,J) = max(Mean_SL+G%bathyT(i,j+1),0.0) * Z_to_H
CS%D_v_Cor(i,J) = max(G%meanSL(i,j+1) + G%bathyT(i,j+1), 0.0) * Z_to_H
if (CS%BT_OBC%v_OBC_type(i,J) > 0) & ! Northern boundary condition
CS%D_v_Cor(i,J) = max(Mean_SL+G%bathyT(i,j),0.0) * Z_to_H
CS%D_v_Cor(i,J) = max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) * Z_to_H
enddo ; enddo ; endif

h_a_neglect = GV%H_subroundoff * 1.0 * US%m_to_L**2
do J=js-1,je ; do I=is-1,ie
if ((CS%q_wt(1,I,J) + CS%q_wt(4,I,J)) + (CS%q_wt(2,I,J) + CS%q_wt(3,I,J)) > 0.) then
CS%q_D(I,J) = 0.25 * (CS%BT_Coriolis_scale * G%CoriolisBu(I,J)) * &
((CS%q_wt(1,I,J) + CS%q_wt(4,I,J)) + (CS%q_wt(2,I,J) + CS%q_wt(3,I,J))) / &
max(Z_to_H * (((CS%q_wt(1,I,J) * max(Mean_SL+G%bathyT(i,j),0.0)) + &
(CS%q_wt(4,I,J) * max(Mean_SL+G%bathyT(i+1,j+1),0.0))) + &
((CS%q_wt(2,I,J) * max(Mean_SL+G%bathyT(i+1,j),0.0)) + &
(CS%q_wt(3,I,J) * max(Mean_SL+G%bathyT(i,j+1),0.0)))), h_a_neglect)
max(Z_to_H * (((CS%q_wt(1,I,J) * max(G%meanSL(i,j) + G%bathyT(i,j), 0.0)) + &
(CS%q_wt(4,I,J) * max(G%meanSL(i+1,j+1) + G%bathyT(i+1,j+1), 0.0))) + &
((CS%q_wt(2,I,J) * max(G%meanSL(i+1,j) + G%bathyT(i+1,j), 0.0)) + &
(CS%q_wt(3,I,J) * max(G%meanSL(i,j+1) + G%bathyT(i,j+1), 0.0)))), &
h_a_neglect)
else ! All four h points are masked out so q_D(I,J) is meaningless
CS%q_D(I,J) = 0.
endif
Expand Down Expand Up @@ -6435,18 +6439,17 @@ subroutine barotropic_init(u, v, h, Time, G, GV, US, param_file, diag, CS, &
! Calculate other constants which are used for btstep.

if (.not.CS%nonlin_stress) then
Mean_SL = G%Z_ref
Z_to_H = GV%Z_to_H ; if (.not.GV%Boussinesq) Z_to_H = GV%RZ_to_H * CS%Rho_BT_lin
do j=js,je ; do I=is-1,ie
htot = max(G%bathyT(i+1,j) + G%Z_ref, 0.0) + max(G%bathyT(i,j) + G%Z_ref, 0.0)
htot = max(G%meanSL(i+1,j) + G%bathyT(i+1,j), 0.0) + max(G%meanSL(i,j) + G%bathyT(i,j), 0.0)
if (G%OBCmaskCu(I,j) * htot > 0.) then
CS%IDatu(I,j) = G%OBCmaskCu(I,j) * 2.0 / (Z_to_H * htot)
else ! Both neighboring H points are masked out or this is an OBC face so IDatu(I,j) is unused
CS%IDatu(I,j) = 0.
endif
enddo ; enddo
do J=js-1,je ; do i=is,ie
htot = max(G%bathyT(i,j+1) + G%Z_ref, 0.0) + max(G%bathyT(i,j) + G%Z_ref, 0.0)
htot = max(G%meanSL(i,j+1) + G%bathyT(i,j+1), 0.0) + max(G%meanSL(i,j) + G%bathyT(i,j), 0.0)
if (G%OBCmaskCv(i,J) * htot > 0.) then
CS%IDatv(i,J) = G%OBCmaskCv(i,J) * 2.0 / (Z_to_H * htot)
else ! Both neighboring H points are masked out or this is an OBC face so IDatv(i,J) is unused
Expand Down
19 changes: 15 additions & 4 deletions src/core/MOM_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,16 @@ module MOM_grid
y_ax_unit_short !< A short description of the y-axis units for documenting parameter units

real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
bathyT !< Ocean bottom depth at tracer points, in depth units [Z ~> m].
bathyT !< Ocean bottom depth, referenced to Z_ref at tracer points. bathyT is in
!! depth units and positive *below* Z_ref [Z ~> m].
real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: &
meanSL !< Spatially varying time mean sea level, referenced to Z_ref at tracer points.
!! meanSL is in height units and positive *above* Z_ref. It is used
!! a) as the height where p = p_atm or zero;
!! b) to calculate time mean thickness of the water column, where
!! mean thickness = max(meanSL + bathyT, 0.0).
!! meanSL is 2D for the consideration of a domain with spatically varying mean
!! height, e.g. the Great Lakes system [Z ~> m].
real :: Z_ref !< A reference value for all geometric height fields, such as bathyT [Z ~> m].

logical :: bathymetry_at_vel !< If true, there are separate values for the
Expand Down Expand Up @@ -584,6 +593,7 @@ subroutine allocate_metrics(G)
ALLOC_(G%IareaCv(isd:ied,JsdB:JedB)) ; G%IareaCv(:,:) = 0.0

ALLOC_(G%bathyT(isd:ied, jsd:jed)) ; G%bathyT(:,:) = -G%Z_ref
ALLOC_(G%meanSL(isd:ied, jsd:jed)) ; G%meanSL(:,:) = G%Z_ref
ALLOC_(G%CoriolisBu(IsdB:IedB, JsdB:JedB)) ; G%CoriolisBu(:,:) = 0.0
ALLOC_(G%Coriolis2Bu(IsdB:IedB, JsdB:JedB)) ; G%Coriolis2Bu(:,:) = 0.0
ALLOC_(G%dF_dx(isd:ied, jsd:jed)) ; G%dF_dx(:,:) = 0.0
Expand Down Expand Up @@ -631,9 +641,10 @@ subroutine MOM_grid_end(G)

DEALLOC_(G%dx_Cv) ; DEALLOC_(G%dy_Cu)

DEALLOC_(G%bathyT) ; DEALLOC_(G%CoriolisBu) ; DEALLOC_(G%Coriolis2Bu)
DEALLOC_(G%dF_dx) ; DEALLOC_(G%dF_dy)
DEALLOC_(G%sin_rot) ; DEALLOC_(G%cos_rot)
DEALLOC_(G%bathyT) ; DEALLOC_(G%meanSL)
DEALLOC_(G%CoriolisBu) ; DEALLOC_(G%Coriolis2Bu)
DEALLOC_(G%dF_dx) ; DEALLOC_(G%dF_dy)
DEALLOC_(G%sin_rot) ; DEALLOC_(G%cos_rot)

DEALLOC_(G%porous_DminU) ; DEALLOC_(G%porous_DmaxU) ; DEALLOC_(G%porous_DavgU)
DEALLOC_(G%porous_DminV) ; DEALLOC_(G%porous_DmaxV) ; DEALLOC_(G%porous_DavgV)
Expand Down
4 changes: 4 additions & 0 deletions src/core/MOM_transcribe_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG, US)
oG%dyT(i,j) = dG%dyT(i+ido,j+jdo)
oG%areaT(i,j) = dG%areaT(i+ido,j+jdo)
oG%bathyT(i,j) = dG%bathyT(i+ido,j+jdo) - oG%Z_ref
oG%meanSL(i,j) = dG%meanSL(i+ido,j+jdo) + oG%Z_ref

oG%dF_dx(i,j) = dG%dF_dx(i+ido,j+jdo)
oG%dF_dy(i,j) = dG%dF_dy(i+ido,j+jdo)
Expand Down Expand Up @@ -145,6 +146,7 @@ subroutine copy_dyngrid_to_MOM_grid(dG, oG, US)
! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(oG%areaT, oG%Domain)
call pass_var(oG%bathyT, oG%Domain)
call pass_var(oG%meanSL, oG%Domain)
call pass_var(oG%geoLonT, oG%Domain)
call pass_var(oG%geoLatT, oG%Domain)
call pass_vector(oG%dxT, oG%dyT, oG%Domain, To_All+Scalar_Pair, AGRID)
Expand Down Expand Up @@ -217,6 +219,7 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG, US)
dG%dyT(i,j) = oG%dyT(i+ido,j+jdo)
dG%areaT(i,j) = oG%areaT(i+ido,j+jdo)
dG%bathyT(i,j) = oG%bathyT(i+ido,j+jdo) + oG%Z_ref
dG%meanSL(i,j) = oG%meanSL(i+ido,j+jdo) - oG%Z_ref

dG%dF_dx(i,j) = oG%dF_dx(i+ido,j+jdo)
dG%dF_dy(i,j) = oG%dF_dy(i+ido,j+jdo)
Expand Down Expand Up @@ -307,6 +310,7 @@ subroutine copy_MOM_grid_to_dyngrid(oG, dG, US)
! Update the halos in case the dynamic grid has smaller halos than the ocean grid.
call pass_var(dG%areaT, dG%Domain)
call pass_var(dG%bathyT, dG%Domain)
call pass_var(dG%meanSL, dG%Domain)
call pass_var(dG%geoLonT, dG%Domain)
call pass_var(dG%geoLatT, dG%Domain)
call pass_vector(dG%dxT, dG%dyT, dG%Domain, To_All+Scalar_Pair, AGRID)
Expand Down
5 changes: 3 additions & 2 deletions src/diagnostics/MOM_wave_speed.F90
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,9 @@ subroutine wave_speed(h, tv, G, GV, US, cg1, CS, halo_size, use_ebt_mode, mono_N
! Determine whether N2 estimates should not be allowed to increase with depth.
if (l_mono_N2_column_fraction>0.) then
if (GV%Boussinesq .or. GV%semi_Boussinesq) then
below_mono_N2_frac = (max(G%bathyT(i,j)+G%Z_ref, 0.0) - GV%H_to_Z*sum_hc < &
l_mono_N2_column_fraction*max(G%bathyT(i,j)+G%Z_ref, 0.0))
below_mono_N2_frac = &
(max(G%meanSL(i,j) + G%bathyT(i,j), 0.0) - GV%H_to_Z * sum_hc < &
l_mono_N2_column_fraction * max(G%meanSL(i,j) + G%bathyT(i,j), 0.0))
else
below_mono_N2_frac = (htot(i) - sum_hc < l_mono_N2_column_fraction*htot(i))
endif
Expand Down
Loading