1 |
|
|
module test_disvert_m |
2 |
|
|
|
3 |
|
|
implicit none |
4 |
|
|
|
5 |
|
|
contains |
6 |
|
|
|
7 |
|
|
subroutine test_disvert |
8 |
|
|
|
9 |
|
|
! Author: Lionel GUEZ |
10 |
|
|
|
11 |
|
|
! This procedure tests the order of pressure values at half-levels |
12 |
|
|
! and full levels. We arbitrarily choose to test ngrid values of |
13 |
|
|
! the surface pressure, which sample possible values on Earth. |
14 |
|
|
|
15 |
|
|
use exner_hyb_m, only: exner_hyb |
16 |
|
|
use vertical_layers_mod, only: ap,bp,preff |
17 |
|
|
use comconst_mod, only: kappa, cpp |
18 |
|
|
|
19 |
|
|
! For llm: |
20 |
|
|
include "dimensions.h" |
21 |
|
|
|
22 |
|
|
! Local: |
23 |
|
|
integer l, i |
24 |
|
|
integer, parameter:: ngrid = 7 |
25 |
|
|
real p(ngrid, llm + 1) ! pressure at half-level, in Pa |
26 |
|
|
real pks(ngrid) ! exner function at the surface, in J K-1 kg-1 |
27 |
|
|
real pk(ngrid, llm) ! exner function at full level, in J K-1 kg-1 |
28 |
|
|
real ps(ngrid) ! surface pressure, in Pa |
29 |
|
|
real p_lay(ngrid, llm) ! pressure at full level, in Pa |
30 |
|
|
real delta_ps ! in Pa |
31 |
|
|
|
32 |
|
|
!--------------------- |
33 |
|
|
|
34 |
|
|
print *, "Call sequence information: test_disvert" |
35 |
|
|
|
36 |
|
|
delta_ps = 6e4 / (ngrid - 1) |
37 |
|
|
ps = (/(5e4 + delta_ps * i, i = 0, ngrid - 1)/) |
38 |
|
|
forall (l = 1: llm + 1) p(:, l) = ap(l) + bp(l) * ps |
39 |
|
|
call exner_hyb(ngrid, ps, p, pks, pk) |
40 |
|
|
p_lay = preff * (pk / cpp)**(1. / kappa) |
41 |
|
|
|
42 |
|
|
! Are pressure values in the right order? |
43 |
|
|
if (any(p(:, :llm) <= p_lay .or. p_lay <= p(:, 2:))) then |
44 |
|
|
! List details and stop: |
45 |
|
|
do l = 1, llm |
46 |
|
|
do i = 1, ngrid |
47 |
|
|
if (p(i, l) <= p_lay(i, l)) then |
48 |
|
|
print 1000, "ps = ", ps(i) / 100., "hPa, p(level ", l, & |
49 |
|
|
") = ", p(i, l) / 100., " hPa <= p(layer ", l, ") = ", & |
50 |
|
|
p_lay(i, l) / 100., " hPa" |
51 |
|
|
end if |
52 |
|
|
if (p_lay(i, l) <= p(i, l + 1)) then |
53 |
|
|
print 1000, "ps = ", ps(i) / 100., "hPa, p(layer ", l, ") = ", & |
54 |
|
|
p_lay(i, l) / 100., " hPa <= p(level ", l + 1, ") = ", & |
55 |
|
|
p(i, l + 1) / 100., " hPa" |
56 |
|
|
end if |
57 |
|
|
end do |
58 |
|
|
end do |
59 |
|
|
call abort_physic("test_disvert", "bad order of pressure values", 1) |
60 |
|
|
end if |
61 |
|
|
|
62 |
|
|
1000 format (3(a, g10.4, a, i0)) |
63 |
|
|
|
64 |
|
|
end subroutine test_disvert |
65 |
|
|
|
66 |
|
|
end module test_disvert_m |