Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 31 additions & 9 deletions tests/chres_cube/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
#
# George Gayno, Lin Gan, Ed Hartnett

set(fortran_src
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/utils.f90"
ftst_utils.F90)

if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian")
endif()

include_directories(
${PROJECT_SOURCE_DIR}
)
include_directories(${PROJECT_SOURCE_DIR})

# Copy necessary test files.
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/config.nml
${CMAKE_CURRENT_BINARY_DIR}/fort.41)

set(exe_name ftst_utils)
add_executable(${exe_name} ${fortran_src})
add_executable(ftst_utils "${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/utils.f90" ftst_utils.F90)
add_test(NAME ftst_utils COMMAND ftst_utils)
target_link_libraries(
ftst_utils
Expand All @@ -37,6 +35,30 @@ if(OpenMP_Fortran_FOUND)
target_link_libraries(ftst_utils OpenMP::OpenMP_Fortran)
endif()

add_executable(ftst_program_setup "${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/input_data.F90"
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/model_grid.F90"
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/program_setup.f90"
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/grib2_util.F90"
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/search_util.f90"
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/utils.f90"
ftst_program_setup.F90)
add_test(NAME ftst_program_setup COMMAND ftst_program_setup)
target_link_libraries(
ftst_program_setup
nemsio::nemsio
sfcio::sfcio
sigio::sigio
bacio::bacio_4
sp::sp_d
w3nco::w3nco_d
esmf
wgrib2::wgrib2_lib
wgrib2::wgrib2_api
MPI::MPI_Fortran
NetCDF::NetCDF_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(ftst_program_setup OpenMP::OpenMP_Fortran)
endif()



23 changes: 23 additions & 0 deletions tests/chres_cube/config.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
&config
mosaic_file_target_grid="/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96/C96_mosaic.nc"
fix_dir_target_grid="/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96/fix_sfc"
orog_dir_target_grid="/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96"
orog_files_target_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"
vcoord_file_target_grid="/scratch1/NCEPDEV/da/George.Gayno/ufs_utils.git/UFS_UTILS/reg_tests/chgres_cube/../../fix/fix_am/global_hyblev.l64.txt"
data_dir_input_grid="/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/input_data/fv3.nemsio"
atm_files_input_grid="gfs.t12z.atmf000.nemsio"
sfc_files_input_grid="gfs.t12z.sfcf000.nemsio"
cycle_mon=07
cycle_day=04
cycle_hour=12
convert_atm=.true.
convert_sfc=.true.
convert_nst=.true.
input_type="gaussian_nemsio"
tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel"
tracers_input="spfh","clwmr","o3mr","icmr","rwmr","snmr","grle"
regional=0
halo_bndy=0
halo_blend=0
/

42 changes: 42 additions & 0 deletions tests/chres_cube/ftst_program_setup.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
! Unit test for chres_cube utility, input_data.F90.
!
! Ed Hartnett 2/16/21

program ftst_program_setup
use esmf
use netcdf
use program_setup
implicit none

print*, "Starting test of program_setup."

print*, "testing read_setup_namelist..."
call read_setup_namelist()
if (cycle_mon .ne. 7 .or. cycle_day .ne. 4 .or. cycle_hour .ne. 12) stop 4
if (.not. convert_atm .or. .not. convert_sfc .or. .not. convert_nst) stop 5
if (regional .ne. 0 .or. halo_bndy .ne. 0 .or. halo_blend .ne. 0) stop 6
if (trim(mosaic_file_target_grid) .ne. "/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96/C96_mosaic.nc") stop 7
if (trim(fix_dir_target_grid) .ne. "/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96/fix_sfc") stop 8
if (trim(orog_dir_target_grid) .ne. "/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/fix/C96/") stop 9
if (trim(vcoord_file_target_grid) .ne. "/scratch1/NCEPDEV/da/George.Gayno/ufs_utils.git/UFS_UTILS/reg_tests/chgres_cube/../../fix/fix_am/global_hyblev.l64.txt") stop 10
if (trim(data_dir_input_grid) .ne. "/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/input_data/fv3.nemsio") stop 11
if (trim(atm_files_input_grid(1)) .ne. 'gfs.t12z.atmf000.nemsio') stop 12
if (trim(sfc_files_input_grid(1)) .ne. 'gfs.t12z.sfcf000.nemsio') stop 13
if (varmap_file .ne. "NULL") stop 14
if (thomp_mp_climo_file .ne. "NULL") stop 16
if (trim(cres_target_grid) .ne. "C96") stop 17
if (atm_weight_file .ne. "NULL") stop 18
if (trim(input_type) .ne. "gaussian_nemsio") stop 19
if (trim(external_model) .ne. "GFS") stop 20
if (num_tracers .ne. 7) stop 21
if (tracers(1) .ne. "sphum" .or. tracers(2) .ne. "liq_wat" .or. tracers(3) .ne. "o3mr" .or. &
tracers(4) .ne. "ice_wat" .or. tracers(5) .ne. "rainwat" .or. tracers(6) .ne. "snowwat" .or. &
tracers(7) .ne. "graupel") stop 22
if (tracers_input(1) .ne. "spfh" .or. tracers_input(2) .ne. "clwmr" .or. &
tracers_input(3) .ne. "o3mr" .or. tracers_input(4) .ne. "icmr" .or. &
tracers_input(5) .ne. "rwmr" .or. tracers_input(6) .ne. "snmr" .or. &
tracers_input(7) .ne. "grle") stop 23
print*, "OK"

print*, "SUCCESS!"
end program ftst_program_setup