Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable cycling atmosphere DA in 3DEnVar mode with coupled ensemble. #1718

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions jobs/JGLOBAL_ARCHIVE
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_ANALYSIS COM_ATMOS_BUFR COM_ATMO
COM_ATMOS_GENESIS COM_ATMOS_HISTORY COM_ATMOS_INPUT COM_ATMOS_MASTER COM_ATMOS_RESTART \
COM_ATMOS_TRACK COM_ATMOS_WMO \
COM_CHEM_HISTORY \
COM_ICE_HISTORY COM_ICE_INPUT \
COM_MED_RESTART \
COM_ICE_HISTORY COM_ICE_INPUT COM_ICE_RESTART \
COM_OBS COM_TOP \
COM_OCEAN_DAILY COM_OCEAN_HISTORY COM_OCEAN_INPUT COM_OCEAN_XSECT \
COM_OCEAN_DAILY COM_OCEAN_RESTART COM_OCEAN_HISTORY COM_OCEAN_INPUT COM_OCEAN_XSECT \
COM_WAVE_GRID COM_WAVE_HISTORY COM_WAVE_STATION

for grid in "0p25" "0p50" "1p00"; do
Expand Down
6 changes: 3 additions & 3 deletions jobs/JGLOBAL_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ fi

# Ignore possible spelling error (nothing is misspelled)
# shellcheck disable=SC2153
GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}")
declare -rx GDATE=$(date -d "${PDY} ${cyc} - ${assim_freq} hours" +%Y%m%d%H)
# shellcheck disable=
declare -x gPDY="${GDATE:0:8}"
declare -x gcyc="${GDATE:8:2}"
declare -rx gPDY="${GDATE:0:8}"
declare -rx gcyc="${GDATE:8:2}"

# Construct COM variables from templates (see config.com)
YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RESTART COM_ATMOS_INPUT COM_ATMOS_ANALYSIS \
Expand Down
49 changes: 15 additions & 34 deletions jobs/rocoto/coupled_ic.sh
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
#! /usr/bin/env bash

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

###############################################################
## Abstract:
## Copy initial conditions from BASE_CPLIC to ROTDIR for coupled forecast-only runs
## HOMEgfs : /full/path/to/workflow
## EXPDIR : /full/path/to/config/files
## CDUMP : cycle name (gdas / gfs)
## PDY : current date (YYYYMMDD)
## cyc : current cycle (HH)
###############################################################

###############################################################
# Source FV3GFS workflow modules
. ${HOMEgfs}/ush/load_fv3gfs_modules.sh
status=$?
[[ ${status} -ne 0 ]] && exit ${status}
err=0

###############################################################
# Source relevant configs
configs="base coupled_ic wave"
for config in ${configs}; do
. ${EXPDIR}/config.${config}
status=$?
[[ ${status} -ne 0 ]] && exit ${status}
done
export job="coupled_ic"
export jobid="${job}.$$"

###############################################################
# Source machine runtime environment
. ${BASE_ENV}/${machine}.env config.coupled_ic
status=$?
[[ ${status} -ne 0 ]] && exit ${status}
# Execute the JJOB

source "${HOMEgfs}/ush/jjob_header.sh" -e "coupled_ic" -c "base coupled_ic"

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

# Initialize return code
err=0

error_message(){
echo "FATAL ERROR: Unable to copy ${1} to ${2} (Error code ${3})"
}
Expand Down Expand Up @@ -78,10 +60,9 @@ if [[ "${DO_OCN:-}" = "YES" ]]; then
[[ ${rc} -ne 0 ]] && error_message "${source}" "${target}" "${rc}"
err=$((err + rc))
case "${OCNRES}" in
"500")
echo "Do not have Mom.res_*.nc files for 5 deg ocean"
;;
"025")
"500" | "100") # Only 5 degree or 1 degree ocean does not have MOM.res_[1-4].nc files
;;
"025") # Only 1/4 degree ocean has MOM.res_[1-4].nc files
for nn in $(seq 1 4); do
source="${BASE_CPLIC}/${CPL_OCNIC}/${PDY}${cyc}/ocn/${OCNRES}/MOM.res_${nn}.nc"
if [[ -f "${source}" ]]; then
Expand All @@ -101,9 +82,9 @@ if [[ "${DO_OCN:-}" = "YES" ]]; then
esac
fi

