From 2840e990bc147a5b88aad9c3b3ec9fb938da3157 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 11:17:16 -0400 Subject: [PATCH 1/6] replace script_dir and top_dir with HOMEgfs in link_workflow --- sorc/link_workflow.sh | 128 ++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 68 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 554b2d568a..f503e7e273 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -2,7 +2,8 @@ #--make symbolic links for EMC installation and hardcopies for NCO delivery -trap 'echo "${BASH_SOURCE[0]} encounted an error at line ${LINENO} (rc=$?)"' ERR +declare -r HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd )" +TRACE=NO source "${HOMEgfs}/ush/preamble.sh" function usage() { cat << EOF @@ -18,8 +19,6 @@ EOF exit 1 } -set -eu - RUN_ENVIR="emc" # Reset option counter in case this script is sourced @@ -42,21 +41,16 @@ while getopts ":ho" option; do done shift $((OPTIND-1)) -script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) -top_dir=$(cd "$(dirname "${script_dir}")" &> /dev/null && pwd) -cd "${script_dir}" - -export COMPILER="intel" # shellcheck disable=SC1091 -source gfs_utils.fd/ush/detect_machine.sh # (sets MACHINE_ID) +COMPILER="intel" source "${HOMEgfs}/sorc/gfs_utils.fd/ush/detect_machine.sh" # (sets MACHINE_ID) # shellcheck disable= machine=$(echo "${MACHINE_ID}" | cut -d. -f1) #------------------------------ #--Set up build.ver and run.ver #------------------------------ -cp "${top_dir}/versions/build.${machine}.ver" "${top_dir}/versions/build.ver" -cp "${top_dir}/versions/run.${machine}.ver" "${top_dir}/versions/run.ver" +cp "${HOMEgfs}/versions/build.${machine}.ver" "${HOMEgfs}/versions/build.ver" +cp "${HOMEgfs}/versions/run.${machine}.ver" "${HOMEgfs}/versions/run.ver" #------------------------------ #--model fix fields @@ -74,7 +68,7 @@ case "${machine}" in esac # Source fix version file -source "${top_dir}/versions/fix.ver" +source "${HOMEgfs}/versions/fix.ver" # LINK is always ln, LINK_OR_COPY can be ln or cp depending on RUN_EVNVIR being emc or nco, respectively LINK="ln -fs" @@ -87,22 +81,22 @@ fi # Link wxflow in ush/python, workflow and ci/scripts # TODO: This will be unnecessary when wxflow is part of the virtualenv -cd "${top_dir}/ush/python" || exit 1 +cd "${HOMEgfs}/ush/python" || exit 1 [[ -s "wxflow" ]] && rm -f wxflow -${LINK} "${top_dir}/sorc/wxflow/src/wxflow" . -cd "${top_dir}/workflow" || exit 1 +${LINK} "${HOMEgfs}/sorc/wxflow/src/wxflow" . +cd "${HOMEgfs}/workflow" || exit 1 [[ -s "wxflow" ]] && rm -f wxflow -${LINK} "${top_dir}/sorc/wxflow/src/wxflow" . -cd "${top_dir}/ci/scripts" || exit 1 +${LINK} "${HOMEgfs}/sorc/wxflow/src/wxflow" . +cd "${HOMEgfs}/ci/scripts" || exit 1 [[ -s "wxflow" ]] && rm -f wxflow -${LINK} "${top_dir}/sorc/wxflow/src/wxflow" . +${LINK} "${HOMEgfs}/sorc/wxflow/src/wxflow" . # Link fix directories if [[ -n "${FIX_DIR}" ]]; then - if [[ ! -d "${top_dir}/fix" ]]; then mkdir "${top_dir}/fix" || exit 1; fi + if [[ ! -d "${HOMEgfs}/fix" ]]; then mkdir "${HOMEgfs}/fix" || exit 1; fi fi -cd "${top_dir}/fix" || exit 1 +cd "${HOMEgfs}/fix" || exit 1 for dir in aer \ am \ chem \ @@ -128,8 +122,8 @@ do done -if [[ -d "${script_dir}/ufs_utils.fd" ]]; then - cd "${script_dir}/ufs_utils.fd/fix" || exit 1 +if [[ -d "${HOMEgfs}/sorc/ufs_utils.fd" ]]; then + cd "${HOMEgfs}/sorc/ufs_utils.fd/fix" || exit 1 ./link_fixdirs.sh "${RUN_ENVIR}" "${machine}" 2> /dev/null fi @@ -137,7 +131,7 @@ fi #--------------------------------------- #--add files from external repositories #--------------------------------------- -cd "${top_dir}/parm/post" || exit 1 +cd "${HOMEgfs}/parm/post" || exit 1 for file in postxconfig-NT-GEFS-ANL.txt postxconfig-NT-GEFS-F00.txt postxconfig-NT-GEFS.txt postxconfig-NT-GFS-ANL.txt \ postxconfig-NT-GFS-F00-TWO.txt postxconfig-NT-GFS-F00.txt postxconfig-NT-GFS-FLUX-F00.txt postxconfig-NT-GFS-FLUX.txt \ postxconfig-NT-GFS-GOES.txt postxconfig-NT-GFS-TWO.txt \ @@ -145,26 +139,26 @@ for file in postxconfig-NT-GEFS-ANL.txt postxconfig-NT-GEFS-F00.txt postxconfig- post_tag_gfs128 post_tag_gfs65 nam_micro_lookup.dat \ AEROSOL_LUTS.dat optics_luts_DUST.dat optics_luts_SALT.dat optics_luts_SOOT.dat optics_luts_SUSO.dat optics_luts_WASO.dat do - ${LINK_OR_COPY} "${script_dir}/upp.fd/parm/${file}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/parm/${file}" . done -cd "${top_dir}/scripts" || exit 8 -${LINK_OR_COPY} "${script_dir}/ufs_utils.fd/scripts/exemcsfc_global_sfc_prep.sh" . -cd "${top_dir}/ush" || exit 8 +cd "${HOMEgfs}/scripts" || exit 8 +${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_utils.fd/scripts/exemcsfc_global_sfc_prep.sh" . +cd "${HOMEgfs}/ush" || exit 8 for file in emcsfc_ice_blend.sh fv3gfs_driver_grid.sh fv3gfs_make_orog.sh global_cycle_driver.sh \ emcsfc_snow.sh fv3gfs_filter_topo.sh global_cycle.sh fv3gfs_make_grid.sh do - ${LINK_OR_COPY} "${script_dir}/ufs_utils.fd/ush/${file}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_utils.fd/ush/${file}" . done for file in finddate.sh make_ntc_bull.pl make_NTC_file.pl make_tif.sh month_name.sh ; do - ${LINK_OR_COPY} "${script_dir}/gfs_utils.fd/ush/${file}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/ush/${file}" . done #------------------------------ #--add GDASApp fix directory #------------------------------ -if [[ -d "${script_dir}/gdas.cd" ]]; then - cd "${top_dir}/fix" || exit 1 +if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then + cd "${HOMEgfs}/fix" || exit 1 [[ ! -d gdas ]] && mkdir -p gdas cd gdas || exit 1 for gdas_sub in crtm fv3jedi gsibec; do @@ -179,97 +173,97 @@ fi #------------------------------ #--add GDASApp files #------------------------------ -if [[ -d "${script_dir}/gdas.cd" ]]; then - cd "${top_dir}/ush" || exit 1 - ${LINK_OR_COPY} "${script_dir}/gdas.cd/ush/ufsda" . - ${LINK_OR_COPY} "${script_dir}/gdas.cd/ush/jediinc2fv3.py" . - ${LINK_OR_COPY} "${script_dir}/gdas.cd/build/bin/imsfv3_scf2ioda.py" . +if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then + cd "${HOMEgfs}/ush" || exit 1 + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/ufsda" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/ush/jediinc2fv3.py" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/build/bin/imsfv3_scf2ioda.py" . fi #------------------------------ #--add DA Monitor file (NOTE: ensure to use correct version) #------------------------------ -if [[ -d "${script_dir}/gsi_monitor.fd" ]]; then +if [[ -d "${HOMEgfs}/sorc/gsi_monitor.fd" ]]; then - cd "${top_dir}/fix" || exit 1 + cd "${HOMEgfs}/fix" || exit 1 [[ ! -d gdas ]] && ( mkdir -p gdas || exit 1 ) cd gdas || exit 1 - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_cost.txt" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_gnorm.txt" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_scaninfo.txt" . - cd "${top_dir}/parm" || exit 1 + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_cost.txt" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/fix/gdas_minmon_gnorm.txt" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_scaninfo.txt" . + cd "${HOMEgfs}/parm" || exit 1 [[ -d mon ]] && rm -rf mon mkdir -p mon cd mon || exit 1 - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" da_mon.parm - # ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/parm/gdas_minmon.parm" . - # ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gfs/parm/gfs_minmon.parm" . - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/parm/gdas_oznmon.parm" . - # ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" da_mon.parm + # ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gdas/parm/gdas_minmon.parm" . + # ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Minimization_Monitor/nwprod/gfs/parm/gfs_minmon.parm" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Ozone_Monitor/nwprod/gdas_oznmon/parm/gdas_oznmon.parm" . + # ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/src/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm" . fi #------------------------------ #--link executables #------------------------------ -if [[ ! -d "${top_dir}/exec" ]]; then mkdir "${top_dir}/exec" || exit 1 ; fi -cd "${top_dir}/exec" || exit 1 +if [[ ! -d "${HOMEgfs}/exec" ]]; then mkdir "${HOMEgfs}/exec" || exit 1 ; fi +cd "${HOMEgfs}/exec" || exit 1 for utilexe in fbwndgfs.x gaussian_sfcanl.x gfs_bufr.x supvit.x syndat_getjtbul.x \ syndat_maksynrc.x syndat_qctropcy.x tocsbufr.x overgridid.x \ mkgfsawps.x enkf_chgres_recenter_nc.x tave.x vint.x reg2grb2.x do [[ -s "${utilexe}" ]] && rm -f "${utilexe}" - ${LINK_OR_COPY} "${script_dir}/gfs_utils.fd/install/bin/${utilexe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/install/bin/${utilexe}" . done [[ -s "ufs_model.x" ]] && rm -f ufs_model.x -${LINK_OR_COPY} "${script_dir}/ufs_model.fd/tests/ufs_model.x" . +${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/ufs_model.x" . [[ -s "upp.x" ]] && rm -f upp.x -${LINK_OR_COPY} "${script_dir}/upp.fd/exec/upp.x" . +${LINK_OR_COPY} "${HOMEgfs}/sorc/upp.fd/exec/upp.x" . for ufs_utilsexe in emcsfc_ice_blend emcsfc_snow2mdl global_cycle; do [[ -s "${ufs_utilsexe}" ]] && rm -f "${ufs_utilsexe}" - ${LINK_OR_COPY} "${script_dir}/ufs_utils.fd/exec/${ufs_utilsexe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_utils.fd/exec/${ufs_utilsexe}" . done # GSI -if [[ -d "${script_dir}/gsi_enkf.fd" ]]; then +if [[ -d "${HOMEgfs}/sorc/gsi_enkf.fd" ]]; then for gsiexe in enkf.x gsi.x; do [[ -s "${gsiexe}" ]] && rm -f "${gsiexe}" - ${LINK_OR_COPY} "${script_dir}/gsi_enkf.fd/install/bin/${gsiexe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_enkf.fd/install/bin/${gsiexe}" . done fi # GSI Utils -if [[ -d "${script_dir}/gsi_utils.fd" ]]; then +if [[ -d "${HOMEgfs}/sorc/gsi_utils.fd" ]]; then for exe in calc_analysis.x calc_increment_ens_ncio.x calc_increment_ens.x \ getsfcensmeanp.x getsigensmeanp_smooth.x getsigensstatp.x \ interp_inc.x recentersigp.x do [[ -s "${exe}" ]] && rm -f "${exe}" - ${LINK_OR_COPY} "${script_dir}/gsi_utils.fd/install/bin/${exe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_utils.fd/install/bin/${exe}" . done fi # GSI Monitor -if [[ -d "${script_dir}/gsi_monitor.fd" ]]; then +if [[ -d "${HOMEgfs}/sorc/gsi_monitor.fd" ]]; then for exe in oznmon_horiz.x oznmon_time.x radmon_angle.x \ radmon_bcoef.x radmon_bcor.x radmon_time.x do [[ -s "${exe}" ]] && rm -f "${exe}" - ${LINK_OR_COPY} "${script_dir}/gsi_monitor.fd/install/bin/${exe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gsi_monitor.fd/install/bin/${exe}" . done fi # GDASApp -if [[ -d "${script_dir}/gdas.cd" ]]; then +if [[ -d "${HOMEgfs}/sorc/gdas.cd" ]]; then declare -a JEDI_EXE=("fv3jedi_addincrement.x" \ "fv3jedi_diffstates.x" \ "fv3jedi_ensvariance.x" \ @@ -296,14 +290,14 @@ if [[ -d "${script_dir}/gdas.cd" ]]; then "apply_incr.exe" ) for gdasexe in "${JEDI_EXE[@]}"; do [[ -s "${gdasexe}" ]] && rm -f "${gdasexe}" - ${LINK_OR_COPY} "${script_dir}/gdas.cd/build/bin/${gdasexe}" . + ${LINK_OR_COPY} "${HOMEgfs}/sorc/gdas.cd/build/bin/${gdasexe}" . done fi #------------------------------ #--link source code directories #------------------------------ -cd "${script_dir}" || exit 8 +cd "${HOMEgfs}/sorc" || exit 8 if [[ -d ufs_model.fd ]]; then [[ -d upp.fd ]] && rm -rf upp.fd ${LINK} ufs_model.fd/FV3/upp upp.fd @@ -389,6 +383,4 @@ do ${LINK_OR_COPY} "gfs_utils.fd/src/${prog}" . done -echo "${BASH_SOURCE[0]} completed successfully" - exit 0 From 81792f91f40daed7cc1c3d4031162387f19dac0b Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 15:05:47 -0400 Subject: [PATCH 2/6] move nems.configure.*.IN from ush to parm/ufs/ --- {ush => parm/ufs}/nems.configure.atm.IN | 0 {ush => parm/ufs}/nems.configure.atm_aero.IN | 0 {ush => parm/ufs}/nems.configure.blocked_atm_wav.IN | 0 {ush => parm/ufs}/nems.configure.cpld.IN | 0 {ush => parm/ufs}/nems.configure.cpld_aero.IN | 0 {ush => parm/ufs}/nems.configure.cpld_aero_outerwave.IN | 0 {ush => parm/ufs}/nems.configure.cpld_aero_wave.IN | 0 {ush => parm/ufs}/nems.configure.cpld_outerwave.IN | 0 {ush => parm/ufs}/nems.configure.cpld_wave.IN | 0 {ush => parm/ufs}/nems.configure.leapfrog_atm_wav.IN | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename {ush => parm/ufs}/nems.configure.atm.IN (100%) rename {ush => parm/ufs}/nems.configure.atm_aero.IN (100%) rename {ush => parm/ufs}/nems.configure.blocked_atm_wav.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld_aero.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld_aero_outerwave.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld_aero_wave.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld_outerwave.IN (100%) rename {ush => parm/ufs}/nems.configure.cpld_wave.IN (100%) rename {ush => parm/ufs}/nems.configure.leapfrog_atm_wav.IN (100%) diff --git a/ush/nems.configure.atm.IN b/parm/ufs/nems.configure.atm.IN similarity index 100% rename from ush/nems.configure.atm.IN rename to parm/ufs/nems.configure.atm.IN diff --git a/ush/nems.configure.atm_aero.IN b/parm/ufs/nems.configure.atm_aero.IN similarity index 100% rename from ush/nems.configure.atm_aero.IN rename to parm/ufs/nems.configure.atm_aero.IN diff --git a/ush/nems.configure.blocked_atm_wav.IN b/parm/ufs/nems.configure.blocked_atm_wav.IN similarity index 100% rename from ush/nems.configure.blocked_atm_wav.IN rename to parm/ufs/nems.configure.blocked_atm_wav.IN diff --git a/ush/nems.configure.cpld.IN b/parm/ufs/nems.configure.cpld.IN similarity index 100% rename from ush/nems.configure.cpld.IN rename to parm/ufs/nems.configure.cpld.IN diff --git a/ush/nems.configure.cpld_aero.IN b/parm/ufs/nems.configure.cpld_aero.IN similarity index 100% rename from ush/nems.configure.cpld_aero.IN rename to parm/ufs/nems.configure.cpld_aero.IN diff --git a/ush/nems.configure.cpld_aero_outerwave.IN b/parm/ufs/nems.configure.cpld_aero_outerwave.IN similarity index 100% rename from ush/nems.configure.cpld_aero_outerwave.IN rename to parm/ufs/nems.configure.cpld_aero_outerwave.IN diff --git a/ush/nems.configure.cpld_aero_wave.IN b/parm/ufs/nems.configure.cpld_aero_wave.IN similarity index 100% rename from ush/nems.configure.cpld_aero_wave.IN rename to parm/ufs/nems.configure.cpld_aero_wave.IN diff --git a/ush/nems.configure.cpld_outerwave.IN b/parm/ufs/nems.configure.cpld_outerwave.IN similarity index 100% rename from ush/nems.configure.cpld_outerwave.IN rename to parm/ufs/nems.configure.cpld_outerwave.IN diff --git a/ush/nems.configure.cpld_wave.IN b/parm/ufs/nems.configure.cpld_wave.IN similarity index 100% rename from ush/nems.configure.cpld_wave.IN rename to parm/ufs/nems.configure.cpld_wave.IN diff --git a/ush/nems.configure.leapfrog_atm_wav.IN b/parm/ufs/nems.configure.leapfrog_atm_wav.IN similarity index 100% rename from ush/nems.configure.leapfrog_atm_wav.IN rename to parm/ufs/nems.configure.leapfrog_atm_wav.IN From 03f8f60e4cf03ca8c9e222293ef00508e53a45b9 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 15:16:38 -0400 Subject: [PATCH 3/6] replace SCRIPTSDIR with HOMEgfs/ush --- scripts/exglobal_forecast.sh | 15 ++++++--------- ush/forecast_postdet.sh | 8 ++++---- ush/nems_configure.sh | 7 ++----- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/scripts/exglobal_forecast.sh b/scripts/exglobal_forecast.sh index d2cc11617a..076c635c17 100755 --- a/scripts/exglobal_forecast.sh +++ b/scripts/exglobal_forecast.sh @@ -79,16 +79,13 @@ source "${HOMEgfs}/ush/preamble.sh" -SCRIPTDIR="${HOMEgfs}/ush" -echo "MAIN: environment loaded for ${machine} platform,Current Script locates in ${SCRIPTDIR}." - # include all subroutines. Executions later. -source "${SCRIPTDIR}/cplvalidate.sh" # validation of cpl* -source "${SCRIPTDIR}/forecast_predet.sh" # include functions for variable definition -source "${SCRIPTDIR}/forecast_det.sh" # include functions for run type determination -source "${SCRIPTDIR}/forecast_postdet.sh" # include functions for variables after run type determination -source "${SCRIPTDIR}/nems_configure.sh" # include functions for nems_configure processing -source "${SCRIPTDIR}/parsing_model_configure_FV3.sh" +source "${HOMEgfs}/ush/cplvalidate.sh" # validation of cpl* +source "${HOMEgfs}/ush/forecast_predet.sh" # include functions for variable definition +source "${HOMEgfs}/ush/forecast_det.sh" # include functions for run type determination +source "${HOMEgfs}/ush/forecast_postdet.sh" # include functions for variables after run type determination +source "${HOMEgfs}/ush/nems_configure.sh" # include functions for nems_configure processing +source "${HOMEgfs}/ush/parsing_model_configure_FV3.sh" # Compset string. For nems.configure.* template selection. Default ATM only confignamevarfornems=${confignamevarfornems:-'atm'} diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index d3fd5c2a97..a251a44e83 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -483,7 +483,7 @@ FV3_nml(){ # namelist output for a certain component echo "SUB ${FUNCNAME[0]}: Creating name lists and model configure file for FV3" # Call child scripts in current script directory - source "${SCRIPTDIR}/parsing_namelists_FV3.sh" + source "${HOMEgfs}/ush/parsing_namelists_FV3.sh" FV3_namelists echo "SUB ${FUNCNAME[0]}: FV3 name lists and model configure file created" } @@ -648,7 +648,7 @@ WW3_nml() { exit 4 fi fi - source "${SCRIPTDIR}/parsing_namelists_WW3.sh" + source "${HOMEgfs}/ush/parsing_namelists_WW3.sh" WW3_namelists } @@ -835,7 +835,7 @@ MOM6_postdet() { MOM6_nml() { echo "SUB ${FUNCNAME[0]}: Creating name list for MOM6" - source "${SCRIPTDIR}/parsing_namelists_MOM6.sh" + source "${HOMEgfs}/ush/parsing_namelists_MOM6.sh" MOM6_namelists } @@ -975,7 +975,7 @@ CICE_postdet() { CICE_nml() { echo "SUB ${FUNCNAME[0]}: Creating name list for CICE" - source "${SCRIPTDIR}/parsing_namelists_CICE.sh" + source "${HOMEgfs}/ush/parsing_namelists_CICE.sh" CICE_namelists } diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index 7393d346a7..c51e500d5d 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -11,10 +11,7 @@ ##### writing_nems_configure() { -echo "SUB ${FUNCNAME[0]}: parsing_nems_configure begins" -if [[ -e "${SCRIPTDIR}/nems.configure" ]]; then - rm -f "${SCRIPTDIR}/nems.configure" -fi +echo "SUB ${FUNCNAME[0]}: nems.configure.sh begins" # Setup nems.configure local DumpFields=${NEMSDumpFields:-false} @@ -34,7 +31,7 @@ rm -f "${DATA}/nems.configure" local esmf_logkind=${esmf_logkind:-"ESMF_LOGKIND_MULTI"} #options: ESMF_LOGKIND_MULTI_ON_ERROR, ESMF_LOGKIND_MULTI, ESMF_LOGKIND_NONE # Copy the selected template into run directory -infile="${SCRIPTDIR}/nems.configure.${confignamevarfornems}.IN" +infile="${HOMEgfs}/parm/ufs/nems.configure.${confignamevarfornems}.IN" if [[ -s ${infile} ]]; then cp "${infile}" tmp1 else From 932be4408507cf9265afb30d985c538b6b69b14e Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 16:39:30 -0400 Subject: [PATCH 4/6] gfs and gefs resources are the same --- .gitignore | 1 + parm/config/gefs/config.resources | 12 ++- parm/config/gefs/config.ufs | 14 ++- parm/config/gfs/config.resources | 12 ++- parm/config/gfs/config.ufs | 8 +- sorc/link_workflow.sh | 24 +++++ ush/nems_configure.sh | 147 +++++++----------------------- 7 files changed, 90 insertions(+), 128 deletions(-) diff --git a/.gitignore b/.gitignore index 3eb6853c19..3abc6e6449 100644 --- a/.gitignore +++ b/.gitignore @@ -142,6 +142,7 @@ ush/make_ntc_bull.pl ush/make_tif.sh ush/month_name.sh ush/imsfv3_scf2ioda.py +ush/atparse.bash # version files versions/build.ver diff --git a/parm/config/gefs/config.resources b/parm/config/gefs/config.resources index e5995b3cf2..6f1db0007b 100644 --- a/parm/config/gefs/config.resources +++ b/parm/config/gefs/config.resources @@ -550,38 +550,42 @@ elif [[ "${step}" = "fcst" || "${step}" = "efcs" ]]; then export MEDPETS MEDTHREADS echo "MEDIATOR using (threads, PETS) = (${MEDTHREADS}, ${MEDPETS})" + CHMPETS=0; CHMTHREADS=0 if [[ "${DO_AERO}" = "YES" ]]; then # GOCART shares the same grid and forecast tasks as FV3 (do not add write grid component tasks). (( CHMTHREADS = ATMTHREADS )) (( CHMPETS = FV3PETS )) # Do not add to NTASKS_TOT - export CHMPETS CHMTHREADS echo "GOCART using (threads, PETS) = (${CHMTHREADS}, ${CHMPETS})" fi + export CHMPETS CHMTHREADS + WAVPETS=0; WAVTHREADS=0 if [[ "${DO_WAVE}" = "YES" ]]; then (( WAVPETS = ntasks_ww3 * nthreads_ww3 )) (( WAVTHREADS = nthreads_ww3 )) - export WAVPETS WAVTHREADS echo "WW3 using (threads, PETS) = (${WAVTHREADS}, ${WAVPETS})" (( NTASKS_TOT = NTASKS_TOT + WAVPETS )) fi + export WAVPETS WAVTHREADS + OCNPETS=0; OCNTHREADS=0 if [[ "${DO_OCN}" = "YES" ]]; then (( OCNPETS = ntasks_mom6 * nthreads_mom6 )) (( OCNTHREADS = nthreads_mom6 )) - export OCNPETS OCNTHREADS echo "MOM6 using (threads, PETS) = (${OCNTHREADS}, ${OCNPETS})" (( NTASKS_TOT = NTASKS_TOT + OCNPETS )) fi + export OCNPETS OCNTHREADS + ICEPETS=0; ICETHREADS=0 if [[ "${DO_ICE}" = "YES" ]]; then (( ICEPETS = ntasks_cice6 * nthreads_cice6 )) (( ICETHREADS = nthreads_cice6 )) - export ICEPETS ICETHREADS echo "CICE6 using (threads, PETS) = (${ICETHREADS}, ${ICEPETS})" (( NTASKS_TOT = NTASKS_TOT + ICEPETS )) fi + export ICEPETS ICETHREADS echo "Total PETS for ${_CDUMP} = ${NTASKS_TOT}" diff --git a/parm/config/gefs/config.ufs b/parm/config/gefs/config.ufs index c23ccf2abd..bfbb0a12cb 100644 --- a/parm/config/gefs/config.ufs +++ b/parm/config/gefs/config.ufs @@ -255,6 +255,7 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs_1998-2006_smoothed_2X.nc" MOM6_RESTART_SETTING='r' MOM6_RIVER_RUNOFF='False' + eps_imesh="4.0e-1" ;; "100") ntasks_mom6=20 @@ -267,6 +268,7 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs_1998-2006_smoothed_2X.nc" MOM6_RESTART_SETTING='n' MOM6_RIVER_RUNOFF='False' + eps_imesh="2.5e-1" ;; "50") ntasks_mom6=60 @@ -279,7 +281,8 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc" MOM6_RESTART_SETTING='n' MOM6_RIVER_RUNOFF='True' - ;; + eps_imesh="1.0e-1" + ;; "025") ntasks_mom6=220 OCNTIM=1800 @@ -291,12 +294,14 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc" MOM6_RIVER_RUNOFF='True' MOM6_RESTART_SETTING="r" + eps_imesh="1.0e-1" ;; *) echo "FATAL ERROR: Unsupported MOM6 resolution = ${mom6_res}, ABORT!" exit 1 ;; esac + export nthreads_mom6 ntasks_mom6 export OCNTIM export NX_GLB NY_GLB @@ -305,6 +310,7 @@ if [[ "${skip_mom6}" == "false" ]]; then export CHLCLIM export MOM6_RIVER_RUNOFF export MOM6_RESTART_SETTING + export eps_imesh fi # CICE6 specific settings @@ -357,10 +363,12 @@ if [[ "${skip_ww3}" == "false" ]]; then ntasks_ww3=262 ;; "glo_200") - ntasks_ww3=40 + ntasks_ww3=30 + nthreads_ww3=1 ;; "glo_500") - ntasks_ww3=10 + ntasks_ww3=12 + nthreads_ww3=1 ;; "mx025") ntasks_ww3=80 diff --git a/parm/config/gfs/config.resources b/parm/config/gfs/config.resources index 2cc8b2426f..bc9edfcb7e 100644 --- a/parm/config/gfs/config.resources +++ b/parm/config/gfs/config.resources @@ -544,38 +544,42 @@ elif [[ "${step}" = "fcst" || "${step}" = "efcs" ]]; then export MEDPETS MEDTHREADS echo "MEDIATOR using (threads, PETS) = (${MEDTHREADS}, ${MEDPETS})" + CHMPETS=0; CHMTHREADS=0 if [[ "${DO_AERO}" = "YES" ]]; then # GOCART shares the same grid and forecast tasks as FV3 (do not add write grid component tasks). (( CHMTHREADS = ATMTHREADS )) (( CHMPETS = FV3PETS )) # Do not add to NTASKS_TOT - export CHMPETS CHMTHREADS echo "GOCART using (threads, PETS) = (${CHMTHREADS}, ${CHMPETS})" fi + export CHMPETS CHMTHREADS + WAVPETS=0; WAVTHREADS=0 if [[ "${DO_WAVE}" = "YES" ]]; then (( WAVPETS = ntasks_ww3 * nthreads_ww3 )) (( WAVTHREADS = nthreads_ww3 )) - export WAVPETS WAVTHREADS echo "WW3 using (threads, PETS) = (${WAVTHREADS}, ${WAVPETS})" (( NTASKS_TOT = NTASKS_TOT + WAVPETS )) fi + export WAVPETS WAVTHREADS + OCNPETS=0; OCNTHREADS=0 if [[ "${DO_OCN}" = "YES" ]]; then (( OCNPETS = ntasks_mom6 * nthreads_mom6 )) (( OCNTHREADS = nthreads_mom6 )) - export OCNPETS OCNTHREADS echo "MOM6 using (threads, PETS) = (${OCNTHREADS}, ${OCNPETS})" (( NTASKS_TOT = NTASKS_TOT + OCNPETS )) fi + export OCNPETS OCNTHREADS + ICEPETS=0; ICETHREADS=0 if [[ "${DO_ICE}" = "YES" ]]; then (( ICEPETS = ntasks_cice6 * nthreads_cice6 )) (( ICETHREADS = nthreads_cice6 )) - export ICEPETS ICETHREADS echo "CICE6 using (threads, PETS) = (${ICETHREADS}, ${ICEPETS})" (( NTASKS_TOT = NTASKS_TOT + ICEPETS )) fi + export ICEPETS ICETHREADS echo "Total PETS for ${_CDUMP} = ${NTASKS_TOT}" diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index 1ec419b822..bfbb0a12cb 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -255,6 +255,7 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs_1998-2006_smoothed_2X.nc" MOM6_RESTART_SETTING='r' MOM6_RIVER_RUNOFF='False' + eps_imesh="4.0e-1" ;; "100") ntasks_mom6=20 @@ -267,6 +268,7 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs_1998-2006_smoothed_2X.nc" MOM6_RESTART_SETTING='n' MOM6_RIVER_RUNOFF='False' + eps_imesh="2.5e-1" ;; "50") ntasks_mom6=60 @@ -279,7 +281,8 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc" MOM6_RESTART_SETTING='n' MOM6_RIVER_RUNOFF='True' - ;; + eps_imesh="1.0e-1" + ;; "025") ntasks_mom6=220 OCNTIM=1800 @@ -291,12 +294,14 @@ if [[ "${skip_mom6}" == "false" ]]; then CHLCLIM="seawifs-clim-1997-2010.${NX_GLB}x${NY_GLB}.v20180328.nc" MOM6_RIVER_RUNOFF='True' MOM6_RESTART_SETTING="r" + eps_imesh="1.0e-1" ;; *) echo "FATAL ERROR: Unsupported MOM6 resolution = ${mom6_res}, ABORT!" exit 1 ;; esac + export nthreads_mom6 ntasks_mom6 export OCNTIM export NX_GLB NY_GLB @@ -305,6 +310,7 @@ if [[ "${skip_mom6}" == "false" ]]; then export CHLCLIM export MOM6_RIVER_RUNOFF export MOM6_RESTART_SETTING + export eps_imesh fi # CICE6 specific settings diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index f503e7e273..36afb4d4c1 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -154,6 +154,30 @@ for file in finddate.sh make_ntc_bull.pl make_NTC_file.pl make_tif.sh month_name ${LINK_OR_COPY} "${HOMEgfs}/sorc/gfs_utils.fd/ush/${file}" . done +# TODO: Link these nems.configure templates from ufs-weather-model +#cd "${HOMEgfs}/parm/ufs" || exit 1 +#declare -a nems_configure_files=("nems.configure.atm.IN" \ +# "nems.configure.atm_aero.IN" \ +# "nems.configure.atmw.IN" \ +# "nems.configure.blocked_atm_wav_2way.IN" \ +# "nems.configure.blocked_atm_wav.IN" \ +# "nems.configure.cpld_agrid.IN" \ +# "nems.configure.cpld_esmfthreads.IN" \ +# "nems.configure.cpld.IN" \ +# "nems.configure.cpld_noaero.IN" \ +# "nems.configure.cpld_noaero_nowave.IN" \ +# "nems.configure.cpld_noaero_outwav.IN" \ +# "nems.configure.leapfrog_atm_wav.IN") +#for file in "${nems_configure_files[@]}"; do +# [[ -s "${file}" ]] && rm -f "${file}" +# ${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/${file}" . +#done + +cd "${HOMEgfs}/ush" || exit 1 +[[ -s "atparse.bash" ]] && rm -f "atparse.bash" +${LINK_OR_COPY} "${HOMEgfs}/sorc/ufs_model.fd/tests/atparse.bash" . + + #------------------------------ #--add GDASApp fix directory #------------------------------ diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index c51e500d5d..1c62cdfd25 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -39,153 +39,68 @@ else exit 1 fi +local atm_model="fv3" local atm_petlist_bounds="0 $(( ${ATMPETS}-1 ))" -local med_petlist_bounds="0 $(( ${MEDPETS}-1 ))" +local atm_omp_num_threads="${ATMTHREADS}" -sed -i -e "s;@\[atm_model\];fv3;g" tmp1 -sed -i -e "s;@\[atm_petlist_bounds\];${atm_petlist_bounds};g" tmp1 -sed -i -e "s;@\[atm_omp_num_threads\];${ATMTHREADS};g" tmp1 -sed -i -e "s;@\[med_model\];cmeps;g" tmp1 -sed -i -e "s;@\[med_petlist_bounds\];${med_petlist_bounds};g" tmp1 -sed -i -e "s;@\[med_omp_num_threads\];${MEDTHREADS};g" tmp1 -sed -i -e "s;@\[esmf_logkind\];${esmf_logkind};g" tmp1 +local med_model="cmeps" +local med_petlist_bounds="0 $(( ${MEDPETS}-1 ))" +local med_omp_num_threads="${MEDTHREADS}" if [[ "${cpl}" = ".true." ]]; then - sed -i -e "s;@\[coupling_interval_slow_sec\];${CPL_SLOW};g" tmp1 + local coupling_interval_slow_sec="${CPL_SLOW}" fi if [[ "${cplflx}" = ".true." ]]; then - # TODO: Should this be raised up to config.ufs or config.ocn? - case "${OCNRES}" in - "500") local eps_imesh="4.0e-1";; - "100") local eps_imesh="2.5e-1";; - *) local eps_imesh="1.0e-1";; - esac local use_coldstart=${use_coldstart:-".false."} local use_mommesh=${USE_MOMMESH:-"true"} - local restile=$(echo "${CASE}" |cut -c2-) - - local start="${ATMPETS}" - local end="$(( ${start}+${OCNPETS}-1 ))" - local ocn_petlist_bounds="${start} ${end}" - - sed -i -e "s;@\[ocn_model\];mom6;g" tmp1 - sed -i -e "s;@\[ocn_petlist_bounds\];${ocn_petlist_bounds};g" tmp1 - sed -i -e "s;@\[ocn_omp_num_threads\];${OCNTHREADS};g" tmp1 - sed -i -e "s;@\[DumpFields\];${DumpFields};g" tmp1 - sed -i -e "s;@\[cap_dbug_flag\];${cap_dbug_flag};g" tmp1 - sed -i -e "s;@\[use_coldstart\];${use_coldstart};g" tmp1 - sed -i -e "s;@\[RUNTYPE\];${cmeps_run_type};g" tmp1 - sed -i -e "s;@\[CPLMODE\];${cplmode};g" tmp1 - sed -i -e "s;@\[coupling_interval_fast_sec\];${CPL_FAST};g" tmp1 - sed -i -e "s;@\[RESTART_N\];${restart_interval};g" tmp1 - sed -i -e "s;@\[use_mommesh\];${use_mommesh};g" tmp1 - sed -i -e "s;@\[eps_imesh\];${eps_imesh};g" tmp1 - sed -i -e "s;@\[ATMTILESIZE\];${restile};g" tmp1 + + local ocn_model="mom6" + local ocn_petlist_bounds="${ATMPETS} $(( ${ATMPETS}+${OCNPETS}-1 ))" + local ocn_omp_num_threads="${OCNTHREADS}" + local RUNTYPE="${cmeps_run_type}" + local CPLMODE="${cplmode}" + local coupling_interval_fast_sec="${CPL_FAST}" + local RESTART_N="${restart_interval}" + local ATMTILESIZE="${CASE:2:}" fi if [[ "${cplice}" = ".true." ]]; then - local mesh_ocn_ice=${MESH_OCN_ICE:-"mesh.mx${ICERES}.nc"} - - local start="$(( ${ATMPETS}+${OCNPETS} ))" - local end="$(( ${start}+${ICEPETS}-1 ))" - local ice_petlist_bounds="${start} ${end}" - - sed -i -e "s;@\[ice_model\];cice6;g" tmp1 - sed -i -e "s;@\[ice_petlist_bounds\];${ice_petlist_bounds};g" tmp1 - sed -i -e "s;@\[ice_omp_num_threads\];${ICETHREADS};g" tmp1 - sed -i -e "s;@\[MESH_OCN_ICE\];${mesh_ocn_ice};g" tmp1 - sed -i -e "s;@\[FHMAX\];${FHMAX_GFS};g" tmp1 + local ice_model="cice6" + local ice_petlist_bounds="$(( ${ATMPETS}+${OCNPETS} )) $(( ${ATMPETS}+${OCNPETS}+${ICEPETS}-1 ))" + local ice_omp_num_threads="${ICETHREADS}" + local MESH_OCN_ICE=${MESH_OCN_ICE:-"mesh.mx${ICERES}.nc"} + local FHMAX="${FHMAX_GFS}" # TODO: How did this get in here hard-wired to FHMAX_GFS? fi if [[ "${cplwav}" = ".true." ]]; then - local start="$(( ${ATMPETS}+${OCNPETS:-0}+${ICEPETS:-0} ))" - local end="$(( ${start}+${WAVPETS}-1 ))" - local wav_petlist_bounds="${start} ${end}" + local wav_model="ww3" + local wav_petlist_bounds="$(( ${ATMPETS}+${OCNPETS}+${ICEPETS} )) $(( ${ATMPETS}+${OCNPETS}+${ICEPETS}+${WAVPETS}-1 ))" + local wav_omp_num_threads="${WAVTHREADS}" + local MULTIGRID="${waveMULTIGRID}" - sed -i -e "s;@\[wav_model\];ww3;g" tmp1 - sed -i -e "s;@\[wav_petlist_bounds\];${wav_petlist_bounds};g" tmp1 - sed -i -e "s;@\[wav_omp_num_threads\];${WAVTHREADS};g" tmp1 - sed -i -e "s;@\[MESH_WAV\];${MESH_WAV};g" tmp1 - sed -i -e "s;@\[MULTIGRID\];${waveMULTIGRID};g" tmp1 fi if [[ "${cplchm}" = ".true." ]]; then + local chm_model="gocart" local chm_petlist_bounds="0 $(( ${CHMPETS}-1 ))" + local chm_omp_num_threads="${CHMTHREADS}" + local coupling_interval_fast_sec="${CPL_FAST}" - sed -i -e "s;@\[chm_model\];gocart;g" tmp1 - sed -i -e "s;@\[chm_petlist_bounds\];${chm_petlist_bounds};g" tmp1 - sed -i -e "s;@\[chm_omp_num_threads\];${CHMTHREADS};g" tmp1 - sed -i -e "s;@\[coupling_interval_fast_sec\];${CPL_FAST};g" tmp1 fi -mv tmp1 nems.configure +source "${HOMEgfs}/ush/atparse.bash" +rm -f "${DATA}/nems.configure" +atparse < "${infile}" >> "${DATA}/nems.configure" echo "$(cat nems.configure)" -if [[ "${cplflx}" = ".true." ]]; then - -#Create other CMEPS mediator related files -cat > pio_in << EOF -&papi_inparm - papi_ctr1_str = "PAPI_FP_OPS" - papi_ctr2_str = "PAPI_NO_CTR" - papi_ctr3_str = "PAPI_NO_CTR" - papi_ctr4_str = "PAPI_NO_CTR" -/ -&pio_default_inparm - pio_async_interface = .false. - pio_blocksize = -1 - pio_buffer_size_limit = -1 - pio_debug_level = 0 - pio_rearr_comm_enable_hs_comp2io = .true. - pio_rearr_comm_enable_hs_io2comp = .false. - pio_rearr_comm_enable_isend_comp2io = .false. - pio_rearr_comm_enable_isend_io2comp = .true. - pio_rearr_comm_fcd = "2denable" - pio_rearr_comm_max_pend_req_comp2io = 0 - pio_rearr_comm_max_pend_req_io2comp = 64 - pio_rearr_comm_type = "p2p" -/ -&prof_inparm - profile_add_detail = .false. - profile_barrier = .false. - profile_depth_limit = 4 - profile_detail_limit = 2 - profile_disable = .false. - profile_global_stats = .true. - profile_outpe_num = 1 - profile_outpe_stride = 0 - profile_ovhd_measurement = .false. - profile_papi_enable = .false. - profile_single_file = .false. - profile_timer = 4 -/ -EOF - -echo "$(cat pio_in)" - -cat > med_modelio.nml << EOF -&pio_inparm - pio_netcdf_format = "64bit_offset" - pio_numiotasks = -99 - pio_rearranger = 1 - pio_root = 1 - pio_stride = 36 - pio_typename = "netcdf" -/ -EOF - -echo "$(cat med_modelio.nml)" - -fi - ${NCP} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/fd_nems.yaml" fd_nems.yaml -echo "SUB ${FUNCNAME[0]}: Nems configured for ${confignamevarfornems}" +echo "SUB ${FUNCNAME[0]}: nems.configure.sh ends for ${confignamevarfornems}" } From ea91d12e88a91e47f2d93afe79b6c38dfcbdc698 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 17:02:59 -0400 Subject: [PATCH 5/6] disable shellcheck on external sources in this function --- sorc/link_workflow.sh | 2 +- ush/nems_configure.sh | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 36afb4d4c1..b88fd664e2 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -2,7 +2,7 @@ #--make symbolic links for EMC installation and hardcopies for NCO delivery -declare -r HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd )" +HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null 2>&1 && pwd )" TRACE=NO source "${HOMEgfs}/ush/preamble.sh" function usage() { diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index 1c62cdfd25..df825eeea3 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -9,8 +9,9 @@ ## This is a child script of modular ## forecast script. This script is definition only (Is it? There is nothing defined here being used outside this script.) ##### -writing_nems_configure() -{ +# shellcheck disable=SC2034 +writing_nems_configure() { + echo "SUB ${FUNCNAME[0]}: nems.configure.sh begins" # Setup nems.configure @@ -40,11 +41,11 @@ else fi local atm_model="fv3" -local atm_petlist_bounds="0 $(( ${ATMPETS}-1 ))" +local atm_petlist_bounds="0 $(( ATMPETS-1 ))" local atm_omp_num_threads="${ATMTHREADS}" local med_model="cmeps" -local med_petlist_bounds="0 $(( ${MEDPETS}-1 ))" +local med_petlist_bounds="0 $(( MEDPETS-1 ))" local med_omp_num_threads="${MEDTHREADS}" if [[ "${cpl}" = ".true." ]]; then @@ -57,7 +58,7 @@ if [[ "${cplflx}" = ".true." ]]; then local use_mommesh=${USE_MOMMESH:-"true"} local ocn_model="mom6" - local ocn_petlist_bounds="${ATMPETS} $(( ${ATMPETS}+${OCNPETS}-1 ))" + local ocn_petlist_bounds="${ATMPETS} $(( ATMPETS+OCNPETS-1 ))" local ocn_omp_num_threads="${OCNTHREADS}" local RUNTYPE="${cmeps_run_type}" local CPLMODE="${cplmode}" @@ -69,7 +70,7 @@ fi if [[ "${cplice}" = ".true." ]]; then local ice_model="cice6" - local ice_petlist_bounds="$(( ${ATMPETS}+${OCNPETS} )) $(( ${ATMPETS}+${OCNPETS}+${ICEPETS}-1 ))" + local ice_petlist_bounds="$(( ATMPETS+OCNPETS )) $(( ATMPETS+OCNPETS+ICEPETS-1 ))" local ice_omp_num_threads="${ICETHREADS}" local MESH_OCN_ICE=${MESH_OCN_ICE:-"mesh.mx${ICERES}.nc"} local FHMAX="${FHMAX_GFS}" # TODO: How did this get in here hard-wired to FHMAX_GFS? @@ -78,7 +79,7 @@ fi if [[ "${cplwav}" = ".true." ]]; then local wav_model="ww3" - local wav_petlist_bounds="$(( ${ATMPETS}+${OCNPETS}+${ICEPETS} )) $(( ${ATMPETS}+${OCNPETS}+${ICEPETS}+${WAVPETS}-1 ))" + local wav_petlist_bounds="$(( ATMPETS+OCNPETS+ICEPETS )) $(( ATMPETS+OCNPETS+ICEPETS+WAVPETS-1 ))" local wav_omp_num_threads="${WAVTHREADS}" local MULTIGRID="${waveMULTIGRID}" @@ -87,7 +88,7 @@ fi if [[ "${cplchm}" = ".true." ]]; then local chm_model="gocart" - local chm_petlist_bounds="0 $(( ${CHMPETS}-1 ))" + local chm_petlist_bounds="0 $(( CHMPETS-1 ))" local chm_omp_num_threads="${CHMTHREADS}" local coupling_interval_fast_sec="${CPL_FAST}" @@ -97,7 +98,7 @@ source "${HOMEgfs}/ush/atparse.bash" rm -f "${DATA}/nems.configure" atparse < "${infile}" >> "${DATA}/nems.configure" -echo "$(cat nems.configure)" +cat nems.configure ${NCP} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/fd_nems.yaml" fd_nems.yaml From e0bd484cbff57d12738085cf87b43ae0953eafe8 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Thu, 13 Jul 2023 17:10:04 -0400 Subject: [PATCH 6/6] no need for tmp1 --- ush/nems_configure.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index df825eeea3..5de127bb31 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -9,6 +9,8 @@ ## This is a child script of modular ## forecast script. This script is definition only (Is it? There is nothing defined here being used outside this script.) ##### + +# Disable variable not used warnings # shellcheck disable=SC2034 writing_nems_configure() { @@ -27,19 +29,9 @@ else local cmeps_run_type='startup' fi -rm -f "${DATA}/nems.configure" - local esmf_logkind=${esmf_logkind:-"ESMF_LOGKIND_MULTI"} #options: ESMF_LOGKIND_MULTI_ON_ERROR, ESMF_LOGKIND_MULTI, ESMF_LOGKIND_NONE -# Copy the selected template into run directory -infile="${HOMEgfs}/parm/ufs/nems.configure.${confignamevarfornems}.IN" -if [[ -s ${infile} ]]; then - cp "${infile}" tmp1 -else - echo "FATAL ERROR: nem.configure template '${infile}' does not exist!" - exit 1 -fi - +# Atm-related local atm_model="fv3" local atm_petlist_bounds="0 $(( ATMPETS-1 ))" local atm_omp_num_threads="${ATMTHREADS}" @@ -94,10 +86,17 @@ if [[ "${cplchm}" = ".true." ]]; then fi +# Ensure the template exists +template="${HOMEgfs}/parm/ufs/nems.configure.${confignamevarfornems}.IN" +if [[ ! -f ${template} ]]; then + echo "FATAL ERROR: template '${template}' does not exist, ABORT!" + exit 1 +fi + source "${HOMEgfs}/ush/atparse.bash" rm -f "${DATA}/nems.configure" -atparse < "${infile}" >> "${DATA}/nems.configure" - +atparse < "${template}" >> "${DATA}/nems.configure" +echo "Rendered nems.configure:" cat nems.configure ${NCP} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/fd_nems.yaml" fd_nems.yaml