diff --git a/jobs/JGLOBAL_FORECAST b/jobs/JGLOBAL_FORECAST index 989f69756d9..6c4200dd6e3 100755 --- a/jobs/JGLOBAL_FORECAST +++ b/jobs/JGLOBAL_FORECAST @@ -51,7 +51,8 @@ if [[ "${DO_OCN}" == "YES" ]]; then YMD="${PDY}" HH="${cyc}" declare_from_tmpl -rx COM_MED_RESTART COM_OCEAN_RESTART COM_OCEAN_INPUT \ COM_OCEAN_HISTORY COM_OCEAN_ANALYSIS RUN="${rCDUMP}" YMD="${gPDY}" HH="${gcyc}" declare_from_tmpl -rx \ - COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL + COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL \ + COM_MED_RESTART_PREV:COM_MED_RESTART_TMPL fi if [[ "${DO_ICE}" == "YES" ]]; then diff --git a/parm/config/gfs/config.base b/parm/config/gfs/config.base index 5a58c75220e..24fae5d0a2c 100644 --- a/parm/config/gfs/config.base +++ b/parm/config/gfs/config.base @@ -302,6 +302,7 @@ export WRITE_NSFLIP=".true." # IAU related parameters export DOIAU="@DOIAU@" # Enable 4DIAU for control with 3 increments +if [[ "${MODE}" == "cycled" && "${SDATE}" == "${PDY}${cyc}" && ${EXP_WARM_START} == ".true." ]]; then export DOIAU="NO"; fi export IAUFHRS="3,6,9" export IAU_FHROT=${IAUFHRS%%,*} export IAU_DELTHRS=6 diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 1c0c50de206..57306ad9693 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -224,29 +224,28 @@ FV3_out() { done done - # Copy restarts in the assimilation window for RUN=gdas|enkfgdas|enkfgfs - if [[ "${RUN}" =~ "gdas" || "${RUN}" == "enkfgfs" ]]; then - local restart_date - restart_date=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${restart_interval} hours" +%Y%m%d%H) - while (( restart_date < forecast_end_cycle )); do - echo "Copying FV3 restarts for 'RUN=${RUN}' at ${restart_date}" - for fv3_restart_file in "${fv3_restart_files[@]}"; do - restart_file="${restart_date:0:8}.${restart_date:8:2}0000.${fv3_restart_file}" - ${NCP} "${DATArestart}/FV3_RESTART/${restart_file}" \ - "${COM_ATMOS_RESTART}/${restart_file}" - done - restart_date=$(date --utc -d "${restart_date:0:8} ${restart_date:8:2} + ${restart_interval} hours" +%Y%m%d%H) + # Create an array of restart dates that need to be copied back to COM based on RUN + local rdate restart_dates + if [[ "${RUN}" == "gfs" || "${RUN}" == "gefs" ]]; then # Copy last restart files for RUN=gfs|gefs to COM + rdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${FHMAX} hours" +%Y%m%d.%H0000) + restart_dates=("${rdate}") + else # Copy restart files for RUN=gdas|enkfgdas|enkfgfs to COM + local restart_hour + restart_dates=() + for restart_hour in "${FV3_RESTART_FH[@]}"; do + rdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${restart_hour} hours" +%Y%m%d.%H0000) + restart_dates+=("${rdate}") done fi - # Copy the final restart files at the end of the forecast segment - # The final restart written at the end of the forecast does not include the valid date - # TODO: verify the above statement since RM found that it did! - echo "Copying FV3 restarts for 'RUN=${RUN}' at the end of the forecast segment: ${forecast_end_cycle}" - for fv3_restart_file in "${fv3_restart_files[@]}"; do - restart_file="${forecast_end_cycle:0:8}.${forecast_end_cycle:8:2}0000.${fv3_restart_file}" - ${NCP} "${DATArestart}/FV3_RESTART/${restart_file}" \ - "${COM_ATMOS_RESTART}/${restart_file}" + # Copy restart files for the dates from above to COM + local restart_date + for restart_date in "${restart_dates[@]}"; do + echo "Copying FV3 restarts for 'RUN=${RUN}' at ${restart_date}" + for fv3_restart_file in "${fv3_restart_files[@]}"; do + ${NCP} "${DATArestart}/FV3_RESTART/${restart_date}.${fv3_restart_file}" \ + "${COM_ATMOS_RESTART}/${restart_date}.${fv3_restart_file}" + done done echo "SUB ${FUNCNAME[0]}: Output data for FV3 copied" diff --git a/ush/forecast_predet.sh b/ush/forecast_predet.sh index 6605a9fa95e..a5944d5bd2e 100755 --- a/ush/forecast_predet.sh +++ b/ush/forecast_predet.sh @@ -86,8 +86,18 @@ FV3_predet(){ FHCYC=${FHCYC:-24} restart_interval=${restart_interval:-${FHMAX}} # restart_interval = 0 implies write restart at the END of the forecast i.e. at FHMAX + # Convert restart interval into an explicit list for FV3 if (( restart_interval == 0 )); then restart_interval=${FHMAX} + FV3_RESTART_FH=("${restart_interval}") + else + # shellcheck disable=SC2312 + mapfile -t FV3_RESTART_FH < <(seq "${restart_interval}" "${restart_interval}" "${FHMAX}") + # If the last forecast hour is not in the array, add it + local nrestarts=${#FV3_RESTART_FH[@]} + if (( FV3_RESTART_FH[nrestarts-1] != FHMAX )); then + FV3_RESTART_FH+=("${FHMAX}") + fi fi # Convert output settings into an explicit list for FV3 diff --git a/ush/parsing_model_configure_FV3.sh b/ush/parsing_model_configure_FV3.sh index 62d023a369a..59d9fb6910d 100755 --- a/ush/parsing_model_configure_FV3.sh +++ b/ush/parsing_model_configure_FV3.sh @@ -24,7 +24,7 @@ local SHOUR=${model_start_date:8:2} # FHMAX local FHROT=${IAU_FHROT:-0} local DT_ATMOS=${DELTIM} -local RESTART_INTERVAL="${restart_interval} -1" +local RESTART_INTERVAL="${FV3_RESTART_FH[*]}" # QUILTING local QUILTING_RESTART=".true." local WRITE_GROUP=${WRITE_GROUP:-1}