# Stage ice initial conditions to ROTDIR (cold start as these are SIS2 generated)
# Stage ice initial conditions to ROTDIR (warm start)
if [[ "${DO_ICE:-}" = "YES" ]]; then
YMD=${PDY} HH=${cyc} generate_com -r COM_ICE_RESTART
YMD=${gPDY} HH=${gcyc} generate_com -r COM_ICE_RESTART
[[ ! -d "${COM_ICE_RESTART}" ]] && mkdir -p "${COM_ICE_RESTART}"
ICERESdec=$(echo "${ICERES}" | awk '{printf "%0.2f", $1/100}')
source="${BASE_CPLIC}/${CPL_ICEIC}/${PDY}${cyc}/ice/${ICERES}/cice5_model_${ICERESdec}.res_${PDY}${cyc}.nc"
Expand Down Expand Up @@ -137,4 +118,4 @@ fi

##############################################################
# Exit cleanly
exit 0
exit "${err}"
2 changes: 1 addition & 1 deletion parm/config/gfs/config.base.emc.dyn
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ case "${CASE}" in
export waveGRD='glo_500'
;;
"C96")
export OCNRES=100
export OCNRES=500
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not support OCNRES=100 as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's supported, it's just not a default for any ATM resolution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thank you for the clarification @WalterKolczynski-NOAA.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to revisit this section in config.base as more combinations are possible, but the limitation here is the bash configuration.

export waveGRD='glo_200'
;;
"C192")
Expand Down
26 changes: 6 additions & 20 deletions parm/config/gfs/config.efcs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@

echo "BEGIN: config.efcs"

# TODO: the _ENKF counterparts need to be defined in config.base
export DO_AERO=${DO_AERO_ENKF:-"NO"}
export DO_OCN=${DO_OCN_ENKF:-"NO"}
export DO_ICE=${DO_ICE_ENKF:-"NO"}
export DO_WAVE=${DO_WAVE_ENKF:-"NO"}
# TODO: the _ENKF counterparts need to be defined in config.base; for now inherit from config.base
export DO_AERO=${DO_AERO_ENKF:-${DO_AERO:-"NO"}}
export DO_OCN=${DO_OCN_ENKF:-${DO_OCN:-"NO"}}
export DO_ICE=${DO_ICE_ENKF:-${DO_ICE:-"NO"}}
export DO_WAVE=${DO_WAVE_ENKF:-${DO_WAVE:-"NO"}}

# TODO: Possibly need OCNRES_ENKF, ICERES_ENKF, WAVRES_ENKF too
if [[ ${DO_OCN} == "YES" ]]; then
case "${CASE_ENS}" in
"C48") export OCNRES=500;;
"C96") export OCNRES=100;;
"C96") export OCNRES=500;;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set because the deterministic and the ensemble share the same ocean resolution, unlike the atmosphere where we have dual resolutions. I am sure we can support dual resolution ocean as well, but its not worth the hassle at this moment.

"C192") export OCNRES=050;;
"C384") export OCNRES=025;;
"C768") export OCNRES=025;;
Expand Down Expand Up @@ -81,18 +81,4 @@ else
export restart_interval="6"
fi

# wave model
export cplwav=.false.

# ocean model resolution
case "${CASE_ENS}" in
"C48") export OCNRES=500;;
"C96") export OCNRES=100;;
"C192") export OCNRES=050;;
"C384") export OCNRES=025;;
"C768") export OCNRES=025;;
*) export OCNRES=025;;
esac
export ICERES=${OCNRES}

