Skip to content

Commit

Permalink
Update config.catchem and exglobal_stage_ic.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanglikate committed Mar 24, 2024
1 parent 0ae51fa commit b2160cf
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 3 deletions.
2 changes: 1 addition & 1 deletion parm/config/gfs/config.catchem
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export dust_alpha_catc="${dust_alpha_catc:-0.04}"
export dust_gamma_catc="${dust_gamma_catc:-1.0}"
export seas_emis_scale="${seas_emis_scale:-"1.,1.,1.,1.,1."}"
# Large scale wet deposition option
export wetdep_ls_cplchp =${wetdep_ls_cplchp:-"1"}
export wetdep_ls_cplchp="${wetdep_ls_cplchp:-1}"

#
# Numbe rof diagnostic aerosol tracers (default: 0)
Expand Down
2 changes: 1 addition & 1 deletion parm/post/postxconfig-NT-CCPP-CHEM-F00.txt
2 changes: 1 addition & 1 deletion parm/post/postxconfig-NT-CCPP-CHEM.txt
91 changes: 91 additions & 0 deletions scripts/exglobal_stage_ic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env bash

source "${HOMEgfs}/ush/preamble.sh"

# Locally scoped variables and functions
# shellcheck disable=SC2153
GDATE=$(date --utc -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
gPDY="${GDATE:0:8}"
gcyc="${GDATE:8:2}"

MEMDIR_ARRAY=()
if [[ "${RUN:-}" = "gefs" ]]; then
# Populate the member_dirs array based on the value of NMEM_ENS
for ((ii = 0; ii <= "${NMEM_ENS:-0}"; ii++)); do
MEMDIR_ARRAY+=("mem$(printf "%03d" "${ii}")")
done
else
MEMDIR_ARRAY+=("")
fi

# Initialize return code
err=0

error_message() {
echo "FATAL ERROR: Unable to copy ${1} to ${2} (Error code ${3})"
}

###############################################################
for MEMDIR in "${MEMDIR_ARRAY[@]}"; do

# Stage atmosphere initial conditions to ROTDIR
if [[ ${EXP_WARM_START:-".false."} = ".true." ]]; then
# Stage the FV3 restarts to ROTDIR (warm start)
RUN=${rCDUMP} YMD=${gPDY} HH=${gcyc} generate_com COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL
[[ ! -d "${COM_ATMOS_RESTART_PREV}" ]] && mkdir -p "${COM_ATMOS_RESTART_PREV}"
for ftype in coupler.res fv_core.res.nc; do
src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${PDY}.${cyc}0000.${ftype}"
tgt="${COM_ATMOS_RESTART_PREV}/${PDY}.${cyc}0000.${ftype}"
${NCP} "${src}" "${tgt}"
rc=$?
((rc != 0)) && error_message "${src}" "${tgt}" "${rc}"
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
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"
${NCP} "${src}" "${tgt}"
rc=$?
((rc != 0)) && error_message "${src}" "${tgt}" "${rc}"
err=$((err + rc))
done
done
else
# Stage the FV3 cold-start initial conditions to ROTDIR
YMD=${PDY} HH=${cyc} generate_com COM_ATMOS_INPUT
[[ ! -d "${COM_ATMOS_INPUT}" ]] && mkdir -p "${COM_ATMOS_INPUT}"
src="$ICSORG/${CDUMP}.${PDY}/${cyc}/atmos/INPUT/gfs_ctrl.nc"
#src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/gfs_ctrl.nc"
tgt="${COM_ATMOS_INPUT}/gfs_ctrl.nc"
${NCP} "${src}" "${tgt}"
rc=$?
((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
src="$ICSORG/${CDUMP}.${PDY}/${cyc}/atmos/INPUT/${ftype}.tile${tt}.nc"
#src="${BASE_CPLIC}/${CPL_ATMIC:-}/${PDY}${cyc}/${MEMDIR}/atmos/${ftype}.tile${tt}.nc"
tgt="${COM_ATMOS_INPUT}/${ftype}.tile${tt}.nc"
${NCP} "${src}" "${tgt}"
rc=$?
((rc != 0)) && error_message "${src}" "${tgt}" "${rc}"
err=$((err + rc))
done
done

fi


done # for MEMDIR in "${MEMDIR_ARRAY[@]}"; do

###############################################################
# Check for errors and exit if any of the above failed
if [[ "${err}" -ne 0 ]]; then
echo "FATAL ERROR: Unable to copy ICs from ${BASE_CPLIC} to ${ROTDIR}; ABORT!"
exit "${err}"
fi

##############################################################
# Exit cleanly
exit "${err}"

0 comments on commit b2160cf

Please sign in to comment.