From 7addff5a639af6ad8c41dc1f36a8ad34967eb9e0 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 12 Feb 2024 14:30:44 -0500 Subject: [PATCH] Update chgres_cube for fractional grids (#873) Update chgres_cube for fractional (partial land/non-land) grids. Outputs a new surface coldstart file (called version 2). Update the sfc_climo_gen program to always map surface data to points with at least some land. Prevously, that only was done for grids with lakes. Fixes #123. --- reg_tests/chgres_cube/13km.conus.nam.grib2.sh | 6 +- reg_tests/chgres_cube/13km.conus.rap.grib2.sh | 6 +- .../chgres_cube/13km.na.gfs.ncei.grib2.sh | 5 +- reg_tests/chgres_cube/25km.conus.gfs.grib2.sh | 6 +- .../chgres_cube/25km.conus.gfs.pbgrib2.sh | 6 +- .../3km.conus.hrrr.gfssdf.grib2.sh | 2 +- .../3km.conus.hrrr.newsfc.grib2.sh | 2 +- reg_tests/chgres_cube/c192.fv3.history.sh | 9 +- reg_tests/chgres_cube/c192.gfs.grib2.sh | 5 +- reg_tests/chgres_cube/c96.fv3.nemsio.sh | 6 +- reg_tests/chgres_cube/c96.fv3.netcdf.sh | 6 +- reg_tests/chgres_cube/c96.fv3.netcdf2wam.sh | 5 +- reg_tests/chgres_cube/c96.fv3.restart.sh | 5 +- reg_tests/chgres_cube/c96.gefs.grib2.sh | 5 +- reg_tests/chgres_cube/c96.gfs.nemsio.sh | 6 +- reg_tests/chgres_cube/c96.gfs.sigio.sh | 6 +- reg_tests/chgres_cube/c96.regional.sh | 83 --- reg_tests/chgres_cube/driver.hera.sh | 57 +- reg_tests/chgres_cube/driver.hercules.sh | 19 +- reg_tests/chgres_cube/driver.jet.sh | 55 +- reg_tests/chgres_cube/driver.orion.sh | 17 +- reg_tests/chgres_cube/driver.wcoss2.sh | 15 +- reg_tests/grid_gen/driver.hercules.sh | 2 +- sorc/CMakeLists.txt | 2 +- sorc/chgres_cube.fd/model_grid.F90 | 54 +- sorc/chgres_cube.fd/program_setup.F90 | 9 +- sorc/chgres_cube.fd/surface.F90 | 595 +++++++++++++----- sorc/chgres_cube.fd/surface_target_data.F90 | 26 +- sorc/chgres_cube.fd/write_data.F90 | 248 ++++++-- sorc/sfc_climo_gen.fd/model_grid.F90 | 22 +- .../chgres_cube/ftst_surface_nst_landfill.F90 | 34 +- ush/fv3gfs_driver_grid.sh | 2 +- 32 files changed, 855 insertions(+), 471 deletions(-) delete mode 100755 reg_tests/chgres_cube/c96.regional.sh diff --git a/reg_tests/chgres_cube/13km.conus.nam.grib2.sh b/reg_tests/chgres_cube/13km.conus.nam.grib2.sh index 16af5e42b..a5bd051c4 100755 --- a/reg_tests/chgres_cube/13km.conus.nam.grib2.sh +++ b/reg_tests/chgres_cube/13km.conus.nam.grib2.sh @@ -12,10 +12,10 @@ set -x export DATA=$OUTDIR/13km_conus_nam_grib2 rm -fr $DATA -export CRES=775 +export CRES=778 export KMRES=13km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/nam.grib2 export GRIB2_FILE_INPUT=nam_218_20200801_0000_000.grb2 @@ -23,7 +23,7 @@ export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." -export OROG_FILES_TARGET_GRID="C775_oro_data.tile7.halo4.nc" +export OROG_FILES_TARGET_GRID="C778_oro_data.tile7.nc" export REGIONAL=1 export HALO_BLEND=0 export HALO_BNDY=4 diff --git a/reg_tests/chgres_cube/13km.conus.rap.grib2.sh b/reg_tests/chgres_cube/13km.conus.rap.grib2.sh index e69bff8b0..4b684b646 100755 --- a/reg_tests/chgres_cube/13km.conus.rap.grib2.sh +++ b/reg_tests/chgres_cube/13km.conus.rap.grib2.sh @@ -12,10 +12,10 @@ set -x export DATA=$OUTDIR/13km_conus_rap_grib2 rm -fr $DATA -export CRES=775 +export CRES=778 export KMRES=13km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/rap.grib2 export GRIB2_FILE_INPUT=1921221000900 @@ -23,7 +23,7 @@ export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GSDphys_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." -export OROG_FILES_TARGET_GRID="C775_oro_data.tile7.nc" +export OROG_FILES_TARGET_GRID="C778_oro_data.tile7.nc" export REGIONAL=1 export HALO_BLEND=0 export HALO_BNDY=4 diff --git a/reg_tests/chgres_cube/13km.na.gfs.ncei.grib2.sh b/reg_tests/chgres_cube/13km.na.gfs.ncei.grib2.sh index 2e48b8095..c3e0c6f5d 100755 --- a/reg_tests/chgres_cube/13km.na.gfs.ncei.grib2.sh +++ b/reg_tests/chgres_cube/13km.na.gfs.ncei.grib2.sh @@ -12,10 +12,9 @@ set -x export DATA=$OUTDIR/13km_na_gfs_ncei_grib2 rm -fr $DATA -export CRES=819 +export CRES=818 export KMRES=13km export FIXfv3=${HOMEreg}/fix/RRFS_NA_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc export COMIN=${HOMEreg}/input_data/gfs.ncei.grib2 export GRIB2_FILE_INPUT=gfs_4_20190801_0000_000.grb2 @@ -23,7 +22,7 @@ export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." -export OROG_FILES_TARGET_GRID="C819_oro_data.tile7.halo4.nc" +export OROG_FILES_TARGET_GRID="C818_oro_data.tile7.nc" export REGIONAL=1 export HALO_BLEND=0 export HALO_BNDY=4 diff --git a/reg_tests/chgres_cube/25km.conus.gfs.grib2.sh b/reg_tests/chgres_cube/25km.conus.gfs.grib2.sh index b7cb4129d..2efb252d7 100755 --- a/reg_tests/chgres_cube/25km.conus.gfs.grib2.sh +++ b/reg_tests/chgres_cube/25km.conus.gfs.grib2.sh @@ -12,10 +12,10 @@ set -x export DATA=$OUTDIR/25km_conus_gfs_grib2 rm -fr $DATA -export CRES=403 +export CRES=405 export KMRES=25km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/gfs.grib2 export GRIB2_FILE_INPUT=gfs.t00z.pgrb2.0p50.f000 @@ -24,7 +24,7 @@ export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GSDphys_noaero_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." export THOMPSON_AEROSOL_FILE=${HOMEufs}/fix/am/Thompson_MP_MONTHLY_CLIMO.nc -export OROG_FILES_TARGET_GRID="C403_oro_data.tile7.halo4.nc" +export OROG_FILES_TARGET_GRID="C405_oro_data.tile7.nc" export REGIONAL=1 export HALO_BLEND=0 export HALO_BNDY=4 diff --git a/reg_tests/chgres_cube/25km.conus.gfs.pbgrib2.sh b/reg_tests/chgres_cube/25km.conus.gfs.pbgrib2.sh index b104804a8..4b3491516 100755 --- a/reg_tests/chgres_cube/25km.conus.gfs.pbgrib2.sh +++ b/reg_tests/chgres_cube/25km.conus.gfs.pbgrib2.sh @@ -12,10 +12,10 @@ set -x export DATA=$OUTDIR/25km_conus_gfs_pbgrib2 rm -fr $DATA -export CRES=403 +export CRES=405 export KMRES=25km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/gfs.pbgrib2 export GRIB2_FILE_INPUT=gfs.t18z.pgrb2.0p25.f006 @@ -23,7 +23,7 @@ export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt export INPUT_TYPE='grib2' export CONVERT_NST=".false." -export OROG_FILES_TARGET_GRID="C403_oro_data.tile7.halo4.nc" +export OROG_FILES_TARGET_GRID="C405_oro_data.tile7.nc" export REGIONAL=1 export HALO_BLEND=0 export HALO_BNDY=4 diff --git a/reg_tests/chgres_cube/3km.conus.hrrr.gfssdf.grib2.sh b/reg_tests/chgres_cube/3km.conus.hrrr.gfssdf.grib2.sh index 63e7702c5..4f72173d6 100755 --- a/reg_tests/chgres_cube/3km.conus.hrrr.gfssdf.grib2.sh +++ b/reg_tests/chgres_cube/3km.conus.hrrr.gfssdf.grib2.sh @@ -15,7 +15,7 @@ rm -fr $DATA export CRES=3357 export KMRES=3km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/hrrr.grib2 export GRIB2_FILE_INPUT=1918200000000 diff --git a/reg_tests/chgres_cube/3km.conus.hrrr.newsfc.grib2.sh b/reg_tests/chgres_cube/3km.conus.hrrr.newsfc.grib2.sh index a8dfcea9e..86a3d8939 100755 --- a/reg_tests/chgres_cube/3km.conus.hrrr.newsfc.grib2.sh +++ b/reg_tests/chgres_cube/3km.conus.hrrr.newsfc.grib2.sh @@ -15,7 +15,7 @@ rm -fr $DATA export CRES=3357 export KMRES=3km export FIXfv3=${HOMEreg}/fix/RRFS_CONUS_${KMRES} -export FIXsfc=${FIXfv3}/fix_sfc + export COMIN=${HOMEreg}/input_data/hrrr.grib2 export GRIB2_FILE_INPUT=1921300000000 diff --git a/reg_tests/chgres_cube/c192.fv3.history.sh b/reg_tests/chgres_cube/c192.fv3.history.sh index 34d23c3e6..c46739691 100755 --- a/reg_tests/chgres_cube/c192.fv3.history.sh +++ b/reg_tests/chgres_cube/c192.fv3.history.sh @@ -13,8 +13,9 @@ export DATA=$OUTDIR/c192_fv3_history rm -fr $DATA export CRES=192 -export FIXfv3=${HOMEreg}/fix/C192 -export FIXsfc=${FIXfv3}/fix_sfc +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/fv3.history # Pay attention to the quotes. Dont start/end with double quote. @@ -22,8 +23,8 @@ export ATM_FILES_INPUT='dynf000.tile1.nc","dynf000.tile2.nc","dynf000.tile3.nc", export SFC_FILES_INPUT='phyf000.tile1.nc","phyf000.tile2.nc","phyf000.tile3.nc","phyf000.tile4.nc","phyf000.tile5.nc","phyf000.tile6.nc' export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export INPUT_TYPE='history' -export MOSAIC_FILE_INPUT_GRID="${HOMEreg}/fix/C96/C96_mosaic.nc" -export OROG_DIR_INPUT_GRID=${HOMEreg}/fix/C96 +export MOSAIC_FILE_INPUT_GRID="${HOMEreg}/fix/C96.history.file/C96_mosaic.nc" +export OROG_DIR_INPUT_GRID=${HOMEreg}/fix/C96.history.file export OROG_FILES_INPUT_GRID='C96_oro_data.tile1.nc","C96_oro_data.tile2.nc","C96_oro_data.tile3.nc","C96_oro_data.tile4.nc","C96_oro_data.tile5.nc","C96_oro_data.tile6.nc' export TRACERS_TARGET='"sphum","liq_wat","o3mr"' export TRACERS_INPUT='"spfh","clwmr","o3mr"' diff --git a/reg_tests/chgres_cube/c192.gfs.grib2.sh b/reg_tests/chgres_cube/c192.gfs.grib2.sh index 95762ac9b..e45b74d53 100755 --- a/reg_tests/chgres_cube/c192.gfs.grib2.sh +++ b/reg_tests/chgres_cube/c192.gfs.grib2.sh @@ -13,8 +13,9 @@ export DATA=$OUTDIR/c192_gfs_grib2 rm -fr $DATA export CRES=192 -export FIXfv3=${HOMEreg}/fix/C192 -export FIXsfc=${FIXfv3}/fix_sfc +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/gfs.grib2 export GRIB2_FILE_INPUT=gfs.t00z.pgrb2.0p50.f000 diff --git a/reg_tests/chgres_cube/c96.fv3.nemsio.sh b/reg_tests/chgres_cube/c96.fv3.nemsio.sh index e9899dfdc..1e35eb79c 100755 --- a/reg_tests/chgres_cube/c96.fv3.nemsio.sh +++ b/reg_tests/chgres_cube/c96.fv3.nemsio.sh @@ -12,8 +12,10 @@ set -x export DATA=$OUTDIR/c96_fv3_nemsio rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/fv3.nemsio export ATM_FILES_INPUT=gfs.t12z.atmf000.nemsio export SFC_FILES_INPUT=gfs.t12z.sfcf000.nemsio diff --git a/reg_tests/chgres_cube/c96.fv3.netcdf.sh b/reg_tests/chgres_cube/c96.fv3.netcdf.sh index 10adb17c6..df55a1f8a 100755 --- a/reg_tests/chgres_cube/c96.fv3.netcdf.sh +++ b/reg_tests/chgres_cube/c96.fv3.netcdf.sh @@ -12,8 +12,10 @@ set -x export DATA=$OUTDIR/c96_fv3_netcdf rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/fv3.netcdf export ATM_FILES_INPUT=gfs.t00z.atmf000.nc export SFC_FILES_INPUT=gfs.t00z.sfcf000.nc diff --git a/reg_tests/chgres_cube/c96.fv3.netcdf2wam.sh b/reg_tests/chgres_cube/c96.fv3.netcdf2wam.sh index 269448759..efdea6627 100755 --- a/reg_tests/chgres_cube/c96.fv3.netcdf2wam.sh +++ b/reg_tests/chgres_cube/c96.fv3.netcdf2wam.sh @@ -12,7 +12,10 @@ set -x export DATA=$OUTDIR/c96_fv3_netcdf2wam rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/fv3.netcdf export ATM_FILES_INPUT=gfs.t00z.atmf000.nc export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt diff --git a/reg_tests/chgres_cube/c96.fv3.restart.sh b/reg_tests/chgres_cube/c96.fv3.restart.sh index 21e9553a7..3c3cf9777 100755 --- a/reg_tests/chgres_cube/c96.fv3.restart.sh +++ b/reg_tests/chgres_cube/c96.fv3.restart.sh @@ -12,8 +12,9 @@ set -x export DATA=$OUTDIR/c96_fv3_restart rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} export COMIN=${HOMEreg}/input_data/fv3.restart export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt export INPUT_TYPE='restart' diff --git a/reg_tests/chgres_cube/c96.gefs.grib2.sh b/reg_tests/chgres_cube/c96.gefs.grib2.sh index 937b42395..a4dabc3cd 100755 --- a/reg_tests/chgres_cube/c96.gefs.grib2.sh +++ b/reg_tests/chgres_cube/c96.gefs.grib2.sh @@ -13,8 +13,9 @@ export DATA=$OUTDIR/c96_gefs_grib2 rm -fr $DATA export CRES=96 -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/gefs.grib2 export GRIB2_FILE_INPUT=gec00.t06z.pgrb2abf00 diff --git a/reg_tests/chgres_cube/c96.gfs.nemsio.sh b/reg_tests/chgres_cube/c96.gfs.nemsio.sh index 7b36c23e1..2eb8cb297 100755 --- a/reg_tests/chgres_cube/c96.gfs.nemsio.sh +++ b/reg_tests/chgres_cube/c96.gfs.nemsio.sh @@ -12,8 +12,10 @@ set -x export DATA=$OUTDIR/c96_gfs_nemsio rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/gfs.nemsio export ATM_FILES_INPUT=gfnanl.gdas.2017071700 export SFC_FILES_INPUT=sfnanl.gdas.2017071700 diff --git a/reg_tests/chgres_cube/c96.gfs.sigio.sh b/reg_tests/chgres_cube/c96.gfs.sigio.sh index 99b7909e9..c4a45fcc6 100755 --- a/reg_tests/chgres_cube/c96.gfs.sigio.sh +++ b/reg_tests/chgres_cube/c96.gfs.sigio.sh @@ -18,8 +18,10 @@ fi export DATA=$OUTDIR/c96_gfs_sigio rm -fr $DATA -export FIXfv3=${HOMEreg}/fix/C96 -export FIXsfc=${FIXfv3}/fix_sfc +export CRES=96 +export ocn=100 +export FIXfv3=${HOMEreg}/fix/C${CRES} + export COMIN=${HOMEreg}/input_data/gfs.sigio export ATM_FILES_INPUT=gdas.t00z.sanl export SFC_FILES_INPUT=gdas.t00z.sfcanl diff --git a/reg_tests/chgres_cube/c96.regional.sh b/reg_tests/chgres_cube/c96.regional.sh deleted file mode 100755 index 6ba6f33da..000000000 --- a/reg_tests/chgres_cube/c96.regional.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -#----------------------------------------------------------------------------- -# Invoke chgres to create C96 regional coldstart files, including a lateral -# boundary file, using FV3 gaussian nemsio files as input. The -# coldstart files are then compared to baseline files using the 'nccmp' -# utility. -# -# This script is run by the machine specific driver script. -#----------------------------------------------------------------------------- - -set -x - -export DATA=$OUTDIR/c96_regional -rm -fr $DATA - -export FIXfv3=${HOMEreg}/fix/C96.regional -export FIXsfc=${FIXfv3}/fix_sfc -export OROG_FILES_TARGET_GRID="C96_oro_data.tile7.nc" -export COMIN=${HOMEreg}/input_data/fv3.nemsio -export ATM_FILES_INPUT=gfs.t12z.atmf000.nemsio -export SFC_FILES_INPUT=gfs.t12z.sfcf000.nemsio -export VCOORD_FILE=${HOMEufs}/fix/am/global_hyblev.l64.txt -export REGIONAL=1 -export HALO_BLEND=0 -export HALO_BNDY=4 - -export CDATE=2019070412 - -export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} - -NCCMP=${NCCMP:-$(which nccmp)} - -#----------------------------------------------------------------------------- -# Invoke chgres program. -#----------------------------------------------------------------------------- - -echo "Starting at: " `date` - -${HOMEufs}/ush/chgres_cube.sh - -iret=$? -if [ $iret -ne 0 ]; then - set +x - echo "<<< C96 REGIONAL TEST FAILED. <<<" - exit $iret -fi - -echo "Ending at: " `date` - -#----------------------------------------------------------------------------- -# Compare output from chgres to baseline set of data. -#----------------------------------------------------------------------------- - -cd $DATA - -mv out.sfc.tile7.nc out.sfc.tile1.nc -mv out.atm.tile7.nc out.atm.tile1.nc - -test_failed=0 -for files in *.nc -do - if [ -f $files ]; then - echo CHECK $files - $NCCMP -dmfqS $files $HOMEreg/baseline_data/c96_regional/$files - iret=$? - if [ $iret -ne 0 ]; then - test_failed=1 - fi - fi -done - -set +x -if [ $test_failed -ne 0 ]; then - echo "<<< C96 REGIONAL TEST FAILED. >>>" - if [ "$UPDATE_BASELINE" = "TRUE" ]; then - $HOMEufs/reg_tests/update_baseline.sh $HOMEreg "c96_regional" $commit_num - fi -else - echo "<<< C96 REGIONAL TEST PASSED. >>>" -fi - -exit 0 diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index f0a35a397..406e4bb22 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -35,7 +35,7 @@ module list export OUTDIR="${WORK_DIR:-/scratch2/NCEPDEV/stmp1/$LOGNAME}" export OUTDIR="${OUTDIR}/reg-tests/chgres-cube" -PROJECT_CODE="${PROJECT_CODE:-nems}" +PROJECT_CODE="${PROJECT_CODE:-fv3-cpu}" QUEUE="${QUEUE:-batch}" #----------------------------------------------------------------------------- @@ -110,112 +110,103 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.nemsio \ -o $LOG_FILE -e $LOG_FILE ./c96.gfs.nemsio.sh) -#----------------------------------------------------------------------------- -# Initialize regional C96 using FV3 gaussian nemsio files. -#----------------------------------------------------------------------------- - -LOG_FILE=consistency.log06 -export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - -o $LOG_FILE -e $LOG_FILE ./c96.regional.sh) - #----------------------------------------------------------------------------- # Initialize C96 using FV3 gaussian netcdf files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log07 +LOG_FILE=consistency.log06 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST7=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ +TEST6=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ -o $LOG_FILE -e $LOG_FILE ./c96.fv3.netcdf.sh) #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log08 +LOG_FILE=consistency.log07 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ +TEST7=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ -o $LOG_FILE -e $LOG_FILE ./c192.gfs.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 25-KM USING GFS GRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log09 +LOG_FILE=consistency.log08 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST9=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.grib2.conus \ +TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 3-KM USING HRRR GRIB2 file WITH GFS PHYSICS. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log10 +LOG_FILE=consistency.log09 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST10=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.gfssdf.grib2.conus \ +TEST9=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.gfssdf.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./3km.conus.hrrr.gfssdf.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 3-KM USING HRRR GRIB2 file WITH GSD PHYSICS AND SFC VARS FROM FILE. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log11 +LOG_FILE=consistency.log10 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST11=$(sbatch --parsable --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.newsfc.grib2.conus \ +TEST10=$(sbatch --parsable --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.newsfc.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./3km.conus.hrrr.newsfc.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM USING NAM GRIB2 file WITH GFS PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log12 +LOG_FILE=consistency.log11 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST12=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.nam.grib2.conus \ +TEST11=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.nam.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./13km.conus.nam.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM USING RAP GRIB2 file WITH GSD PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log13 +LOG_FILE=consistency.log12 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST13=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.rap.grib2.conus \ +TEST12=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.rap.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./13km.conus.rap.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM NA USING NCEI GFS GRIB2 file WITH GFS PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log14 +LOG_FILE=consistency.log13 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST14=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.na.gfs.ncei.grib2.conus \ +TEST13=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.na.gfs.ncei.grib2.conus \ -o $LOG_FILE -e $LOG_FILE ./13km.na.gfs.ncei.grib2.sh) #----------------------------------------------------------------------------- # Initialize C96 WAM IC using FV3 gaussian netcdf files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log15 +LOG_FILE=consistency.log14 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST15=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf2wam \ +TEST14=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf2wam \ -o $LOG_FILE -e $LOG_FILE ./c96.fv3.netcdf2wam.sh) #----------------------------------------------------------------------------- # Initialize CONUS 25-KM USING GFS PGRIB2+BGRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log16 +LOG_FILE=consistency.log15 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST16=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ +TEST15=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.pbgrib2.sh) #----------------------------------------------------------------------------- # Initialize global C96 using GEFS GRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log17 +LOG_FILE=consistency.log16 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ +TEST16=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ -o $LOG_FILE -e $LOG_FILE ./c96.gefs.grib2.sh) #----------------------------------------------------------------------------- @@ -224,7 +215,7 @@ TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_ LOG_FILE=consistency.log sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d\ - afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF + afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF #!/bin/bash grep -a '<<<' $LOG_FILE* > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.hercules.sh b/reg_tests/chgres_cube/driver.hercules.sh index 177943574..d9a6a8358 100755 --- a/reg_tests/chgres_cube/driver.hercules.sh +++ b/reg_tests/chgres_cube/driver.hercules.sh @@ -34,7 +34,7 @@ module list ulimit -s unlimited -export OUTDIR="${WORK_DIR:-/work/noaa/stmp/$LOGNAME}" +export OUTDIR="${WORK_DIR:-/work2/noaa/stmp/$LOGNAME}" export OUTDIR="${OUTDIR}/reg-tests/chgres-cube" PROJECT_CODE="${PROJECT_CODE:-fv3-cpu}" @@ -117,13 +117,13 @@ TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:15:00 -A --open-mode=append -o $LOG_FILE5 -e $LOG_FILE5 ./c96.gfs.nemsio.sh) #----------------------------------------------------------------------------- -# Initialize regional C96 using FV3 gaussian nemsio files. +# Initialize C96 using GEFS GRIB2 file. #----------------------------------------------------------------------------- LOG_FILE6=${LOG_FILE}06 export OMP_NUM_THREADS=1 # needs to match cpus-per-task -TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - --open-mode=append -o $LOG_FILE6 -e $LOG_FILE6 ./c96.regional.sh) +TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ + --open-mode=append -o $LOG_FILE6 -e $LOG_FILE6 ./c96.gefs.grib2.sh) #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 files. @@ -215,22 +215,13 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST16=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 --mem=75G -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2 \ --open-mode=append -o $LOG_FILE16 -e $LOG_FILE16 ./25km.conus.gfs.pbgrib2.sh) -#----------------------------------------------------------------------------- -# Initialize C96 using GEFS GRIB2 file. -#----------------------------------------------------------------------------- - -LOG_FILE17=${LOG_FILE}17 -export OMP_NUM_THREADS=1 # needs to match cpus-per-task -TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ - --open-mode=append -o $LOG_FILE17 -e $LOG_FILE17 ./c96.gefs.grib2.sh) - #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE \ - -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF + -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF #!/bin/bash grep -a '<<<' ${LOG_FILE}* > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index a6fed567d..2143f2b4d 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -111,112 +111,103 @@ export OMP_NUM_THREADS=1 TEST5=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.nemsio \ --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.gfs.nemsio.sh) -#----------------------------------------------------------------------------- -# Initialize regional C96 using FV3 gaussian nemsio files. -#----------------------------------------------------------------------------- - -LOG_FILE=consistency.log06 -export OMP_NUM_THREADS=1 -TEST6=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.regional.sh) - #----------------------------------------------------------------------------- # Initialize C96 using FV3 gaussian netcdf files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log07 +LOG_FILE=consistency.log06 export OMP_NUM_THREADS=1 -TEST7=$(sbatch --parsable --partition=xjet --nodes=2 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ +TEST6=$(sbatch --parsable --partition=xjet --nodes=2 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.fv3.netcdf.sh) #----------------------------------------------------------------------------- # Initialize C192 using GFS GRIB2 data. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log08 +LOG_FILE=consistency.log07 export OMP_NUM_THREADS=1 -TEST8=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ +TEST7=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ --exclusive -o $LOG_FILE -e $LOG_FILE ./c192.gfs.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 25-KM USING GFS GRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log09 +LOG_FILE=consistency.log08 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST9=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.grib2.conus \ +TEST8=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 3-KM USING HRRR GRIB2 file WITH GFS PHYSICS. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log10 +LOG_FILE=consistency.log09 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST10=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.gfssdf.grib2.conus \ +TEST9=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.gfssdf.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./3km.conus.hrrr.gfssdf.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 3-KM USING HRRR GRIB2 file WITH GSD PHYSICS AND SFC VARS FROM FILE. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log11 +LOG_FILE=consistency.log10 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST11=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=3 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.newsfc.grib2.conus \ +TEST10=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=3 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 3km.conus.hrrr.newsfc.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./3km.conus.hrrr.newsfc.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM USING NAM GRIB2 file WITH GFS PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log12 +LOG_FILE=consistency.log11 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST12=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.nam.grib2.conus \ +TEST11=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.nam.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./13km.conus.nam.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM USING RAP GRIB2 file WITH GSD PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log13 +LOG_FILE=consistency.log12 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST13=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.rap.grib2.conus \ +TEST12=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 13km.conus.rap.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./13km.conus.rap.grib2.sh) #----------------------------------------------------------------------------- # Initialize CONUS 13-KM NA USING NCEI GFS GRIB2 file WITH GFS PHYSICS . #----------------------------------------------------------------------------- -LOG_FILE=consistency.log14 +LOG_FILE=consistency.log13 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST14=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 13km.na.gfs.ncei.grib2.conus \ +TEST13=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 13km.na.gfs.ncei.grib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./13km.na.gfs.ncei.grib2.sh) #----------------------------------------------------------------------------- # Initialize C96 WAM IC using FV3 gaussian netcdf files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log15 +LOG_FILE=consistency.log14 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST15=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf2wam \ +TEST14=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=2 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf2wam \ --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.fv3.netcdf2wam.sh) #----------------------------------------------------------------------------- # Initialize CONUS 25-KM USING GFS PGRIB2+BGRIB2 files. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log16 +LOG_FILE=consistency.log15 export OMP_NUM_THREADS=1 # should match cpus-per-task -TEST16=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ +TEST15=$(sbatch --parsable --partition=xjet --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2.conus \ --exclusive -o $LOG_FILE -e $LOG_FILE ./25km.conus.gfs.pbgrib2.sh) #----------------------------------------------------------------------------- # Initialize C96 using GEFS GRIB2 data. #----------------------------------------------------------------------------- -LOG_FILE=consistency.log17 +LOG_FILE=consistency.log16 export OMP_NUM_THREADS=1 -TEST17=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ +TEST16=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ --exclusive -o $LOG_FILE -e $LOG_FILE ./c96.gefs.grib2.sh) #----------------------------------------------------------------------------- @@ -226,7 +217,7 @@ TEST17=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:0 LOG_FILE=consistency.log sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d\ - afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF + afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF #!/bin/bash grep -a '<<<' $LOG_FILE* > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh index 66ef97d6c..15660b068 100755 --- a/reg_tests/chgres_cube/driver.orion.sh +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -115,13 +115,13 @@ TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:15:00 -A --open-mode=append -o $LOG_FILE5 -e $LOG_FILE5 ./c96.gfs.nemsio.sh) #----------------------------------------------------------------------------- -# Initialize regional C96 using FV3 gaussian nemsio files. +# Initialize C96 using GEFS GRIB2 file. #----------------------------------------------------------------------------- LOG_FILE6=${LOG_FILE}06 export OMP_NUM_THREADS=1 # needs to match cpus-per-task -TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - --open-mode=append -o $LOG_FILE6 -e $LOG_FILE6 ./c96.regional.sh) +TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ + --open-mode=append -o $LOG_FILE6 -e $LOG_FILE6 ./c96.gefs.grib2.sh) #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 files. @@ -213,22 +213,13 @@ export OMP_NUM_THREADS=1 # should match cpus-per-task TEST16=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 --mem=75G -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J 25km.conus.gfs.pbgrib2 \ --open-mode=append -o $LOG_FILE16 -e $LOG_FILE16 ./25km.conus.gfs.pbgrib2.sh) -#----------------------------------------------------------------------------- -# Initialize C96 using GEFS GRIB2 file. -#----------------------------------------------------------------------------- - -LOG_FILE17=${LOG_FILE}17 -export OMP_NUM_THREADS=1 # needs to match cpus-per-task -TEST17=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 --mem=75G -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c96.gefs.grib2 \ - --open-mode=append -o $LOG_FILE17 -e $LOG_FILE17 ./c96.gefs.grib2.sh) - #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE \ - -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF + -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF #!/bin/bash grep -a '<<<' ${LOG_FILE}* > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.wcoss2.sh b/reg_tests/chgres_cube/driver.wcoss2.sh index 6ae0efb48..2638b3f6d 100755 --- a/reg_tests/chgres_cube/driver.wcoss2.sh +++ b/reg_tests/chgres_cube/driver.wcoss2.sh @@ -113,13 +113,13 @@ TEST5=$(qsub -V -o $LOG_FILE -e $LOG_FILE -q $QUEUE -A $PROJECT_CODE -l walltime -N c96.gfs.nemsio -l select=1:ncpus=6:ompthreads=1:mem=35GB $PWD/c96.gfs.nemsio.sh) #----------------------------------------------------------------------------- -# Initialize regional C96 using FV3 gaussian nemsio files. +# Initialize global C96 using GEFS GRIB2 files. #----------------------------------------------------------------------------- LOG_FILE=consistency.log06 export APRUN="mpiexec -n 6 -ppn 6 --cpu-bind core" TEST6=$(qsub -V -o $LOG_FILE -e $LOG_FILE -q $QUEUE -A $PROJECT_CODE -l walltime=00:05:00 \ - -N c96.regional -l select=1:ncpus=6:ompthreads=1:mem=35GB $PWD/c96.regional.sh) + -N c96.gefs.grib2 -l select=1:ncpus=6:ompthreads=1:mem=15GB $PWD/c96.gefs.grib2.sh) #----------------------------------------------------------------------------- # Initialize C96 using FV3 gaussian netcdf files. @@ -211,15 +211,6 @@ export APRUN="mpiexec -n 6 -ppn 6 --cpu-bind core" TEST16=$(qsub -V -o $LOG_FILE -e $LOG_FILE -q $QUEUE -A $PROJECT_CODE -l walltime=00:05:00 \ -N 25km.conus.gfs.pbgrib2.conus -l select=1:ncpus=6:ompthreads=1:mem=15GB $PWD/25km.conus.gfs.pbgrib2.sh) -#----------------------------------------------------------------------------- -# Initialize global C96 using GEFS GRIB2 files. -#----------------------------------------------------------------------------- - -LOG_FILE=consistency.log17 -export APRUN="mpiexec -n 6 -ppn 6 --cpu-bind core" -TEST17=$(qsub -V -o $LOG_FILE -e $LOG_FILE -q $QUEUE -A $PROJECT_CODE -l walltime=00:05:00 \ - -N c96.gefs.grib2 -l select=1:ncpus=6:ompthreads=1:mem=15GB $PWD/c96.gefs.grib2.sh) - #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- @@ -227,7 +218,7 @@ TEST17=$(qsub -V -o $LOG_FILE -e $LOG_FILE -q $QUEUE -A $PROJECT_CODE -l walltim LOG_FILE=consistency.log qsub -V -o ${LOG_FILE} -e ${LOG_FILE} -q $QUEUE -A $PROJECT_CODE -l walltime=00:01:00 \ -N chgres_summary -l select=1:ncpus=1:mem=100MB \ - -W depend=afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16:$TEST17 << EOF + -W depend=afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6:$TEST7:$TEST8:$TEST9:$TEST10:$TEST11:$TEST12:$TEST13:$TEST14:$TEST15:$TEST16 << EOF #!/bin/bash cd ${this_dir} grep -a '<<<' ${LOG_FILE}?? | grep -v echo > $SUM_FILE diff --git a/reg_tests/grid_gen/driver.hercules.sh b/reg_tests/grid_gen/driver.hercules.sh index 3c46a2d45..5f4a81478 100755 --- a/reg_tests/grid_gen/driver.hercules.sh +++ b/reg_tests/grid_gen/driver.hercules.sh @@ -30,7 +30,7 @@ module list set -x ulimit -s unlimited -export WORK_DIR="${WORK_DIR:-/work/noaa/stmp/$LOGNAME}" +WORK_DIR="${WORK_DIR:-/work2/noaa/stmp/$LOGNAME}" export WORK_DIR="${WORK_DIR}/reg-tests/grid-gen" QUEUE="${QUEUE:-batch}" PROJECT_CODE=${PROJECT_CODE:-fv3-cpu} diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index 13ebfaae0..b08bd79bd 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -41,7 +41,7 @@ if(GBLEVENTS) add_subdirectory(gblevents.fd) endif() if(CPLD_GRIDGEN) -add_subdirectory(cpld_gridgen.fd) + add_subdirectory(cpld_gridgen.fd) endif() if(WEIGHT_GEN) add_subdirectory(weight_gen.fd) diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 854bcb622..44431f59c 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -70,10 +70,11 @@ module model_grid type(esmf_field), public :: longitude_w_input_grid !< longitude of 'west' edge of grid !! box, input grid - type(esmf_field), public :: landmask_target_grid - !< land mask target grid - '1' land; - !! '0' non-land + !< land mask target grid - '1' some or all land; + !! '0' all non-land + type(esmf_field), public :: land_frac_target_grid + !< land fraction, target grid type(esmf_field), public :: latitude_target_grid !< latitude of grid center, target grid type(esmf_field), public :: latitude_s_target_grid @@ -91,8 +92,8 @@ module model_grid !< longitude of 'west' edge of grid !! box, target grid type(esmf_field), public :: seamask_target_grid - !< sea mask target grid - '1' non-land; - !! '0' land + !< sea mask target grid - '1' some or all non-land; + !! '0' all land type(esmf_field), public :: terrain_target_grid !< terrain height target grid @@ -415,8 +416,6 @@ subroutine define_input_grid_mosaic(localpet, npets) integer :: extra, error, ncid integer, allocatable :: decomptile(:,:) - integer(esmf_kind_i8), allocatable :: landmask_one_tile(:,:) - real(esmf_kind_r8), allocatable :: latitude_one_tile(:,:) real(esmf_kind_r8), allocatable :: latitude_s_one_tile(:,:) real(esmf_kind_r8), allocatable :: latitude_w_one_tile(:,:) @@ -551,7 +550,6 @@ subroutine define_input_grid_mosaic(localpet, npets) allocate(latitude_one_tile(i_input,j_input)) allocate(latitude_s_one_tile(i_input,jp1_input)) allocate(latitude_w_one_tile(ip1_input,j_input)) - allocate(landmask_one_tile(i_input,j_input)) else allocate(longitude_one_tile(0,0)) allocate(longitude_s_one_tile(0,0)) @@ -559,7 +557,6 @@ subroutine define_input_grid_mosaic(localpet, npets) allocate(latitude_one_tile(0,0)) allocate(latitude_s_one_tile(0,0)) allocate(latitude_w_one_tile(0,0)) - allocate(landmask_one_tile(0,0)) endif do tile = 1, num_tiles_input_grid @@ -601,7 +598,6 @@ subroutine define_input_grid_mosaic(localpet, npets) deallocate(latitude_one_tile) deallocate(latitude_s_one_tile) deallocate(latitude_w_one_tile) - deallocate(landmask_one_tile) end subroutine define_input_grid_mosaic @@ -906,6 +902,7 @@ subroutine define_target_grid(localpet, npets) integer(esmf_kind_i8), allocatable :: landmask_one_tile(:,:) integer(esmf_kind_i8), allocatable :: seamask_one_tile(:,:) + real(esmf_kind_r8), allocatable :: land_frac_one_tile(:,:) real(esmf_kind_r8), allocatable :: latitude_one_tile(:,:) real(esmf_kind_r8), allocatable :: latitude_s_one_tile(:,:) real(esmf_kind_r8), allocatable :: latitude_w_one_tile(:,:) @@ -993,6 +990,14 @@ subroutine define_target_grid(localpet, npets) ! seamask (1 - non-land, 0 -land). Read lat/lon on target grid. !----------------------------------------------------------------------- + print*,"- CALL FieldCreate FOR TARGET GRID LAND FRACTION." + land_frac_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="target_grid_landmask", rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", error) + print*,"- CALL FieldCreate FOR TARGET GRID LANDMASK." landmask_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_I8, & @@ -1071,6 +1076,7 @@ subroutine define_target_grid(localpet, npets) call error_handler("IN FieldCreate", error) if (localpet == 0) then + allocate(land_frac_one_tile(i_target,j_target)) allocate(landmask_one_tile(i_target,j_target)) allocate(seamask_one_tile(i_target,j_target)) allocate(latitude_one_tile(i_target,j_target)) @@ -1081,6 +1087,7 @@ subroutine define_target_grid(localpet, npets) allocate(longitude_w_one_tile(ip1_target,j_target)) allocate(terrain_one_tile(i_target,j_target)) else + allocate(land_frac_one_tile(0,0)) allocate(landmask_one_tile(0,0)) allocate(seamask_one_tile(0,0)) allocate(longitude_one_tile(0,0)) @@ -1096,14 +1103,22 @@ subroutine define_target_grid(localpet, npets) if (localpet == 0) then the_file = trim(orog_dir_target_grid) // trim(orog_files_target_grid(tile)) call get_model_mask_terrain(trim(the_file), i_target, j_target, landmask_one_tile, & - terrain_one_tile) - seamask_one_tile = 0 - where(landmask_one_tile == 0) seamask_one_tile = 1 + terrain_one_tile, land_frac_one_tile) + + seamask_one_tile = 0 ! all land + where(floor(land_frac_one_tile) == 0) seamask_one_tile = 1 ! at least some non-land. + landmask_one_tile = 0 ! all non-land + where(ceiling(land_frac_one_tile) == 1) landmask_one_tile = 1 ! at least some land + call get_model_latlons(mosaic_file_target_grid, orog_dir_target_grid, num_tiles_target_grid, tile, & i_target, j_target, ip1_target, jp1_target, latitude_one_tile, & latitude_s_one_tile, latitude_w_one_tile, longitude_one_tile, & longitude_s_one_tile, longitude_w_one_tile) endif + print*,"- CALL FieldScatter FOR TARGET GRID LAND FRACTION. TILE IS: ", tile + call ESMF_FieldScatter(land_frac_target_grid, land_frac_one_tile, rootpet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LANDMASK. TILE IS: ", tile call ESMF_FieldScatter(landmask_target_grid, landmask_one_tile, rootpet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -1142,6 +1157,7 @@ subroutine define_target_grid(localpet, npets) call error_handler("IN FieldScatter", error) enddo + deallocate(land_frac_one_tile) deallocate(landmask_one_tile) deallocate(seamask_one_tile) deallocate(longitude_one_tile) @@ -1322,8 +1338,9 @@ end subroutine get_model_latlons !! @param [in] jdim "j" dimension of tile !! @param [out] mask land mask of tile !! @param [out] terrain terrain height of tile +!! @param [out] land_frac The fraction of the grid point that is land. !! @author George Gayno NCEP/EMC - subroutine get_model_mask_terrain(orog_file, idim, jdim, mask, terrain) + subroutine get_model_mask_terrain(orog_file, idim, jdim, mask, terrain, land_frac) use netcdf @@ -1335,6 +1352,7 @@ subroutine get_model_mask_terrain(orog_file, idim, jdim, mask, terrain) integer(esmf_kind_i8), intent(out) :: mask(idim,jdim) real(esmf_kind_i8), intent(out) :: terrain(idim,jdim) + real(esmf_kind_i8), intent(out) :: land_frac(idim,jdim) integer :: error, lat, lon integer :: ncid, id_dim, id_var @@ -1381,6 +1399,13 @@ subroutine get_model_mask_terrain(orog_file, idim, jdim, mask, terrain) call netcdf_err(error, 'reading orog_raw') terrain = dummy + print*,"- READ LAND FRACTION." + error=nf90_inq_varid(ncid, 'land_frac', id_var) + call netcdf_err(error, 'reading land_frac id') + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, 'reading orog_raw') + land_frac = dummy + error = nf90_close(ncid) deallocate (dummy) @@ -1412,6 +1437,7 @@ subroutine cleanup_input_target_grid_data if (ESMF_FieldIsCreated(longitude_w_input_grid)) then call ESMF_FieldDestroy(longitude_w_input_grid, rc=rc) endif + call ESMF_FieldDestroy(land_frac_target_grid, rc=rc) call ESMF_FieldDestroy(landmask_target_grid, rc=rc) call ESMF_FieldDestroy(latitude_target_grid, rc=rc) if (ESMF_FieldIsCreated(latitude_s_target_grid)) then diff --git a/sorc/chgres_cube.fd/program_setup.F90 b/sorc/chgres_cube.fd/program_setup.F90 index 68c6c0308..efec5e3a4 100644 --- a/sorc/chgres_cube.fd/program_setup.F90 +++ b/sorc/chgres_cube.fd/program_setup.F90 @@ -89,8 +89,10 @@ module program_setup integer, public :: regional = 0 !< For regional target grids. When '1' remove boundary halo region from atmospheric/surface data and !! output atmospheric boundary file. When '2' output boundary file only. Default is '0' (global grids). integer, public :: halo_bndy = 0 !< Number of row/cols of lateral halo, where pure lateral bndy conditions are applied (regional target grids). - integer, public :: halo_blend = 0 !< Number of row/cols of blending halo, where model tendencies and lateral boundary tendencies are applied. Regional target grids only. - integer, public :: nsoill_out = 4 !< Number of soil levels desired in the output data. chgres_cube can interpolate from 9 input to 4 output levels. DEFAULT: 4. + integer, public :: halo_blend = 0 !< Number of row/cols of blending halo, where model + !! tendencies and lateral boundary tendencies are applied. Regional target grids only. + integer, public :: nsoill_out = 4 !< Number of soil levels desired in the output data. + !! chgres_cube can interpolate from 9 input to 4 output levels. DEFAULT: 4. logical, public :: convert_atm = .false. !< Convert atmospheric data when true. logical, public :: convert_nst = .false. !< Convert nst data when true. @@ -158,7 +160,6 @@ subroutine read_setup_namelist(filename) integer :: is, ie, ierr - namelist /config/ varmap_file, & mosaic_file_target_grid, & fix_dir_target_grid, & @@ -224,7 +225,7 @@ subroutine read_setup_namelist(filename) if (ie == 0) then call error_handler("CANT DETERMINE CRES FROM OROG FILE.", 1) endif - + cres_target_grid = orog_files_target_grid(1)(is:ie) if (.not. convert_sfc .and. .not. convert_atm) then diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index 37ef6dc61..68a9d131a 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -29,7 +29,7 @@ module surface srflag_target_grid, soil_temp_target_grid, & seaice_depth_target_grid, snow_liq_equiv_target_grid, & seaice_skin_temp_target_grid, skin_temp_target_grid, & - snow_depth_target_grid, z0_target_grid, & + snow_depth_target_grid, & c_d_target_grid, c_0_target_grid, & d_conv_target_grid, dt_cool_target_grid, & ifd_target_grid, qrain_target_grid, & @@ -40,7 +40,11 @@ module surface xtts_target_grid, xzts_target_grid, & z_c_target_grid, zm_target_grid, & soilm_tot_target_grid, lai_target_grid, & - soilm_liq_target_grid + soilm_liq_target_grid, ice_temp_target_grid, & + snow_depth_at_ice_target_grid, & + z0_water_target_grid, & + z0_ice_target_grid, sst_target_grid, & + snow_liq_equiv_at_ice_target_grid use write_data, only : write_fv3_sfc_data_netcdf @@ -76,6 +80,9 @@ module surface !< gravity real, parameter, private :: hlice = 3.335E5 !< latent heat of fusion + + real(esmf_kind_r8), parameter, private :: missing = -1.e20_esmf_kind_r8 + !< flag for non-active points. type realptr_2d @@ -194,7 +201,7 @@ subroutine surface_driver(localpet) call calc_liq_soil_moisture !--------------------------------------------------------------------------------------------- -! Set z0 at land and sea ice. +! Set z0 at water and sea ice. !--------------------------------------------------------------------------------------------- call roughness @@ -219,6 +226,12 @@ subroutine surface_driver(localpet) if (convert_nst) call cleanup_input_nst_data +!--------------------------------------------------------------------------------------------- +! Update land mask for ice. +!--------------------------------------------------------------------------------------------- + + call update_landmask + !--------------------------------------------------------------------------------------------- ! Write data to file. !--------------------------------------------------------------------------------------------- @@ -346,6 +359,7 @@ subroutine interp(localpet) real(esmf_kind_r8), allocatable :: data_one_tile2(:,:) real(esmf_kind_r8), allocatable :: data_one_tile_3d(:,:,:) real(esmf_kind_r8), allocatable :: latitude_one_tile(:,:) + real(esmf_kind_r8), allocatable :: fice_target_one_tile(:,:) real(esmf_kind_r8), pointer :: seaice_fract_target_ptr(:,:) real(esmf_kind_r8), pointer :: srflag_target_ptr(:,:) real(esmf_kind_r8), pointer :: terrain_from_input_ptr(:,:) @@ -354,6 +368,7 @@ subroutine interp(localpet) real(esmf_kind_r8), pointer :: landmask_input_ptr(:,:) real(esmf_kind_r8), pointer :: veg_type_input_ptr(:,:) real(esmf_kind_r8), allocatable :: veg_type_target_one_tile(:,:) + real(esmf_kind_r8) :: ice_lim type(esmf_regridmethod_flag) :: method type(esmf_routehandle) :: regrid_bl_no_mask @@ -519,7 +534,7 @@ subroutine interp(localpet) where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1 mask_target_ptr = 0 - where (landmask_target_ptr == 1) mask_target_ptr = 1 + where (landmask_target_ptr == 1) mask_target_ptr = 1 ! some or all land. print*,"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND." terrain_from_input_grid_land = ESMF_FieldCreate(target_grid, & @@ -642,19 +657,27 @@ subroutine interp(localpet) enddo nullify(veg_type_target_ptr) endif + print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_all_land, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !----------------------------------------------------------------------- -! Next, determine the sea ice fraction on target grid. -! Interpolate. +! Next, determine the sea ice fraction on the fractional target grid. +! For fractional grids, the ice fraction is not scaled for the +! fraction of non-land. So if a point is 50% land and non-land, +! an ice frac of 100% means the entire non-land portion is ice covered. !----------------------------------------------------------------------- mask_input_ptr = 1 where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0 +!----------------------------------------------------------------------- +! Map to grid points that are partial or all non-land. That is +! indicated where seamask_target is '1'. +!----------------------------------------------------------------------- + mask_target_ptr = int(seamask_target_ptr,kind=esmf_kind_i4) method=ESMF_REGRIDMETHOD_CONSERVE @@ -727,21 +750,21 @@ subroutine interp(localpet) call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 91, & latitude=latitude_one_tile) endif - - print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile - call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldGather", rc) - +!------------------------------------------------------------------------------ +! To reduce the potenitally large number of target grid points with a very +! small amount of open water, set any point with ice between 95-100% to 100%. +!------------------------------------------------------------------------------ + + ice_lim = 0.95_esmf_kind_r8 + if (localpet == 0) then do j = 1, j_target do i = 1, i_target - if (data_one_tile(i,j) > 1.0_esmf_kind_r8) then + if (data_one_tile(i,j) > ice_lim) then data_one_tile(i,j) = 1.0_esmf_kind_r8 endif if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8 - if (data_one_tile(i,j) >= 0.15_esmf_kind_r8) mask_target_one_tile(i,j) = 2 enddo enddo endif @@ -751,11 +774,6 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) - print*,"- CALL FieldScatter FOR TARGET LANDMASK TILE: ", tile - call ESMF_FieldScatter(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldScatter", rc) - enddo deallocate(latitude_one_tile) @@ -773,16 +791,10 @@ subroutine interp(localpet) mask_input_ptr = 0 where (nint(landmask_input_ptr) == 2) mask_input_ptr = 1 - print*,"- CALL FieldGet FOR TARGET land sea mask." - call ESMF_FieldGet(landmask_target_grid, & - farrayPtr=landmask_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldGet", rc) - mask_target_ptr = 0 do j = clb_target(2), cub_target(2) do i = clb_target(1), cub_target(1) - if (landmask_target_ptr(i,j) == 2) mask_target_ptr(i,j) = 1 + if (seaice_fract_target_ptr(i,j) > 0.0) mask_target_ptr(i,j) = 1 enddo enddo @@ -791,7 +803,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridStore for 3d seaice fields." call ESMF_FieldRegridStore(soil_temp_input_grid, & - soil_temp_target_grid, & + ice_temp_target_grid, & srcmaskvalues=(/0/), & dstmaskvalues=(/0/), & polemethod=ESMF_POLEMETHOD_NONE, & @@ -801,6 +813,7 @@ subroutine interp(localpet) routehandle=regrid_seaice, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) @@ -810,20 +823,23 @@ subroutine interp(localpet) bundle_seaice_input = ESMF_FieldBundleCreate(name="sea ice input", rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleCreate", rc) - call ESMF_FieldBundleAdd(bundle_seaice_target, (/seaice_depth_target_grid, snow_depth_target_grid, & - snow_liq_equiv_target_grid, seaice_skin_temp_target_grid, & - soil_temp_target_grid/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + + call ESMF_FieldBundleAdd(bundle_seaice_target, (/seaice_depth_target_grid, snow_depth_at_ice_target_grid, & + snow_liq_equiv_at_ice_target_grid, seaice_skin_temp_target_grid, & + ice_temp_target_grid/), rc=rc) + + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleAdd", rc) + call ESMF_FieldBundleAdd(bundle_seaice_input, (/seaice_depth_input_grid, snow_depth_input_grid, & snow_liq_equiv_input_grid, seaice_skin_temp_input_grid, & soil_temp_input_grid/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleAdd", rc) + call ESMF_FieldBundleGet(bundle_seaice_target,fieldCount=num_fields,rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleGet", rc) - allocate(search_nums(num_fields)) allocate(dozero(num_fields)) @@ -841,16 +857,22 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleDestroy", rc) + if (localpet == 0) then + allocate(fice_target_one_tile(i_target,j_target)) + else + allocate(fice_target_one_tile(0,0)) + endif + do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile - call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) + call ESMF_FieldGather(seaice_fract_target_grid, fice_target_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then - where(mask_target_one_tile == 1) mask_target_one_tile = 0 - where(mask_target_one_tile == 2) mask_target_one_tile = 1 + mask_target_one_tile = 0 + where(fice_target_one_tile > 0.0) mask_target_one_tile = 1 call search_many(num_fields,bundle_seaice_target,tile, search_nums,localpet, & mask=mask_target_one_tile) else @@ -860,6 +882,7 @@ subroutine interp(localpet) enddo deallocate(search_nums) + call ESMF_FieldBundleDestroy(bundle_seaice_target,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldBundleDestroy", rc) @@ -870,21 +893,26 @@ subroutine interp(localpet) call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- -! Now interpolate water fields. +! Now interpolate open water fields. !--------------------------------------------------------------------------------------------- mask_input_ptr = 0 where (nint(landmask_input_ptr) == 0) mask_input_ptr = 1 +!--------------------------------------------------------------------------------------------- +! Set target mask - want points with at least some open water. +!--------------------------------------------------------------------------------------------- + mask_target_ptr = 0 - where (landmask_target_ptr == 0) mask_target_ptr = 1 + where (seamask_target_ptr == 1) mask_target_ptr = 1 ! some or all non-land. + where (seaice_fract_target_ptr == 1.0_esmf_kind_r8) mask_target_ptr = 0 ! all ice. method=ESMF_REGRIDMETHOD_CONSERVE isrctermprocessing = 1 print*,"- CALL FieldRegridStore for water fields." call ESMF_FieldRegridStore(skin_temp_input_grid, & - skin_temp_target_grid, & + sst_target_grid, & srcmaskvalues=(/0/), & dstmaskvalues=(/0/), & polemethod=ESMF_POLEMETHOD_NONE, & @@ -903,9 +931,12 @@ subroutine interp(localpet) bundle_water_input = ESMF_FieldBundleCreate(name="water input", rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleCreate", rc) - call ESMF_FieldBundleAdd(bundle_water_target, (/skin_temp_target_grid, z0_target_grid/), rc=rc) + + call ESMF_FieldBundleAdd(bundle_water_target, (/sst_target_grid, z0_water_target_grid/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleAdd", rc) + call ESMF_FieldBundleAdd(bundle_water_input, (/skin_temp_input_grid, z0_input_grid/), rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleAdd", rc) @@ -964,8 +995,13 @@ subroutine interp(localpet) do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET SEAMASK TILE: ", tile + call ESMF_FieldGather(seamask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile - call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) + call ESMF_FieldGather(seaice_fract_target_grid, fice_target_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) @@ -974,11 +1010,12 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) +! Mask must be points with some water, but no ice. if (localpet == 0) then allocate(water_target_one_tile(i_target,j_target)) water_target_one_tile = 0 - where(mask_target_one_tile == 0) water_target_one_tile = 1 - + where(mask_target_one_tile == 1) water_target_one_tile = 1 ! some or all non-land. + where(fice_target_one_tile == 1.0_esmf_kind_r8) water_target_one_tile = 0 ! all ice call search_many(num_fields,bundle_water_target, tile,search_nums,localpet, & latitude=latitude_one_tile,mask=water_target_one_tile) else @@ -989,7 +1026,7 @@ subroutine interp(localpet) enddo - deallocate(latitude_one_tile,search_nums) + deallocate(latitude_one_tile,search_nums,fice_target_one_tile) call ESMF_FieldBundleDestroy(bundle_water_target,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -1008,7 +1045,7 @@ subroutine interp(localpet) where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1 mask_target_ptr = 0 - where (landmask_target_ptr == 1) mask_target_ptr = 1 + where (landmask_target_ptr == 1) mask_target_ptr = 1 ! some or all land. method=ESMF_REGRIDMETHOD_CONSERVE isrctermprocessing = 1 @@ -1058,7 +1095,6 @@ subroutine interp(localpet) call ESMF_FieldBundleDestroy(bundle_allland_input,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldBundleDestroy", rc) - do tile = 1, num_tiles_target_grid @@ -1070,7 +1106,7 @@ subroutine interp(localpet) if (localpet == 0) then allocate(land_target_one_tile(i_target,j_target)) land_target_one_tile = 0 - where(mask_target_one_tile == 1) land_target_one_tile = 1 + where(mask_target_one_tile == 1) land_target_one_tile = 1 ! some or all land. call search_many(num_fields,bundle_allland_target, & tile,search_nums,localpet, mask=land_target_one_tile) @@ -1101,8 +1137,6 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,'land ice check ',veg_type_landice_input - mask_input_ptr = 0 where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 1 @@ -1237,8 +1271,8 @@ subroutine interp(localpet) where (nint(veg_type_input_ptr) == veg_type_landice_input) mask_input_ptr = 0 mask_target_ptr = 0 - where (landmask_target_ptr == 1) mask_target_ptr = 1 - where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0 + where (landmask_target_ptr == 1) mask_target_ptr = 1 ! some or all land. + where (nint(veg_type_target_ptr) == veg_type_landice_target) mask_target_ptr = 0 ! land ice. method=ESMF_REGRIDMETHOD_NEAREST_STOD isrctermprocessing = 1 @@ -1278,12 +1312,6 @@ subroutine interp(localpet) if (.not. sotyp_from_climo) then -! call ESMF_FieldBundleAdd(bundle_nolandice_target, (/soil_type_target_grid/), rc=rc) -! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & -! call error_handler("IN FieldBundleAdd", rc) -! call ESMF_FieldBundleAdd(bundle_nolandice_input, (/soil_type_input_grid/), rc=rc) -! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & -! call error_handler("IN FieldBundleAdd", rc) print*,"- CALL Field_Regrid ." call ESMF_FieldRegrid(soil_type_input_grid, & soil_type_target_grid, & @@ -1305,10 +1333,6 @@ subroutine interp(localpet) call ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j) soil_type_target_ptr(i,j) = -9999.9 enddo - ! call ESMF_FieldBundleGet(bundle_nolandice_target,fieldCount=num_fields,rc=rc) - ! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - ! call error_handler("IN FieldBundleGet", rc) - ! sotyp_ind = 3 endif if (.not. vgfrc_from_climo) then @@ -1369,11 +1393,6 @@ subroutine interp(localpet) search_nums(1:5) = (/85,7,224,85,86/) dozero(1:5) = (/.False.,.False.,.True.,.True.,.False./) - !if (.not.sotyp_from_climo) then - ! search_nums(sotyp_ind) = 226 - ! dozero(sotyp_ind) = .False. - !endif - if (.not. vgfrc_from_climo) then search_nums(vgfrc_ind) = 224 dozero(vgfrc_ind) = .True. @@ -1569,7 +1588,7 @@ subroutine calc_liq_soil_moisture do i = clb(1), cub(1) !--------------------------------------------------------------------------------------------- -! Check land points that are not permanent land ice. +! Check points with some land (that are not permanent land ice). !--------------------------------------------------------------------------------------------- if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target) then @@ -1852,7 +1871,7 @@ subroutine rescale_soil_moisture do i = clb(1), cub(1) !--------------------------------------------------------------------------------------------- -! Check land points that are not permanent land ice. +! Check points with some land (that are not permanent land ice). !--------------------------------------------------------------------------------------------- if (landmask_ptr(i,j) == 1 .and. nint(veg_type_ptr(i,j)) /= veg_type_landice_target) then @@ -2001,7 +2020,7 @@ subroutine adjust_soilt_for_terrain do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 1) then + if (landmask_ptr(i,j) == 1) then ! partial or all land terrain_diff = abs(terrain_input_ptr(i,j) - terrain_target_ptr(i,j)) if (terrain_diff > 100.0) then do k = clb(3), cub(3) @@ -2135,29 +2154,26 @@ subroutine adjust_soil_levels(localpet) end subroutine adjust_soil_levels -!> Set roughness length at land and sea ice. At land, roughness is -!! set from a lookup table based on the vegetation type. At sea ice, -!! roughness is set to 1 cm. +!> Set roughness length at points with some sea ice to 1 cm. +!! Set flag value at points with some or all open water. !! !! @author George Gayno NOAA/EMC subroutine roughness - use model_grid, only : landmask_target_grid - use static_data, only : veg_type_target_grid + use model_grid, only : landmask_target_grid, & + seamask_target_grid implicit none integer :: clb(2), cub(2), i, j, rc integer(esmf_kind_i8), pointer :: landmask_ptr(:,:) + integer(esmf_kind_i8), pointer :: seamask_ptr(:,:) - real :: z0_igbp(20) - real(esmf_kind_r8), pointer :: data_ptr(:,:) - real(esmf_kind_r8), pointer :: veg_type_ptr(:,:) + real(esmf_kind_r8), pointer :: data_ptr2(:,:) + real(esmf_kind_r8), pointer :: data_ptr3(:,:) + real(esmf_kind_r8), pointer :: fice_ptr(:,:) - data z0_igbp /1.089, 2.653, 0.854, 0.826, 0.800, 0.050, & - 0.030, 0.856, 0.856, 0.150, 0.040, 0.130, & - 1.000, 0.250, 0.011, 0.011, 0.001, 0.076, & - 0.050, 0.030/ + print*,"- SET ROUGHNESS." print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." call ESMF_FieldGet(landmask_target_grid, & @@ -2167,36 +2183,63 @@ subroutine roughness if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE." - call ESMF_FieldGet(veg_type_target_grid, & - farrayPtr=veg_type_ptr, rc=rc) + print*,"- CALL FieldGet FOR TARGET GRID SEA ICE." + call ESMF_FieldGet(seaice_fract_target_grid, & + farrayPtr=fice_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,"- CALL FieldGet FOR TARGET GRID Z0." - call ESMF_FieldGet(z0_target_grid, & - farrayPtr=data_ptr, rc=rc) + print*,"- CALL FieldGet FOR TARGET GRID Z0 WATER." + call ESMF_FieldGet(z0_water_target_grid, & + farrayPtr=data_ptr3, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldGet", rc) + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET SEA MASK." + call ESMF_FieldGet(seamask_target_grid, & + farrayPtr=seamask_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID Z0 ICE." + call ESMF_FieldGet(z0_ice_target_grid, & + farrayPtr=data_ptr2, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + +! At points with some ice, set to nominal value of 1 cm. Elsewhere, set to flag value. do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 2) then - data_ptr(i,j) = 1.0 - elseif (landmask_ptr(i,j) == 1) then - data_ptr(i,j) = z0_igbp(nint(veg_type_ptr(i,j))) * 100.0 + if (fice_ptr(i,j) > 0.0) then + data_ptr2(i,j) = 1.0 + else + data_ptr2(i,j) = missing + endif + enddo + enddo + +! Roughness at points with some or all open water. Here we set a flag value at points +! that are all ice or points that are all land (seamask = 0). + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (fice_ptr(i,j) == 1.0_esmf_kind_r8 .or. seamask_ptr(i,j) == 0) then + data_ptr3(i,j) = missing endif enddo enddo end subroutine roughness -!> Perform some quality control checks before output. +!> Perform some quality control checks and set flag values +!! at non-active points. !! !! @author George Gayno NOAA/EMC subroutine qc_check - use model_grid, only : landmask_target_grid + use model_grid, only : landmask_target_grid, & + seamask_target_grid use static_data, only : alvsf_target_grid, & alvwf_target_grid, & @@ -2217,9 +2260,11 @@ subroutine qc_check integer :: clb(2), cub(2), i, j, rc integer(esmf_kind_i8), pointer :: landmask_ptr(:,:) + integer(esmf_kind_i8), pointer :: seamask_ptr(:,:) real(esmf_kind_r8), pointer :: data_ptr(:,:) real(esmf_kind_r8), pointer :: data3d_ptr(:,:,:) + real(esmf_kind_r8), pointer :: ice_ptr(:,:,:) real(esmf_kind_r8), pointer :: soilmt_ptr(:,:,:) real(esmf_kind_r8), pointer :: soilml_ptr(:,:,:) real(esmf_kind_r8), pointer :: veg_greenness_ptr(:,:) @@ -2228,6 +2273,11 @@ subroutine qc_check real(esmf_kind_r8), pointer :: skint_ptr(:,:) real(esmf_kind_r8), pointer :: fice_ptr(:,:) real(esmf_kind_r8), pointer :: hice_ptr(:,:) + real(esmf_kind_r8), pointer :: tg3_ptr(:,:) + real(esmf_kind_r8), pointer :: snod_ptr(:,:) + real(esmf_kind_r8), pointer :: snol_ptr(:,:) + + print*,'- PERFORM QC CHECK' print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." call ESMF_FieldGet(landmask_target_grid, & @@ -2237,6 +2287,18 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) + print*,"- CALL FieldGet FOR TARGET GRID SEA MASK." + call ESMF_FieldGet(seamask_target_grid, & + farrayPtr=seamask_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION." + call ESMF_FieldGet(seaice_fract_target_grid, & + farrayPtr=fice_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + print*,"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE." call ESMF_FieldGet(slope_type_target_grid, & farrayPtr=data_ptr, rc=rc) @@ -2245,7 +2307,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land. enddo enddo @@ -2257,7 +2319,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land. enddo enddo @@ -2269,11 +2331,11 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) veg_type_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) veg_type_ptr(i,j) = 0.0 ! all non-land. enddo enddo - print*,"- SET TARGET GRID ALVSF AT NON-LAND." + print*,"- SET TARGET GRID ALVSF FLAG AT NON-LAND." call ESMF_FieldGet(alvsf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2281,11 +2343,11 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06 ! gfs physics flag value + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing ! gfs physics flag value enddo enddo - print*,"- SET TARGET GRID ALVWF AT NON-LAND." + print*,"- SET TARGET GRID ALVWF FLAG AT NON-LAND." call ESMF_FieldGet(alvwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2293,11 +2355,11 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06 ! gfs physics flag value + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing ! gfs physics flag value enddo enddo - print*,"- SET TARGET GRID ALNSF AT NON-LAND." + print*,"- SET TARGET GRID ALNSF FLAG AT NON-LAND." call ESMF_FieldGet(alnsf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2305,11 +2367,11 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06 ! gfs physics flag value + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing ! gfs physics flag value enddo enddo - print*,"- SET TARGET GRID ALNWF AT NON-LAND." + print*,"- SET TARGET GRID ALNWF FLAG AT NON-LAND." call ESMF_FieldGet(alnwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2317,7 +2379,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.06 ! gfs physics flag value + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = missing ! gfs physics flag value enddo enddo @@ -2329,11 +2391,11 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land enddo enddo - print*,"- SET NON-LAND FLAG FOR TARGET GRID FACSF." + print*,"- SET NON-LAND FLAG FOR TARGET GRID FACWF." call ESMF_FieldGet(facwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2341,7 +2403,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land enddo enddo @@ -2353,7 +2415,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land enddo enddo @@ -2365,7 +2427,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land enddo enddo @@ -2377,7 +2439,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) veg_greenness_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) veg_greenness_ptr(i,j) = 0.0 ! all non-land enddo enddo @@ -2389,7 +2451,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) /= 1) data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) data_ptr(i,j) = 0.0 ! all non-land enddo enddo @@ -2399,6 +2461,8 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) +! The 0.01 indicates bare ground. + do j = clb(2), cub(2) do i = clb(1), cub(1) if (veg_greenness_ptr(i,j) <= 0.01) data_ptr(i,j) = 0.0 @@ -2411,53 +2475,91 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,"- SET TARGET GRID SKIN TEMP AT ICE POINTS." + print*,"- CALL FieldGet FOR TARGET GRID SKIN TEMP." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skint_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION." - call ESMF_FieldGet(seaice_fract_target_grid, & - farrayPtr=fice_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldGet", rc) - - print*,"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS." + print*,"- CALL FieldGet FOR TARGET GRID ICE DEPTH." call ESMF_FieldGet(seaice_depth_target_grid, & farrayPtr=hice_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) +! Under some model configurations, ice can form at t=00. New ice needs +! a valid skin temperature. Therefore, at open water (potential +! ice points) set to 'frz_ice'. + + print*,"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS." + do j = clb(2), cub(2) do i = clb(1), cub(1) - if (fice_ptr(i,j) > 0.0) then - skint_ptr(i,j) = (fice_ptr(i,j) * seaice_skint_ptr(i,j)) + & - ( (1.0 - fice_ptr(i,j)) * frz_ice ) - else - seaice_skint_ptr(i,j) = skint_ptr(i,j) + if (fice_ptr(i,j) == 0.0) then + if (seamask_ptr(i,j) == 0) then ! all land + seaice_skint_ptr(i,j) = missing + else + seaice_skint_ptr(i,j) = frz_ice ! some water and no ice + endif hice_ptr(i,j) = 0.0 endif enddo enddo - print*,"- SET TARGET GRID SUBSTRATE TEMP AT ICE." - call ESMF_FieldGet(substrate_temp_target_grid, & + print*,"- SET TARGET GRID SST FLAG VALUE." + call ESMF_FieldGet(sst_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) +! Set flag at points with all ice or points that are all land (seamask=0). + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (fice_ptr(i,j) == 1.0_esmf_kind_r8 .or. seamask_ptr(i,j) == 0.0) then + data_ptr(i,j) = missing + endif + enddo + enddo + + print*,"- SET MISSING FLAG AT TARGET GRID SUBSTRATE TEMP." + call ESMF_FieldGet(substrate_temp_target_grid, & + farrayPtr=tg3_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 2) then ! sea ice - data_ptr(i,j) = frz_ice - elseif (landmask_ptr(i,j) == 0) then ! open water flag value. - data_ptr(i,j) = skint_ptr(i,j) + if (landmask_ptr(i,j) == 0.0) then ! completely non-land. + tg3_ptr(i,j) = missing endif enddo enddo - print*,"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER." + print*,"- SET MISSING FLAG AT TARGET GRID SNOW FIELDS AT ICE." + + print*,"- CALL FieldGet FOR TARGET GRID SNOW DEPTH AT ICE." + call ESMF_FieldGet(snow_depth_at_ice_target_grid, & + farrayPtr=snod_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SNOW LIQ EQUIV AT ICE." + call ESMF_FieldGet(snow_liq_equiv_at_ice_target_grid, & + farrayPtr=snol_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (fice_ptr(i,j) == 0.0) then ! points with no ice. + snol_ptr(i,j) = missing + snod_ptr(i,j) = missing + end if + enddo + enddo + + print*,"- SET NON-LAND FLAG AT TARGET GRID SNOW DEPTH." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2465,13 +2567,13 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 0) then ! open water - data_ptr(i,j) = 0.0 + if (landmask_ptr(i,j) == 0) then ! all non-land + data_ptr(i,j) = missing end if enddo enddo - print*,"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER." + print*,"- SET NON-LAND FLAG AT TARGET GRID SNOW LIQ." call ESMF_FieldGet(snow_liq_equiv_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2479,9 +2581,9 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 0) then ! open water - data_ptr(i,j) = 0.0 - endif + if (landmask_ptr(i,j) == 0) then ! all non-land + data_ptr(i,j) = missing + end if enddo enddo @@ -2491,7 +2593,7 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE." + print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE." call ESMF_FieldGet(soilm_liq_target_grid, & farrayPtr=soilml_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2499,7 +2601,7 @@ subroutine qc_check do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 2 .or. landmask_ptr(i,j) == 0 .or. & + if (landmask_ptr(i,j) == 0 .or. & nint(veg_type_ptr(i,j)) == veg_type_landice_target) then soilmt_ptr(i,j,:) = 1.0 soilml_ptr(i,j,:) = 1.0 @@ -2507,16 +2609,48 @@ subroutine qc_check enddo enddo - print*,"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE." + print*,"- SET NON-LAND FLAG FOR TARGET GRID SOIL TEMPERATURE." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=data3d_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (landmask_ptr(i,j) == 0) then ! all non-land. + data3d_ptr(i,j,:) = missing + endif + enddo + enddo + + print*,"- SET NON-ICE FLAG FOR TARGET GRID ICE COLUMN TEMPERATURE." + call ESMF_FieldGet(ice_temp_target_grid, & + farrayPtr=ice_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) +! Under some model configurations, ice can form at t=00. New ice needs +! a valid ice column temperature. Therefore, at open water (potential +! ice points) set to 'frz_ice'. + do j = clb(2), cub(2) do i = clb(1), cub(1) - if (landmask_ptr(i,j) == 0) then - data3d_ptr(i,j,:) = skint_ptr(i,j) ! open water flag value. + if (fice_ptr(i,j) == 0.0) then + if (seamask_ptr(i,j) == 0) then ! all land + ice_ptr(i,j,:) = missing + else + ice_ptr(i,j,:) = frz_ice ! some water and no ice + endif + endif + enddo + enddo + + print*,"- SET NON-LAND FLAG FOR TARGET GRID SKIN TEMPERATURE." + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (landmask_ptr(i,j) == 0) then ! all non-land. + skint_ptr(i,j) = missing endif enddo enddo @@ -2531,7 +2665,7 @@ end subroutine qc_check !! @author George Gayno NOAA/EMC subroutine nst_land_fill - use model_grid, only : landmask_target_grid + use model_grid, only : seamask_target_grid implicit none @@ -2542,16 +2676,23 @@ subroutine nst_land_fill integer, PARAMETER :: nst_fill = 0.0 real(esmf_kind_r8), pointer :: data_ptr(:,:) + real(esmf_kind_r8), pointer :: fice_ptr(:,:) real(esmf_kind_r8), pointer :: skint_ptr(:,:) type(esmf_field) :: temp_field type(esmf_fieldbundle) :: nst_bundle - print*,"- CALL FieldGet FOR TARGET GRID LANDMASK." - call ESMF_FieldGet(landmask_target_grid, & + print*,"- CALL FieldGet FOR TARGET GRID SEAMASK." + call ESMF_FieldGet(seamask_target_grid, & farrayPtr=mask_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SEAICE FRACT." + call ESMF_FieldGet(seaice_fract_target_grid, & + farrayPtr=fice_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGet", rc) nst_bundle = ESMF_FieldBundleCreate(name="nst_bundle", rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& @@ -2577,7 +2718,8 @@ subroutine nst_land_fill if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) - where(mask_ptr /= 0) data_ptr = skint_ptr + where(mask_ptr == 0) data_ptr = skint_ptr ! all land + where(fice_ptr > 0.0) data_ptr = frz_ice ! points with some ice ! xz @@ -2587,7 +2729,8 @@ subroutine nst_land_fill if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) - where(mask_ptr /= 0) data_ptr = xz_fill + where(mask_ptr == 0) data_ptr = xz_fill ! all land + where(fice_ptr > 0.0) data_ptr = xz_fill ! points with some ice do i = 1,num_nst_fields_minus2 @@ -2599,7 +2742,8 @@ subroutine nst_land_fill if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) - where(mask_ptr /= 0) data_ptr = nst_fill + where(mask_ptr == 0) data_ptr = nst_fill ! all land + where(fice_ptr > 0.0) data_ptr = nst_fill ! points with some ice enddo @@ -2735,6 +2879,22 @@ subroutine create_surface_esmf_fields target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV AT SEA ICE." + snow_liq_equiv_at_ice_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + name="snow_liq_equiv_at_ice_target_grid", & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET grid snow liq equiv at sea ice." + call ESMF_FieldGet(snow_liq_equiv_at_ice_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH." snow_depth_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -2751,6 +2911,22 @@ subroutine create_surface_esmf_fields target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH AT SEA ICE." + snow_depth_at_ice_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + name="snow_depth_at_ice_target_grid", & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET grid snow depth at sea ice." + call ESMF_FieldGet(snow_depth_at_ice_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION." seaice_fract_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -2783,6 +2959,22 @@ subroutine create_surface_esmf_fields target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID sst." + sst_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + name="sst_target_grid", & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET sst." + call ESMF_FieldGet(sst_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP." seaice_skin_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -2863,16 +3055,32 @@ subroutine create_surface_esmf_fields target_ptr = init_val - print*,"- CALL FieldCreate FOR TARGET GRID Z0." - z0_target_grid = ESMF_FieldCreate(target_grid, & + print*,"- CALL FieldCreate FOR TARGET GRID Z0_ICE." + z0_ice_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & - name="z0_target_grid", & + name="z0_ice_target_grid", & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) - print*,"- INITIALIZE TARGET grid z0." - call ESMF_FieldGet(z0_target_grid, & + print*,"- INITIALIZE TARGET grid z0_ice." + call ESMF_FieldGet(z0_ice_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + + print*,"- CALL FieldCreate FOR TARGET GRID Z0_WATER." + z0_water_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + name="z0_water_target_grid", & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET grid z0_water." + call ESMF_FieldGet(z0_water_target_grid, & farrayPtr=target_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) @@ -2911,6 +3119,24 @@ subroutine create_surface_esmf_fields target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE COLUMN TEMPERATURE." + ice_temp_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="ice_temp_target_grid", & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_target/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET grid ice temp" + call ESMF_FieldGet(ice_temp_target_grid, & + farrayPtr=target_ptr_3d, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr_3d = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE." soil_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3124,6 +3350,65 @@ subroutine create_nst_esmf_fields end subroutine create_nst_esmf_fields +!> Update landmask for sea ice. +!! +!! The model requires the landmask record be present. However, the data +!! is recomputed in FV3ATM routine fv3atm_sfc_io.F90 after it is read in. Here, +!! compute it using the same algorithm as the model and output it as +!! a diagnostic. +!! +!! @author George Gayno + subroutine update_landmask + + use model_grid, only : landmask_target_grid, land_frac_target_grid + + implicit none + + integer :: i, j, rc, clb(2), cub(2) + integer(esmf_kind_i8), pointer :: mask_ptr(:,:) + + real(esmf_kind_r8), pointer :: ice_ptr(:,:) + real(esmf_kind_r8), pointer :: land_frac_ptr(:,:) + + print*,"- UPDATE TARGET LANDMASK WITH ICE RECORD." + + print*,"- GET TARGET grid sea ice fraction." + call ESMF_FieldGet(seaice_fract_target_grid, & + farrayPtr=ice_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- GET TARGET landmask." + call ESMF_FieldGet(landmask_target_grid, & + farrayPtr=mask_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- GET TARGET land fraction." + call ESMF_FieldGet(land_frac_target_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=land_frac_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + + mask_ptr(i,j) = ceiling(land_frac_ptr(i,j)) + if (mask_ptr(i,j) /= 1) then + if(ice_ptr(i,j) > 0.0) then + mask_ptr(i,j) = 2 + else + mask_ptr(i,j) = 0 + endif + endif + + enddo + enddo + + end subroutine update_landmask + !> Convert 1d index to 2d indices. !! !! @param[in] ij the 1d index diff --git a/sorc/chgres_cube.fd/surface_target_data.F90 b/sorc/chgres_cube.fd/surface_target_data.F90 index c9011f8b1..f4f6e0bc8 100644 --- a/sorc/chgres_cube.fd/surface_target_data.F90 +++ b/sorc/chgres_cube.fd/surface_target_data.F90 @@ -23,6 +23,8 @@ module surface_target_data type(esmf_field), public :: ffmm_target_grid !< log((z0+z1)*1/z0) !< See sfc_diff.f for details. + type(esmf_field), public :: ice_temp_target_grid + !< 3-d sea ice column temperature type(esmf_field), public :: q2m_target_grid !< 2-m specific humidity. type(esmf_field), public :: seaice_depth_target_grid @@ -33,12 +35,19 @@ module surface_target_data !< Sea ice skin temperature. type(esmf_field), public :: skin_temp_target_grid !< Skin temperature/sst. + type(esmf_field), public :: sst_target_grid + !< SST at open water. type(esmf_field), public :: srflag_target_grid !< Snow/rain flag. type(esmf_field), public :: snow_liq_equiv_target_grid - !< Liquid equivalent snow depth. + !< Liquid equivalent snow depth at land. + type(esmf_field), public :: snow_liq_equiv_at_ice_target_grid + !< Liquid equivalent snow depth at sea + !< ice. type(esmf_field), public :: snow_depth_target_grid - !< Physical snow depth. + !< Physical snow depth at land. + type(esmf_field), public :: snow_depth_at_ice_target_grid + !< physical snow depth at sea ice. type(esmf_field), public :: soil_temp_target_grid !< 3-d soil temperature. type(esmf_field), public :: soilm_liq_target_grid @@ -51,8 +60,10 @@ module surface_target_data !< Precipitation. type(esmf_field), public :: ustar_target_grid !< Friction velocity. - type(esmf_field), public :: z0_target_grid - !< Roughness length. + type(esmf_field), public :: z0_ice_target_grid + !< roughness length at sea ice + type(esmf_field), public :: z0_water_target_grid + !< roughness length at open water type(esmf_field), public :: lai_target_grid !< Leaf area index. @@ -120,17 +131,22 @@ subroutine cleanup_target_sfc_data call ESMF_FieldDestroy(tprcp_target_grid, rc=rc) call ESMF_FieldDestroy(f10m_target_grid, rc=rc) call ESMF_FieldDestroy(ffmm_target_grid, rc=rc) + if (ESMF_FieldIsCreated(ice_temp_target_grid)) call ESMF_FieldDestroy(ice_temp_target_grid, rc=rc) call ESMF_FieldDestroy(ustar_target_grid, rc=rc) call ESMF_FieldDestroy(snow_liq_equiv_target_grid, rc=rc) call ESMF_FieldDestroy(snow_depth_target_grid, rc=rc) + if (ESMF_FieldIsCreated(snow_liq_equiv_at_ice_target_grid)) call ESMF_FieldDestroy(snow_liq_equiv_at_ice_target_grid, rc=rc) + if (ESMF_FieldIsCreated(snow_depth_at_ice_target_grid)) call ESMF_FieldDestroy(snow_depth_at_ice_target_grid, rc=rc) call ESMF_FieldDestroy(seaice_fract_target_grid, rc=rc) call ESMF_FieldDestroy(seaice_depth_target_grid, rc=rc) call ESMF_FieldDestroy(seaice_skin_temp_target_grid, rc=rc) call ESMF_FieldDestroy(srflag_target_grid, rc=rc) call ESMF_FieldDestroy(skin_temp_target_grid, rc=rc) + if (ESMF_FieldIsCreated(sst_target_grid)) call ESMF_FieldDestroy(sst_target_grid, rc=rc) call ESMF_FieldDestroy(canopy_mc_target_grid, rc=rc) call ESMF_FieldDestroy(lai_target_grid,rc=rc) - call ESMF_FieldDestroy(z0_target_grid, rc=rc) + call ESMF_FieldDestroy(z0_ice_target_grid, rc=rc) + call ESMF_FieldDestroy(z0_water_target_grid, rc=rc) call ESMF_FieldDestroy(soil_temp_target_grid, rc=rc) call ESMF_FieldDestroy(soilm_tot_target_grid, rc=rc) call ESMF_FieldDestroy(soilm_liq_target_grid, rc=rc) diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index 8334ae217..61bb7f591 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -1821,16 +1821,21 @@ subroutine write_fv3_sfc_data_netcdf(localpet) seaice_fract_target_grid, & seaice_skin_temp_target_grid, & skin_temp_target_grid, & + sst_target_grid, & soil_temp_target_grid, & + ice_temp_target_grid, & soilm_liq_target_grid, & soilm_tot_target_grid, & srflag_target_grid, & snow_liq_equiv_target_grid, & snow_depth_target_grid, & + snow_liq_equiv_at_ice_target_grid, & + snow_depth_at_ice_target_grid, & t2m_target_grid, & tprcp_target_grid, & ustar_target_grid, & - z0_target_grid, & + z0_ice_target_grid, & + z0_water_target_grid, & lai_target_grid, & c_d_target_grid, & c_0_target_grid, & @@ -1872,22 +1877,22 @@ subroutine write_fv3_sfc_data_netcdf(localpet) character(len=128) :: outfile integer :: header_buffer_val = 16384 - integer :: dim_x, dim_y, dim_lsoil, dim_time + integer :: dim_x, dim_y, dim_lsoil, dim_ice, dim_time integer :: error, i, ncid, tile - integer :: id_x, id_y, id_lsoil + integer :: id_x, id_y, id_lsoil, id_ice integer :: id_slmsk, id_time integer :: id_lat, id_lon - integer :: id_tsea, id_sheleg, id_tg3 - integer :: id_zorl, id_alvsf, id_alvwf + integer :: id_tsfcl, id_tsea, id_sheleg_ice, id_sheleg_land + integer :: id_zorl_water, id_zorl_ice, id_alvsf, id_alvwf integer :: id_alnsf, id_alnwf, id_vfrac - integer :: id_canopy, id_f10m, id_t2m + integer :: id_canopy, id_f10m, id_t2m, id_tg3 integer :: id_q2m, id_vtype, id_stype integer :: id_facsf, id_facwf, id_uustar integer :: id_ffmm, id_ffhh, id_hice integer :: id_fice, id_tisfc, id_tprcp - integer :: id_srflag, id_snwdph, id_shdmin + integer :: id_srflag, id_snwdph_ice, id_snwdph_land, id_shdmin integer :: id_shdmax, id_slope, id_snoalb - integer :: id_lai + integer :: id_lai, id_ice_temp integer :: id_stc, id_smc, id_slc integer :: id_tref, id_z_c, id_c_0 integer :: id_c_d, id_w_0, id_w_d @@ -1903,6 +1908,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) real(kind=4), allocatable :: lsoil_data(:), x_data(:), y_data(:) real(kind=8), allocatable :: dum2d(:,:), dum3d(:,:,:) real(kind=4) :: times + real(kind=8), parameter :: missing=-1.e+20_8 real(esmf_kind_r8), allocatable :: data_one_tile(:,:) real(esmf_kind_r8), allocatable :: data_one_tile_3d(:,:,:) @@ -1972,9 +1978,18 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING YAXIS DIMENSION' ) error = nf90_def_dim(ncid, 'zaxis_1', lsoil_target, dim_lsoil) call netcdf_err(error, 'DEFINING ZAXIS DIMENSION' ) + error = nf90_def_dim(ncid, 'zaxis_2', 2, dim_ice) + call netcdf_err(error, 'DEFINING ZAXIS2 DIMENSION' ) error = nf90_def_dim(ncid, 'Time', 1, dim_time) call netcdf_err(error, 'DEFINING TIME DIMENSION' ) +!--- define attributes +! +!--- The fractional grid version of chgres will output +!--- a new coldstart file. This file will be 'version 2'. + error = nf90_put_att(ncid, nf90_global, 'file_version', 'V2') + call netcdf_err(error, 'DEFINING GLOBAL ATTRIBUTE' ) + !--- define fields error = nf90_def_var(ncid, 'xaxis_1', NF90_FLOAT, (/dim_x/), id_x) call netcdf_err(error, 'DEFINING XAXIS_1 FIELD' ) @@ -2003,6 +2018,15 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_att(ncid, id_lsoil, "cartesian_axis", "Z") call netcdf_err(error, 'WRITING ZAXIS_1 FIELD' ) + error = nf90_def_var(ncid, 'zaxis_2', NF90_FLOAT, (/dim_ice/), id_ice) + call netcdf_err(error, 'DEFINING ZAXIS_2 FIELD' ) + error = nf90_put_att(ncid, id_ice, "long_name", "zaxis_2") + call netcdf_err(error, 'DEFINING ZAXIS_2 LONG NAME' ) + error = nf90_put_att(ncid, id_ice, "units", "none") + call netcdf_err(error, 'DEFINING ZAXIS_2 UNITS' ) + error = nf90_put_att(ncid, id_ice, "cartesian_axis", "Z") + call netcdf_err(error, 'WRITING ZAXIS_2 FIELD' ) + error = nf90_def_var(ncid, 'Time', NF90_FLOAT, dim_time, id_time) call netcdf_err(error, 'DEFINING TIME FIELD' ) error = nf90_put_att(ncid, id_time, "long_name", "Time") @@ -2035,6 +2059,17 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_att(ncid, id_slmsk, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING SLMSK COORD' ) + error = nf90_def_var(ncid, 'tsfcl', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tsfcl) + call netcdf_err(error, 'DEFINING TSFCL' ) + error = nf90_put_att(ncid, id_tsfcl, "long_name", "tsfcl") + call netcdf_err(error, 'DEFINING TSFCL LONG NAME' ) + error = nf90_put_att(ncid, id_tsfcl, "units", "none") + call netcdf_err(error, 'DEFINING TSFCL UNITS' ) + error = nf90_put_att(ncid, id_tsfcl, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TSFCL COORD' ) + error = nf90_put_att(ncid, id_tsfcl, "missing_value", missing) + call netcdf_err(error, 'DEFINING TSFCL MISSING FLAG' ) + error = nf90_def_var(ncid, 'tsea', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tsea) call netcdf_err(error, 'DEFINING TSEA' ) error = nf90_put_att(ncid, id_tsea, "long_name", "tsea") @@ -2043,15 +2078,30 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TSEA UNITS' ) error = nf90_put_att(ncid, id_tsea, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING TSEA COORD' ) - - error = nf90_def_var(ncid, 'sheleg', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_sheleg) - call netcdf_err(error, 'DEFINING SHELEG' ) - error = nf90_put_att(ncid, id_sheleg, "long_name", "sheleg") - call netcdf_err(error, 'DEFINING SHELEG LONG NAME' ) - error = nf90_put_att(ncid, id_sheleg, "units", "none") - call netcdf_err(error, 'DEFINING SHELEG UNITS' ) - error = nf90_put_att(ncid, id_sheleg, "coordinates", "geolon geolat") - call netcdf_err(error, 'DEFINING SHELEG COORD' ) + error = nf90_put_att(ncid, id_tsea, "missing_value", missing) + call netcdf_err(error, 'DEFINING TSEA MISSING FLAG' ) + + error = nf90_def_var(ncid, 'weasdi', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_sheleg_ice) + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT ICE' ) + error = nf90_put_att(ncid, id_sheleg_ice, "long_name", "sheleg_ice") + call netcdf_err(error, 'DEFINING WEASD/SHELEG ICE LONG NAME' ) + error = nf90_put_att(ncid, id_sheleg_ice, "units", "none") + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT ICE UNITS' ) + error = nf90_put_att(ncid, id_sheleg_ice, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT ICE COORD' ) + error = nf90_put_att(ncid, id_sheleg_ice, "missing_value", missing) + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT ICE MISSING FLAG' ) + + error = nf90_def_var(ncid, 'weasdl', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_sheleg_land) + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT LAND' ) + error = nf90_put_att(ncid, id_sheleg_land, "long_name", "sheleg_land") + call netcdf_err(error, 'DEFINING WEASD/SHELEG LAND LONG NAME' ) + error = nf90_put_att(ncid, id_sheleg_land, "units", "none") + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT LAND UNITS' ) + error = nf90_put_att(ncid, id_sheleg_land, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT LAND COORD' ) + error = nf90_put_att(ncid, id_sheleg_land, "missing_value", missing) + call netcdf_err(error, 'DEFINING WEASD/SHELEG AT LAND MISSING FLAG' ) error = nf90_def_var(ncid, 'tg3', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tg3) call netcdf_err(error, 'DEFINING TG3' ) @@ -2061,15 +2111,30 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TG3 UNITS' ) error = nf90_put_att(ncid, id_tg3, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING TG3 COORD' ) - - error = nf90_def_var(ncid, 'zorl', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_zorl) - call netcdf_err(error, 'DEFINING ZORL' ) - error = nf90_put_att(ncid, id_zorl, "long_name", "zorl") - call netcdf_err(error, 'DEFINING ZORL LONG NAME' ) - error = nf90_put_att(ncid, id_zorl, "units", "none") - call netcdf_err(error, 'DEFINING ZORL UNITS' ) - error = nf90_put_att(ncid, id_zorl, "coordinates", "geolon geolat") - call netcdf_err(error, 'DEFINING ZORL COORD' ) + error = nf90_put_att(ncid, id_tg3, "missing_value", missing) + call netcdf_err(error, 'DEFINING TG3 MISSING FLAG' ) + + error = nf90_def_var(ncid, 'zorli', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_zorl_ice) + call netcdf_err(error, 'DEFINING ZORLI' ) + error = nf90_put_att(ncid, id_zorl_ice, "long_name", "zorli") + call netcdf_err(error, 'DEFINING ZORLI LONG NAME' ) + error = nf90_put_att(ncid, id_zorl_ice, "units", "none") + call netcdf_err(error, 'DEFINING ZORLI UNITS' ) + error = nf90_put_att(ncid, id_zorl_ice, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ZORLI COORD' ) + error = nf90_put_att(ncid, id_zorl_ice, "missing_value", missing) + call netcdf_err(error, 'DEFINING ZORLI MISSING FLAG' ) + + error = nf90_def_var(ncid, 'zorlw', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_zorl_water) + call netcdf_err(error, 'DEFINING ZORLW' ) + error = nf90_put_att(ncid, id_zorl_water, "long_name", "zorlw") + call netcdf_err(error, 'DEFINING ZORLW LONG NAME' ) + error = nf90_put_att(ncid, id_zorl_water, "units", "none") + call netcdf_err(error, 'DEFINING ZORLW UNITS' ) + error = nf90_put_att(ncid, id_zorl_water, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ZORLW COORD' ) + error = nf90_put_att(ncid, id_zorl_water, "missing_value", missing) + call netcdf_err(error, 'DEFINING ZORLW MISSING FLAG' ) error = nf90_def_var(ncid, 'alvsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alvsf) call netcdf_err(error, 'DEFINING ALVSF' ) @@ -2079,6 +2144,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALVSF UNITS' ) error = nf90_put_att(ncid, id_alvsf, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING ALVSF COORD' ) + error = nf90_put_att(ncid, id_alvsf, "missing_value", missing) + call netcdf_err(error, 'DEFINING ALVSF MISSING FLAG' ) error = nf90_def_var(ncid, 'alvwf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alvwf) call netcdf_err(error, 'DEFINING ALVWF' ) @@ -2088,6 +2155,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALVWF UNITS' ) error = nf90_put_att(ncid, id_alvwf, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING ALVWF COORD' ) + error = nf90_put_att(ncid, id_alvwf, "missing_value", missing) + call netcdf_err(error, 'DEFINING ALVWF MISSING FLAG' ) error = nf90_def_var(ncid, 'alnsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alnsf) call netcdf_err(error, 'DEFINING ALNSF' ) @@ -2097,6 +2166,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALNSF UNITS' ) error = nf90_put_att(ncid, id_alnsf, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING ALNSF COORD' ) + error = nf90_put_att(ncid, id_alnsf, "missing_value", missing) + call netcdf_err(error, 'DEFINING ALNSF MISSING FLAG' ) error = nf90_def_var(ncid, 'alnwf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alnwf) call netcdf_err(error, 'DEFINING ALNWF' ) @@ -2106,6 +2177,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALNWF UNITS' ) error = nf90_put_att(ncid, id_alnwf, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING ALNWF COORD' ) + error = nf90_put_att(ncid, id_alnwf, "missing_value", missing) + call netcdf_err(error, 'DEFINING ALNWF MISSING FLAG' ) error = nf90_def_var(ncid, 'facsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_facsf) call netcdf_err(error, 'DEFINING FACSF' ) @@ -2241,6 +2314,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TISFC UNITS' ) error = nf90_put_att(ncid, id_tisfc, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING TISFC COORD' ) + error = nf90_put_att(ncid, id_tisfc, "missing_value", missing) + call netcdf_err(error, 'DEFINING TISFC MISSING FLAG' ) error = nf90_def_var(ncid, 'tprcp', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tprcp) call netcdf_err(error, 'DEFINING TPRCP' ) @@ -2260,14 +2335,27 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_att(ncid, id_srflag, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING SRFLAG COORD' ) - error = nf90_def_var(ncid, 'snwdph', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_snwdph) - call netcdf_err(error, 'DEFINING SNWDPH' ) - error = nf90_put_att(ncid, id_snwdph, "long_name", "snwdph") - call netcdf_err(error, 'DEFINING SNWDPH LONG NAME' ) - error = nf90_put_att(ncid, id_snwdph, "units", "none") - call netcdf_err(error, 'DEFINING SNWDPH UNITS' ) - error = nf90_put_att(ncid, id_snwdph, "coordinates", "geolon geolat") - call netcdf_err(error, 'DEFINING SNWDPH COORD' ) + error = nf90_def_var(ncid, 'snodi', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_snwdph_ice) + call netcdf_err(error, 'DEFINING SNWDPH AT ICE' ) + error = nf90_put_att(ncid, id_snwdph_ice, "long_name", "snwdph_ice") + call netcdf_err(error, 'DEFINING SNWDPH AT ICE LONG NAME' ) + error = nf90_put_att(ncid, id_snwdph_ice, "units", "none") + call netcdf_err(error, 'DEFINING SNWDPH AT ICE UNITS' ) + error = nf90_put_att(ncid, id_snwdph_ice, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SNWDPH AT ICE COORD' ) + error = nf90_put_att(ncid, id_snwdph_ice, "missing_value", missing) + call netcdf_err(error, 'DEFINING SNWDPH AT ICE MISSING FLAG' ) + + error = nf90_def_var(ncid, 'snodl', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_snwdph_land) + call netcdf_err(error, 'DEFINING SNWDPH AT LAND' ) + error = nf90_put_att(ncid, id_snwdph_land, "long_name", "snwdph_land") + call netcdf_err(error, 'DEFINING SNWDPH AT LAND LONG NAME' ) + error = nf90_put_att(ncid, id_snwdph_land, "units", "none") + call netcdf_err(error, 'DEFINING SNWDPH AT LAND UNITS' ) + error = nf90_put_att(ncid, id_snwdph_land, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SNWDPH AT LAND COORD' ) + error = nf90_put_att(ncid, id_snwdph_land, "missing_value", missing) + call netcdf_err(error, 'DEFINING SNWDPH AT LAND MISSING FLAG' ) error = nf90_def_var(ncid, 'shdmin', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_shdmin) call netcdf_err(error, 'DEFINING SHDMIN' ) @@ -2324,6 +2412,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING STC UNITS' ) error = nf90_put_att(ncid, id_stc, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING STC COORD' ) + error = nf90_put_att(ncid, id_stc, "missing_value", missing) + call netcdf_err(error, 'DEFINING STC MISSING FLAG' ) error = nf90_def_var(ncid, 'smc', NF90_DOUBLE, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc) call netcdf_err(error, 'DEFINING SMC' ) @@ -2343,6 +2433,17 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_att(ncid, id_slc, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING SLC COORD' ) + error = nf90_def_var(ncid, 'tiice', NF90_DOUBLE, (/dim_x,dim_y,dim_ice,dim_time/), id_ice_temp) + call netcdf_err(error, 'DEFINING TIICE' ) + error = nf90_put_att(ncid, id_ice_temp, "long_name", "tiice") + call netcdf_err(error, 'DEFINING TIICE LONG NAME' ) + error = nf90_put_att(ncid, id_ice_temp, "units", "none") + call netcdf_err(error, 'DEFINING TIICE UNITS' ) + error = nf90_put_att(ncid, id_ice_temp, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TIICE COORD' ) + error = nf90_put_att(ncid, id_ice_temp, "missing_value", missing) + call netcdf_err(error, 'DEFINING TIICE MISSING FLAG' ) + if (convert_nst) then error = nf90_def_var(ncid, 'tref', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tref) @@ -2517,6 +2618,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) if (localpet == 0) then error = nf90_put_var( ncid, id_lsoil, lsoil_data) call netcdf_err(error, 'WRITING ZAXIS RECORD' ) + error = nf90_put_var( ncid, id_ice, (/1,2/)) + call netcdf_err(error, 'WRITING ZAXIS2 RECORD' ) error = nf90_put_var( ncid, id_x, x_data) call netcdf_err(error, 'WRITING XAXIS RECORD' ) error = nf90_put_var( ncid, id_y, y_data) @@ -2548,26 +2651,48 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'WRITING LONGITUDE RECORD' ) endif - print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile + print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV AT LAND FOR TILE: ", tile call ESMF_FieldGather(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) - error = nf90_put_var( ncid, id_sheleg, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) - call netcdf_err(error, 'WRITING SNOW LIQ EQUIV RECORD' ) + error = nf90_put_var( ncid, id_sheleg_land, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING SNOW LIQ EQUIV AT LAND RECORD' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV AT ICE FOR TILE: ", tile + call ESMF_FieldGather(snow_liq_equiv_at_ice_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_sheleg_ice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING SNOW LIQ EQUIV AT ICE RECORD' ) endif - print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile + print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH AT LAND FOR TILE: ", tile call ESMF_FieldGather(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) - error = nf90_put_var( ncid, id_snwdph, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) - call netcdf_err(error, 'WRITING SNWDPH RECORD' ) + error = nf90_put_var( ncid, id_snwdph_land, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING SNWDPH AT LAND RECORD' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH AT ICE FOR TILE: ", tile + call ESMF_FieldGather(snow_depth_at_ice_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_snwdph_ice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING SNWDPH AT ICE RECORD' ) endif print*,"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile @@ -2581,15 +2706,26 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'WRITING SLOPE RECORD' ) endif - print*,"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile - call ESMF_FieldGather(z0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + print*,"- CALL FieldGather FOR TARGET GRID Z0_ICE FOR TILE: ", tile + call ESMF_FieldGather(z0_ice_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) - error = nf90_put_var( ncid, id_zorl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) - call netcdf_err(error, 'WRITING Z0 RECORD' ) + error = nf90_put_var( ncid, id_zorl_ice, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING Z0_ICE RECORD' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID Z0_WATER FOR TILE: ", tile + call ESMF_FieldGather(z0_water_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_zorl_water, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING Z0_WATER RECORD' ) endif print*,"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile @@ -2866,6 +3002,17 @@ subroutine write_fv3_sfc_data_netcdf(localpet) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_tsfcl, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING TSFCL RECORD' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID sst FOR TILE: ", tile + call ESMF_FieldGather(sst_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + if (localpet == 0) then dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) error = nf90_put_var( ncid, id_tsea, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) @@ -2894,6 +3041,19 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'WRITING CANOPY MC RECORD' ) endif +! ice column temperature + + print*,"- CALL FieldGather FOR TARGET GRID SEA ICE COLUMN TEMPERATURE FOR TILE: ", tile + call ESMF_FieldGather(ice_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum3d(:,:,:) = data_one_tile_3d(istart:iend, jstart:jend,:) + error = nf90_put_var( ncid, id_ice_temp, dum3d(:,:,1:2), start=(/1,1,1,1/), count=(/i_target_out,j_target_out,2,1/)) + call netcdf_err(error, 'WRITING SEA ICE COLUMN TEMP RECORD' ) + endif + ! soil temperature print*,"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index abc6b4b37..b2c8f8fc4 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -370,16 +370,16 @@ subroutine get_model_info(orog_file, mask, land_frac, lat2d, lon2d, idim, jdim) ! surface data will not be mapped to it. !----------------------------------------------------------------------- - error=nf90_inq_varid(ncid, 'lake_frac', id_var) - if (error /= 0) then - print*,"- READ LAND MASK (SLMSK)" - error=nf90_inq_varid(ncid, 'slmsk', id_var) - call netcdf_err(error, "READING SLMSK ID") - error=nf90_get_var(ncid, id_var, dummy) - call netcdf_err(error, "READING SLMSK") - mask = nint(dummy) - land_frac = -999. - else +!error=nf90_inq_varid(ncid, 'lake_frac', id_var) +!if (error /= 0) then +! print*,"- READ LAND MASK (SLMSK)" +! error=nf90_inq_varid(ncid, 'slmsk', id_var) +! call netcdf_err(error, "READING SLMSK ID") +! error=nf90_get_var(ncid, id_var, dummy) +! call netcdf_err(error, "READING SLMSK") +! mask = nint(dummy) +! land_frac = -999. +!else print*,"- READ LAND FRACTION" error=nf90_inq_varid(ncid, 'land_frac', id_var) call netcdf_err(error, "READING LAND_FRAC ID") @@ -393,7 +393,7 @@ subroutine get_model_info(orog_file, mask, land_frac, lat2d, lon2d, idim, jdim) endif enddo enddo - endif +!endif print*,"- READ LATITUDE" error=nf90_inq_varid(ncid, 'geolat', id_var) diff --git a/tests/chgres_cube/ftst_surface_nst_landfill.F90 b/tests/chgres_cube/ftst_surface_nst_landfill.F90 index e2fcd7bde..3228202bb 100644 --- a/tests/chgres_cube/ftst_surface_nst_landfill.F90 +++ b/tests/chgres_cube/ftst_surface_nst_landfill.F90 @@ -9,12 +9,13 @@ program surface_nst_landfill use model_grid, only : i_target, j_target, & target_grid, num_tiles_target_grid, & - landmask_target_grid + seamask_target_grid use surface, only : nst_land_fill, & create_nst_esmf_fields - + use surface_target_data, only : skin_temp_target_grid, & + seaice_fract_target_grid, & c_d_target_grid, & c_0_target_grid, & d_conv_target_grid, & @@ -51,13 +52,12 @@ program surface_nst_landfill character(len=50) :: fname - integer(esmf_kind_i8), pointer :: mask_target_ptr(:,:) integer(esmf_kind_i8), allocatable :: mask(:,:) - real(esmf_kind_r8), pointer :: skin_temp_ptr(:,:), & - tmp_ptr(:,:) + real(esmf_kind_r8), pointer :: tmp_ptr(:,:) real(esmf_kind_r8), allocatable :: skin_temp(:,:), & + ice(:,:), & tmp_array_2d(:,:), & nst_field_correct(:,:), & tref_correct(:,:),& @@ -80,7 +80,7 @@ program surface_nst_landfill !--------------------------------------------------------------------! !---------------- Setup Target Grid & Coordinates -------------------! !--------------------------------------------------------------------! - + i_target = IPTS_TARGET j_target = JPTS_TARGET @@ -93,10 +93,10 @@ program surface_nst_landfill if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN GridAddCoord", rc) - landmask_target_grid = ESMF_FieldCreate(target_grid, & + seamask_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_I8, & staggerloc=ESMF_STAGGERLOC_CENTER, & - name="target_grid_landmask", & + name="target_grid_seamask", & rc=rc) skin_temp_target_grid = ESMF_FieldCreate(target_grid, & @@ -105,22 +105,32 @@ program surface_nst_landfill name="target_grid_skin_temp", & rc=rc) + seaice_fract_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="target_grid_ice_fract", & + rc=rc) + call create_nst_esmf_fields allocate(mask(i_target,j_target)) + allocate(ice(i_target,j_target)) allocate(skin_temp(i_target,j_target)) allocate(nst_field_correct(i_target,j_target)) allocate(tref_correct(i_target,j_target)) allocate(xz_correct(i_target,j_target)) - mask = reshape((/0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0/),(/i_target,j_target/)) + ice = 0 ! ice free + mask = reshape((/1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1/),(/i_target,j_target/)) skin_temp = reshape((/280., 280., 280., 280., & 280., 290., 290., 280., & 280., 290., 290., 280., & 280., 280., 280., 280./),(/i_target,j_target/)) - call ESMF_FieldScatter(landmask_target_grid, mask, rootpet=0, rc=rc) + call ESMF_FieldScatter(seamask_target_grid, mask, rootpet=0, rc=rc) call ESMF_FieldScatter(skin_temp_target_grid, skin_temp, rootpet=0, rc=rc) - deallocate(mask, skin_temp) + call ESMF_FieldScatter(seaice_fract_target_grid, ice, rootpet=0, rc=rc) + + deallocate(mask, skin_temp, ice) nst_field_correct = reshape((/-999.9, -999.9, -999.9, -999.9, & -999.9, 0., 0., -999.9, & @@ -217,7 +227,7 @@ program surface_nst_landfill deallocate(tmp_array_2d,nst_field_correct,tref_correct,xz_correct) - call ESMF_FieldDestroy(landmask_target_grid,rc=rc) + call ESMF_FieldDestroy(seamask_target_grid,rc=rc) call ESMF_FieldDestroy(skin_temp_target_grid,rc=rc) call cleanup_target_nst_data call ESMF_GridDestroy(target_grid,rc=rc) diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index aafa48cae..710e9fbfb 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -636,7 +636,7 @@ The following parameters were used soil_type=$soil_type_src lake_data_srce=$lake_data_srce target_lon=$target_lon # Center longitude of grid - target_lat=target_lat # Center latitude of grid + target_lat=$target_lat # Center latitude of grid idim=$idim # Dimension of grid in 'i' direction jdim=$jdim # Dimension of grid in 'j' direction delx=$delx # Grid spacing (in degrees) in the 'i' direction