Skip to content

Commit

Permalink
remove the variable waveMULTIGRID
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMFernando-NOAA committed Dec 20, 2024
1 parent e070372 commit 0e0c1b9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 257 deletions.
2 changes: 0 additions & 2 deletions parm/config/gefs/config.wave
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export RUNRSTwave="gdas"
export waveGRDN='1' # grid number for ww3_multi
export waveGRDG='10' # grid group for ww3_multi
export USE_WAV_RMP='NO' # YES/NO rmp grid remapping pre-processed coefficients
export waveMULTIGRID='.false.' # .true./.false. for multi or shel
export MESH_WAV="mesh.${waveGRD}.nc" # Mesh grid for wave model for CMEPS
export waveesmfGRD=' ' # input grid for multigrid

Expand All @@ -30,7 +29,6 @@ case "${waveGRD}" in
export waveGRDN='1 2 3'
export waveGRDG='10 20 30'
export USE_WAV_RMP='YES'
export waveMULTIGRID='.false.'
export IOSRV='3'
export MESH_WAV=' '
export waveesmfGRD='glox_10m'
Expand Down
21 changes: 5 additions & 16 deletions ush/forecast_postdet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -375,24 +375,16 @@ WW3_postdet() {

# Link output files
local wavprfx="${RUN}wave${WAV_MEMBER:-}"
if [[ "${waveMULTIGRID}" == ".true." ]]; then
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.mww3.${PDY}${cyc}" "log.mww3"
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.${waveGRD}"
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.log.${waveGRD}.${PDY}${cyc}" "log.ww3"

# Loop for gridded output (uses FHINC)
local fhr vdate FHINC ww3_grid
fhr=${FHMIN_WAV}
fhinc=${FHOUT_WAV}
while (( fhr <= FHMAX_WAV )); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d.%H0000)
if [[ "${waveMULTIGRID}" == ".true." ]]; then
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${vdate}" "${DATA}/${vdate}.out_grd.${waveGRD}"
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${vdate}" "${DATA}/${vdate}.out_grd.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_grd.${waveGRD}.${vdate}" "${DATA}/${vdate}.out_grd.ww3"

if (( FHMAX_HF_WAV > 0 && FHOUT_HF_WAV > 0 && fhr < FHMAX_HF_WAV )); then
fhinc=${FHOUT_HF_WAV}
fi
Expand All @@ -404,11 +396,8 @@ WW3_postdet() {
fhinc=${FHINCP_WAV}
while (( fhr <= FHMAX_WAV )); do
vdate=$(date --utc -d "${current_cycle:0:8} ${current_cycle:8:2} + ${fhr} hours" +%Y%m%d.%H0000)
if [[ "${waveMULTIGRID}" == ".true." ]]; then
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.${waveuoutpGRD}"
else
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.ww3"
fi
${NLN} "${COMOUT_WAVE_HISTORY}/${wavprfx}.out_pnt.${waveuoutpGRD}.${vdate}" "${DATA}/${vdate}.out_pnt.ww3"

fhr=$((fhr + fhinc))
done
}
Expand Down
19 changes: 3 additions & 16 deletions ush/forecast_predet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -591,22 +591,9 @@ WW3_predet(){
# Files from wave prep and wave init jobs
# Copy mod_def files for wave grids
local ww3_grid
if [[ "${waveMULTIGRID}" == ".true." ]]; then
local array=("${WAVECUR_FID}" "${WAVEICE_FID}" "${WAVEWND_FID}" "${waveuoutpGRD}" "${waveGRD}" "${waveesmfGRD}")
echo "Wave Grids: ${array[*]}"
local grdALL
# shellcheck disable=SC2312
grdALL=$(printf "%s\n" "${array[@]}" | sort -u | tr '\n' ' ')

for ww3_grid in ${grdALL}; do
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${ww3_grid}" "${DATA}/mod_def.${ww3_grid}" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${ww3_grid}' from '${COMIN_WAVE_PREP}'"; exit 1 )
done
else
#if shel, only 1 waveGRD which is linked to mod_def.ww3
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${waveGRD}" "${DATA}/mod_def.ww3" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${waveGRD}' from '${COMIN_WAVE_PREP}'"; exit 1 )
fi
#if shel, only 1 waveGRD which is linked to mod_def.ww3
${NCP} "${COMIN_WAVE_PREP}/${RUN}wave.mod_def.${waveGRD}" "${DATA}/mod_def.ww3" \
|| ( echo "FATAL ERROR: Failed to copy '${RUN}wave.mod_def.${waveGRD}' from '${COMIN_WAVE_PREP}'"; exit 1 )

