Skip to content

Commit

Permalink
Address comments from Bob by adding scaling to dimensional numbers, r…
Browse files Browse the repository at this point in the history
…eplacing Boussinesq rho in nonBoussinesq code, and removing white space to follow 2-space indenting.
  • Loading branch information
claireyung committed Feb 6, 2025
1 parent cb86dd5 commit 63fedcd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
10 changes: 6 additions & 4 deletions src/core/MOM_PressureForce_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 283 in src/core/MOM_PressureForce_FV.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_PressureForce_FV.F90#L283

Added line #L283 was not covered by tests

if ((CS%id_MassWt_u > 0) .or. (CS%id_MassWt_v > 0)) then
MassWt_u(:,:,:) = 0.0 ; MassWt_v(:,:,:) = 0.0
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Check warning on line 1192 in src/core/MOM_PressureForce_FV.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_PressureForce_FV.F90#L1192

Added line #L1192 was not covered by tests
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)
Expand Down
20 changes: 10 additions & 10 deletions src/core/MOM_density_integrals.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 285 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L285

Added line #L285 was not covered by tests
endif
if (hWght > 0.) then
hL = (z_t(i,j) - z_b(i,j)) + dz_neglect
Expand Down Expand Up @@ -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

Check warning on line 357 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L357

Added line #L357 was not covered by tests
endif
if (hWght > 0.) then
hL = (z_t(i,j) - z_b(i,j)) + dz_neglect
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Check warning on line 1111 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1111

Added line #L1111 was not covered by tests
endif
if (hWght > 0.) then
hL = (e(i,j,K) - e(i,j,K+1)) + dz_subroundoff
Expand Down Expand Up @@ -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

Check warning on line 1223 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1223

Added line #L1223 was not covered by tests
endif
if (hWght > 0.) then
hL = (e(i,j,K) - e(i,j,K+1)) + dz_subroundoff
Expand Down Expand Up @@ -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

Check warning on line 1554 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1554

Added line #L1554 was not covered by tests
endif

if (hWght > 0.) then
Expand Down Expand Up @@ -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

Check warning on line 1619 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1619

Added line #L1619 was not covered by tests
endif
if (hWght > 0.) then
hL = (p_b(i,j) - p_t(i,j)) + dP_neglect
Expand Down Expand Up @@ -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

Check warning on line 1839 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1839

Added line #L1839 was not covered by tests
endif
if (hWght > 0.) then
hL = (p_b(i,j) - p_t(i,j)) + dP_neglect
Expand Down Expand Up @@ -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

Check warning on line 1909 in src/core/MOM_density_integrals.F90

View check run for this annotation

Codecov / codecov/patch

src/core/MOM_density_integrals.F90#L1909

Added line #L1909 was not covered by tests
endif
if (hWght > 0.) then
hL = (p_b(i,j) - p_t(i,j)) + dP_neglect
Expand Down

0 comments on commit 63fedcd

Please sign in to comment.