Skip to content

Commit

Permalink
+Avoid nonsensical units descriptions
Browse files Browse the repository at this point in the history
  Eliminated units arguments for logical, integer, or character string get_param
calls where the units make no sense.  In some other cases, calls were slightly
revised to place the units and scale arguments on the same line for easier
detection of inconsistent settings.  All answers are bitwise identical, but
the MOM_parameter_doc.all files for some test cases are corrected.
  • Loading branch information
Hallberg-NOAA authored and marshallward committed Apr 2, 2022
1 parent c626cc4 commit 6bfd073
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 79 deletions.
2 changes: 1 addition & 1 deletion src/initialization/MOM_state_initialization.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ subroutine trim_for_ice(PF, G, GV, US, ALE_CSp, tv, h, just_read)
fail_if_missing=.not.just_read, do_not_log=just_read)
call get_param(PF, mdl, "SURFACE_PRESSURE_VAR", p_surf_var, &
"The initial condition variable for the surface pressure exerted by ice.", &
units="Pa", default="", do_not_log=just_read)
default="", do_not_log=just_read)
call get_param(PF, mdl, "INPUTDIR", inputdir, default=".", do_not_log=.true.)
filename = trim(slasher(inputdir))//trim(p_surf_file)
if (.not.just_read) call log_param(PF, mdl, "!INPUTDIR/SURFACE_HEIGHT_IC_FILE", filename)
Expand Down
24 changes: 11 additions & 13 deletions src/user/Idealized_Hurricane.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ subroutine idealized_hurricane_wind_init(Time, G, US, param_file, CS)
units='Pa', default=96800., scale=US%m_s_to_L_T**2*US%kg_m3_to_R)
call get_param(param_file, mdl, "IDL_HURR_RAD_MAX_WIND", &
CS%rad_max_wind, "Radius of maximum winds used in the "//&
"idealized hurricane wind profile.", units='m', &
default=50.e3, scale=US%m_to_L)
"idealized hurricane wind profile.", &
units='m', default=50.e3, scale=US%m_to_L)
call get_param(param_file, mdl, "IDL_HURR_MAX_WIND", CS%max_windspeed, &
"Maximum wind speed used in the idealized hurricane"// &
"wind profile.", units='m/s', default=65., scale=US%m_s_to_L_T)
Expand All @@ -143,28 +143,26 @@ subroutine idealized_hurricane_wind_init(Time, G, US, param_file, CS)
"hurricane wind profile.", units='m/s', default=5.0, scale=US%m_s_to_L_T)
call get_param(param_file, mdl, "IDL_HURR_TRAN_DIR", CS%hurr_translation_dir, &
"Translation direction (towards) of hurricane used in the "//&
"idealized hurricane wind profile.", units='degrees', &
default=180.0, scale=CS%Deg2Rad)
"idealized hurricane wind profile.", &
units='degrees', default=180.0, scale=CS%Deg2Rad)
call get_param(param_file, mdl, "IDL_HURR_X0", CS%Hurr_cen_X0, &
"Idealized Hurricane initial X position", &
units='m', default=0., scale=US%m_to_L)
call get_param(param_file, mdl, "IDL_HURR_Y0", CS%Hurr_cen_Y0, &
"Idealized Hurricane initial Y position", &
units='m', default=0., scale=US%m_to_L)
call get_param(param_file, mdl, "IDL_HURR_TAU_CURR_REL", CS%relative_tau, &
"Current relative stress switch "//&
"used in the idealized hurricane wind profile.", &
units='', default=.false.)
"Current relative stress switch used in the idealized hurricane wind profile.", &
default=.false.)

! Parameters for SCM mode
call get_param(param_file, mdl, "IDL_HURR_SCM_BR_BENCH", CS%BR_BENCH, &
"Single column mode benchmark case switch, which is "// &
"invoking a modification (bug) in the wind profile meant to "//&
"reproduce a previous implementation.", units='', default=.false.)
"reproduce a previous implementation.", default=.false.)
call get_param(param_file, mdl, "IDL_HURR_SCM", CS%SCM_MODE, &
"Single Column mode switch "//&
"used in the SCM idealized hurricane wind profile.", &
units='', default=.false.)
"Single Column mode switch used in the SCM idealized hurricane wind profile.", &
default=.false.)
call get_param(param_file, mdl, "IDL_HURR_SCM_LOCY", CS%dy_from_center, &
"Y distance of station used in the SCM idealized hurricane "//&
"wind profile.", units='m', default=50.e3, scale=US%m_to_L)
Expand All @@ -186,8 +184,8 @@ subroutine idealized_hurricane_wind_init(Time, G, US, param_file, CS)
"parameters from vertical units of m to kg m-2.", &
units="kg m-3", default=1035.0, scale=US%kg_m3_to_R, do_not_log=.true.)
call get_param(param_file, mdl, "GUST_CONST", CS%gustiness, &
"The background gustiness in the winds.", units="Pa", &
default=0.0, scale=US%kg_m3_to_R*US%m_s_to_L_T**2*US%L_to_Z, do_not_log=.true.)
"The background gustiness in the winds.", &
units="Pa", default=0.0, scale=US%kg_m2s_to_RZ_T*US%m_s_to_L_T, do_not_log=.true.)

