Skip to content

Commit

Permalink
Merge branch 'develop' into feature/cycle_frac
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Aug 23, 2021
2 parents 6c98ecd + f7cbbb5 commit fae377e
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
1 change: 1 addition & 0 deletions sorc/chgres_cube.fd/atmosphere.F90
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module atmosphere
!! target grid

public :: atmosphere_driver
public :: read_vcoord_info

contains

Expand Down
6 changes: 6 additions & 0 deletions tests/chgres_cube/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/config_gaussian_nemsio.nml ${CMAKE_CURRENT_BINARY_DIR}/data/config_gaussian_nemsio.nml)
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/config_gfs_grib2.nml ${CMAKE_CURRENT_BINARY_DIR}/data/config_gfs_grib2.nml)
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/global_hyblev.l28.txt ${CMAKE_CURRENT_BINARY_DIR}/data/global_hyblev.l28.txt)
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/data/config_spectral_sigio.nml ${CMAKE_CURRENT_BINARY_DIR}/data/config_spectral_sigio.nml)
execute_process( COMMAND ${CMAKE_COMMAND} -E copy
Expand Down Expand Up @@ -168,3 +170,7 @@ add_mpi_test(chgres_cube-ftst_surface_nst_landfill
EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/ftst_surface_nst_landfill
NUMPROCS 1
TIMEOUT 60)

add_executable(ftst_read_vcoord ftst_read_vcoord.F90)
target_link_libraries(ftst_read_vcoord chgres_cube_lib)
add_test(NAME chgres_cube-ftst_read_vcoord COMMAND ftst_read_vcoord)
30 changes: 30 additions & 0 deletions tests/chgres_cube/data/global_hyblev.l28.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
2 28
.000 1.00000000
.009 .98872586
11.635 .97440184
86.457 .95587239
292.577 .93174961
701.453 .90058087
1381.526 .86097487
2389.205 .81178485
3757.142 .75234710
5481.144 .68274682
7508.532 .60405491
9731.807 .51845667
11991.428 .42919536
14089.535 .34029321
15812.926 .25608430
16959.994 .18066704
17364.658 .11741761
16912.130 .06867500
15613.564 .03495010
13671.427 .01432627
11343.654 .00393276
8913.767 .00037868
6678.608 .00000000
4844.036 .00000000
3376.516 .00000000
2210.979 .00000000
1290.533 .00000000
566.898 .00000000
.000 .00000000
81 changes: 81 additions & 0 deletions tests/chgres_cube/ftst_read_vcoord.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
program vcoord

! Test the 'read_vcoord_info' routine, which reads
! the 'global_hyblev' files. These files contain
! the definition of the model vertical hybrid levels.
! The levels are defined by two coefficients 'ak'
! and 'bk' as follows:
!
! pressure(level) = ak + (bk * surface pressure)
!
! The 'read_vcoord_info' routine returns the
! number of vertical levels, the number of level
! interfaces (# of levels plus 1), the number of
! level coordinates (two for 'ak' and 'bk') and
! the 'ak' and 'bk' values. All are compared to
! expected values. The sample 'global_hyblev'
! file is set by variable "vcoord_file_target_grid'.
!
! @author George Gayno

use atmosphere, only : read_vcoord_info, &
vcoord_target, &
nvcoord_target, &
lev_target, &
levp1_target

use program_setup, only : vcoord_file_target_grid

implicit none

integer :: j

integer, parameter :: LEV_TARGET_EXPECTED=28 ! number of levels.
integer, parameter :: LEVP1_TARGET_EXPECTED=29 ! number of level interfaces.
integer, parameter :: NVCOORD_TARGET_EXPECTED=2 ! number of level coordinates.

real :: VCOORD_AK_EXPECTED(LEVP1_TARGET_EXPECTED) ! 'ak' values for each interface.
real :: VCOORD_BK_EXPECTED(LEVP1_TARGET_EXPECTED) ! 'bk' values for each interface.

data VCOORD_AK_EXPECTED /.000, .009, 11.635, &
86.457, 292.577, 701.453, &
1381.526, 2389.205, 3757.142, &
5481.144, 7508.532, 9731.807, &
11991.428, 14089.535, 15812.926, &
16959.994, 17364.658, 16912.130, &
15613.564, 13671.427, 11343.654, &
8913.767, 6678.608, 4844.036, &
3376.516, 2210.979, 1290.533, &
566.898, 0.000/

data VCOORD_BK_EXPECTED /1.00000000, .98872586, .97440184, &
.95587239, .93174961, .90058087, &
.86097487, .81178485, .75234710, &
.68274682, .60405491, .51845667, &
.42919536, .34029321, .25608430, &
.18066704, .11741761, .06867500, &
.03495010, .01432627, .00393276, &
.00037868, 0.0, 0.0, &
0.0, 0.0, 0.0, &
0.0, 0.0 /

print*,'Starting test of read_vcoord_info routine'

vcoord_file_target_grid="./data/global_hyblev.l28.txt"

call read_vcoord_info

if (lev_target /= LEV_TARGET_EXPECTED) stop 2
if (levp1_target /= LEVP1_TARGET_EXPECTED) stop 4
if (nvcoord_target /= NVCOORD_TARGET_EXPECTED) stop 6

do j = 1, levp1_target
if (vcoord_target(j,1) /= VCOORD_AK_EXPECTED(j)) stop 8
if (vcoord_target(j,2) /= VCOORD_BK_EXPECTED(j)) stop 10
enddo

print*,"OK"

print*,"SUCCESS!"

end program vcoord

0 comments on commit fae377e

Please sign in to comment.