Skip to content

Commit

Permalink
Improve the script to run fcst for GEFS
Browse files Browse the repository at this point in the history
 On branch feature/gefs_v13_822_add_atm_fcst
	modified:   jobs/JGLOBAL_FORECAST
	modified:   jobs/rocoto/fcst.sh
	modified:   parm/config/config.fcst
	modified:   ush/forecast_postdet.sh
	modified:   ush/forecast_predet.sh

Refs: NOAA-EMC#822
  • Loading branch information
XianwuXue-NOAA committed Jul 21, 2022
1 parent 01f344b commit 9865bf9
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jobs/JGLOBAL_FORECAST
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ rCDUMP=$CDUMP
[[ $CDUMP = "gfs" ]] && export rCDUMP="gdas"

# Forecast length for GFS forecast
if [ $CDUMP = "gfs" ]; then
if [ $CDUMP = "gfs" ] || [ $CDUMP = "gefs" ]; then
export FHMAX=$FHMAX_GFS
export FHOUT=$FHOUT_GFS
export FHMAX_HF=$FHMAX_HF_GFS
Expand Down
3 changes: 3 additions & 0 deletions jobs/rocoto/fcst.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ status=$?
[[ $status -ne 0 ]] && exit $status
if [[ $CDUMP == "gefs" ]]; then
export MEMBER=`echo ${RUNMEM:-"c00"}|cut -c2-3`
if [[ $RUNMEM != "c00" ]]; then
export PREFIX_ATMINC="r"
fi
fi
###############################################################
# Execute the JJOB
Expand Down
79 changes: 79 additions & 0 deletions parm/config/config.fcst
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,85 @@ elif [[ "$CDUMP" == "gfs" ]] ; then # GFS cycle specific parameters
export io_layout="1,1"
fi

elif [[ "$CDUMP" == "gefs" ]] ; then # GEFS cycle specific parameters

if [[ $RUNMEM == "c00" ]]; then
# Write more variables to output
if [ $QUILTING = ".true." -a $OUTPUT_GRID = "gaussian_grid" ]; then
export DIAG_TABLE="$HOMEgfs/parm/parm_fv3diag/diag_table"
else
export DIAG_TABLE="$HOMEgfs/parm/parm_fv3diag/diag_table_orig"
fi

# Write gfs restart files to rerun fcst from any break point
export restart_interval_gfs=${restart_interval_gfs:-0}
if [ $restart_interval_gfs -le 0 ]; then
export restart_interval="$FHMAX_GFS"
else
rst_list=""
IAU_OFFSET=${IAU_OFFSET:-0}
[[ $DOIAU = "NO" ]] && export IAU_OFFSET=0
xfh=$((restart_interval_gfs+(IAU_OFFSET/2)))
while [ $xfh -le $FHMAX_GFS ]; do
rst_list="$rst_list $xfh"
xfh=$((xfh+restart_interval_gfs))
done
export restart_interval="$rst_list"
fi

if [ $DO_AERO = "YES" ]; then
# Make sure a restart file is written at the cadence time
if [[ ! "${restart_interval[*]}" =~ "$STEP_GFS" ]]; then
export restart_interval="$STEP_GFS $restart_interval"
fi
fi

# Choose coupling with wave
if [ $DO_WAVE = "YES" -a "$WAVE_CDUMP" != "gdas" ]; then
export cplwav=".true."
fi

# Turn off dry mass adjustment in GFS
export adjust_dry_mass=".false."

# Write each restart file in 16 small files to save time
if [ $CASE = C768 ]; then
export io_layout="4,4"
else
export io_layout="1,1"
fi

else
# Variables used in DA cycling
if [ $QUILTING = ".true." -a $OUTPUT_GRID = "gaussian_grid" ]; then
export DIAG_TABLE="$HOMEgfs/parm/parm_fv3diag/diag_table_da"
else
export DIAG_TABLE="$HOMEgfs/parm/parm_fv3diag/diag_table_da_orig"
fi

# Write restart files, where $number is current model start time.
# restart_interval: $number
# number=0, writes out restart files at the end of forecast.
# number>0, writes out restart files at the frequency of $number and at the end of forecast.
# restart_interval: "$number -1"
# writes out restart files only once at $number forecast hour.
# restart_interval: "$number1 $number2 $number3 ..."
# writes out restart file at the specified forecast hours
export restart_interval=${restart_interval:-6}

# For IAU, write restarts at beginning of window also
if [ $DOIAU = "YES" ]; then
export restart_interval="3 6"
fi

# Choose coupling with wave
if [ $DO_WAVE = "YES" ]; then export cplwav=".true." ; fi

# Turn on dry mass adjustment in GDAS
export adjust_dry_mass=".true."

fi

fi

if [[ $DO_COUPLED = "YES" ]] ; then # coupled model
Expand Down
2 changes: 2 additions & 0 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ data_out_GFS() {
fi
elif [ $CDUMP = "gfs" ]; then
$NCP $DATA/input.nml $ROTDIR/${CDUMP}.${PDY}/${cyc}/atmos/
elif [ $CDUMP = "gefs" ]; then
$NCP $DATA/input.nml $ROTDIR/${CDUMP}.${PDY}/${cyc}/$RUNMEM/atmos/
fi
fi

Expand Down
29 changes: 28 additions & 1 deletion ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ FV3_GFS_predet(){
if [ $MEMBER -lt 0 ]; then
NTASKS_TOT=${NTASKS_TOT:-$npe_fcst_gfs}
else
NTASKS_TOT=${NTASKS_TOT:-$npe_efcs}
if [[ $CDUMP == gefs ]]; then
NTASKS_TOT=${NTASKS_TOT:-$npe_fcst_gfs}
else
NTASKS_TOT=${NTASKS_TOT:-$npe_efcs}
fi
fi

TYPE=${TYPE:-"nh"} # choices: nh, hydro
Expand Down Expand Up @@ -241,6 +245,29 @@ FV3_GFS_predet(){
for file in $files; do
$NLN $RSTDIR_ATM/$file $RSTDIR_ATM/${vPDY}.${vcyc}0000.$file
done
elif [ $CDUMP = "gefs" -a $rst_invt1 -gt 0 ]; then
if [ $MEMBER -eq 0 ]; then
memchar=c$(printf %02i $MEMBER)
else
memchar=p$(printf %02i $MEMBER)
fi
RSTDIR_ATM=${RSTDIR:-$ROTDIR}/${CDUMP}.${PDY}/${cyc}/${memchar}/atmos/RERUN_RESTART
if [ ! -d $RSTDIR_ATM ]; then mkdir -p $RSTDIR_ATM ; fi
$NLN $RSTDIR_ATM RESTART
# The final restart written at the end doesn't include the valid date
# Create links that keep the same name pattern for these files
VDATE=$($NDATE +$FHMAX_GFS $CDATE)
vPDY=$(echo $VDATE | cut -c1-8)
vcyc=$(echo $VDATE | cut -c9-10)
files="coupler.res fv_core.res.nc"
for tile in {1..6}; do
for base in ca_data fv_core.res fv_srf_wnd.res fv_tracer.res phy_data sfc_data; do
files="${files} ${base}.tile${tile}.nc"
done
done
for file in $files; do
$NLN $RSTDIR_ATM/$file $RSTDIR_ATM/${vPDY}.${vcyc}0000.$file
done
else
mkdir -p $DATA/RESTART
fi
Expand Down

0 comments on commit 9865bf9

Please sign in to comment.