Skip to content

Commit

Permalink
Documented 170 variable units
Browse files Browse the repository at this point in the history
  Changed comments to use the square bracket notation to document the units of
about 170 variables, many of them heat fluxes, themodynamic variables or
nondimensional ratios.  Only comments have been changed and all answers are
bitwise identical.
  • Loading branch information
Hallberg-NOAA committed Jan 29, 2019
1 parent ea5c097 commit dea748a
Show file tree
Hide file tree
Showing 31 changed files with 197 additions and 204 deletions.
49 changes: 26 additions & 23 deletions src/ALE/MOM_regridding.F90
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ module MOM_regridding
!> Reference pressure for potential density calculations (Pa)
real :: ref_pressure = 2.e7

!> Weight given to old coordinate when blending between new and old grids (nondim)
!> Weight given to old coordinate when blending between new and old grids [nondim]
!! Used only below depth_of_time_filter_shallow, with a cubic variation
!! from zero to full effect between depth_of_time_filter_shallow and
!! depth_of_time_filter_deep.
Expand All @@ -100,7 +100,7 @@ module MOM_regridding
real :: depth_of_time_filter_deep = 0.

!> Fraction (between 0 and 1) of compressibility to add to potential density
!! profiles when interpolating for target grid positions. (nondim)
!! profiles when interpolating for target grid positions. [nondim]
real :: compressibility_fraction = 0.

!> If true, each interface is given a maximum depth based on a rescaling of
Expand Down Expand Up @@ -184,6 +184,7 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
character(len=*), intent(in) :: param_prefix !< String to prefix to parameter names.
!! If empty, causes main model parameters to be used.
character(len=*), intent(in) :: param_suffix !< String to append to parameter names.

