/[lmdze]/trunk/Sources/phylmd/CV30_routines/cv30_feed.f
ViewVC logotype

Annotation of /trunk/Sources/phylmd/CV30_routines/cv30_feed.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 197 - (hide annotations)
Tue May 24 12:25:29 2016 UTC (8 years ago) by guez
File size: 2615 byte(s)
Clarified the computation of sigt in cv30_unsat. Replacing pr2 by 1 -
pr1 changes the results.

1 guez 185 module cv30_feed_m
2 guez 47
3 guez 103 implicit none
4 guez 47
5 guez 103 contains
6 guez 47
7 guez 196 SUBROUTINE cv30_feed(t1, q1, qs1, p1, ph1, gz1, nk1, icb1, iflag1, tnk1, &
8     qnk1, gznk1, plcl1)
9 guez 47
10 guez 180 ! Purpose: convective feed
11 guez 47
12 guez 186 use cv30_param_m, only: minorig, nl
13 guez 195 USE dimphy, ONLY: klev, klon
14     use numer_rec_95, only: locate
15 guez 47
16 guez 195 real, intent(in):: t1(:, :) ! (klon, klev)
17     real, intent(in):: q1(:, :), qs1(:, :), p1(:, :) ! (klon, klev)
18     real, intent(in):: ph1(:, :) ! (klon, klev+1)
19     real, intent(in):: gz1(:, :) ! (klon, klev)
20 guez 47
21 guez 103 ! outputs:
22 guez 196
23     integer, intent(out):: nk1(:) ! (klon)
24    
25     integer, intent(out):: icb1(:) ! (klon)
26     ! first level above lcl, 2 <= icb1 <= nl - 2
27    
28     integer, intent(out):: iflag1(:) ! (klon)
29 guez 195 real tnk1(klon), qnk1(klon), gznk1(klon)
30     real, intent(out):: plcl1(klon)
31 guez 47
32 guez 180 ! Local:
33 guez 195 integer i
34     real pnk(klon), qsnk(klon), rh(klon), chi(klon)
35 guez 180 real, parameter:: A = 1669., B = 122.
36 guez 47
37 guez 103 !--------------------------------------------------------------------
38 guez 47
39 guez 196 iflag1 = 0
40 guez 195 plcl1 = 0.
41 guez 47
42 guez 180 ! Origin level of ascending parcels
43 guez 195 nk1 = minorig
44 guez 47
45 guez 180 ! Check whether parcel level temperature and specific humidity
46     ! are reasonable
47 guez 47
48 guez 195 do i = 1, klon
49     if (t1(i, nk1(i)) < 250. .or. q1(i, nk1(i)) <= 0.) iflag1(i) = 7
50 guez 103 end do
51 guez 47
52 guez 180 ! Calculate lifted condensation level of air at parcel origin level
53 guez 195 ! (within 0.2 % of formula of Bolton, Mon. Wea. Rev., 1980)
54 guez 47
55 guez 195 do i = 1, klon
56 guez 196 if (iflag1(i) == 0) then
57 guez 195 tnk1(i) = t1(i, nk1(i))
58     qnk1(i) = q1(i, nk1(i))
59     gznk1(i) = gz1(i, nk1(i))
60     pnk(i) = p1(i, nk1(i))
61     qsnk(i) = qs1(i, nk1(i))
62 guez 103
63 guez 195 rh(i) = qnk1(i) / qsnk(i)
64     chi(i) = tnk1(i) / (A - B*rh(i) - tnk1(i))
65     plcl1(i) = pnk(i)*(rh(i)**chi(i))
66 guez 196 if (plcl1(i) < 200. .or. plcl1(i) >= 2000.) iflag1(i) = 8
67 guez 103 endif
68     end do
69    
70 guez 196 ! Compute icb1:
71 guez 195 do i = 1, klon
72     if (plcl1(i) <= ph1(i, nl - 2)) then
73     ! Distinguish this case just so that icb1 = nl - 2, not nl =
74     ! 3, for plcl1 exactly == ph1(i, nl - 2). Maybe not useful.
75     icb1(i) = nl - 2
76     else
77     icb1(i) = locate(- ph1(i, 3:nl - 2), - plcl1(i), my_lbound = 3)
78     ! {2 <= icb1(i) <= nl - 3}
79 guez 197 ! {ph1(i, icb1(i) + 1) < plcl1(i)}
80     ! {plcl1(i) <= ph1(i, icb1(i)) or icb1(i) == 2}
81 guez 195 end if
82 guez 103 end do
83 guez 47
84 guez 196 where (icb1 == nl - 2 .and. iflag1 == 0) iflag1 = 9
85 guez 47
86 guez 197 ! {(2 <= icb1(i) <= nl - 3 and ph1(i, icb1(i) + 1) < plcl1(i) and
87     ! (plcl1(i) <= ph1(i, icb1(i)) or icb1(i) == 2)) or iflag1(i) /=
88     ! 0}
89    
90 guez 185 end SUBROUTINE cv30_feed
91 guez 103
92 guez 185 end module cv30_feed_m

  ViewVC Help
Powered by ViewVC 1.1.21