From add8b2c36285101a638865b77ca260ba82580992 Mon Sep 17 00:00:00 2001 From: JeffBeck-NOAA <55201531+JeffBeck-NOAA@users.noreply.github.com> Date: Wed, 23 Mar 2022 14:14:47 -0600 Subject: [PATCH] Add missing user-defined stochastic physics options; fix stochastic physics seed generation script (#704) ## DESCRIPTION OF CHANGES: Add missing user-defined options for tendency-based stochastic physics and fix the ensemble-based seed generation script to work regardless of whether stochastic physics is turned on or not. ## TESTS CONDUCTED: Tested on Hera using the following WE2E configurations with and without stochastic physics: config.grid_RRFS_CONUS_3km_ics_HRRR_lbcs_RAP_suite_HRRR.sh config.community_ensemble_2mems.sh ## ISSUE (optional): [Issue #702](https://github.com/ufs-community/regional_workflow/issues/702) ## CONTRIBUTORS (optional): Thanks to @mkavulich and @chan-hoo for finding this problem. --- scripts/exregional_run_fcst.sh | 7 +- ush/config_defaults.sh | 9 +++ ush/generate_FV3LAM_wflow.sh | 64 ++++++++++----- ...arams.sh => set_FV3nml_ens_stoch_seeds.sh} | 81 +++++++++++-------- 4 files changed, 104 insertions(+), 57 deletions(-) rename ush/{set_FV3nml_stoch_params.sh => set_FV3nml_ens_stoch_seeds.sh} (87%) diff --git a/scripts/exregional_run_fcst.sh b/scripts/exregional_run_fcst.sh index d7c3d48f62..331bb6ab49 100755 --- a/scripts/exregional_run_fcst.sh +++ b/scripts/exregional_run_fcst.sh @@ -9,7 +9,7 @@ # . ${GLOBAL_VAR_DEFNS_FP} . $USHDIR/source_util_funcs.sh -. $USHDIR/set_FV3nml_stoch_params.sh +. $USHDIR/set_FV3nml_ens_stoch_seeds.sh # #----------------------------------------------------------------------- # @@ -444,8 +444,9 @@ if [ ${WRITE_DOPOST} = "TRUE" ]; then cp_vrfy ${UPP_DIR}/parm/params_grib2_tbl_new . fi -if [ "${DO_ENSEMBLE}" = TRUE ]; then - set_FV3nml_stoch_params cdate="$cdate" || print_err_msg_exit "\ +if [ "${DO_ENSEMBLE}" = TRUE ] && ([ "${DO_SPP}" = TRUE ] || [ "${DO_SPPT}" = TRUE ] || [ "${DO_SHUM}" = TRUE ] \ + [ "${DO_SKEB}" = TRUE ] || [ "${DO_LSM_SPP}" = TRUE ]); then + set_FV3nml_ens_stoch_seeds cdate="$cdate" || print_err_msg_exit "\ Call to function to create the ensemble-based namelist for the current cycle's (cdate) run directory (run_dir) failed: cdate = \"${cdate}\" diff --git a/ush/config_defaults.sh b/ush/config_defaults.sh index 4c7b4d7e8c..466344f682 100644 --- a/ush/config_defaults.sh +++ b/ush/config_defaults.sh @@ -1504,6 +1504,7 @@ FIXgsm_FILES_TO_COPY_TO_FIXam=( \ "global_hyblev.l65.txt" \ "global_zorclim.1x1.grb" \ "global_sfc_emissivity_idx.txt" \ +"global_tg3clim.2.6x1.5.grb" \ "global_solarconstant_noaa_an.txt" \ "global_albedo4.1x1.grb" \ "geo_em.d01.lat-lon.2.5m.HGT_M.nc" \ @@ -1558,6 +1559,7 @@ CYCLEDIR_LINKS_TO_FIXam_FILES_MAPPING=( \ "global_h2oprdlos.f77 | global_h2o_pltc.f77" \ "global_albedo4.1x1.grb | global_albedo4.1x1.grb" \ "global_zorclim.1x1.grb | global_zorclim.1x1.grb" \ +"global_tg3clim.2.6x1.5.grb | global_tg3clim.2.6x1.5.grb" \ "sfc_emissivity_idx.txt | global_sfc_emissivity_idx.txt" \ "solarconstant_noaa_an.txt | global_solarconstant_noaa_an.txt" \ "global_o3prdlos.f77 | " \ @@ -1793,18 +1795,25 @@ NUM_ENS_MEMBERS="1" DO_SHUM="FALSE" DO_SPPT="FALSE" DO_SKEB="FALSE" +ISEED_SPPT="1" +ISEED_SHUM="2" +ISEED_SKEB="3" +NEW_LSCALE="TRUE" SHUM_MAG="0.006" #Variable "shum" in input.nml SHUM_LSCALE="150000" SHUM_TSCALE="21600" #Variable "shum_tau" in input.nml SHUM_INT="3600" #Variable "shumint" in input.nml SPPT_MAG="0.7" #Variable "sppt" in input.nml +SPPT_LOGIT="TRUE" SPPT_LSCALE="150000" SPPT_TSCALE="21600" #Variable "sppt_tau" in input.nml SPPT_INT="3600" #Variable "spptint" in input.nml +SPPT_SFCLIMIT="TRUE" SKEB_MAG="0.5" #Variable "skeb" in input.nml SKEB_LSCALE="150000" SKEB_TSCALE="21600" #Variable "skeb_tau" in input.nml SKEB_INT="3600" #Variable "skebint" in input.nml +SKEBNORM="1" SKEB_VDOF="10" USE_ZMTNBLCK="FALSE" # diff --git a/ush/generate_FV3LAM_wflow.sh b/ush/generate_FV3LAM_wflow.sh index 7c840a955f..88c6493a83 100755 --- a/ush/generate_FV3LAM_wflow.sh +++ b/ush/generate_FV3LAM_wflow.sh @@ -790,22 +790,6 @@ settings="\ 'lndp_type': ${LNDP_TYPE}, 'lndp_each_step': ${LSM_SPP_EACH_STEP}, 'fhcyc': ${FHCYC_LSM_SPP_OR_NOT}, - } -'nam_stochy': { - 'shum': ${SHUM_MAG}, - 'shum_lscale': ${SHUM_LSCALE}, - 'shum_tau': ${SHUM_TSCALE}, - 'shumint': ${SHUM_INT}, - 'sppt': ${SPPT_MAG}, - 'sppt_lscale': ${SPPT_LSCALE}, - 'sppt_tau': ${SPPT_TSCALE}, - 'spptint': ${SPPT_INT}, - 'skeb': ${SKEB_MAG}, - 'skeb_lscale': ${SKEB_LSCALE}, - 'skeb_tau': ${SKEB_TSCALE}, - 'skebint': ${SKEB_INT}, - 'skeb_vdof': ${SKEB_VDOF}, - 'use_zmtnblck': ${USE_ZMTNBLCK}, }" # # Add to "settings" the values of those namelist variables that specify @@ -862,6 +846,51 @@ done settings="$settings }" # +# Add the relevant tendency-based stochastic physics namelist variables to +# "settings" when running with SPPT, SHUM, or SKEB turned on. Otherwise +# only include an empty "nam_stochy" stanza. +# +settings="$settings +'nam_stochy': {" +if [ "${DO_SPPT}" = "TRUE" ]; then + settings="$settings + 'iseed_sppt': ${ISEED_SPPT}, + 'new_lscale': ${NEW_LSCALE}, + 'sppt': ${SPPT_MAG}, + 'sppt_logit': ${SPPT_LOGIT}, + 'sppt_lscale': ${SPPT_LSCALE}, + 'sppt_sfclimit': ${SPPT_SFCLIMIT}, + 'sppt_tau': ${SPPT_TSCALE}, + 'spptint': ${SPPT_INT}, + 'use_zmtnblck': ${USE_ZMTNBLCK}," +fi + +if [ "${DO_SHUM}" = "TRUE" ]; then + settings="$settings + 'iseed_shum': ${ISEED_SHUM}, + 'new_lscale': ${NEW_LSCALE}, + 'shum': ${SHUM_MAG}, + 'shum_lscale': ${SHUM_LSCALE}, + 'shum_tau': ${SHUM_TSCALE}, + 'shumint': ${SHUM_INT}, + 'use_zmtnblck': ${USE_ZMTNBLCK}," +fi + +if [ "${DO_SKEB}" = "TRUE" ]; then + settings="$settings + 'iseed_skeb': ${ISEED_SKEB}, + 'new_lscale': ${NEW_LSCALE}, + 'skeb': ${SKEB_MAG}, + 'skeb_lscale': ${SKEB_LSCALE}, + 'skebnorm': ${SKEBNORM}, + 'skeb_tau': ${SKEB_TSCALE}, + 'skebint': ${SKEB_INT}, + 'skeb_vdof': ${SKEB_VDOF}, + 'use_zmtnblck': ${USE_ZMTNBLCK}," +fi +settings="$settings + }" +# # Add the relevant SPP namelist variables to "settings" when running with # SPP turned on. Otherwise only include an empty "nam_sppperts" stanza. # @@ -1067,9 +1096,6 @@ fi } - - - # #----------------------------------------------------------------------- # diff --git a/ush/set_FV3nml_stoch_params.sh b/ush/set_FV3nml_ens_stoch_seeds.sh similarity index 87% rename from ush/set_FV3nml_stoch_params.sh rename to ush/set_FV3nml_ens_stoch_seeds.sh index 8abfc45d47..64322d6648 100644 --- a/ush/set_FV3nml_stoch_params.sh +++ b/ush/set_FV3nml_ens_stoch_seeds.sh @@ -13,7 +13,7 @@ # #----------------------------------------------------------------------- # -function set_FV3nml_stoch_params() { +function set_FV3nml_ens_stoch_seeds() { # #----------------------------------------------------------------------- # @@ -98,48 +98,67 @@ function set_FV3nml_stoch_params() { ensmem_num=$((10#${ENSMEM_INDX})) + settings="\ +'nam_stochy': {" + + if [ ${DO_SPPT} = TRUE ]; then + + iseed_sppt=$(( cdate*1000 + ensmem_num*10 + 1 )) + settings="$settings + 'iseed_sppt': ${iseed_sppt}," + + fi + + if [ ${DO_SHUM} = TRUE ]; then + iseed_shum=$(( cdate*1000 + ensmem_num*10 + 2 )) + settings="$settings + 'iseed_shum': ${iseed_shum}," + + fi + + if [ ${DO_SKEB} = TRUE ]; then + iseed_skeb=$(( cdate*1000 + ensmem_num*10 + 3 )) - iseed_sppt=$(( cdate*1000 + ensmem_num*10 + 1 )) - iseed_lsm_spp=$(( cdate*1000 + ensmem_num*10 + 9)) + settings="$settings + 'iseed_skeb': ${iseed_skeb}," + + fi + settings="$settings + }" + + settings="$settings +'nam_sppperts': {" + + if [ ${DO_SPP} = TRUE ]; then num_iseed_spp=${#ISEED_SPP[@]} for (( i=0; i<${num_iseed_spp}; i++ )); do iseed_spp[$i]=$(( cdate*1000 + ensmem_num*10 + ${ISEED_SPP[$i]} )) done - settings="" - - if [ ${DO_SPPT} = TRUE ] || [ ${DO_SHUM} = TRUE ] || [ ${DO_SKEB} = TRUE ]; then - - settings=$settings"\ -'nam_stochy': { - 'iseed_shum': ${iseed_shum}, - 'iseed_skeb': ${iseed_skeb}, - 'iseed_sppt': ${iseed_sppt}, - } -" + settings="$settings + 'iseed_spp': [ $( printf "%s, " "${iseed_spp[@]}" ) ]," + fi - if [ ${DO_SPP} = TRUE ]; then + settings="$settings + }" - settings=$settings"\ -'nam_sppperts': { - 'iseed_spp': [ $( printf "%s, " "${iseed_spp[@]}" ) ] - } -" - fi + settings="$settings +'nam_sfcperts': {" if [ ${DO_LSM_SPP} = TRUE ]; then + + iseed_lsm_spp=$(( cdate*1000 + ensmem_num*10 + 9)) + + settings="$settings + 'iseed_lndp': [ $( printf "%s, " "${iseed_lsm_spp[@]}" ) ]," - settings=$settings"\ -'nam_sfcperts': { - 'iseed_lndp': [ $( printf "%s, " "${iseed_lsm_spp[@]}" ) ] - } -" fi - if [ -n "$settings" ]; then + settings="$settings + }" $USHDIR/set_namelist.py -q \ -n ${FV3_NML_FP} \ @@ -156,14 +175,6 @@ failed. Parameters passed to this script are: Namelist settings specified on command line (these have highest precedence): settings = $settings" - - else - - print_info_msg "\ -The variable \"settings\" is empty, so not setting any namelist values." - - fi - # #----------------------------------------------------------------------- #