echo "END: config.efcs"
108 changes: 42 additions & 66 deletions scripts/exgdas_enkf_fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,58 +18,34 @@
####
################################################################################

source "$HOMEgfs/ush/preamble.sh"

# Directories.
export FIX_DIR=${FIX_DIR:-$HOMEgfs/fix}
export FIX_AM=${FIX_AM:-$FIX_DIR/am}

# Utilities
export NCP=${NCP:-"/bin/cp -p"}
export NMV=${NMV:-"/bin/mv"}
export NLN=${NLN:-"/bin/ln -sf"}

# Scripts.
FORECASTSH=${FORECASTSH:-$HOMEgfs/scripts/exglobal_forecast.sh}
source "${HOMEgfs}/ush/preamble.sh"

# Enemble group, begin and end
ENSGRP=${ENSGRP:-1}
ENSBEG=${ENSBEG:-1}
ENSEND=${ENSEND:-1}

# Model builds
export FCSTEXECDIR=${FCSTEXECDIR:-$HOMEgfs/sorc/fv3gfs.fd/BUILD/bin}
export FCSTEXEC=${FCSTEXEC:-fv3gfs.x}

# Get DA specific diag table.
export PARM_FV3DIAG=${PARM_FV3DIAG:-$HOMEgfs/parm/parm_fv3diag}
export DIAG_TABLE=${DIAG_TABLE_ENKF:-${DIAG_TABLE:-$PARM_FV3DIAG/diag_table_da}}

# Re-run failed members, or entire group
RERUN_EFCSGRP=${RERUN_EFCSGRP:-"YES"}

# Recenter flag and increment file prefix
RECENTER_ENKF=${RECENTER_ENKF:-"YES"}
export PREFIX_ATMINC=${PREFIX_ATMINC:-""}

# Ops related stuff
SENDECF=${SENDECF:-"NO"}
SENDDBN=${SENDDBN:-"NO"}

################################################################################
# Preprocessing
cd $DATA || exit 99
DATATOP=$DATA
cd "${DATA}" || exit 99
DATATOP=${DATA}

################################################################################
# Set output data
EFCSGRP="${COM_TOP}/efcs.grp${ENSGRP}"
if [ -f $EFCSGRP ]; then
if [ $RERUN_EFCSGRP = "YES" ]; then
rm -f $EFCSGRP
if [[ -f ${EFCSGRP} ]]; then
if [[ ${RERUN_EFCSGRP} = "YES" ]]; then
rm -f "${EFCSGRP}"
else
echo "RERUN_EFCSGRP = $RERUN_EFCSGRP, will re-run FAILED members only!"
$NMV $EFCSGRP ${EFCSGRP}.fail
echo "RERUN_EFCSGRP = ${RERUN_EFCSGRP}, will re-run FAILED members only!"
${NMV} "${EFCSGRP}" "${EFCSGRP}".fail
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
fi
fi

Expand Down Expand Up @@ -119,7 +95,7 @@ export FHZER=${FHZER_ENKF:-${FHZER:-6}}
export FHCYC=${FHCYC_ENKF:-${FHCYC:-6}}

# Set PREFIX_ATMINC to r when recentering on
if [ $RECENTER_ENKF = "YES" ]; then
if [[ ${RECENTER_ENKF} = "YES" ]]; then
export PREFIX_ATMINC="r"
fi

Expand All @@ -132,21 +108,21 @@ declare -x gcyc="${GDATE:8:2}"
################################################################################
# Run forecast for ensemble member
rc=0
for imem in $(seq $ENSBEG $ENSEND); do
for imem in $(seq "${ENSBEG}" "${ENSEND}"); do

cd $DATATOP
cd "${DATATOP}"

cmem=$(printf %03i $imem)
cmem=$(printf %03i "${imem}")
memchar="mem${cmem}"

echo "Processing MEMBER: $cmem"
echo "Processing MEMBER: ${cmem}"

ra=0

