Skip to content

Commit

Permalink
allow building multiple ufs_model.x for gfs, gefs and sfs
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Nov 14, 2024
1 parent 57c8aa3 commit 1c5b14b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions parm/config/gefs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export esmf_logkind="ESMF_LOGKIND_MULTI_ON_ERROR" #Options: ESMF_LOGKIND_MULTI_O

export FORECASTSH="${SCRgfs}/exglobal_forecast.sh"
#export FORECASTSH="${SCRgfs}/exglobal_forecast.py" # Temp. while this is worked on
export FCSTEXEC="ufs_model.x"
export FCSTEXEC="gefs_model.x"

#######################################################################
# Model configuration
Expand Down Expand Up @@ -117,7 +117,7 @@ if (( gwd_opt == 2 )); then
export do_gsl_drag_ls_bl=".true."
export do_gsl_drag_ss=".false."
export do_gsl_drag_tofd=".true."
export do_gwd_opt_psl=".true."
export do_gwd_opt_psl=".true."
export do_ugwp_v1_orog_only=".false."
launch_level=$(echo "${LEVS}/2.35" |bc)
export launch_level
Expand Down Expand Up @@ -145,7 +145,7 @@ if [[ "${progsigma}" == ".true." ]]; then tbp="_progsigma" ; fi
if [[ "${DO_AERO}" == "YES" ]]; then
export IAER=2011 # spectral band mapping method for aerosol optical properties
else
export IAER=1011
export IAER=1011
fi
export iovr_lw=3 ; #de-correlation length cloud overlap method (Barker, 2008)
export iovr_sw=3 ; #de-correlation length cloud overlap method (Barker, 2008)
Expand Down
6 changes: 3 additions & 3 deletions parm/config/gfs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export esmf_logkind="ESMF_LOGKIND_MULTI_ON_ERROR" #Options: ESMF_LOGKIND_MULTI_O

export FORECASTSH="${SCRgfs}/exglobal_forecast.sh"
#export FORECASTSH="${SCRgfs}/exglobal_forecast.py" # Temp. while this is worked on
export FCSTEXEC="ufs_model.x"
export FCSTEXEC="gfs_model.x"

#######################################################################
# Model configuration
Expand Down Expand Up @@ -128,7 +128,7 @@ if (( gwd_opt == 2 )); then
export do_gsl_drag_ls_bl=".true."
export do_gsl_drag_ss=".false."
export do_gsl_drag_tofd=".true."
export do_gwd_opt_psl=".true."
export do_gwd_opt_psl=".true."
export do_ugwp_v1_orog_only=".false."
launch_level=$(echo "${LEVS}/2.35" |bc)
export launch_level
Expand Down Expand Up @@ -160,7 +160,7 @@ if [[ "${progsigma}" == ".true." ]]; then tbp="_progsigma" ; fi
if [[ "${DO_AERO}" == "YES" ]]; then
export IAER=2011 # spectral band mapping method for aerosol optical properties
else
export IAER=1011
export IAER=1011
fi
export iovr_lw=3 ; #de-correlation length cloud overlap method (Barker, 2008)
export iovr_sw=3 ; #de-correlation length cloud overlap method (Barker, 2008)
Expand Down
7 changes: 4 additions & 3 deletions sorc/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ _wave_opt=""
_hydro_opt=""
_build_job_max=20
_quick_kill="NO"
_ufs_exec="-e gfs_model.x"
# Reset option counter in case this script is sourced
OPTIND=1
while getopts ":a:dfghj:kuvwy" option; do
Expand All @@ -69,8 +70,8 @@ while getopts ":a:dfghj:kuvwy" option; do
k) _quick_kill="YES" ;;
u) _build_ufsda="YES" ;;
v) _verbose_opt="-v";;
w) _wave_opt="-w";;
y) _hydro_opt="-y";;
w) _wave_opt="-w"; _ufs_exec="-e gefs_model.x";;
y) _hydro_opt="-y"; _ufs_exec="-e sfs_model.x";;
:)
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument"
_usage
Expand Down Expand Up @@ -133,7 +134,7 @@ declare -A build_opts
big_jobs=0
build_jobs["ufs"]=8
big_jobs=$((big_jobs+1))
build_opts["ufs"]="${_wave_opt} ${_hydro_opt} ${_verbose_opt} ${_build_ufs_opt} ${_build_debug}"
build_opts["ufs"]="${_wave_opt} ${_hydro_opt} ${_verbose_opt} ${_build_ufs_opt} ${_build_debug} ${_ufs_exec}"

build_jobs["upp"]=1
build_opts["upp"]="${_build_debug}"
Expand Down
20 changes: 14 additions & 6 deletions sorc/build_ufs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ APP="S2SWA"
CCPP_SUITES="FV3_GFS_v17_p8_ugwpv1,FV3_GFS_v17_coupled_p8_ugwpv1,FV3_global_nest_v1" # TODO: does the g-w need to build with all these CCPP_SUITES?
PDLIB="ON"
HYDRO="OFF"
EXEC_NAME="gfs_model.x"

while getopts ":da:fj:vwy" option; do
while getopts ":da:fj:e:vwy" option; do
case "${option}" in
d) BUILD_TYPE="Debug";;
a) APP="${OPTARG}";;
Expand All @@ -18,6 +19,7 @@ while getopts ":da:fj:vwy" option; do
v) export BUILD_VERBOSE="YES";;
w) PDLIB="OFF";;
y) HYDRO="ON";;
e) EXEC_NAME="${OPTARG}";;
:)
echo "[${BASH_SOURCE[0]}]: ${option} requires an argument"
;;
Expand All @@ -40,13 +42,19 @@ if [[ ${BUILD_TYPE:-"Release"} = "DEBUG" ]] ; then
elif [[ "${FASTER:-OFF}" == ON ]] ; then
MAKE_OPT+=" -DFASTER=ON"
fi
COMPILE_NR=0

case "${EXEC_NAME}" in
"gfs_model.x") COMPILE_ID=1 ;;
"gefs_model.x") COMPILE_ID=2 ;;
"sfs_model.x") COMPILE_ID=3 ;;
*) COMPILE_ID=0 ;;
esac
CLEAN_BEFORE=YES
CLEAN_AFTER=NO

BUILD_JOBS=${BUILD_JOBS:-8} ./tests/compile.sh "${MACHINE_ID}" "${MAKE_OPT}" "${COMPILE_NR}" "intel" "${CLEAN_BEFORE}" "${CLEAN_AFTER}"
mv "./tests/fv3_${COMPILE_NR}.exe" ./tests/ufs_model.x
mv "./tests/modules.fv3_${COMPILE_NR}.lua" ./tests/modules.ufs_model.lua
cp "./modulefiles/ufs_common.lua" ./tests/ufs_common.lua
BUILD_JOBS=${BUILD_JOBS:-8} ./tests/compile.sh "${MACHINE_ID}" "${MAKE_OPT}" "${COMPILE_ID}" "intel" "${CLEAN_BEFORE}" "${CLEAN_AFTER}"
mv "./tests/fv3_${COMPILE_ID}.exe" "./tests/${EXEC_NAME}"
if [[ ! -f "./tests/modules.ufs_model.lua" ]]; then mv "./tests/modules.fv3_${COMPILE_ID}.lua" "./tests/modules.ufs_model.lua"; fi
if [[ ! -f "./tests/ufs_common.lua" ]]; then cp "./modulefiles/ufs_common.lua" ./tests/ufs_common.lua; fi

exit 0

0 comments on commit 1c5b14b

Please sign in to comment.