if [[ "${WW3ICEINP}" == "YES" ]]; then
local wavicefile="${COMIN_WAVE_PREP}/${RUN}wave.${WAVEICE_FID}.t${current_cycle:8:2}z.ice"
Expand Down
284 changes: 62 additions & 222 deletions ush/parsing_namelists_WW3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,15 @@ WW3_namelists(){
# --------------------------------------------------------------------------- #
# Create ww3_multi/shel.inp

if [ $waveMULTIGRID = ".true." ]; then
# ww3_multi template
if [ -f ${PARMgfs}/wave/ww3_multi.inp.tmpl ]; then
cp ${PARMgfs}/wave/ww3_multi.inp.tmpl ww3_multi.inp.tmpl
fi
if [ ! -f ww3_multi.inp.tmpl ]; then
echo "ABNORMAL EXIT: NO TEMPLATE FOR WW3 MULTI INPUT FILE"
exit 11
fi
else
# ww3_multi template
if [ -f ${PARMgfs}/wave/ww3_shel.inp.tmpl ]; then
cp ${PARMgfs}/wave/ww3_shel.inp.tmpl ww3_shel.inp.tmpl
fi
if [ ! -f ww3_shel.inp.tmpl ]; then
echo "ABNORMAL EXIT: NO TEMPLATE FOR WW3 SHEL INPUT FILE"
exit 12
fi
# ww3_multi template
if [ -f ${PARMgfs}/wave/ww3_shel.inp.tmpl ]; then
cp ${PARMgfs}/wave/ww3_shel.inp.tmpl ww3_shel.inp.tmpl
fi
if [ ! -f ww3_shel.inp.tmpl ]; then
echo "ABNORMAL EXIT: NO TEMPLATE FOR WW3 SHEL INPUT FILE"
exit 12
fi


# Buoy location file

Expand All @@ -114,210 +104,60 @@ WW3_namelists(){
exit 12
fi



if [ $waveMULTIGRID = ".true." ]; then
#multi

# Initialize inp file parameters
NFGRIDS=0
NMGRIDS=0
CPLILINE='$'
ICELINE='$'
ICEFLAG='no'
CURRLINE='$'
CURRFLAG='no'
WINDLINE='$'
WINDFLAG='no'
UNIPOINTS='$'

# Check for required inputs and coupling options
if [ $waveuoutpGRD ]
then
UNIPOINTS="'$waveuoutpGRD'"
fi

# Check if waveesmfGRD is set
if [ ${waveesmfGRD} ]
then
NFGRIDS=$(expr $NFGRIDS + 1)
fi

case ${WW3ATMINP} in
'YES' )
NFGRIDS=$(expr $NFGRIDS + 1)
WINDLINE=" '$WAVEWND_FID' F F T F F F F F F"
WINDFLAG="$WAVEWND_FID"
;;
'CPL' )
WNDIFLAG='T'
if [ ${waveesmfGRD} ]
then
WINDFLAG="CPL:${waveesmfGRD}"
CPLILINE=" '${waveesmfGRD}' F F T F F F F F F"
else
WINDFLAG="CPL:native"
fi
;;
esac

case ${WW3ICEINP} in
'YES' )
NFGRIDS=$(expr $NFGRIDS + 1)
ICEIFLAG='T'
ICELINE=" '$WAVEICE_FID' F F F T F F F F F"
ICEFLAG="$WAVEICE_FID"
;;
'CPL' )
ICEIFLAG='T'
if [ ${waveesmfGRD} ]
then
ICEFLAG="CPL:${waveesmfGRD}"
CPLILINE=" '${waveesmfGRD}' F F ${WNDIFLAG} T F F F F F"
else
ICEFLAG="CPL:native"
fi
;;
esac

