Skip to content

Commit

Permalink
Enable different coupled settings for ensemble (#2030)
Browse files Browse the repository at this point in the history
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. A
switch to turn on gocart is added to `config.ufs`, but unlike the other switches
this one takes no arguments.

The name of the ufs configure template used is converted from a partial file
name to the full file name.

Resolves #1692
  • Loading branch information
WalterKolczynski-NOAA authored Nov 17, 2023
1 parent fe792c0 commit ea386ab
Show file tree
Hide file tree
Showing 29 changed files with 195 additions and 205 deletions.
9 changes: 0 additions & 9 deletions parm/config/gefs/config.base.emc.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,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
Expand Down Expand Up @@ -183,17 +181,14 @@ export ICERES=${OCNRES}

case "${APP}" in
ATM)
export confignamevarforufs="atm"
;;
ATMA)
export DO_AERO="YES"
export confignamevarforufs="atm_aero"
;;
ATMW)
export DO_COUPLED="YES"
export DO_WAVE="YES"
export WAVE_CDUMP="both"
export confignamevarforufs="leapfrog_atm_wav"
;;
NG-GODAS)
export DO_ATM="NO"
Expand All @@ -204,19 +199,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 L141
export confignamevarforufs="cpld"

if [[ "${APP}" =~ A$ ]]; then
export DO_AERO="YES"
export confignamevarforufs="${confignamevarforufs}_aero"
fi

if [[ "${APP}" =~ ^S2SW ]]; then
export DO_WAVE="YES"
export WAVE_CDUMP="both"
export cplwav2atm=".true."
export confignamevarforufs="${confignamevarforufs}_outerwave"
fi
;;
*)
Expand Down
7 changes: 4 additions & 3 deletions parm/config/gefs/config.efcs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ export DO_WAVE=${DO_WAVE_ENKF:-${DO_WAVE:-"NO"}}
# Source model specific information that is resolution dependent
string="--fv3 ${CASE_ENS}"
# Ocean/Ice/Waves ensemble configurations are identical to deterministic member
[[ ${DO_OCN} == "YES" ]] && string="${string} --mom6 ${OCNRES}"
[[ ${DO_ICE} == "YES" ]] && string="${string} --cice6 ${ICERES}"
[[ ${DO_WAVE} == "YES" ]] && string="${string} --ww3 ${waveGRD// /;}"
[[ "${DO_OCN}" == "YES" ]] && string="${string} --mom6 ${OCNRES}"
[[ "${DO_ICE}" == "YES" ]] && string="${string} --cice6 ${ICERES}"
[[ "${DO_WAVE}" == "YES" ]] && string="${string} --ww3 ${waveGRD// /;}"
[[ "${DO_AERO}" == "YES" ]] && string="${string} --gocart"
# shellcheck disable=SC2086
source "${EXPDIR}/config.ufs" ${string}

Expand Down
59 changes: 4 additions & 55 deletions parm/config/gefs/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@ esac

# Source model specific information that is resolution dependent
string="--fv3 ${CASE}"
[[ ${DO_OCN} == "YES" ]] && string="${string} --mom6 ${OCNRES}"
[[ ${DO_ICE} == "YES" ]] && string="${string} --cice6 ${ICERES}"
[[ ${DO_WAVE} == "YES" ]] && string="${string} --ww3 ${waveGRD// /;}"
[[ "${DO_OCN}" == "YES" ]] && string="${string} --mom6 ${OCNRES}"
[[ "${DO_ICE}" == "YES" ]] && string="${string} --cice6 ${ICERES}"
[[ "${DO_WAVE}" == "YES" ]] && string="${string} --ww3 ${waveGRD// /;}"
[[ "${DO_AERO}" == "YES" ]] && string="${string} --gocart"
# We are counting on $string being multiple arguments
# 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
Expand All @@ -41,35 +35,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"
Expand Down Expand Up @@ -286,11 +251,6 @@ export DIAG_TABLE="${HOMEgfs}/parm/ufs/fv3/diag_table"
# 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" ]]; then
export cplwav=".true."
fi

# Turn off dry mass adjustment in GFS
export adjust_dry_mass=".false."

Expand All @@ -301,17 +261,6 @@ else
export io_layout="1,1"
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
Expand Down
83 changes: 80 additions & 3 deletions parm/config/gefs/config.ufs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@

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:"
echo "--fv3 C48|C96|C192|C384|C768|C1152|C3072"
echo "--mom6 500|100|025"
echo "--cice6 500|100|025"
echo "--ww3 gnh_10m;aoc_9km;gsh_15m|gwes_30m|glo_025|glo_200|glo_500|mx025"
echo "--gocart"

exit 1

Expand All @@ -25,34 +26,41 @@ fi
skip_mom6=true
skip_cice6=true
skip_ww3=true
skip_gocart=true
skip_mediator=true

# Loop through named arguments
while [[ $# -gt 0 ]]; do
while (( $# > 0 )); do
key="$1"
case "${key}" in
"--fv3")
fv3_res="$2"
shift
;;
"--mom6")
mom6_res="$2"
skip_mom6=false
shift
;;
"--cice6")
cice6_res="$2"
skip_cice6=false
shift
;;
"--ww3")
ww3_res="$2"
skip_ww3=false
shift
;;
"--gocart")
skip_gocart=false
;;
*) # unknown option
echo "FATAL ERROR: Unknown option: ${key}, ABORT!"
exit 1
;;
esac
shift
shift
done

