-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit test for chgres_cube routine 'read_vcoord_info' (#569)
Fixes #499.
- Loading branch information
1 parent
6112630
commit f7cbbb5
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ module atmosphere | |
!! target grid | ||
|
||
public :: atmosphere_driver | ||
public :: read_vcoord_info | ||
|
||
contains | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |