/[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 198 - (hide annotations)
Tue May 31 16:17:35 2016 UTC (8 years ago) by guez
File size: 2540 byte(s)
Removed variables nk1 and nk in cv_driver and below. These arrays were
just equal to the constant minorig. (This is also the case in LMDZ.)

In cv_thermo, removed some variables which were copies of variables of
suphec_m. Changed some variables to named constants.

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

  ViewVC Help
Powered by ViewVC 1.1.21