Skip to content

Commit

Permalink
Corrected units in parameterization code comments
Browse files Browse the repository at this point in the history
  Widespread cleanup of units in comments in vertical parameterizations.  All
answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Oct 8, 2019
1 parent 8ade6de commit 0d43bc3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
12 changes: 6 additions & 6 deletions src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module MOM_energetic_PBL
!/ Constants
real :: VonKar = 0.41 !< The von Karman coefficient. This should be runtime, but because
!! it is runtime in KPP and set to 0.4 it might change answers.
real :: omega !< The Earth's rotation rate [T-1].
real :: omega !< The Earth's rotation rate [T-1 ~> s-1].
real :: omega_frac !< When setting the decay scale for turbulence, use this fraction of
!! the absolute rotation rate blended with the local value of f, as
!! sqrt((1-of)*f^2 + of*4*omega^2) [nondim].
Expand Down Expand Up @@ -343,7 +343,7 @@ subroutine energetic_PBL(h_3d, u_3d, v_3d, tv, fluxes, dt, Kd_int, G, GV, US, CS
real :: h_neglect ! A thickness that is so small it is usually lost
! in roundoff and can be neglected [H ~> m or kg m-2].

real :: absf ! The absolute value of f [T-1].
real :: absf ! The absolute value of f [T-1 ~> s-1].
real :: U_star ! The surface friction velocity [Z T-1 ~> m s-1].
real :: U_Star_Mean ! The surface friction without gustiness [Z T-1 ~> m s-1].
real :: B_Flux ! The surface buoyancy flux [Z2 T-3 ~> m2 s-3]
Expand Down Expand Up @@ -539,9 +539,9 @@ subroutine ePBL_column(h, u, v, T0, S0, dSV_dT, dSV_dS, TKE_forcing, B_flux, abs
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, dimension(SZK_(GV)), intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2].
real, dimension(SZK_(GV)), intent(in) :: u !< Zonal velocities interpolated to h points
!! [m s-1].
!! [L T-1 ~> m s-1].
real, dimension(SZK_(GV)), intent(in) :: v !< Zonal velocities interpolated to h points
!! [m s-1].
!! [L T-1 ~> m s-1].
real, dimension(SZK_(GV)), intent(in) :: T0 !< The initial layer temperatures [degC].
real, dimension(SZK_(GV)), intent(in) :: S0 !< The initial layer salinities [ppt].

Expand Down Expand Up @@ -740,7 +740,7 @@ subroutine ePBL_column(h, u, v, T0, S0, dSV_dT, dSV_dS, TKE_forcing, B_flux, abs
! from the surface.

! The following are only used for diagnostics.
real :: dt__diag ! A copy of dt_diag (if present) or dt [T].
real :: dt__diag ! A copy of dt_diag (if present) or dt [T ~> s].
real :: I_dtdiag ! = 1.0 / dt__diag [T-1 ~> s-1].

!----------------------------------------------------------------------
Expand Down Expand Up @@ -1749,7 +1749,7 @@ subroutine find_mstar(CS, US, Buoyancy_Flux, UStar, UStar_Mean,&
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
real, intent(in) :: UStar !< ustar w/ gustiness [Z T-1 ~> m s-1]
real, intent(in) :: UStar_Mean !< ustar w/o gustiness [Z T-1 ~> m s-1]
real, intent(in) :: Abs_Coriolis !< abolute value of the Coriolis parameter [T-1]
real, intent(in) :: Abs_Coriolis !< abolute value of the Coriolis parameter [T-1 ~> s-1]
real, intent(in) :: Buoyancy_Flux !< Buoyancy flux [Z2 T-3 ~> m2 s-3]
real, intent(in) :: BLD !< boundary layer depth [Z ~> m]
real, intent(out) :: Mstar !< Ouput mstar (Mixing/ustar**3) [nondim]
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_internal_tide_input.F90
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module MOM_int_tide_input
real, allocatable, dimension(:,:) :: &
TKE_itidal_input, & !< The internal tide TKE input at the bottom of the ocean [R Z3 T-3 ~> W m-2].
h2, & !< The squared topographic roughness height [Z2 ~> m2].
tideamp, & !< The amplitude of the tidal velocities [m s-1].
tideamp, & !< The amplitude of the tidal velocities [Z T-1 ~> m s-1].
Nb !< The bottom stratification [T-1 ~> s-1].
end type int_tide_input_type

Expand Down Expand Up @@ -401,7 +401,7 @@ subroutine int_tide_input_init(Time, G, GV, US, param_file, diag, CS, itide)
if (max_frac_rough >= 0.0) &
itide%h2(i,j) = min((max_frac_rough*G%bathyT(i,j))**2, itide%h2(i,j))

! Compute the fixed part of internal tidal forcing; units are [R Z3 T-2 = J m-2] here.
! Compute the fixed part of internal tidal forcing; units are [R Z3 T-2 ~> J m-2] here.
CS%TKE_itidal_coef(i,j) = 0.5*US%L_to_Z*kappa_h2_factor*GV%Rho0*&
kappa_itides * itide%h2(i,j) * itide%tideamp(i,j)**2
enddo ; enddo
Expand Down
22 changes: 11 additions & 11 deletions src/parameterizations/vertical/MOM_kappa_shear.F90
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module MOM_kappa_shear
!! massive layers in this calculation.
! I can think of no good reason why this should be false. - RWH
real :: vel_underflow !< Velocity components smaller than vel_underflow
!! are set to 0 [Z T-1 ~> m s-1].
!! are set to 0 [L T-1 ~> m s-1].
! logical :: layer_stagger = .false. ! If true, do the calculations centered at
! layers, rather than the interfaces.
logical :: debug = .false. !< If true, write verbose debugging messages.
Expand Down Expand Up @@ -734,7 +734,7 @@ subroutine kappa_shear_column(kappa, tke, dt, nzc, f2, surface_pres, &
local_src_avg, & ! The time-integral of the local source [nondim].
tol_min, & ! Minimum tolerated ksrc for the corrector step [T-1 ~> s-1].
tol_max, & ! Maximum tolerated ksrc for the corrector step [T-1 ~> s-1].
tol_chg, & ! The tolerated change integrated in time [s T-nondim].
tol_chg, & ! The tolerated change integrated in time [nondim].
dist_from_top, & ! The distance from the top surface [Z ~> m].
local_src ! The sum of all sources of kappa, including kappa_src and
! sources from the elliptic term [T-1 ~> s-1].
Expand Down Expand Up @@ -1210,8 +1210,8 @@ subroutine calculate_projected_state(kappa, u0, v0, T0, S0, dt, nz, &
!! layers?).
real, dimension(nz+1), intent(in) :: kappa !< The diapycnal diffusivity at interfaces,
!! [Z2 T-1 ~> m2 s-1].
real, dimension(nz), intent(in) :: u0 !< The initial zonal velocity [m s-1].
real, dimension(nz), intent(in) :: v0 !< The initial meridional velocity [m s-1].
real, dimension(nz), intent(in) :: u0 !< The initial zonal velocity [L T-1 ~> m s-1].
real, dimension(nz), intent(in) :: v0 !< The initial meridional velocity [L T-1 ~> m s-1].
real, dimension(nz), intent(in) :: T0 !< The initial temperature [degC].
real, dimension(nz), intent(in) :: S0 !< The initial salinity [ppt].
real, dimension(nz), intent(in) :: dz !< The grid spacing of layers [Z ~> m].
Expand All @@ -1222,8 +1222,8 @@ subroutine calculate_projected_state(kappa, u0, v0, T0, S0, dt, nz, &
real, dimension(nz+1), intent(in) :: dbuoy_dS !< The partial derivative of buoyancy with
!! salinity [Z T-2 ppt-1 ~> m s-2 ppt-1].
real, intent(in) :: dt !< The time step [T ~> s].
real, dimension(nz), intent(inout) :: u !< The zonal velocity after dt [m s-1].
real, dimension(nz), intent(inout) :: v !< The meridional velocity after dt [m s-1].
real, dimension(nz), intent(inout) :: u !< The zonal velocity after dt [L T-1 ~> m s-1].
real, dimension(nz), intent(inout) :: v !< The meridional velocity after dt [L T-1 ~> m s-1].
real, dimension(nz), intent(inout) :: T !< The temperature after dt [degC].
real, dimension(nz), intent(inout) :: Sal !< The salinity after dt [ppt].
type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
Expand All @@ -1237,13 +1237,13 @@ subroutine calculate_projected_state(kappa, u0, v0, T0, S0, dt, nz, &
!! diffusivity.
real, optional, intent(in) :: vel_underflow !< If present and true, any velocities that
!! are smaller in magnitude than this value are
!! set to 0 [m s-1].
!! set to 0 [L T-1 ~> m s-1].

! Local variables
real, dimension(nz+1) :: c1
real :: L2_to_Z2 ! A conversion factor from horizontal length units to vertical depth
! units squared [Z2 s2 T-2 m-2 ~> 1].
real :: underflow_vel ! Velocities smaller in magnitude than underflow_vel are set to 0 [m s-1].
real :: underflow_vel ! Velocities smaller in magnitude than underflow_vel are set to 0 [L T-1 ~> m s-1].
real :: a_a, a_b, b1, d1, bd1, b1nz_0
integer :: k, ks, ke

Expand Down Expand Up @@ -1352,7 +1352,7 @@ subroutine find_kappa_tke(N2, S2, kappa_in, Idz, dz_Int, I_L2_bdry, f2, &
real, dimension(nz+1), intent(in) :: dz_Int !< The thicknesses associated with interfaces
!! [Z-1 ~> m-1].
real, dimension(nz+1), intent(in) :: I_L2_bdry !< The inverse of the squared distance to
!! boundaries [Z-2 !> m-2].
!! boundaries [Z-2 ~> m-2].
real, dimension(nz), intent(in) :: Idz !< The inverse grid spacing of layers [Z-1 ~> m-1].
real, intent(in) :: f2 !< The squared Coriolis parameter [T-2 ~> s-2].
type(Kappa_shear_CS), pointer :: CS !< A pointer to this module's control structure.
Expand All @@ -1366,7 +1366,7 @@ subroutine find_kappa_tke(N2, S2, kappa_in, Idz, dz_Int, I_L2_bdry, f2, &
real, dimension(nz+1), intent(out) :: kappa !< The diapycnal diffusivity at interfaces
!! [Z2 T-1 ~> m2 s-1].
real, dimension(nz+1), optional, &
intent(out) :: kappa_src !< The source term for kappa [T-1].
intent(out) :: kappa_src !< The source term for kappa [T-1 ~> s-1].
real, dimension(nz+1), optional, &
intent(out) :: local_src !< The sum of all local sources for kappa,
!! [T-1 ~> s-1].
Expand Down Expand Up @@ -1422,7 +1422,7 @@ subroutine find_kappa_tke(N2, S2, kappa_in, Idz, dz_Int, I_L2_bdry, f2, &
! Temporary variables used in the Newton's method iterations.
real :: decay_term_k ! The decay term in the diffusivity equation
real :: decay_term_Q ! The decay term in the TKE equation - proportional to [T-1 ~> s-1]
real :: I_Q ! The inverse of TKE [s2 m-2]
real :: I_Q ! The inverse of TKE [T2 Z-2 ~> s2 m-2]
real :: kap_src
real :: v1 ! A temporary variable proportional to [T-1 ~> s-1]
real :: v2
Expand Down
24 changes: 11 additions & 13 deletions src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ module MOM_set_diffusivity
logical :: bulkmixedlayer !< If true, a refined bulk mixed layer is used with
!! GV%nk_rho_varies variable density mixed & buffer layers.
real :: FluxRi_max !< The flux Richardson number where the stratification is
!! large enough that N2 > omega2. The full expression for
!! the Flux Richardson number is usually
!! large enough that N2 > omega2 [nondim]. The full expression
!! for the Flux Richardson number is usually
!! FLUX_RI_MAX*N2/(N2+OMEGA2). The default is 0.2.
logical :: bottomdraglaw !< If true, the bottom stress is calculated with a
!! drag law c_drag*|u|*u.
Expand Down Expand Up @@ -93,8 +93,6 @@ module MOM_set_diffusivity
real :: dissip_N2 !< Coefficient c in minimum dissipation = c*N2 [R Z2 T-1 ~> J s m-3]
real :: dissip_Kd_min !< Minimum Kd [Z2 T-1 ~> m2 s-1], with dissipation Rho0*Kd_min*N^2

real :: TKE_itide_max !< maximum internal tide conversion [W m-2]
!! available to mix above the BBL
real :: omega !< Earth's rotation frequency [T-1 ~> s-1]
logical :: ML_radiation !< allow a fraction of TKE available from wind work
!! to penetrate below mixed layer base with a vertical
Expand All @@ -107,7 +105,7 @@ module MOM_set_diffusivity
!! of exp(-h_ML*Idecay_len_TkE), where Idecay_len_TKE is
!! calculated the same way as in the mixed layer code.
!! The diapycnal diffusivity is KD(k) = E/(N2(k)+OMEGA2),
!! where N2 is the squared buoyancy frequency [s-2] and OMEGA2
!! where N2 is the squared buoyancy frequency [T-2 ~> s-2] and OMEGA2
!! is the rotation rate of the earth squared.
real :: ML_rad_kd_max !< Maximum diapycnal diffusivity due to turbulence
!! radiated from the base of the mixed layer [Z2 T-1 ~> m2 s-1].
Expand Down Expand Up @@ -224,7 +222,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt_in_T,
!! properties of the ocean.
type(vertvisc_type), intent(inout) :: visc !< Structure containing vertical viscosities, bottom
!! boundary layer properies, and related fields.
real, intent(in) :: dt_in_T !< Time increment [s].
real, intent(in) :: dt_in_T !< Time increment [T ~> s].
type(set_diffusivity_CS), pointer :: CS !< Module control structure.
real, dimension(SZI_(G),SZJ_(G),SZK_(G)), &
intent(out) :: Kd_lay !< Diapycnal diffusivity of each layer [Z2 T-1 ~> m2 s-1].
Expand All @@ -246,7 +244,7 @@ subroutine set_diffusivity(u, v, h, u_h, v_h, tv, fluxes, optics, visc, dt_in_T,

real, dimension(SZI_(G),SZK_(G)) :: &
N2_lay, & !< squared buoyancy frequency associated with layers [T-2 ~> s-2]
maxTKE, & !< energy required to entrain to h_max [m3 T-3]
maxTKE, & !< energy required to entrain to h_max [Z3 T-3 ~> m3 s-3]
TKE_to_Kd !< conversion rate (~1.0 / (G_Earth + dRho_lay)) between
!< TKE dissipated within a layer and Kd in that layer
!< [Z2 T-1 / Z3 T-3 = T2 Z-1 ~> s2 m-1]
Expand Down Expand Up @@ -674,10 +672,10 @@ subroutine find_TKE_to_Kd(h, tv, dRho_int, N2_lay, j, dt, G, GV, US, CS, &
! above or below [Z ~> m].
real :: dRho_lay ! density change across a layer [R ~> kg m-3]
real :: Omega2 ! rotation rate squared [T-2 ~> s-2]
real :: G_Rho0 ! gravitation accel divided by Bouss ref density [Z T-2 R-1 -> m4 s-2 kg-1]
real :: G_IRho0 ! Alternate calculation of G_Rho0 for reproducibility [Z T-2 R-1 -> m4 s-2 kg-1]
real :: G_Rho0 ! gravitation accel divided by Bouss ref density [Z T-2 R-1 ~> m4 s-2 kg-1]
real :: G_IRho0 ! Alternate calculation of G_Rho0 for reproducibility [Z T-2 R-1 ~> m4 s-2 kg-1]
real :: I_Rho0 ! inverse of Boussinesq reference density [R-1 ~> m3 kg-1]
real :: I_dt ! 1/dt [T-1]
real :: I_dt ! 1/dt [T-1 ~> s-1]
real :: H_neglect ! negligibly small thickness [H ~> m or kg m-2]
real :: hN2pO2 ! h (N^2 + Omega^2), in [m3 T-2 Z-2 ~> m s-2].
logical :: do_i(SZI_(G))
Expand Down Expand Up @@ -1450,9 +1448,9 @@ subroutine add_LOTW_BBL_diffusivity(h, u, v, tv, fluxes, visc, j, N2_int, &
TKE_remaining = exp(-Idecay*dh) * TKE_remaining

z_bot = z_bot + h(i,j,k)*GV%H_to_Z ! Distance between upper interface of layer and the bottom [Z ~> m].
D_minus_z = max(total_thickness - z_bot, 0.) ! Thickness above layer, Z.
D_minus_z = max(total_thickness - z_bot, 0.) ! Thickness above layer [Z ~> m].

! Diffusivity using law of the wall, limited by rotation, at height z [m2 s-1].
! Diffusivity using law of the wall, limited by rotation, at height z [Z2 T-1 ~> m2 s-1].
! This calculation is at the upper interface of the layer
if ( ustar_D + absf * ( z_bot * D_minus_z ) == 0.) then
Kd_wall = 0.
Expand All @@ -1461,7 +1459,7 @@ subroutine add_LOTW_BBL_diffusivity(h, u, v, tv, fluxes, visc, j, N2_int, &
/ (ustar_D + absf * (z_bot * D_minus_z))
endif

! TKE associated with Kd_wall [m3 s-2].
! TKE associated with Kd_wall [Z3 T-3 ~> m3 s-3].
! This calculation if for the volume spanning the interface.
TKE_Kd_wall = Kd_wall * 0.5 * (dh + dhm1) * max(N2_int(i,k), N2_min)

Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_set_viscosity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ subroutine set_viscous_BBL(u, v, h, tv, visc, G, GV, US, CS, symmetrize)
real :: U_bg_sq ! The square of an assumed background
! velocity, for calculating the mean
! magnitude near the bottom for use in the
! quadratic bottom drag [m2 s-2].
! quadratic bottom drag [L2 T-2 ~> m2 s-2].
real :: hwtot ! Sum of the thicknesses used to calculate
! the near-bottom velocity magnitude [H ~> m or kg m-2].
real :: hutot ! Running sum of thicknesses times the
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_vert_friction.F90
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ subroutine vertvisc_coef(u, v, h, forces, visc, dt_in_T, G, GV, US, CS, OBC)
type(ocean_OBC_type), pointer :: OBC !< Open boundary condition structure

! Field from forces used in this subroutine:
! ustar: the friction velocity [m s-1], used here as the mixing
! ustar: the friction velocity [Z T-1 ~> m s-1], used here as the mixing
! velocity in the mixed layer if NKML > 1 in a bulk mixed layer.

! Local variables
Expand Down

0 comments on commit 0d43bc3

Please sign in to comment.