Skip to content

Commit

Permalink
Add regression test for regional grid that uses GSL GWD
Browse files Browse the repository at this point in the history
orography. Update hera regression driver script.

Fixes ufs-community#253
  • Loading branch information
GeorgeGayno-NOAA committed Mar 22, 2021
1 parent 673d382 commit 6dced69
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 7 deletions.
9 changes: 3 additions & 6 deletions driver_scripts/driver_grid.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@ fi
# out_dir - where files will be placed upon completion.
#-----------------------------------------------------------------------

#export home_dir=$SLURM_SUBMIT_DIR/..
export home_dir=/scratch1/BMC/wrfruc/mtoy/git_local/UFS_UTILS
#export TEMP_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype
export TEMP_DIR=/scratch1/BMC/gsd-fv3-dev/NCEPDEV/stmp3/$LOGNAME/fv3_grid.$gtype
#export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/my_grids
export out_dir=/scratch1/BMC/gsd-fv3-dev/NCEPDEV/stmp3/$LOGNAME/my_grids
export home_dir=$SLURM_SUBMIT_DIR/..
export TEMP_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype
export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/my_grids

#-----------------------------------------------------------------------
# Should not need to change anything below here.
Expand Down
9 changes: 8 additions & 1 deletion reg_tests/grid_gen/driver.hera.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,19 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_
TEST3=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J esg.regional \
-o $LOG_FILE -e $LOG_FILE -d afterok:$TEST2 ./esg.regional.sh)

#-----------------------------------------------------------------------------
# Regional GSL gravity wave drag test.
#-----------------------------------------------------------------------------

TEST4=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J reg.gsl.gwd \
-o $LOG_FILE -e $LOG_FILE -d afterok:$TEST3 ./regional.gsl.gwd.sh)

#-----------------------------------------------------------------------------
# Create summary log.
#-----------------------------------------------------------------------------

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \
--open-mode=append -q $QUEUE -d afterok:$TEST3 << EOF
--open-mode=append -q $QUEUE -d afterok:$TEST4 << EOF
#!/bin/bash
grep -a '<<<' $LOG_FILE > $SUM_FILE
EOF
69 changes: 69 additions & 0 deletions reg_tests/grid_gen/regional.gsl.gwd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

#-----------------------------------------------------------------------
# Create a regional esg grid with GSL gravity wave drag files.
# Compare output to a set of baseline files using the 'nccmp' utility.
# This script is run by the machine specific driver script.
#-----------------------------------------------------------------------

set -x

export TEMP_DIR=${WORK_DIR}/regional.gsl.gwd.work
export out_dir=${WORK_DIR}/regional.gsl.gwd

export gtype=regional_esg
export make_gsl_orog=true # Create GSL gravity wave drag fields
export target_lon=-97.5 # Center longitude of the highest resolution tile
export target_lat=35.5 # Center latitude of the highest resolution tile
export idim=301 # Dimension of grid in 'i' direction
export jdim=200 # Dimension of grid in 'j' direction
export delx=0.0585 # Grid spacing in degrees in 'i' direction
export dely=0.0585 # Grid spacing in degrees in 'j' direction
export halo=4

NCCMP=${NCCMP:-$(which nccmp)}

#-----------------------------------------------------------------------
# Start script.
#-----------------------------------------------------------------------

echo "Starting at: " `date`

$home_dir/ush/fv3gfs_driver_grid.sh

iret=$?
if [ $iret -ne 0 ]; then
set +x
echo "<<< REGIONAL GSL GWD TEST FAILED. <<<"
exit $iret
fi

echo "Ending at: " `date`

#-----------------------------------------------------------------------------
# Compare output to baseline set of data.
#-----------------------------------------------------------------------------

cd $out_dir/C772

test_failed=0
for files in *tile*.nc ./fix_sfc/*tile*.nc
do
if [ -f $files ]; then
echo CHECK $files
$NCCMP -dmfqS $files $HOMEreg/regional.gsl.gwd/$files
iret=$?
if [ $iret -ne 0 ]; then
test_failed=1
fi
fi
done

set +x
if [ $test_failed -ne 0 ]; then
echo "<<< REGIONAL GSL GWD TEST FAILED. >>>"
else
echo "<<< REGIONAL GSL GWD TEST PASSED. >>>"
fi

exit 0
2 changes: 2 additions & 0 deletions ush/fv3gfs_driver_grid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export add_lake=${add_lake:-false} # add lake fraction and depth. uniform
export lake_cutoff=${lake_cutoff:-0.20} # lake fractions less than lake_cutoff
# are ignored.

export make_gsl_orog={make_gsl_orog:-false} # when true, create GSL drag suite orog files.

if [ $gtype = uniform ]; then
echo "Creating global uniform grid"
elif [ $gtype = stretch ]; then
Expand Down

0 comments on commit 6dced69

Please sign in to comment.