1 | SUBROUTINE concentrations2(pplay,t_seri,pdt,tr_seri, nqmx) |
---|
2 | |
---|
3 | use dimphy |
---|
4 | use conc, only: mmean, rho, Akknew, rnew, cpnew |
---|
5 | use cpdet_phy_mod, only: cpdet |
---|
6 | USE chemparam_mod |
---|
7 | |
---|
8 | implicit none |
---|
9 | |
---|
10 | !======================================================================= |
---|
11 | ! CALCULATION OF MEAN MOLECULAR MASS, Cp, Akk and R |
---|
12 | ! |
---|
13 | ! mmean(klon,klev) amu |
---|
14 | ! cpnew(klon,klev) J/kg/K |
---|
15 | ! rnew(klon,klev) J/kg/K |
---|
16 | ! akknew(klon,klev) coefficient of thermal conduction |
---|
17 | ! |
---|
18 | ! version: April 2012 - Franck Lefevre |
---|
19 | !======================================================================= |
---|
20 | |
---|
21 | ! declarations |
---|
22 | |
---|
23 | #include "YOMCST.h" |
---|
24 | #include "clesphys.h" |
---|
25 | c#include "comdiurn.h" |
---|
26 | c#include "chimiedata.h" |
---|
27 | c#include "tracer.h" |
---|
28 | c#include "mmol.h" |
---|
29 | |
---|
30 | ! input/output |
---|
31 | |
---|
32 | real pplay(klon,klev) |
---|
33 | c real pt(klon,klev) |
---|
34 | integer,intent(in) :: nqmx ! number of tracers |
---|
35 | real t_seri(klon, klev) |
---|
36 | real pdt(klon,klev) |
---|
37 | real n2vmr_gcm(klon,klev),nvmr_gcm(klon,klev) |
---|
38 | real tr_seri(klon,klev,nqmx) |
---|
39 | c real pdq(klon,klev,nqmx) |
---|
40 | real ptimestep |
---|
41 | |
---|
42 | ! local variables |
---|
43 | |
---|
44 | integer :: i, l, ig, iq |
---|
45 | integer, save :: nbq |
---|
46 | integer,allocatable,save :: niq(:) |
---|
47 | real :: ni(nqmx), ntot |
---|
48 | real :: zt(klon, klev) |
---|
49 | real :: zq(klon, klev, nqmx) |
---|
50 | real,allocatable,save :: aki(:) |
---|
51 | real,allocatable,save :: cpi(:) |
---|
52 | real, save :: akin,akin2 |
---|
53 | |
---|
54 | logical, save :: firstcall = .true. |
---|
55 | |
---|
56 | if (firstcall) then |
---|
57 | |
---|
58 | ! initialize thermal conductivity and specific heat coefficients |
---|
59 | ! values are taken from the literature [J/kg K] |
---|
60 | |
---|
61 | ! allocate local saved arrays: |
---|
62 | allocate(aki(nqmx)) |
---|
63 | allocate(cpi(nqmx)) |
---|
64 | allocate(niq(nqmx)) |
---|
65 | |
---|
66 | ! find index of chemical tracers to use |
---|
67 | ! initialize thermal conductivity and specific heat coefficients |
---|
68 | ! !? values are estimated |
---|
69 | |
---|
70 | nbq = 0 ! to count number of tracers used in this subroutine |
---|
71 | |
---|
72 | if (i_co2 /= 0) then |
---|
73 | nbq = nbq + 1 |
---|
74 | niq(nbq) = i_co2 |
---|
75 | aki(nbq) = 3.072e-4 |
---|
76 | cpi(nbq) = 0.834e3 |
---|
77 | end if |
---|
78 | if (i_co /= 0) then |
---|
79 | nbq = nbq + 1 |
---|
80 | niq(nbq) = i_co |
---|
81 | aki(nbq) = 4.87e-4 |
---|
82 | cpi(nbq) = 1.034e3 |
---|
83 | end if |
---|
84 | if (i_o /= 0) then |
---|
85 | nbq = nbq + 1 |
---|
86 | niq(nbq) = i_o |
---|
87 | aki(nbq) = 7.59e-4 |
---|
88 | cpi(nbq) = 1.3e3 |
---|
89 | end if |
---|
90 | if (i_o1d /= 0) then |
---|
91 | nbq = nbq + 1 |
---|
92 | niq(nbq) = i_o1d |
---|
93 | aki(nbq) = 7.59e-4 !? |
---|
94 | cpi(nbq) = 1.3e3 !? |
---|
95 | end if |
---|
96 | if (i_o2 /= 0) then |
---|
97 | nbq = nbq + 1 |
---|
98 | niq(nbq) = i_o2 |
---|
99 | aki(nbq) = 5.68e-4 |
---|
100 | cpi(nbq) = 0.9194e3 |
---|
101 | end if |
---|
102 | if (i_o3 /= 0) then |
---|
103 | nbq = nbq + 1 |
---|
104 | niq(nbq) = i_o3 |
---|
105 | aki(nbq) = 3.00e-4 !? |
---|
106 | cpi(nbq) = 0.800e3 !? |
---|
107 | end if |
---|
108 | if (i_h /= 0) then |
---|
109 | nbq = nbq + 1 |
---|
110 | niq(nbq) = i_h |
---|
111 | aki(nbq) = 0.0 |
---|
112 | cpi(nbq) = 20.780e3 |
---|
113 | end if |
---|
114 | if (i_h2 /= 0) then |
---|
115 | nbq = nbq + 1 |
---|
116 | niq(nbq) = i_h2 |
---|
117 | aki(nbq) = 36.314e-4 |
---|
118 | cpi(nbq) = 14.266e3 |
---|
119 | end if |
---|
120 | if (i_oh /= 0) then |
---|
121 | nbq = nbq + 1 |
---|
122 | niq(nbq) = i_oh |
---|
123 | aki(nbq) = 7.00e-4 !? |
---|
124 | cpi(nbq) = 1.045e3 |
---|
125 | end if |
---|
126 | if (i_ho2 /= 0) then |
---|
127 | nbq = nbq + 1 |
---|
128 | niq(nbq) = i_ho2 |
---|
129 | aki(nbq) = 0.0 |
---|
130 | cpi(nbq) = 1.065e3 !? |
---|
131 | end if |
---|
132 | if (i_n2 /= 0) then |
---|
133 | nbq = nbq + 1 |
---|
134 | niq(nbq) = i_n2 |
---|
135 | aki(nbq) = 5.6e-4 |
---|
136 | cpi(nbq) = 1.034e3 |
---|
137 | end if |
---|
138 | c if (i_ar /= 0) then |
---|
139 | c nbq = nbq + 1 |
---|
140 | c niq(nbq) = i_ar |
---|
141 | c aki(nbq) = 0.0 !? |
---|
142 | c cpi(nbq) = 1.000e3 !? |
---|
143 | c end if |
---|
144 | if (i_h2o /= 0) then |
---|
145 | nbq = nbq + 1 |
---|
146 | niq(nbq) = i_h2o |
---|
147 | aki(nbq) = 0.0 |
---|
148 | cpi(nbq) = 1.870e3 |
---|
149 | end if |
---|
150 | c if (i_n /= 0) then |
---|
151 | c nbq = nbq + 1 |
---|
152 | c niq(nbq) = i_n |
---|
153 | c aki(nbq) = 0.0 |
---|
154 | c cpi(nbq) = 0.0 |
---|
155 | c endif |
---|
156 | c if(i_no /= 0) then |
---|
157 | c nbq = nbq + 1 |
---|
158 | c niq(nbq) = i_no |
---|
159 | c aki(nbq) = 0.0 |
---|
160 | c cpi(nbq) = 0.0 |
---|
161 | c endif |
---|
162 | c if(i_no2 /= 0) then |
---|
163 | c nbq = nbq + 1 |
---|
164 | c niq(nbq) = i_no2 |
---|
165 | c aki(nbq) = 0.0 |
---|
166 | c cpi(nbq) = 0.0 |
---|
167 | c endif |
---|
168 | c if(i_n2d /= 0) then |
---|
169 | c nbq = nbq + 1 |
---|
170 | c niq(nbq) = i_n2d |
---|
171 | c aki(nbq) = 0.0 |
---|
172 | c cpi(nbq) = 0.0 |
---|
173 | c endif |
---|
174 | |
---|
175 | ! tell the world about it: |
---|
176 | write(*,*) "concentrations: firstcall, nbq=",nbq |
---|
177 | ! write(*,*) " niq(1:nbq)=",niq(1:nbq) |
---|
178 | ! write(*,*) " aki(1:nbq)=",aki(1:nbq) |
---|
179 | ! write(*,*) " cpi(1:nbq)=",cpi(1:nbq) |
---|
180 | |
---|
181 | |
---|
182 | firstcall = .false. |
---|
183 | end if ! if (firstcall) |
---|
184 | |
---|
185 | ! update temperature |
---|
186 | |
---|
187 | do l = 1,klev |
---|
188 | do ig = 1,klon |
---|
189 | zt(ig,l) = t_seri(ig,l) |
---|
190 | end do |
---|
191 | end do |
---|
192 | |
---|
193 | |
---|
194 | ! update mass mixing ratio tracers |
---|
195 | |
---|
196 | do l = 1,klev |
---|
197 | do ig = 1,klon |
---|
198 | do i = 1,nqmx |
---|
199 | ! iq = niq(i) |
---|
200 | zq(ig,l,i) = max(1.e-30, tr_seri(ig,l,i)) |
---|
201 | end do |
---|
202 | end do |
---|
203 | end do |
---|
204 | |
---|
205 | ! mmean : mean molecular mass |
---|
206 | ! rho : mass density [kg/m3] |
---|
207 | ! rnew : specific gas constant |
---|
208 | |
---|
209 | mmean(:,:) = 0. |
---|
210 | rho(:,:) = 0. |
---|
211 | |
---|
212 | do l = 1,klev |
---|
213 | do ig = 1,klon |
---|
214 | do i = 1,nqmx |
---|
215 | c iq = niq(i) |
---|
216 | mmean(ig,l) = mmean(ig,l) + zq(ig,l,i)/M_tr(i) |
---|
217 | end do |
---|
218 | mmean(ig,l) = 1./mmean(ig,l) |
---|
219 | rnew(ig,l) = 8.314/mmean(ig,l)*1.e3 ! J/kg K |
---|
220 | c write(*,*),'Mmean in concentration2: ',ig, l, mmean(ig,l) |
---|
221 | end do |
---|
222 | end do |
---|
223 | |
---|
224 | ! cpnew : specific heat |
---|
225 | ! akknew : thermal conductivity cofficient |
---|
226 | |
---|
227 | cpnew(:,:) = 0. |
---|
228 | akknew(:,:) = 0. |
---|
229 | |
---|
230 | do l = 1,klev |
---|
231 | do ig = 1,klon |
---|
232 | |
---|
233 | ntot = pplay(ig,l)/(RKBOL*zt(ig,l))*1.e-6 ! in #/cm3 |
---|
234 | rho(ig,l) = (ntot * mmean(ig,l))/RNAVO*1.e3 ! in kg/m3 |
---|
235 | |
---|
236 | c write(*,*),'Air density: ',ig, l, rho(0,l) |
---|
237 | |
---|
238 | !! WARNING -> Cp here below doesn't depend on T (cpdet) |
---|
239 | |
---|
240 | do i = 1,nbq |
---|
241 | c iq = niq(i) |
---|
242 | ni(i) = ntot*zq(ig,l,i)*mmean(ig,l)/M_tr(i) |
---|
243 | cpnew(ig,l) = cpnew(ig,l) + ni(i)*cpi(i) |
---|
244 | akknew(ig,l) = akknew(ig,l) + ni(i)*aki(i) |
---|
245 | end do |
---|
246 | |
---|
247 | |
---|
248 | cpnew(ig,l) = cpnew(ig,l)/ntot |
---|
249 | akknew(ig,l)= akknew(ig,l)/ntot |
---|
250 | |
---|
251 | |
---|
252 | end do |
---|
253 | end do |
---|
254 | |
---|
255 | return |
---|
256 | end |
---|