! Local variables
integer :: ke ! Number of levels
character(len=80) :: string, string2, varName ! Temporary strings
Expand All @@ -194,18 +195,19 @@ subroutine initialize_regridding(CS, GV, US, max_depth, param_file, mdl, coord_m
logical :: tmpLogical, fix_haloclines, set_max, do_sum, main_parameters
logical :: coord_is_state_dependent, ierr
real :: filt_len, strat_tol, index_scale, tmpReal
real :: maximum_depth !< The maximum depth of the ocean [m] (not in Z).
real :: maximum_depth ! The maximum depth of the ocean [m] (not in Z).
real :: dz_fixed_sfc, Rho_avg_depth, nlay_sfc_int
real :: adaptTimeRatio, adaptZoom, adaptZoomCoeff, adaptBuoyCoeff, adaptAlpha
integer :: nz_fixed_sfc, k, nzf(4)
real, dimension(:), allocatable :: dz ! Resolution (thickness) in units of coordinate
real, dimension(:), allocatable :: dz ! Resolution (thickness) in units of coordinate, which may be
! [m] or [Z ~> m] or [H ~> m or kg m-2] or [kg m-3] or other units.
real, dimension(:), allocatable :: h_max ! Maximum layer thicknesses [H ~> m or kg m-2]
real, dimension(:), allocatable :: z_max ! Maximum interface depths [H ~> m or kg m-2] or other
! units depending on the coordinate
real, dimension(:), allocatable :: dz_max ! Thicknesses used to find maximum interface depths
! [H ~> m or kg m-2] or other units
real, dimension(:), allocatable :: rho_target ! Target density used in HYBRID mode
! Thicknesses that give level centers corresponding to table 2 of WOA09
real, dimension(:), allocatable :: rho_target ! Target density used in HYBRID mode [kg m-3]
! Thicknesses [m] that give level centers corresponding to table 2 of WOA09
real, dimension(40) :: woa09_dz = (/ 5., 10., 10., 15., 22.5, 25., 25., 25., &
37.5, 50., 50., 75., 100., 100., 100., 100., &
100., 100., 100., 100., 100., 100., 100., 175., &
Expand Down Expand Up @@ -918,10 +920,11 @@ end subroutine calc_h_new_by_dz

!> Check that the total thickness of two grids match
subroutine check_remapping_grid( G, GV, h, dzInterface, msg )
type(ocean_grid_type), intent(in) :: G !< Grid structure
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer thicknesses (m)
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(in) :: dzInterface !< Change in interface positions (m)
type(ocean_grid_type), intent(in) :: G !< Grid structure
type(verticalGrid_type), intent(in) :: GV !< Ocean vertical grid structure
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
real, dimension(SZI_(G),SZJ_(G),SZK_(GV)+1), intent(in) :: dzInterface !< Change in interface positions
!! [H ~> m or kg m-2]
character(len=*), intent(in) :: msg !< Message to append to errors
! Local variables
integer :: i, j
Expand All @@ -936,8 +939,8 @@ end subroutine check_remapping_grid
!> Check that the total thickness of new and old grids are consistent
subroutine check_grid_column( nk, depth, h, dzInterface, msg )
integer, intent(in) :: nk !< Number of cells
real, intent(in) :: depth !< Depth of bottom (m or arbitrary units)
real, dimension(nk), intent(in) :: h !< Cell thicknesses (m or arbitrary units)
real, intent(in) :: depth !< Depth of bottom [Z ~> m] or arbitrary units
real, dimension(nk), intent(in) :: h !< Cell thicknesses [Z ~> m] or arbitrary units
real, dimension(nk+1), intent(in) :: dzInterface !< Change in interface positions (same units as h)
character(len=*), intent(in) :: msg !< Message to append to errors
! Local variables
Expand Down Expand Up @@ -998,9 +1001,9 @@ end subroutine check_grid_column
subroutine filtered_grid_motion( CS, nk, z_old, z_new, dz_g )
type(regridding_CS), intent(in) :: CS !< Regridding control structure
integer, intent(in) :: nk !< Number of cells in source grid
real, dimension(nk+1), intent(in) :: z_old !< Old grid position (m)
real, dimension(CS%nk+1), intent(in) :: z_new !< New grid position (m)
real, dimension(CS%nk+1), intent(inout) :: dz_g !< Change in interface positions (m)
real, dimension(nk+1), intent(in) :: z_old !< Old grid position [m]
real, dimension(CS%nk+1), intent(in) :: z_new !< New grid position [m]
real, dimension(CS%nk+1), intent(inout) :: dz_g !< Change in interface positions [m]
! Local variables
real :: sgn ! The sign convention for downward.
real :: dz_tgt, zr1, z_old_k
Expand Down Expand Up @@ -1475,7 +1478,7 @@ subroutine build_grid_HyCOM1( G, GV, h, tv, h_new, dzInterface, CS )

z_col(1) = 0. ! Work downward rather than bottom up
do K = 1, GV%ke
z_col(K+1) = z_col(K) + h(i,j,k) ! Work in units of [H ~> m or kg m-2]
z_col(K+1) = z_col(K) + h(i,j,k)
p_col(k) = CS%ref_pressure + CS%compressibility_fraction * &
( 0.5 * ( z_col(K) + z_col(K+1) ) * GV%H_to_Pa - CS%ref_pressure )
enddo
Expand Down Expand Up @@ -1607,7 +1610,7 @@ subroutine build_grid_SLight(G, GV, h, tv, dzInterface, CS)
depth = G%bathyT(i,j) * GV%Z_to_H
z_col(1) = 0. ! Work downward rather than bottom up
do K=1,nz
z_col(K+1) = z_col(K) + h(i, j, k) ! Work in units of [H ~> m or kg m-2]
z_col(K+1) = z_col(K) + h(i,j,k)
p_col(k) = CS%ref_pressure + CS%compressibility_fraction * &
( 0.5 * ( z_col(K) + z_col(K+1) ) * GV%H_to_Pa - CS%ref_pressure )
enddo
Expand Down Expand Up @@ -2221,19 +2224,19 @@ subroutine set_regrid_params( CS, boundary_extrapolation, min_thickness, old_gri
real, optional, intent(in) :: Rho_ml_avg_depth !< Averaging depth over which to determine mixed layer potential
!! density [H ~> m or kg m-2]
real, optional, intent(in) :: nlay_ML_to_interior !< Number of layers to offset the mixed layer density to find
!! resolved stratification (nondim)
!! 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 [m]
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
!! from the top.
real, optional, intent(in) :: adaptTimeRatio !< Ratio of the ALE timestep to the grid timescale, ND.
real, optional, intent(in) :: adaptTimeRatio !< Ratio of the ALE timestep to the grid timescale [nondim].
real, optional, intent(in) :: adaptZoom !< Depth of near-surface zooming region [H ~> m or kg m-2].
real, optional, intent(in) :: adaptZoomCoeff !< Coefficient of near-surface zooming diffusivity, ND.
real, optional, intent(in) :: adaptBuoyCoeff !< Coefficient of buoyancy diffusivity, ND.
real, optional, intent(in) :: adaptAlpha !< Scaling factor on optimization tendency, ND.
real, optional, intent(in) :: adaptZoomCoeff !< Coefficient of near-surface zooming diffusivity [nondim].
real, optional, intent(in) :: adaptBuoyCoeff !< Coefficient of buoyancy diffusivity [nondim].
real, optional, intent(in) :: adaptAlpha !< Scaling factor on optimization tendency [nondim].
logical, optional, intent(in) :: adaptDoMin !< If true, make a HyCOM-like mixed layer by
!! preventing interfaces from being shallower than
!! the depths specified by the regridding coordinate.
Expand Down
2 changes: 1 addition & 1 deletion src/ALE/MOM_remapping.F90
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module MOM_remapping
! outside of the range 0 to 1.
#define __USE_ROUNDOFF_SAFE_ADJUSTMENTS__

real, parameter :: hNeglect_dflt = 1.E-30 !< A dimensional (H units) number that can be
real, parameter :: hNeglect_dflt = 1.E-30 !< A thickness [H ~> m or kg m-2] that can be
!! added to thicknesses in a denominator without
!! changing the numerical result, except where
!! a division by zero would otherwise occur.
Expand Down
16 changes: 8 additions & 8 deletions src/ALE/coord_hycom.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module coord_hycom
subroutine init_coord_hycom(CS, nk, coordinateResolution, target_density, interp_CS)
type(hycom_CS), pointer :: CS !< Unassociated pointer to hold the control structure
integer, intent(in) :: nk !< Number of layers in generated grid
real, dimension(nk), intent(in) :: coordinateResolution !< Nominal near-surface resolution (m)
real, dimension(nk+1),intent(in) :: target_density !< Interface target densities (kg/m3)
real, dimension(nk), intent(in) :: coordinateResolution !< Nominal near-surface resolution [m]
real, dimension(nk+1),intent(in) :: target_density !< Interface target densities [kg m-3]
type(interp_CS_type), intent(in) :: interp_CS !< Controls for interpolation

if (associated(CS)) call MOM_error(FATAL, "init_coord_hycom: CS already associated!")
Expand Down Expand Up @@ -100,13 +100,13 @@ subroutine build_hycom1_column(CS, eqn_of_state, nz, depth, h, T, S, p_col, &
type(EOS_type), pointer :: eqn_of_state !< Equation of state structure
integer, intent(in) :: nz !< Number of levels
real, intent(in) :: depth !< Depth of ocean bottom (positive [H ~> m or kg m-2])
real, dimension(nz), intent(in) :: T !< Temperature of column (degC)
real, dimension(nz), intent(in) :: S !< Salinity of column (psu)
real, dimension(nz), intent(in) :: h !< Layer thicknesses, (in m or H)
real, dimension(nz), intent(in) :: p_col !< Layer pressure in Pa
real, dimension(nz), intent(in) :: T !< Temperature of column [degC]
real, dimension(nz), intent(in) :: S !< Salinity of column [ppt]
real, dimension(nz), intent(in) :: h !< Layer thicknesses, in [m] or [H ~> m or kg m-2]
real, dimension(nz), intent(in) :: p_col !< Layer pressure [Pa]
real, dimension(nz+1), intent(in) :: z_col !< Interface positions relative to the surface [H ~> m or kg m-2]
real, dimension(CS%nk+1), intent(inout) :: z_col_new !< Absolute positions of interfaces
real, optional, intent(in) :: zScale !< Scaling factor from the input thicknesses in m
real, optional, intent(in) :: zScale !< Scaling factor from the input thicknesses in [m]
!! to desired units for zInterface, perhaps m_to_H.
real, optional, intent(in) :: h_neglect !< A negligibly small width for the
!! purpose of cell reconstructions
Expand All @@ -121,7 +121,7 @@ subroutine build_hycom1_column(CS, eqn_of_state, nz, depth, h, T, S, p_col, &
real, dimension(CS%nk) :: h_col_new ! New layer thicknesses
real :: z_scale
real :: stretching ! z* stretching, converts z* to z.
real :: nominal_z ! Nominal depth of interface is using z* (m or Pa)
real :: nominal_z ! Nominal depth of interface when using z* [Z ~> m]
real :: hNew
logical :: maximum_depths_set ! If true, the maximum depths of interface have been set.
logical :: maximum_h_set ! If true, the maximum layer thicknesses have been set.
Expand Down
2 changes: 1 addition & 1 deletion src/ALE/coord_sigma.F90
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module coord_sigma
subroutine init_coord_sigma(CS, nk, coordinateResolution)
type(sigma_CS), pointer :: CS !< Unassociated pointer to hold the control structure
integer, intent(in) :: nk !< Number of layers in the grid
real, dimension(:), intent(in) :: coordinateResolution !< Nominal coordinate resolution (nondim)
real, dimension(:), intent(in) :: coordinateResolution !< Nominal coordinate resolution [nondim]

if (associated(CS)) call MOM_error(FATAL, "init_coord_sigma: CS already associated!")
allocate(CS)
Expand Down
12 changes: 6 additions & 6 deletions src/ALE/coord_slight.F90
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ module coord_slight
real :: ref_pressure

!> Fraction (between 0 and 1) of compressibility to add to potential density
!! profiles when interpolating for target grid positions. (nondim)
!! profiles when interpolating for target grid positions. [nondim]
real :: compressibility_fraction

! The following 4 parameters were introduced for use with the SLight coordinate:
!> Depth over which to average to determine the mixed layer potential density [H ~> m or kg m-2]
real :: Rho_ML_avg_depth

!> Number of layers to offset the mixed layer density to find resolved stratification (nondim)
!> Number of layers to offset the mixed layer density to find resolved stratification [nondim]
real :: nlay_ml_offset

!> The number of fixed-thickness layers at the top of the model
Expand All @@ -48,7 +48,7 @@ module coord_slight
!! unstable water mass profiles [H ~> m or kg m-2].
real :: halocline_filter_length

!> A value of the stratification ratio that defines a problematic halocline region (nondim).
!> A value of the stratification ratio that defines a problematic halocline region [nondim].
real :: halocline_strat_tol

!> Nominal density of interfaces [kg m-3].
Expand Down Expand Up @@ -124,21 +124,21 @@ subroutine set_slight_params(CS, max_interface_depths, max_layer_thickness, &
!! new grid through regridding [H ~> m or kg m-2]
real, optional, intent(in) :: compressibility_fraction !< Fraction (between 0 and 1) of
!! compressibility to add to potential density profiles when
!! interpolating for target grid positions. (nondim)
!! interpolating for target grid positions. [nondim]
real, optional, intent(in) :: dz_ml_min !< The fixed resolution in the topmost
!! SLight_nkml_min layers [H ~> m or kg m-2]
integer, optional, intent(in) :: nz_fixed_surface !< The number of fixed-thickness layers at the
!! top of the model
real, optional, intent(in) :: Rho_ML_avg_depth !< Depth over which to average to determine
!! the mixed layer potential density [H ~> m or kg m-2]
real, optional, intent(in) :: nlay_ML_offset !< Number of layers to offset the mixed layer
!! density to find resolved stratification (nondim)
!! density to find resolved stratification [nondim]
logical, optional, intent(in) :: fix_haloclines !< If true, detect regions with much weaker than
!! based on in-situ density, and use a stretched coordinate there.
real, optional, intent(in) :: halocline_filter_length !< A length scale over which to filter T & S
!! when looking for spuriously unstable water mass profiles [H ~> m or kg m-2].
real, optional, intent(in) :: halocline_strat_tol !< A value of the stratification ratio that
!! defines a problematic halocline region (nondim).
!! defines a problematic halocline region [nondim].
type(interp_CS_type), &
optional, intent(in) :: interp_CS !< Controls for interpolation

Expand Down
4 changes: 2 additions & 2 deletions src/core/MOM.F90
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ subroutine step_MOM(forces, fluxes, sfc_state, Time_start, time_interval, CS, &
logical :: therm_reset ! If true, reset running sums of thermodynamic quantities.
real :: cycle_time ! The length of the coupled time-stepping cycle [s].
real, dimension(SZI_(CS%G),SZJ_(CS%G)) :: &
ssh ! sea surface height, which may be based on eta_av (meter)
ssh ! sea surface height, which may be based on eta_av [m]

real, dimension(:,:,:), pointer :: &
u => NULL(), & ! u : zonal velocity component [m s-1]
Expand Down Expand Up @@ -2488,7 +2488,7 @@ subroutine finish_MOM_initialization(Time, dirs, CS, restart_CSp)
type(unit_scale_type), pointer :: US => NULL() ! Pointer to a structure containing
! various unit conversion factors
type(MOM_restart_CS), pointer :: restart_CSp_tmp => NULL()
real, allocatable :: z_interface(:,:,:) ! Interface heights (meter)
real, allocatable :: z_interface(:,:,:) ! Interface heights [m]
type(vardesc) :: vd

call cpu_clock_begin(id_clock_init)
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_PressureForce_analytic_FV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ subroutine PressureForce_AFV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p
! to reduce the impact of truncation errors.
real :: rho_in_situ(SZI_(G)) ! The in situ density [kg m-3].
real :: Pa_to_H ! A factor to convert from Pa to the thicknesss units (H).
! real :: oneatm = 101325.0 ! 1 atm in Pa (kg/ms2)
! real :: oneatm = 101325.0 ! 1 atm in [Pa] = [kg m-1 s-2]
real, parameter :: C1_6 = 1.0/6.0
integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz, nkmb
integer :: i, j, k
Expand Down
2 changes: 1 addition & 1 deletion src/core/MOM_PressureForce_blocked_AFV.F90
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ subroutine PressureForce_blk_AFV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS, p_atm,
! to reduce the impact of truncation errors.
real :: rho_in_situ(SZI_(G)) ! The in situ density [kg m-3].
real :: Pa_to_H ! A factor to convert from Pa to the thicknesss units (H).
! real :: oneatm = 101325.0 ! 1 atm in Pa (kg/ms2)
! real :: oneatm = 101325.0 ! 1 atm in [Pa] = [kg m-1 s-2]
real, parameter :: C1_6 = 1.0/6.0
integer :: is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz, nkmb
integer :: is_bk, ie_bk, js_bk, je_bk, Isq_bk, Ieq_bk, Jsq_bk, Jeq_bk
Expand Down
Loading

0 comments on commit dea748a

Please sign in to comment.