if (CS%BR_BENCH) then
CS%rho_a = 1.2*US%kg_m3_to_R
Expand Down
64 changes: 30 additions & 34 deletions src/user/MOM_wave_interface.F90
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
call log_version(param_file, mdl, version)

! Langmuir number Options
call get_param(param_file, mdl, "LA_DEPTH_RATIO", CS%LA_FracHBL, &
"The depth (normalized by BLD) to average Stokes drift over in "//&
"Langmuir number calculation, where La = sqrt(ust/Stokes).", &
units="nondim", default=0.04)
call get_param(param_file, mdl, "LA_DEPTH_RATIO", CS%LA_FracHBL, &
"The depth (normalized by BLD) to average Stokes drift over in "//&
"Langmuir number calculation, where La = sqrt(ust/Stokes).", &
units="nondim", default=0.04)

if (StatisticalWaves) then
CS%WaveMethod = LF17
Expand All @@ -256,25 +256,25 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
! Wave modified physics
! Presently these are all in research mode
call get_param(param_file, mdl, "LAGRANGIAN_MIXING", CS%LagrangianMixing, &
"Flag to use Lagrangian Mixing of momentum", units="", &
Default=.false., do_not_log=.not.use_waves)
"Flag to use Lagrangian Mixing of momentum", default=.false., &
do_not_log=.not.use_waves)
if (CS%LagrangianMixing) then
! Force Code Intervention
call MOM_error(FATAL,"Should you be enabling Lagrangian Mixing? Code not ready.")
endif
call get_param(param_file, mdl, "STOKES_MIXING", CS%StokesMixing, &
"Flag to use Stokes Mixing of momentum", units="", &
Default=.false., do_not_log=.not.use_waves)
"Flag to use Stokes Mixing of momentum", default=.false., &
do_not_log=.not.use_waves)
if (CS%StokesMixing) then
! Force Code Intervention
call MOM_error(FATAL,"Should you be enabling Stokes Mixing? Code not ready.")
call MOM_error(FATAL, "Should you be enabling Stokes Mixing? Code not ready.")
endif
call get_param(param_file, mdl, "CORIOLIS_STOKES", CS%CoriolisStokes, &
"Flag to use Coriolis Stokes acceleration", units="", &
Default=.false., do_not_log=.not.use_waves)
"Flag to use Coriolis Stokes acceleration", default=.false., &
do_not_log=.not.use_waves)
if (CS%CoriolisStokes) then
! Force Code Intervention
call MOM_error(FATAL,"Should you be enabling Coriolis-Stokes? Code not ready.")
call MOM_error(FATAL, "Should you be enabling Coriolis-Stokes? Code not ready.")
endif

