Skip to content

Commit

Permalink
Merge pull request #120 from XianwuXue-NOAA/feature/v13_atmos_fcst
Browse files Browse the repository at this point in the history
Make atmos_fcst job work using GFSv17 and new COM structure
  • Loading branch information
XianwuXue-NOAA authored May 4, 2023
2 parents fcad19a + 3af9001 commit 2970fdf
Show file tree
Hide file tree
Showing 21 changed files with 1,513 additions and 774 deletions.
8 changes: 4 additions & 4 deletions jobs/JGEFS_ATMOS_PREP
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export COMPONENT="atmos"
#############################
# Source relevant config files
#############################
configs="gefs gefs_atmos_prep"
config_path=$PARMgefs/parm_gefs
configs="base prep"
config_path=${PARMgefs}/config
for config in $configs; do
. ${config_path}/${config}.parm
. ${config_path}/config.${config}
export err=$?
if [[ $err != 0 ]]; then
echo "FATAL ERROR in $(basename $BASH_SOURCE): Error while loading parm file ${config_path}/${config}.parm"
echo "FATAL ERROR in $(basename $BASH_SOURCE): Error while loading parm file ${config_path}/config.${config}"
exit ${err}
fi
done
Expand Down
101 changes: 57 additions & 44 deletions jobs/JGEFS_FORECAST
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
#!/bin/ksh
#! /usr/bin/env bash

echo "$(date -u) begin ${.sh.file}"

set -xa
if [[ ${STRICT:-NO} == "YES" ]]; then
# Turn on strict bash error checking
set -eu
fi
export PS4='$SECONDS + $(basename ${.sh.file})[$LINENO] '
source "${HOMEgefs:-${HOMEgfs}}/ush/preamble.sh"

####################################
# Determine Job Output Name on System
####################################
export jobid=${jobid:-"$job.$PBS_JOBID"}
export jobid=${jobid:-"${job}.${PBS_JOBID}"}
export pgmout="OUTPUT.${PBS_JOBID}"
export pgmerr=errfile

Expand All @@ -23,12 +16,6 @@ export DATA=${DATA:-${DATAROOT}/${jobid}}
mkdir -p $DATA
cd $DATA

######################################
# Set up compute resources
######################################
export total_tasks=${total_tasks:-320}
export APRUN=${gefsmpexec:-"mpiexec -n $total_tasks"}

####################################
# Specify NET and RUN Name and model
####################################
Expand All @@ -55,8 +42,8 @@ setpdy.sh
source PDY

if [ ${FORECAST_SEGMENT} = lr ]; then
export cyc=00
export cycle=t${cyc}z
export cyc=00
export cycle=t${cyc}z
fi

####################################
Expand All @@ -71,51 +58,79 @@ export PARMgefs=${PARMgefs:-$HOMEgefs/parm}
##############################################
# Define COM directories
##############################################
ver=${ver:-$(echo ${gefs_ver}|cut -c1-5)}
export COMIN=${COMIN:-$(compath.py $envir/com/$NET/${ver})/${RUN}.${PDY}/$cyc}
export COMOUT=${COMOUT:-$(compath.py -o $NET/${ver})/${RUN}.${PDY}/$cyc}
export GESIN=${GESIN:-$(compath.py $envir/com/$NET/${ver})/${RUN}.${PDY}/$cyc/nwges}
export GESOUT=${GESOUT:-$(compath.py -o $NET/${ver})/${RUN}.${PDY}/$cyc/nwges}
ver=${gefs_ver:0:5}
export ROTDIR=${ROTDIR:-$(compath.py $envir/com/$NET/${ver})}

#############################
# Source relevant config files
#############################
configs="gefs gefs_wave gefs_fcst"
config_path=$PARMgefs
export CDATE=$PDY$cyc
configs="base fcst efcs"
config_path=${PARMgefs}/config
for config in $configs; do
. $config_path/$config.parm
export err=$?
if [[ $err != 0 ]]; then
echo "FATAL ERROR in ${.sh.file}: Error while loading parm file $config_path/$config.parm"
exit $err
fi
. ${config_path}/config.${config}
export err=$?
if [[ $err != 0 ]]; then
echo "FATAL ERROR in ${BASH_SOURCE[0]}: Error while loading parm file ${config_path}/config.${config}"
exit $err
fi
done

export APRUN_UFS=${APRUN_UFS:-"${launcher:-'mpiexec -l'} -n ${npe_fcst} -ppn ${npe_node_fcst} --cpu-bind depth --depth ${NTHREADS_FV3}"}

if [[ $cplchm = ".true." ]]; then
COMPONENT="chem"
fi
if [[ $cplwav = ".true." ]]; then
# Set location of wave restart from last cycle
last_date=$($NDATE -$WAVHCYC $CDATE)
last_PDY=$(echo $last_date | cut -c1-8)
last_cyc=$(echo $last_date | cut -c9-10)
export WRDIR=${WRDIR:-$(compath.py $envir/com/$NET/${ver})}/${RUN}.${last_PDY}/$last_cyc/wave/restart
COMPONENT="chem"
fi

