Skip to content

Commit

Permalink
+Rescaled density units of cTKE arguments
Browse files Browse the repository at this point in the history
  Rescaled the density units of the cTKE or TKE_forced variables passed to
energetic_PBL and applyBoundaryFluxesInOut for dimensional consistency testing.
All answers are bitwise identical, but the units of an argument to two public
interfaces have changed.
  • Loading branch information
Hallberg-NOAA committed Sep 29, 2019
1 parent 68e322b commit 5122e33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/parameterizations/vertical/MOM_diabatic_aux.F90
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt, fluxes, optics, nsw, h, t
!! heat and freshwater fluxes is applied [m].
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
optional, intent(out) :: cTKE !< Turbulent kinetic energy requirement to mix
!! forcing through each layer [kg m-3 Z3 T-2 ~> J m-2]
!! forcing through each layer [R Z3 T-2 ~> J m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
optional, intent(out) :: dSV_dT !< Partial derivative of specific volume with
!! potential temperature [m3 kg-1 degC-1].
Expand Down Expand Up @@ -946,7 +946,7 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt, fluxes, optics, nsw, h, t
calculate_buoyancy = present(SkinBuoyFlux)
if (calculate_buoyancy) SkinBuoyFlux(:,:) = 0.0
! I_G_Earth = US%Z_to_m / (US%L_T_to_m_s**2 * GV%g_Earth)
g_Hconv2 = (US%m_to_Z**3 * US%T_to_s**2) * GV%H_to_Pa * GV%H_to_kg_m2
g_Hconv2 = (US%m_to_Z**3 * US%T_to_s**2) * GV%H_to_Pa * GV%H_to_kg_m2*US%kg_m3_to_R

if (present(cTKE)) cTKE(:,:,:) = 0.0
if (calculate_buoyancy) then
Expand Down Expand Up @@ -1136,7 +1136,7 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt, fluxes, optics, nsw, h, t
! Sriver = 0 (i.e. rivers are assumed to be pure freshwater)
RivermixConst = -0.5*(CS%rivermix_depth*dt)*(US%m_to_Z**3 * US%T_to_s**2) * GV%Z_to_H*GV%H_to_Pa

cTKE(i,j,k) = cTKE(i,j,k) + max(0.0, RivermixConst*dSV_dS(i,j,1) * &
cTKE(i,j,k) = cTKE(i,j,k) + max(0.0, RivermixConst*US%kg_m3_to_R*dSV_dS(i,j,1) * &
(fluxes%lrunoff(i,j) + fluxes%frunoff(i,j)) * tv%S(i,j,1))
endif

Expand Down Expand Up @@ -1283,7 +1283,7 @@ subroutine applyBoundaryFluxesInOut(CS, G, GV, US, dt, fluxes, optics, nsw, h, t
.false., .true., T2d, Pen_SW_bnd, TKE=pen_TKE_2d, dSV_dT=dSV_dT_2d)
k = 1 ! For setting break-points.
do k=1,nz ; do i=is,ie
cTKE(i,j,k) = cTKE(i,j,k) + pen_TKE_2d(i,k)
cTKE(i,j,k) = cTKE(i,j,k) + US%kg_m3_to_R*pen_TKE_2d(i,k)
enddo ; enddo
else
call absorbRemainingSW(G, GV, US, h2d, opacityBand, nsw, optics, j, dt_in_T, H_limit_fluxes, &
Expand Down
10 changes: 6 additions & 4 deletions src/parameterizations/vertical/MOM_diabatic_driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ subroutine diabatic_ALE_legacy(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Tim
! [H ~> m or kg m-2]
dSV_dT, & ! The partial derivative of specific volume with temperature [m3 kg-1 degC-1]
dSV_dS, & ! The partial derivative of specific volume with salinity [m3 kg-1 ppt-1].
cTKE, & ! convective TKE requirements for each layer [kg m-3 Z3 T-2 ~> J m-2].
cTKE, & ! convective TKE requirements for each layer [R Z3 T-2 ~> J m-2].
u_h, & ! zonal and meridional velocities at thickness points after
v_h ! entrainment [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G)) :: &
Expand Down Expand Up @@ -835,7 +835,8 @@ subroutine diabatic_ALE_legacy(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Tim
call hchksum(eb_t, "after applyBoundaryFluxes eb_t",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(ea_s, "after applyBoundaryFluxes ea_s",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(eb_s, "after applyBoundaryFluxes eb_s",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(cTKE, "after applyBoundaryFluxes cTKE",G%HI,haloshift=0)
call hchksum(cTKE, "after applyBoundaryFluxes cTKE",G%HI,haloshift=0, &
scale=US%R_to_kg_m3*US%Z_to_m**3*US%s_to_T**2)
call hchksum(dSV_dT, "after applyBoundaryFluxes dSV_dT",G%HI,haloshift=0)
call hchksum(dSV_dS, "after applyBoundaryFluxes dSV_dS",G%HI,haloshift=0)
endif
Expand Down Expand Up @@ -1268,7 +1269,7 @@ subroutine diabatic_ALE(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end,
! [H ~> m or kg m-2]
dSV_dT, & ! The partial derivative of specific volume with temperature [m3 kg-1 degC-1]
dSV_dS, & ! The partial derivative of specific volume with salinity [m3 kg-1 ppt-1].
cTKE, & ! convective TKE requirements for each layer [kg m-3 Z3 T-2 ~> J m-2].
cTKE, & ! convective TKE requirements for each layer [R Z3 T-2 ~> J m-2].
u_h, & ! zonal and meridional velocities at thickness points after
v_h ! entrainment [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G)) :: &
Expand Down Expand Up @@ -1565,7 +1566,8 @@ subroutine diabatic_ALE(u, v, h, tv, Hml, fluxes, visc, ADp, CDp, dt, Time_end,
call hchksum(eb_t, "after applyBoundaryFluxes eb_t",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(ea_s, "after applyBoundaryFluxes ea_s",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(eb_s, "after applyBoundaryFluxes eb_s",G%HI,haloshift=0, scale=GV%H_to_m)
call hchksum(cTKE, "after applyBoundaryFluxes cTKE",G%HI,haloshift=0)
call hchksum(cTKE, "after applyBoundaryFluxes cTKE",G%HI,haloshift=0, &
scale=US%R_to_kg_m3*US%Z_to_m**3*US%s_to_T**2)
call hchksum(dSV_dT, "after applyBoundaryFluxes dSV_dT",G%HI,haloshift=0)
call hchksum(dSV_dS, "after applyBoundaryFluxes dSV_dS",G%HI,haloshift=0)
endif
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ subroutine energetic_PBL(h_3d, u_3d, v_3d, tv, fluxes, dt, Kd_int, G, GV, US, CS
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
intent(in) :: TKE_forced !< The forcing requirements to homogenize the
!! forcing that has been applied to each layer
!! [kg m-3 Z3 T-2 ~> J m-2].
!! [R Z3 T-2 ~> J m-2].
type(thermo_var_ptrs), intent(inout) :: tv !< A structure containing pointers to any
!! available thermodynamic fields. Absent fields
!! have NULL ptrs.
Expand Down Expand Up @@ -406,7 +406,7 @@ subroutine energetic_PBL(h_3d, u_3d, v_3d, tv, fluxes, dt, Kd_int, G, GV, US, CS
do k=1,nz ; do i=is,ie
h_2d(i,k) = h_3d(i,j,k) ; u_2d(i,k) = u_3d(i,j,k) ; v_2d(i,k) = v_3d(i,j,k)
T_2d(i,k) = tv%T(i,j,k) ; S_2d(i,k) = tv%S(i,j,k)
TKE_forced_2d(i,k) = US%kg_m3_to_R*TKE_forced(i,j,k)
TKE_forced_2d(i,k) = TKE_forced(i,j,k)
dSV_dT_2d(i,k) = US%R_to_kg_m3*dSV_dT(i,j,k) ; dSV_dS_2d(i,k) = US%R_to_kg_m3*dSV_dS(i,j,k)
enddo ; enddo

Expand Down

0 comments on commit 5122e33

Please sign in to comment.