! Get Wave Method and write to integer WaveMethod
Expand All @@ -293,7 +293,7 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
" directly from WW3 and is based on the \n"// &
" surface layer and projected Langmuir \n"// &
" number (Li 2016)\n", &
units='', default=NULL_STRING)
default=NULL_STRING)
select case (TRIM(TMPSTRING1))
case (NULL_STRING)! No Waves
call MOM_error(FATAL, "wave_interface_init called with no specified "//&
Expand All @@ -311,12 +311,11 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
units='m', default=50.0, scale=US%m_to_Z)
case (SURFBANDS_STRING)! Surface Stokes Drift Bands
CS%WaveMethod = SURFBANDS
call get_param(param_file, mdl, "SURFBAND_SOURCE", TMPSTRING2, &
"Choice of SURFACE_BANDS data mode, valid options include: \n"// &
" DATAOVERRIDE - Read from NetCDF using FMS DataOverride. \n"// &
" COUPLER - Look for variables from coupler pass \n"// &
" INPUT - Testing with fixed values.", &
units='', default=NULL_STRING)
call get_param(param_file, mdl, "SURFBAND_SOURCE", TMPSTRING2, &
"Choice of SURFACE_BANDS data mode, valid options include: \n"//&
" DATAOVERRIDE - Read from NetCDF using FMS DataOverride. \n"//&
" COUPLER - Look for variables from coupler pass \n"//&
" INPUT - Testing with fixed values.", default=NULL_STRING)
select case (TRIM(TMPSTRING2))
case (NULL_STRING)! Default
call MOM_error(FATAL, "wave_interface_init called with SURFACE_BANDS"//&
Expand All @@ -328,10 +327,10 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
case (COUPLER_STRING)! Reserved for coupling
CS%DataSource = COUPLER
! This is just to make something work, but it needs to be read from the wavemodel.
call get_param(param_file,mdl,"STK_BAND_COUPLER",CS%NumBands, &
"STK_BAND_COUPLER is the number of Stokes drift bands in the coupler. "// &
"This has to be consistent with the number of Stokes drift bands in WW3, "//&
"or the model will fail.",units='', default=1)
call get_param(param_file, mdl, "STK_BAND_COUPLER",CS%NumBands, &
"STK_BAND_COUPLER is the number of Stokes drift bands in the coupler. "//&
"This has to be consistent with the number of Stokes drift bands in WW3, "//&
"or the model will fail.", default=1)
allocate( CS%WaveNum_Cen(CS%NumBands), source=0.0 )
allocate( CS%STKx0(G%isdB:G%iedB,G%jsd:G%jed,CS%NumBands), source=0.0 )
allocate( CS%STKy0(G%isdB:G%iedB,G%jsd:G%jed,CS%NumBands), source=0.0 )
Expand All @@ -341,11 +340,10 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
units='rad/m', default=0.12566, scale=US%Z_to_m)
case (INPUT_STRING)! A method to input the Stokes band (globally uniform)
CS%DataSource = INPUT
call get_param(param_file,mdl,"SURFBAND_NB",CS%NumBands, &
"Prescribe number of wavenumber bands for Stokes drift. "// &
"Make sure this is consistnet w/ WAVENUMBERS, STOKES_X, and "// &
"STOKES_Y, there are no safety checks in the code.", &
units='', default=1)
call get_param(param_file, mdl, "SURFBAND_NB", CS%NumBands, &
"Prescribe number of wavenumber bands for Stokes drift. "//&
"Make sure this is consistnet w/ WAVENUMBERS, STOKES_X, and "//&
"STOKES_Y, there are no safety checks in the code.", default=1)
allocate( CS%WaveNum_Cen(1:CS%NumBands), source=0.0 )
allocate( CS%PrescribedSurfStkX(1:CS%NumBands), source=0.0 )
allocate( CS%PrescribedSurfStkY(1:CS%NumBands), source=0.0 )
Expand All @@ -370,17 +368,15 @@ subroutine MOM_wave_interface_init(time, G, GV, US, param_file, CS, diag )
call MOM_error(WARNING,"DHH85 only ever set-up for uniform cases w/"//&
" Stokes drift in x-direction.")
call get_param(param_file, mdl, "DHH85_AGE_FP", CS%WaveAgePeakFreq, &
"Choose true to use waveage in peak frequency.", &
units='', default=.false.)
"Choose true to use waveage in peak frequency.", default=.false.)
call get_param(param_file, mdl, "DHH85_AGE", CS%WaveAge, &
"Wave Age for DHH85 spectrum.", &
units='', default=1.2)
call get_param(param_file,mdl,"DHH85_WIND", CS%WaveWind, &
call get_param(param_file, mdl, "DHH85_WIND", CS%WaveWind, &
"Wind speed for DHH85 spectrum.", &
units='m s-1', default=10.0, scale=US%m_s_to_L_T)
call get_param(param_file,mdl,"STATIC_DHH85", CS%StaticWaves, &
"Flag to disable updating DHH85 Stokes drift.", &
default=.false.)
call get_param(param_file, mdl, "STATIC_DHH85", CS%StaticWaves, &
"Flag to disable updating DHH85 Stokes drift.", default=.false.)
case (LF17_STRING)!Li and Fox-Kemper 17 wind-sea Langmuir number
CS%WaveMethod = LF17
case (EFACTOR_STRING)!Li and Fox-Kemper 16
Expand Down
53 changes: 22 additions & 31 deletions src/user/SCM_CVMix_tests.F90
Original file line number Diff line number Diff line change
Expand Up @@ -143,48 +143,39 @@ subroutine SCM_CVMix_tests_surface_forcing_init(Time, G, param_file, CS)

! Read all relevant parameters and write them to the model log.
call log_version(param_file, mdl, version, "")
call get_param(param_file, mdl, "SCM_USE_WIND_STRESS", &
CS%UseWindStress, "Wind Stress switch "// &
"used in the SCM CVMix surface forcing.", &
units='', default=.false.)
call get_param(param_file, mdl, "SCM_USE_HEAT_FLUX", &
CS%UseHeatFlux, "Heat flux switch "// &
"used in the SCM CVMix test surface forcing.", &
units='', default=.false.)
call get_param(param_file, mdl, "SCM_USE_EVAPORATION", &
CS%UseEvaporation, "Evaporation switch "// &
"used in the SCM CVMix test surface forcing.", &
units='', default=.false.)
call get_param(param_file, mdl, "SCM_USE_DIURNAL_SW", &
CS%UseDiurnalSW, "Diurnal sw radation switch "// &
"used in the SCM CVMix test surface forcing.", &
units='', default=.false.)
call get_param(param_file, mdl, "SCM_USE_WIND_STRESS", CS%UseWindStress, &
"Wind Stress switch used in the SCM CVMix surface forcing.", &
default=.false.)
call get_param(param_file, mdl, "SCM_USE_HEAT_FLUX", CS%UseHeatFlux, &
"Heat flux switch used in the SCM CVMix test surface forcing.", &
default=.false.)
call get_param(param_file, mdl, "SCM_USE_EVAPORATION", CS%UseEvaporation, &
"Evaporation switch used in the SCM CVMix test surface forcing.", &
default=.false.)
call get_param(param_file, mdl, "SCM_USE_DIURNAL_SW", CS%UseDiurnalSW, &
"Diurnal sw radation switch used in the SCM CVMix test surface forcing.", &
default=.false.)
if (CS%UseWindStress) then
call get_param(param_file, mdl, "SCM_TAU_X", &
CS%tau_x, "Constant X-dir wind stress "// &
"used in the SCM CVMix test surface forcing.", &
call get_param(param_file, mdl, "SCM_TAU_X", CS%tau_x, &
"Constant X-dir wind stress used in the SCM CVMix test surface forcing.", &
units='N/m2', scale=US%kg_m2s_to_RZ_T*US%m_s_to_L_T, fail_if_missing=.true.)
call get_param(param_file, mdl, "SCM_TAU_Y", &
CS%tau_y, "Constant y-dir wind stress "// &
"used in the SCM CVMix test surface forcing.", &
call get_param(param_file, mdl, "SCM_TAU_Y", CS%tau_y, &
"Constant y-dir wind stress used in the SCM CVMix test surface forcing.", &
units='N/m2', scale=US%kg_m2s_to_RZ_T*US%m_s_to_L_T, fail_if_missing=.true.)
endif
if (CS%UseHeatFlux) then
call get_param(param_file, mdl, "SCM_HEAT_FLUX", &
CS%surf_HF, "Constant surface heat flux "// &
"used in the SCM CVMix test surface forcing.", &
call get_param(param_file, mdl, "SCM_HEAT_FLUX", CS%surf_HF, &
"Constant surface heat flux used in the SCM CVMix test surface forcing.", &
units='m K/s', scale=US%m_to_Z*US%T_to_s, fail_if_missing=.true.)
endif
if (CS%UseEvaporation) then
call get_param(param_file, mdl, "SCM_EVAPORATION", &
CS%surf_evap, "Constant surface evaporation "// &
"used in the SCM CVMix test surface forcing.", &
call get_param(param_file, mdl, "SCM_EVAPORATION", CS%surf_evap, &
"Constant surface evaporation used in the SCM CVMix test surface forcing.", &
units='m/s', scale=US%m_to_Z*US%T_to_s, fail_if_missing=.true.)
endif
if (CS%UseDiurnalSW) then
call get_param(param_file, mdl, "SCM_DIURNAL_SW_MAX", &
CS%Max_sw, "Maximum diurnal sw radiation "// &
"used in the SCM CVMix test surface forcing.", &
call get_param(param_file, mdl, "SCM_DIURNAL_SW_MAX", CS%Max_sw, &
"Maximum diurnal sw radiation used in the SCM CVMix test surface forcing.", &
units='m K/s', scale=US%m_to_Z*US%T_to_s, fail_if_missing=.true.)
endif
call get_param(param_file, mdl, "RHO_0", CS%Rho0, &
Expand Down

0 comments on commit 6bfd073

Please sign in to comment.