# Mediator is required if any of the non-ATM components are used
Expand Down Expand Up @@ -98,6 +106,10 @@ case "${machine}" in
;;
esac
;;
*)
echo "FATAL ERROR: Unrecognized machine ${machine}"
exit 14
;;
esac
export npe_node_max

Expand Down Expand Up @@ -249,13 +261,28 @@ case ${fv3_res} in
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
source "${EXPDIR}/config.ocn"
export cplflx=".true."
model_list="${model_list}.ocean"
nthreads_mom6=1
case "${mom6_res}" in
"500")
Expand Down Expand Up @@ -362,6 +389,9 @@ fi

# CICE6 specific settings
if [[ "${skip_cice6}" == "false" ]]; then
source "${EXPDIR}/config.ice"
export cplice=".true."
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!"
Expand Down Expand Up @@ -398,6 +428,10 @@ fi

# WW3 specific settings
if [[ "${skip_ww3}" == "false" ]]; then
source "${EXPDIR}/config.wave"
export cplwav=".true."
export cplwav2atm=".true."
model_list="${model_list}.wave"
nthreads_ww3=2
case "${ww3_res}" in
"gnh_10m;aoc_9km;gsh_15m")
Expand Down Expand Up @@ -428,4 +462,47 @@ if [[ "${skip_ww3}" == "false" ]]; then
export ntasks_ww3 nthreads_ww3
fi

# GOCART specific settings
if [[ "${skip_gocart}" == "false" ]]; then
source "${EXPDIR}/config.aero"
export cplchm=".true."
model_list="${model_list}.aero"
fi

# Set the name of the UFS (previously nems) configure template to use
case "${model_list}" in
atm)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.atm.IN"
;;
atm.aero)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.atm_aero.IN"
;;
atm.wave)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.leapfrog_atm_wav.IN"
;;
atm.ocean.ice)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.cpld.IN"
;;
atm.ocean.ice.aero)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.cpld_aero.IN"
;;
atm.ocean.ice.wave)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.cpld_outerwave.IN"
;;
atm.ocean.ice.wave.aero)
export ufs_configure_template="${HOMEgfs}/parm/ufs/ufs.configure.cpld_aero_outerwave.IN"
;;
*)
echo "FATAL ERROR: Unable to determine appropriate UFS configure template for ${model_list}"
exit 16
;;
esac

if [[ ! -r "${ufs_configure_template}" ]]; then
echo "FATAL ERROR: ${ufs_configure_template} either doesn't exist or is not readable."
exit 17
fi

unset model_list

echo "END: config.ufs"
15 changes: 9 additions & 6 deletions parm/config/gfs/config.aero
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Turn off warnings about unused variables
# shellcheck disable=SC2034

# Directory containing GOCART configuration files. Defaults to parm/ufs/chem if unset.
AERO_CONFIG_DIR=${HOMEgfs}/parm/ufs/chem

# Path to the input data tree
case ${machine} in
Expand All @@ -30,14 +28,19 @@ case ${machine} in
exit 2
;;
esac
export AERO_INPUTS_DIR

# Biomass burning emission dataset. Choose from: GBBEPx, QFED, NONE (default)
AERO_EMIS_FIRE=QFED
export AERO_DIAG_TABLE="${HOMEgfs}/parm/ufs/fv3/diag_table.aero"
export AERO_FIELD_TABLE="${HOMEgfs}/parm/ufs/fv3/field_table.aero"
# Biomass burning emission dataset. Choose from: gbbepx, qfed, none
export AERO_EMIS_FIRE="qfed"
# Directory containing GOCART configuration files
export AERO_CONFIG_DIR="${HOMEgfs}/parm/ufs/gocart"

# Aerosol convective scavenging factors (list of string array elements)
# Element syntax: '<tracer_name>:<factor>'. Use <tracer_name> = * to set default factor for all aerosol tracers
# Scavenging factors are set to 0 (no scavenging) if unset
aero_conv_scav_factors="'*:0.3','so2:0.0','msa:0.0','dms:0.0','nh3:0.4','nh4:0.6','bc1:0.6','bc2:0.6','oc1:0.4','oc2:0.4','dust1:0.6','dust2:0.6', 'dust3:0.6','dust4:0.6','dust5:0.6','seas1:0.5','seas2:0.5','seas3:0.5','seas4:0.5','seas5:0.5'"
export fscav_aero="'*:0.3','so2:0.0','msa:0.0','dms:0.0','nh3:0.4','nh4:0.6','bc1:0.6','bc2:0.6','oc1:0.4','oc2:0.4','dust1:0.6','dust2:0.6', 'dust3:0.6','dust4:0.6','dust5:0.6','seas1:0.5','seas2:0.5','seas3:0.5','seas4:0.5','seas5:0.5'"
#
# Number of diagnostic aerosol tracers (default: 0)
aero_diag_tracers=2
export dnats_aero=2
Loading

0 comments on commit ea386ab

Please sign in to comment.