Skip to content

Commit

Permalink
Fix wave restarts
Browse files Browse the repository at this point in the history
Fixes some issues that were preventing wave restarts from operating
correctly.

First, the wave restart files were not being correctly linked from
`$DATA` to `$DATArestart`. The files are placed in the root of
`$DATA` instead of in `${DATA}/WAVE_RESTART`, so now links for the
individual files are created.

Second, the incorrect filenames were being searches for and copied
as part of a rerun. Filenames were geared towards multigrid waves,
which use the grid names, but single grid just uses a `ww3`. Since
multigrid waves are deprecated in workflow and will soon be removed
(#2637), these were updated only supporting the single-grid option.

These fixes allow forecast segments (and emergency restarts) to
work correctly when waves are on.

Resolves #3001
  • Loading branch information
WalterKolczynski-NOAA committed Oct 16, 2024
1 parent 77edb05 commit 1314581
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
9 changes: 3 additions & 6 deletions ush/forecast_det.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,9 @@ UFS_det(){

# Check for WW3 restart availability
if [[ "${cplwav}" == ".true." ]]; then
local ww3_grid
for ww3_grid in ${waveGRD} ; do
if [[ ! -f "${DATArestart}/WW3_RESTART/${rdate:0:8}.${rdate:8:2}0000.restart.${ww3_grid}" ]]; then
ww3_rst_ok="NO"
fi
done
if [[ ! -f "${DATArestart}/WW3_RESTART/${rdate:0:8}.${rdate:8:2}0000.restart.ww3" ]]; then
ww3_rst_ok="NO"
fi
fi

# Collective check
Expand Down
11 changes: 10 additions & 1 deletion ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ WW3_postdet() {
echo "Copying WW3 restarts for 'RUN=${RUN}' at '${restart_date}' from '${restart_dir}'"
local ww3_restart_file
for ww3_grid in ${waveGRD} ; do
ww3_restart_file="${restart_dir}/${restart_date:0:8}.${restart_date:8:2}0000.restart.${ww3_grid}"
ww3_restart_file="${restart_dir}/${restart_date:0:8}.${restart_date:8:2}0000.restart.ww3"
if [[ ! -f "${ww3_restart_file}" ]]; then
echo "WARNING: WW3 restart file '${ww3_restart_file}' not found for warm_start='${warm_start}', will start from rest!"
if [[ "${RERUN}" == "YES" ]]; then
Expand All @@ -361,6 +361,15 @@ WW3_postdet() {
echo "WW3 will start from rest!"
fi # [[ "${warm_start}" == ".true." ]]

# Link restart files
local restart_file
# Use restart_date if it was determined above, otherwise use initialization date
for (( vdate = "${restart_date:-${PDY}${cyc}}"; vdate <= forecast_end_cycle;
vdate = $(date --utc -d "${vdate:0:8} ${vdate:8:2} + ${restart_interval} hours" +%Y%m%d%H) )); do
restart_file="${vdate:0:8}.${vdate:8:2}0000.restart.ww3"
${NLN} "${DATArestart}/WW3_RESTART/${restart_file}" "${restart_file}"
done

# Link output files
local wavprfx="${RUN}wave${WAV_MEMBER:-}"
if [[ "${waveMULTIGRID}" == ".true." ]]; then
Expand Down
6 changes: 3 additions & 3 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ WW3_predet(){
echo "SUB ${FUNCNAME[0]}: WW3 before run type determination"

if [[ ! -d "${COMOUT_WAVE_HISTORY}" ]]; then mkdir -p "${COMOUT_WAVE_HISTORY}"; fi
if [[ ! -d "${COMOUT_WAVE_RESTART}" ]]; then mkdir -p "${COMOUT_WAVE_RESTART}" ; fi
if [[ ! -d "${COMOUT_WAVE_RESTART}" ]]; then mkdir -p "${COMOUT_WAVE_RESTART}"; fi

if [[ ! -d "${DATArestart}/WAVE_RESTART" ]]; then mkdir -p "${DATArestart}/WAVE_RESTART"; fi
${NLN} "${DATArestart}/WAVE_RESTART" "${DATA}/restart_wave"
if [[ ! -d "${DATArestart}/WW3_RESTART" ]]; then mkdir -p "${DATArestart}/WW3_RESTART"; fi
# Wave restarts are linked in postdet to only create links for files that will be created

# Files from wave prep and wave init jobs
# Copy mod_def files for wave grids
Expand Down

0 comments on commit 1314581

Please sign in to comment.