Skip to content

Commit

Permalink
modified: jobs/JGLOBAL_FORECAST parm/config/config.wave scripts/exglo…
Browse files Browse the repository at this point in the history
…bal_fcst_nemsfv3gfs.sh

    add WW3 break-point restart capability and clean up forecast script.
  • Loading branch information
yangfanglin committed Jul 4, 2020
1 parent 28b1faf commit 5fe1a21
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 39 deletions.
8 changes: 0 additions & 8 deletions jobs/JGLOBAL_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,6 @@ if [ $RUN_ENVIR = "nco" ]; then
export RSTDIR=${GESROOT:?}/$envir
fi

# Source additional configs
if [ ${DO_WAVE:-"NO"} = "YES" ]; then
# WAVE component directory
export WAV_MOD_ID=${WAV_MOD_ID:-wave}
export COMINWW3=${COMINWW3:-${ROTDIR:?}}
export COMOUTWW3=${COMOUTWW3:-${ROTDIR:?}}
fi

##############################################
# Begin JOB SPECIFIC work
##############################################
Expand Down
12 changes: 4 additions & 8 deletions parm/config/config.wave
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,10 @@ export wavepostGRD='gnh_10m aoc_9km gsh_15m' # Native grids that will be post-pr
export CDATE=${PDY}${cyc}

# The start time reflects the number of hindcast hours prior to the cycle initial time
if [ "$CDUMP" = "gdas" ]
then
if [ "$CDUMP" = "gdas" ]; then
export FHMAX_WAV=${FHMAX:-9}
else
FHMAX_GFS="FHMAX_GFS_${cyc}"
export FHMAX_WAV=${!FHMAX_GFS}
export FHMAX_WAV=$FHMAX_GFS
fi
export WAVHINDH=${WAVHINDH:-0}
export FHMIN_WAV=${FHMIN_WAV:-0}
Expand All @@ -72,13 +70,11 @@ export FHINCP_WAV=`expr $DTPNT_WAV / 3600`
export OUTPARS_WAV="WND CUR ICE HS T01 T02 DIR FP DP PHS PTP PDIR CHA"

# Restart file config
if [ "$CDUMP" = "gdas" ]
then
if [ "$CDUMP" = "gdas" ]; then
WAVNCYC=4
WAVHCYC=6
FHMAX_WAV_CUR=${FHMAX_WAV_CUR:-48} # RTOFS forecasts only out to 8 days
elif [ ${gfs_cyc} -ne 0 ]
then
elif [ ${gfs_cyc} -ne 0 ]; then
FHMAX_WAV_CUR=${FHMAX_WAV_CUR:-192} # RTOFS forecasts only out to 8 days
WAVHCYC=`expr 24 / ${gfs_cyc}`
else
Expand Down
62 changes: 39 additions & 23 deletions scripts/exglobal_fcst_nemsfv3gfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ if [ $CDUMP = "gfs" -a $rst_invt1 -gt 0 ]; then
RSTDIR_TMP=${RSTDIR:-$ROTDIR}/${CDUMP}.${PDY}/${cyc}/RERUN_RESTART
if [ ! -d $RSTDIR_TMP ]; then mkdir -p $RSTDIR_TMP ; fi
$NLN $RSTDIR_TMP RESTART
if [ $cplwav = ".true." ]; then
RSTDIR_WAVE=${RSTDIR:-$ROTDIR}/${CDUMP}wave.${PDY}/${cyc}/RERUN_RESTART
if [ ! -d $RSTDIR_WAVE ]; then mkdir -p $RSTDIR_WAVE ; fi
$NLN $RSTDIR_WAVE restart_wave
fi
else
mkdir -p $DATA/RESTART
fi
Expand Down Expand Up @@ -317,6 +322,8 @@ EOF
$NLN $file $DATA/INPUT/$file2
done

hour_rst=`$NHOUR $CDATE_RST $CDATE`
IAU_FHROT=$((IAU_OFFSET+hour_rst))
if [ $DOIAU = "YES" ]; then
IAUFHRS=-1
IAU_DELTHRS=0
Expand Down Expand Up @@ -395,57 +402,61 @@ if [ $IAER -gt 0 ] ; then
done
fi

#### Copy over WW3 inputs
#-------------wavewave----------------------
if [ $cplwav = ".true." ]; then
# Link WW3 files
for file in $(ls $COMINWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/rmp_src_to_dst_conserv_*) ; do
#-------------wavewave----------------------

for file in $(ls $ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/rmp_src_to_dst_conserv_*) ; do
$NLN $file $DATA/
done
$NLN $COMINWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/ww3_multi.${COMPONENTwave}${WAV_MEMBER}.${cycle}.inp $DATA/ww3_multi.inp
# Check for expected wave grids for this run
$NLN $ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/ww3_multi.${CDUMP}wave${WAV_MEMBER}.${cycle}.inp $DATA/ww3_multi.inp

array=($WAVECUR_FID $WAVEICE_FID $WAVEWND_FID $waveuoutpGRD $waveGRD $waveesmfGRD $wavesbsGRD $wavepostGRD $waveinterpGRD)
grdALL=`printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' '`
for wavGRD in ${grdALL}; do
# Wave IC (restart) file must exist for warm start on this cycle, if not wave model starts from flat ocean
# For IAU needs to use sPDY for adding IAU backup of 3h
$NLN $COMINWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/${COMPONENTwave}.mod_def.$wavGRD $DATA/mod_def.$wavGRD
$NLN $ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/${CDUMP}wave.mod_def.$wavGRD $DATA/mod_def.$wavGRD
done
# Wave IC (restart) interval assumes 4 daily cycles (restarts only written by gdas cycle)
# WAVHCYC needs to be consistent with restart write interval in ww3_multi.inp or will FAIL

