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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (show annotations)
Mon Mar 21 15:36:26 2016 UTC (8 years, 1 month ago) by guez
File size: 2639 byte(s)
Removed variables nlm and nlp of module cv30_param_m. We do not
believe much in the benefit of these intermediary variables so we go
for clarity.

Removed variable noff of module cv30_param_m. Never used anywhere
else. Just set the value of nl explicitly in cv30_param.

Removed argument nd of cv30_param. Only called with nd = klev.

Replaced calls to zilch by array assignments. There was a strange
double call to zilch with the same arguments in cv30_mixing.

Removed procedure cv_flag. Just set the value of variable cvflag_grav
of module cvflag at declaration.

1 module cv30_feed_m
2
3 implicit none
4
5 contains
6
7 SUBROUTINE cv30_feed(len, nd, t, q, qs, p, ph, gz, nk, icb, icbmax, iflag, &
8 tnk, qnk, gznk, plcl)
9
10 ! Purpose: convective feed
11
12 ! Main differences with cv_feed:
13 ! - ph added in input
14 ! - here, nk(i) = minorig
15 ! - icb defined differently (plcl compared with ph instead of p)
16
17 use cv30_param_m, only: minorig, nl
18
19 integer, intent(in):: len, nd
20 real, intent(in):: t(len, nd)
21 real, intent(in):: q(len, nd), qs(len, nd), p(len, nd)
22 real, intent(in):: ph(len, nd+1)
23 real, intent(in):: gz(len, nd)
24
25 ! outputs:
26 integer, intent(out):: nk(len), icb(len), icbmax
27 integer, intent(inout):: iflag(len)
28 real tnk(len), qnk(len), gznk(len)
29 real, intent(out):: plcl(len)
30
31 ! Local:
32 integer i, k
33 real pnk(len), qsnk(len), rh(len), chi(len)
34 real, parameter:: A = 1669., B = 122.
35
36 !--------------------------------------------------------------------
37
38 plcl = 0.
39
40 ! Origin level of ascending parcels
41
42 do i = 1, len
43 nk(i) = minorig
44 end do
45
46 ! Check whether parcel level temperature and specific humidity
47 ! are reasonable
48
49 do i = 1, len
50 if ((t(i, nk(i)) < 250. .or. q(i, nk(i)) <= 0.) .and. iflag(i) == 0) &
51 iflag(i) = 7
52 end do
53
54 ! Calculate lifted condensation level of air at parcel origin level
55 ! (within 0.2% of formula of Bolton, Mon. Wea. Rev., 1980)
56
57 do i = 1, len
58 if (iflag(i) /= 7) then
59 tnk(i) = t(i, nk(i))
60 qnk(i) = q(i, nk(i))
61 gznk(i) = gz(i, nk(i))
62 pnk(i) = p(i, nk(i))
63 qsnk(i) = qs(i, nk(i))
64
65 rh(i) = qnk(i)/qsnk(i)
66 chi(i) = tnk(i)/(A-B*rh(i)-tnk(i))
67 plcl(i) = pnk(i)*(rh(i)**chi(i))
68 if ((plcl(i) < 200. .or. plcl(i) >= 2000.) .and. iflag(i) == 0) &
69 iflag(i) = 8
70 endif
71 end do
72
73 ! Calculate first level above lcl (= icb)
74
75 do i = 1, len
76 icb(i) = nl - 1
77 end do
78
79 ! La modification consiste \`a comparer plcl \`a ph et non \`a p:
80 ! icb est d\'efini par : ph(icb) < plcl < ph(icb - 1)
81 do k = 3, nl-1 ! modification pour que icb soit supérieur ou égal à 2
82 do i = 1, len
83 if (ph(i, k) < plcl(i)) icb(i) = min(icb(i), k)
84 end do
85 end do
86
87 do i = 1, len
88 if ((icb(i) == nl - 1).and.(iflag(i) == 0)) iflag(i) = 9
89 end do
90
91 do i = 1, len
92 icb(i) = icb(i)-1 ! icb >= 2
93 end do
94
95 ! Compute icbmax
96
97 icbmax = 2
98
99 do i = 1, len
100 if (iflag(i) < 7) icbmax = max(icbmax, icb(i))
101 end do
102
103 end SUBROUTINE cv30_feed
104
105 end module cv30_feed_m

  ViewVC Help
Powered by ViewVC 1.1.21