export COMPONENT=${COMPONENT:-atmos}

echo "Environment before calling script"
env | sort

# Ignore possible spelling error (nothing is misspelled)
# shellcheck disable=SC2153
GDATE=$(${NDATE} -"${assim_freq}" "${PDY}${cyc}")
# shellcheck disable=
declare -x gPDY="${GDATE:0:8}"
declare -x gcyc="${GDATE:8:2}"

# Construct COM variables from templates (see config.com)
declare -rx memchar=${RUNMEM:2:3}

MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -rx COM_ATMOS_RESTART COM_ATMOS_INPUT COM_ATMOS_ANALYSIS \
COM_ATMOS_HISTORY COM_ATMOS_MASTER

RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -rx COM_ATMOS_RESTART_PREV:COM_ATMOS_RESTART_TMPL

if [[ ${DO_WAVE} == "YES" ]]; then
MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -rx COM_WAVE_RESTART COM_WAVE_PREP COM_WAVE_HISTORY
RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -rx COM_WAVE_RESTART_PREV:COM_WAVE_RESTART_TMPL
fi

if [[ ${DO_OCN} == "YES" ]]; then
MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -rx COM_MED_RESTART COM_OCEAN_RESTART \
COM_OCEAN_INPUT COM_OCEAN_HISTORY COM_OCEAN_ANALYSIS
RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -rx COM_OCEAN_RESTART_PREV:COM_OCEAN_RESTART_TMPL
fi

if [[ ${DO_ICE} == "YES" ]]; then
MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -rx COM_ICE_HISTORY
RUN=${rCDUMP} MEMDIR="${memchar}" YMD="${gPDY}" HH="${gcyc}" generate_com -rx COM_ICE_RESTART_PREV:COM_ICE_RESTART_TMPL
fi

if [[ ${DO_AERO} == "YES" ]]; then
MEMDIR="${memchar}" YMD=${PDY} HH=${cyc} generate_com -rx COM_CHEM_HISTORY
fi

#############################################################
# Execute the script
$HOMEgefs/scripts/exgefs_forecast.sh
export err=$?
if [[ $err == 0 ]]; then
echo "$job completed normally!"
echo "$job completed normally!"
else
echo "FATAL ERROR in ${.sh.file}: $job failed!"
exit $err
echo "FATAL ERROR in ${BASH_SOURCE[0]}: $job failed!"
exit $err
fi
#############################################################

Expand All @@ -125,6 +140,4 @@ fi
cd $DATAROOT
if [ ${KEEPDATA:-NO} = NO ] ; then rm -rf $DATA ; fi

echo "$(date -u) end ${.sh.file}"

exit $err
4 changes: 3 additions & 1 deletion parm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ post
product
prep_chem_sources.inp.IN

config
config/config.nsst
config/config.com
config/config.defaults.s2sw
128 changes: 106 additions & 22 deletions parm/parm_gefs/gefs.parm → parm/config/config.base
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ esac
memberlist="c00"

imem=1
while [[ imem -le $npert ]];
do
while [[ imem -le $npert ]]; do
memberlist="$memberlist p$(printf %02i $imem)"
(( imem++ ))
((imem++))
done
export memberlist

Expand All @@ -62,26 +61,26 @@ if [[ ${RUNMEM:-none} = "geaer" ]]; then cplchm=".true."; fi
export cplchm=${cplchm:-.false.}

if [[ $cplchm = ".true." ]]; then
# Override forecast length
export fhmaxh=$fhmax_aer
export fhmax=$fhmax_aer
# Override forecast length
export fhmaxh=$fhmax_aer
export fhmax=$fhmax_aer

export AEROSOL_INIT_TYPE=${AEROSOL_INIT_TYPE:-"warm"}
export AEROSOL_INIT_TYPE=${AEROSOL_INIT_TYPE:-"warm"}

export cplwav=".false." # Running both chem and waves is not yet supported
export cplwav=".false." # Running both chem and waves is not yet supported
fi

export fhmax
if (( fhmax <= fhmaxh )); then export fhmaxh=$fhmax; fi
if (( FHMAXHF > fhmaxh )); then export FHMAXHF=$fhmaxh; fi
if ((fhmax <= fhmaxh)); then export fhmaxh=$fhmax; fi
if ((FHMAXHF > fhmaxh)); then export FHMAXHF=$fhmaxh; fi

export restart_interval=${fhrestart:-12}
export restart_interval_gfs=${fhrestart:-12}
export restart_interval_aer=${restart_interval_aer:-12}
export other_restart_time=${other_restart_time:-6}

if [[ $cplchm = ".true." ]]; then
export restart_interval=$restart_interval_aer
export other_restart_time=${other_restart_time:-$gefs_cych}
export restart_interval_gfs=$restart_interval_aer
export other_restart_time=${other_restart_time:-$gefs_cych}
fi