WAVHCYC=${WAVHCYC:-6}
WRDATE=`$NDATE -${WAVHCYC} $CDATE`
WRPDY=`echo $WRDATE | cut -c1-8`
WRcyc=`echo $WRDATE | cut -c9-10`
WRDIR=$COMINWW3/${COMPONENTRSTwave}.${WRPDY}/${WRcyc}/restart
datwave=$COMOUTWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/
wavprfx=${COMPONENTwave}${WAV_MEMBER}
WRDIR=$ROTDIR/gdaswave.${WRPDY}/${WRcyc}/restart
datwave=$ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/
wavprfx=${CDUMP}wave${WAV_MEMBER}

for wavGRD in $waveGRD ; do
# Link wave IC for current cycle
$NLN ${WRDIR}/${sPDY}.${scyc}0000.restart.${wavGRD} $DATA/restart.${wavGRD}
if [ $RERUN = "NO" ]; then
$NLN ${WRDIR}/${sPDY}.${scyc}0000.restart.${wavGRD} $DATA/restart.${wavGRD}
else
$NLN ${RSTDIR_WAVE}/${PDYT}.${cyct}0000.restart.${wavGRD} $DATA/restart.${wavGRD}
fi
eval $NLN $datwave/${wavprfx}.log.${wavGRD}.${PDY}${cyc} log.${wavGRD}
done

if [ "$WW3ICEINP" = "YES" ]; then
wavicefile=$COMINWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/${COMPONENTwave}.${WAVEICE_FID}.${cycle}.ice
wavicefile=$ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/${CDUMP}wave.${WAVEICE_FID}.${cycle}.ice
if [ ! -f $wavicefile ]; then
echo "ERROR: WW3ICEINP = ${WW3ICEINP}, but missing ice file"
echo "Abort!"
exit 1
fi
$NLN ${wavicefile} $DATA/ice.${WAVEICE_FID}
fi

if [ "$WW3CURINP" = "YES" ]; then
wavcurfile=$COMINWW3/${COMPONENTwave}.${PDY}/${cyc}/rundata/${COMPONENTwave}.${WAVECUR_FID}.${cycle}.cur
wavcurfile=$ROTDIR/${CDUMP}wave.${PDY}/${cyc}/rundata/${CDUMP}wave.${WAVECUR_FID}.${cycle}.cur
if [ ! -f $wavcurfile ]; then
echo "ERROR: WW3CURINP = ${WW3CURINP}, but missing current file"
echo "Abort!"
exit 1
fi
$NLN $wavcurfile $DATA/current.${WAVECUR_FID}
fi
# Link output files

# Link output files
cd $DATA
eval $NLN $datwave/${wavprfx}.log.mww3.${PDY}${cyc} log.mww3
# Loop for gridded output (uses FHINC)
fhr=$FHMIN_WAV
while [ $fhr -le $FHMAX_WAV ]; do
YMDH=`$NDATE $fhr $CDATE`
Expand All @@ -460,7 +471,8 @@ if [ $cplwav = ".true." ]; then
fi
fhr=$((fhr+FHINC))
done
# Loop for point output (uses DTPNT)

# Loop for point output (uses DTPNT)
fhr=$FHMIN_WAV
while [ $fhr -le $FHMAX_WAV ]; do
YMDH=`$NDATE $fhr $CDATE`
Expand All @@ -470,7 +482,11 @@ if [ $cplwav = ".true." ]; then
FHINC=$FHINCP_WAV
fhr=$((fhr+FHINC))
done

#-------------wavewave----------------------
fi
#-------------wavewave----------------------


# inline post fix files
if [ $WRITE_DOPOST = ".true." ]; then
Expand Down Expand Up @@ -1303,8 +1319,9 @@ if [ $SEND = "YES" ]; then
for file in $(ls ${rPDY}.${rcyc}0000.*) ; do
$NCP $file $memdir/RESTART/$file
done

if [ $cplwav = ".true." ]; then
WRDIR=$COMOUTWW3/${COMPONENTRSTwave}.${PDY}/${cyc}/restart
WRDIR=$ROTDIR/gdaswave.${PDY}/${cyc}/restart
mkdir -p ${WRDIR}
for wavGRD in $waveGRD ; do
# Copy wave IC for the next cycle
Expand All @@ -1326,10 +1343,9 @@ if [ $SEND = "YES" ]; then
$NCP $file $memdir/RESTART/$file
done
if [ $cplwav = ".true." ]; then
WRDIR=$COMOUTWW3/${COMPONENTRSTwave}.${PDY}/${cyc}/restart/
WRDIR=$ROTDIR/gdaswave.${PDY}/${cyc}/restart/
mkdir -p ${WRDIR}
for wavGRD in $waveGRD ; do
# Copy wave IC for the next cycle
$NCP $DATA/${rPDY}.${rcyc}0000.restart.${wavGRD} ${WRDIR}
done
fi
Expand Down

0 comments on commit 5fe1a21

Please sign in to comment.