Skip to content

Commit

Permalink
Corrected more documented units in comments
Browse files Browse the repository at this point in the history
  Corrected additional documented units in comments, corrected spelling errors
in comments and removed unused variables.  Also noted some probable dimensional
consistency errors in MOM_open_boundary.F90.  All answers are bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Mar 20, 2020
1 parent 3be0470 commit a99e444
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
call get_param(param_file, mdl, "HALOCLINE_FILTER_LENGTH", filt_len, &
"A length scale over which to smooth the temperature and "//&
"salinity before identifying erroneously unstable haloclines.", &
units="m", default=2.0)
units="m", default=2.0, scale=GV%m_to_H)
call get_param(param_file, mdl, "HALOCLINE_STRAT_TOL", strat_tol, &
"A tolerance for the ratio of the stratification of the "//&
"apparent coordinate stratification to the actual value "//&
Expand Down Expand Up @@ -2247,7 +2247,7 @@ subroutine set_regrid_params( CS, boundary_extrapolation, min_thickness, old_gri
!! resolved stratification [nondim]
logical, optional, intent(in) :: fix_haloclines !< Detect regions with much weaker stratification in the coordinate
real, optional, intent(in) :: halocline_filt_len !< Length scale over which to filter T & S when looking for
!! spuriously unstable water mass profiles [m]
!! spuriously unstable water mass profiles [H ~> m or kg m-2]
real, optional, intent(in) :: halocline_strat_tol !< Value of the stratification ratio that defines a problematic
!! halocline region.
logical, optional, intent(in) :: integrate_downward_for_e !< If true, integrate for interface positions downward
Expand Down
2 changes: 0 additions & 2 deletions src/core/MOM_barotropic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2540,9 +2540,7 @@ subroutine apply_velocity_OBCs(OBC, ubt, vbt, uhbt, vhbt, ubt_trans, vbt_trans,
integer :: i, j, is, ie, js, je
real, dimension(SZIB_(G),SZJB_(G)) :: grad
real, parameter :: eps = 1.0e-20
real :: rx_max, ry_max ! coefficients for radiation
is = G%isc-halo ; ie = G%iec+halo ; js = G%jsc-halo ; je = G%jec+halo
rx_max = OBC%rx_max ; ry_max = OBC%rx_max

if (BT_OBC%apply_u_OBCs) then
do j=js,je ; do I=is-1,ie ; if (OBC%segnum_u(I,j) /= OBC_NONE) then
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_forcing_type.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ subroutine forcing_diagnostics(fluxes, sfc_state, G, US, time_end, diag, handles
real, dimension(SZI_(G),SZJ_(G)) :: res
real :: total_transport ! for diagnosing integrated boundary transport
real :: ave_flux ! for diagnosing averaged boundary flux
real :: C_p ! seawater heat capacity (J/(deg K * kg))
real :: C_p ! seawater heat capacity [J degC-1 kg-1]
real :: RZ_T_conversion ! A combination of scaling factors for mass fluxes [kg T m-2 s-1 R-1 Z-1 ~> 1]
real :: I_dt ! inverse time step [s-1]
real :: ppt2mks ! conversion between ppt and mks
Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM_interface_heights.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ subroutine find_eta_3d(h, tv, G, GV, US, eta, eta_bt, halo_size, eta_to_m)
!! the units of eta to m; by default this is US%Z_to_m.

! Local variables
real :: p(SZI_(G),SZJ_(G),SZK_(G)+1)
real :: p(SZI_(G),SZJ_(G),SZK_(G)+1) ! Hydrostatic pressure at each interface [Pa]
real :: dz_geo(SZI_(G),SZJ_(G),SZK_(G)) ! The change in geopotential height
! across a layer [m2 s-2].
real :: dilate(SZI_(G)) ! non-dimensional dilation factor
real :: htot(SZI_(G)) ! total thickness H
real :: htot(SZI_(G)) ! total thickness [H ~> m or kg m-2]
real :: I_gEarth
real :: Z_to_eta, H_to_eta, H_to_rho_eta ! Unit conversion factors with obvious names.
integer i, j, k, isv, iev, jsv, jev, nz, halo
Expand Down
13 changes: 8 additions & 5 deletions src/core/MOM_open_boundary.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ module MOM_open_boundary
real, pointer, dimension(:,:,:) :: buffer_src=>NULL() !< buffer for segment data located at cell faces
!! and on the original vertical grid
integer :: nk_src !< Number of vertical levels in the source data
real, dimension(:,:,:), pointer :: dz_src=>NULL() !< vertical grid cell spacing of the incoming segment data [m]
real, dimension(:,:,:), pointer :: dz_src=>NULL() !< vertical grid cell spacing of the incoming segment
!! data, set in [Z ~> m] then scaled to [H ~> m or kg m-2]
real, dimension(:,:,:), pointer :: buffer_dst=>NULL() !< buffer src data remapped to the target vertical grid
real, dimension(:,:), pointer :: bt_vel=>NULL() !< barotropic velocity [L T-1 ~> m s-1]
real :: value !< constant value if fid is equal to -1
Expand Down Expand Up @@ -260,6 +261,7 @@ module MOM_open_boundary
real :: rx_max !< The maximum magnitude of the baroclinic radiation
!! velocity (or speed of characteristics) [m s-1]. The
!! default value is 10 m s-1.
!### The description above seems inconsistent with the code, and the units should be [nondim].
logical :: OBC_pe !< Is there an open boundary on this tile?
type(remapping_CS), pointer :: remap_CS !< ALE remapping control structure for segments only
type(OBC_registry_type), pointer :: OBC_Reg => NULL() !< Registry type for boundaries
Expand Down Expand Up @@ -478,11 +480,13 @@ subroutine open_boundary_config(G, US, param_file, OBC)
call initialize_segment_data(G, OBC, param_file)

if (open_boundary_query(OBC, apply_open_OBC=.true.)) then
!### I think that OBC%rx_max as used is actually nondimensional, with effective
! units of grid points per time step.
call get_param(param_file, mdl, "OBC_RADIATION_MAX", OBC%rx_max, &
"The maximum magnitude of the baroclinic radiation "//&
"velocity (or speed of characteristics). This is only "//&
"used if one of the open boundary segments is using Orlanski.", &
units="m s-1", default=10.0)
units="m s-1", default=10.0) !### Should the units here be "nondim"?
call get_param(param_file, mdl, "OBC_RAD_VEL_WT", OBC%gamma_uv, &
"The relative weighting for the baroclinic radiation "//&
"velocities (or speed of characteristics) at the new "//&
Expand Down Expand Up @@ -3421,16 +3425,15 @@ subroutine update_OBC_segment_data(G, GV, US, OBC, tv, h, Time)
type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
type(ocean_OBC_type), pointer :: OBC !< Open boundary structure
type(thermo_var_ptrs), intent(in) :: tv !< Thermodynamics structure
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(inout) :: h !< Thickness [m]
real, dimension(SZI_(G),SZJ_(G), SZK_(G)), intent(inout) :: h !< Thickness [H ~> m or kg m-2]
type(time_type), intent(in) :: Time !< Model time
! Local variables
integer :: i, j, k, is, ie, js, je, isd, ied, jsd, jed
integer :: IsdB, IedB, JsdB, JedB, n, m, nz
character(len=40) :: mdl = "set_OBC_segment_data" ! This subroutine's name.
character(len=200) :: filename, OBC_file, inputdir ! Strings for file/path
type(OBC_segment_type), pointer :: segment => NULL()
integer, dimension(4) :: siz,siz2
real :: sumh ! column sum of thicknesses [m]
integer, dimension(4) :: siz
integer :: ni_seg, nj_seg ! number of src gridpoints along the segments
integer :: i2, j2 ! indices for referencing local domain array
integer :: is_obc, ie_obc, js_obc, je_obc ! segment indices within local domain
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/lateral/MOM_internal_tides.F90
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ subroutine propagate_int_tide(h, tv, cn, TKE_itidal_input, vel_btTide, Nb, dt, &
! Dissipate energy if Fr>1; done here with an arbitrary time scale
if (Fr2_max > 1.0) then
En_initial = sum(CS%En(i,j,:,fr,m)) ! for debugging
! Calculate effective decay rate [s-1] if breaking occurs over a time step
! Calculate effective decay rate [T-1 ~> s-1] if breaking occurs over a time step
loss_rate = (1.0 - Fr2_max) / (Fr2_max * dt)
do a=1,CS%nAngle
! Determine effective dissipation rate (Wm-2)
Expand Down
2 changes: 0 additions & 2 deletions src/parameterizations/lateral/MOM_thickness_diffuse.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,6 @@ subroutine add_detangling_Kh(h, e, Kh_u, Kh_v, KH_u_CFL, KH_v_CFL, tv, dt, G, GV
! normalized by the arithmetic mean thickness.
real :: Kh_scale ! A ratio by which Kh_u_CFL is scaled for maximally jagged
! layers [nondim].
! real :: Kh_det ! The detangling diffusivity [m2 s-1].
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].

Expand All @@ -1422,7 +1421,6 @@ subroutine add_detangling_Kh(h, e, Kh_u, Kh_v, KH_u_CFL, KH_v_CFL, tv, dt, G, GV
! the damping timescale [T-1 ~> s-1].
real :: Fn_R ! A function of Rsl, such that Rsl < Fn_R < 1.
real :: denom, I_denom ! A denominator and its inverse, various units.
! real :: Kh_min ! A local floor on the diffusivity [m2 s-1].
real :: Kh_max ! A local ceiling on the diffusivity [L2 T-1 ~> m2 s-1].
real :: wt1, wt2 ! Nondimensional weights.
! Variables used only in testing code.
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_diapyc_energy_req.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ subroutine find_PE_chg_orig(Kddt_h, h_k, b_den_1, dTe_term, dSe_term, &
real :: b1Kd ! Temporary array [nondim]
real :: ColHt_chg ! The change in column thickness [Z ~> m].
real :: dColHt_max ! The change in column thickness for infinite diffusivity [Z ~> m].
real :: dColHt_dKd ! The partial derivative of column thickness with diffusivity [s Z-1 ~> s m-1].
real :: dColHt_dKd ! The partial derivative of column thickness with Kddt_h [Z H-1 ~> 1 or m3 kg-1].
real :: dT_k, dT_km1 ! Temporary arrays [degC].
real :: dS_k, dS_km1 ! Temporary arrays [ppt].
real :: I_Kr_denom ! Temporary arrays [H-2 ~> m-2 or m4 kg-2].
Expand Down
2 changes: 1 addition & 1 deletion src/parameterizations/vertical/MOM_energetic_PBL.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ subroutine find_PE_chg_orig(Kddt_h, h_k, b_den_1, dTe_term, dSe_term, &
real :: b1Kd ! Temporary array [nondim]
real :: ColHt_chg ! The change in column thickness [Z ~> m].
real :: dColHt_max ! The change in column thickness for infinite diffusivity [Z ~> m].
real :: dColHt_dKd ! The partial derivative of column thickness with diffusivity [s Z-1 ~> s m-1].
real :: dColHt_dKd ! The partial derivative of column thickness with Kddt_h [Z H-1 ~> 1 or m3 kg-2].
real :: dT_k, dT_km1 ! Temporary arrays [degC].
real :: dS_k, dS_km1 ! Temporary arrays [ppt].
real :: I_Kr_denom ! Temporary array [H-2 ~> m-2 or m4 kg-2]
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_geothermal.F90
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ subroutine geothermal(h, tv, dt, ea, eb, G, GV, US, CS, halo)
! for diagnostics [degC]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: h_old ! Thickness of each layer
! before any heat is added,
! for diagnostics [m or kg m-2]
! for diagnostics [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(G)) :: work_3d ! Scratch variable used to
! calculate change in heat
! due to geothermal
real :: Idt ! inverse of the timestep [s-1]
real :: Idt ! inverse of the timestep [T-1 ~> s-1]

logical :: do_i(SZI_(G))
logical :: compute_h_old, compute_T_old
Expand Down
4 changes: 2 additions & 2 deletions src/parameterizations/vertical/MOM_set_diffusivity.F90
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ subroutine find_TKE_to_Kd(h, tv, dRho_int, N2_lay, j, dt, G, GV, US, CS, &
real :: I_Rho0 ! inverse of Boussinesq reference density [R-1 ~> m3 kg-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].
real :: hN2pO2 ! h (N^2 + Omega^2), in [Z T-2 ~> m s-2].
logical :: do_i(SZI_(G))

integer :: i, k, is, ie, nz, i_rem, kmb, kb_min
Expand Down Expand Up @@ -1118,7 +1118,7 @@ subroutine add_drag_diffusivity(h, u, v, tv, fluxes, visc, j, TKE_to_Kd, &
!! usually (~Rho_0 / (G_Earth * dRho_lay))
!! [Z2 T-1 / Z3 T-3 = T2 Z-1 ~> s2 m-1]
real, dimension(SZI_(G),SZK_(G)), intent(in) :: maxTKE !< The energy required to for a layer to entrain
!! to its maximum-realizable thickness [m3 T-3 ~> m3 s-3]
!! to its maximum-realizable thickness [Z3 T-3 ~> m3 s-3]
integer, dimension(SZI_(G)), intent(in) :: kb !< Index of lightest layer denser than the buffer
!! layer, or -1 without a bulk mixed layer
type(set_diffusivity_CS), pointer :: CS !< Diffusivity control structure
Expand Down
12 changes: 6 additions & 6 deletions src/parameterizations/vertical/MOM_tidal_mixing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module MOM_tidal_mixing
Kd_Niku_work => NULL(),& !< layer integrated work by lee-wave driven mixing [R Z3 T-3 ~> W m-2]
Kd_Itidal_Work => NULL(),& !< layer integrated work by int tide driven mixing [R Z3 T-3 ~> W m-2]
Kd_Lowmode_Work => NULL(),& !< layer integrated work by low mode driven mixing [R Z3 T-3 ~> W m-2]
N2_int => NULL(),& !< Bouyancy frequency squared at interfaces [s-2]
N2_int => NULL(),& !< Bouyancy frequency squared at interfaces [T-2 ~> s-2]
vert_dep_3d => NULL(),& !< The 3-d mixing energy deposition [W m-3]
Schmittner_coeff_3d => NULL() !< The coefficient in the Schmittner et al mixing scheme, in UNITS?
real, pointer, dimension(:,:,:) :: tidal_qe_md => NULL() !< Input tidal energy dissipated locally,
Expand All @@ -61,8 +61,8 @@ module MOM_tidal_mixing
TKE_itidal_used => NULL(),& !< internal tide TKE input at ocean bottom [R Z3 T-3 ~> W m-2]
N2_bot => NULL(),& !< bottom squared buoyancy frequency [T-2 ~> s-2]
N2_meanz => NULL(),& !< vertically averaged buoyancy frequency [T-2 ~> s-2]
Polzin_decay_scale_scaled => NULL(),& !< vertical scale of decay for tidal dissipation
Polzin_decay_scale => NULL(),& !< vertical decay scale for tidal diss with Polzin [m]
Polzin_decay_scale_scaled => NULL(),& !< vertical scale of decay for tidal dissipation [Z ~> m]
Polzin_decay_scale => NULL(),& !< vertical decay scale for tidal diss with Polzin [Z ~> m]
Simmons_coeff_2d => NULL() !< The Simmons et al mixing coefficient

end type
Expand Down Expand Up @@ -153,8 +153,8 @@ module MOM_tidal_mixing
!! by the bottom stratfication [R Z3 T-2 ~> J m-2].
real, pointer, dimension(:,:) :: Nb => NULL() !< The near bottom buoyancy frequency [T-1 ~> s-1].
real, pointer, dimension(:,:) :: mask_itidal => NULL() !< A mask of where internal tide energy is input
real, pointer, dimension(:,:) :: h2 => NULL() !< Squared bottom depth variance [m2].
real, pointer, dimension(:,:) :: tideamp => NULL() !< RMS tidal amplitude [m s-1]
real, pointer, dimension(:,:) :: h2 => NULL() !< Squared bottom depth variance [Z2 ~> m2].
real, pointer, dimension(:,:) :: tideamp => NULL() !< RMS tidal amplitude [Z T-1 ~> m s-1]
real, allocatable, dimension(:) :: h_src !< tidal constituent input layer thickness [m]
real, allocatable, dimension(:,:) :: tidal_qe_2d !< Tidal energy input times the local dissipation
!! fraction, q*E(x,y), with the CVMix implementation
Expand Down Expand Up @@ -590,7 +590,7 @@ logical function tidal_mixing_init(Time, G, GV, US, param_file, diag, CS)

if (CS%use_CVMix_tidal) then
CS%id_N2_int = register_diag_field('ocean_model','N2_int',diag%axesTi,Time, &
'Bouyancy frequency squared, at interfaces', 's-2')
'Bouyancy frequency squared, at interfaces', 's-2') !###, conversion=US%s_to_T**2)
!> TODO: add units
CS%id_Simmons_coeff = register_diag_field('ocean_model','Simmons_coeff',diag%axesT1,Time, &
'time-invariant portion of the tidal mixing coefficient using the Simmons', '')
Expand Down
2 changes: 1 addition & 1 deletion src/user/Idealized_Hurricane.F90
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ subroutine SCM_idealized_hurricane_wind_forcing(state, forces, day, G, US, CS)
endif
forces%tauy(I,j) = CS%rho_a * US%L_to_Z * G%mask2dCv(I,j) * Cd*dU10*dV
enddo ; enddo
! Set the surface friction velocity [m s-1]. ustar is always positive.
! Set the surface friction velocity [Z T-1 ~> m s-1]. ustar is always positive.
do j=js,je ; do i=is,ie
! This expression can be changed if desired, but need not be.
forces%ustar(i,j) = G%mask2dT(i,j) * sqrt(US%L_to_Z * (CS%gustiness/CS%Rho0 + &
Expand Down
6 changes: 3 additions & 3 deletions src/user/baroclinic_zone_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ subroutine bcz_params(G, GV, US, param_file, S_ref, dSdz, delta_S, dSdx, T_ref,
real, intent(out) :: T_ref !< Reference temperature [degC]
real, intent(out) :: dTdz !< Temperature stratification [degC Z-1 ~> degC m-1]
real, intent(out) :: delta_T !< Temperature difference across baroclinic zone [degC]
real, intent(out) :: dTdx !< Linear temperature gradient [degC m-1]
real, intent(out) :: L_zone !< Width of baroclinic zone [m]
real, intent(out) :: dTdx !< Linear temperature gradient in [degC G%x_axis_units-1]
real, intent(out) :: L_zone !< Width of baroclinic zone in [G%x_axis_units]
logical, optional, intent(in) :: just_read_params !< If present and true, this call will
!! only read parameters without changing h.

Expand Down Expand Up @@ -90,7 +90,7 @@ subroutine baroclinic_zone_init_temperature_salinity(T, S, h, G, GV, US, param_f
integer :: i, j, k, is, ie, js, je, nz
real :: T_ref, dTdz, dTdx, delta_T ! Parameters describing temperature distribution
real :: S_ref, dSdz, dSdx, delta_S ! Parameters describing salinity distribution
real :: L_zone ! Width of baroclinic zone
real :: L_zone ! Width of baroclinic zone in [G%axis_units]
real :: zc, zi ! Depths in depth units [Z ~> m]
real :: x, xd, xs, y, yd, fn
real :: PI ! 3.1415926... calculated as 4*atan(1)
Expand Down

0 comments on commit a99e444

Please sign in to comment.