[1442] | 1 | subroutine moldiffcoeff_red(dij,indic,gcmind,ncompdiff2) |
---|
| 2 | |
---|
| 3 | USE chemparam_mod |
---|
[1621] | 4 | USE infotrac_phy |
---|
[1442] | 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. |
---|
[2523] | 86 | ! logical,parameter :: outputcoeffs=.true. ! to output 'coeffs.dat' file, |
---|
[1442] | 87 | logical,parameter :: outputcoeffs=.false. ! to output 'coeffs.dat' file, |
---|
| 88 | ! set outputcoeffs=.true. |
---|
| 89 | |
---|
| 90 | ! Initializations at first call (and some sanity checks) |
---|
| 91 | if (firstcall) then |
---|
| 92 | ! identify the indexes of the tracers we'll need |
---|
| 93 | ! g_co2=igcm_co2 |
---|
| 94 | ! if (g_co2.eq.0) then |
---|
| 95 | ! write(*,*) "moldiffcoeff: Error; no CO2 tracer !!!" |
---|
| 96 | ! stop |
---|
| 97 | ! endif |
---|
| 98 | ! g_n2=igcm_n2 |
---|
| 99 | ! if (g_n2.eq.0) then |
---|
| 100 | ! write(*,*) "moldiffcoeff: Error; no N2 tracer !!!" |
---|
| 101 | ! stop |
---|
| 102 | ! endif |
---|
| 103 | ! g_ar=igcm_ar |
---|
| 104 | ! if (g_ar.eq.0) then |
---|
| 105 | ! write(*,*) "moldiffcoeff: Error; no Ar tracer !!!" |
---|
| 106 | ! stop |
---|
| 107 | ! endif |
---|
| 108 | ! g_h2=igcm_h2 |
---|
| 109 | ! if (g_h2.eq.0) then |
---|
| 110 | ! write(*,*) "moldiffcoeff: Error; no H2 tracer !!!" |
---|
| 111 | ! stop |
---|
| 112 | ! endif |
---|
| 113 | ! g_h=igcm_h |
---|
| 114 | ! if (g_h.eq.0) then |
---|
| 115 | ! write(*,*) "moldiffcoeff: Error; no H tracer !!!" |
---|
| 116 | ! stop |
---|
| 117 | ! endif |
---|
| 118 | ! g_co=igcm_co |
---|
| 119 | ! if (g_co.eq.0) then |
---|
| 120 | ! write(*,*) "moldiffcoeff: Error; no CO tracer !!!" |
---|
| 121 | ! stop |
---|
| 122 | ! endif |
---|
| 123 | ! g_o2=igcm_o2 |
---|
| 124 | ! if (g_o2.eq.0) then |
---|
| 125 | ! write(*,*) "moldiffcoeff: Error; no O2 tracer !!!" |
---|
| 126 | ! stop |
---|
| 127 | ! endif |
---|
| 128 | ! g_oh=igcm_oh |
---|
| 129 | ! if (g_oh.eq.0) then |
---|
| 130 | ! write(*,*) "moldiffcoeff: Error; no OH tracer !!!" |
---|
| 131 | ! stop |
---|
| 132 | ! endif |
---|
| 133 | ! g_ho2=igcm_ho2 |
---|
| 134 | ! if (g_ho2.eq.0) then |
---|
| 135 | ! write(*,*) "moldiffcoeff: Error; no HO2 tracer !!!" |
---|
| 136 | ! stop |
---|
| 137 | ! endif |
---|
| 138 | ! g_h2o=igcm_h2o_vap |
---|
| 139 | ! if (g_h2o.eq.0) then |
---|
| 140 | ! write(*,*) "moldiffcoeff: Error; no H2O tracer !!!" |
---|
| 141 | ! stop |
---|
| 142 | ! endif |
---|
| 143 | ! g_h2o2=igcm_h2o2 |
---|
| 144 | ! if (g_h2o2.eq.0) then |
---|
| 145 | ! write(*,*) "moldiffcoeff: Error; no H2O2 tracer !!!" |
---|
| 146 | ! stop |
---|
| 147 | ! endif |
---|
| 148 | ! g_o1d=igcm_o1d |
---|
| 149 | ! if (g_h.eq.0) then |
---|
| 150 | ! write(*,*) "moldiffcoeff: Error; no O1d tracer !!!" |
---|
| 151 | ! stop |
---|
| 152 | ! endif |
---|
| 153 | ! g_o3=igcm_o3 |
---|
| 154 | ! if (g_o3.eq.0) then |
---|
| 155 | ! write(*,*) "moldiffcoeff: Error; no O3 tracer !!!" |
---|
| 156 | ! stop |
---|
| 157 | ! endif |
---|
| 158 | ! g_n=igcm_n |
---|
| 159 | ! if (g_n.eq.0) then |
---|
| 160 | ! write(*,*) "moldiffcoeff: Error; no N tracer !!!" |
---|
| 161 | ! stop |
---|
| 162 | ! endif |
---|
| 163 | ! g_no=igcm_no |
---|
| 164 | ! if (g_no.eq.0) then |
---|
| 165 | ! write(*,*) "moldiffcoeff: Error; no NO tracer !!!" |
---|
| 166 | ! stop |
---|
| 167 | ! endif |
---|
| 168 | ! g_no2=igcm_no2 |
---|
| 169 | ! if (g_no2.eq.0) then |
---|
| 170 | ! write(*,*) "moldiffcoeff: Error; no NO2 tracer !!!" |
---|
| 171 | ! stop |
---|
| 172 | ! endif |
---|
| 173 | ! g_n2d=igcm_n2d |
---|
| 174 | ! if (g_n2d.eq.0) then |
---|
| 175 | ! write(*,*) "moldiffcoeff: Error; no N2(D) tracer !!!" |
---|
| 176 | ! stop |
---|
| 177 | ! endif |
---|
| 178 | ! g_oplus=igcm_oplus |
---|
| 179 | ! if (g_oplus .eq. 0) then |
---|
| 180 | ! write(*,*) "moldiffcoeff: Error; no Oplus tracer !!!" |
---|
| 181 | ! stop |
---|
| 182 | ! endif |
---|
| 183 | ! g_hplus=igcm_hplus |
---|
| 184 | ! if (g_hplus .eq. 0) then |
---|
| 185 | ! write(*,*) "moldiffcoeff: Error; no Hplus tracer !!!" |
---|
| 186 | ! stop |
---|
| 187 | ! endif |
---|
| 188 | ! g_o=igcm_o |
---|
| 189 | ! if (g_o.eq.0) then |
---|
| 190 | ! write(*,*) "moldiffcoeff: Error; no O tracer !!!" |
---|
| 191 | ! stop |
---|
| 192 | ! endif |
---|
| 193 | |
---|
| 194 | c |
---|
| 195 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 196 | c fill array to relate local indexes to gcm indexes |
---|
| 197 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 198 | |
---|
| 199 | ! gcmind(i_co2) = g_co2 |
---|
| 200 | ! gcmind(i_n2) = g_n2 |
---|
| 201 | ! gcmind(i_ar) = g_ar |
---|
| 202 | ! gcmind(i_h2) = g_h2 |
---|
| 203 | ! gcmind(i_h) = g_h |
---|
| 204 | ! gcmind(i_co) = g_co |
---|
| 205 | ! gcmind(i_o2) = g_o2 |
---|
| 206 | ! gcmind(i_oh)= g_oh |
---|
| 207 | ! gcmind(i_ho2) = g_ho2 |
---|
| 208 | ! gcmind(i_h2o) = g_h2o |
---|
| 209 | ! gcmind(i_h2o2)= g_h2o2 |
---|
| 210 | ! gcmind(i_o1d) = g_o1d |
---|
| 211 | ! gcmind(i_o3) = g_o3 |
---|
| 212 | ! gcmind(i_n)= g_n |
---|
| 213 | ! gcmind(i_no) = g_no |
---|
| 214 | ! gcmind(i_no2) = g_no2 |
---|
| 215 | ! gcmind(i_n2d) = g_n2d |
---|
| 216 | ! gcmind(i_oplus) = g_oplus |
---|
| 217 | ! gcmind(i_hplus) = g_hplus |
---|
| 218 | ! gcmind(i_o) = g_o |
---|
| 219 | |
---|
| 220 | c |
---|
| 221 | cccccccccccccccccccccccccccccccccccccccccccccccccccccccc |
---|
| 222 | firstcall= .false. |
---|
| 223 | endif ! of if (firstcall) |
---|
| 224 | |
---|
| 225 | dijh2co = 0.0000651 |
---|
| 226 | dijh2n2 = 0.0000674 |
---|
| 227 | dijh2o2 = 0.0000697 |
---|
| 228 | dijh2co2 = 0.0000550 |
---|
| 229 | dijho = 0.000114 |
---|
| 230 | |
---|
| 231 | ! dij(i_h2,i_co) = 0.0000651 |
---|
| 232 | ! dij(i_h2,i_n2) = 0.0000674 |
---|
| 233 | ! dij(i_h2,i_o2) = 0.0000697 |
---|
| 234 | ! dij(i_h2,i_co2) = 0.0000550 |
---|
| 235 | ! dij(i_h2,i_h2) = 0.0 |
---|
| 236 | ! dij(i_h2,i_h) = 0.0 |
---|
| 237 | ! dij(i_h2,i_h2o) = 0.0 !0003 |
---|
| 238 | ! dij(i_h2,i_h2o2) = 0.0 !0003 |
---|
| 239 | ! dij(i_h2,i_o3) = 0.0 !0003 |
---|
| 240 | ! dij(i_h2,i_o) = 0.0 |
---|
| 241 | ! dij(i_h2,i_ar) = 0.0 |
---|
| 242 | ! dij(i_h2,i_n) = 0.0 |
---|
| 243 | |
---|
| 244 | !c dij(i_h,i_o) = 0.0000144 |
---|
| 245 | ! dij(i_h,i_o) = 0.000114 |
---|
| 246 | |
---|
| 247 | ! find h2, h and o index in gcm |
---|
| 248 | ! these species are used to define the diffusion coefficients |
---|
| 249 | |
---|
| 250 | do n=1,nqtot |
---|
| 251 | if (tname(n) .eq. 'h2') g_h2=n |
---|
| 252 | if (tname(n) .eq. 'h') g_h=n |
---|
| 253 | if (tname(n) .eq. 'o') g_o=n |
---|
| 254 | enddo |
---|
| 255 | print*,'moldiffcoeff_red: gh2',g_h2,g_h,g_o |
---|
| 256 | |
---|
| 257 | print*,'moldiffcoeff_red: COEFF CALC' |
---|
| 258 | |
---|
| 259 | do n=1,ncompdiff2 |
---|
| 260 | dijref=0. |
---|
| 261 | if (tname(gcmind(n)) .eq. 'co') dijref=dijh2co |
---|
| 262 | if (tname(gcmind(n)) .eq. 'n2') dijref=dijh2n2 |
---|
| 263 | if (tname(gcmind(n)) .eq. 'o2') dijref=dijh2o2 |
---|
| 264 | if (tname(gcmind(n)) .eq. 'co2') dijref=dijh2co2 |
---|
| 265 | ! print*,'test',n,dijref |
---|
| 266 | if (dijref .gt. 0.0) then |
---|
| 267 | do nn=n,ncompdiff2 |
---|
| 268 | dij(nn,n)=dijref |
---|
| 269 | & *sqrt(M_tr(g_h2)/M_tr(gcmind(nn))) |
---|
| 270 | if(n.eq.nn) dij(nn,n)=1.0 |
---|
| 271 | dij(n,nn)=dij(nn,n) |
---|
| 272 | enddo |
---|
| 273 | endif |
---|
| 274 | if (dijref .eq. 0.0) then |
---|
| 275 | dijref=dijho |
---|
| 276 | dnh=dijref*sqrt(M_tr(g_o)/M_tr(gcmind(n))) |
---|
| 277 | do nn=n,ncompdiff2 |
---|
| 278 | dij(nn,n)=dnh*sqrt(M_tr(g_h)/M_tr(gcmind(nn))) |
---|
| 279 | if(n.eq.nn) dij(nn,n)=1.0 |
---|
| 280 | dij(n,nn)=dij(nn,n) |
---|
| 281 | enddo |
---|
| 282 | endif |
---|
| 283 | enddo |
---|
| 284 | |
---|
[2523] | 285 | !!! TEST !!! Augmentation des coeffs CO2/CO et CO2/O |
---|
| 286 | ! do n=2,ncompdiff2 |
---|
| 287 | ! if ((tname(gcmind(n)).eq.'co').or.(tname(gcmind(n)).eq.'o')) then |
---|
| 288 | ! dij(1,n)=dij(1,n)*1000. |
---|
| 289 | ! dij(n,1)=dij(1,n) |
---|
| 290 | ! endif |
---|
| 291 | ! enddo |
---|
| 292 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 293 | |
---|
[1442] | 294 | if (outputcoeffs) then |
---|
| 295 | ! output coefficients in 'coeffs.dat' file |
---|
| 296 | open(56,file='coeffs.dat',status='unknown') |
---|
| 297 | do n=1,ncompdiff2 |
---|
| 298 | do nn=n,ncompdiff2 |
---|
[2523] | 299 | write(56,*) tname(gcmind(n)),tname(gcmind(nn)),dij(n,nn) !*1.e5/1.381e-23/(273**1.75) |
---|
[1442] | 300 | enddo |
---|
| 301 | enddo |
---|
| 302 | close(56) |
---|
| 303 | endif |
---|
| 304 | |
---|
| 305 | |
---|
| 306 | return |
---|
| 307 | end |
---|
| 308 | |
---|