#pass these variables to gefs_wave.parm
Expand Down Expand Up @@ -135,21 +134,24 @@ export IDVC=${IDVC:-2}
export HOMEgefs=${HOMEgefs:-${PACKAGEROOT}/gefs.${gefs_ver}}
export EXECgefs=${EXECgefs:-${HOMEgefs}/exec}
export USHgefs=${USHgefs:-${HOMEgefs}/ush}
#export FIXgefs=${FIXgefs:-${HOMEgefs}/fix/fix_gefs}
export PARMgefs=${PARMgefs:-${HOMEgefs}/parm}

export HOMEgfs=${HOMEgfs:-${HOMEgefs}}
export PARMgfs=${HOMEgfs}/parm
export EXPDIR=${PARMgfs}/config
#export FIXgfs=${HOMEgfs}/fix
#export USHgfs=${HOMEgfs}/ush
#export UTILgfs=${HOMEgfs}/util
#export EXECgfs=${HOMEgfs}/exec
#export SCRgfs=${HOMEgfs}/scripts
export FIXgfs=${HOMEgfs}/fix
export USHgfs=${HOMEgfs}/ush
export UTILgfs=${HOMEgfs}/util
export EXECgfs=${HOMEgfs}/exec
export SCRgfs=${HOMEgfs}/scripts

#export FIXcice=${HOMEgfs}/fix/cice
#export FIXmom=${HOMEgfs}/fix/mom6
#export FIXreg2grb2=${HOMEgfs}/fix/reg2grb2
export FIXcice=${HOMEgfs}/fix/cice
export FIXmom=${HOMEgfs}/fix/mom6
export FIXreg2grb2=${HOMEgfs}/fix/reg2grb2


export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'}
export LOGSCRIPT=${LOGSCRIPT:-""} #=startmsg

####################################
# CONVENIENT utility scripts and other environment parameters
Expand Down Expand Up @@ -182,6 +184,23 @@ export VERBOSE=${VERBOSE:-YES}
# Get all the COM path templates
source "${PARMgefs:-${PARMgfs}}/config/config.com"

#------
# APP settings
export APP=${APP:-"ATM"} # ATM, S2SW

# Defaults:
export DO_ATM="YES"
export DO_COUPLED="NO"
export DO_WAVE="NO"
export DO_OCN="NO"
export DO_ICE="NO"
export DO_AERO="NO"
export CCPP_SUITE=${CCPP_SUITE:-"FV3_GFS_v17_p8"} #FV3_GFS_v16"}
export WAVE_CDUMP="" # When to include wave suite: gdas, gfs, or both
export DOBNDPNT_WAVE="NO"
export cplwav2atm=".false."
export FRAC_GRID=".true."

# These are the currently available grid-combinations
case "${CASE}" in
"C48") export OCNRES=500;;
Expand All @@ -192,6 +211,71 @@ case "${CASE}" in
*) export OCNRES=025;;
esac
export ICERES=${OCNRES}
export waveGRD='gnh_10m aoc_9km gsh_15m'

case "${APP}" in
ATM)
export confignamevarfornems="atm"
;;
ATMA)
export DO_AERO="YES"
export confignamevarfornems="atm_aero"
;;
ATMW)
export DO_COUPLED="YES"
export DO_WAVE="YES"
export WAVE_CDUMP="both"
export confignamevarfornems="leapfrog_atm_wav"
;;
NG-GODAS)
export DO_ATM="NO"
export DO_OCN="YES"
export DO_ICE="YES"
;;
S2S*)
export DO_COUPLED="YES"
export DO_OCN="YES"
export DO_ICE="YES"
export CCPP_SUITE="FV3_GFS_v17_coupled_p8"
export confignamevarfornems="cpld"

if [[ "${APP}" =~ A$ ]]; then
export DO_AERO="YES"
export confignamevarfornems="${confignamevarfornems}_aero"
fi

if [[ "${APP}" =~ ^S2SW ]]; then
export DO_WAVE="YES"
export WAVE_CDUMP="both"
export cplwav2atm=".true."
export confignamevarfornems="${confignamevarfornems}_outerwave"
fi

source ${EXPDIR}/config.defaults.s2sw

;;
*)
echo "Unrecognized APP: ${APP}"
exit 1
;;
esac

# Surface cycle update frequency
export FHCYC=24

# IAU related parameters
export DOIAU="NO" # Enable 4DIAU for control with 3 increments
export IAU_OFFSET=0
export IAU_DELTHRS=0
export IAU_FHROT=0

# turned on nsst in anal and/or fcst steps, and turn off rtgsst
export DONST="YES"
if [[ ${DONST} = "YES" ]]; then export FNTSFA=" "; fi

# The switch to apply SST elevation correction or not
export nst_anl=.true.
#-----

# Microphysics Options: 99-ZhaoCarr, 8-Thompson; 6-WSM6, 10-MG, 11-GFDL
export imp_physics=${imp_physics:-"8"}
Expand Down
Loading

0 comments on commit 2970fdf

Please sign in to comment.