From e38fde5ff263fe3173c56e1d0bb9b401ce948877 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Mon, 30 Oct 2023 21:32:16 -0500 Subject: [PATCH] Enable different coupled settings for ensemble Preliminarily adds the ability to turn off some coupled components for the ensemble. To enable this, many settings are moved out of `config.fcst` and into `config.ufs` so they are calculated after any overrides of `DO_*` have been made. Some settings also had to be moved out of `config.base` for the same reason. The name of the nems configure template used is converted from a partial file name to the full file name. In anticipation of #1942, the filename is assigned to a variable named `ufs_configure_template`, though otherwise 'nems' is still used for filenames, etc. Refs #1692 --- parm/config/gfs/config.base.emc.dyn | 11 ---- parm/config/gfs/config.fcst | 56 -------------------- parm/config/gfs/config.ufs | 81 ++++++++++++++++++++++++++++- ush/nems_configure.sh | 4 +- 4 files changed, 81 insertions(+), 71 deletions(-) diff --git a/parm/config/gfs/config.base.emc.dyn b/parm/config/gfs/config.base.emc.dyn index fdf5bc25c1b..adfa0257abc 100644 --- a/parm/config/gfs/config.base.emc.dyn +++ b/parm/config/gfs/config.base.emc.dyn @@ -151,10 +151,8 @@ export DO_WAVE="NO" export DO_OCN="NO" export DO_ICE="NO" export DO_AERO="NO" -export CCPP_SUITE="FV3_GFS_v17_p8_ugwpv1" export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both export DOBNDPNT_WAVE="NO" -export cplwav2atm=".false." export FRAC_GRID=".true." # Set operational resolution @@ -196,17 +194,14 @@ export ICERES=${OCNRES} case "${APP}" in ATM) - export confignamevarfornems="atm" ;; ATMA) export DO_AERO="YES" - export confignamevarfornems="atm_aero" ;; ATMW) export DO_COUPLED="YES" export DO_WAVE="YES" export WAVE_CDUMP="both" - export confignamevarfornems="leapfrog_atm_wav" ;; NG-GODAS) export DO_ATM="NO" @@ -217,21 +212,15 @@ case "${APP}" in export DO_COUPLED="YES" export DO_OCN="YES" export DO_ICE="YES" - export CCPP_SUITE="FV3_GFS_v17_coupled_p8_ugwpv1" # TODO: Does this include FV3_GFS_v17_p8? Can this be used instead of FV3_GFS_v17_p8 on L149 - export confignamevarfornems="cpld" if [[ "${APP}" =~ A$ ]]; then export DO_AERO="YES" - export confignamevarfornems="${confignamevarfornems}_aero" fi if [[ "${APP}" =~ ^S2SW ]]; then export DO_WAVE="YES" export WAVE_CDUMP="both" - export cplwav2atm=".true." - export confignamevarfornems="${confignamevarfornems}_outerwave" fi - ;; *) echo "Unrecognized APP: '${APP}'" diff --git a/parm/config/gfs/config.fcst b/parm/config/gfs/config.fcst index 7a3c1b3b301..ee81442430b 100644 --- a/parm/config/gfs/config.fcst +++ b/parm/config/gfs/config.fcst @@ -20,13 +20,6 @@ string="--fv3 ${CASE}" # shellcheck disable=SC2086 source "${EXPDIR}/config.ufs" ${string} -# Source component configs if necessary -for component in WAVE OCN ICE AERO; do - control="DO_${component}" - if [[ ${!control} == "YES" ]]; then - source "${EXPDIR}/config.${component,,}" - fi -done # Get task specific resources source "${EXPDIR}/config.resources" fcst @@ -41,35 +34,6 @@ export esmf_profile=".false." export esmf_logkind="ESMF_LOGKIND_MULTI_ON_ERROR" #Options: ESMF_LOGKIND_MULTI_ON_ERROR, ESMF_LOGKIND_MULTI, ESMF_LOGKIND_NONE -####################################################################### -# COUPLING COMPONENTS - -# cpl defaults -export cpl=".false." -export cplflx=".false." -export cplice=".false." -export cplchm=".false." -export cplwav=".false." - -# cpl changes based on APP - -if [[ "${DO_COUPLED}" == "YES" ]]; then - export cpl=".true." -fi -if [[ "${DO_AERO}" == "YES" ]]; then - export cplchm=".true." -fi -if [[ "${DO_ICE}" == "YES" ]]; then - export cplice=".true." - export cplflx=".true." -fi -if [[ "${DO_OCN}" == "YES" ]]; then - export cplflx=".true." -fi -if [[ "${DO_WAVE}" == "YES" ]]; then - export cplwav=".true." -fi - ####################################################################### export FORECASTSH="${HOMEgfs}/scripts/exglobal_forecast.sh" @@ -285,16 +249,12 @@ if [[ "${CDUMP}" =~ "gdas" ]] ; then # GDAS cycle specific parameters # Variables used in DA cycling export DIAG_TABLE="${HOMEgfs}/parm/ufs/fv3/diag_table_da" - if [[ "${DOIAU}" == "YES" ]]; then export restart_interval="3" else export restart_interval="6" fi - # Choose coupling with wave - if [[ "${DO_WAVE}" == "YES" ]]; then export cplwav=".true." ; fi - # Turn on dry mass adjustment in GDAS export adjust_dry_mass=".true." @@ -306,11 +266,6 @@ elif [[ "${CDUMP}" =~ "gfs" ]] ; then # GFS cycle specific parameters # Write gfs restart files to rerun fcst from any break point export restart_interval=${restart_interval_gfs:-12} - # Choose coupling with wave - if [[ "${DO_WAVE}" = "YES" && "${WAVE_CDUMP}" != "gdas" ]]; then - export cplwav=".true." - fi - # Turn off dry mass adjustment in GFS export adjust_dry_mass=".false." @@ -323,17 +278,6 @@ elif [[ "${CDUMP}" =~ "gfs" ]] ; then # GFS cycle specific parameters fi -if [[ "${DO_AERO}" = "YES" ]]; then # temporary settings for aerosol coupling - export AERO_DIAG_TABLE="${AERO_DIAG_TABLE:-${HOMEgfs}/parm/ufs/fv3/diag_table.aero}" - export AERO_FIELD_TABLE="${AERO_FIELD_TABLE:-${HOMEgfs}/parm/ufs/fv3/field_table.aero}" - AERO_EMIS_FIRE="${AERO_EMIS_FIRE:-none}" - export AERO_EMIS_FIRE=${AERO_EMIS_FIRE,,} - export AERO_CONFIG_DIR="${AERO_CONFIG_DIR:-${HOMEgfs}/parm/ufs/chem}" - export AERO_INPUTS_DIR="${AERO_INPUTS_DIR:-}" - export fscav_aero="${aero_conv_scav_factors:-${fscav_aero}}" - export dnats_aero="${aero_diag_tracers:-0}" -fi - # Remember config.efcs will over-ride these values for ensemble forecasts # if these variables are re-defined there. # Otherwise, the ensemble forecast will inherit from config.fcst diff --git a/parm/config/gfs/config.ufs b/parm/config/gfs/config.ufs index e499d90fdd5..cdf9f797a15 100644 --- a/parm/config/gfs/config.ufs +++ b/parm/config/gfs/config.ufs @@ -8,7 +8,7 @@ echo "BEGIN: config.ufs" -if [ $# -le 1 ]; then +if (( $# <= 1 )); then echo "Must specify an input resolution argument to set variables!" echo "argument can be any one of the following:" @@ -28,7 +28,7 @@ skip_ww3=true skip_mediator=true # Loop through named arguments -while [[ $# -gt 0 ]]; do +while (( $# > 0 )); do key="$1" case "${key}" in "--fv3") @@ -60,6 +60,14 @@ if [[ "${skip_mom6}" == "false" ]] || [[ "${skip_cice6}" == "false" ]] || [[ "${ skip_mediator=false fi +# Source component configs if necessary +for component in WAVE OCN ICE AERO; do + control="DO_${component}" + if [[ ${!control} == "YES" ]]; then + source "${EXPDIR}/config.${component,,}" + fi +done + case "${machine}" in "WCOSS2") npe_node_max=128 @@ -98,6 +106,10 @@ case "${machine}" in ;; esac ;; + *) + echo "FATAL ERROR: Unrecognized machine ${machine}" + exit 14 + ;; esac export npe_node_max @@ -246,16 +258,34 @@ case ${fv3_res} in OUTPUT_FILETYPE_ATM="netcdf_parallel" OUTPUT_FILETYPE_SFC="netcdf_parallel" ;; + *) + echo "FATAL ERROR: Unrecognized FV3 resolution ${fv3_res}" + exit 15 + ;; esac export OUTPUT_FILETYPE_ATM OUTPUT_FILETYPE_SFC +# cpl defaults +export cpl=".false." +export cplflx=".false." +export cplice=".false." +export cplchm=".false." +export cplwav=".false." +export cplwav2atm=".false." +export CCPP_SUITE="FV3_GFS_v17_p8_ugwpv1" +model_list="atm" + # Mediator specific settings if [[ "${skip_mediator}" == "false" ]]; then + export cpl=".true." export nthreads_mediator=${nthreads_fv3} # Use same threads as FV3 + export CCPP_SUITE="FV3_GFS_v17_coupled_p8_ugwpv1" # TODO: Does this include FV3_GFS_v17_p8? Can this be used instead of FV3_GFS_v17_p8? fi # MOM6 specific settings if [[ "${skip_mom6}" == "false" ]]; then + export cplflx=".true." + model_list="${model_list}.ocean" nthreads_mom6=1 case "${mom6_res}" in "500") @@ -364,11 +394,14 @@ fi # CICE6 specific settings if [[ "${skip_cice6}" == "false" ]]; then + model_list="${model_list}.ice" # Ensure we sourced the MOM6 section if [[ "${skip_mom6}" == "true" ]]; then echo "FATAL ERROR: CICE6 cannot be configured without MOM6, ABORT!" exit 1 fi + + export cplice=".true." nthreads_cice6=${nthreads_mom6} # CICE6 needs to run on same threads as MOM6 case "${cice6_res}" in "500") @@ -400,6 +433,9 @@ fi # WW3 specific settings if [[ "${skip_ww3}" == "false" ]]; then + export cplwav=".true." + export cplwav2atm=".true." + model_list="${model_list}.wave" nthreads_ww3=2 case "${ww3_res}" in "gnh_10m;aoc_9km;gsh_15m") @@ -430,4 +466,45 @@ if [[ "${skip_ww3}" == "false" ]]; then export ntasks_ww3 nthreads_ww3 fi +# GOCART specific settings +if [[ "${DO_AERO}" = "YES" ]]; then # temporary settings for aerosol coupling + export cplchm=".true." + + model_list="${model_list}.aero" + export AERO_DIAG_TABLE="${AERO_DIAG_TABLE:-${HOMEgfs}/parm/ufs/fv3/diag_table.aero}" + export AERO_FIELD_TABLE="${AERO_FIELD_TABLE:-${HOMEgfs}/parm/ufs/fv3/field_table.aero}" + AERO_EMIS_FIRE="${AERO_EMIS_FIRE:-none}" + export AERO_EMIS_FIRE=${AERO_EMIS_FIRE,,} + export AERO_CONFIG_DIR="${AERO_CONFIG_DIR:-${HOMEgfs}/parm/ufs/chem}" + export AERO_INPUTS_DIR="${AERO_INPUTS_DIR:-}" + export fscav_aero="${aero_conv_scav_factors:-${fscav_aero}}" + export dnats_aero="${aero_diag_tracers:-0}" +fi + +# Set the name of the UFS (previously nems) configure template to use +case "${model_list}" in + atm) + export ufs_configure_template="nems.configure.atm.IN" + ;; + atm.aero) + export ufs_configure_template="nems.configure.atm_aero.IN" + ;; + atm.wave) + export ufs_configure_template="nems.configure.leapfrog_atm_wav.IN" + ;; + atm.ocean.ice) + export ufs_configure_template="nems.configure.cpld.IN" + ;; + atm.ocean.ice.aero) + export ufs_configure_template="nems.configure.cpld_aero.IN" + ;; + atm.ocean.ice.wave.aero) + export ufs_configure_template="nems.configure.cpld_aero_outerwave.IN" + ;; + *) + echo "FATAL ERROR: Unable to determine appropriate UFS configure template for ${model_list}" + exit 16 + ;; +esac + echo "END: config.ufs" diff --git a/ush/nems_configure.sh b/ush/nems_configure.sh index 28c6713dd88..0af3645e34c 100755 --- a/ush/nems_configure.sh +++ b/ush/nems_configure.sh @@ -89,7 +89,7 @@ if [[ "${cplchm}" = ".true." ]]; then fi # Ensure the template exists -template="${HOMEgfs}/parm/ufs/nems.configure.${confignamevarfornems}.IN" +template="${HOMEgfs}/parm/ufs/${ufs_configure_template}" if [[ ! -f ${template} ]]; then echo "FATAL ERROR: template '${template}' does not exist, ABORT!" exit 1 @@ -103,6 +103,6 @@ cat nems.configure ${NCP} "${HOMEgfs}/sorc/ufs_model.fd/tests/parm/fd_nems.yaml" fd_nems.yaml -echo "SUB ${FUNCNAME[0]}: nems.configure.sh ends for ${confignamevarfornems}" +echo "SUB ${FUNCNAME[0]}: nems.configure.sh ends for ${ufs_configure_template}" }