From 63fedcd85f3afa816f9fb95f3c1f5d4783db7351 Mon Sep 17 00:00:00 2001 From: Claire Yung Date: Fri, 7 Feb 2025 10:16:39 +1100 Subject: [PATCH] Address comments from Bob by adding scaling to dimensional numbers, replacing Boussinesq rho in nonBoussinesq code, and removing white space to follow 2-space indenting. --- src/core/MOM_PressureForce_FV.F90 | 10 ++++++---- src/core/MOM_density_integrals.F90 | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/core/MOM_PressureForce_FV.F90 b/src/core/MOM_PressureForce_FV.F90 index 250138c770..01ed666f77 100644 --- a/src/core/MOM_PressureForce_FV.F90 +++ b/src/core/MOM_PressureForce_FV.F90 @@ -280,7 +280,7 @@ subroutine PressureForce_FV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_ dp_neglect = GV%g_Earth*GV%H_to_RZ * GV%H_subroundoff alpha_ref = 1.0 / CS%Rho0 I_gEarth = 1.0 / GV%g_Earth - p_nonvanished = GV%g_Earth*CS%Rho0*CS%h_nonvanished + p_nonvanished = GV%g_Earth*GV%H_to_RZ*CS%h_nonvanished if ((CS%id_MassWt_u > 0) .or. (CS%id_MassWt_v > 0)) then MassWt_u(:,:,:) = 0.0 ; MassWt_v(:,:,:) = 0.0 @@ -985,6 +985,7 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm real :: I_g_rho ! The inverse of the density times the gravitational acceleration [Z T2 L-2 R-1 ~> m Pa-1] real :: rho_ref ! The reference density [R ~> kg m-3]. real :: dz_neglect ! A minimal thickness [Z ~> m], like e. + real :: dz_nonvanished ! A small thickness considered to be vanished for mass weighting [Z ~> m] real :: H_to_RL2_T2 ! A factor to convert from thickness units (H) to pressure ! units [R L2 T-2 H-1 ~> Pa m-1 or Pa m2 kg-1]. real :: T5(5) ! Temperatures and salinities at five quadrature points [C ~> degC] @@ -1025,6 +1026,7 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm h_neglect = GV%H_subroundoff dz_neglect = GV%dZ_subroundoff + dz_nonvanished = GV%H_to_Z*CS%h_nonvanished I_Rho0 = 1.0 / GV%Rho0 G_Rho0 = GV%g_Earth / GV%Rho0 GxRho = GV%g_Earth * GV%Rho0 @@ -1180,21 +1182,21 @@ subroutine PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm intx_dpa(:,:,k), inty_dpa(:,:,k), & MassWghtInterp=CS%MassWghtInterp, & use_inaccurate_form=CS%use_inaccurate_pgf_rho_anom, Z_0p=Z_0p, & - MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=CS%h_nonvanished) + MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=dz_nonvanished) elseif ( CS%Recon_Scheme == 2 ) then call int_density_dz_generic_ppm(k, tv, T_t, T_b, S_t, S_b, e, & rho_ref, CS%Rho0, GV%g_Earth, dz_neglect, G%bathyT, & G%HI, GV, tv%eqn_of_state, US, CS%use_stanley_pgf, dpa(:,:,k), intz_dpa(:,:,k), & intx_dpa(:,:,k), inty_dpa(:,:,k), & MassWghtInterp=CS%MassWghtInterp, Z_0p=Z_0p, & - MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=CS%h_nonvanished) + MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=dz_nonvanished) endif else call int_density_dz(tv_tmp%T(:,:,k), tv_tmp%S(:,:,k), e(:,:,K), e(:,:,K+1), & rho_ref, CS%Rho0, GV%g_Earth, G%HI, tv%eqn_of_state, US, dpa(:,:,k), & intz_dpa(:,:,k), intx_dpa(:,:,k), inty_dpa(:,:,k), G%bathyT, e(:,:,1), dz_neglect, & CS%MassWghtInterp, Z_0p=Z_0p, & - MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=CS%h_nonvanished) + MassWghtInterpVanOnly=CS%MassWghtInterpVanOnly, h_nv=dz_nonvanished) endif if (GV%Z_to_H /= 1.0) then !$OMP parallel do default(shared) diff --git a/src/core/MOM_density_integrals.F90 b/src/core/MOM_density_integrals.F90 index bd87acd27c..c9c227686c 100644 --- a/src/core/MOM_density_integrals.F90 +++ b/src/core/MOM_density_integrals.F90 @@ -282,7 +282,7 @@ subroutine int_density_dz_generic_pcm(T, S, z_t, z_b, rho_ref, rho_0, G_e, HI, & hWght = max(hWght, z_b(i+1,j)-SSH(i,j), z_b(i,j)-SSH(i+1,j)) ! If both sides are nonvanished, then set it back to zero. if (((z_t(i,j) - z_b(i,j)) > h_nonvanished) .and. ((z_t(i+1,j) - z_b(i+1,j)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (z_t(i,j) - z_b(i,j)) + dz_neglect @@ -354,7 +354,7 @@ subroutine int_density_dz_generic_pcm(T, S, z_t, z_b, rho_ref, rho_0, G_e, HI, & hWght = max(hWght, z_b(i,j+1)-SSH(i,j), z_b(i,j)-SSH(i,j+1)) ! If both sides are nonvanished, then set it back to zero. if (((z_t(i,j) - z_b(i,j)) > h_nonvanished) .and. ((z_t(i,j+1) - z_b(i,j+1)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (z_t(i,j) - z_b(i,j)) + dz_neglect @@ -666,7 +666,7 @@ subroutine int_density_dz_generic_plm(k, tv, T_t, T_b, S_t, S_b, e, rho_ref, & hWght = max(hWght, hWghtTop) ! If both sides are nonvanished, then set it back to zero. if (((e(i,j,K) - e(i,j,K+1)) > h_nonvanished) .and. ((e(i+1,j,K) - e(i+1,j,K+1)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (e(i,j,K) - e(i,j,K+1)) + dz_subroundoff @@ -777,7 +777,7 @@ subroutine int_density_dz_generic_plm(k, tv, T_t, T_b, S_t, S_b, e, rho_ref, & hWght = max(hWght, hWghtTop) ! If both sides are nonvanished, then set it back to zero. if (((e(i,j,K) - e(i,j,K+1)) > h_nonvanished) .and. ((e(i,j+1,K) - e(i,j+1,K+1)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then @@ -1108,7 +1108,7 @@ subroutine int_density_dz_generic_ppm(k, tv, T_t, T_b, S_t, S_b, e, & hWght = max(hWght, hWghtTop) ! If both sides are nonvanished, then set it back to zero. if (((e(i,j,K) - e(i,j,K+1)) > h_nonvanished) .and. ((e(i+1,j,K) - e(i+1,j,K+1)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (e(i,j,K) - e(i,j,K+1)) + dz_subroundoff @@ -1220,7 +1220,7 @@ subroutine int_density_dz_generic_ppm(k, tv, T_t, T_b, S_t, S_b, e, & hWght = max(hWght, hWghtTop) ! If both sides are nonvanished, then set it back to zero. if (((e(i,j,K) - e(i,j,K+1)) > h_nonvanished) .and. ((e(i,j+1,K) - e(i,j+1,K+1)) > h_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (e(i,j,K) - e(i,j,K+1)) + dz_subroundoff @@ -1551,7 +1551,7 @@ subroutine int_spec_vol_dp_generic_pcm(T, S, p_t, p_b, alpha_ref, HI, EOS, US, d hWght = max(hWght, P_surf(i,j)-p_b(i+1,j), P_surf(i+1,j)-p_b(i,j)) ! If both sides are nonvanished, then set it back to zero. if (((p_b(i,j) - p_t(i,j)) > p_nonvanished) .and. ((p_b(i+1,j) - p_t(i+1,j)) > p_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then @@ -1616,7 +1616,7 @@ subroutine int_spec_vol_dp_generic_pcm(T, S, p_t, p_b, alpha_ref, HI, EOS, US, d hWght = max(hWght, P_surf(i,j)-p_b(i,j+1), P_surf(i,j+1)-p_b(i,j)) ! If both sides are nonvanished, then set it back to zero. if (((p_b(i,j) - p_t(i,j)) > p_nonvanished) .and. ((p_b(i,j+1) - p_t(i,j+1)) > p_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (p_b(i,j) - p_t(i,j)) + dP_neglect @@ -1836,7 +1836,7 @@ subroutine int_spec_vol_dp_generic_plm(T_t, T_b, S_t, S_b, p_t, p_b, alpha_ref, hWght = max(hWght, P_surf(i,j)-p_b(i+1,j), P_surf(i+1,j)-p_b(i,j)) ! If both sides are nonvanished, then set it back to zero. if (((p_b(i,j) - p_t(i,j)) > p_nonvanished) .and. ((p_b(i+1,j) - p_t(i+1,j)) > p_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (p_b(i,j) - p_t(i,j)) + dP_neglect @@ -1906,7 +1906,7 @@ subroutine int_spec_vol_dp_generic_plm(T_t, T_b, S_t, S_b, p_t, p_b, alpha_ref, hWght = max(hWght, P_surf(i,j)-p_b(i,j+1), P_surf(i,j+1)-p_b(i,j)) ! If both sides are nonvanished, then set it back to zero. if (((p_b(i,j) - p_t(i,j)) > p_nonvanished) .and. ((p_b(i,j+1) - p_t(i,j+1)) > p_nonvanished)) then - hWght = massWeightNVonlyToggle * hWght + hWght = massWeightNVonlyToggle * hWght endif if (hWght > 0.) then hL = (p_b(i,j) - p_t(i,j)) + dP_neglect