Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test and bug fix for chgres_cube.fd/search_util.F90 #436

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add some hooks to call the search routine.
Fixes #279
  • Loading branch information
GeorgeGayno-NOAA committed Apr 8, 2021
commit f9e3be7fb2f262b4af82829a5ab9f763729f1490
2 changes: 1 addition & 1 deletion sorc/chgres_cube.fd/search_util.F90
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_l
case (230) ! soil type on the input grid
default_value = 11.0
case default
print*,'- FATAL ERROR. UNIDENTIFIED FIELD NUMBER : ', field
print*,'- FATAL ERROR. UNIDENTIFIED FIELD NUMBER : ', field_num
call mpi_abort(mpi_comm_world, 77, ierr)
end select

Expand Down
8 changes: 8 additions & 0 deletions tests/chres_cube/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,13 @@ if(OpenMP_Fortran_FOUND)
endif()

add_executable(ftst_search_util
"${CMAKE_SOURCE_DIR}/sorc/chgres_cube.fd/search_util.F90"
ftst_search_util.F90)
add_test(NAME ftst_search_util COMMAND ftst_search_util)
target_link_libraries(
ftst_search_util
esmf
MPI::MPI_Fortran)
if(OpenMP_Fortran_FOUND)
target_link_libraries(ftst_search_util OpenMP::OpenMP_Fortran)
endif()
35 changes: 35 additions & 0 deletions tests/chres_cube/ftst_search_util.F90
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
program test_search_util

use mpi
use esmf
use search_util

implicit none

integer, parameter :: idim = 3
integer, parameter :: jdim = 3
integer, parameter :: tile = 1

integer :: field_num, ierr
integer(esmf_kind_i8) :: mask(idim,jdim)

real(esmf_kind_r8) :: field(idim,jdim)
real(esmf_kind_r8) :: latitude(idim,jdim)
real(esmf_kind_r8) :: terrain_land(idim,jdim)
real(esmf_kind_r8) :: soilt_climo(idim,jdim)

data mask /0, 0, 0, 1, 1, 1, 0, 0, 0/

data latitude /-30.0, -30.0, -30.0, 0., 0., 0., 25.0, 25.0, 25.0/

data terrain_land /0., 0., 0., 50.0, 75.0, 80.0, 0., 0., 0./

data soilt_climo /285.0, 285.0, 285.0, 0., 0., 0., 278.0, 278.0, 278.0/

data field/0., 0., 0., 0., 0., 0., 0., 0., 0./

call mpi_init(ierr)

print*,'hello world'

field_num = 0

call search (field, mask, idim, jdim, tile, field_num, latitude, terrain_land, &
soilt_climo)

call mpi_finalize(ierr)

end program test_search_util