case ${WW3CURINP} in
'YES' )
if [ "$WAVECUR_FID" != "$WAVEICE_FID" ]; then
NFGRIDS=$(expr $NFGRIDS + 1)
CURRLINE=" '$WAVECUR_FID' F T F F F F F F F"
CURRFLAG="$WAVECUR_FID"
else # cur fields share the same grid as ice grid
ICELINE=" '$WAVEICE_FID' F T F ${ICEIFLAG} F F F F F"
CURRFLAG="$WAVEICE_FID"
fi
;;
'CPL' )
CURIFLAG='T'
if [ ${waveesmfGRD} ]
then
CURRFLAG="CPL:${waveesmfGRD}"
CPLILINE=" '${waveesmfGRD}' F T ${WNDIFLAG} ${ICEFLAG} F F F F F"
else
CURRFLAG="CPL:native"
fi
;;
esac

unset agrid
agrid=
gline=
GRDN=0
# grdGRP=1 # Single group for now
GRDN=$(expr "${GRDN}" + 1)
agrid=( ${agrid[*]} ${waveGRD} )
NMGRIDS=$(expr "$NMGRIDS" + 1)
gridN=$(echo $waveGRDN | awk -v i=$GRDN '{print $i}')
gridG=$(echo $waveGRDG | awk -v i=$GRDN '{print $i}')
gline="${gline}'${waveGRD}' 'no' 'CURRFLAG' 'WINDFLAG' 'ICEFLAG' 'no' 'no' 'no' 'no' 'no' ${gridN} ${gridG} 0.00 1.00 F\n"
gline="${gline}\$"
echo $gline

sed -e "s/NFGRIDS/$NFGRIDS/g" \
-e "s/NMGRIDS/${NMGRIDS}/g" \
-e "s/FUNIPNT/${FUNIPNT}/g" \
-e "s/IOSRV/${IOSRV}/g" \
-e "s/FPNTPROC/${FPNTPROC}/g" \
-e "s/FGRDPROC/${FGRDPROC}/g" \
-e "s/OUTPARS/${OUTPARS_WAV}/g" \
-e "s/CPLILINE/${CPLILINE}/g" \
-e "s/UNIPOINTS/${UNIPOINTS}/g" \
-e "s/GRIDLINE/${gline}/g" \
-e "s/ICELINE/$ICELINE/g" \
-e "s/CURRLINE/$CURRLINE/g" \
-e "s/WINDLINE/$WINDLINE/g" \
-e "s/ICEFLAG/$ICEFLAG/g" \
-e "s/CURRFLAG/$CURRFLAG/g" \
-e "s/WINDFLAG/$WINDFLAG/g" \
-e "s/RUN_BEG/$time_beg/g" \
-e "s/RUN_END/$time_end/g" \
-e "s/OUT_BEG/$time_beg_out/g" \
-e "s/OUT_END/$time_end/g" \
-e "s/DTFLD/ $DTFLD_WAV/g" \
-e "s/FLAGMASKCOMP/ $FLAGMASKCOMP/g" \
-e "s/FLAGMASKOUT/ $FLAGMASKOUT/g" \
-e "s/GOFILETYPE/ $GOFILETYPE/g" \
-e "s/POFILETYPE/ $POFILETYPE/g" \
-e "s/DTPNT/ $DTPNT_WAV/g" \
-e "/BUOY_FILE/r buoy.loc" \
-e "s/BUOY_FILE/DUMMY/g" \
-e "s/RST_BEG/$time_rst_ini/g" \
-e "s/RSTTYPE/$RSTTYPE_WAV/g" \
-e "s/RST_2_BEG/$time_rst2_ini/g" \
-e "s/DTRST/$DT_1_RST_WAV/g" \
-e "s/DT_2_RST/$DT_2_RST_WAV/g" \
-e "s/RST_END/$time_rst1_end/g" \
-e "s/RST_2_END/$time_rst2_end/g" \
ww3_multi.inp.tmpl | \
sed -n "/DUMMY/!p" > ww3_multi.inp

rm -f ww3_multi.inp.tmpl buoy.loc

cat ww3_multi.inp

else
#ww3_shel

# Initialize inp file parameters
ICELINE='F F'
CURRLINE='F F'
WINDLINE='F F'

case ${WW3ATMINP} in
'YES' )
WINDLINE="T F";;
'CPL' )
WINDLINE="C F";;
esac

case ${WW3ICEINP} in
'YES' )
ICELINE="T F";;
'CPL' )
ICELINE="C F";;
esac

case ${WW3CURINP} in
'YES' )
CURRLINE="T F";;
'CPL' )
CURRLINE="C F";;
esac

sed -e "s/IOSRV/${IOSRV}/g" \
-e "s/OUTPARS/${OUTPARS_WAV}/g" \
-e "s/ICELINE/$ICELINE/g" \
-e "s/CURRLINE/$CURRLINE/g" \
-e "s/WINDLINE/$WINDLINE/g" \
-e "s/RUN_BEG/$time_beg/g" \
-e "s/RUN_END/$time_end/g" \
-e "s/OUT_BEG/$time_beg_out/g" \
-e "s/OUT_END/$time_end/g" \
-e "s/DTFLD/ $DTFLD_WAV/g" \
-e "s/GOFILETYPE/ $GOFILETYPE/g" \
-e "s/POFILETYPE/ $POFILETYPE/g" \
-e "s/DTPNT/ $DTPNT_WAV/g" \
-e "s/DTPNT/ $DTPNT_WAV/g" \
-e "/BUOY_FILE/r buoy.loc" \
-e "s/BUOY_FILE/DUMMY/g" \
-e "s/RST_BEG/$time_rst_ini/g" \
-e "s/RSTTYPE/$RSTTYPE_WAV/g" \
-e "s/RST_2_BEG/$time_rst2_ini/g" \
-e "s/DTRST/$DT_1_RST_WAV/g" \
-e "s/DT_2_RST/$DT_2_RST_WAV/g" \
-e "s/RST_END/$time_rst1_end/g" \
-e "s/RST_2_END/$time_rst2_end/g" \
ww3_shel.inp.tmpl | \
sed -n "/DUMMY/!p" > ww3_shel.inp

rm -f ww3_shel.inp.tmpl buoy.loc

cat ww3_shel.inp

fi
ICELINE='F F'
CURRLINE='F F'
WINDLINE='F F'

case ${WW3ATMINP} in
'YES' )
WINDLINE="T F";;
'CPL' )
WINDLINE="C F";;
esac

case ${WW3ICEINP} in
'YES' )
ICELINE="T F";;
'CPL' )
ICELINE="C F";;
esac

case ${WW3CURINP} in
'YES' )
CURRLINE="T F";;
'CPL' )
CURRLINE="C F";;
esac

sed -e "s/IOSRV/${IOSRV}/g" \
-e "s/OUTPARS/${OUTPARS_WAV}/g" \
-e "s/ICELINE/$ICELINE/g" \
-e "s/CURRLINE/$CURRLINE/g" \
-e "s/WINDLINE/$WINDLINE/g" \
-e "s/RUN_BEG/$time_beg/g" \
-e "s/RUN_END/$time_end/g" \
-e "s/OUT_BEG/$time_beg_out/g" \
-e "s/OUT_END/$time_end/g" \
-e "s/DTFLD/ $DTFLD_WAV/g" \
-e "s/GOFILETYPE/ $GOFILETYPE/g" \
-e "s/POFILETYPE/ $POFILETYPE/g" \
-e "s/DTPNT/ $DTPNT_WAV/g" \
-e "s/DTPNT/ $DTPNT_WAV/g" \
-e "/BUOY_FILE/r buoy.loc" \
-e "s/BUOY_FILE/DUMMY/g" \
-e "s/RST_BEG/$time_rst_ini/g" \
-e "s/RSTTYPE/$RSTTYPE_WAV/g" \
-e "s/RST_2_BEG/$time_rst2_ini/g" \
-e "s/DTRST/$DT_1_RST_WAV/g" \
-e "s/DT_2_RST/$DT_2_RST_WAV/g" \
-e "s/RST_END/$time_rst1_end/g" \
-e "s/RST_2_END/$time_rst2_end/g" \
ww3_shel.inp.tmpl | \
sed -n "/DUMMY/!p" > ww3_shel.inp

rm -f ww3_shel.inp.tmpl buoy.loc

cat ww3_shel.inp

}
1 change: 0 additions & 1 deletion ush/parsing_ufs_configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ if [[ "${cplwav}" = ".true." ]]; then
local wav_model="ww3"
local wav_petlist_bounds="$(( ATMPETS+OCNPETS+ICEPETS )) $(( ATMPETS+OCNPETS+ICEPETS+WAVPETS-1 ))"
local wav_omp_num_threads="${WAVTHREADS}"
local MULTIGRID="${waveMULTIGRID}"
local WW3_user_sets_restname="false"

local WW3_user_histname="false"
Expand Down

0 comments on commit 0e0c1b9

Please sign in to comment.