Skip to content

Commit

Permalink
Correction of documented units in comments
Browse files Browse the repository at this point in the history
  Corrected some units in comments and eliminated some unused variables.
All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Nov 15, 2019
1 parent 6e115b7 commit c741390
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 72 deletions.
6 changes: 3 additions & 3 deletions src/core/MOM_variables.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ module MOM_variables
dv_dt_dia => NULL() !< Meridional acceleration due to diapycnal mixing [L T-2 ~> m s-2]
real, pointer, dimension(:,:,:) :: du_other => NULL()
!< Zonal velocity changes due to any other processes that are
!! not due to any explicit accelerations [m s-1].
!! not due to any explicit accelerations [L T-1 ~> m s-1].
real, pointer, dimension(:,:,:) :: dv_other => NULL()
!< Meridional velocity changes due to any other processes that are
!! not due to any explicit accelerations [m s-1].
!< Meridional velocity changes due to any other processes that are
!! not due to any explicit accelerations [L T-1 ~> m s-1].

! These accelerations are sub-terms included in the accelerations above.
real, pointer :: gradKEu(:,:,:) => NULL() !< gradKEu = - d/dx(u2) [L T-2 ~> m s-2]
Expand Down
8 changes: 4 additions & 4 deletions src/diagnostics/MOM_PointAccel.F90
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ subroutine write_u_accel(I, j, um, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rp
if (associated(ADp%du_other)) then
write(file,'(/,"du_other: ",$)')
do k=ks,ke ; if (do_k(k)) write(file,'(ES10.3," ",$)') &
(ADp%du_other(I,j,k)); enddo
(US%L_T_to_m_s*ADp%du_other(I,j,k)); enddo
endif
if (present(a)) then
write(file,'(/,"a: ",$)')
Expand Down Expand Up @@ -379,7 +379,7 @@ subroutine write_u_accel(I, j, um, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rp
if (associated(ADp%du_other)) then
write(file,'(/,"du_other: ",$)')
do k=ks,ke ; if (do_k(k)) write(file,'(F10.6," ",$)') &
(ADp%du_other(I,j,k))*Inorm(k); enddo
(US%L_T_to_m_s*ADp%du_other(I,j,k))*Inorm(k); enddo
endif
if (associated(CS%u_accel_bt)) then
write(file,'(/,"dubt: ",$)')
Expand Down Expand Up @@ -553,7 +553,7 @@ subroutine write_v_accel(i, J, vm, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rp
if (associated(ADp%dv_other)) then
write(file,'(/,"dv_other: ",$)')
do k=ks,ke ; if (do_k(k)) write(file,'(ES10.3," ",$)') &
(ADp%dv_other(i,J,k)); enddo
(US%L_T_to_m_s*ADp%dv_other(i,J,k)); enddo
endif
if (present(a)) then
write(file,'(/,"a: ",$)')
Expand Down Expand Up @@ -711,7 +711,7 @@ subroutine write_v_accel(i, J, vm, hin, ADp, CDp, dt_in_T, G, GV, US, CS, vel_rp
if (associated(ADp%dv_other)) then
write(file,'(/,"dv_other: ",$)')
do k=ks,ke ; if (do_k(k)) write(file,'(F10.6," ",$)') &
(ADp%dv_other(i,J,k)*Inorm(k)); enddo
(US%L_T_to_m_s*ADp%dv_other(i,J,k)*Inorm(k)); enddo
endif
if (associated(CS%v_accel_bt)) then
write(file,'(/,"dvbt: ",$)')
Expand Down
6 changes: 3 additions & 3 deletions src/diagnostics/MOM_diagnostics.F90
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ end subroutine calculate_diagnostic_fields
!! weights that should be assigned to elements k and k+1.
subroutine find_weights(Rlist, R_in, k, nz, wt, wt_p)
real, dimension(:), &
intent(in) :: Rlist !< The list of target densities [kg m-3]
real, intent(in) :: R_in !< The density being inserted into Rlist [kg m-3]
intent(in) :: Rlist !< The list of target densities [R ~> kg m-3]
real, intent(in) :: R_in !< The density being inserted into Rlist [R ~> kg m-3]
integer, intent(inout) :: k !< The value of k such that Rlist(k) <= R_in < Rlist(k+1)
!! The input value is a first guess
integer, intent(in) :: nz !< The number of layers in Rlist
Expand Down Expand Up @@ -1359,7 +1359,7 @@ subroutine post_transport_diagnostics(G, GV, US, uhtr, vhtr, h, IDs, diag_pre_dy
! [H s-1 ~> m s-1 or kg m-2 s-1].
real :: Idt ! The inverse of the time interval [T-1 ~> s-1]
real :: H_to_kg_m2_dt ! A conversion factor from accumulated transports to fluxes
! [kg L-2 H-1 s-1 ~> kg m-3 s-1 or s-1].
! [kg L-2 H-1 T-1 ~> kg m-3 s-1 or s-1].
integer :: i, j, k, is, ie, js, je, nz
is = G%isc ; ie = G%iec ; js = G%jsc ; je = G%jec ; nz = G%ke

Expand Down
12 changes: 6 additions & 6 deletions src/parameterizations/lateral/MOM_MEKE.F90
Original file line number Diff line number Diff line change
Expand Up @@ -358,20 +358,20 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
! Calculate Laplacian of MEKE
!$OMP parallel do default(shared)
do j=js-1,je+1 ; do I=is-2,ie+1
! Here the units of MEKE_uflux are [L2 T-2].
! Here the units of MEKE_uflux are [L2 T-2 ~> m2 s-2].
MEKE_uflux(I,j) = ((G%dy_Cu(I,j)*G%IdxCu(I,j)) * G%mask2dCu(I,j)) * &
(MEKE%MEKE(i+1,j) - MEKE%MEKE(i,j))
! This would have units of [R Z L2 T-2]
! This would have units of [R Z L2 T-2 ~> kg s-2]
! MEKE_uflux(I,j) = ((G%dy_Cu(I,j)*G%IdxCu(I,j)) * &
! ((2.0*mass(i,j)*mass(i+1,j)) / ((mass(i,j)+mass(i+1,j)) + mass_neglect)) ) * &
! (MEKE%MEKE(i+1,j) - MEKE%MEKE(i,j))
enddo ; enddo
!$OMP parallel do default(shared)
do J=js-2,je+1 ; do i=is-1,ie+1
! Here the units of MEKE_vflux are [L2 T-2].
! Here the units of MEKE_vflux are [L2 T-2 ~> m2 s-2].
MEKE_vflux(i,J) = ((G%dx_Cv(i,J)*G%IdyCv(i,J)) * G%mask2dCv(i,J)) * &
(MEKE%MEKE(i,j+1) - MEKE%MEKE(i,j))
! This would have units of [R Z L2 T-2]
! This would have units of [R Z L2 T-2 ~> kg s-2]
! MEKE_vflux(i,J) = ((G%dx_Cv(i,J)*G%IdyCv(i,J)) * &
! ((2.0*mass(i,j)*mass(i,j+1)) / ((mass(i,j)+mass(i,j+1)) + mass_neglect)) ) * &
! (MEKE%MEKE(i,j+1) - MEKE%MEKE(i,j))
Expand Down Expand Up @@ -436,7 +436,7 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
if (Kh_here*Inv_Kh_max > 0.25) Kh_here = 0.25 / Inv_Kh_max
Kh_u(I,j) = Kh_here

! Here the units of MEKE_uflux and MEKE_vflux are [R Z L4 T-3].
! Here the units of MEKE_uflux and MEKE_vflux are [R Z L4 T-3 ~> kg m2 s-3].
MEKE_uflux(I,j) = ((Kh_here * (G%dy_Cu(I,j)*G%IdxCu(I,j))) * &
((2.0*mass(i,j)*mass(i+1,j)) / ((mass(i,j)+mass(i+1,j)) + mass_neglect)) ) * &
(MEKE%MEKE(i,j) - MEKE%MEKE(i+1,j))
Expand All @@ -451,7 +451,7 @@ subroutine step_forward_MEKE(MEKE, h, SN_u, SN_v, visc, dt, G, GV, US, CS, hu, h
if (Kh_here*Inv_Kh_max > 0.25) Kh_here = 0.25 / Inv_Kh_max
Kh_v(i,J) = Kh_here

! Here the units of MEKE_uflux and MEKE_vflux are [R Z L4 T-3].
! Here the units of MEKE_uflux and MEKE_vflux are [R Z L4 T-3 ~> kg m2 s-3].
MEKE_vflux(i,J) = ((Kh_here * (G%dx_Cv(i,J)*G%IdyCv(i,J))) * &
((2.0*mass(i,j)*mass(i,j+1)) / ((mass(i,j)+mass(i,j+1)) + mass_neglect)) ) * &
(MEKE%MEKE(i,j) - MEKE%MEKE(i,j+1))
Expand Down
20 changes: 10 additions & 10 deletions src/parameterizations/lateral/MOM_hor_visc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ module MOM_hor_visc
!! answers from the end of 2018. Otherwise, use updated and more robust
!! forms of the same expressions.
real :: GME_h0 !< The strength of GME tapers quadratically to zero when the bathymetric
!! depth is shallower than GME_H0 [m]
!! depth is shallower than GME_H0 [Z ~> m]
real :: GME_efficiency !< The nondimensional prefactor multiplying the GME coefficient [nondim]
real :: GME_limiter !< The absolute maximum value the GME coefficient is allowed to take [m2 s-1].
real :: GME_limiter !< The absolute maximum value the GME coefficient is allowed to take [L2 T-1 ~> m2 s-1].

real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: Kh_bg_xx
!< The background Laplacian viscosity at h points [L2 T-1 ~> m2 s-1].
Expand All @@ -101,9 +101,9 @@ module MOM_hor_visc
!< The background biharmonic viscosity at h points [L4 T-1 ~> m4 s-1].
!! The actual viscosity may be the larger of this
!! viscosity and the Smagorinsky and Leith viscosities.
real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: Biharm5_const2_xx
! real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: Biharm5_const2_xx
!< A constant relating the biharmonic viscosity to the
!! square of the velocity shear [m4 s]. This value is
!! square of the velocity shear [L4 T ~> m4 s]. This value is
!! set to be the magnitude of the Coriolis terms once the
!! velocity differences reach a value of order 1/2 MAXVEL.
real ALLOCABLE_, dimension(NIMEM_,NJMEM_) :: reduction_xx
Expand All @@ -123,9 +123,9 @@ module MOM_hor_visc
!< The background biharmonic viscosity at q points [L4 T-1 ~> m4 s-1].
!! The actual viscosity may be the larger of this
!! viscosity and the Smagorinsky and Leith viscosities.
real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEMB_PTR_) :: Biharm5_const2_xy
! real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEMB_PTR_) :: Biharm5_const2_xy
!< A constant relating the biharmonic viscosity to the
!! square of the velocity shear [m4 s]. This value is
!! square of the velocity shear [L4 T ~> m4 s]. This value is
!! set to be the magnitude of the Coriolis terms once the
!! velocity differences reach a value of order 1/2 MAXVEL.
real ALLOCABLE_, dimension(NIMEMB_PTR_,NJMEMB_PTR_) :: reduction_xy
Expand Down Expand Up @@ -1234,7 +1234,7 @@ subroutine horizontal_viscosity(u, v, h, diffu, diffv, MEKE, VarMix, G, GV, US,

! Make a similar calculation as for FrictWork above but accumulating into
! the vertically integrated MEKE source term, and adjusting for any
! energy loss seen as a reduction in the [biharmonic] frictional source term.
! energy loss seen as a reduction in the (biharmonic) frictional source term.
if (find_FrictWork .and. associated(MEKE)) then ; if (associated(MEKE%mom_src)) then
if (k==1) then
do j=js,je ; do i=is,ie
Expand Down Expand Up @@ -2239,9 +2239,9 @@ subroutine hor_visc_end(CS)
endif
if (CS%Smagorinsky_Ah) then
DEALLOC_(CS%Biharm5_const_xx) ; DEALLOC_(CS%Biharm5_const_xy)
if (CS%bound_Coriolis) then
DEALLOC_(CS%Biharm5_const2_xx) ; DEALLOC_(CS%Biharm5_const2_xy)
endif
! if (CS%bound_Coriolis) then
! DEALLOC_(CS%Biharm5_const2_xx) ; DEALLOC_(CS%Biharm5_const2_xy)
! endif
endif
if (CS%Leith_Ah) then
DEALLOC_(CS%Biharm_const_xx) ; DEALLOC_(CS%Biharm_const_xy)
Expand Down
14 changes: 7 additions & 7 deletions src/parameterizations/lateral/MOM_internal_tides.F90
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ subroutine propagate_int_tide(h, tv, cn, TKE_itidal_input, vel_btTide, Nb, dt, &
test
real, dimension(SZI_(G),SZJ_(G),CS%nFreq,CS%nMode) :: &
tot_En_mode, & ! energy summed over angles only [R Z3 T-2 ~> J m-2]
Ub, & ! near-bottom horizontal velocity of wave (modal) [m s-1]
Ub, & ! near-bottom horizontal velocity of wave (modal) [L T-1 ~> m s-1]
Umax ! Maximum horizontal velocity of wave (modal) [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJB_(G)) :: &
flux_heat_y, &
Expand All @@ -191,7 +191,7 @@ subroutine propagate_int_tide(h, tv, cn, TKE_itidal_input, vel_btTide, Nb, dt, &
real :: I_D_here ! The inverse of the local depth [Z-1 ~> m-1]
real :: I_rho0 ! The inverse fo the Boussinesq density [R-1 ~> m3 kg-1]
real :: freq2 ! The frequency squared [T-2 ~> s-2]
real :: c_phase ! The phase speed [m s-1]
real :: c_phase ! The phase speed [L T-1 ~> m s-1]
real :: loss_rate ! An energy loss rate [T-1 ~> s-1]
real :: Fr2_max
real :: cn_subRO ! A tiny wave speed to prevent division by zero [L T-1 ~> m s-1]
Expand Down Expand Up @@ -772,8 +772,8 @@ subroutine refract(En, cn, freq, dt, G, US, NAngle, use_PPMang)
real :: f2 ! The squared Coriolis parameter [T-2 ~> s-2].
real :: favg ! The average Coriolis parameter at a point [T-1 ~> s-1].
real :: df_dy, df_dx ! The x- and y- gradients of the Coriolis parameter [T-1 L-1 ~> s-1 m-1].
real :: dlnCn_dx ! The x-gradient of the wave speed divided by itself [m-1].
real :: dlnCn_dy ! The y-gradient of the wave speed divided by itself [m-1].
real :: dlnCn_dx ! The x-gradient of the wave speed divided by itself [L-1 ~> m-1].
real :: dlnCn_dy ! The y-gradient of the wave speed divided by itself [L-1 ~> m-1].
real :: Angle_size, dt_Angle_size, angle
real :: Ifreq, Kmag2, I_Kmag
real :: cn_subRO ! A tiny wave speed to prevent division by zero [L T-1 ~> m s-1]
Expand Down Expand Up @@ -980,7 +980,7 @@ subroutine propagate(En, cn, freq, dt, G, US, CS, NAngle)
cos_angle, sin_angle
real, dimension(NAngle) :: &
Cgx_av, Cgy_av, dCgx, dCgy
real :: f2 ! The squared Coriolis parameter [s-2].
real :: f2 ! The squared Coriolis parameter [T-2 ~> s-2].
real :: Angle_size, I_Angle_size, angle
real :: Ifreq ! The inverse of the frequency [T ~> s]
real :: freq2 ! The frequency squared [T-2 ~> s-2]
Expand Down Expand Up @@ -1367,7 +1367,7 @@ subroutine propagate_x(En, speed_x, Cgx_av, dCgx, dt, G, US, Nangle, CS, LB)
real, dimension(SZI_(G),SZJ_(G)) :: &
EnL, EnR ! Left and right face energy densities [R Z3 T-2 ~> J m-2].
real, dimension(SZIB_(G),SZJ_(G)) :: &
flux_x ! The internal wave energy flux [J s-1].
flux_x ! The internal wave energy flux [J T-1 ~> J s-1].
real, dimension(SZIB_(G)) :: &
cg_p, cg_m, flux1, flux2
!real, dimension(SZI_(G),SZJB_(G),Nangle) :: En_m, En_p
Expand Down Expand Up @@ -1442,7 +1442,7 @@ subroutine propagate_y(En, speed_y, Cgy_av, dCgy, dt, G, US, Nangle, CS, LB)
real, dimension(SZI_(G),SZJ_(G)) :: &
EnL, EnR ! South and north face energy densities [R Z3 T-2 ~> J m-2].
real, dimension(SZI_(G),SZJB_(G)) :: &
flux_y ! The internal wave energy flux [J s-1].
flux_y ! The internal wave energy flux [J T-1 ~> J s-1].
real, dimension(SZI_(G)) :: &
cg_p, cg_m, flux1, flux2
!real, dimension(SZI_(G),SZJB_(G),Nangle) :: En_m, En_p
Expand Down
26 changes: 10 additions & 16 deletions src/parameterizations/lateral/MOM_lateral_mixing_coeffs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ subroutine calc_QG_Leith_viscosity(CS, G, GV, US, h, k, div_xx_dx, div_xx_dy, vo
type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
! real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal flow [m s-1]
! real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional flow [m s-1]
! real, dimension(SZIB_(G),SZJ_(G),SZK_(G)), intent(in) :: u !< Zonal flow [L T-1 ~> m s-1]
! real, dimension(SZI_(G),SZJB_(G),SZK_(G)), intent(in) :: v !< Meridional flow [L T-1 ~> m s-1]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), intent(inout) :: h !< Layer thickness [H ~> m or kg m-2]
integer, intent(in) :: k !< Layer for which to calculate vorticity magnitude
real, dimension(SZIB_(G),SZJ_(G)), intent(in) :: div_xx_dx !< x-derivative of horizontal divergence
Expand All @@ -721,38 +721,31 @@ subroutine calc_QG_Leith_viscosity(CS, G, GV, US, h, k, div_xx_dx, div_xx_dy, vo
real, dimension(SZIB_(G),SZJ_(G)), intent(inout) :: vort_xy_dy !< y-derivative of vertical vorticity
!! (d/dy(dv/dx - du/dy)) [L-1 T-1 ~> m-1 s-1]
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Kh_h !< Leith Laplacian viscosity
!! at h-points [m2 s-1]
!! at h-points [L2 T-1 ~> m2 s-1]
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Kh_q !< Leith Laplacian viscosity
!! at q-points [m2 s-1]
!! at q-points [L2 T-1 ~> m2 s-1]
! real, dimension(SZI_(G),SZJ_(G)), intent(out) :: Leith_Ah_h !< Leith bi-harmonic viscosity
!! at h-points [m4 s-1]
!! at h-points [L4 T-1 ~> m4 s-1]
! real, dimension(SZIB_(G),SZJB_(G)), intent(out) :: Leith_Ah_q !< Leith bi-harmonic viscosity
!! at q-points [m4 s-1]
!! at q-points [L4 T-1 ~> m4 s-1]

! Local variables
! real, dimension(SZIB_(G),SZJB_(G)) :: vort_xy, & ! Vertical vorticity (dv/dx - du/dy) [s-1]
! dudy, & ! Meridional shear of zonal velocity [s-1]
! dvdx ! Zonal shear of meridional velocity [s-1]
real, dimension(SZI_(G),SZJB_(G)) :: &
! vort_xy_dx, & ! x-derivative of vertical vorticity (d/dx(dv/dx - du/dy)) [L-1 T-1 ~> m-1 s-1]
! div_xx_dy, & ! y-derivative of horizontal divergence (d/dy(du/dx + dv/dy)) [L-1 T-1 ~> m-1 s-1]
dslopey_dz, & ! z-derivative of y-slope at v-points [Z-1 ~> m-1]
h_at_v, & ! Thickness at v-points [H ~> m or kg m-2]
beta_v, & ! Beta at v-points [T-1 L-1 ~> s-1 m-1]
grad_vort_mag_v, & ! Magnitude of vorticity gradient at v-points [T-1 L-1 ~> s-1 m-1]
grad_div_mag_v ! Magnitude of divergence gradient at v-points [T-1 L-1 ~> s-1 m-1]

real, dimension(SZIB_(G),SZJ_(G)) :: &
! vort_xy_dy, & ! y-derivative of vertical vorticity (d/dy(dv/dx - du/dy)) [L-1 T-1 ~> m-1 s-1]
! div_xx_dx, & ! x-derivative of horizontal divergence (d/dx(du/dx + dv/dy)) [L-1 T-1 ~> m-1 s-1]
dslopex_dz, & ! z-derivative of x-slope at u-points [Z-1 ~> m-1]
h_at_u, & ! Thickness at u-points [H ~> m or kg m-2]
beta_u, & ! Beta at u-points [T-1 L-1 ~> s-1 m-1]
grad_vort_mag_u, & ! Magnitude of vorticity gradient at u-points [T-1 L-1 ~> s-1 m-1]
grad_div_mag_u ! Magnitude of divergence gradient at u-points [T-1 L-1 ~> s-1 m-1]
! real, dimension(SZI_(G),SZJ_(G)) :: div_xx ! Estimate of horizontal divergence at h-points [s-1]
! real :: mod_Leith, DY_dxBu, DX_dyBu, vert_vort_mag
real :: h_at_slope_above, h_at_slope_below, Ih
real :: h_at_slope_above ! The thickness above [H ~> m or kg m-2]
real :: h_at_slope_below ! The thickness below [H ~> m or kg m-2]
real :: Ih ! The inverse of a combination of thicknesses [H-1 ~> m-1 or m2 kg-1]
real :: f ! A copy of the Coriolis parameter [T-1 ~> s-1]
integer :: i, j, is, ie, js, je, Isq, Ieq, Jsq, Jeq,nz
real :: inv_PI3
Expand Down Expand Up @@ -1052,6 +1045,7 @@ subroutine VarMix_init(Time, G, GV, US, param_file, diag, CS)
'Square of Brunt-Vaisala frequency, N^2, at u-points, as used in Visbeck et al.', 's-2')
CS%id_N2_v = register_diag_field('ocean_model', 'N2_v', diag%axesCvi, Time, &
'Square of Brunt-Vaisala frequency, N^2, at v-points, as used in Visbeck et al.', 's-2')
!### The units of the next two diagnostics should be 'nondim'.
CS%id_S2_u = register_diag_field('ocean_model', 'S2_u', diag%axesCu1, Time, &
'Depth average square of slope magnitude, S^2, at u-points, as used in Visbeck et al.', 's-2')
CS%id_S2_v = register_diag_field('ocean_model', 'S2_v', diag%axesCv1, Time, &
Expand Down
Loading

0 comments on commit c741390

Please sign in to comment.