diff --git a/ush/forecast_postdet.sh b/ush/forecast_postdet.sh index 1c0c50de206..fd1ef9a078d 100755 --- a/ush/forecast_postdet.sh +++ b/ush/forecast_postdet.sh @@ -89,15 +89,20 @@ FV3_postdet() { fi done - # Need a coupler.res when doing IAU + # Need a coupler.res that is consistent with the model start time if [[ "${DOIAU}" == "YES" ]]; then - rm -f "${DATA}/INPUT/coupler.res" - cat >> "${DATA}/INPUT/coupler.res" << EOF - 3 (Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4) - ${previous_cycle:0:4} ${previous_cycle:4:2} ${previous_cycle:6:2} ${previous_cycle:8:2} 0 0 Model start time: year, month, day, hour, minute, second - ${current_cycle_begin:0:4} ${current_cycle_begin:4:2} ${current_cycle_begin:6:2} ${current_cycle_begin:8:2} 0 0 Current model time: year, month, day, hour, minute, second -EOF + local model_start_time="${previous_cycle}" + local model_current_time="${current_cycle_begin}" + else + local model_start_time="${current_cycle}" + local model_current_time="${current_cycle}" fi + rm -f "${DATA}/INPUT/coupler.res" + cat >> "${DATA}/INPUT/coupler.res" << EOF + 3 (Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4) + ${model_start_time:0:4} ${model_start_time:4:2} ${model_start_time:6:2} ${model_start_time:8:2} 0 0 Model start time: year, month, day, hour, minute, second + ${model_current_time:0:4} ${model_current_time:4:2} ${model_current_time:6:2} ${model_current_time:8:2} 0 0 Current model time: year, month, day, hour, minute, second +EOF # Create a array of increment files local inc_files inc_file iaufhrs iaufhr 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}