From b5dd23b16a2e4a3ae561a69414b38437c21d4ab0 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Thu, 25 Apr 2024 13:40:54 -0600 Subject: [PATCH 01/15] Add the global nesting capability --- parm/config/gfs/config.base | 7 ++ parm/config/gfs/config.fcst | 6 +- parm/config/gfs/config.resources | 7 ++ parm/config/gfs/config.stage_ic | 4 + parm/config/gfs/config.ufs | 102 +++++++++++++++++- scripts/exglobal_stage_ic.sh | 13 ++- ush/forecast_postdet.sh | 11 +- ush/forecast_predet.sh | 19 +++- ush/parsing_model_configure_FV3.sh | 21 ++++ ush/parsing_namelists_FV3.sh | 163 +++++++++++++++++++++-------- 10 files changed, 301 insertions(+), 52 deletions(-) diff --git a/parm/config/gfs/config.base b/parm/config/gfs/config.base index 5a58c75220e..ab35f717cbf 100644 --- a/parm/config/gfs/config.base +++ b/parm/config/gfs/config.base @@ -184,6 +184,13 @@ export DO_AERO="NO" export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both export DOBNDPNT_WAVE="NO" export FRAC_GRID=".true." +export DO_NEST="NO" # Whether to run a global-nested domain +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then + export ntiles=7 + export NEST_OUTPUT_GRID="regional_latlon" +else + export ntiles=6 +fi # Set operational resolution export OPS_RES="C768" # Do not change # TODO: Why is this needed and where is it used? diff --git a/parm/config/gfs/config.fcst b/parm/config/gfs/config.fcst index 14621307f59..ddca84306b5 100644 --- a/parm/config/gfs/config.fcst +++ b/parm/config/gfs/config.fcst @@ -253,7 +253,11 @@ export DO_SPPT=${DO_SPPT:-"NO"} export DO_SKEB=${DO_SKEB:-"NO"} export DO_SHUM=${DO_SHUM:-"NO"} export DO_LAND_PERT=${DO_LAND_PERT:-"NO"} -export DO_CA=${DO_CA:-"YES"} +if [[ "${DO_NEST:-NO}" == YES ]] ; then + export DO_CA="NO" #CA does not work with nesting. +else + export DO_CA=${DO_CA:-"YES"} +fi #coupling settings export cplmode="ufs.frac" diff --git a/parm/config/gfs/config.resources b/parm/config/gfs/config.resources index 9e229de11af..63b57b15b4e 100644 --- a/parm/config/gfs/config.resources +++ b/parm/config/gfs/config.resources @@ -600,6 +600,13 @@ case ${step} in [[ "${DO_ICE}" == "YES" ]] && nthreads_cice6=1 fi + if [[ ${ntiles} -gt 6 ]] ; then + export layout_x_nest=${layout_x_nest:-10} + export layout_y_nest=${layout_y_nest:-10} + export npx_nest=${npx_nest:-1441} + export npy_nest=${npy_nest:-961} + fi + # PETS for the atmosphere dycore (( FV3PETS = ntasks_fv3 * nthreads_fv3 )) echo "FV3 using (nthreads, PETS) = (${nthreads_fv3}, ${FV3PETS})" diff --git a/parm/config/gfs/config.stage_ic b/parm/config/gfs/config.stage_ic index 63d0e4a5cf3..51e57c33dd3 100644 --- a/parm/config/gfs/config.stage_ic +++ b/parm/config/gfs/config.stage_ic @@ -38,4 +38,8 @@ case "${CASE}" in ;; esac +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then + export CPL_ATMIC=GLOBAL-NEST_${CASE} +fi + echo "END: config.stage_ic" diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index 7cec5a08220..6aabe3c268b 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -68,6 +68,21 @@ if [[ "${skip_mom6}" == "false" ]] || [[ "${skip_cice6}" == "false" ]] || [[ "${ skip_mediator=false fi +if [[ "${DO_NEST:-NO}" == YES ]] ; then + export grid_type=0 + export target_lat=32.5 + export target_lon=-135.0 + export stretch_fac=1.0001 + export NEST_LON1=-195.000000 + export NEST_LAT1=-7.500000 + export NEST_LON2=-75.000000 + export NEST_LAT2=72.500000 + export twowaynest=${twowaynest:-.true.} +else + # No nest. + export grid_type=-1 +fi + # (Standard) Model resolution dependent variables case "${fv3_res}" in "C48") @@ -105,6 +120,24 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=1 export WRITE_GROUP_GFS=1 export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=1 + if [[ ${DO_NEST:-NO} == YES ]] ; then + export DELTIM=450 + export layout_x_gfs=4 + export layout_y_gfs=4 + export layout_x_nest=12 + export layout_y_nest=10 + export nest_refine=4 + export nest_ioffset=4 + export nest_joffset=9 + export npx_nest=361 + export npy_nest=241 + export NEST_DLON=0.25 + export NEST_DLAT=0.25 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=2 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=2 + fi ;; "C192") export DELTIM=450 @@ -123,6 +156,24 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 export WRITE_GROUP_GFS=2 export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=5 + if [[ ${DO_NEST:-NO} == YES ]] ; then + export DELTIM=225 + export layout_x_gfs=5 + export layout_y_gfs=6 + export layout_x_nest=15 + export layout_y_nest=25 + export nest_refine=4 + export nest_ioffset=7 + export nest_joffset=19 + export npx_nest=721 + export npy_nest=481 + export NEST_DLON=0.125 + export NEST_DLAT=0.125 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=15 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=15 + fi ;; "C384") export DELTIM=300 @@ -141,6 +192,26 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 export WRITE_GROUP_GFS=4 export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=10 + if [[ ${DO_NEST:-NO} == YES ]] ; then + export DELTIM=150 + export layout_x=8 + export layout_y=8 + export layout_x_gfs=8 + export layout_y_gfs=8 + export layout_x_nest=34 + export layout_y_nest=24 + export nest_refine=4 + export nest_ioffset=13 + export nest_joffset=37 + export npx_nest=1441 + export npy_nest=961 + export NEST_DLON=0.0625 + export NEST_DLAT=0.0625 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=20 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 + fi ;; "C768") export DELTIM=150 @@ -159,6 +230,28 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 export WRITE_GROUP_GFS=4 export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 #Note this should be 10 for WCOSS2 + if [[ ${DO_NEST:-NO} == YES ]] ; then + export DELTIM=75 + export layout_x=16 + export layout_y=10 + export layout_x_gfs=16 + export layout_y_gfs=10 + export layout_x_nest=48 + export layout_y_nest=45 + export nthreads_fv3=2 + export nthreads_fv3_gfs=2 + export nest_refine=4 + export nest_ioffset=24 + export nest_joffset=72 + export npx_nest=2881 + export npy_nest=1921 + export NEST_DLON=0.0325 + export NEST_DLAT=0.0325 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=90 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=90 + fi ;; "C1152") export DELTIM=120 @@ -209,6 +302,9 @@ export WRTTASK_PER_GROUP_PER_THREAD_GFS (( ntasks_fv3 = layout_x * layout_y * 6 )) (( ntasks_fv3_gfs = layout_x_gfs * layout_y_gfs * 6 )) +if [[ "${DO_NEST:-NO}" == YES ]] ; then + (( ntasks_fv3_gfs += layout_x_nest * layout_y_nest )) +fi export ntasks_fv3 export ntasks_fv3_gfs @@ -241,7 +337,11 @@ export cplice=".false." export cplchm=".false." export cplwav=".false." export cplwav2atm=".false." -export CCPP_SUITE="${CCPP_SUITE:-FV3_GFS_v17_p8_ugwpv1}" +if [[ "${DO_NEST:-NO}" == YES ]] ; then + export CCPP_SUITE="${CCPP_SUITE:-FV3_global_nest_v1}" +else + export CCPP_SUITE="${CCPP_SUITE:-FV3_GFS_v17_p8_ugwpv1}" +fi model_list="atm" # Mediator specific settings diff --git a/scripts/exglobal_stage_ic.sh b/scripts/exglobal_stage_ic.sh index 1a15ceb465d..d941fa10b48 100755 --- a/scripts/exglobal_stage_ic.sh +++ b/scripts/exglobal_stage_ic.sh @@ -42,9 +42,13 @@ for MEMDIR in "${MEMDIR_ARRAY[@]}"; do err=$((err + rc)) done for ftype in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data; do - for ((tt = 1; tt <= 6; tt++)); do + for ((tt = 1; tt <= ntiles; tt++)); do src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${PDY}.${cyc}0000.${ftype}.tile${tt}.nc" - tgt="${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.${ftype}.tile${tt}.nc" + if (( tt > 6 )) ; then + tgt="${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.${ftype}.nest0$((tt-5)).tile${tt}.nc" + else + tgt="${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.${ftype}.tile${tt}.nc" + fi ${NCP} "${src}" "${tgt}" rc=$? ((rc != 0)) && error_message "${src}" "${tgt}" "${rc}" @@ -62,7 +66,7 @@ for MEMDIR in "${MEMDIR_ARRAY[@]}"; do ((rc != 0)) && error_message "${src}" "${tgt}" "${rc}" err=$((err + rc)) for ftype in gfs_data sfc_data; do - for ((tt = 1; tt <= 6; tt++)); do + for ((tt = 1; tt <= ntiles; tt++)); do src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${ftype}.tile${tt}.nc" tgt="${COM_ATMOS_INPUT}/${ftype}.tile${tt}.nc" ${NCP} "${src}" "${tgt}" @@ -70,6 +74,9 @@ for MEMDIR in "${MEMDIR_ARRAY[@]}"; do ((rc != 0)) && error_message "${src}" "${tgt}" "${rc}" err=$((err + rc)) done + if (( ntiles > 6 )); then + ${NLN} "${COM_ATMOS_INPUT}/${ftype}.tile7.nc" "${COM_ATMOS_INPUT}/${ftype}.nest02.tile7.nc" + fi done fi diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 1c0c50de206..36df6c30aa4 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -175,6 +175,10 @@ EOF if [[ "${WRITE_DOPOST}" == ".true." ]]; then ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.master.grb2f${FH3}" "GFSPRS.GrbF${FH2}" ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}" + if [[ "${DO_NEST:-NO}" == YES ]] ; then + ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.grb2f${FH3}" "GFSPRS.GrbF${FH2}.nest02" + ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}.nest02" + fi fi done else # TODO: Is this even valid anymore? @@ -196,7 +200,12 @@ FV3_nml() { source "${USHgfs}/parsing_namelists_FV3.sh" source "${USHgfs}/parsing_model_configure_FV3.sh" - FV3_namelists + if [[ "${DO_NEST:-NO}" == YES ]] ; then + FV3_namelists global_with_nest + FV3_namelists nest + else + FV3_namelists #default to global without nest + fi FV3_model_configure echo "SUB ${FUNCNAME[0]}: FV3 name lists and model configure file created" diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 6605a9fa95e..212257c3239 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -107,9 +107,6 @@ FV3_predet(){ IAUFHRS=${IAUFHRS:-0} IAU_DELTHRS=${IAU_DELTHRS:-0} - # Model config options - ntiles=6 - #------------------------------------------------------------------ # changeable parameters # dycore definitions @@ -232,9 +229,16 @@ FV3_predet(){ # Conserve total energy as heat globally consv_te=${consv_te:-1.} # range 0.-1., 1. will restore energy to orig. val. before physics + if [[ "${DO_NEST:-NO}" == YES ]] ; then + consv_te=0 + k_split=${k_split:-1} + k_split_nest=${k_split_nest:-4} + else + consv_te=${consv_te:-1.} # range 0.-1., 1. will restore energy to orig. val. before physics + k_split=${k_split:-2} + fi # time step parameters in FV3 - k_split=${k_split:-2} n_split=${n_split:-5} if [[ "${MONO:0:4}" == "mono" ]]; then # monotonic options @@ -360,6 +364,13 @@ FV3_predet(){ ${NCP} "${FIXgfs}/ugwd/${CASE}/${CASE}_oro_data_ls.tile${tt}.nc" "${DATA}/INPUT/oro_data_ls.tile${tt}.nc" ${NCP} "${FIXgfs}/ugwd/${CASE}/${CASE}_oro_data_ss.tile${tt}.nc" "${DATA}/INPUT/oro_data_ss.tile${tt}.nc" done + if [[ "${DO_NEST:-NO}" == YES ]] ; then + ${NLN} "${DATA}/INPUT/oro_data.tile7.nc" "${DATA}/INPUT/oro_data.nest02.tile7.nc" + ${NLN} "${DATA}/INPUT/${CASE}_grid.tile7.nc" "${DATA}/INPUT/${CASE}_grid.nest02.tile7.nc" + ${NLN} "${DATA}/INPUT/${CASE}_grid.tile7.nc" "${DATA}/INPUT/grid.nest02.tile7.nc" + ${NLN} "${DATA}/INPUT/oro_data_ls.tile7.nc" "${DATA}/INPUT/oro_data_ls.nest02.tile7.nc" + ${NLN} "${DATA}/INPUT/oro_data_ss.tile7.nc" "${DATA}/INPUT/oro_data_ss.nest02.tile7.nc" + fi # NoahMP table local noahmptablefile="${PARMgfs}/ufs/noahmptable.tbl" diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 62d023a369a..e10107a49b7 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -59,6 +59,27 @@ if [[ ! -f ${template} ]]; then fi rm -f "${DATA}/model_configure" atparse < "${template}" >> "${DATA}/model_configure" + +if [[ "${DO_NEST:-NO}" == YES ]] ; then + cat >> model_configure < +output_grid: ${NEST_OUTPUT_GRID} +imo: ${npx_nest} +jmo: ${npy_nest} +cen_lon: ${target_lon} +cen_lat: ${target_lat} +lon1: ${NEST_LON1} +lat1: ${NEST_LAT1} +lon2: ${NEST_LON2} +lat2: ${NEST_LAT2} +dlon: ${NEST_DLON} +dlat: ${NEST_DLAT} + +EOF +fi + echo "Rendered model_configure" cat "${DATA}/model_configure" diff --git a/ush/parsing_namelists_FV3.sh b/ush/parsing_namelists_FV3.sh index 9e6e67f9cc7..664174f6e32 100755 --- a/ush/parsing_namelists_FV3.sh +++ b/ush/parsing_namelists_FV3.sh @@ -6,6 +6,20 @@ # shellcheck disable=SC2034 FV3_namelists(){ +# First argument tells us which namelist we're writing: +# global_no_nest = writing input.nml for global-only (no nest) +# global_with_nest = writing input.nml for running global with a nest +# nest = writing input_nest02.nml for running the nest +namelist_mode="${1:-global_no_nest}" + +if [[ ${namelist_mode} == nest ]] ; then + nml_file=input_nest02.nml + only_input_nml="YES" +else + nml_file=input.nml + only_input_nml="NO" +fi + # setup the tables DIAG_TABLE=${DIAG_TABLE:-${PARMgfs}/ufs/fv3/diag_table} DIAG_TABLE_APPEND=${DIAG_TABLE_APPEND:-${PARMgfs}/ufs/fv3/diag_table_aod} @@ -20,6 +34,7 @@ fi # ensure non-prognostic tracers are set dnats=${dnats:-0} +if [[ "${only_input_nml:-NO}" == "NO" ]] ; then # build the diag_table { echo "UFS_Weather_Model_Forecast" @@ -67,8 +82,28 @@ if [[ -n "${AERO_FIELD_TABLE:-}" ]]; then else ${NCP} "${FIELD_TABLE}" field_table fi +fi # only_input_nml + +if [[ ${namelist_mode} =~ global ]] ; then + layout_x_here=${layout_x} + layout_y_here=${layout_y} + ntiles_here=6 + npx_here=${npx} + npy_here=${npy} + k_split_here=${k_split} +else + layout_x_here=${layout_x_nest} + layout_y_here=${layout_y_nest} + ntiles_here=1 + nested_here=.true. + twowaynest_here=${twowaynest:-.true.} + nestupdate_here=${nestupdate:-7} + npx_here=${npx_nest} + npy_here=${npy_nest} + k_split_here=${k_split_nest} +fi -cat > input.nml < "${nml_file}" < input.nml < input.nml < input.nml <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF oz_phys = .false. oz_phys_2015 = .true. EOF ;; "FV3_GSD_v0") - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -219,7 +277,7 @@ EOF EOF ;; FV3_GFS_v16_coupled*) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -237,7 +295,7 @@ EOF EOF ;; FV3_GFS_v16*) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -257,7 +315,7 @@ EOF ;; FV3_GFS_v17*) local default_dt_inner=$(( DELTIM/2 )) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".true."} @@ -292,7 +350,7 @@ EOF ;; FV3_global_nest*) local default_dt_inner=$(( DELTIM/2 )) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} lcnorm = ${lcnorm:-".false."} ltaerosol = ${ltaerosol:-".false."} @@ -327,13 +385,13 @@ EOF EOF ;; *) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} EOF ;; esac -cat >> input.nml <> "${nml_file}" <> input.nml <> input.nml << EOF + cat >> "${nml_file}" << EOF fscav_aero = ${fscav_aero:-'*:0.0'} EOF fi -cat >> input.nml <> "${nml_file}" <> input.nml <> input.nml <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF iaufhrs = ${IAUFHRS} iau_delthrs = ${IAU_DELTHRS} iau_inc_files= ${IAU_INC_FILES} @@ -448,7 +506,7 @@ EOF fi if [[ ${DO_CA:-"NO"} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF do_ca = .true. ca_global = ${ca_global:-".false."} ca_sgs = ${ca_sgs:-".true."} @@ -465,19 +523,33 @@ EOF fi if [[ "${DO_LAND_PERT:-NO}" == "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF lndp_type = ${lndp_type:-2} n_var_lndp = ${n_var_lndp:-0} EOF fi # Close &gfs_physics_nml section -cat >> input.nml << EOF +cat >> "${nml_file}" << EOF +/ +EOF + +if [[ ${namelist_mode} == "global_with_nest" ]] ; then + cat >> "${nml_file}" << EOF +&fv_nest_nml + grid_pes = $(( layout_x * layout_y * 6 )),$(( layout_x_nest * layout_y_nest )) + tile_coarse = 0,6 + num_tile_top = 6 + p_split = 1 + nest_refine = 0,${nest_refine} + nest_ioffsets = 0,${nest_ioffset} + nest_joffsets = 0,${nest_joffset} / EOF +fi if [[ ${knob_ugwp_version} -eq 0 ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -496,7 +568,7 @@ EOF fi if [[ ${knob_ugwp_version} -eq 1 ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -522,9 +594,9 @@ if [[ ${knob_ugwp_version} -eq 1 ]]; then EOF fi -echo "" >> input.nml +echo "" >> "${nml_file}" -cat >> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> "${nml_file}" <> input.nml +echo "" >> "${nml_file}" #if [ $MEMBER -gt 0 ]; then if [[ "${DO_SPPT}" = "YES" || "${DO_SHUM}" = "YES" || "${DO_SKEB}" = "YES" || "${DO_LAND_PERT}" = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_stochy EOF if [[ ${DO_SKEB} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF skeb = ${SKEB} iseed_skeb = ${ISEED_SKEB:-${ISEED}} skeb_tau = ${SKEB_TAU:-"-999."} @@ -655,7 +734,7 @@ EOF fi if [[ ${DO_SHUM} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF shum = ${SHUM} iseed_shum = ${ISEED_SHUM:-${ISEED}} shum_tau = ${SHUM_TAU:-"-999."} @@ -664,7 +743,7 @@ EOF fi if [[ ${DO_SPPT} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF sppt = ${SPPT} iseed_sppt = ${ISEED_SPPT:-${ISEED}} sppt_tau = ${SPPT_TAU:-"-999."} @@ -677,7 +756,7 @@ EOF fi if [[ "${DO_OCN_SPPT:-NO}" == "YES" ]]; then - cat >> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF / EOF if [[ ${DO_LAND_PERT} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_sfcperts lndp_type = ${lndp_type} LNDP_TAU = ${LNDP_TAU} @@ -728,7 +807,7 @@ EOF / EOF else - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_sfcperts / EOF @@ -736,7 +815,7 @@ EOF else - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_stochy / &nam_sfcperts @@ -745,9 +824,9 @@ EOF fi -# Echo out formatted "input.nml" +# Echo out formatted ""${nml_file}"" echo "====================================" -echo "FV3_namelists(): 'input.nml'" -cat input.nml +echo "FV3_namelists(): '${nml_file}'" +cat "${nml_file}" echo "====================================" } From b1ad53dddcdcda115b1086dc4be40c0f4d28e4e0 Mon Sep 17 00:00:00 2001 From: Guoqing Ge Date: Thu, 25 Apr 2024 16:45:55 -0600 Subject: [PATCH 02/15] Apply suggestions from code review Co-authored-by: Rahul Mahajan --- parm/config/gfs/config.fcst | 7 +++---- parm/config/gfs/config.resources | 2 +- parm/config/gfs/config.stage_ic | 2 +- parm/config/gfs/config.ufs | 3 ++- ush/forecast_postdet.sh | 3 ++- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/parm/config/gfs/config.fcst b/parm/config/gfs/config.fcst index ddca84306b5..63273e0fe4c 100644 --- a/parm/config/gfs/config.fcst +++ b/parm/config/gfs/config.fcst @@ -253,10 +253,9 @@ export DO_SPPT=${DO_SPPT:-"NO"} export DO_SKEB=${DO_SKEB:-"NO"} export DO_SHUM=${DO_SHUM:-"NO"} export DO_LAND_PERT=${DO_LAND_PERT:-"NO"} -if [[ "${DO_NEST:-NO}" == YES ]] ; then - export DO_CA="NO" #CA does not work with nesting. -else - export DO_CA=${DO_CA:-"YES"} +export DO_CA=${DO_CA:-"YES"} +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then + export DO_CA="NO" # CA does not work with nesting. fi #coupling settings diff --git a/parm/config/gfs/config.resources b/parm/config/gfs/config.resources index 63b57b15b4e..62a3e17bdb9 100644 --- a/parm/config/gfs/config.resources +++ b/parm/config/gfs/config.resources @@ -600,7 +600,7 @@ case ${step} in [[ "${DO_ICE}" == "YES" ]] && nthreads_cice6=1 fi - if [[ ${ntiles} -gt 6 ]] ; then + if (( ntiles > 6 )); then export layout_x_nest=${layout_x_nest:-10} export layout_y_nest=${layout_y_nest:-10} export npx_nest=${npx_nest:-1441} diff --git a/parm/config/gfs/config.stage_ic b/parm/config/gfs/config.stage_ic index 51e57c33dd3..9956e8af6a0 100644 --- a/parm/config/gfs/config.stage_ic +++ b/parm/config/gfs/config.stage_ic @@ -39,7 +39,7 @@ case "${CASE}" in esac if [[ "${DO_NEST:-NO}" == "YES" ]] ; then - export CPL_ATMIC=GLOBAL-NEST_${CASE} + export CPL_ATMIC="GLOBAL-NEST_${CASE}" fi echo "END: config.stage_ic" diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index 6aabe3c268b..abbdbb6d1c9 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -68,7 +68,8 @@ if [[ "${skip_mom6}" == "false" ]] || [[ "${skip_cice6}" == "false" ]] || [[ "${ skip_mediator=false fi -if [[ "${DO_NEST:-NO}" == YES ]] ; then +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then + # Describe nest location, interaction with parent, etc. export grid_type=0 export target_lat=32.5 export target_lon=-135.0 diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 36df6c30aa4..b3f0ff5817a 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -200,11 +200,12 @@ FV3_nml() { source "${USHgfs}/parsing_namelists_FV3.sh" source "${USHgfs}/parsing_model_configure_FV3.sh" + # Call the appropriate namelist functions if [[ "${DO_NEST:-NO}" == YES ]] ; then FV3_namelists global_with_nest FV3_namelists nest else - FV3_namelists #default to global without nest + FV3_namelists fi FV3_model_configure From efce25953606beff021f41b1f7e8a59f2d16d228 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Thu, 25 Apr 2024 19:41:12 -0600 Subject: [PATCH 03/15] Apply suggestions from code review --- parm/config/gefs/config.base | 7 + parm/config/gfs/config.ufs | 296 +++++++++++++++-------------- sorc/link_workflow.sh | 2 +- ush/forecast_postdet.sh | 10 +- ush/parsing_model_configure_FV3.sh | 27 +-- ush/parsing_namelists_FV3.sh | 6 +- 6 files changed, 171 insertions(+), 177 deletions(-) diff --git a/parm/config/gefs/config.base b/parm/config/gefs/config.base index 07664f15ff2..bc37c5abbc5 100644 --- a/parm/config/gefs/config.base +++ b/parm/config/gefs/config.base @@ -137,6 +137,13 @@ export DO_AERO="NO" export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both export DOBNDPNT_WAVE="NO" # The GEFS buoys file does not currently have any boundary points export FRAC_GRID=".true." +export DO_NEST="NO" # Whether to run a global-nested domain +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then + export ntiles=7 + export NEST_OUTPUT_GRID="regional_latlon" +else + export ntiles=6 +fi # Set operational resolution export OPS_RES="C768" # Do not change diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index abbdbb6d1c9..ad306277a71 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -69,19 +69,19 @@ if [[ "${skip_mom6}" == "false" ]] || [[ "${skip_cice6}" == "false" ]] || [[ "${ fi if [[ "${DO_NEST:-NO}" == "YES" ]] ; then - # Describe nest location, interaction with parent, etc. - export grid_type=0 - export target_lat=32.5 - export target_lon=-135.0 - export stretch_fac=1.0001 - export NEST_LON1=-195.000000 - export NEST_LAT1=-7.500000 - export NEST_LON2=-75.000000 - export NEST_LAT2=72.500000 - export twowaynest=${twowaynest:-.true.} + # Describe nest location, interaction with parent, etc. + export grid_type=0 + export target_lat=32.5 + export target_lon=-135.0 + export stretch_fac=1.0001 + export NEST_LON1=-195.000000 + export NEST_LAT1=-7.500000 + export NEST_LON2=-75.000000 + export NEST_LAT2=72.500000 + export twowaynest=${twowaynest:-.true.} else - # No nest. - export grid_type=-1 + # No nest. + export grid_type=-1 fi # (Standard) Model resolution dependent variables @@ -105,153 +105,157 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=1 ;; "C96") - export DELTIM=600 - export layout_x=2 - export layout_y=2 - export layout_x_gfs=2 - export layout_y_gfs=2 - export nthreads_fv3=1 - export nthreads_fv3_gfs=1 - export nthreads_ufs=1 - export nthreads_ufs_gfs=1 - export cdmbgwd="0.14,1.8,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling - export cdmbgwd_gsl="20.0,2.5,1.0,1.0" # settings for GSL drag suite - export knob_ugwp_tauamp=3.0e-3 # setting for UGWPv1 non-stationary GWD - export WRITE_GROUP=1 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=1 - export WRITE_GROUP_GFS=1 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=1 if [[ ${DO_NEST:-NO} == YES ]] ; then - export DELTIM=450 - export layout_x_gfs=4 - export layout_y_gfs=4 - export layout_x_nest=12 - export layout_y_nest=10 - export nest_refine=4 - export nest_ioffset=4 - export nest_joffset=9 - export npx_nest=361 - export npy_nest=241 - export NEST_DLON=0.25 - export NEST_DLAT=0.25 - export WRITE_GROUP=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=2 - export WRITE_GROUP_GFS=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=2 + export DELTIM=450 + export layout_x_gfs=4 + export layout_y_gfs=4 + export layout_x_nest=12 + export layout_y_nest=10 + export nest_refine=4 + export nest_ioffset=4 + export nest_joffset=9 + export npx_nest=361 + export npy_nest=241 + export NEST_DLON=0.25 + export NEST_DLAT=0.25 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=2 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=2 + else + export DELTIM=600 + export layout_x=2 + export layout_y=2 + export layout_x_gfs=2 + export layout_y_gfs=2 + export nthreads_fv3=1 + export nthreads_fv3_gfs=1 + export nthreads_ufs=1 + export nthreads_ufs_gfs=1 + export cdmbgwd="0.14,1.8,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling + export cdmbgwd_gsl="20.0,2.5,1.0,1.0" # settings for GSL drag suite + export knob_ugwp_tauamp=3.0e-3 # setting for UGWPv1 non-stationary GWD + export WRITE_GROUP=1 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=1 + export WRITE_GROUP_GFS=1 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=1 fi ;; "C192") - export DELTIM=450 - export layout_x=4 - export layout_y=6 - export layout_x_gfs=4 - export layout_y_gfs=6 - export nthreads_fv3=1 - export nthreads_fv3_gfs=2 - export nthreads_ufs=1 - export nthreads_ufs_gfs=2 - export cdmbgwd="0.23,1.5,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling - export cdmbgwd_gsl="10.0,3.5,1.0,1.0" # settings for GSL drag suite - export knob_ugwp_tauamp=1.5e-3 # setting for UGWPv1 non-stationary GWD - export WRITE_GROUP=1 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 - export WRITE_GROUP_GFS=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=5 if [[ ${DO_NEST:-NO} == YES ]] ; then - export DELTIM=225 - export layout_x_gfs=5 - export layout_y_gfs=6 - export layout_x_nest=15 - export layout_y_nest=25 - export nest_refine=4 - export nest_ioffset=7 - export nest_joffset=19 - export npx_nest=721 - export npy_nest=481 - export NEST_DLON=0.125 - export NEST_DLAT=0.125 - export WRITE_GROUP=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=15 - export WRITE_GROUP_GFS=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=15 + export DELTIM=225 + export layout_x_gfs=5 + export layout_y_gfs=6 + export layout_x_nest=15 + export layout_y_nest=25 + export nest_refine=4 + export nest_ioffset=7 + export nest_joffset=19 + export npx_nest=721 + export npy_nest=481 + export NEST_DLON=0.125 + export NEST_DLAT=0.125 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=15 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=15 + else + export DELTIM=450 + export layout_x=4 + export layout_y=6 + export layout_x_gfs=4 + export layout_y_gfs=6 + export nthreads_fv3=1 + export nthreads_fv3_gfs=2 + export nthreads_ufs=1 + export nthreads_ufs_gfs=2 + export cdmbgwd="0.23,1.5,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling + export cdmbgwd_gsl="10.0,3.5,1.0,1.0" # settings for GSL drag suite + export knob_ugwp_tauamp=1.5e-3 # setting for UGWPv1 non-stationary GWD + export WRITE_GROUP=1 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=5 fi ;; "C384") - export DELTIM=300 - export layout_x=8 - export layout_y=8 - export layout_x_gfs=8 - export layout_y_gfs=8 - export nthreads_fv3=2 - export nthreads_fv3_gfs=2 - export nthreads_ufs=2 - export nthreads_ufs_gfs=2 - export cdmbgwd="1.1,0.72,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling - export cdmbgwd_gsl="5.0,5.0,1.0,1.0" # settings for GSL drag suite - export knob_ugwp_tauamp=0.8e-3 # setting for UGWPv1 non-stationary GWD - export WRITE_GROUP=4 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 - export WRITE_GROUP_GFS=4 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=10 if [[ ${DO_NEST:-NO} == YES ]] ; then - export DELTIM=150 - export layout_x=8 - export layout_y=8 - export layout_x_gfs=8 - export layout_y_gfs=8 - export layout_x_nest=34 - export layout_y_nest=24 - export nest_refine=4 - export nest_ioffset=13 - export nest_joffset=37 - export npx_nest=1441 - export npy_nest=961 - export NEST_DLON=0.0625 - export NEST_DLAT=0.0625 - export WRITE_GROUP=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=20 - export WRITE_GROUP_GFS=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 + export DELTIM=150 + export layout_x=8 + export layout_y=8 + export layout_x_gfs=8 + export layout_y_gfs=8 + export layout_x_nest=34 + export layout_y_nest=24 + export nest_refine=4 + export nest_ioffset=13 + export nest_joffset=37 + export npx_nest=1441 + export npy_nest=961 + export NEST_DLON=0.0625 + export NEST_DLAT=0.0625 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=20 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 + else + export DELTIM=300 + export layout_x=8 + export layout_y=8 + export layout_x_gfs=8 + export layout_y_gfs=8 + export nthreads_fv3=2 + export nthreads_fv3_gfs=2 + export nthreads_ufs=2 + export nthreads_ufs_gfs=2 + export cdmbgwd="1.1,0.72,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling + export cdmbgwd_gsl="5.0,5.0,1.0,1.0" # settings for GSL drag suite + export knob_ugwp_tauamp=0.8e-3 # setting for UGWPv1 non-stationary GWD + export WRITE_GROUP=4 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 + export WRITE_GROUP_GFS=4 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=10 fi ;; "C768") - export DELTIM=150 - export layout_x=8 - export layout_y=12 - export layout_x_gfs=12 - export layout_y_gfs=16 - export nthreads_fv3=4 - export nthreads_fv3_gfs=4 - export nthreads_ufs=4 - export nthreads_ufs_gfs=4 - export cdmbgwd="4.0,0.15,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling - export cdmbgwd_gsl="2.5,7.5,1.0,1.0" # settings for GSL drag suite - export knob_ugwp_tauamp=0.5e-3 # setting for UGWPv1 non-stationary GWD - export WRITE_GROUP=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 - export WRITE_GROUP_GFS=4 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 #Note this should be 10 for WCOSS2 if [[ ${DO_NEST:-NO} == YES ]] ; then - export DELTIM=75 - export layout_x=16 - export layout_y=10 - export layout_x_gfs=16 - export layout_y_gfs=10 - export layout_x_nest=48 - export layout_y_nest=45 - export nthreads_fv3=2 - export nthreads_fv3_gfs=2 - export nest_refine=4 - export nest_ioffset=24 - export nest_joffset=72 - export npx_nest=2881 - export npy_nest=1921 - export NEST_DLON=0.0325 - export NEST_DLAT=0.0325 - export WRITE_GROUP=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=90 - export WRITE_GROUP_GFS=2 - export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=90 + export DELTIM=75 + export layout_x=16 + export layout_y=10 + export layout_x_gfs=16 + export layout_y_gfs=10 + export layout_x_nest=48 + export layout_y_nest=45 + export nthreads_fv3=2 + export nthreads_fv3_gfs=2 + export nest_refine=4 + export nest_ioffset=24 + export nest_joffset=72 + export npx_nest=2881 + export npy_nest=1921 + export NEST_DLON=0.0325 + export NEST_DLAT=0.0325 + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=90 + export WRITE_GROUP_GFS=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=90 + else + export DELTIM=150 + export layout_x=8 + export layout_y=12 + export layout_x_gfs=12 + export layout_y_gfs=16 + export nthreads_fv3=4 + export nthreads_fv3_gfs=4 + export nthreads_ufs=4 + export nthreads_ufs_gfs=4 + export cdmbgwd="4.0,0.15,1.0,1.0" # mountain blocking, ogwd, cgwd, cgwd src scaling + export cdmbgwd_gsl="2.5,7.5,1.0,1.0" # settings for GSL drag suite + export knob_ugwp_tauamp=0.5e-3 # setting for UGWPv1 non-stationary GWD + export WRITE_GROUP=2 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE=10 + export WRITE_GROUP_GFS=4 + export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=20 #Note this should be 10 for WCOSS2 fi ;; "C1152") diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index b3512d14d91..5420de89755 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -169,7 +169,7 @@ done # Link these templates from ufs-weather-model cd "${HOMEgfs}/parm/ufs" || exit 1 -declare -a ufs_templates=("model_configure.IN" \ +declare -a ufs_templates=("model_configure.IN" "model_configure.nest.IN"\ "MOM_input_025.IN" "MOM_input_050.IN" "MOM_input_100.IN" "MOM_input_500.IN" \ "MOM6_data_table.IN" \ "ice_in.IN" \ diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index b3f0ff5817a..34c313a9056 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -176,8 +176,8 @@ EOF ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.master.grb2f${FH3}" "GFSPRS.GrbF${FH2}" ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}" if [[ "${DO_NEST:-NO}" == YES ]] ; then - ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.grb2f${FH3}" "GFSPRS.GrbF${FH2}.nest02" - ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}.nest02" + ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.grb2f${FH3}" "GFSPRS.GrbF${FH2}.nest02" + ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}.nest02" fi fi done @@ -202,10 +202,10 @@ FV3_nml() { # Call the appropriate namelist functions if [[ "${DO_NEST:-NO}" == YES ]] ; then - FV3_namelists global_with_nest - FV3_namelists nest + FV3_namelists global_with_nest + FV3_namelists nest else - FV3_namelists + FV3_namelists fi FV3_model_configure diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index e10107a49b7..3793b8c6bfa 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -52,34 +52,17 @@ local OUTPUT_FH=${FV3_OUTPUT_FH} local IAU_OFFSET=${IAU_OFFSET:-0} # Ensure the template exists -template="${PARMgfs}/ufs/model_configure.IN" +if [[ "${DO_NEST:-NO}" == YES ]] ; then + template="${PARMgfs}/ufs/model_configure.nest.IN" +else + template="${PARMgfs}/ufs/model_configure.IN" +fi if [[ ! -f ${template} ]]; then echo "FATAL ERROR: template '${template}' does not exist, ABORT!" exit 1 fi rm -f "${DATA}/model_configure" atparse < "${template}" >> "${DATA}/model_configure" - -if [[ "${DO_NEST:-NO}" == YES ]] ; then - cat >> model_configure < -output_grid: ${NEST_OUTPUT_GRID} -imo: ${npx_nest} -jmo: ${npy_nest} -cen_lon: ${target_lon} -cen_lat: ${target_lat} -lon1: ${NEST_LON1} -lat1: ${NEST_LAT1} -lon2: ${NEST_LON2} -lat2: ${NEST_LAT2} -dlon: ${NEST_DLON} -dlat: ${NEST_DLAT} - -EOF -fi - echo "Rendered model_configure" cat "${DATA}/model_configure" diff --git a/ush/parsing_namelists_FV3.sh b/ush/parsing_namelists_FV3.sh index 664174f6e32..e6065abc15b 100755 --- a/ush/parsing_namelists_FV3.sh +++ b/ush/parsing_namelists_FV3.sh @@ -135,9 +135,9 @@ cat > "${nml_file}" < Date: Thu, 25 Apr 2024 19:46:45 -0600 Subject: [PATCH 04/15] minor fix --- sorc/link_workflow.sh | 2 +- ush/parsing_model_configure_FV3.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 5420de89755..53d0a4d249f 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -169,7 +169,7 @@ done # Link these templates from ufs-weather-model cd "${HOMEgfs}/parm/ufs" || exit 1 -declare -a ufs_templates=("model_configure.IN" "model_configure.nest.IN"\ +declare -a ufs_templates=("model_configure.IN" "model_configure_nest.IN"\ "MOM_input_025.IN" "MOM_input_050.IN" "MOM_input_100.IN" "MOM_input_500.IN" \ "MOM6_data_table.IN" \ "ice_in.IN" \ diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 3793b8c6bfa..9c02dfa69b5 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -53,7 +53,7 @@ local IAU_OFFSET=${IAU_OFFSET:-0} # Ensure the template exists if [[ "${DO_NEST:-NO}" == YES ]] ; then - template="${PARMgfs}/ufs/model_configure.nest.IN" + template="${PARMgfs}/ufs/model_configure_nest.IN" else template="${PARMgfs}/ufs/model_configure.IN" fi From b5b2809a1b9402f3189d715b3fe63a099f7de5f0 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Thu, 25 Apr 2024 21:18:14 -0600 Subject: [PATCH 05/15] minor changes --- parm/config/gfs/config.ufs | 4 ++-- ush/parsing_model_configure_FV3.sh | 2 ++ ush/parsing_namelists_FV3.sh | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index ad306277a71..d6719f04f01 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -71,9 +71,9 @@ fi if [[ "${DO_NEST:-NO}" == "YES" ]] ; then # Describe nest location, interaction with parent, etc. export grid_type=0 - export target_lat=32.5 - export target_lon=-135.0 export stretch_fac=1.0001 + export TARGET_LAT=32.5 + export TARGET_LON=-135.0 export NEST_LON1=-195.000000 export NEST_LAT1=-7.500000 export NEST_LON2=-75.000000 diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 9c02dfa69b5..6654bbcf4ca 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -53,6 +53,8 @@ local IAU_OFFSET=${IAU_OFFSET:-0} # Ensure the template exists if [[ "${DO_NEST:-NO}" == YES ]] ; then + local NEST_IMO=${npx_nest} + local NEST_JMO=${npy_nest} template="${PARMgfs}/ufs/model_configure_nest.IN" else template="${PARMgfs}/ufs/model_configure.IN" diff --git a/ush/parsing_namelists_FV3.sh b/ush/parsing_namelists_FV3.sh index e6065abc15b..f55d03f3d8b 100755 --- a/ush/parsing_namelists_FV3.sh +++ b/ush/parsing_namelists_FV3.sh @@ -211,8 +211,8 @@ EOF if [[ "${DO_NEST:-NO}" == YES && ${namelist_mode} =~ global ]] ; then cat >> "${nml_file}" < Date: Fri, 26 Apr 2024 14:57:48 -0600 Subject: [PATCH 06/15] remove self.config.ntiles=6 in analysis.py --- ush/python/pygfs/task/analysis.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ush/python/pygfs/task/analysis.py b/ush/python/pygfs/task/analysis.py index 078e013e7f8..02011423b75 100644 --- a/ush/python/pygfs/task/analysis.py +++ b/ush/python/pygfs/task/analysis.py @@ -25,7 +25,6 @@ class Analysis(Task): def __init__(self, config: Dict[str, Any]) -> None: super().__init__(config) - self.config.ntiles = 6 # Store location of GDASApp jinja2 templates self.gdasapp_j2tmpl_dir = os.path.join(self.config.PARMgfs, 'gdas') From 1029271ed71d25579120ec254aae415d7fb05627 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:03:23 -0600 Subject: [PATCH 07/15] revert changes in parsing_namelists_FV3.sh --- ush/parsing_namelists_FV3.sh | 163 +++++++++-------------------------- 1 file changed, 42 insertions(+), 121 deletions(-) diff --git a/ush/parsing_namelists_FV3.sh b/ush/parsing_namelists_FV3.sh index f55d03f3d8b..9e6e67f9cc7 100755 --- a/ush/parsing_namelists_FV3.sh +++ b/ush/parsing_namelists_FV3.sh @@ -6,20 +6,6 @@ # shellcheck disable=SC2034 FV3_namelists(){ -# First argument tells us which namelist we're writing: -# global_no_nest = writing input.nml for global-only (no nest) -# global_with_nest = writing input.nml for running global with a nest -# nest = writing input_nest02.nml for running the nest -namelist_mode="${1:-global_no_nest}" - -if [[ ${namelist_mode} == nest ]] ; then - nml_file=input_nest02.nml - only_input_nml="YES" -else - nml_file=input.nml - only_input_nml="NO" -fi - # setup the tables DIAG_TABLE=${DIAG_TABLE:-${PARMgfs}/ufs/fv3/diag_table} DIAG_TABLE_APPEND=${DIAG_TABLE_APPEND:-${PARMgfs}/ufs/fv3/diag_table_aod} @@ -34,7 +20,6 @@ fi # ensure non-prognostic tracers are set dnats=${dnats:-0} -if [[ "${only_input_nml:-NO}" == "NO" ]] ; then # build the diag_table { echo "UFS_Weather_Model_Forecast" @@ -82,28 +67,8 @@ if [[ -n "${AERO_FIELD_TABLE:-}" ]]; then else ${NCP} "${FIELD_TABLE}" field_table fi -fi # only_input_nml - -if [[ ${namelist_mode} =~ global ]] ; then - layout_x_here=${layout_x} - layout_y_here=${layout_y} - ntiles_here=6 - npx_here=${npx} - npy_here=${npy} - k_split_here=${k_split} -else - layout_x_here=${layout_x_nest} - layout_y_here=${layout_y_nest} - ntiles_here=1 - nested_here=.true. - twowaynest_here=${twowaynest:-.true.} - nestupdate_here=${nestupdate:-7} - npx_here=${npx_nest} - npy_here=${npy_nest} - k_split_here=${k_split_nest} -fi -cat > "${nml_file}" < input.nml < "${nml_file}" < "${nml_file}" < "${nml_file}" <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" << EOF + cat >> input.nml << EOF oz_phys = .false. oz_phys_2015 = .true. EOF ;; "FV3_GSD_v0") - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -277,7 +219,7 @@ EOF EOF ;; FV3_GFS_v16_coupled*) - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -295,7 +237,7 @@ EOF EOF ;; FV3_GFS_v16*) - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -315,7 +257,7 @@ EOF ;; FV3_GFS_v17*) local default_dt_inner=$(( DELTIM/2 )) - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".true."} @@ -350,7 +292,7 @@ EOF ;; FV3_global_nest*) local default_dt_inner=$(( DELTIM/2 )) - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} lcnorm = ${lcnorm:-".false."} ltaerosol = ${ltaerosol:-".false."} @@ -385,13 +327,13 @@ EOF EOF ;; *) - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF iovr = ${iovr:-"3"} EOF ;; esac -cat >> "${nml_file}" <> input.nml <> "${nml_file}" <> "${nml_file}" << EOF + cat >> input.nml << EOF fscav_aero = ${fscav_aero:-'*:0.0'} EOF fi -cat >> "${nml_file}" <> input.nml <> "${nml_file}" <> "${nml_file}" <> input.nml <> "${nml_file}" << EOF + cat >> input.nml << EOF iaufhrs = ${IAUFHRS} iau_delthrs = ${IAU_DELTHRS} iau_inc_files= ${IAU_INC_FILES} @@ -506,7 +448,7 @@ EOF fi if [[ ${DO_CA:-"NO"} = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF do_ca = .true. ca_global = ${ca_global:-".false."} ca_sgs = ${ca_sgs:-".true."} @@ -523,33 +465,19 @@ EOF fi if [[ "${DO_LAND_PERT:-NO}" == "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF lndp_type = ${lndp_type:-2} n_var_lndp = ${n_var_lndp:-0} EOF fi # Close &gfs_physics_nml section -cat >> "${nml_file}" << EOF -/ -EOF - -if [[ ${namelist_mode} == "global_with_nest" ]] ; then - cat >> "${nml_file}" << EOF -&fv_nest_nml - grid_pes = $(( layout_x * layout_y * 6 )),$(( layout_x_nest * layout_y_nest )) - tile_coarse = 0,6 - num_tile_top = 6 - p_split = 1 - nest_refine = 0,${nest_refine} - nest_ioffsets = 0,${nest_ioffset} - nest_joffsets = 0,${nest_joffset} +cat >> input.nml << EOF / EOF -fi if [[ ${knob_ugwp_version} -eq 0 ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -568,7 +496,7 @@ EOF fi if [[ ${knob_ugwp_version} -eq 1 ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -594,9 +522,9 @@ if [[ ${knob_ugwp_version} -eq 1 ]]; then EOF fi -echo "" >> "${nml_file}" +echo "" >> input.nml -cat >> "${nml_file}" <> input.nml <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" +echo "" >> input.nml #if [ $MEMBER -gt 0 ]; then if [[ "${DO_SPPT}" = "YES" || "${DO_SHUM}" = "YES" || "${DO_SKEB}" = "YES" || "${DO_LAND_PERT}" = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &nam_stochy EOF if [[ ${DO_SKEB} = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF skeb = ${SKEB} iseed_skeb = ${ISEED_SKEB:-${ISEED}} skeb_tau = ${SKEB_TAU:-"-999."} @@ -734,7 +655,7 @@ EOF fi if [[ ${DO_SHUM} = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF shum = ${SHUM} iseed_shum = ${ISEED_SHUM:-${ISEED}} shum_tau = ${SHUM_TAU:-"-999."} @@ -743,7 +664,7 @@ EOF fi if [[ ${DO_SPPT} = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF sppt = ${SPPT} iseed_sppt = ${ISEED_SPPT:-${ISEED}} sppt_tau = ${SPPT_TAU:-"-999."} @@ -756,7 +677,7 @@ EOF fi if [[ "${DO_OCN_SPPT:-NO}" == "YES" ]]; then - cat >> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" << EOF + cat >> input.nml << EOF / EOF if [[ ${DO_LAND_PERT} = "YES" ]]; then - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &nam_sfcperts lndp_type = ${lndp_type} LNDP_TAU = ${LNDP_TAU} @@ -807,7 +728,7 @@ EOF / EOF else - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &nam_sfcperts / EOF @@ -815,7 +736,7 @@ EOF else - cat >> "${nml_file}" << EOF + cat >> input.nml << EOF &nam_stochy / &nam_sfcperts @@ -824,9 +745,9 @@ EOF fi -# Echo out formatted ""${nml_file}"" +# Echo out formatted "input.nml" echo "====================================" -echo "FV3_namelists(): '${nml_file}'" -cat "${nml_file}" +echo "FV3_namelists(): 'input.nml'" +cat input.nml echo "====================================" } From 9b509d18e751ad662db633fedf6db4bf33c92876 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:25:58 -0600 Subject: [PATCH 08/15] add a new file - parsing_namelists_FV3_nest.sh --- ush/parsing_namelists_FV3_nest.sh | 753 ++++++++++++++++++++++++++++++ 1 file changed, 753 insertions(+) create mode 100755 ush/parsing_namelists_FV3_nest.sh diff --git a/ush/parsing_namelists_FV3_nest.sh b/ush/parsing_namelists_FV3_nest.sh new file mode 100755 index 00000000000..9e6e67f9cc7 --- /dev/null +++ b/ush/parsing_namelists_FV3_nest.sh @@ -0,0 +1,753 @@ +#! /usr/bin/env bash + +# parsing namelist of FV3, diag_table, etc. + +# Disable variable not used warnings +# shellcheck disable=SC2034 +FV3_namelists(){ + +# setup the tables +DIAG_TABLE=${DIAG_TABLE:-${PARMgfs}/ufs/fv3/diag_table} +DIAG_TABLE_APPEND=${DIAG_TABLE_APPEND:-${PARMgfs}/ufs/fv3/diag_table_aod} +DATA_TABLE=${DATA_TABLE:-${PARMgfs}/ufs/MOM6_data_table.IN} +FIELD_TABLE=${FIELD_TABLE:-${PARMgfs}/ufs/fv3/field_table} + +# set cdmbgwd +if (( gwd_opt == 2 )) && [[ ${do_gsl_drag_ls_bl} == ".true." ]]; then + cdmbgwd=${cdmbgwd_gsl} +fi + +# ensure non-prognostic tracers are set +dnats=${dnats:-0} + +# build the diag_table +{ +echo "UFS_Weather_Model_Forecast" +if [[ "${DOIAU}" = "YES" ]]; then + echo "${previous_cycle:0:4} ${previous_cycle:4:2} ${previous_cycle:6:2} ${previous_cycle:8:2} 0 0" +else + echo "${current_cycle:0:4} ${current_cycle:4:2} ${current_cycle:6:2} ${current_cycle:8:2} 0 0" +fi +cat "${DIAG_TABLE}" +if [[ -n "${AERO_DIAG_TABLE:-}" ]]; then + cat "${AERO_DIAG_TABLE}" +fi +cat "${DIAG_TABLE_APPEND}" +} >> diag_table_template + +local template=diag_table_template +local SYEAR=${current_cycle:0:4} +local SMONTH=${current_cycle:4:2} +local SDAY=${current_cycle:6:2} +local CHOUR=${current_cycle:8:2} +local MOM6_OUTPUT_DIR="./MOM6_OUTPUT" + +atparse < "${template}" >> "diag_table" + + +# copy data table +${NCP} "${DATA_TABLE}" data_table + +# build field_table +if [[ -n "${AERO_FIELD_TABLE:-}" ]]; then + nrec=$(wc -l < "${FIELD_TABLE}") + prec=${nrec} + if (( dnats > 0 )); then + prec=$( grep -F -n TRACER "${FIELD_TABLE}" 2> /dev/null | tail -n "${dnats}" | head -1 | cut -d: -f1 ) + prec=${prec:-0} + prec=$(( prec > 0 ? prec - 1 : prec )) + fi + { \ + head -n "${prec}" "${FIELD_TABLE}" ; \ + cat "${AERO_FIELD_TABLE}" ; \ + tail -n $(( nrec - prec )) "${FIELD_TABLE}" ; \ + } > field_table + # add non-prognostic tracers from additional table + dnats=$(( dnats + dnats_aero )) +else + ${NCP} "${FIELD_TABLE}" field_table +fi + +cat > input.nml <> input.nml << EOF + oz_phys = .false. + oz_phys_2015 = .true. +EOF + ;; + "FV3_GSD_v0") + cat >> input.nml << EOF + iovr = ${iovr:-"3"} + ltaerosol = ${ltaerosol:-".false."} + lradar = ${lradar:-".false."} + ttendlim = ${ttendlim:-0.005} + oz_phys = ${oz_phys:-".false."} + oz_phys_2015 = ${oz_phys_2015:-".true."} + lsoil_lsm = ${lsoil_lsm:-"4"} + do_mynnedmf = ${do_mynnedmf:-".false."} + do_mynnsfclay = ${do_mynnsfclay:-".false."} + icloud_bl = ${icloud_bl:-"1"} + bl_mynn_edmf = ${bl_mynn_edmf:-"1"} + bl_mynn_tkeadvect=${bl_mynn_tkeadvect:-".true."} + bl_mynn_edmf_mom=${bl_mynn_edmf_mom:-"1"} + min_lakeice = ${min_lakeice:-"0.15"} + min_seaice = ${min_seaice:-"0.15"} + use_cice_alb = ${use_cice_alb:-".false."} +EOF + ;; + FV3_GFS_v16_coupled*) + cat >> input.nml << EOF + iovr = ${iovr:-"3"} + ltaerosol = ${ltaerosol:-".false."} + lradar = ${lradar:-".false."} + ttendlim = ${ttendlim:-"0.005"} + oz_phys = ${oz_phys:-".false."} + oz_phys_2015 = ${oz_phys_2015:-".true."} + do_mynnedmf = ${do_mynnedmf:-".false."} + do_mynnsfclay = ${do_mynnsfclay:-".false."} + icloud_bl = ${icloud_bl:-"1"} + bl_mynn_edmf = ${bl_mynn_edmf:-"1"} + bl_mynn_tkeadvect = ${bl_mynn_tkeadvect:-".true."} + bl_mynn_edmf_mom = ${bl_mynn_edmf_mom:-"1"} + min_lakeice = ${min_lakeice:-"0.15"} + min_seaice = ${min_seaice:-"0.15"} +EOF + ;; + FV3_GFS_v16*) + cat >> input.nml << EOF + iovr = ${iovr:-"3"} + ltaerosol = ${ltaerosol:-".false."} + lradar = ${lradar:-".false."} + ttendlim = ${ttendlim:-"0.005"} + oz_phys = ${oz_phys:-".false."} + oz_phys_2015 = ${oz_phys_2015:-".true."} + lsoil_lsm = ${lsoil_lsm:-"4"} + do_mynnedmf = ${do_mynnedmf:-".false."} + do_mynnsfclay = ${do_mynnsfclay:-".false."} + icloud_bl = ${icloud_bl:-"1"} + bl_mynn_edmf = ${bl_mynn_edmf:-"1"} + bl_mynn_tkeadvect = ${bl_mynn_tkeadvect:-".true."} + bl_mynn_edmf_mom = ${bl_mynn_edmf_mom:-"1"} + min_lakeice = ${min_lakeice:-"0.15"} + min_seaice = ${min_seaice:-"0.15"} +EOF + ;; + FV3_GFS_v17*) + local default_dt_inner=$(( DELTIM/2 )) + cat >> input.nml << EOF + iovr = ${iovr:-"3"} + ltaerosol = ${ltaerosol:-".false."} + lradar = ${lradar:-".true."} + ttendlim = ${ttendlim:-"-999"} + dt_inner = ${dt_inner:-"${default_dt_inner}"} + sedi_semi = ${sedi_semi:-".true."} + decfl = ${decfl:-"10"} + oz_phys = ${oz_phys:-".false."} + oz_phys_2015 = ${oz_phys_2015:-".true."} + lsoil_lsm = ${lsoil_lsm:-"4"} + do_mynnedmf = ${do_mynnedmf:-".false."} + do_mynnsfclay = ${do_mynnsfclay:-".false."} + icloud_bl = ${icloud_bl:-"1"} + bl_mynn_edmf = ${bl_mynn_edmf:-"1"} + bl_mynn_tkeadvect = ${bl_mynn_tkeadvect:-".true."} + bl_mynn_edmf_mom = ${bl_mynn_edmf_mom:-"1"} + do_ugwp = ${do_ugwp:-".false."} + do_tofd = ${do_tofd:-".false."} + gwd_opt = ${gwd_opt:-"2"} + do_ugwp_v0 = ${do_ugwp_v0:-".false."} + do_ugwp_v1 = ${do_ugwp_v1:-".true."} + do_ugwp_v0_orog_only = ${do_ugwp_v0_orog_only:-".false."} + do_ugwp_v0_nst_only = ${do_ugwp_v0_nst_only:-".false."} + do_gsl_drag_ls_bl = ${do_gsl_drag_ls_bl:-".true."} + do_gsl_drag_ss = ${do_gsl_drag_ss:-".true."} + do_gsl_drag_tofd = ${do_gsl_drag_tofd:-".true."} + do_ugwp_v1_orog_only = ${do_ugwp_v1_orog_only:-".false."} + min_lakeice = ${min_lakeice:-"0.15"} + min_seaice = ${min_seaice:-"0.15"} + use_cice_alb = ${use_cice_alb:-".false."} +EOF + ;; + FV3_global_nest*) + local default_dt_inner=$(( DELTIM/2 )) + cat >> input.nml << EOF + iovr = ${iovr:-"3"} + lcnorm = ${lcnorm:-".false."} + ltaerosol = ${ltaerosol:-".false."} + lradar = ${lradar:-".true."} + ttendlim = ${ttendlim:-"-999"} + dt_inner = ${dt_inner:-"${default_dt_inner}"} + sedi_semi = ${sedi_semi:-".true."} + decfl = ${decfl:-"10"} + oz_phys = ${oz_phys:-".false."} + oz_phys_2015 = ${oz_phys_2015:-".true."} + lsoil_lsm = ${lsoil_lsm:-"4"} + do_mynnedmf = ${do_mynnedmf:-".false."} + do_mynnsfclay = ${do_mynnsfclay:-".false."} + icloud_bl = ${icloud_bl:-"1"} + bl_mynn_edmf = ${bl_mynn_edmf:-"1"} + bl_mynn_tkeadvect = ${bl_mynn_tkeadvect:-".true."} + bl_mynn_edmf_mom = ${bl_mynn_edmf_mom:-"1"} + do_ugwp = ${do_ugwp:-".false."} + do_tofd = ${do_tofd:-".false."} + gwd_opt = ${gwd_opt:-"2"} + do_ugwp_v0 = ${do_ugwp_v0:-".false."} + do_ugwp_v1 = ${do_ugwp_v1:-".true."} + do_ugwp_v0_orog_only = ${do_ugwp_v0_orog_only:-".false."} + do_ugwp_v0_nst_only = ${do_ugwp_v0_nst_only:-".false."} + do_gsl_drag_ls_bl = ${do_gsl_drag_ls_bl:-".true."} + do_gsl_drag_ss = ${do_gsl_drag_ss:-".true."} + do_gsl_drag_tofd = ${do_gsl_drag_tofd:-".true."} + do_ugwp_v1_orog_only = ${do_ugwp_v1_orog_only:-".false."} + min_lakeice = ${min_lakeice:-"0.15"} + min_seaice = ${min_seaice:-"0.15"} + use_cice_alb = ${use_cice_alb:-".false."} +EOF + ;; + *) + cat >> input.nml << EOF + iovr = ${iovr:-"3"} +EOF + ;; +esac + +cat >> input.nml <> input.nml << EOF + fscav_aero = ${fscav_aero:-'*:0.0'} +EOF +fi + +cat >> input.nml <> input.nml <> input.nml << EOF + iaufhrs = ${IAUFHRS} + iau_delthrs = ${IAU_DELTHRS} + iau_inc_files= ${IAU_INC_FILES} + iau_drymassfixer = .false. + iau_filter_increments = ${IAU_FILTER_INCREMENTS:-".false."} +EOF +fi + +if [[ ${DO_CA:-"NO"} = "YES" ]]; then + cat >> input.nml << EOF + do_ca = .true. + ca_global = ${ca_global:-".false."} + ca_sgs = ${ca_sgs:-".true."} + nca = ${nca:-"1"} + ncells = ${ncells:-"5"} + nlives = ${nlives:-"12"} + nseed = ${nseed:-"1"} + nfracseed = ${nfracseed:-"0.5"} + nthresh = ${nthresh:-"18"} + ca_trigger = ${ca_trigger:-".true."} + nspinup = ${nspinup:-"1"} + iseed_ca = ${ISEED_CA:-"12345"} +EOF +fi + +if [[ "${DO_LAND_PERT:-NO}" == "YES" ]]; then + cat >> input.nml << EOF + lndp_type = ${lndp_type:-2} + n_var_lndp = ${n_var_lndp:-0} +EOF +fi + +# Close &gfs_physics_nml section +cat >> input.nml << EOF +/ +EOF + +if [[ ${knob_ugwp_version} -eq 0 ]]; then + cat >> input.nml << EOF +&cires_ugwp_nml + knob_ugwp_solver = ${knob_ugwp_solver:-2} + knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} + knob_ugwp_wvspec = ${knob_ugwp_wvspec:-1,25,25,25} + knob_ugwp_azdir = ${knob_ugwp_azdir:-2,4,4,4} + knob_ugwp_stoch = ${knob_ugwp_stoch:-0,0,0,0} + knob_ugwp_effac = ${knob_ugwp_effac:-1,1,1,1} + knob_ugwp_doaxyz = ${knob_ugwp_doaxyz:-1} + knob_ugwp_doheat = ${knob_ugwp_doheat:-1} + knob_ugwp_dokdis = ${knob_ugwp_dokdis:-1} + knob_ugwp_ndx4lh = ${knob_ugwp_ndx4lh:-1} + knob_ugwp_version = ${knob_ugwp_version:-0} + launch_level = ${launch_level:-54} +/ +EOF +fi + +if [[ ${knob_ugwp_version} -eq 1 ]]; then + cat >> input.nml << EOF +&cires_ugwp_nml + knob_ugwp_solver = ${knob_ugwp_solver:-2} + knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} + knob_ugwp_wvspec = ${knob_ugwp_wvspec:-1,25,25,25} + knob_ugwp_azdir = ${knob_ugwp_azdir:-2,4,4,4} + knob_ugwp_stoch = ${knob_ugwp_stoch:-0,0,0,0} + knob_ugwp_effac = ${knob_ugwp_effac:-1,1,1,1} + knob_ugwp_doaxyz = ${knob_ugwp_doaxyz:-1} + knob_ugwp_doheat = ${knob_ugwp_doheat:-1} + knob_ugwp_dokdis = ${knob_ugwp_dokdis:-2} + knob_ugwp_ndx4lh = ${knob_ugwp_ndx4lh:-4} + knob_ugwp_version = ${knob_ugwp_version:-1} + knob_ugwp_palaunch = ${knob_ugwp_palaunch:-275.0e2} + knob_ugwp_nslope = ${knob_ugwp_nslope:-1} + knob_ugwp_lzmax = ${knob_ugwp_lzmax:-15.750e3} + knob_ugwp_lzmin = ${knob_ugwp_lzmin:-0.75e3} + knob_ugwp_lzstar = ${knob_ugwp_lzstar:-2.0e3} + knob_ugwp_taumin = ${knob_ugwp_taumin:-0.25e-3} + knob_ugwp_tauamp = ${knob_ugwp_tauamp:-3.0e-3} + knob_ugwp_lhmet = ${knob_ugwp_lhmet:-200.0e3} + knob_ugwp_orosolv = ${knob_ugwp_orosolv:-'pss-1986'} +/ +EOF +fi + +echo "" >> input.nml + +cat >> input.nml <> input.nml +#if [ $MEMBER -gt 0 ]; then +if [[ "${DO_SPPT}" = "YES" || "${DO_SHUM}" = "YES" || "${DO_SKEB}" = "YES" || "${DO_LAND_PERT}" = "YES" ]]; then + + cat >> input.nml << EOF +&nam_stochy +EOF + + if [[ ${DO_SKEB} = "YES" ]]; then + cat >> input.nml << EOF + skeb = ${SKEB} + iseed_skeb = ${ISEED_SKEB:-${ISEED}} + skeb_tau = ${SKEB_TAU:-"-999."} + skeb_lscale = ${SKEB_LSCALE:-"-999."} + skebnorm = ${SKEBNORM:-"1"} + skeb_npass = ${SKEB_NPASS:-"30"} + skeb_vdof = ${SKEB_VDOF:-"5"} +EOF + fi + + if [[ ${DO_SHUM} = "YES" ]]; then + cat >> input.nml << EOF + shum = ${SHUM} + iseed_shum = ${ISEED_SHUM:-${ISEED}} + shum_tau = ${SHUM_TAU:-"-999."} + shum_lscale = ${SHUM_LSCALE:-"-999."} +EOF + fi + + if [[ ${DO_SPPT} = "YES" ]]; then + cat >> input.nml << EOF + sppt = ${SPPT} + iseed_sppt = ${ISEED_SPPT:-${ISEED}} + sppt_tau = ${SPPT_TAU:-"-999."} + sppt_lscale = ${SPPT_LSCALE:-"-999."} + sppt_logit = ${SPPT_LOGIT:-".true."} + sppt_sfclimit = ${SPPT_SFCLIMIT:-".true."} + use_zmtnblck = ${use_zmtnblck:-".true."} + pbl_taper = ${pbl_taper:-"0,0,0,0.125,0.25,0.5,0.75"} +EOF + fi + + if [[ "${DO_OCN_SPPT:-NO}" == "YES" ]]; then + cat >> input.nml <> input.nml <> input.nml <> input.nml <> input.nml << EOF +/ +EOF + + if [[ ${DO_LAND_PERT} = "YES" ]]; then + cat >> input.nml << EOF +&nam_sfcperts + lndp_type = ${lndp_type} + LNDP_TAU = ${LNDP_TAU} + LNDP_SCALE = ${LNDP_SCALE} + ISEED_LNDP = ${ISEED_LNDP:-${ISEED}} + lndp_var_list = ${lndp_var_list} + lndp_prt_list = ${lndp_prt_list} +/ +EOF + else + cat >> input.nml << EOF +&nam_sfcperts +/ +EOF + fi + +else + + cat >> input.nml << EOF +&nam_stochy +/ +&nam_sfcperts +/ +EOF + +fi + +# Echo out formatted "input.nml" +echo "====================================" +echo "FV3_namelists(): 'input.nml'" +cat input.nml +echo "====================================" +} From 1dc95ae413b5cfe1f5fe89caea25f2a515f3a6a2 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:28:22 -0600 Subject: [PATCH 09/15] update parsing_namelists_FV3_nest.sh for global nest --- ush/parsing_namelists_FV3_nest.sh | 162 ++++++++++++++++++++++-------- 1 file changed, 120 insertions(+), 42 deletions(-) diff --git a/ush/parsing_namelists_FV3_nest.sh b/ush/parsing_namelists_FV3_nest.sh index 9e6e67f9cc7..ba7376585fe 100755 --- a/ush/parsing_namelists_FV3_nest.sh +++ b/ush/parsing_namelists_FV3_nest.sh @@ -6,6 +6,19 @@ # shellcheck disable=SC2034 FV3_namelists(){ +# First argument tells us which namelist we're writing: +# global = writing input.nml for running global with a nest +# nest = writing input_nest02.nml for running the nest +namelist_mode="${1:-global}" + +if [[ "${namelist_mode}" == "nest" ]] ; then + nml_file=input_nest02.nml + only_input_nml="YES" +else + nml_file=input.nml + only_input_nml="NO" +fi + # setup the tables DIAG_TABLE=${DIAG_TABLE:-${PARMgfs}/ufs/fv3/diag_table} DIAG_TABLE_APPEND=${DIAG_TABLE_APPEND:-${PARMgfs}/ufs/fv3/diag_table_aod} @@ -20,6 +33,7 @@ fi # ensure non-prognostic tracers are set dnats=${dnats:-0} +if [[ "${only_input_nml:-NO}" == "NO" ]] ; then # build the diag_table { echo "UFS_Weather_Model_Forecast" @@ -67,8 +81,28 @@ if [[ -n "${AERO_FIELD_TABLE:-}" ]]; then else ${NCP} "${FIELD_TABLE}" field_table fi +fi # only_input_nml + +if [[ "${namelist_mode}" == "global" ]] ; then + layout_x_here=${layout_x} + layout_y_here=${layout_y} + ntiles_here=6 + npx_here=${npx} + npy_here=${npy} + k_split_here=${k_split} +else + layout_x_here=${layout_x_nest} + layout_y_here=${layout_y_nest} + ntiles_here=1 + nested_here=.true. + twowaynest_here=${twowaynest:-.true.} + nestupdate_here=${nestupdate:-7} + npx_here=${npx_nest} + npy_here=${npy_nest} + k_split_here=${k_split_nest} +fi -cat > input.nml < "${nml_file}" < input.nml < input.nml < input.nml <> "${nml_file}" <> "${nml_file}" <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF oz_phys = .false. oz_phys_2015 = .true. EOF ;; "FV3_GSD_v0") - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -219,7 +276,7 @@ EOF EOF ;; FV3_GFS_v16_coupled*) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -237,7 +294,7 @@ EOF EOF ;; FV3_GFS_v16*) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".false."} @@ -257,7 +314,7 @@ EOF ;; FV3_GFS_v17*) local default_dt_inner=$(( DELTIM/2 )) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} ltaerosol = ${ltaerosol:-".false."} lradar = ${lradar:-".true."} @@ -292,7 +349,7 @@ EOF ;; FV3_global_nest*) local default_dt_inner=$(( DELTIM/2 )) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} lcnorm = ${lcnorm:-".false."} ltaerosol = ${ltaerosol:-".false."} @@ -327,13 +384,13 @@ EOF EOF ;; *) - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF iovr = ${iovr:-"3"} EOF ;; esac -cat >> input.nml <> "${nml_file}" <> input.nml <> input.nml << EOF + cat >> "${nml_file}" << EOF fscav_aero = ${fscav_aero:-'*:0.0'} EOF fi -cat >> input.nml <> "${nml_file}" <> input.nml <> input.nml <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF iaufhrs = ${IAUFHRS} iau_delthrs = ${IAU_DELTHRS} iau_inc_files= ${IAU_INC_FILES} @@ -448,7 +505,7 @@ EOF fi if [[ ${DO_CA:-"NO"} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF do_ca = .true. ca_global = ${ca_global:-".false."} ca_sgs = ${ca_sgs:-".true."} @@ -465,19 +522,33 @@ EOF fi if [[ "${DO_LAND_PERT:-NO}" == "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF lndp_type = ${lndp_type:-2} n_var_lndp = ${n_var_lndp:-0} EOF fi # Close &gfs_physics_nml section -cat >> input.nml << EOF +cat >> "${nml_file}" << EOF +/ +EOF + +if [[ "${namelist_mode}" == "global" ]] ; then + cat >> "${nml_file}" << EOF +&fv_nest_nml + grid_pes = $(( layout_x * layout_y * 6 )),$(( layout_x_nest * layout_y_nest )) + tile_coarse = 0,6 + num_tile_top = 6 + p_split = 1 + nest_refine = 0,${nest_refine} + nest_ioffsets = 0,${nest_ioffset} + nest_joffsets = 0,${nest_joffset} / EOF +fi if [[ ${knob_ugwp_version} -eq 0 ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -496,7 +567,7 @@ EOF fi if [[ ${knob_ugwp_version} -eq 1 ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &cires_ugwp_nml knob_ugwp_solver = ${knob_ugwp_solver:-2} knob_ugwp_source = ${knob_ugwp_source:-1,1,0,0} @@ -522,9 +593,9 @@ if [[ ${knob_ugwp_version} -eq 1 ]]; then EOF fi -echo "" >> input.nml +echo "" >> "${nml_file}" -cat >> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> "${nml_file}" <> input.nml +echo "" >> "${nml_file}" #if [ $MEMBER -gt 0 ]; then if [[ "${DO_SPPT}" = "YES" || "${DO_SHUM}" = "YES" || "${DO_SKEB}" = "YES" || "${DO_LAND_PERT}" = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_stochy EOF if [[ ${DO_SKEB} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF skeb = ${SKEB} iseed_skeb = ${ISEED_SKEB:-${ISEED}} skeb_tau = ${SKEB_TAU:-"-999."} @@ -655,7 +733,7 @@ EOF fi if [[ ${DO_SHUM} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF shum = ${SHUM} iseed_shum = ${ISEED_SHUM:-${ISEED}} shum_tau = ${SHUM_TAU:-"-999."} @@ -664,7 +742,7 @@ EOF fi if [[ ${DO_SPPT} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF sppt = ${SPPT} iseed_sppt = ${ISEED_SPPT:-${ISEED}} sppt_tau = ${SPPT_TAU:-"-999."} @@ -677,7 +755,7 @@ EOF fi if [[ "${DO_OCN_SPPT:-NO}" == "YES" ]]; then - cat >> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml <> "${nml_file}" <> input.nml << EOF + cat >> "${nml_file}" << EOF / EOF if [[ ${DO_LAND_PERT} = "YES" ]]; then - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_sfcperts lndp_type = ${lndp_type} LNDP_TAU = ${LNDP_TAU} @@ -728,7 +806,7 @@ EOF / EOF else - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_sfcperts / EOF @@ -736,7 +814,7 @@ EOF else - cat >> input.nml << EOF + cat >> "${nml_file}" << EOF &nam_stochy / &nam_sfcperts @@ -745,9 +823,9 @@ EOF fi -# Echo out formatted "input.nml" +# Echo out formatted ""${nml_file}"" echo "====================================" -echo "FV3_namelists(): 'input.nml'" -cat input.nml +echo "FV3_namelists(): '${nml_file}'" +cat "${nml_file}" echo "====================================" } From 383f463089facb58caff2051e2c936c20f07bbcb Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:30:10 -0600 Subject: [PATCH 10/15] update config.ufs --- parm/config/gfs/config.ufs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index d6719f04f01..e37e46cf700 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -105,7 +105,7 @@ case "${fv3_res}" in export WRTTASK_PER_GROUP_PER_THREAD_PER_TILE_GFS=1 ;; "C96") - if [[ ${DO_NEST:-NO} == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then export DELTIM=450 export layout_x_gfs=4 export layout_y_gfs=4 @@ -142,7 +142,7 @@ case "${fv3_res}" in fi ;; "C192") - if [[ ${DO_NEST:-NO} == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then export DELTIM=225 export layout_x_gfs=5 export layout_y_gfs=6 @@ -179,7 +179,7 @@ case "${fv3_res}" in fi ;; "C384") - if [[ ${DO_NEST:-NO} == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then export DELTIM=150 export layout_x=8 export layout_y=8 @@ -218,7 +218,7 @@ case "${fv3_res}" in fi ;; "C768") - if [[ ${DO_NEST:-NO} == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then export DELTIM=75 export layout_x=16 export layout_y=10 @@ -307,7 +307,7 @@ export WRTTASK_PER_GROUP_PER_THREAD_GFS (( ntasks_fv3 = layout_x * layout_y * 6 )) (( ntasks_fv3_gfs = layout_x_gfs * layout_y_gfs * 6 )) -if [[ "${DO_NEST:-NO}" == YES ]] ; then +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then (( ntasks_fv3_gfs += layout_x_nest * layout_y_nest )) fi export ntasks_fv3 @@ -342,7 +342,7 @@ export cplice=".false." export cplchm=".false." export cplwav=".false." export cplwav2atm=".false." -if [[ "${DO_NEST:-NO}" == YES ]] ; then +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then export CCPP_SUITE="${CCPP_SUITE:-FV3_global_nest_v1}" else export CCPP_SUITE="${CCPP_SUITE:-FV3_GFS_v17_p8_ugwpv1}" From 6db19cf53e755b134982d30d587189096adf93c0 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:33:20 -0600 Subject: [PATCH 11/15] update parsing_namelists_FV3_nest.sh --- ush/parsing_namelists_FV3_nest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ush/parsing_namelists_FV3_nest.sh b/ush/parsing_namelists_FV3_nest.sh index ba7376585fe..46d1050b2f2 100755 --- a/ush/parsing_namelists_FV3_nest.sh +++ b/ush/parsing_namelists_FV3_nest.sh @@ -4,7 +4,7 @@ # Disable variable not used warnings # shellcheck disable=SC2034 -FV3_namelists(){ +FV3_namelists_nest(){ # First argument tells us which namelist we're writing: # global = writing input.nml for running global with a nest @@ -825,7 +825,7 @@ fi # Echo out formatted ""${nml_file}"" echo "====================================" -echo "FV3_namelists(): '${nml_file}'" +echo "FV3_namelists_nest(): '${nml_file}'" cat "${nml_file}" echo "====================================" } From 759fa302acc5d68b3e4c45c021e120cbb5977884 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:35:02 -0600 Subject: [PATCH 12/15] update forecast_postdet.sh --- ush/forecast_postdet.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 34c313a9056..5f6318f6e10 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -202,8 +202,9 @@ FV3_nml() { # Call the appropriate namelist functions if [[ "${DO_NEST:-NO}" == YES ]] ; then - FV3_namelists global_with_nest - FV3_namelists nest + source "${USHgfs}/parsing_namelists_FV3_nest.sh" + FV3_namelists_nest global + FV3_namelists_nest nest else FV3_namelists fi From 66406beed392db3ed691a6d449ec061e934550f8 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:41:37 -0600 Subject: [PATCH 13/15] add quotation mark to 'YES' --- ush/forecast_postdet.sh | 4 ++-- ush/forecast_predet.sh | 4 ++-- ush/parsing_model_configure_FV3.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 5f6318f6e10..e11c20fdc39 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -175,7 +175,7 @@ EOF if [[ "${WRITE_DOPOST}" == ".true." ]]; then ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.master.grb2f${FH3}" "GFSPRS.GrbF${FH2}" ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}" - if [[ "${DO_NEST:-NO}" == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.grb2f${FH3}" "GFSPRS.GrbF${FH2}.nest02" ${NLN} "${COM_ATMOS_MASTER}/${RUN}.t${cyc}z.nest.sfluxgrbf${FH3}.grib2" "GFSFLX.GrbF${FH2}.nest02" fi @@ -201,7 +201,7 @@ FV3_nml() { source "${USHgfs}/parsing_model_configure_FV3.sh" # Call the appropriate namelist functions - if [[ "${DO_NEST:-NO}" == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then source "${USHgfs}/parsing_namelists_FV3_nest.sh" FV3_namelists_nest global FV3_namelists_nest nest diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 212257c3239..2b44e1dd797 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -229,7 +229,7 @@ FV3_predet(){ # Conserve total energy as heat globally consv_te=${consv_te:-1.} # range 0.-1., 1. will restore energy to orig. val. before physics - if [[ "${DO_NEST:-NO}" == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then consv_te=0 k_split=${k_split:-1} k_split_nest=${k_split_nest:-4} @@ -364,7 +364,7 @@ FV3_predet(){ ${NCP} "${FIXgfs}/ugwd/${CASE}/${CASE}_oro_data_ls.tile${tt}.nc" "${DATA}/INPUT/oro_data_ls.tile${tt}.nc" ${NCP} "${FIXgfs}/ugwd/${CASE}/${CASE}_oro_data_ss.tile${tt}.nc" "${DATA}/INPUT/oro_data_ss.tile${tt}.nc" done - if [[ "${DO_NEST:-NO}" == YES ]] ; then + if [[ "${DO_NEST:-NO}" == "YES" ]] ; then ${NLN} "${DATA}/INPUT/oro_data.tile7.nc" "${DATA}/INPUT/oro_data.nest02.tile7.nc" ${NLN} "${DATA}/INPUT/${CASE}_grid.tile7.nc" "${DATA}/INPUT/${CASE}_grid.nest02.tile7.nc" ${NLN} "${DATA}/INPUT/${CASE}_grid.tile7.nc" "${DATA}/INPUT/grid.nest02.tile7.nc" diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 6654bbcf4ca..f9fa54a1ff8 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -52,7 +52,7 @@ local OUTPUT_FH=${FV3_OUTPUT_FH} local IAU_OFFSET=${IAU_OFFSET:-0} # Ensure the template exists -if [[ "${DO_NEST:-NO}" == YES ]] ; then +if [[ "${DO_NEST:-NO}" == "YES" ]] ; then local NEST_IMO=${npx_nest} local NEST_JMO=${npy_nest} template="${PARMgfs}/ufs/model_configure_nest.IN" From 9c9e2b5d30de253852934d6016d9b487d348828e Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:49:18 -0600 Subject: [PATCH 14/15] disable 'masking return value' warnings --- ush/parsing_namelists_FV3_nest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ush/parsing_namelists_FV3_nest.sh b/ush/parsing_namelists_FV3_nest.sh index 46d1050b2f2..1072d05c954 100755 --- a/ush/parsing_namelists_FV3_nest.sh +++ b/ush/parsing_namelists_FV3_nest.sh @@ -2,8 +2,9 @@ # parsing namelist of FV3, diag_table, etc. -# Disable variable not used warnings +# Disable variable not used warnings and 'masking return value' warnings # shellcheck disable=SC2034 +# shellcheck disable=SC2155 FV3_namelists_nest(){ # First argument tells us which namelist we're writing: From 19f448d9b44ddd402a2c0e2c72dd59564dcd4ea9 Mon Sep 17 00:00:00 2001 From: "guoqing.ge" Date: Fri, 26 Apr 2024 15:53:03 -0600 Subject: [PATCH 15/15] shellcheck disable=SC2312 --- ush/parsing_namelists_FV3_nest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ush/parsing_namelists_FV3_nest.sh b/ush/parsing_namelists_FV3_nest.sh index 1072d05c954..2f99a1cdf56 100755 --- a/ush/parsing_namelists_FV3_nest.sh +++ b/ush/parsing_namelists_FV3_nest.sh @@ -4,7 +4,7 @@ # Disable variable not used warnings and 'masking return value' warnings # shellcheck disable=SC2034 -# shellcheck disable=SC2155 +# shellcheck disable=SC2312 FV3_namelists_nest(){ # First argument tells us which namelist we're writing: