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

Fix wave restart for cold start and add ic version file #3112

Merged
Show file tree
Hide file tree
Changes from 6 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
10 changes: 6 additions & 4 deletions parm/config/gefs/config.stage_ic
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ export BASE_IC="@BASE_IC@" # Platform home for staged ICs

export STAGE_IC_YAML_TMPL="${PARMgfs}/stage/master_gefs.yaml.j2"

# Set ICSDIR
source "${HOMEgfs}/versions/ic.ver"

# Set ICSDIR (if not defined)
if [[ -z "${ICSDIR}" ]] ; then

ic_ver="20240610"

if (( NMEM_ENS > 0 )) ; then
ensic="${CASE_ENS}"
fi
Expand All @@ -26,7 +25,10 @@ if [[ -z "${ICSDIR}" ]] ; then
ocnic="mx${OCNRES}"
fi

export ICSDIR="${BASE_IC}/${CASE}${ensic:-}${ocnic:-}/${ic_ver}"
dir_name="${CASE}${ensic:-}${ocnic:-}"
ic_ver="${ic_versions[${dir_name}]}"

export ICSDIR="${BASE_IC}/${dir_name}/${ic_ver}"

fi

Expand Down
9 changes: 6 additions & 3 deletions parm/config/gfs/config.stage_ic
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export BASE_IC="@BASE_IC@" # Platform home for staged ICs

export STAGE_IC_YAML_TMPL="${PARMgfs}/stage/master_gfs.yaml.j2"

source "${HOMEgfs}/versions/ic.ver"

# Set ICSDIR (if not defined)
if [[ -z "${ICSDIR}" ]] ; then

ic_ver="20240610"

if (( NMEM_ENS > 0 )) ; then
ensic="${CASE_ENS}"
fi
Expand All @@ -25,7 +25,10 @@ if [[ -z "${ICSDIR}" ]] ; then
ocnic="mx${OCNRES}"
fi

export ICSDIR="${BASE_IC}/${CASE}${ensic:-}${ocnic:-}/${ic_ver}"
dir_name="${CASE}${ensic:-}${ocnic:-}"
ic_ver="${ic_versions[${dir_name}]}"

export ICSDIR="${BASE_IC}/${dir_name}/${ic_ver}"

fi

Expand Down
7 changes: 1 addition & 6 deletions parm/stage/master_gfs.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@
'${YMD}':previous_cycle_YMD,
'${HH}':previous_cycle_HH,
'${MEMDIR}': mem_char }) %}
{% set previous_cycle_and_run_dict = ({ '${ROTDIR}':ROTDIR,
'${RUN}':RUN,
'${YMD}':previous_cycle_YMD,
'${HH}':previous_cycle_HH,
'${MEMDIR}': mem_char }) %}

{% set COMOUT_ATMOS_INPUT_MEM = COM_ATMOS_INPUT_TMPL | replace_tmpl(current_cycle_dict) %}
{% set COMOUT_ATMOS_RESTART_PREV_MEM = COM_ATMOS_RESTART_TMPL | replace_tmpl(previous_cycle_dict) %}
Expand All @@ -108,7 +103,7 @@
{% set COMOUT_OCEAN_RESTART_PREV_MEM = COM_OCEAN_RESTART_TMPL | replace_tmpl(previous_cycle_dict) %}
{% set COMOUT_OCEAN_ANALYSIS_MEM = COM_OCEAN_ANALYSIS_TMPL | replace_tmpl(current_cycle_dict) %}
{% set COMOUT_MED_RESTART_PREV_MEM = COM_MED_RESTART_TMPL | replace_tmpl(previous_cycle_dict) %}
{% set COMOUT_WAVE_RESTART_PREV_MEM = COM_WAVE_RESTART_TMPL | replace_tmpl(previous_cycle_and_run_dict) %}
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved Hide resolved
{% set COMOUT_WAVE_RESTART_PREV_MEM = COM_WAVE_RESTART_TMPL | replace_tmpl(previous_cycle_dict) %}

# Append the member COM directories
{% do COMOUT_ATMOS_INPUT_MEM_list.append(COMOUT_ATMOS_INPUT_MEM)%}
Expand Down
50 changes: 22 additions & 28 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,39 +328,33 @@ WW3_postdet() {

local ww3_grid first_ww3_restart_out ww3_restart_file
# Copy initial condition files:
if [[ "${warm_start}" == ".true." ]]; then
local restart_date restart_dir
if [[ "${RERUN}" == "YES" ]]; then
restart_date="${RERUN_DATE}"
restart_dir="${DATArestart}/WW3_RESTART"
else
restart_date="${model_start_date_current_cycle}"
restart_dir="${COMIN_WAVE_RESTART_PREV}"
fi
echo "Copying WW3 restarts for 'RUN=${RUN}' at '${restart_date}' from '${restart_dir}'"
ww3_restart_file="${restart_dir}/${restart_date:0:8}.${restart_date:8:2}0000.restart.ww3"
if [[ -f "${ww3_restart_file}" ]]; then
${NCP} "${ww3_restart_file}" "${DATA}/restart.ww3" \
local restart_date restart_dir
if [[ "${RERUN}" == "YES" ]]; then
restart_date="${RERUN_DATE}"
restart_dir="${DATArestart}/WW3_RESTART"
else
restart_date="${model_start_date_current_cycle}"
restart_dir="${COMIN_WAVE_RESTART_PREV}"
fi

echo "Copying WW3 restarts for 'RUN=${RUN}' at '${restart_date}' from '${restart_dir}'"
ww3_restart_file="${restart_dir}/${restart_date:0:8}.${restart_date:8:2}0000.restart.ww3"
if [[ -s "${ww3_restart_file}" ]]; then
${NCP} "${ww3_restart_file}" "${DATA}/restart.ww3" \
|| ( echo "FATAL ERROR: Unable to copy WW3 IC, ABORT!"; exit 1 )
first_ww3_restart_out=$(date --utc -d "${restart_date:0:8} ${restart_date:8:2} + ${restart_interval} hours" +%Y%m%d%H)
else
if [[ "${RERUN}" == "YES" ]]; then
# In the case of a RERUN, the WW3 restart file is required
echo "FATAL ERROR: WW3 restart file '${ww3_restart_file}' not found for RERUN='${RERUN}', ABORT!"
exit 1
else
if [[ "${RERUN}" == "YES" ]]; then
# In the case of a RERUN, the WW3 restart file is required
echo "FATAL ERROR: WW3 restart file '${ww3_restart_file}' not found for RERUN='${RERUN}', ABORT!"
exit 1
else
echo "WARNING: WW3 restart file '${ww3_restart_file}' not found for warm_start='${warm_start}', will start from rest!"
fi
echo "WARNING: WW3 restart file '${ww3_restart_file}' not found for warm_start='${warm_start}', will start from rest!"
first_ww3_restart_out=${model_start_date_current_cycle}
fi

first_ww3_restart_out=$(date --utc -d "${restart_date:0:8} ${restart_date:8:2} + ${restart_interval} hours" +%Y%m%d%H)
else # cold start
echo "WW3 will start from rest!"
first_ww3_restart_out="${model_start_date_current_cycle}"
fi # [[ "${warm_start}" == ".true." ]]
fi

# Link restart files
local ww3_restart_file
# Use restart_date if it was determined above, otherwise use initialization date
for (( vdate = first_ww3_restart_out; vdate <= forecast_end_cycle;
vdate = $(date --utc -d "${vdate:0:8} ${vdate:8:2} + ${restart_interval} hours" +%Y%m%d%H) )); do
ww3_restart_file="${vdate:0:8}.${vdate:8:2}0000.restart.ww3"
Expand Down
22 changes: 22 additions & 0 deletions versions/ic.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Initial condition subfolder versions

#shellcheck disable=SC2034
declare -A ic_versions

ic_versions['C48']=20241120
ic_versions['C48mx500']=20241120
WalterKolczynski-NOAA marked this conversation as resolved.
Show resolved Hide resolved
ic_versions['C48C48mx500']=20241120

ic_versions['C96']=20241120
ic_versions['C96C48']=20241120
ic_versions['C96mx100']=20240610

ic_versions['C384C192']=20240610
ic_versions['C384mx025']=20241120

ic_versions['C768']=20241120
ic_versions['C768mx025']=20241120

ic_versions['C1152']=20241120
ic_versions['C1152mx025']=20241120
Loading