1 | subroutine moldiffcoeff_red(dij,indic,gcmind,ncompdiff2) |
---|
2 | |
---|
3 | USE chemparam_mod |
---|
4 | USE infotrac_phy |
---|
5 | USE dimphy |
---|
6 | |
---|
7 | IMPLICIT NONE |
---|
8 | c======================================================================= |
---|
9 | c subject: |
---|
10 | c -------- |
---|
11 | c Computing molecular diffusion coefficients |
---|
12 | c following Nair 94 (pg 131) |
---|
13 | c author: MAC 2002 |
---|
14 | c ------ |
---|
15 | c |
---|
16 | c======================================================================= |
---|
17 | #include "diffusion.h" |
---|
18 | |
---|
19 | c----------------------------------------------------------------------- |
---|
20 | c Input/Output |
---|
21 | c ------------ |
---|
22 | c integer,parameter :: ncompmoldiff = 12 |
---|
23 | integer ncompdiff2 |
---|
24 | integer gcmind(ncompdiff2) |
---|
25 | real dij(ncompdiff2,ncompdiff2) |
---|
26 | integer indic(nqtot) |
---|
27 | |
---|
28 | c Local variables: |
---|
29 | c --------------- |
---|
30 | INTEGER nq, n, nn, i,iq |
---|
31 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
32 | c tracer numbering in the molecular diffusion |
---|
33 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
34 | |
---|
35 | real :: dijh2co,dijh2n2,dijh2co2,dijh2o2,dijho,dijref |
---|
36 | ! integer :: i_h2,i_h,i_o |
---|
37 | integer :: g_h2,g_h,g_o |
---|
38 | ! integer,parameter :: i_o = 1 |
---|
39 | ! integer,parameter :: i_n2 = 2 |
---|
40 | ! integer,parameter :: i_co = 3 |
---|
41 | ! integer,parameter :: i_ar = 4 |
---|
42 | ! integer,parameter :: i_h2 = 5 |
---|
43 | ! integer,parameter :: i_h = 6 |
---|
44 | ! integer,parameter :: i_o2 = 7 |
---|
45 | ! integer,parameter :: i_oh = 8 |
---|
46 | ! integer,parameter :: i_ho2 = 9 |
---|
47 | ! integer,parameter :: i_h2o = 10 |
---|
48 | ! integer,parameter :: i_h2o2 = 11 |
---|
49 | ! integer,parameter :: i_o1d = 12 |
---|
50 | ! integer,parameter :: i_o3 = 13 |
---|
51 | ! integer,parameter :: i_n = 13 |
---|
52 | ! integer,parameter :: i_no = 14 |
---|
53 | ! integer,parameter :: i_no2 = 15 |
---|
54 | ! integer,parameter :: i_n2d = 17 |
---|
55 | ! integer,parameter :: i_oplus = 18 |
---|
56 | ! integer,parameter :: i_co2 = 16 |
---|
57 | ! integer,parameter :: i_oplus = 17 |
---|
58 | ! integer,parameter :: i_hplus = 18 |
---|
59 | |
---|
60 | ! Tracer indexes in the GCM: |
---|
61 | ! integer,save :: g_co2=0 |
---|
62 | ! integer,save :: g_co=0 |
---|
63 | ! integer,save :: g_o=0 |
---|
64 | ! integer,save :: g_o1d=0 |
---|
65 | ! integer,save :: g_o2=0 |
---|
66 | ! integer,save :: g_o3=0 |
---|
67 | ! integer,save :: g_h=0 |
---|
68 | ! integer,save :: g_h2=0 |
---|
69 | ! integer,save :: g_oh=0 |
---|
70 | ! integer,save :: g_ho2=0 |
---|
71 | ! integer,save :: g_h2o2=0 |
---|
72 | ! integer,save :: g_n2=0 |
---|
73 | ! integer,save :: g_ar=0 |
---|
74 | ! integer,save :: g_h2o=0 |
---|
75 | ! integer,save :: g_n=0 |
---|
76 | ! integer,save :: g_no=0 |
---|
77 | ! integer,save :: g_no2=0 |
---|
78 | ! integer,save :: g_n2d=0 |
---|
79 | ! integer,save :: g_oplus=0 |
---|
80 | ! integer,save :: g_hplus=0 |
---|
81 | |
---|
82 | ! integer,save :: gcmind(ncompdiff) |
---|
83 | |
---|
84 | real dnh |
---|
85 | logical,save :: firstcall=.true. |
---|
86 | logical,parameter :: outputcoeffs=.false. ! to output 'coeffs.dat' file, |
---|
87 | ! set outputcoeffs=.true. |
---|
88 | |
---|
89 | ! Initializations at first call (and some sanity checks) |
---|
90 | if (firstcall) then |
---|
91 | ! identify the indexes of the tracers we'll need |
---|
92 | ! g_co2=igcm_co2 |
---|
93 | ! if (g_co2.eq.0) then |
---|
94 | ! write(*,*) "moldiffcoeff: Error; no CO2 tracer !!!" |
---|
95 | ! stop |
---|
96 | ! endif |
---|
97 | ! g_n2=igcm_n2 |
---|
98 | ! if (g_n2.eq.0) then |
---|
99 | ! write(*,*) "moldiffcoeff: Error; no N2 tracer !!!" |
---|
100 | ! stop |
---|
101 | ! endif |
---|
102 | ! g_ar=igcm_ar |
---|
103 | ! if (g_ar.eq.0) then |
---|
104 | ! write(*,*) "moldiffcoeff: Error; no Ar tracer !!!" |
---|
105 | ! stop |
---|
106 | ! endif |
---|
107 | ! g_h2=igcm_h2 |
---|
108 | ! if (g_h2.eq.0) then |
---|
109 | ! write(*,*) "moldiffcoeff: Error; no H2 tracer !!!" |
---|
110 | ! stop |
---|
111 | ! endif |
---|
112 | ! g_h=igcm_h |
---|
113 | ! if (g_h.eq.0) then |
---|
114 | ! write(*,*) "moldiffcoeff: Error; no H tracer !!!" |
---|
115 | ! stop |
---|
116 | ! endif |
---|
117 | ! g_co=igcm_co |
---|
118 | ! if (g_co.eq.0) then |
---|
119 | ! write(*,*) "moldiffcoeff: Error; no CO tracer !!!" |
---|
120 | ! stop |
---|
121 | ! endif |
---|
122 | ! g_o2=igcm_o2 |
---|
123 | ! if (g_o2.eq.0) then |
---|
124 | ! write(*,*) "moldiffcoeff: Error; no O2 tracer !!!" |
---|
125 | ! stop |
---|
126 | ! endif |
---|
127 | ! g_oh=igcm_oh |
---|
128 | ! if (g_oh.eq.0) then |
---|
129 | ! write(*,*) "moldiffcoeff: Error; no OH tracer !!!" |
---|
130 | ! stop |
---|
131 | ! endif |
---|
132 | ! g_ho2=igcm_ho2 |
---|
133 | ! if (g_ho2.eq.0) then |
---|
134 | ! write(*,*) "moldiffcoeff: Error; no HO2 tracer !!!" |
---|
135 | ! stop |
---|
136 | ! endif |
---|
137 | ! g_h2o=igcm_h2o_vap |
---|
138 | ! if (g_h2o.eq.0) then |
---|
139 | ! write(*,*) "moldiffcoeff: Error; no H2O tracer !!!" |
---|
140 | ! stop |
---|
141 | ! endif |
---|
142 | ! g_h2o2=igcm_h2o2 |
---|
143 | ! if (g_h2o2.eq.0) then |
---|
144 | ! write(*,*) "moldiffcoeff: Error; no H2O2 tracer !!!" |
---|
145 | ! stop |
---|
146 | ! endif |
---|
147 | ! g_o1d=igcm_o1d |
---|
148 | ! if (g_h.eq.0) then |
---|
149 | ! write(*,*) "moldiffcoeff: Error; no O1d tracer !!!" |
---|
150 | ! stop |
---|
151 | ! endif |
---|
152 | ! g_o3=igcm_o3 |
---|
153 | ! if (g_o3.eq.0) then |
---|
154 | ! write(*,*) "moldiffcoeff: Error; no O3 tracer !!!" |
---|
155 | ! stop |
---|
156 | ! endif |
---|
157 | ! g_n=igcm_n |
---|
158 | ! if (g_n.eq.0) then |
---|
159 | ! write(*,*) "moldiffcoeff: Error; no N tracer !!!" |
---|
160 | ! stop |
---|
161 | ! endif |
---|
162 | ! g_no=igcm_no |
---|
163 | ! if (g_no.eq.0) then |
---|
164 | ! write(*,*) "moldiffcoeff: Error; no NO tracer !!!" |
---|
165 | ! stop |
---|
166 | ! endif |
---|
167 | ! g_no2=igcm_no2 |
---|
168 | ! if (g_no2.eq.0) then |
---|
169 | ! write(*,*) "moldiffcoeff: Error; no NO2 tracer !!!" |
---|
170 | ! stop |
---|
171 | ! endif |
---|
172 | ! g_n2d=igcm_n2d |
---|
173 | ! if (g_n2d.eq.0) then |
---|
174 | ! write(*,*) "moldiffcoeff: Error; no N2(D) tracer !!!" |
---|
175 | ! stop |
---|
176 | ! endif |
---|
177 | ! g_oplus=igcm_oplus |
---|
178 | ! if (g_oplus .eq. 0) then |
---|
179 | ! write(*,*) "moldiffcoeff: Error; no Oplus tracer !!!" |
---|
180 | ! stop |
---|
181 | ! endif |
---|
182 | ! g_hplus=igcm_hplus |
---|
183 | ! if (g_hplus .eq. 0) then |
---|
184 | ! write(*,*) "moldiffcoeff: Error; no Hplus tracer !!!" |
---|
185 | ! stop |
---|
186 | ! endif |
---|
187 | ! g_o=igcm_o |
---|
188 | ! if (g_o.eq.0) then |
---|
189 | ! write(*,*) "moldiffcoeff: Error; no O tracer !!!" |
---|
190 | ! stop |
---|
191 | ! endif |
---|
192 | |
---|
193 | c |
---|
194 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
195 | c fill array to relate local indexes to gcm indexes |
---|
196 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
197 | |
---|
198 | ! gcmind(i_co2) = g_co2 |
---|
199 | ! gcmind(i_n2) = g_n2 |
---|
200 | ! gcmind(i_ar) = g_ar |
---|
201 | ! gcmind(i_h2) = g_h2 |
---|
202 | ! gcmind(i_h) = g_h |
---|
203 | ! gcmind(i_co) = g_co |
---|
204 | ! gcmind(i_o2) = g_o2 |
---|
205 | ! gcmind(i_oh)= g_oh |
---|
206 | ! gcmind(i_ho2) = g_ho2 |
---|
207 | ! gcmind(i_h2o) = g_h2o |
---|
208 | ! gcmind(i_h2o2)= g_h2o2 |
---|
209 | ! gcmind(i_o1d) = g_o1d |
---|
210 | ! gcmind(i_o3) = g_o3 |
---|
211 | ! gcmind(i_n)= g_n |
---|
212 | ! gcmind(i_no) = g_no |
---|
213 | ! gcmind(i_no2) = g_no2 |
---|
214 | ! gcmind(i_n2d) = g_n2d |
---|
215 | ! gcmind(i_oplus) = g_oplus |
---|
216 | ! gcmind(i_hplus) = g_hplus |
---|
217 | ! gcmind(i_o) = g_o |
---|
218 | |
---|
219 | c |
---|
220 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
221 | firstcall= .false. |
---|
222 | endif ! of if (firstcall) |
---|
223 | |
---|
224 | dijh2co = 0.0000651 |
---|
225 | dijh2n2 = 0.0000674 |
---|
226 | dijh2o2 = 0.0000697 |
---|
227 | dijh2co2 = 0.0000550 |
---|
228 | dijho = 0.000114 |
---|
229 | |
---|
230 | ! dij(i_h2,i_co) = 0.0000651 |
---|
231 | ! dij(i_h2,i_n2) = 0.0000674 |
---|
232 | ! dij(i_h2,i_o2) = 0.0000697 |
---|
233 | ! dij(i_h2,i_co2) = 0.0000550 |
---|
234 | ! dij(i_h2,i_h2) = 0.0 |
---|
235 | ! dij(i_h2,i_h) = 0.0 |
---|
236 | ! dij(i_h2,i_h2o) = 0.0 !0003 |
---|
237 | ! dij(i_h2,i_h2o2) = 0.0 !0003 |
---|
238 | ! dij(i_h2,i_o3) = 0.0 !0003 |
---|
239 | ! dij(i_h2,i_o) = 0.0 |
---|
240 | ! dij(i_h2,i_ar) = 0.0 |
---|
241 | ! dij(i_h2,i_n) = 0.0 |
---|
242 | |
---|
243 | !c dij(i_h,i_o) = 0.0000144 |
---|
244 | ! dij(i_h,i_o) = 0.000114 |
---|
245 | |
---|
246 | ! find h2, h and o index in gcm |
---|
247 | ! these species are used to define the diffusion coefficients |
---|
248 | |
---|
249 | do n=1,nqtot |
---|
250 | if (tname(n) .eq. 'h2') g_h2=n |
---|
251 | if (tname(n) .eq. 'h') g_h=n |
---|
252 | if (tname(n) .eq. 'o') g_o=n |
---|
253 | enddo |
---|
254 | print*,'moldiffcoeff_red: gh2',g_h2,g_h,g_o |
---|
255 | |
---|
256 | print*,'moldiffcoeff_red: COEFF CALC' |
---|
257 | |
---|
258 | do n=1,ncompdiff2 |
---|
259 | dijref=0. |
---|
260 | if (tname(gcmind(n)) .eq. 'co') dijref=dijh2co |
---|
261 | if (tname(gcmind(n)) .eq. 'n2') dijref=dijh2n2 |
---|
262 | if (tname(gcmind(n)) .eq. 'o2') dijref=dijh2o2 |
---|
263 | if (tname(gcmind(n)) .eq. 'co2') dijref=dijh2co2 |
---|
264 | ! print*,'test',n,dijref |
---|
265 | if (dijref .gt. 0.0) then |
---|
266 | do nn=n,ncompdiff2 |
---|
267 | dij(nn,n)=dijref |
---|
268 | & *sqrt(M_tr(g_h2)/M_tr(gcmind(nn))) |
---|
269 | if(n.eq.nn) dij(nn,n)=1.0 |
---|
270 | dij(n,nn)=dij(nn,n) |
---|
271 | enddo |
---|
272 | endif |
---|
273 | if (dijref .eq. 0.0) then |
---|
274 | dijref=dijho |
---|
275 | dnh=dijref*sqrt(M_tr(g_o)/M_tr(gcmind(n))) |
---|
276 | do nn=n,ncompdiff2 |
---|
277 | dij(nn,n)=dnh*sqrt(M_tr(g_h)/M_tr(gcmind(nn))) |
---|
278 | if(n.eq.nn) dij(nn,n)=1.0 |
---|
279 | dij(n,nn)=dij(nn,n) |
---|
280 | enddo |
---|
281 | endif |
---|
282 | enddo |
---|
283 | |
---|
284 | if (outputcoeffs) then |
---|
285 | ! output coefficients in 'coeffs.dat' file |
---|
286 | open(56,file='coeffs.dat',status='unknown') |
---|
287 | do n=1,ncompdiff2 |
---|
288 | do nn=n,ncompdiff2 |
---|
289 | write(56,*) n,nn,dij(n,nn) !*1.e5/1.381e-23/(273**1.75) |
---|
290 | enddo |
---|
291 | enddo |
---|
292 | close(56) |
---|
293 | endif |
---|
294 | |
---|
295 | |
---|
296 | return |
---|
297 | end |
---|
298 | |
---|