skip_mem="NO"
if [ -f ${EFCSGRP}.fail ]; then
memstat=$(cat ${EFCSGRP}.fail | grep "MEMBER $cmem" | grep "PASS" | wc -l)
[[ $memstat -eq 1 ]] && skip_mem="YES"
if [[ -f ${EFCSGRP}.fail ]]; then
memstat=$(cat "${EFCSGRP}".fail | grep "MEMBER ${cmem}" | grep "PASS" | wc -l)
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
[[ ${memstat} -eq 1 ]] && skip_mem="YES"
fi

# Construct COM variables from templates (see config.com)
Expand Down Expand Up @@ -177,70 +153,70 @@ for imem in $(seq $ENSBEG $ENSEND); do
fi


if [ $skip_mem = "NO" ]; then
if [[ ${skip_mem} = "NO" ]]; then

ra=0

export MEMBER=$imem
export MEMBER=${imem}
export DATA="${DATATOP}/${memchar}"
if [ -d $DATA ]; then rm -rf $DATA; fi
mkdir -p $DATA
$FORECASTSH
if [[ -d ${DATA} ]]; then rm -rf "${DATA}"; fi
mkdir -p "${DATA}"
${FORECASTSH}
ra=$?

# Notify a member forecast failed and abort
if [ $ra -ne 0 ]; then
err_exit "FATAL ERROR: forecast of member $cmem FAILED. Aborting job"
if [[ ${ra} -ne 0 ]]; then
err_exit "FATAL ERROR: forecast of member ${cmem} FAILED. Aborting job"
fi

rc=$((rc+ra))

fi

if [ $SENDDBN = YES ]; then
fhr=$FHOUT
while [ $fhr -le $FHMAX ]; do
FH3=$(printf %03i $fhr)
if [ $(expr $fhr % 3) -eq 0 ]; then
if [[ ${SENDDBN} = YES ]]; then
fhr=${FHOUT}
while [[ ${fhr} -le ${FHMAX} ]]; do
FH3=$(printf %03i "${fhr}")
if [[ $(expr "${fhr}" % 3) -eq 0 ]]; then
aerorahul marked this conversation as resolved.
Show resolved Hide resolved
"${DBNROOT}/bin/dbn_alert" MODEL GFS_ENKF "${job}" "${COM_ATMOS_HISTORY}/${RUN}.t${cyc}z.sfcf${FH3}.nc"
fi
fhr=$((fhr+FHOUT))
done
fi

cd $DATATOP
cd "${DATATOP}"

if [ -s $EFCSGRP ]; then
$NCP $EFCSGRP log_old
if [[ -s ${EFCSGRP} ]]; then
${NCP} "${EFCSGRP}" log_old
fi
[[ -f log ]] && rm log
[[ -f log_new ]] && rm log_new
if [ $ra -ne 0 ]; then
echo "MEMBER $cmem : FAIL" > log
if [[ ${ra} -ne 0 ]]; then
echo "MEMBER ${cmem} : FAIL" > log
else
echo "MEMBER $cmem : PASS" > log
echo "MEMBER ${cmem} : PASS" > log
fi
if [ -s log_old ] ; then
if [[ -s log_old ]] ; then
cat log_old log > log_new
else
cat log > log_new
fi
$NCP log_new $EFCSGRP
${NCP} log_new "${EFCSGRP}"

done

################################################################################
# Echo status of ensemble group
cd $DATATOP
echo "Status of ensemble members in group $ENSGRP:"
cat $EFCSGRP
[[ -f ${EFCSGRP}.fail ]] && rm ${EFCSGRP}.fail
cd "${DATATOP}"
echo "Status of ensemble members in group ${ENSGRP}:"
cat "${EFCSGRP}"
[[ -f ${EFCSGRP}.fail ]] && rm "${EFCSGRP}".fail

################################################################################
# If any members failed, error out
export err=$rc; err_chk
export err=${rc}; err_chk

################################################################################
# Postprocessing

exit $err
exit "${err}"
Loading