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