Changeset 757 for trunk/LMDZ.MARS/libf
- Timestamp:
- Aug 7, 2012, 3:14:07 PM (12 years ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 1 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/nlte_aux.F
r695 r757 1 c********************************************************************** 2 3 c Includes the following old 1-D model files/subroutines 4 5 c -MZTCRSUB_dlvr11.f 6 c *dinterconnection 7 c *planckd 8 c *leetvt 9 c -MZTFSUB_dlvr11_02.f 10 c *initial 11 c *intershphunt 12 c *interstrhunt 13 c *intzhunt 14 c *intzhunt_cts 15 c *rhist 16 c *we_clean 17 c *mztf_correccion 18 c *mzescape_normaliz 19 c *mzescape_normaliz_02 20 c -interdpESCTVCISO_dlvr11.f 21 c -hunt_cts.f 22 c -huntdp.f 23 c -hunt.f 24 c -interdp_limits.f 25 c -interhunt2veces.f 26 c -interhunt5veces.f 27 c -interhuntdp3veces.f 28 c -interhuntdp4veces.f 29 c -interhuntdp.f 30 c -interhunt.f 31 c -interhuntlimits2veces.f 32 c -interhuntlimits5veces.f 33 c -interhuntlimits.f 34 c -lubksb_dp.f 35 c -ludcmp_dp.f 36 c -LUdec.f 37 c -mat_oper.f 38 c *unit 39 c *diago 40 c *invdiag 41 c *samem 42 c *mulmv 43 c *trucodiag 44 c *trucommvv 45 c *sypvmv 46 c *mulmm 47 c *resmm 48 c *sumvv 49 c *sypvvv 50 c *zerom 51 c *zero4m 52 c *zero3m 53 c *zero2m 54 c *zerov 55 c *zero4v 56 c *zero3v 57 c *zero2v 58 c -suaviza.f 59 60 c********************************************************************** 61 62 63 c *** Old MZTCRSUB_dlvr11.f *** 64 65 !************************************************************************ 66 67 ! subroutine dinterconnection ( v, vt ) 68 69 70 ************************************************************************ 71 72 ! implicit none 73 ! include 'nlte_paramdef.h' 74 75 c argumentos 76 ! real*8 vt(nl), v(nl) 77 78 c local variables 79 ! integer i 80 81 c ************* 82 ! 83 ! do i=1,nl 84 ! v(i) = vt(i) 85 ! end do 86 87 ! return 88 ! end 89 1 90 c*********************************************************************** 2 c File with all subroutines required by mztf 3 c Subroutines previously included in mztfsub_overlap.F 4 c 5 c jan 98 malv basado en mztfsub_solar 6 c jul 2011 malv+fgg adapted to LMD-MGCM 7 c 8 c contiene: 9 c initial 10 c intershape 11 c interstrength 12 c intz 13 c rhist 14 c we 15 c simrul 16 c fi 17 c f 18 c findw 19 c voigtf 91 function planckdp(tp,xnu) 20 92 c*********************************************************************** 21 22 c **************************************************************** 23 subroutine initial 24 25 c ma & crs !evita troubles 16-july-96 26 c **************************************************************** 27 28 implicit none 29 93 94 implicit none 95 96 include 'nlte_paramdef.h' 97 98 real*8 planckdp 99 real*8 xnu 100 real tp 101 102 planckdp = gamma*xnu**3.0d0 / exp( ee*xnu/dble(tp) ) 103 !erg cm-2.sr-1/cm-1. 104 105 c end 106 return 107 end 108 109 c*********************************************************************** 110 subroutine leetvt 111 112 c*********************************************************************** 113 114 implicit none 115 30 116 include 'nlte_paramdef.h' 31 117 include 'nlte_commons.h' 32 33 c local variables 34 integer i 35 36 c *************** 37 38 eqw = 0.0d00 39 aa = 0.0d00 40 bb = 0.0d00 41 cc = 0.0d00 42 dd = 0.0d00 43 44 do i=1,nbox 45 ua(i) = 0.0d0 46 ccbox(i) = 0.0d0 47 ddbox(i) = 0.0d0 48 end do 49 50 return 51 end 52 53 c ********************************************************************** 54 subroutine intershape(alsx,alnx,adx,xtemp) 55 c interpolates the line shape parameters at a temperature xtemp from 56 c input histogram data. 57 c ********************************************************************** 58 59 implicit none 60 118 119 c local variables 120 integer i 121 real*8 zld(nl), zyd(nzy) 122 real*8 xvt11(nzy), xvt21(nzy), xvt31(nzy), xvt41(nzy) 123 124 c*********************************************************************** 125 126 do i=1,nzy 127 zyd(i) = dble(zy(i)) 128 xvt11(i)= dble( ty(i) ) 129 xvt21(i)= dble( ty(i) ) 130 xvt31(i)= dble( ty(i) ) 131 xvt41(i)= dble( ty(i) ) 132 end do 133 134 do i=1,nl 135 zld(i) = dble( zl(i) ) 136 enddo 137 call interhuntdp4veces ( v626t1,v628t1,v636t1,v627t1, zld,nl, 138 $ xvt11, xvt21, xvt31, xvt41, zyd,nzy, 1 ) 139 140 141 c end 142 return 143 end 144 145 146 c *** MZTFSUB_dlvr11_02.f *** 147 148 149 c **************************************************************** 150 subroutine initial 151 152 c **************************************************************** 153 154 implicit none 155 61 156 include 'nlte_paramdef.h' 62 157 include 'nlte_commons.h' 63 64 c arguments 65 real*8 alsx(nbox_max),alnx(nbox_max),adx(nbox_max), 66 & xtemp(nbox_max) 67 68 c local variables 69 integer i, k 70 71 c *********** 72 73 ! write (*,*) 'intershape xtemp =', xtemp 74 75 do 1, k=1,nbox 76 if (xtemp(k).gt.tmax) then 77 write (*,*) ' WARNING ! Tpath,tmax= ',xtemp(k),tmax 78 xtemp(k) = tmax 79 endif 80 if (xtemp(k).lt.tmin) then 81 write (*,*) ' WARNING ! Tpath,tmin= ',xtemp(k),tmin 82 xtemp(k) = tmin 83 endif 84 85 i = 1 86 do while (i.le.mm) 87 i = i + 1 88 89 if (abs(xtemp(k)-thist(i)) .lt. 1.0d-4) then !evita troubles 90 alsx(k)=xls1(i,k) !16-july-1996 91 alnx(k)=xln1(i,k) 92 adx(k)=xld1(i,k) 93 goto 1 94 elseif ( thist(i) .le. xtemp(k) ) then 95 alsx(k) = (( xls1(i,k)*(thist(i-1)-xtemp(k)) + 96 @ xls1(i-1,k)*(xtemp(k)-thist(i)) )) / 97 $ (thist(i-1)-thist(i)) 98 alnx(k) = (( xln1(i,k)*(thist(i-1)-xtemp(k)) + 99 @ xln1(i-1,k)*(xtemp(k)-thist(i)) )) / 100 $ (thist(i-1)-thist(i)) 101 adx(k) = (( xld1(i,k)*(thist(i-1)-xtemp(k)) + 102 @ xld1(i-1,k)*(xtemp(k)-thist(i)) )) / 103 $ (thist(i-1)-thist(i)) 104 goto 1 105 end if 106 end do 107 write (*,*) 108 @ ' error in xtemp(k). it should be between tmin and tmax' 109 1 continue 110 111 return 112 end 158 159 c local variables 160 integer i 161 162 c *************** 163 164 eqw = 0.0d00 165 aa = 0.0d00 166 cc = 0.0d00 167 dd = 0.0d00 168 169 do i=1,nbox 170 ccbox(i) = 0.0d0 171 ddbox(i) = 0.0d0 172 end do 173 174 return 175 end 176 113 177 c ********************************************************************** 114 subroutine interstrength (stx, ts, sx, xtemp) 115 c interpolates the line strength at a temperature xtemp from 116 c input histogram data. 178 179 subroutine intershphunt (i, alsx,adx,xtemp) 180 117 181 c ********************************************************************** 118 119 implicit none 120 182 183 implicit none 184 121 185 include 'nlte_paramdef.h' 122 186 include 'nlte_commons.h' 123 124 c arguments 125 real*8 stx ! output, total band strength 126 real*8 ts ! input, temp for stx 127 real*8 sx(nbox_max) ! output, strength for each box 128 real*8 xtemp(nbox_max) ! input, temp for sx 129 130 c local variables 131 integer i, k 132 133 c *********** 134 135 do 1, k=1,nbox 136 ! if(xtemp(k).lt.ts)then 137 ! write(*,*)'***********************' 138 ! write(*,*)'mztfsub_overlap/EEEEEEH!',xtemp(k),ts,k 139 ! write(*,*)'***********************' 140 ! endif 141 if (xtemp(k).gt.tmax) xtemp(k) = tmax 142 if (xtemp(k).lt.tmin) xtemp(k) = tmin 143 i = 1 144 do while (i.le.mm-1) 145 i = i + 1 146 ! write(*,*)'mztfsub_overlap/136',i,xtemp(k),thist(i) 147 if ( abs(xtemp(k)-thist(i)) .lt. 1.0d-4 ) then 148 sx(k) = sk1(i,k) 149 ! write(*,*)'mztfsub_overlap/139',sx(k),k,i 150 goto 1 151 elseif ( thist(i) .le. xtemp(k) ) then 152 sx(k) = ( sk1(i,k)*(thist(i-1)-xtemp(k)) + sk1(i-1,k)* 153 @ (xtemp(k)-thist(i)) ) / (thist(i-1)-thist(i)) 154 ! write(*,*)'mztfsub_overlap/144',sx(k),k,i 155 goto 1 156 end if 157 end do 158 write (*,*) ' error in xtemp(kr) =', xtemp(k), 159 @ '. it should be between ' 160 write (*,*) ' tmin =',tmin, ' and tmax =',tmax 161 stop 162 1 continue 163 164 stx = 0.d0 165 if (ts.gt.tmax) ts = dble( tmax ) 166 if (ts.lt.tmin) ts = dble( tmin ) 167 i = 1 168 do while (i.le.mm-1) 169 i = i + 1 170 ! write(*,*)'mztfsub_overlap/160',i,ts,thist(i) 171 if ( abs(ts-thist(i)) .lt. 1.0d-4 ) then 172 do k=1,nbox 173 stx = stx + no(k) * sk1(i,k) 174 ! write(*,*)'mztfsub_overlap/164',stx 175 end do 176 return 177 elseif ( thist(i) .le. ts ) then 178 do k=1,nbox 179 stx = stx + no(k) * (( sk1(i,k)*(thist(i-1)-ts) + 180 @ sk1(i-1,k)*(ts-thist(i)) )) / (thist(i-1)-thist(i)) 181 ! write(*,*)'mztfsub_overlap/171',stx 182 end do 183 ! stop 184 return 185 end if 186 end do 187 188 return 189 end 190 191 187 188 c arguments 189 real*8 alsx(nbox_max),adx(nbox_max) ! Output 190 real*8 xtemp(nbox_max) ! Input 191 integer i ! I , O 192 193 c local variables 194 integer k 195 real*8 factor 196 real*8 temperatura ! para evitar valores ligeramnt out of limits 197 198 c *********** 199 200 do 1, k=1,nbox_max 201 temperatura = xtemp(k) 202 if (abs(xtemp(k)-thist(1)).le.0.01d0) then 203 temperatura=thist(1) 204 elseif (abs(xtemp(k)-thist(nhist)).le.0.01d0) then 205 temperatura=thist(nhist) 206 endif 207 call huntdp ( thist,nhist, temperatura, i ) 208 if ( i.eq.0 .or. i.eq.nhist ) then 209 write (*,*) ' HUNT/ Limits input grid:', 210 @ thist(1),thist(nhist) 211 write (*,*) ' HUNT/ location in new grid:', xtemp(k) 212 stop ' INTERSHP/ Interpolation error. T out of Histogram.' 213 endif 214 factor = 1.d0 / (thist(i+1)-thist(i)) 215 alsx(k) = (( xls1(i,k)*(thist(i+1)-xtemp(k)) + 216 @ xls1(i+1,k)*(xtemp(k)-thist(i)) )) * factor 217 adx(k) = (( xld1(i,k)*(thist(i+1)-xtemp(k)) + 218 @ xld1(i+1,k)*(xtemp(k)-thist(i)) )) * factor 219 1 continue 220 221 return 222 end 223 192 224 c ********************************************************************** 193 subroutine intz(h,aco2,ap,amr,at, con) 194 c return interp. concentration, pressure,mixing ratio and temperature 195 c for a input height h 225 226 subroutine interstrhunt (i, stx, ts, sx, xtemp ) 227 196 228 c ********************************************************************** 197 198 implicit none 229 230 implicit none 231 199 232 include 'nlte_paramdef.h' 200 233 include 'nlte_commons.h' 201 202 c arguments 203 real h ! i 204 real*8 con(nzy) ! i 205 real*8 aco2, ap, at, amr ! o 206 207 c local variables 208 integer k 209 210 c ************ 211 212 if ( ( h.lt.zy(1) ).and.( h.le.-1.e-5 ) ) then 213 write (*,*) ' zp= ',h,' zy(1)= ',zy(1) 214 stop'from intz: error in interpolation, z < minimum height' 215 elseif (h.gt.zy(nzy)) then 216 write (*,*) ' zp= ',h,' zy(nzy)= ',zy(nzy) 217 stop'from intz: error in interpolation, z > maximum height' 218 end if 219 220 if (h.eq.zy(nzy)) then 221 ap = dble( py(nzy) ) 222 aco2= con(nzy) 223 at = dble( ty(nzy) ) 224 amr = dble( mr(nzy) ) 225 return 226 end if 227 228 do k=1,nzy-1 229 if( abs( h-zy(k) ).le.( 1.e-5 ) ) then 230 ap = dble( py(k) ) 231 aco2= con(k) 232 at = dble( ty(k) ) 233 amr = dble( mr(k) ) 234 return 235 elseif(h.gt.zy(k).and.h.lt.zy(k+1))then 236 ap = dble( exp( log(py(k)) + log(py(k+1)/py(k)) * 237 @ (h-zy(k)) / (zy(k+1)-zy(k)) ) ) 238 aco2 = exp( log(con(k)) + log( con(k+1)/con(k) ) * 239 @ (h-zy(k)) / (zy(k+1)-zy(k)) ) 240 at = dble( ty(k)+(ty(k+1)-ty(k))*(h-zy(k))/ 241 @ (zy(k+1)-zy(k)) ) 242 amr = dble( mr(k)+(mr(k+1)-mr(k))*(h-zy(k))/ 243 @ (zy(k+1)-zy(k)) ) 244 return 245 end if 246 end do 247 248 return 249 end 250 251 252 234 235 c arguments 236 real*8 stx ! output, total band strength 237 real*8 ts ! input, temp for stx 238 real*8 sx(nbox_max) ! output, strength for each box 239 real*8 xtemp(nbox_max) ! input, temp for sx 240 integer i 241 242 c local variables 243 integer k 244 real*8 factor 245 real*8 temperatura 246 247 c *********** 248 249 do 1, k=1,nbox 250 temperatura = xtemp(k) 251 if (abs(xtemp(k)-thist(1)).le.0.01d0) then 252 temperatura=thist(1) 253 elseif (abs(xtemp(k)-thist(nhist)).le.0.01d0) then 254 temperatura=thist(nhist) 255 endif 256 call huntdp ( thist,nhist, temperatura, i ) 257 if ( i.eq.0 .or. i.eq.nhist ) then 258 write(*,*)'HUNT/ Limits input grid:',thist(1),thist(nhist) 259 write(*,*)'HUNT/ location in new grid:',xtemp(k) 260 stop'INTERSTR/1/ Interpolation error. T out of Histogram.' 261 endif 262 factor = 1.d0 / (thist(i+1)-thist(i)) 263 sx(k) = ( sk1(i,k) * (thist(i+1)-xtemp(k)) 264 @ + sk1(i+1,k) * (xtemp(k)-thist(i)) ) * factor 265 1 continue 266 267 268 temperatura = ts 269 if (abs(ts-thist(1)).le.0.01d0) then 270 temperatura=thist(1) 271 elseif (abs(ts-thist(nhist)).le.0.01d0) then 272 temperatura=thist(nhist) 273 endif 274 call huntdp ( thist,nhist, temperatura, i ) 275 if ( i.eq.0 .or. i.eq.nhist ) then 276 write (*,*) ' HUNT/ Limits input grid:', 277 @ thist(1),thist(nhist) 278 write (*,*) ' HUNT/ location in new grid:', ts 279 stop ' INTERSTR/2/ Interpolat error. T out of Histogram.' 280 endif 281 factor = 1.d0 / (thist(i+1)-thist(i)) 282 stx = 0.d0 283 do k=1,nbox 284 stx = stx + no(k) * ( sk1(i,k)*(thist(i+1)-ts) + 285 @ sk1(i+1,k)*(ts-thist(i)) ) * factor 286 end do 287 288 289 return 290 end 291 253 292 c ********************************************************************** 254 real*8 function iaa_we(ig,me,pe,plaux,idummy,nt_local,p_local, 255 $ Desp,wsL) 256 c icls=5 -->para mztf 257 c icls=1,2,3-->para fot, line shape (v=1,l=2,d=3) (only use if wr=2) 258 c calculates an approximate equivalent width for an error estimate. 259 c 260 c ioverlap = 0 ....... no correction for overlaping 261 c 1 ....... "lisat" first correction (see overlap_box. 262 c 2 ....... " " " plus "supersaturation" 263 264 c idummy=0 do nothing 265 c 1 write out some values for diagnostics 266 c 2 correct the Strong Lorentz behaviour for SZA>90 267 c 3 casos 1 & 2 268 269 c malv nov-98 add overlaping's corrections 293 294 subroutine intzhunt (k, h, aco2,ap,amr,at, con) 295 296 c k lleva la posicion de la ultima llamada a intz , necesario para 297 c que esto represente una aceleracion real. 270 298 c ********************************************************************** 271 272 implicit none 273 299 300 implicit none 274 301 include 'nlte_paramdef.h' 275 302 include 'nlte_commons.h' 276 277 c arguments 278 integer ig ! ADDED FOR TRACEBACK 279 real*8 me ! I. path's absorber amount 280 real*8 pe ! I. path's presion total 281 real*8 plaux ! I. path's partial pressure of CO2 282 real*8 nt_local ! I. needed for strong limit of Lorentz profil 283 real*8 p_local ! I. " " " 284 integer idummy ! I. indica varias opciones 285 real*8 wsL ! O. need this for strong Lorentz correction 286 real*8 Desp ! I. need this for strong Lorentz correction 287 288 c local variables 289 integer i 290 real*8 y,x,wl,wd 291 real*8 cn(0:7),dn(0:7) 292 real*8 pi, xx 293 real*8 f_sat_box 294 real*8 dv_sat_box, dv_corte_box 295 real*8 area_core_box, area_wing_box 296 real*8 wlgood , parentesis , xlor 297 real*8 wsl_grad 298 299 300 c data blocks 301 data cn/9.99998291698d-1,-3.53508187098d-1,9.60267807976d-2, 302 @ -2.04969011013d-2,3.43927368627d-3,-4.27593051557d-4, 303 @ 3.42209457833d-5,-1.28380804108d-6/ 304 data dn/1.99999898289,5.774919878d-1,-5.05367549898d-1, 305 @ 8.21896973657d-1,-2.5222672453,6.1007027481, 306 @ -8.51001627836,4.6535116765/ 307 308 c *********** 309 310 c equivalent width of atmospheric line. 311 312 pi = acos(-1.d0) 313 314 if ( idummy.gt.9 ) 315 @ write (*,*) ' S, m, alsa, pp =', ka(kr), me, alsa(kr), plaux 316 317 y=ka(kr)*me 318 ! x=y/(2.0*pi*(alsa(kr)*pl+alna(kr)*(pe-pl))) 319 x=y/(2.0d0*pi* alsa(kr)*plaux) !+alna(kr)*(pe-pl))) 320 321 ! Strong limit of Lorentz profile: WL = 2 SQRT( S * m * alsa*pl ) 322 ! Para anular esto, comentar las siguientes 5 lineas 323 ! if ( x .gt. 1.e6 ) then 324 ! wl = 2.0*sqrt( y * alsa(kr)*pl ) 325 ! else 326 ! wl=y/sqrt(1.0d0+pi*x/2.0d0) 327 ! endif 328 329 wl=y/sqrt(1.0d0+pi*x/2.0d0) 330 331 if (wl .le. 0.d0) then 332 write(*,*)'mztfsub_overlap/496',ig,y,ka(kr),me,kr 333 stop'WE/Lorentz EQW zero or negative!/498' !,ig 334 endif 335 336 if ( idummy.gt.9 ) 337 @ write (*,*) ' y, x =', y, x 338 339 xlor = x 340 if ( (idummy.eq.2 .or. idummy.eq.12) .and. xlor.gt.1e5 ) then 341 ! en caso que estemos en el regimen 342 ! Strong Lorentz y la presion local 343 ! vaya disminuyendo, corregimos la EQW 344 ! con un gradiente analitico (notebook) 345 wsL = 2.0*sqrt( y * alsa(kr)*plaux ) 346 wsl_grad = - 2.d0 * ka(kr)*alsa(kr) * nt_local*p_local / wsL 347 wlgood = w_strongLor_prev(kr) + wsl_grad * Desp 348 if (idummy.eq.12) 349 @ write (*,*) ' W(wrong), W_SL, W_SL prev, W_SL corrected=', 350 @ wl, wsL, w_strongLor_prev(kr), wlgood 351 wl = wlgood 352 endif 353 ! wsL = wl pero esto no lo hacemos todavia, porque necesitamos 354 ! el valor que ahora mismo tiene wsL para corregir la 355 ! expresion R&W below 356 357 ! write (*,*) 'WE arguments me,pe,pl =', me,pe,pl 358 ! write (*,*) 'WE/ wl,ka(kr),alsa(kr) =', 359 ! @ wl, ka(kr),alsa(kr) 360 361 362 !>>>>>>> 363 500 format (a,i3,3(2x,1pe15.8)) 364 600 format (a,2(2x,1pe16.9)) 365 700 format (a,3(1x,1pe16.9)) 366 ! if (kr.eq.8 .or. kr.eq.13) then 367 ! write (*,500) 'WE/kr,m,pt,pl=', kr, me, pe, pl 368 ! write (*,700) ' /aln,als,d_x=', alna(kr),alsa(kr), 369 ! @ 2.0*pi*( alsa(kr)*pl + alna(kr)*(pe-pl) ) 370 ! write (*,600) ' /alsa*p_CO2, alna*p_n2 :', 371 ! @ alsa(kr)*pl, alna(kr)*(pe-pl) 372 ! write (*,600) ' a*p, S =', 373 ! @ alsa(kr)*pl + alna(kr)*(pe-pl) , ka(kr) 374 ! write (*,600) ' /S*m, x =', y, x 375 ! write (*,600) ' /aprox, WL =', 376 ! @ 2.*sqrt( y*( alsa(kr)*pl+alna(kr)*(pe-pl) ) ), WL 377 ! endif 378 ! 379 ! corrections to lorentz eqw due to overlaping and super-saturation 380 ! 381 382 i_supersat = 0 383 384 if ( icls.eq.5 .and. ioverlap.gt.0 ) then 385 ! for the moment, only consider overlaping for mztf.f, not fot.f 386 387 ! definition of saturation in the lisat model 388 ! 389 asat_box = 0.99d0 390 f_sat_box = 2.d0 * x 391 xx = f_sat_box / log( 1./(1-asat_box) ) 392 if ( xx .lt. 1.0d0 ) then 393 dv_sat_box = 0.0d0 394 asat_box = 1.0d0 - exp( - f_sat_box ) 395 else 396 dv_sat_box = alsa(kr) * sqrt( xx - 1.0d0 ) 397 ! approximation: only use of alsa in mars and venus 398 endif 399 400 ! area of saturated line 401 ! 402 area_core_box = 2.d0 * dv_sat_box * asat_box 403 area_wing_box = 0.5d0 * ( wl - area_core_box ) 404 dv_corte_box = dv_sat_box + 2.d0*area_wing_box/asat_box 405 406 ! super-saturation or simple overlaping? 407 ! 408 ! i_supersat = 0 409 xx = dv_sat_box - ( 0.5d0 * dist(kr) ) 410 if ( xx .ge. 0.0 ! definition of supersaturation 411 @ .and. dv_sat_box .gt. 0.0 ! definition of saturation 412 @ .and. (dist(kr).gt.0.0) ) ! box contains more than 1 line 413 @ ! and not too far apart 414 @ then 415 416 i_supersat = 1 417 418 else 419 ! no super-saturation, then use "lisat + first correction", i.e., 420 ! correct for line products 421 ! 422 423 wl = wl 424 425 endif 426 427 end if ! end of overlaping loop 428 429 if (icls.eq.2) then 430 iaa_we = wl 431 return 432 endif 433 434 cc doppler limit: 435 if ( idummy.gt.9 ) 436 @ write (*,*) ' S*m, alf_dop =', y, alda(kr)*sqrt(pi) 437 438 x = y / (alda(kr)*sqrt(pi)) 439 if ( x.lt.1.e-10 ) then ! to avoid underflow 440 wd = y 441 else 442 wd=alda(kr)*sqrt(4.0*pi*x**2*(1.0+log(1.0+x))/(4.0+pi*x**2)) 443 endif 444 if ( idummy.gt.9 ) 445 @ write (*,*) ' wd =', wd 446 447 cc doppler weak limit 448 c wd = ka(kr) * me 449 450 cc good doppler 451 if(icls.eq.5) then !para mztf 452 !write (*,*) 'para mztf, icls=',icls 453 if (x.lt.5.) then 454 wd = 0.d0 455 do i=0,7 456 wd = wd + cn(i) * x**i 457 end do 458 wd = alda(kr) * x * sqrt(pi) * wd 459 elseif (x.gt.5.) then 460 wd = 0.d0 461 do i=0,7 462 wd = wd + dn(i) / (log(x))**i 463 end do 464 wd = alda(kr) * sqrt(log(x)) * wd 465 else 466 stop ' x should not be less than zero' 467 end if 468 end if 469 470 471 if ( i_supersat .eq. 0 ) then 472 473 parentesis = wl**2+wd**2-(wd*wl/y)**2 474 ! changed +(wd*wl/y)**2 to -...14-3-84 475 476 if ( parentesis .lt. 0.0 ) then 477 if ((idummy.eq.2 .or. idummy.eq.12) .and. xlor.gt.1e5) then 478 parentesis = wl**2+wd**2-(wd*wsL/y)**2 479 ! este cambio puede ser necesario cuando se hace 480 ! correccion Strong Lor, para evitar valores 481 ! negativos del parentesis en sqrt( ) 482 else 483 stop ' WE/ Error en las EQW wl,wl,y ' 484 endif 485 endif 486 487 iaa_we = sqrt( parentesis ) 488 ! write (*,*) ' from iaa_we: xdop,alda,wd', sngl(x),alda(kr),sngl(wd) 489 ! write (*,*) ' from iaa_we: we', iaa_we 490 491 else 492 493 iaa_we = wl 494 ! if there is supersaturation we can ignore wd completely; 495 ! mztf.f will compute the eqw of the whole box afterwards 496 497 endif 498 499 if (icls.eq.3) iaa_we = wd 500 501 if ( idummy.gt.9 ) 502 @ write (*,*) ' wl,wd,w =', wl,wd,iaa_we 503 504 wsL = wl 505 506 return 507 end 508 509 303 304 c arguments 305 real h ! i 306 real*8 con(nzy) ! i 307 real*8 aco2, ap, at, amr ! o 308 integer k ! i 309 310 c local variables 311 real factor 312 313 c ************ 314 315 call hunt ( zy,nzy, h, k ) 316 factor = (h-zy(k)) / (zy(k+1)-zy(k)) 317 ap = dble( exp( log(py(k)) + log(py(k+1)/py(k)) * factor ) ) 318 aco2 = dlog(con(k)) + dlog( con(k+1)/con(k) ) * dble(factor) 319 aco2 = exp( aco2 ) 320 at = dble( ty(k) + (ty(k+1)-ty(k)) * factor ) 321 amr = dble( mr(k) + (mr(k+1)-mr(k)) * factor ) 322 323 324 return 325 end 326 510 327 c ********************************************************************** 511 real*8 function simrul(a,b,fsim,c,acc) 512 c adaptively integrates fsim from a to b, within the criterion acc. 328 329 subroutine intzhunt_cts (k, h, nzy_cts_real, 330 @ aco2,ap,amr,at, con) 331 332 c k lleva la posicion de la ultima llamada a intz , necesario para 333 c que esto represente una aceleracion real. 513 334 c ********************************************************************** 514 515 implicit none 516 517 real*8 res,a,b,g0,g1,g2,g3,g4,d,a0,a1,a2,h,x,acc,c,fsim 518 real*8 s1(70),s2(70),s3(70) 519 real*8 c1, c2 520 integer*4 m,n,j 521 522 res=0. 523 c=0. 524 m=0 525 n=0 526 j=30 527 g0=fsim(a) 528 g2=fsim((a+b)/2.) 529 g4=fsim(b) 530 a0=(b-a)*(g0+4.0*g2+g4)/2.0 531 1 d=2.0**n 532 h=(b-a)/(4.0*d) 533 x=a+(4.0*m+1.0)*h 534 g1=fsim(x) 535 g3=fsim(x+2.0*h) 536 a1=h*(g0+4.0*g1+g2) 537 a2=h*(g2+4.0*g3+g4) 538 if ( abs(a1+a2-a0).gt.(acc/d)) goto 2 539 res=res+(16.0*(a1+a2)-a0)/45.0 540 m=m+1 541 c=a+m*(b-a)/d 542 6 if (m.eq.(2*(m/2))) goto 4 543 if ((m.ne.1).or.(n.ne.0)) goto 5 544 8 simrul=res 545 return 546 2 m=2*m 547 n=n+1 548 if (n.gt.j) goto 3 549 a0=a1 550 s1(n)=a2 551 s2(n)=g3 552 s3(n)=g4 553 g4=g2 554 g2=g1 555 goto 1 556 3 c1=c-(b-a)/d 557 c2=c+(b-a)/d 558 write(2,7) c1,c,c2,fsim(c1),fsim(c),fsim(c2) 559 write(*,7) c1,c,c2,fsim(c1),fsim(c),fsim(c2) 560 7 format(2x,'17hsimrule fails at ',/,3e15.6,/,3e15.6) 561 goto 8 562 5 a0=s1(n) 563 g0=g4 564 g2=s2(n) 565 g4=s3(n) 566 goto 1 567 4 m=m/2 568 n=n-1 569 goto 6 570 end 571 572 c ********************************************************************** 573 subroutine findw(ig,iirw,idummy,c1,p1, Desp, wsL) 574 c this routine sets up accuracy criteria and calls simrule between limit 575 c that depend on the number of atmospheric and cell paths. it gives eqw. 576 577 c Add correction for EQW in Strong Lorentz regime and SZA>90 578 c ********************************************************************** 579 580 implicit none 335 336 implicit none 581 337 include 'nlte_paramdef.h' 582 338 include 'nlte_commons.h' 583 584 c arguments 585 integer ig ! ADDED FOR TRACEBACK 586 integer iirw 587 integer idummy ! I. indica varias opciones 588 real*8 c1 ! I. needed for strong limit of Lorentz profil 589 real*8 p1 ! I. " " " 590 real*8 wsL ! O. need this for strong Lorentz correction 591 real*8 Desp ! I. need this for strong Lorentz correction 592 593 c local variables 594 real*8 ept,eps,xa 595 real*8 acc, c 596 real*8 iaa_we 597 real*8 iaa_f, iaa_fi, simrul 598 599 external iaa_f,iaa_fi 600 601 c ********** *********** ********* 602 603 if(icls.eq.5) then !para mztf 604 ! if(ig.eq.1682)write(*,*)'mztfsub_overlap/768',ua(kr),iirw 605 if (iirw.eq.2) then !iirw=icf=2 ==> we use the w&r formula 606 w = iaa_we(ig,ua(kr),pt,pp, idummy, c1,p1, Desp, wsL ) 607 return 608 end if 609 ept=iaa_we(ig,ua(kr),pt,pp, idummy,c1,p1, Desp, wsL) 610 else !para fot 611 if (iirw.eq.2) then ! icf=2 ==> we use the w&r formula 612 w = iaa_we(ig,sl_ua,pt,pp, idummy,c1,p1, Desp, wsL) 613 return 614 end if 615 ept=iaa_we(ig,sl_ua,pt,pp, idummy,c1,p1, Desp, wsL) 616 end if 617 618 c the next block is a modification to avoid nul we. 619 c this situation appears for weak lines and low path temperature, but 620 c there is not any loss of accuracy. first july 1986 621 if (ept.eq.0.) then ! for weak lines sometimes we=0 622 ept=1.0e-18 623 write (*,*) 'ept =',ept 624 write (*,*) 'from we: we=0.0' 625 return 626 end if 627 628 acc = 4.d0 629 acc = 10.d0**(-acc) 630 631 eps = acc * ept !accuracy 10-4 atmospheric eqw. 632 xa=0.5*ept/iaa_f(0.d0) !width of doppler shifted atmospheric line. 633 w = 2.0*( simrul(0.0d0,xa,iaa_f,c,eps) 634 . + simrul(0.1d0,1.0/xa,iaa_fi,c,eps) ) 635 !no shift. 636 637 return 638 end 639 640 339 340 c arguments 341 real h ! i 342 real*8 con(nzy_cts) ! i 343 real*8 aco2, ap, at, amr ! o 344 integer k ! i 345 integer nzy_cts_real ! i 346 347 c local variables 348 real factor 349 350 c ************ 351 352 call hunt_cts ( zy_cts,nzy_cts, nzy_cts_real, h, k ) 353 factor = (h-zy_cts(k)) / (zy_cts(k+1)-zy_cts(k)) 354 ap = dble( exp( log(py_cts(k)) + 355 @ log(py_cts(k+1)/py_cts(k)) * factor ) ) 356 aco2 = dlog(con(k)) + dlog( con(k+1)/con(k) ) * dble(factor) 357 aco2 = exp( aco2 ) 358 at = dble( ty_cts(k) + (ty_cts(k+1)-ty_cts(k)) * factor ) 359 amr = dble( mr_cts(k) + (mr_cts(k+1)-mr_cts(k)) * factor ) 360 361 362 return 363 end 364 365 641 366 c ********************************************************************** 642 double precision function iaa_fi(y) 643 c returns the value of f(1/y) 367 368 real*8 function we_clean ( y,pl, xalsa, xalda ) 369 644 370 c ********************************************************************** 645 646 implicit none 647 real*8 iaa_f, y 648 649 iaa_fi=iaa_f(1.0/y)/y**2 650 return 651 end 652 653 654 c ********************************************************************** 655 double precision function iaa_f(nuaux) 656 c calculates 1-exp(-k(nu)u) for all series paths or combinations thereof 657 c ********************************************************************** 658 659 implicit none 371 372 implicit none 373 374 include 'nlte_paramdef.h' 375 376 c arguments 377 real*8 y ! I. path's absorber amount * strength 378 real*8 pl ! I. path's partial pressure of CO2 379 real*8 xalsa ! I. Self lorentz linewidth for 1 isot & 1 box 380 real*8 xalda ! I. Doppler linewidth " " 381 382 c local variables 383 integer i 384 real*8 x,wl,wd,wvoigt 385 real*8 cn(0:7),dn(0:7) 386 real*8 factor, denom 387 real*8 pi, pi2, sqrtpi 388 389 c data blocks 390 data cn/9.99998291698d-1,-3.53508187098d-1,9.60267807976d-2, 391 @ -2.04969011013d-2,3.43927368627d-3,-4.27593051557d-4, 392 @ 3.42209457833d-5,-1.28380804108d-6/ 393 data dn/1.99999898289,5.774919878d-1,-5.05367549898d-1, 394 @ 8.21896973657d-1,-2.5222672453,6.1007027481, 395 @ -8.51001627836,4.6535116765/ 396 397 c *********** 398 399 pi = 3.141592 400 pi2= 6.28318531 401 sqrtpi = 1.77245385 402 403 x=y / ( pi2 * xalsa*pl ) 404 405 406 c Lorentz 407 wl=y/sqrt(1.0d0+pi*x/2.0d0) 408 409 c Doppler 410 x = y / (xalda*sqrtpi) 411 if (x .lt. 5.0d0) then 412 wd = cn(0) 413 factor = 1.d0 414 do i=1,7 415 factor = factor * x 416 wd = wd + cn(i) * factor 417 end do 418 wd = xalda * x * sqrtpi * wd 419 else 420 wd = dn(0) 421 factor = 1.d0 / log(x) 422 denom = 1.d0 423 do i=1,7 424 denom = denom * factor 425 wd = wd + dn(i) * denom 426 end do 427 wd = xalda * sqrt(log(x)) * wd 428 end if 429 430 c Voigt 431 wvoigt = wl*wl + wd*wd - (wd*wl/y)*(wd*wl/y) 432 433 if ( wvoigt .lt. 0.0d0 ) then 434 write (*,*) ' Subroutine WE/ Error in Voift EQS calculation ' 435 write (*,*) ' WL, WD, X, Y = ', wl, wd, x, y 436 stop ' ERROR : Imaginary EQW. Revise spectral data. ' 437 endif 438 439 we_clean = sqrt( wvoigt ) 440 441 442 return 443 end 444 445 446 c *********************************************************************** 447 448 subroutine mztf_correccion (coninf, con, ib ) 449 450 c *********************************************************************** 451 452 implicit none 453 660 454 include 'nlte_paramdef.h' 661 455 include 'nlte_commons.h' 662 663 double precision tra,xa,ya,za,yy,nuaux 664 double precision voigtf 665 tra=1.0d0 666 667 yy=1.0d0/alda(kr) 668 xa=nuaux*yy 669 ya= ( alsa(kr)*pp + alna(kr)*(pt-pp) ) * yy 670 za=ka(kr)*yy 671 672 if(icls.eq.5) then !para mztf 673 ! write (*,*) 'icls=',icls 674 tra=za*ua(kr)*voigtf(sngl(xa),sngl(ya)) 456 457 c arguments 458 integer ib 459 real*8 con(nzy), coninf 460 461 ! local variables 462 integer i, isot 463 real*8 tvt0(nzy), tvtbs(nzy), zld(nl),zyd(nzy) 464 real*8 xqv, xes, xlower, xfactor 465 466 c ********* 467 468 isot = 1 469 nu11 = dble( nu(1,1) ) 470 471 do i=1,nzy 472 zyd(i) = dble(zy(i)) 473 enddo 474 do i=1,nl 475 zld(i) = dble( zl(i) ) 476 end do 477 478 ! tvtbs 479 call interhuntdp (tvtbs,zyd,nzy, v626t1,zld,nl, 1 ) 480 481 ! tvt0 482 if (ib.eq.2 .or. ib.eq.3 .or. ib.eq.4) then 483 call interhuntdp (tvt0,zyd,nzy, v626t1,zld,nl, 1 ) 675 484 else 676 tra=za*sl_ua*voigtf(sngl(xa),sngl(ya)) 677 end if 678 679 if (tra.gt.50.0) then 680 tra=1.0 !2.0e-22 overflow cut-off. 681 else if (tra.gt.1.0e-4) then 682 tra=1.0-exp(-tra) 683 end if 684 685 iaa_f=tra 686 return 687 end 688 689 c ********************************************************************** 690 double precision function voigtf(x1,y) 691 c computes voigt function for any value of x1 and any +ve value of y. 692 c where possible uses modified lorentz and modified doppler approximatio 693 c otherwise uses a rearranged rybicki routine. 694 c c(n) = exp(-(n/h)**2)/(pi*sqrt(pi)), with h = 2.5 . 695 c accurate to better than 1 in 10000. 696 c ********************************************************************** 697 698 implicit none 699 700 real x1, y 701 real x, xx, xxyy, xh,xhxh, yh,yhyh, f1,f2, p, q, xn,xnxn, voig 702 703 real*8 b,g0,g1,g2,g3,g4,d1,d2,d3,d4,c 704 integer*4 n 705 706 dimension c(10) 707 complex xp,xpp,z 708 709 data c(1)/0.15303405/ 710 data c(2)/0.94694928e-1/ 711 data c(3)/0.42549174e-1/ 712 data c(4)/0.13882935e-1/ 713 data c(5)/0.32892528e-2/ 714 data c(6)/0.56589906e-3/ 715 data c(7)/0.70697890e-4/ 716 data c(8)/0.64135678e-5/ 717 data c(9)/0.42249221e-6/ 718 data c(10)/0.20209868e-7/ 719 720 x=abs(x1) 721 if (x.gt.7.2) goto 1 722 if ((y+x*0.3).gt.5.4) goto 1 723 if (y.gt.0.01) goto 3 724 if (x.lt.2.1) goto 2 725 goto 3 726 c here uses modified lorentz approx. 727 1 xx=x*x 728 xxyy=xx+y*y 729 b=xx/xxyy 730 voigtf=y*(1.+(2.*b-0.5+(0.75-(9.-12.*b)*b)/xxyy)/ 731 * xxyy)/(xxyy*3.141592654) 732 return 733 c here uses modified doppler approx. 734 2 xx=x*x 735 voigtf=0.56418958*exp(-xx)*(1.-y*(1.-0.5*y)*(1.1289-xx*(1.1623+ 736 * xx*(0.080812+xx*(0.13854-xx*(0.033605-0.0073972*xx)))))) 737 return 738 c here uses a rearranged rybicki routine. 739 3 xh=2.5*x 740 xhxh=xh*xh 741 yh=2.5*y 742 yhyh=yh*yh 743 f1=xhxh+yhyh 744 f2=f1-0.5*yhyh 745 if (y.lt.0.1) goto 20 746 p=-y*7.8539816 !7.8539816=2.5*pi 747 q=x*7.8539816 748 xpp=cmplx(p,q) 749 z=cexp(xpp) 750 d1=xh*aimag(z) 751 d2=-d1 752 d3=yh*(1.-real(z)) 753 d4=-d3+2.*yh 754 voig=0.17958712*(d1+d3)/f1 755 goto 30 756 20 p=x*7.8539816 757 q=y*7.8539816 758 xp=cmplx(p,q) 759 z=ccos(xp) 760 d1=xh*aimag(z) 761 d2=-d1 762 d3=yh*(1.-real(z)) 763 d4=-d3+2.*yh 764 voig=0.56418958*exp(y*y-x*x)*cos(2.*x*y)+0.17958712*(d1+d3)/f1 765 30 xn=0. 766 do 55 n=1,10,2 767 xn=xn+1. 768 xnxn=xn*xn 769 g1=xh-xn 770 g2=g1*(xh+xn) 771 g3=0.5*g2*g2 772 voig=voig+c(n)*(d2*(g2+yhyh)+d4*(f1+xnxn))/ 773 & (g3+yhyh*(f2+xnxn)) 774 xn=xn+1. 775 xnxn=xn*xn 776 g1=xh-xn 777 g2=g1*(xh+xn) 778 g3=0.5*g2*g2 779 voig=voig+c(n+1)*(d1*(g2+yhyh)+d3*(f1+xnxn))/ 780 @ (g3+yhyh*(f2+xnxn)) 781 55 continue 782 voigtf=voig 783 return 784 end 785 786 787 788 c ********************************************************************** 789 c elimin_mz1d.F (includes smooth_cf) 790 c ************************************************************************ 791 subroutine elimin_mz1d (c,vc, ilayer,nanaux,itblout, nwaux) 792 793 c Eliminate anomalous negative numbers in c(nl,nl) according to "nanaux": 794 795 c nanaux = 0 -> no eliminate 796 c @ -> eliminate all numbers with absol.value<abs(max(c(n,r)))/300. 797 c 2 -> eliminate all anomalous negative numbers in c(n,r). 798 c 3 -> eliminate all anomalous negative numbers far from the main 799 c diagonal. 800 c 8 -> eliminate all non-zero numbers outside the main diagonal, 801 c and the contibution of lower boundary. 802 c 9 -> eliminate all non-zero numbers outside the main diagonal. 803 c 4 -> hace un smoothing cuando la distancia de separacion entre 804 c el valor maximo y el minimo de cf > 50 capas. 805 c 5 -> elimina valores menores que 1.0d-19 806 c 6 -> incluye los dos casos 4 y 5 807 c 7 -> llama a lisa: smooth con width=nw & elimina mejorado 808 c 78-> incluye los dos casos 7 y 8 809 c 79-> incluye los dos casos 7 y 9 810 811 c itblout (itableout in calling program) is the option for writing 812 c out or not the purged c(n,r) matrix: 813 c itblout = 0 -> no write 814 c = 1 -> write out in curtis***.out according to ilayer 815 816 c ilayer is the index for the layer selected to write out the matrix: 817 c ilayer = 0 => matrix elements written out cover all the altitudes 818 c with 5 layers steps 819 c > 0 => " " " " are c(ilayer,*) 820 c NOTA: 821 c EXISTE LA POSIBILIDAD DE SACAR TODAS LAS CAPAS (TODA LA MATRIZ) 822 c UTILIZANDO itableout=30 EN MZTUD 823 824 c jul 2011 malv+fgg adapted to LMD-MGCM 825 c Sep-04 FGG+MALV Correct include and call parameters 826 c cristina 25-sept-1996 y 27-ene-1997 827 c JAN 98 MALV Version for mz1d 828 c ************************************************************************ 485 do i=1,nzy 486 tvt0(i) = dble( ty(i) ) 487 end do 488 end if 489 490 c factor 491 do i=1,nzy 492 493 xlower = exp( ee*dble(elow(isot,ib)) * 494 @ ( 1.d0/dble(ty(i))-1.d0/tvt0(i) ) ) 495 xes = 1.0d0 496 xqv = ( 1.d0-exp( -ee*nu11/tvtbs(i) ) ) / 497 @ (1.d0-exp( -ee*nu11/dble(ty(i)) )) 498 xfactor = xlower * xqv**2.d0 * xes 499 500 con(i) = con(i) * xfactor 501 if (i.eq.nzy) coninf = coninf * xfactor 502 503 end do 504 505 506 return 507 end 508 509 510 c *********************************************************************** 511 512 subroutine mzescape_normaliz ( taustar, istyle ) 513 514 c *********************************************************************** 515 516 implicit none 517 include 'nlte_paramdef.h' 518 519 c arguments 520 real*8 taustar(nl) ! o 521 integer istyle ! i 522 523 c local variables and constants 524 integer i, imaximum 525 real*8 maximum 526 527 c *************** 528 529 taustar(nl) = taustar(nl-1) 530 531 if ( istyle .eq. 1 ) then 532 imaximum = nl 533 maximum = taustar(nl) 534 do i=1,nl-1 535 if (taustar(i).gt.maximum) taustar(i) = taustar(nl) 536 enddo 537 elseif ( istyle .eq. 2 ) then 538 imaximum = nl 539 maximum = taustar(nl) 540 do i=nl-1,1,-1 541 if (taustar(i).gt.maximum) then 542 maximum = taustar(i) 543 imaximum = i 544 endif 545 enddo 546 do i=imaximum,nl 547 if (taustar(i).lt.maximum) taustar(i) = maximum 548 enddo 549 endif 550 551 do i=1,nl 552 taustar(i) = taustar(i) / maximum 553 enddo 554 555 556 c end 557 return 558 end 559 560 c *********************************************************************** 561 562 subroutine mzescape_normaliz_02 ( taustar, nn, istyle ) 563 564 c *********************************************************************** 565 566 implicit none 567 568 c arguments 569 real*8 taustar(nn) ! i,o 570 integer istyle ! i 571 integer nn ! i 572 573 c local variables and constants 574 integer i, imaximum 575 real*8 maximum 576 577 c *************** 578 579 taustar(nn) = taustar(nn-1) 580 581 if ( istyle .eq. 1 ) then 582 imaximum = nn 583 maximum = taustar(nn) 584 do i=1,nn-1 585 if (taustar(i).gt.maximum) taustar(i) = taustar(nn) 586 enddo 587 elseif ( istyle .eq. 2 ) then 588 imaximum = nn 589 maximum = taustar(nn) 590 do i=nn-1,1,-1 591 if (taustar(i).gt.maximum) then 592 maximum = taustar(i) 593 imaximum = i 594 endif 595 enddo 596 do i=imaximum,nn 597 if (taustar(i).lt.maximum) taustar(i) = maximum 598 enddo 599 endif 600 601 do i=1,nn 602 taustar(i) = taustar(i) / maximum 603 enddo 604 605 606 c end 607 return 608 end 609 610 611 c *** interdp_ESCTVCISO_dlvr11.f *** 612 613 c*********************************************************************** 614 615 subroutine interdp_ESCTVCISO 616 617 c*********************************************************************** 829 618 830 619 implicit none … … 833 622 include 'nlte_commons.h' 834 623 835 integer nanaux,j,i,itblout,kk,k,ir,in 836 integer ilayer,jmin, jmax,np,nwaux,ntimes,ntimes2 837 !* real*8 c(nl,nl), vc(nl), amax, cmax, cmin, cs(nl,nl), mini 838 real*8 c(nl,nl), vc(nl), amax, cmax, cmin, mini 839 real*8 aux(nl), auxs(nl) 840 character layercode*3 841 842 ntimes=0 843 ntimes2=0 844 ! type *,'from elimin_mz4: nan, nw',nan,nw 845 846 if (nanaux .eq. 0) goto 200 847 848 if(nanaux.eq.1)then 849 do i=1,nl 850 amax=1.0d-36 851 do j=1,nl 852 if(abs(c(i,j)).gt.amax)amax=abs(c(i,j)) 853 end do 854 do j=1,nl 855 if(abs(c(i,j)).lt.amax/300.0d0)c(i,j)=0.0d0 856 end do 857 enddo 858 elseif(nanaux.eq.2)then 859 do i=1,nl 860 do j=1,nl 861 if( ( j.le.(i-2) .or. j.gt.(i+2) ).and. 862 @ ( c(i,j).lt.0.0d0 ) ) c(i,j)=0.0d0 863 end do 864 enddo 865 elseif(nanaux.eq.3)then 866 do i=1,nl 867 do j=1,nl 868 if (abs(i-j).ge.10) c(i,j)=0.0d0 869 end do 870 enddo 871 elseif(nanaux.eq.8)then 872 do i=1,nl 873 do j=1,i-1 874 c(i,j)=0.0d0 875 enddo 876 do j=i+1,nl 877 c(i,j)=0.0d0 878 enddo 879 vc(i)= 0.d0 880 enddo 881 elseif(nanaux.eq.9)then 882 do i=1,nl 883 do j=1,i-1 884 c(i,j)=0.0d0 885 enddo 886 do j=i+1,nl 887 c(i,j)=0.0d0 888 enddo 889 enddo 890 ! elseif(nan.eq.7.or.nan.eq.78.or.nan.eq.79)then 891 ! call lisa(c, vc, nl, nw) 892 end if 893 if(nanaux.eq.78)then 894 do i=1,nl 895 do j=1,i-1 896 c(i,j)=0.0d0 897 enddo 898 do j=i+1,nl 899 c(i,j)=0.0d0 900 enddo 901 vc(i)= 0.d0 902 enddo 903 endif 904 if(nanaux.eq.79)then 905 do i=1,nl 906 do j=1,i-1 907 c(i,j)=0.0d0 908 enddo 909 do j=i+1,nl 910 c(i,j)=0.0d0 911 enddo 912 enddo 913 endif 914 915 if(nanaux.eq.5.or.nanaux.eq.6)then 916 do i=1,nl 917 mini = 1.0d-19 918 do j=1,nl 919 if(abs(c(i,j)).le.mini.and.c(i,j).ne.0.d0) then 920 ntimes2=ntimes2+1 921 end if 922 if ( abs(c(i,j)).le.mini) c(i,j)=0.d0 923 end do 924 enddo 925 end if 926 927 if(nanaux.eq.4.or.nanaux.eq.6)then 928 do i=1,nl 929 do j=1,nl 930 aux(j)=c(i,j) 931 auxs(j)=c(i,j) 932 end do 933 !call maxdp_2(aux,nl,cmax,jmax) 934 cmax=maxval(aux) 935 jmax=maxloc(aux,dim=1) 936 if(abs(jmax-i).ge.50) then 937 call smooth_cf(aux,auxs,i,nl,3) 938 !!!call smooth_cf(aux,auxs,i,nl,5) 939 ntimes=ntimes+1 940 end if 941 do j=1,nl 942 c(i,j)=auxs(j) 943 end do 944 end do 945 end if 946 947 ! type *, 'elimin_mz4: c(n,r) procesed for elimination. ' 948 ! type *, ' ' 949 ! if(nan.eq.4.or.nan.eq.6) type *, ' call smoothing:',ntimes 950 ! if(nan.eq.5.or.nan.eq.6) type *, ' call elimina: ',ntimes2 951 ! if(nan.eq.7) type *, ' from elimin: lisa w=',nw 952 ! type *, ' ' 953 954 955 200 continue 956 957 c writting out of c(n,r) in ascii file 958 959 ! if(itblout.eq.1) then 960 961 ! if (ilayer.eq.0) then 962 963 ! open (unit=2, status='new', 964 ! @ file=dircurtis//'curtis_gnu.out', recl=1024) 965 ! write(2,'(a)') 966 ! @ ' curtis matrix: table with 1.e+7 * acf(n,r) ' 967 ! write(2,114) 'n,r', ( i, i=nl,1,-5 ) 968 ! do in=nl,1,-5 969 ! write(2,*) 970 ! write(2,115) in, ( c(in,ir)*1.d7, ir=nl,1,-5 ) 971 ! end do 972 ! close(2) 973 974 975 ! write (*,*) ' ' 976 ! write (*,*) ' curtis.out has been created. ' 977 ! write (*,*) ' ' 978 979 ! else 980 981 ! write (layercode,132) ilayer 982 ! open (2, status='new', 983 ! @ file=dircurtis//'curtis'//layercode//'.out') 984 ! write(2,'(a)') 985 ! @ ' curtis matrix: table with 1.e+7 * acf(n,r) ' 986 ! write(2,116) ' layer x c(',layercode, 987 ! @ ',x) c(x,', layercode,')' 988 ! do in=nl,1,-1 989 ! if (c(ilayer,ilayer).ne.0.d0) then 990 ! write(2,117) in, c(ilayer,in), c(in,ilayer), 991 ! @ c(ilayer,in)/c(ilayer,ilayer), 992 ! @ c(in,ilayer)/c(ilayer,ilayer) 993 ! else 994 ! write(2,118) in, c(ilayer,in), c(in,ilayer) 995 ! end if 996 ! end do 997 ! close(2) 998 ! write (*,*) ' ' 999 ! write (*,*) dircurtis//'curtis'//layercode//'.out', 1000 ! @ ' has been created.' 1001 ! write (*,*) ' ' 1002 1003 ! end if 1004 1005 ! elseif(itblout.eq.0)then 1006 1007 ! continue 1008 1009 ! else 1010 1011 ! write (*,*) ' error from elimin: ', 1012 ! @ ' itblout should be 1 or 0; itblout= ',itblout 1013 ! stop 1014 1015 ! end if 1016 1017 return 1018 1019 112 format(10x,10(i3,9x)) 1020 113 format(1x,i3,2x,9(1pe9.2,2x)) 624 c local variables 625 integer i 626 real*8 lnpnb(nl) 627 628 629 c*********************************************************************** 630 631 c Use pressure in the NLTE grid but in log and in nb 632 do i=1,nl 633 lnpnb(i) = log( dble( pl(i) * 1013.25 * 1.e6) ) 634 enddo 635 636 c Interpolations 637 638 call interhuntdp3veces 639 @ ( taustar21,taustar31,taustar41, lnpnb, nl, 640 @ tstar21tab,tstar31tab,tstar41tab, lnpnbtab, nztabul, 641 @ 1 ) 642 643 call interhuntdp3veces ( vc210,vc310,vc410, lnpnb, nl, 644 @ vc210tab,vc310tab,vc410tab, lnpnbtab, nztabul, 2 ) 645 646 c end 647 return 648 end 649 650 651 c *** hunt_cts.f *** 652 653 cccc 654 SUBROUTINE hunt_cts(xx,n,n_cts,x,jlo) 655 c 656 c La dif con hunt es el uso de un indice superior (n_cts) mas bajito que (n) 657 c 658 c Arguments 659 INTEGER jlo ! O 660 INTEGER n ! I 661 INTEGER n_cts ! I 662 REAL xx(n) ! I 663 REAL x ! I 664 665 c Local variables 666 INTEGER inc,jhi,jm 667 LOGICAL ascnd 668 c 669 cccc 670 c 671 ascnd=xx(n_cts).ge.xx(1) 672 if(jlo.le.0.or.jlo.gt.n_cts)then 673 jlo=0 674 jhi=n_cts+1 675 goto 3 676 endif 677 inc=1 678 if(x.ge.xx(jlo).eqv.ascnd)then 679 1 jhi=jlo+inc 680 ! write (*,*) jlo 681 if(jhi.gt.n_cts)then 682 jhi=n_cts+1 683 ! write (*,*) jhi-1 684 else if(x.ge.xx(jhi).eqv.ascnd)then 685 jlo=jhi 686 inc=inc+inc 687 ! write (*,*) jlo 688 goto 1 689 endif 690 else 691 jhi=jlo 692 2 jlo=jhi-inc 693 ! write (*,*) jlo 694 if(jlo.lt.1)then 695 jlo=0 696 else if(x.lt.xx(jlo).eqv.ascnd)then 697 jhi=jlo 698 inc=inc+inc 699 goto 2 700 endif 701 endif 702 3 if(jhi-jlo.eq.1)then 703 if(x.eq.xx(n_cts))jlo=n_cts-1 704 if(x.eq.xx(1))jlo=1 705 ! write (*,*) jlo 706 return 707 endif 708 jm=(jhi+jlo)/2 709 if(x.ge.xx(jm).eqv.ascnd)then 710 jlo=jm 711 else 712 jhi=jm 713 endif 714 ! write (*,*) jhi-1 715 goto 3 716 c 717 END 718 1021 719 1022 114 format(1x,a3, 11(8x,i3)) 1023 115 format( 1x,i3, 2x, 11(1pe10.3)) 1024 116 format( 1x,a17,a2,a18,a2,a1 ) 1025 117 format( 3x,i3, 4(8x,1pe10.3) ) 1026 118 format( 3x,i3, 2(8x,1pe10.3) ) 1027 120 format( 1x,i3, 1x,i3, 2x, 11(1pe10.3)) 1028 1029 132 format(i3) 1030 1031 ! cambio: los formatos 114, 115 , 117 y 118 1032 ! cambio: al cambia nl de 51 a 140 hay que cambiar el formato i2-->i3 1033 ! y ahora en vez de 11 capas de 5 en 5, hay 28 1034 ! 1035 end 1036 c************************************************************************** 1037 subroutine smooth_cf( c, cs, i, nl, w ) 1038 c hace un smoothing de c(i,*), de la contribucion de todas las capas 1039 c menos de la capa en cuestion, la i. 1040 c opcion w (width): el tamanho de la ventana del smoothing. 1041 c output values: cs 1042 c************************************************************************** 1043 1044 implicit none 720 c *** huntdp.f *** 721 722 cccc 723 SUBROUTINE huntdp(xx,n,x,jlo) 724 c 725 c Arguments 726 INTEGER jlo ! O 727 INTEGER n ! I 728 REAL*8 xx(n) ! I 729 REAL*8 x ! I 730 731 c Local variables 732 INTEGER inc,jhi,jm 733 LOGICAL ascnd 734 c 735 cccc 736 c 737 ascnd=xx(n).ge.xx(1) 738 if(jlo.le.0.or.jlo.gt.n)then 739 jlo=0 740 jhi=n+1 741 goto 3 742 endif 743 inc=1 744 if(x.ge.xx(jlo).eqv.ascnd)then 745 1 jhi=jlo+inc 746 if(jhi.gt.n)then 747 jhi=n+1 748 else if(x.ge.xx(jhi).eqv.ascnd)then 749 jlo=jhi 750 inc=inc+inc 751 goto 1 752 endif 753 else 754 jhi=jlo 755 2 jlo=jhi-inc 756 if(jlo.lt.1)then 757 jlo=0 758 else if(x.lt.xx(jlo).eqv.ascnd)then 759 jhi=jlo 760 inc=inc+inc 761 goto 2 762 endif 763 endif 764 3 if(jhi-jlo.eq.1)then 765 if(x.eq.xx(n))jlo=n-1 766 if(x.eq.xx(1))jlo=1 767 return 768 endif 769 jm=(jhi+jlo)/2 770 if(x.ge.xx(jm).eqv.ascnd)then 771 jlo=jm 772 else 773 jhi=jm 774 endif 775 goto 3 776 c 777 END 778 1045 779 1046 integer j,np,i,nl,w 1047 real*8 c(nl), cs(nl) 1048 1049 if(w.eq.0) then 1050 do j=1,nl 1051 cs(j)=c(j) 1052 end do 1053 1054 elseif(w.eq.3) then 1055 1056 ! write (*,*) 'smoothing w=3' 1057 do j=1,i-4 1058 if(j.eq.1) then 1059 cs(j)=c(j) 1060 else 1061 cs(j)=1/3.d0*(c(j-1)+c(j)+c(j+1)) 1062 end if 1063 end do 1064 do j=i+4,nl-1 1065 if(j.eq.nl) then 1066 cs(j)=c(j) 1067 else 1068 cs(j)=1/3.d0*(c(j-1)+c(j)+c(j+1)) 1069 end if 1070 end do 1071 elseif(w.eq.5) then 1072 1073 ! type *,'smoothing w=5' 1074 do j=3,i-4 1075 if(j.eq.1) then 1076 cs(j)=c(j) 1077 else 1078 cs(j)=1/5.d0*(c(j-2)+c(j-1)+c(j)+c(j+1)+c(j+2)) 1079 end if 1080 end do 1081 do j=i+4,nl-2 1082 if(j.eq.nl) then 1083 cs(j)=c(j) 1084 else 1085 cs(j)=1/5.d0*(c(j-2)+c(j-1)+c(j)+c(j+1)+c(j+2)) 1086 end if 1087 end do 1088 end if 1089 return 1090 end 1091 1092 1093 1094 c***************************************************************************** 1095 c suaviza 1096 c***************************************************************************** 1097 c 1098 subroutine suaviza ( x, n, ismooth, y ) 1099 c 1100 c x - input and return values 1101 c y - auxiliary vector 1102 c ismooth = 0 --> no smoothing is performed 1103 c ismooth = 1 --> weak smoothing (5 points, centred weighted) 1104 c ismooth = 2 --> normal smoothing (3 points, evenly weighted) 1105 c ismooth = 3 --> strong smoothing (5 points, evenly weighted) 1106 1107 1108 c malv august 1991 1109 c***************************************************************************** 1110 1111 implicit none 1112 1113 integer n, imax, imin, i, ismooth 1114 real*8 x(n), y(n) 1115 c***************************************************************************** 1116 1117 imin=1 1118 imax=n 1119 1120 if (ismooth.eq.0) then 1121 1122 return 1123 1124 elseif (ismooth.eq.1) then ! 5 points, with central weighting 1125 1126 do i=imin,imax 1127 if(i.eq.imin)then 1128 y(i)=x(imin) 1129 elseif(i.eq.imax)then 1130 y(i)=x(imax-1)+(x(imax-1)-x(imax-3))/2.d0 1131 elseif(i.gt.(imin+1) .and. i.lt.(imax-1) )then 1132 y(i) = ( x(i+2)/4.d0 + x(i+1)/2.d0 + 2.d0*x(i)/3.d0 + 1133 & x(i-1)/2.d0 + x(i-2)/4.d0 )* 6.d0/13.d0 1134 else 1135 y(i)=(x(i+1)/2.d0+x(i)+x(i-1)/2.d0)/2.d0 1136 end if 1137 end do 1138 1139 elseif (ismooth.eq.2) then ! 3 points, evenly spaced 1140 1141 do i=imin,imax 1142 if(i.eq.imin)then 1143 y(i)=x(imin) 1144 elseif(i.eq.imax)then 1145 y(i)=x(imax-1)+(x(imax-1)-x(imax-3))/2.d0 1146 else 1147 y(i) = ( x(i+1)+x(i)+x(i-1) )/3.d0 1148 end if 1149 end do 1150 1151 elseif (ismooth.eq.3) then ! 5 points, evenly spaced 1152 1153 do i=imin,imax 1154 if(i.eq.imin)then 1155 y(i) = x(imin) 1156 elseif(i.eq.(imin+1) .or. i.eq.(imax-1))then 1157 y(i) = ( x(i+1)+x(i)+x(i-1) )/3.d0 1158 elseif(i.eq.imax)then 1159 y(i) = ( x(imax-1) + x(imax-1) + x(imax-2) ) / 3.d0 1160 else 1161 y(i) = ( x(i+2)+x(i+1)+x(i)+x(i-1)+x(i-2) )/5.d0 1162 end if 1163 end do 1164 1165 else 1166 1167 write (*,*) ' Error in suaviza.f Wrong ismooth value.' 1168 stop 1169 1170 endif 1171 1172 c rehago el cambio, para devolver x(i) 1173 do i=imin,imax 1174 x(i)=y(i) 1175 end do 1176 1177 return 1178 end 1179 1180 1181 1182 1183 c***************************************************************************** 1184 c LUdec.F (includes lubksb_dp and ludcmp_dp subroutines) 1185 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1186 c 1187 c Solution of linear equation without inverting matrix 1188 c using LU decomposition: 1189 c AA * xx = bb AA, bb: known 1190 c xx: to be found 1191 c AA and bb are not modified in this subroutine 1192 c 1193 c MALV , Sep 2007 1194 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1195 1196 subroutine LUdec(xx,aa,bb,m,n) 1197 1198 implicit none 1199 1200 ! Arguments 1201 integer,intent(in) :: m, n 1202 real*8,intent(in) :: aa(m,m), bb(m) 1203 real*8,intent(out) :: xx(m) 1204 1205 1206 ! Local variables 1207 real*8 a(n,n), b(n), x(n), d 1208 integer i, j, indx(n) 1209 1210 1211 ! Subrutinas utilizadas 1212 ! ludcmp_dp, lubksb_dp 1213 1214 !!!!!!!!!!!!!!! Comienza el programa !!!!!!!!!!!!!! 780 c *** hunt.f *** 781 782 cccc 783 SUBROUTINE hunt(xx,n,x,jlo) 784 c 785 c Arguments 786 INTEGER jlo ! O 787 INTEGER n ! I 788 REAL xx(n) ! I 789 REAL x ! I 790 791 c Local variables 792 INTEGER inc,jhi,jm 793 LOGICAL ascnd 794 c 795 cccc 796 c 797 ascnd=xx(n).ge.xx(1) 798 if(jlo.le.0.or.jlo.gt.n)then 799 jlo=0 800 jhi=n+1 801 goto 3 802 endif 803 inc=1 804 if(x.ge.xx(jlo).eqv.ascnd)then 805 1 jhi=jlo+inc 806 ! write (*,*) jlo 807 if(jhi.gt.n)then 808 jhi=n+1 809 ! write (*,*) jhi-1 810 else if(x.ge.xx(jhi).eqv.ascnd)then 811 jlo=jhi 812 inc=inc+inc 813 ! write (*,*) jlo 814 goto 1 815 endif 816 else 817 jhi=jlo 818 2 jlo=jhi-inc 819 ! write (*,*) jlo 820 if(jlo.lt.1)then 821 jlo=0 822 else if(x.lt.xx(jlo).eqv.ascnd)then 823 jhi=jlo 824 inc=inc+inc 825 goto 2 826 endif 827 endif 828 3 if(jhi-jlo.eq.1)then 829 if(x.eq.xx(n))jlo=n-1 830 if(x.eq.xx(1))jlo=1 831 ! write (*,*) jlo 832 return 833 endif 834 jm=(jhi+jlo)/2 835 if(x.ge.xx(jm).eqv.ascnd)then 836 jlo=jm 837 else 838 jhi=jm 839 endif 840 ! write (*,*) jhi-1 841 goto 3 842 c 843 END 844 1215 845 1216 do i=1,n 1217 b(i) = bb(i+1) 1218 do j=1,n 1219 a(i,j) = aa(i+1,j+1) 1220 enddo 1221 enddo 1222 1223 ! Descomposicion de auxm1 1224 call ludcmp_dp ( a, n, n, indx, d) 1225 1226 ! Sustituciones foward y backwards para hallar la solucion 1227 do i=1,n 1228 x(i) = b(i) 1229 enddo 1230 call lubksb_dp( a, n, n, indx, x ) 1231 1232 do i=1,n 1233 xx(i+1) = x(i) 1234 enddo 1235 1236 return 1237 end 1238 1239 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1240 1241 subroutine ludcmp_dp(a,n,np,indx,d) 1242 1243 c jul 2011 malv+fgg 1244 1245 implicit none 1246 1247 integer,intent(in) :: n, np 1248 real*8,intent(inout) :: a(np,np) 1249 real*8,intent(out) :: d 1250 integer,intent(out) :: indx(n) 1251 1252 integer i, j, k, imax 1253 real*8,parameter :: tiny=1.0d-20 1254 real*8 vv(n), aamax, sum, dum 1255 1256 1257 d=1.0d0 1258 do 12 i=1,n 1259 aamax=0.0d0 1260 do 11 j=1,n 1261 if (abs(a(i,j)).gt.aamax) aamax=abs(a(i,j)) 1262 11 continue 1263 if (aamax.eq.0.0) then 1264 write(*,*) 'ludcmp_dp: singular matrix!' 1265 stop 1266 endif 1267 vv(i)=1.0d0/aamax 1268 12 continue 1269 do 19 j=1,n 1270 if (j.gt.1) then 1271 do 14 i=1,j-1 1272 sum=a(i,j) 1273 if (i.gt.1)then 1274 do 13 k=1,i-1 1275 sum=sum-a(i,k)*a(k,j) 1276 13 continue 1277 a(i,j)=sum 1278 endif 1279 14 continue 1280 endif 1281 aamax=0.0d0 1282 do 16 i=j,n 1283 sum=a(i,j) 1284 if (j.gt.1)then 1285 do 15 k=1,j-1 1286 sum=sum-a(i,k)*a(k,j) 1287 15 continue 1288 a(i,j)=sum 1289 endif 1290 dum=vv(i)*abs(sum) 1291 if (dum.ge.aamax) then 1292 imax=i 1293 aamax=dum 1294 endif 1295 16 continue 1296 if (j.ne.imax)then 1297 do 17 k=1,n 1298 dum=a(imax,k) 1299 a(imax,k)=a(j,k) 1300 a(j,k)=dum 1301 17 continue 1302 d=-d 1303 vv(imax)=vv(j) 1304 endif 1305 indx(j)=imax 1306 if(j.ne.n)then 1307 if(a(j,j).eq.0.0)a(j,j)=tiny 1308 dum=1.0d0/a(j,j) 1309 do 18 i=j+1,n 1310 a(i,j)=a(i,j)*dum 1311 18 continue 1312 endif 1313 19 continue 1314 if(a(n,n).eq.0.0)a(n,n)=tiny 1315 return 1316 end 1317 1318 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1319 1320 subroutine lubksb_dp(a,n,np,indx,b) 1321 1322 c jul 2011 malv+fgg 1323 1324 implicit none 1325 1326 integer,intent(in) :: n,np 1327 real*8,intent(in) :: a(np,np) 1328 integer,intent(in) :: indx(n) 1329 real*8,intent(out) :: b(n) 1330 1331 real*8 sum 1332 integer ii, ll, i, j 1333 1334 ii=0 1335 do 12 i=1,n 1336 ll=indx(i) 1337 sum=b(ll) 1338 b(ll)=b(i) 1339 if (ii.ne.0)then 1340 do 11 j=ii,i-1 1341 sum=sum-a(i,j)*b(j) 1342 11 continue 1343 else if (sum.ne.0.0) then 1344 ii=i 1345 endif 1346 b(i)=sum 1347 12 continue 1348 do 14 i=n,1,-1 1349 sum=b(i) 1350 if(i.lt.n)then 1351 do 13 j=i+1,n 1352 sum=sum-a(i,j)*b(j) 1353 13 continue 1354 endif 1355 b(i)=sum/a(i,i) 1356 14 continue 1357 return 1358 end 1359 1360 1361 1362 1363 c***************************************************************************** 1364 c intersp 1365 c *********************************************************************** 1366 subroutine intersp(yy,zz,m,y,z,n,opt) 1367 c interpolation soubroutine. input values: y(n) at z(n). 1368 c output values: yy(m) at zz(m). options: 1 -> lineal; 2 -> logarithmic 1369 1370 c jul 2011 malv+fgg 1371 c *********************************************************************** 1372 1373 implicit none 1374 1375 integer n,m,i,j,opt 1376 real zz(m),yy(m),z(n),y(n) 1377 real zmin,zzmin,zmax,zzmax 1378 1379 ! write(*,*) ' interpolating' 1380 ! call minsp(z,n,zmin) 1381 zmin=minval(z) 1382 ! call minsp(zz,m,zzmin) 1383 zzmin=minval(zz) 1384 ! call maxsp(z,n,zmax) 1385 zmax=maxval(z) 1386 ! call maxsp(zz,m,zzmax) 1387 zzmax=maxval(zz) 1388 1389 if(zzmin.lt.zmin)then 1390 write(*,*) 'from interp: new variable out of limits' 1391 write(*,*) zzmin,'must be .ge. ',zmin 1392 stop 1393 ! elseif(zzmax.gt.zmax)then 1394 ! write(*,*)'from interp: new variable out of limits' 1395 ! write(*,*)zzmax, 'must be .le. ',zmax 1396 ! stop 1397 end if 1398 1399 do 1,i=1,m 1400 1401 do 2,j=1,n-1 1402 if(zz(i).ge.z(j).and.zz(i).lt.z(j+1)) goto 3 1403 2 continue 1404 c in this case (zz(m).ge.z(n)) and j leaves the loop with j=n-1+1=n 1405 if(opt.eq.1)then 1406 yy(i)=y(n-1)+(y(n)-y(n-1))*(zz(i)-z(n-1))/(z(n)-z(n-1)) 1407 elseif(opt.eq.2)then 1408 if(y(n).eq.0.0.or.y(n-1).eq.0.0)then 1409 yy(i)=0.0 1410 else 1411 yy(i)=exp(log(y(n-1))+log(y(n)/y(n-1))* 1412 @ (zz(i)-z(n-1))/(z(n)-z(n-1))) 1413 end if 1414 else 1415 write(*,*)'from interp error: opt must be 1 or 2, opt= ',opt 1416 end if 1417 goto 1 1418 3 continue 1419 if(opt.eq.1)then 1420 yy(i)=y(j)+(y(j+1)-y(j))*(zz(i)-z(j))/(z(j+1)-z(j)) 1421 elseif(opt.eq.2)then 1422 if(y(j+1).eq.0.0.or.y(j).eq.0.0)then 1423 yy(i)=0.0 1424 else 1425 yy(i)=exp(log(y(j))+log(y(j+1)/y(j))* 1426 @ (zz(i)-z(j))/(z(j+1)-z(j))) 1427 end if 1428 else 1429 write(*,*)'from interp error: opt must be 1 or 2, opt= ',opt 1430 end if 1431 1 continue 1432 1433 return 1434 end 1435 1436 1437 1438 c***************************************************************************** 1439 c interdp 1440 c *********************************************************************** 1441 subroutine interdp(yy,zz,m,y,z,n,opt) 1442 c interpolation soubroutine. input values: y(n) at z(n). 1443 c output values: yy(m) at zz(m). options: 1 -> lineal; 2 -> logarithmic 1444 c jul 2011: malv+fgg Adapted to LMD-MGCM 1445 c *********************************************************************** 1446 implicit none 1447 integer n,m,i,j,opt 1448 real*8 zz(m),yy(m),z(n),y(n), zmin,zzmin,zmax,zzmax 1449 1450 ! write (*,*) ' d interpolating ' 1451 ! call mindp (z,n,zmin) 1452 zmin=minval(z) 1453 ! call mindp (zz,m,zzmin) 1454 zzmin=minval(zz) 1455 ! call maxdp (z,n,zmax) 1456 zmax=maxval(z) 1457 ! call maxdp (zz,m,zzmax) 1458 zzmax=maxval(zz) 846 c *** interdp_limits.f *** 847 848 c *********************************************************************** 849 850 subroutine interdp_limits ( yy, zz, m, i1,i2, 851 @ y, z, n, j1,j2, opt) 852 853 c Interpolation soubroutine. 854 c Returns values between indexes i1 & i2, donde 1 =< i1 =< i2 =< m 855 c Solo usan los indices de los inputs entre j1,j2, 1 =< j1 =< j2 =< n 856 c Input values: y(n) , z(n) (solo se usarann los valores entre j1,j2) 857 c zz(m) (solo se necesita entre i1,i2) 858 c Output values: yy(m) (solo se calculan entre i1,i2) 859 c Options: opt=1 -> lineal ,, opt=2 -> logarithmic 860 c Difference with interdp: 861 c here interpolation proceeds between indexes i1,i2 only 862 c if i1=1 & i2=m, both subroutines are exactly the same 863 c thus previous calls to interdp or interdp2 could be easily replaced 864 865 c JAN 98 MALV Version for mz1d 866 c *********************************************************************** 867 868 implicit none 869 870 ! Arguments 871 integer n,m ! I. Dimensions 872 integer i1, i2, j1, j2, opt ! I 873 real*8 zz(m) ! I 874 real*8 yy(m) ! O 875 real*8 z(n),y(n) ! I 876 877 ! Local variables 878 integer i,j 879 real*8 zmin,zzmin,zmax,zzmax 880 881 c ******************************* 882 883 ! write (*,*) ' d interpolating ' 884 ! call mindp_limits (z,n,zmin, j1,j2) 885 ! call mindp_limits (zz,m,zzmin, i1,i2) 886 ! call maxdp_limits (z,n,zmax, j1,j2) 887 ! call maxdp_limits (zz,m,zzmax, i1,i2) 888 zmin=minval(z(j1:j2)) 889 zzmin=minval(zz(i1:i2)) 890 zmax=maxval(z(j1:j2)) 891 zzmax=maxval(zz(i1:i2)) 1459 892 1460 893 if(zzmin.lt.zmin)then … … 1462 895 write (*,*) zzmin,'must be .ge. ',zmin 1463 896 stop 1464 ! elseif(zzmax.gt.zmax)then 1465 ! write (*,*) 'from interp: new variable out of limits' 1466 ! write (*,*) zzmax, 'must be .le. ',zmax 1467 ! stop 1468 end if 1469 1470 do 1,i=1,m 1471 1472 do 2,j=1,n-1 1473 if(zz(i).ge.z(j).and.zz(i).lt.z(j+1)) goto 3 1474 2 continue 1475 c in this case (zz(m).eq.z(n)) and j leaves the loop with j=n-1+1=n 1476 if(opt.eq.1)then 1477 yy(i)=y(n-1)+(y(n)-y(n-1))*(zz(i)-z(n-1))/(z(n)-z(n-1)) 1478 elseif(opt.eq.2)then 1479 if(y(n).eq.0.0d0.or.y(n-1).eq.0.0d0)then 1480 yy(i)=0.0d0 1481 else 1482 yy(i)=dexp(dlog(y(n-1))+dlog(y(n)/y(n-1))* 1483 @ (zz(i)-z(n-1))/(z(n)-z(n-1))) 1484 end if 1485 else 1486 write (*,*) 1487 @ ' from d interp error: opt must be 1 or 2, opt= ',opt 1488 end if 1489 goto 1 1490 3 continue 1491 if(opt.eq.1)then 1492 yy(i)=y(j)+(y(j+1)-y(j))*(zz(i)-z(j))/(z(j+1)-z(j)) 1493 ! write (*,*) ' ' 1494 ! write (*,*) ' z(j),z(j+1) =', z(j),z(j+1) 1495 ! write (*,*) ' t(j),t(j+1) =', y(j),y(j+1) 1496 ! write (*,*) ' zz, tt = ', zz(i), yy(i) 1497 elseif(opt.eq.2)then 1498 if(y(j+1).eq.0.0d0.or.y(j).eq.0.0d0)then 1499 yy(i)=0.0d0 1500 else 1501 yy(i)=dexp(dlog(y(j))+dlog(y(j+1)/y(j))* 1502 @ (zz(i)-z(j))/(z(j+1)-z(j))) 1503 end if 1504 else 1505 write (*,*) ' from interp error: opt must be 1 or 2, opt= ', 1506 @ opt 1507 end if 1508 1 continue 1509 return 1510 end 1511 1512 1513 c***************************************************************************** 1514 c interdp_limits.F 1515 c *********************************************************************** 1516 1517 subroutine interdp_limits ( yy,zz,m, i1,i2, y,z,n, j1,j2, opt) 1518 1519 c Interpolation soubroutine. 1520 c Returns values between indexes i1 & i2, donde 1 =< i1 =< i2 =< m 1521 c Solo usan los indices de los inputs entre j1,j2, 1 =< j1 =< j2 =< n 1522 c Input values: y(n) , z(n) (solo se usan los valores entre j1,j2) 1523 c zz(m) (solo se necesita entre i1,i2) 1524 c Output values: yy(m) (solo se calculan entre i1,i2) 1525 c Options: opt=1 -> lineal ,, opt=2 -> logarithmic 1526 c Difference with interdp: 1527 c here interpolation proceeds between indexes i1,i2 only 1528 c if i1=1 & i2=m, both subroutines are exactly the same 1529 c thus previous calls to interdp or interdp2 could be easily replaced 1530 1531 c JAN 98 MALV Version for mz1d 1532 c jul 2011 malv+fgg Adapted to LMD-MGCM 1533 c *********************************************************************** 1534 1535 implicit none 1536 1537 ! Arguments 1538 integer n,m ! I. Dimensions 1539 integer i1, i2, j1, j2, opt ! I 1540 real*8 zz(m),yy(m) ! O 1541 real*8 z(n),y(n) ! I 1542 1543 ! Local variables 1544 integer i,j 1545 real*8 zmin,zzmin,zmax,zzmax 1546 1547 c ******************************* 1548 1549 ! type *, ' d interpolating ' 1550 ! call mindp_limits (z,n,zmin, j1,j2) 1551 zmin=minval(z(j1:j2)) 1552 ! call mindp_limits (zz,m,zzmin, i1,i2) 1553 zzmin=minval(zz(i1:i2)) 1554 ! call maxdp_limits (z,n,zmax, j1,j2) 1555 zmax=maxval(z(j1:j2)) 1556 ! call maxdp_limits (zz,m,zzmax, i1,i2) 1557 zzmax=maxval(zz(i1:i2)) 1558 1559 if(zzmin.lt.zmin)then 1560 write (*,*) 'from d interp: new variable out of limits' 1561 write (*,*) zzmin,'must be .ge. ',zmin 1562 stop 1563 ! elseif(zzmax.gt.zmax)then 1564 ! type *,'from interp: new variable out of limits' 1565 ! type *,zzmax, 'must be .le. ',zmax 1566 ! stop 897 ! elseif(zzmax.gt.zmax)then 898 ! type *,'from interp: new variable out of limits' 899 ! type *,zzmax, 'must be .le. ',zmax 900 ! stop 1567 901 end if 1568 902 … … 1572 906 if(zz(i).ge.z(j).and.zz(i).lt.z(j+1)) goto 3 1573 907 2 continue 1574 c 908 c in this case (zz(i2).eq.z(j2)) and j leaves the loop with j=j2-1+1=j2 1575 909 if(opt.eq.1)then 1576 yy(i)=y(j2-1)+(y(j2)-y(j2-1))* 1577 $ (z z(i)-z(j2-1))/(z(j2)-z(j2-1))910 yy(i)=y(j2-1)+(y(j2)-y(j2-1))*(zz(i)-z(j2-1))/ 911 $ (z(j2)-z(j2-1)) 1578 912 elseif(opt.eq.2)then 1579 913 if(y(j2).eq.0.0d0.or.y(j2-1).eq.0.0d0)then … … 1590 924 if(opt.eq.1)then 1591 925 yy(i)=y(j)+(y(j+1)-y(j))*(zz(i)-z(j))/(z(j+1)-z(j)) 1592 ! 1593 ! 1594 ! 1595 ! 926 ! type *, ' ' 927 ! type *, ' z(j),z(j+1) =', z(j),z(j+1) 928 ! type *, ' t(j),t(j+1) =', y(j),y(j+1) 929 ! type *, ' zz, tt = ', zz(i), yy(i) 1596 930 elseif(opt.eq.2)then 1597 931 if(y(j+1).eq.0.0d0.or.y(j).eq.0.0d0)then … … 1610 944 1611 945 1612 1613 c***************************************************************************** 1614 c Subroutines previously included in tcrco2_subrut.F 946 c *** interhunt2veces.f *** 947 948 c *********************************************************************** 949 950 subroutine interhunt2veces ( y1,y2, zz,m, 951 @ x1,x2, z,n, opt) 952 953 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 954 c input values: y(n) at z(n) 955 c output values: yy(m) at zz(m) 956 c options: 1 -> lineal 957 c 2 -> logarithmic 958 c *********************************************************************** 959 960 implicit none 961 962 ! Arguments 963 integer n,m,opt ! I 964 real zz(m),z(n) ! I 965 real y1(m),y2(m) ! O 966 real x1(n),x2(n) ! I 967 968 969 ! Local variables 970 integer i, j 971 real factor 972 real zaux 973 974 !!!! 975 976 j = 1 ! initial first guess (=n/2 is anothr pssblty) 977 978 do 1,i=1,m ! 979 980 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 981 zaux = zz(i) 982 if (abs(zaux-z(1)).le.0.01) then 983 zaux=z(1) 984 elseif (abs(zaux-z(n)).le.0.01) then 985 zaux=z(n) 986 endif 987 call hunt ( z,n, zaux, j ) 988 if ( j.eq.0 .or. j.eq.n ) then 989 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 990 write (*,*) ' HUNT/ location in new grid:', zz(i) 991 stop ' interhunt2/ Interpolat error. zz out of limits.' 992 endif 993 994 ! Perform interpolation 995 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 996 if (opt.eq.1) then 997 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 998 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 999 else 1000 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1001 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1002 end if 1003 1004 1 continue 1005 1006 return 1007 end 1008 1009 1010 c *** interhunt5veces.f *** 1011 1012 c *********************************************************************** 1013 1014 subroutine interhunt5veces ( y1,y2,y3,y4,y5, zz,m, 1015 @ x1,x2,x3,x4,x5, z,n, opt) 1016 1017 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1018 c input values: y(n) at z(n) 1019 c output values: yy(m) at zz(m) 1020 c options: 1 -> lineal 1021 c 2 -> logarithmic 1022 c *********************************************************************** 1023 1024 implicit none 1025 ! Arguments 1026 integer n,m,opt ! I 1027 real zz(m),z(n) ! I 1028 real y1(m),y2(m),y3(m),y4(m),y5(m) ! O 1029 real x1(n),x2(n),x3(n),x4(n),x5(n) ! I 1030 1031 1032 ! Local variables 1033 integer i, j 1034 real factor 1035 real zaux 1036 1037 !!!! 1038 1039 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1040 1041 do 1,i=1,m ! 1042 1043 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1044 zaux = zz(i) 1045 if (abs(zaux-z(1)).le.0.01) then 1046 zaux=z(1) 1047 elseif (abs(zaux-z(n)).le.0.01) then 1048 zaux=z(n) 1049 endif 1050 call hunt ( z,n, zaux, j ) 1051 if ( j.eq.0 .or. j.eq.n ) then 1052 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1053 write (*,*) ' HUNT/ location in new grid:', zz(i) 1054 stop ' interhunt5/ Interpolat error. zz out of limits.' 1055 endif 1056 1057 ! Perform interpolation 1058 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1059 if (opt.eq.1) then 1060 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1061 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1062 y3(i) = x3(j) + (x3(j+1)-x3(j)) * factor 1063 y4(i) = x4(j) + (x4(j+1)-x4(j)) * factor 1064 y5(i) = x5(j) + (x5(j+1)-x5(j)) * factor 1065 else 1066 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1067 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1068 y3(i) = exp( log(x3(j)) + log(x3(j+1)/x3(j)) * factor ) 1069 y4(i) = exp( log(x4(j)) + log(x4(j+1)/x4(j)) * factor ) 1070 y5(i) = exp( log(x5(j)) + log(x5(j+1)/x5(j)) * factor ) 1071 end if 1072 1073 1 continue 1074 1075 return 1076 end 1077 1078 1079 1080 c *** interhuntdp3veces.f *** 1081 1082 c *********************************************************************** 1083 1084 subroutine interhuntdp3veces ( y1,y2,y3, zz,m, 1085 @ x1,x2,x3, z,n, opt) 1086 1087 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1088 c input values: x(n) at z(n) 1089 c output values: y(m) at zz(m) 1090 c options: opt = 1 -> lineal 1091 c opt=/=1 -> logarithmic 1092 c *********************************************************************** 1093 ! Arguments 1094 integer n,m,opt ! I 1095 real*8 zz(m),z(n) ! I 1096 real*8 y1(m),y2(m),y3(m) ! O 1097 real*8 x1(n),x2(n),x3(n) ! I 1098 1099 1100 ! Local variables 1101 integer i, j 1102 real*8 factor 1103 real*8 zaux 1104 1105 !!!! 1106 1107 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1108 1109 do 1,i=1,m ! 1110 1111 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1112 zaux = zz(i) 1113 if (abs(zaux-z(1)).le.0.01d0) then 1114 zaux=z(1) 1115 elseif (abs(zaux-z(n)).le.0.01d0) then 1116 zaux=z(n) 1117 endif 1118 call huntdp ( z,n, zaux, j ) 1119 if ( j.eq.0 .or. j.eq.n ) then 1120 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1121 write (*,*) ' HUNT/ location in new grid:', zz(i) 1122 stop ' INTERHUNTDP3/ Interpolat error. zz out of limits.' 1123 endif 1124 1125 ! Perform interpolation 1126 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1127 if (opt.eq.1) then 1128 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1129 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1130 y3(i) = x3(j) + (x3(j+1)-x3(j)) * factor 1131 else 1132 y1(i) = dexp( dlog(x1(j)) + dlog(x1(j+1)/x1(j)) * factor ) 1133 y2(i) = dexp( dlog(x2(j)) + dlog(x2(j+1)/x2(j)) * factor ) 1134 y3(i) = dexp( dlog(x3(j)) + dlog(x3(j+1)/x3(j)) * factor ) 1135 end if 1136 1137 1 continue 1138 1139 return 1140 end 1141 1142 1143 c *** interhuntdp4veces.f *** 1144 1145 c *********************************************************************** 1146 1147 subroutine interhuntdp4veces ( y1,y2,y3,y4, zz,m, 1148 @ x1,x2,x3,x4, z,n, opt) 1149 1150 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1151 c input values: x1(n),x2(n),x3(n),x4(n) at z(n) 1152 c output values: y1(m),y2(m),y3(m),y4(m) at zz(m) 1153 c options: 1 -> lineal 1154 c 2 -> logarithmic 1155 c *********************************************************************** 1156 1157 implicit none 1158 1159 ! Arguments 1160 integer n,m,opt ! I 1161 real*8 zz(m),z(n) ! I 1162 real*8 y1(m),y2(m),y3(m),y4(m) ! O 1163 real*8 x1(n),x2(n),x3(n),x4(n) ! I 1164 1165 1166 ! Local variables 1167 integer i, j 1168 real*8 factor 1169 real*8 zaux 1170 1171 !!!! 1172 1173 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1174 1175 do 1,i=1,m ! 1176 1177 ! Caza del indice j donde ocurre que zz(i) esta entre [z(j),z(j+1)] 1178 zaux = zz(i) 1179 if (abs(zaux-z(1)).le.0.01d0) then 1180 zaux=z(1) 1181 elseif (abs(zaux-z(n)).le.0.01d0) then 1182 zaux=z(n) 1183 endif 1184 call huntdp ( z,n, zaux, j ) 1185 if ( j.eq.0 .or. j.eq.n ) then 1186 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1187 write (*,*) ' HUNT/ location in new grid:', zz(i) 1188 stop ' INTERHUNTDP4/ Interpolat error. zz out of limits.' 1189 endif 1190 1191 ! Perform interpolation 1192 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1193 if (opt.eq.1) then 1194 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1195 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1196 y3(i) = x3(j) + (x3(j+1)-x3(j)) * factor 1197 y4(i) = x4(j) + (x4(j+1)-x4(j)) * factor 1198 else 1199 y1(i) = dexp( dlog(x1(j)) + dlog(x1(j+1)/x1(j)) * factor ) 1200 y2(i) = dexp( dlog(x2(j)) + dlog(x2(j+1)/x2(j)) * factor ) 1201 y3(i) = dexp( dlog(x3(j)) + dlog(x3(j+1)/x3(j)) * factor ) 1202 y4(i) = dexp( dlog(x4(j)) + dlog(x4(j+1)/x4(j)) * factor ) 1203 end if 1204 1205 1 continue 1206 1207 return 1208 end 1209 1210 1211 c *** interhuntdp.f *** 1212 1213 c *********************************************************************** 1214 1215 subroutine interhuntdp ( y1, zz,m, 1216 @ x1, z,n, opt) 1217 1218 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1219 c input values: x1(n) at z(n) 1220 c output values: y1(m) at zz(m) 1221 c options: 1 -> lineal 1222 c 2 -> logarithmic 1223 c *********************************************************************** 1224 1225 implicit none 1226 1227 ! Arguments 1228 integer n,m,opt ! I 1229 real*8 zz(m),z(n) ! I 1230 real*8 y1(m) ! O 1231 real*8 x1(n) ! I 1232 1233 1234 ! Local variables 1235 integer i, j 1236 real*8 factor 1237 real*8 zaux 1238 1239 !!!! 1240 1241 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1242 1243 do 1,i=1,m ! 1244 1245 ! Caza del indice j donde ocurre que zz(i) esta entre [z(j),z(j+1)] 1246 zaux = zz(i) 1247 if (abs(zaux-z(1)).le.0.01d0) then 1248 zaux=z(1) 1249 elseif (abs(zaux-z(n)).le.0.01d0) then 1250 zaux=z(n) 1251 endif 1252 call huntdp ( z,n, zaux, j ) 1253 if ( j.eq.0 .or. j.eq.n ) then 1254 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1255 write (*,*) ' HUNT/ location in new grid:', zz(i) 1256 stop ' INTERHUNT/ Interpolat error. zz out of limits.' 1257 endif 1258 1259 ! Perform interpolation 1260 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1261 if (opt.eq.1) then 1262 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1263 else 1264 y1(i) = dexp( dlog(x1(j)) + dlog(x1(j+1)/x1(j)) * factor ) 1265 end if 1266 1267 1 continue 1268 1269 return 1270 end 1271 1272 1273 c *** interhunt.f *** 1274 1615 1275 c*********************************************************************** 1616 c tcrco2_subrut.f 1617 c 1618 c jan 98 malv version for mz1d. copied from solar10/mz4sub.f 1619 c jul 2011 malv+fgg adapted to LMD-MGCM 1276 1277 subroutine interhunt ( y1, zz,m, 1278 @ x1, z,n, opt) 1279 1280 c interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1281 c input values: x1(n) at z(n) 1282 c output values: y1(m) at zz(m) 1283 c options: 1 -> lineal 1284 c 2 -> logarithmic 1620 1285 c*********************************************************************** 1621 1622 ************************************************************************ 1623 1624 subroutine dinterconnection ( v, vt ) 1625 1626 * input: vib. temp. from che*.for programs, vt(nl) 1627 * output: test vibrational temp. for other che*.for, v(nl) 1628 ! iconex_smooth=1 ==> with smoothing 1629 ! iconex_smooth=0 ==> without smoothing 1630 ! iconex_tk=40 ==> with forced lte up to 40 km 1631 ! iconex_tk=20 ==> with forced lte up to 20 km 1632 ************************************************************************ 1633 1634 implicit none 1635 include 'nlte_paramdef.h' 1636 include 'nlte_commons.h' 1637 1638 c argumentos 1639 real*8 vt(nl), v(nl) 1640 1641 c local variables 1642 integer i 1643 1644 c ************* 1645 1646 do i=1,nl 1647 v(i) = vt(i) 1648 end do 1649 1650 ! lo siguiente se utilizaba en solar10, pero es mejor introducirlo en 1651 ! la driver. por ahora no lo uso todavia. 1652 ! call fluctua(v,iconex_fluctua) 1653 ! call smooth_nl(v,iconex_smooth,nl) 1654 ! call forzar_tk(v,iconex_tk) 1655 1656 return 1657 end 1658 1286 1287 implicit none 1288 1289 ! Arguments 1290 integer n,m,opt ! I 1291 real zz(m),z(n) ! I 1292 real y1(m) ! O 1293 real x1(n) ! I 1294 1295 1296 ! Local variables 1297 integer i, j 1298 real factor 1299 real zaux 1300 1301 !!!! 1302 1303 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1304 1305 do 1,i=1,m ! 1306 1307 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1308 zaux = zz(i) 1309 if (abs(zaux-z(1)).le.0.01) then 1310 zaux=z(1) 1311 elseif (abs(zaux-z(n)).le.0.01) then 1312 zaux=z(n) 1313 endif 1314 call hunt ( z,n, zaux, j ) 1315 if ( j.eq.0 .or. j.eq.n ) then 1316 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1317 write (*,*) ' HUNT/ location in new grid:', zz(i) 1318 stop ' interhunt/ Interpolat error. z out of limits.' 1319 endif 1320 1321 ! Perform interpolation 1322 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1323 if (opt.eq.1) then 1324 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1325 else 1326 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1327 end if 1328 1329 1330 1 continue 1331 1332 return 1333 end 1334 1335 1336 c *** interhuntlimits2veces.f *** 1337 1659 1338 c*********************************************************************** 1660 function planckdp(tp,xnu) 1661 c returns the black body function at wavenumber xnu and temperature t. 1339 1340 subroutine interhuntlimits2veces 1341 @ ( y1,y2, zz,m, limite1,limite2, 1342 @ x1,x2, z,n, opt) 1343 1344 c Interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1345 c Input values: x1,x2(n) at z(n) 1346 c Output values: 1347 c y1,y2(m) at zz(m) pero solo entre los indices de zz 1348 c siguientes: [limite1,limite2] 1349 c Options: 1 -> linear in z and linear in x 1350 c 2 -> linear in z and logarithmic in x 1351 c 3 -> logarithmic in z and linear in x 1352 c 4 -> logarithmic in z and logaritmic in x 1353 c 1354 c NOTAS: Esta subrutina extiende y generaliza la usual 1355 c "interhunt5veces" en 2 direcciones: 1356 c - la condicion en los limites es que zz(limite1:limite2) 1357 c esté dentro de los limites de z (pero quizas no todo zz) 1358 c - se han añadido 3 opciones mas al caso de interpolacion 1359 c logaritmica, ahora se hace en log de z, de x o de ambos. 1360 c Notese que esta subrutina engloba a la interhunt5veces 1361 c ( esta es reproducible haciendo limite1=1 y limite2=m 1362 c y usando una de las 2 primeras opciones opt=1,2 ) 1662 1363 c*********************************************************************** 1663 1664 implicit none 1665 1666 include 'nlte_paramdef.h' 1667 include 'nlte_commons.h' 1668 1669 ! common/datis/ pi, vlight, ee, hplanck, gamma, ab, 1670 ! @ n_avog, GG, R0, cte_sb, kboltzman, raddeg 1671 ! real*8 pi, vlight, ee, hplanck, gamma, ab, 1672 ! @ n_avog, GG, R0, cte_sb, kboltzman, raddeg 1673 1674 real*8 planckdp 1675 real*8 xnu 1676 real tp 1677 1678 planckdp = gamma*xnu**3.0 / exp( ee*xnu/dble(tp) ) 1679 !erg cm-2.sr-1/cm-1. 1680 1681 return 1682 end 1683 1684 c **************************************************************** 1685 function bandid (ib) 1686 c returns the 2 character code of the band 1687 c **************************************************************** 1688 implicit none 1689 1690 integer ib 1691 character*2 bandid 1692 1693 132 format(i2) 1694 ! encode (2,132,bandid) ib 1695 write ( bandid, 132) ib 1696 1697 if ( ib .eq. 1 ) bandid = '01' 1698 if ( ib .eq. 2 ) bandid = '02' 1699 if ( ib .eq. 3 ) bandid = '03' 1700 if ( ib .eq. 4 ) bandid = '04' 1701 if ( ib .eq. 5 ) bandid = '05' 1702 if ( ib .eq. 6 ) bandid = '06' 1703 if ( ib .eq. 7 ) bandid = '07' 1704 if ( ib .eq. 8 ) bandid = '08' 1705 if ( ib .eq. 9 ) bandid = '09' 1706 if ( ib .eq. 0 ) bandid = '00' 1707 1708 c end 1709 return 1364 1365 implicit none 1366 1367 ! Arguments 1368 integer n,m,opt, limite1,limite2 ! I 1369 real zz(m),z(n) ! I 1370 real y1(m),y2(m) ! O 1371 real x1(n),x2(n) ! I 1372 1373 1374 ! Local variables 1375 integer i, j 1376 real factor 1377 real zaux 1378 1379 !!!! 1380 1381 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1382 1383 do 1,i=limite1,limite2 1384 1385 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1386 zaux = zz(i) 1387 if (abs(zaux-z(1)).le.0.01) then 1388 zaux=z(1) 1389 elseif (abs(zaux-z(n)).le.0.01) then 1390 zaux=z(n) 1391 endif 1392 call hunt ( z,n, zaux, j ) 1393 if ( j.eq.0 .or. j.eq.n ) then 1394 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1395 write (*,*) ' HUNT/ location in new grid:', zz(i) 1396 stop ' interhuntlimits/ Interpolat error. z out of limits.' 1397 endif 1398 1399 ! Perform interpolation 1400 if (opt.eq.1) then 1401 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1402 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1403 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1404 1405 elseif (opt.eq.2) then 1406 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1407 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1408 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1409 elseif (opt.eq.3) then 1410 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1411 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1412 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1413 elseif (opt.eq.4) then 1414 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1415 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1416 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1417 end if 1418 1419 1420 1 continue 1421 1422 return 1423 end 1424 1425 1426 c *** interhuntlimits5veces.f *** 1427 1428 c*********************************************************************** 1429 1430 subroutine interhuntlimits5veces 1431 @ ( y1,y2,y3,y4,y5, zz,m, limite1,limite2, 1432 @ x1,x2,x3,x4,x5, z,n, opt) 1433 1434 c Interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1435 c Input values: x1,x2,..,x5(n) at z(n) 1436 c Output values: 1437 c y1,y2,...,y5(m) at zz(m) pero solo entre los indices de zz 1438 c siguientes: [limite1,limite2] 1439 c Options: 1 -> linear in z and linear in x 1440 c 2 -> linear in z and logarithmic in x 1441 c 3 -> logarithmic in z and linear in x 1442 c 4 -> logarithmic in z and logaritmic in x 1443 c 1444 c NOTAS: Esta subrutina extiende y generaliza la usual 1445 c "interhunt5veces" en 2 direcciones: 1446 c - la condicion en los limites es que zz(limite1:limite2) 1447 c esté dentro de los limites de z (pero quizas no todo zz) 1448 c - se han añadido 3 opciones mas al caso de interpolacion 1449 c logaritmica, ahora se hace en log de z, de x o de ambos. 1450 c Notese que esta subrutina engloba a la interhunt5veces 1451 c ( esta es reproducible haciendo limite1=1 y limite2=m 1452 c y usando una de las 2 primeras opciones opt=1,2 ) 1453 c*********************************************************************** 1454 1455 implicit none 1456 1457 ! Arguments 1458 integer n,m,opt, limite1,limite2 ! I 1459 real zz(m),z(n) ! I 1460 real y1(m),y2(m),y3(m),y4(m),y5(m) ! O 1461 real x1(n),x2(n),x3(n),x4(n),x5(n) ! I 1462 1463 1464 ! Local variables 1465 integer i, j 1466 real factor 1467 real zaux 1468 1469 !!!! 1470 1471 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1472 1473 do 1,i=limite1,limite2 1474 1475 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1476 zaux = zz(i) 1477 if (abs(zaux-z(1)).le.0.01) then 1478 zaux=z(1) 1479 elseif (abs(zaux-z(n)).le.0.01) then 1480 zaux=z(n) 1481 endif 1482 call hunt ( z,n, zaux, j ) 1483 if ( j.eq.0 .or. j.eq.n ) then 1484 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1485 write (*,*) ' HUNT/ location in new grid:', zz(i) 1486 stop ' interhuntlimits/ Interpolat error. z out of limits.' 1487 endif 1488 1489 ! Perform interpolation 1490 if (opt.eq.1) then 1491 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1492 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1493 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1494 y3(i) = x3(j) + (x3(j+1)-x3(j)) * factor 1495 y4(i) = x4(j) + (x4(j+1)-x4(j)) * factor 1496 y5(i) = x5(j) + (x5(j+1)-x5(j)) * factor 1497 elseif (opt.eq.2) then 1498 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1499 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1500 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1501 y3(i) = exp( log(x3(j)) + log(x3(j+1)/x3(j)) * factor ) 1502 y4(i) = exp( log(x4(j)) + log(x4(j+1)/x4(j)) * factor ) 1503 y5(i) = exp( log(x5(j)) + log(x5(j+1)/x5(j)) * factor ) 1504 elseif (opt.eq.3) then 1505 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1506 y1(i) = x1(j) + (x1(j+1)-x1(j)) * factor 1507 y2(i) = x2(j) + (x2(j+1)-x2(j)) * factor 1508 y3(i) = x3(j) + (x3(j+1)-x3(j)) * factor 1509 y4(i) = x4(j) + (x4(j+1)-x4(j)) * factor 1510 y5(i) = x5(j) + (x5(j+1)-x5(j)) * factor 1511 elseif (opt.eq.4) then 1512 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1513 y1(i) = exp( log(x1(j)) + log(x1(j+1)/x1(j)) * factor ) 1514 y2(i) = exp( log(x2(j)) + log(x2(j+1)/x2(j)) * factor ) 1515 y3(i) = exp( log(x3(j)) + log(x3(j+1)/x3(j)) * factor ) 1516 y4(i) = exp( log(x4(j)) + log(x4(j+1)/x4(j)) * factor ) 1517 y5(i) = exp( log(x5(j)) + log(x5(j+1)/x5(j)) * factor ) 1518 end if 1519 1520 1521 1 continue 1522 1523 return 1524 end 1525 1526 1527 1528 c *** interhuntlimits.f *** 1529 1530 c*********************************************************************** 1531 1532 subroutine interhuntlimits ( y, zz,m, limite1,limite2, 1533 @ x, z,n, opt) 1534 1535 c Interpolation soubroutine basada en Numerical Recipes HUNT.FOR 1536 c Input values: x(n) at z(n) 1537 c Output values: y(m) at zz(m) pero solo entre los indices de zz 1538 c siguientes: [limite1,limite2] 1539 c Options: 1 -> linear in z and linear in x 1540 c 2 -> linear in z and logarithmic in x 1541 c 3 -> logarithmic in z and linear in x 1542 c 4 -> logarithmic in z and logaritmic in x 1543 c 1544 c NOTAS: Esta subrutina extiende y generaliza la usual "interhunt" 1545 c en 2 direcciones: 1546 c - la condicion en los limites es que zz(limite1:limite2) 1547 c esté dentro de los limites de z (pero quizas no todo zz) 1548 c - se han añadido 3 opciones mas al caso de interpolacion 1549 c logaritmica, ahora se hace en log de z, de x o de ambos. 1550 c Notese que esta subrutina engloba a la usual interhunt 1551 c ( esta es reproducible haciendo limite1=1 y limite2=m 1552 c y usando una de las 2 primeras opciones opt=1,2 ) 1553 c*********************************************************************** 1554 1555 implicit none 1556 1557 ! Arguments 1558 integer n,m,opt, limite1,limite2 ! I 1559 real zz(m),z(n) ! I 1560 real y(m) ! O 1561 real x(n) ! I 1562 1563 1564 ! Local variables 1565 integer i, j 1566 real factor 1567 real zaux 1568 1569 !!!! 1570 1571 j = 1 ! initial first guess (=n/2 is anothr pssblty) 1572 1573 do 1,i=limite1,limite2 1574 1575 ! Busca indice j donde ocurre q zz(i) esta entre [z(j),z(j+1)] 1576 zaux = zz(i) 1577 if (abs(zaux-z(1)).le.0.01) then 1578 zaux=z(1) 1579 elseif (abs(zaux-z(n)).le.0.01) then 1580 zaux=z(n) 1581 endif 1582 call hunt ( z,n, zaux, j ) 1583 if ( j.eq.0 .or. j.eq.n ) then 1584 write (*,*) ' HUNT/ Limits input grid:', z(1),z(n) 1585 write (*,*) ' HUNT/ location in new grid:', zz(i) 1586 stop ' interhuntlimits/ Interpolat error. z out of limits.' 1587 endif 1588 1589 ! Perform interpolation 1590 if (opt.eq.1) then 1591 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1592 y(i) = x(j) + (x(j+1)-x(j)) * factor 1593 elseif (opt.eq.2) then 1594 factor = (zz(i)-z(j))/(z(j+1)-z(j)) 1595 y(i) = exp( log(x(j)) + log(x(j+1)/x(j)) * factor ) 1596 elseif (opt.eq.3) then 1597 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1598 y(i) = x(j) + (x(j+1)-x(j)) * factor 1599 elseif (opt.eq.4) then 1600 factor = (log(zz(i))-log(z(j)))/(log(z(j+1))-log(z(j))) 1601 y(i) = exp( log(x(j)) + log(x(j+1)/x(j)) * factor ) 1602 end if 1603 1604 1605 1 continue 1606 1607 return 1608 end 1609 1610 1611 c *** lubksb_dp.f *** 1612 1613 subroutine lubksb_dp(a,n,np,indx,b) 1614 1615 implicit none 1616 1617 integer,intent(in) :: n,np 1618 real*8,intent(in) :: a(np,np) 1619 integer,intent(in) :: indx(n) 1620 real*8,intent(out) :: b(n) 1621 1622 real*8 sum 1623 integer ii, ll, i, j 1624 1625 ii=0 1626 do 12 i=1,n 1627 ll=indx(i) 1628 sum=b(ll) 1629 b(ll)=b(i) 1630 if (ii.ne.0)then 1631 do 11 j=ii,i-1 1632 sum=sum-a(i,j)*b(j) 1633 11 continue 1634 else if (sum.ne.0.0) then 1635 ii=i 1636 endif 1637 b(i)=sum 1638 12 continue 1639 do 14 i=n,1,-1 1640 sum=b(i) 1641 if(i.lt.n)then 1642 do 13 j=i+1,n 1643 sum=sum-a(i,j)*b(j) 1644 13 continue 1645 endif 1646 b(i)=sum/a(i,i) 1647 14 continue 1648 return 1649 end 1650 1651 1652 c *** ludcmp_dp.f *** 1653 1654 subroutine ludcmp_dp(a,n,np,indx,d) 1655 1656 implicit none 1657 1658 integer,intent(in) :: n, np 1659 real*8,intent(inout) :: a(np,np) 1660 real*8,intent(out) :: d 1661 integer,intent(out) :: indx(n) 1662 1663 integer nmax, i, j, k, imax 1664 real*8 tiny 1665 parameter (nmax=100,tiny=1.0d-20) 1666 real*8 vv(nmax), aamax, sum, dum 1667 1668 1669 d=1.0d0 1670 do 12 i=1,n 1671 aamax=0.0d0 1672 do 11 j=1,n 1673 if (abs(a(i,j)).gt.aamax) aamax=abs(a(i,j)) 1674 11 continue 1675 if (aamax.eq.0.0) then 1676 write(*,*) 'ludcmp_dp: singular matrix!' 1677 stop 1678 endif 1679 vv(i)=1.0d0/aamax 1680 12 continue 1681 do 19 j=1,n 1682 if (j.gt.1) then 1683 do 14 i=1,j-1 1684 sum=a(i,j) 1685 if (i.gt.1)then 1686 do 13 k=1,i-1 1687 sum=sum-a(i,k)*a(k,j) 1688 13 continue 1689 a(i,j)=sum 1690 endif 1691 14 continue 1692 endif 1693 aamax=0.0d0 1694 do 16 i=j,n 1695 sum=a(i,j) 1696 if (j.gt.1)then 1697 do 15 k=1,j-1 1698 sum=sum-a(i,k)*a(k,j) 1699 15 continue 1700 a(i,j)=sum 1701 endif 1702 dum=vv(i)*abs(sum) 1703 if (dum.ge.aamax) then 1704 imax=i 1705 aamax=dum 1706 endif 1707 16 continue 1708 if (j.ne.imax)then 1709 do 17 k=1,n 1710 dum=a(imax,k) 1711 a(imax,k)=a(j,k) 1712 a(j,k)=dum 1713 17 continue 1714 d=-d 1715 vv(imax)=vv(j) 1716 endif 1717 indx(j)=imax 1718 if(j.ne.n)then 1719 if(a(j,j).eq.0.0)a(j,j)=tiny 1720 dum=1.0d0/a(j,j) 1721 do 18 i=j+1,n 1722 a(i,j)=a(i,j)*dum 1723 18 continue 1724 endif 1725 19 continue 1726 if(a(n,n).eq.0.0)a(n,n)=tiny 1727 return 1710 1728 end 1711 1729 1712 1730 1713 1714 c***************************************************************************** 1715 c Subroutines previously included in mat_oper.F 1716 c***************************************************************************** 1717 c set of subroutines for the cz*.for programs: 1718 ! subroutine unit(a,n) 1719 ! subroutine diago(a,v,n) diagonal matrix with v 1720 ! subroutine invdiag(a,b,n) inverse of diagonal matrix 1721 ! subroutine sypvvv(a,b,c,d,n) suma y prod de 3 vectores, muy comun 1722 ! subroutine sypvmv(v,w,b,u,n) suma y prod de 3 vectores, muy comun 1723 ! subroutine mulmvv(w,b,u,v,n) prod matriz vector vector 1724 ! subroutine muymvv(w,b,u,v,n) prod matriz (inv.vector) vector 1725 ! subroutine samem (a,m,n) 1726 ! subroutine mulmv(a,b,c,n) 1727 ! subroutine mulmm(a,b,c,n) 1728 ! subroutine resmm(a,b,c,n) 1729 ! subroutine mulvv(a,b,c,n) 1730 ! subroutine sumvv(a,b,c,n) 1731 ! subroutine zerom(a,n) 1732 ! subroutine zero4m(a,b,c,d,n) 1733 ! subroutine zero3m(a,b,c,n) 1734 ! subroutine zero2m(a,b,n) 1735 ! subroutine zerov(a,n) 1736 ! subroutine zero4v(a,b,c,d,n) 1737 ! subroutine zero3v(a,b,c,n) 1738 ! subroutine zero2v(a,b,n) 1739 1740 ! 1741 ! 1742 ! May-05 Sustituimos todos los zerojt de cristina por las subrutinas 1743 ! genericas zerov*** 1744 ! 1731 c *** LUdec.f *** 1732 1733 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1734 c 1735 c Solution of linear equation without inverting matrix 1736 c using LU decomposition: 1737 c AA * xx = bb AA, bb: known 1738 c xx: to be found 1739 c AA and bb are not modified in this subroutine 1740 c 1741 c MALV , Sep 2007 1742 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1743 1744 subroutine LUdec(xx,aa,bb,m,n) 1745 1746 implicit none 1747 1748 ! Arguments 1749 integer,intent(in) :: m, n 1750 real*8,intent(in) :: aa(m,m), bb(m) 1751 real*8,intent(out) :: xx(m) 1752 1753 1754 ! Local variables 1755 real*8 a(n,n), b(n), x(n), d 1756 integer i, j, indx(n) 1757 1758 1759 ! Subrutinas utilizadas 1760 ! ludcmp_dp, lubksb_dp 1761 1762 !!!!!!!!!!!!!!!Comienza el programa !!!!!!!!!!!!!! 1763 1764 do i=1,n 1765 b(i) = bb(i+1) 1766 do j=1,n 1767 a(i,j) = aa(i+1,j+1) 1768 enddo 1769 enddo 1770 1771 ! Descomposicion de auxm1 1772 call ludcmp_dp ( a, n, n, indx, d) 1773 1774 ! Sustituciones foward y backwards para hallar la solucion 1775 do i=1,n 1776 x(i) = b(i) 1777 enddo 1778 call lubksb_dp( a, n, n, indx, x ) 1779 1780 do i=1,n 1781 xx(i+1) = x(i) 1782 enddo 1783 1784 return 1785 end 1786 1787 1788 c *** mat_oper.f *** 1789 1790 ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 1791 1745 1792 c *********************************************************************** 1746 1793 subroutine unit(a,n) 1747 1794 c store the unit value in the diagonal of a 1748 1795 c *********************************************************************** 1796 implicit none 1749 1797 real*8 a(n,n) 1750 1798 integer n,i,j,k … … 1795 1843 1796 1844 c *********************************************************************** 1845 subroutine invdiag(a,b,n) 1846 c inverse of a diagonal matrix 1847 c *********************************************************************** 1848 implicit none 1849 1850 integer n,i,j,k 1851 real*8 a(n,n),b(n,n) 1852 1853 do 1,i=2,n-1 1854 do 2,j=2,n-1 1855 if (i.eq.j) then 1856 a(i,j) = 1.d0/b(i,i) 1857 else 1858 a(i,j)=0.0d0 1859 end if 1860 2 continue 1861 1 continue 1862 do k=1,n 1863 a(n,k) = 0.0d0 1864 a(1,k) = 0.0d0 1865 a(k,1) = 0.0d0 1866 a(k,n) = 0.0d0 1867 end do 1868 return 1869 end 1870 1871 1872 c *********************************************************************** 1797 1873 subroutine samem (a,m,n) 1798 1874 c store the matrix m in the matrix a 1799 1875 c *********************************************************************** 1876 implicit none 1800 1877 real*8 a(n,n),m(n,n) 1801 1878 integer n,i,j,k … … 1813 1890 return 1814 1891 end 1892 1893 1815 1894 c *********************************************************************** 1816 1895 subroutine mulmv(a,b,c,n) … … 1825 1904 sum=0.0d0 1826 1905 do 2,j=2,n-1 1827 sum =sum+ (b(i,j)) * (c(j))1906 sum = sum + b(i,j) * c(j) 1828 1907 2 continue 1829 1908 a(i)=sum … … 1834 1913 end 1835 1914 1836 c *********************************************************************** 1837 subroutine mulmm(a,b,c,n) 1838 c *********************************************************************** 1839 real*8 a(n,n), b(n,n), c(n,n) 1915 1916 c *********************************************************************** 1917 subroutine trucodiag(a,b,c,d,e,n) 1918 c inputs: matrices b,c,d,e 1919 c output: matriz diagonal a 1920 c Operacion a realizar: a = b * c^(-1) * d + e 1921 c La matriz c va a ser invertida 1922 c Todas las matrices de entrada son diagonales excepto b 1923 c Aprovechamos esa condicion para invertir c, acelerar el calculo, y 1924 c ademas, para forzar que a sea diagonal 1925 c *********************************************************************** 1926 implicit none 1927 real*8 a(n,n),b(n,n),c(n,n),d(n,n),e(n,n), sum 1840 1928 integer n,i,j,k 1841 1842 ! do i=2,n-1 1843 ! do j=2,n-1 1844 ! a(i,j)= 0.d00 1845 ! do k=2,n-1 1846 ! a(i,j) = a(i,j) + b(i,k) * c(k,j) 1847 ! end do 1848 ! end do 1849 ! end do 1850 do j=2,n-1 1851 do i=2,n-1 1852 a(i,j)=0.d0 1853 enddo 1854 do k=2,n-1 1855 do i=2,n-1 1856 a(i,j)=a(i,j)+b(i,k)*c(k,j) 1857 enddo 1858 enddo 1859 enddo 1929 do 1,i=2,n-1 1930 sum=0.0d0 1931 do 2,j=2,n-1 1932 sum=sum+ b(i,j) * d(j,j)/c(j,j) 1933 2 continue 1934 a(i,i) = sum + e(i,i) 1935 1 continue 1860 1936 do k=1,n 1861 1937 a(n,k) = 0.0d0 … … 1864 1940 a(k,n) = 0.0d0 1865 1941 end do 1866 1867 return 1868 end 1869 1870 c *********************************************************************** 1871 subroutine resmm(a,b,c,n) 1872 c *********************************************************************** 1873 real*8 a(n,n), b(n,n), c(n,n) 1874 integer n,i,j,k 1875 1876 do i=2,n-1 1877 do j=2,n-1 1878 a(i,j)= b(i,j) - c(i,j) 1879 end do 1880 end do 1881 do k=1,n 1882 a(n,k) = 0.0d0 1883 a(1,k) = 0.0d0 1884 a(k,1) = 0.0d0 1885 a(k,n) = 0.0d0 1886 end do 1887 1888 return 1889 end 1942 return 1943 end 1944 1945 1946 c *********************************************************************** 1947 subroutine trucommvv(v,b,c,u,w,n) 1948 c inputs: matrices b,c , vectores u,w 1949 c output: vector v 1950 c Operacion a realizar: v = b * c^(-1) * u + w 1951 c La matriz c va a ser invertida 1952 c c es diagonal, b no 1953 c Aprovechamos esa condicion para invertir c, y acelerar el calculo 1954 c *********************************************************************** 1955 implicit none 1956 real*8 v(n),b(n,n),c(n,n),u(n),w(n), sum 1957 integer n,i,j 1958 do 1,i=2,n-1 1959 sum=0.0d0 1960 do 2,j=2,n-1 1961 sum=sum+ b(i,j) * u(j)/c(j,j) 1962 2 continue 1963 v(i) = sum + w(i) 1964 1 continue 1965 v(1) = 0.d0 1966 v(n) = 0.d0 1967 return 1968 end 1969 1970 1971 c *********************************************************************** 1972 subroutine sypvmv(v,u,c,w,n) 1973 c inputs: matriz diagonal c , vectores u,w 1974 c output: vector v 1975 c Operacion a realizar: v = u + c * w 1976 c *********************************************************************** 1977 implicit none 1978 real*8 v(n),u(n),c(n,n),w(n) 1979 integer n,i 1980 do 1,i=2,n-1 1981 v(i)= u(i) + c(i,i) * w(i) 1982 1 continue 1983 v(1) = 0.0d0 1984 v(n) = 0.0d0 1985 return 1986 end 1987 1890 1988 1891 1989 c *********************************************************************** … … 1899 1997 1900 1998 do 1,i=2,n-1 1901 a(i)= (b(i)) + (c(i))1999 a(i)= b(i) + c(i) 1902 2000 1 continue 1903 2001 a(1) = 0.0d0 … … 1906 2004 end 1907 2005 1908 c *********************************************************************** 1909 subroutine zerom(a,n) 2006 2007 c *********************************************************************** 2008 subroutine sypvvv(a,b,c,d,n) 2009 c a(i)=b(i)+c(i)*d(i) 2010 c *********************************************************************** 2011 implicit none 2012 real*8 a(n),b(n),c(n),d(n) 2013 integer n,i 2014 do 1,i=2,n-1 2015 a(i)= b(i) + c(i) * d(i) 2016 1 continue 2017 a(1) = 0.0d0 2018 a(n) = 0.0d0 2019 return 2020 end 2021 2022 2023 c *********************************************************************** 2024 ! subroutine zerom(a,n) 1910 2025 c a(i,j)= 0.0 1911 2026 c *********************************************************************** 1912 1913 implicit none 1914 1915 integer n,i,j 1916 real*8 a(n,n) 1917 1918 do 1,i=1,n 1919 do 2,j=1,n 1920 a(i,j) = 0.0d0 1921 2 continue 1922 1 continue 1923 return 1924 end 2027 ! implicit none 2028 ! integer n,i,j 2029 ! real*8 a(n,n) 2030 2031 ! do 1,i=1,n 2032 ! do 2,j=1,n 2033 ! a(i,j) = 0.0d0 2034 ! 2 continue 2035 ! 1 continue 2036 ! return 2037 ! end 2038 1925 2039 1926 2040 c *********************************************************************** … … 1928 2042 c a(i,j) = b(i,j) = c(i,j) = d(i,j) = 0.0 1929 2043 c *********************************************************************** 2044 implicit none 1930 2045 real*8 a(n,n), b(n,n), c(n,n), d(n,n) 1931 integer n,i,j 1932 do 1,i=1,n 1933 do 2,j=1,n 1934 a(i,j) = 0.0d0 1935 b(i,j) = 0.0d0 1936 c(i,j) = 0.0d0 1937 d(i,j) = 0.0d0 1938 2 continue 1939 1 continue 1940 return 1941 end 2046 integer n 2047 a(1:n,1:n)=0.d0 2048 b(1:n,1:n)=0.d0 2049 c(1:n,1:n)=0.d0 2050 d(1:n,1:n)=0.d0 2051 ! do 1,i=1,n 2052 ! do 2,j=1,n 2053 ! a(i,j) = 0.0d0 2054 ! b(i,j) = 0.0d0 2055 ! c(i,j) = 0.0d0 2056 ! d(i,j) = 0.0d0 2057 ! 2 continue 2058 ! 1 continue 2059 return 2060 end 2061 1942 2062 1943 2063 c *********************************************************************** … … 1945 2065 c a(i,j) = b(i,j) = c(i,j) = 0.0 1946 2066 c ********************************************************************** 2067 implicit none 1947 2068 real*8 a(n,n), b(n,n), c(n,n) 1948 integer n,i,j 1949 do 1,i=1,n 1950 do 2,j=1,n 1951 a(i,j) = 0.0d0 1952 b(i,j) = 0.0d0 1953 c(i,j) = 0.0d0 1954 2 continue 1955 1 continue 1956 return 1957 end 2069 integer n 2070 a(1:n,1:n)=0.d0 2071 b(1:n,1:n)=0.d0 2072 c(1:n,1:n)=0.d0 2073 ! do 1,i=1,n 2074 ! do 2,j=1,n 2075 ! a(i,j) = 0.0d0 2076 ! b(i,j) = 0.0d0 2077 ! c(i,j) = 0.0d0 2078 ! 2 continue 2079 ! 1 continue 2080 return 2081 end 2082 1958 2083 1959 2084 c *********************************************************************** … … 1961 2086 c a(i,j) = b(i,j) = 0.0 1962 2087 c *********************************************************************** 2088 implicit none 1963 2089 real*8 a(n,n), b(n,n) 1964 integer n,i,j 1965 do 1,i=1,n 1966 do 2,j=1,n 1967 a(i,j) = 0.0d0 1968 b(i,j) = 0.0d0 1969 2 continue 1970 1 continue 1971 return 1972 end 1973 c *********************************************************************** 1974 subroutine zerov(a,n) 2090 integer n 2091 a(1:n,1:n)=0.d0 2092 b(1:n,1:n)=0.d0 2093 ! do 1,i=1,n 2094 ! do 2,j=1,n 2095 ! a(i,j) = 0.0d0 2096 ! b(i,j) = 0.0d0 2097 ! 2 continue 2098 ! 1 continue 2099 return 2100 end 2101 2102 2103 c *********************************************************************** 2104 ! subroutine zerov(a,n) 1975 2105 c a(i)= 0.0 1976 2106 c *********************************************************************** 1977 real*8 a(n) 1978 integer n,i 1979 do 1,i=1,n 1980 a(i) = 0.0d0 1981 1 continue 1982 return 1983 end 2107 ! implicit none 2108 ! real*8 a(n) 2109 ! integer n,i 2110 ! do 1,i=1,n 2111 ! a(i) = 0.0d0 2112 ! 1 continue 2113 ! return 2114 ! end 2115 2116 1984 2117 c *********************************************************************** 1985 2118 subroutine zero4v(a,b,c,d,n) 1986 2119 c a(i) = b(i) = c(i) = d(i,j) = 0.0 1987 2120 c *********************************************************************** 2121 implicit none 1988 2122 real*8 a(n), b(n), c(n), d(n) 1989 integer n,i 1990 do 1,i=1,n 1991 a(i) = 0.0d0 1992 b(i) = 0.0d0 1993 c(i) = 0.0d0 1994 d(i) = 0.0d0 1995 1 continue 1996 return 1997 end 2123 integer n 2124 a(1:n)=0.d0 2125 b(1:n)=0.d0 2126 c(1:n)=0.d0 2127 d(1:n)=0.d0 2128 ! do 1,i=1,n 2129 ! a(i) = 0.0d0 2130 ! b(i) = 0.0d0 2131 ! c(i) = 0.0d0 2132 ! d(i) = 0.0d0 2133 ! 1 continue 2134 return 2135 end 2136 2137 1998 2138 c *********************************************************************** 1999 2139 subroutine zero3v(a,b,c,n) 2000 2140 c a(i) = b(i) = c(i) = 0.0 2001 2141 c *********************************************************************** 2142 implicit none 2002 2143 real*8 a(n), b(n), c(n) 2003 integer n,i 2004 do 1,i=1,n 2005 a(i) = 0.0d0 2006 b(i) = 0.0d0 2007 c(i) = 0.0d0 2008 1 continue 2009 return 2010 end 2144 integer n 2145 a(1:n)=0.d0 2146 b(1:n)=0.d0 2147 c(1:n)=0.d0 2148 ! do 1,i=1,n 2149 ! a(i) = 0.0d0 2150 ! b(i) = 0.0d0 2151 ! c(i) = 0.0d0 2152 ! 1 continue 2153 return 2154 end 2155 2156 2011 2157 c *********************************************************************** 2012 2158 subroutine zero2v(a,b,n) 2013 2159 c a(i) = b(i) = 0.0 2014 2160 c *********************************************************************** 2161 implicit none 2015 2162 real*8 a(n), b(n) 2016 integer n,i 2017 do 1,i=1,n 2018 a(i) = 0.0d0 2019 b(i) = 0.0d0 2020 1 continue 2021 return 2022 end 2023 2024 2163 integer n 2164 a(1:n)=0.d0 2165 b(1:n)=0.d0 2166 ! do 1,i=1,n 2167 ! a(i) = 0.0d0 2168 ! b(i) = 0.0d0 2169 ! 1 continue 2170 return 2171 end 2172 2173 c *********************************************************************** 2174 2175 2176 c**************************************************************************** 2177 2178 c *** suaviza.f *** 2179 2180 c***************************************************************************** 2181 c 2182 subroutine suaviza ( x, n, ismooth, y ) 2183 c 2184 c x - input and return values 2185 c y - auxiliary vector 2186 c ismooth = 0 --> no smoothing is performed 2187 c ismooth = 1 --> weak smoothing (5 points, centred weighted) 2188 c ismooth = 2 --> normal smoothing (3 points, evenly weighted) 2189 c ismooth = 3 --> strong smoothing (5 points, evenly weighted) 2190 2191 2192 c august 1991 2193 c***************************************************************************** 2194 2195 implicit none 2196 2197 integer n, imax, imin, i, ismooth 2198 real*8 x(n), y(n) 2199 c***************************************************************************** 2200 2201 imin=1 2202 imax=n 2203 2204 if (ismooth.eq.0) then 2205 2206 return 2207 2208 elseif (ismooth.eq.1) then ! 5 points, with central weighting 2209 2210 do i=imin,imax 2211 if(i.eq.imin)then 2212 y(i)=x(imin) 2213 elseif(i.eq.imax)then 2214 y(i)=x(imax-1)+(x(imax-1)-x(imax-3))/2.d0 2215 elseif(i.gt.(imin+1) .and. i.lt.(imax-1) )then 2216 y(i) = ( x(i+2)/4.d0 + x(i+1)/2.d0 + 2.d0*x(i)/3.d0 + 2217 @ x(i-1)/2.d0 + x(i-2)/4.d0 )* 6.d0/13.d0 2218 else 2219 y(i)=(x(i+1)/2.d0+x(i)+x(i-1)/2.d0)/2.d0 2220 end if 2221 end do 2222 2223 elseif (ismooth.eq.2) then ! 3 points, evenly spaced 2224 2225 do i=imin,imax 2226 if(i.eq.imin)then 2227 y(i)=x(imin) 2228 elseif(i.eq.imax)then 2229 y(i)=x(imax-1)+(x(imax-1)-x(imax-3))/2.d0 2230 else 2231 y(i) = ( x(i+1)+x(i)+x(i-1) )/3.d0 2232 end if 2233 end do 2234 2235 elseif (ismooth.eq.3) then ! 5 points, evenly spaced 2236 2237 do i=imin,imax 2238 if(i.eq.imin)then 2239 y(i) = x(imin) 2240 elseif(i.eq.(imin+1) .or. i.eq.(imax-1))then 2241 y(i) = ( x(i+1)+x(i)+x(i-1) )/3.d0 2242 elseif(i.eq.imax)then 2243 y(i) = ( x(imax-1) + x(imax-1) + x(imax-2) ) / 3.d0 2244 else 2245 y(i) = ( x(i+2)+x(i+1)+x(i)+x(i-1)+x(i-2) )/5.d0 2246 end if 2247 end do 2248 2249 else 2250 2251 write (*,*) ' Error in suaviza.f Wrong ismooth value.' 2252 stop 2253 2254 endif 2255 2256 c rehago el cambio, para devolver x(i) 2257 do i=imin,imax 2258 x(i)=y(i) 2259 end do 2260 2261 return 2262 end 2263 2264 2265 c *********************************************************************** 2266 subroutine mulmmf90(a,b,c,n) 2267 c *********************************************************************** 2268 implicit none 2269 real*8 a(n,n), b(n,n), c(n,n) 2270 integer n 2271 2272 a=matmul(b,c) 2273 a(1,:)=0.d0 2274 a(:,1)=0.d0 2275 a(n,:)=0.d0 2276 a(:,n)=0.d0 2277 2278 return 2279 end 2280 2281 2282 c *********************************************************************** 2283 subroutine resmmf90(a,b,c,n) 2284 c *********************************************************************** 2285 implicit none 2286 real*8 a(n,n), b(n,n), c(n,n) 2287 integer n 2288 2289 a=b-c 2290 a(1,:)=0.d0 2291 a(:,1)=0.d0 2292 a(n,:)=0.d0 2293 a(:,n)=0.d0 2294 2295 return 2296 end 2297 2298 2299 c******************************************************************* 2300 2301 subroutine gethist_03 (ihist) 2302 2303 c******************************************************************* 2304 2305 implicit none 2306 2307 include 'nlte_paramdef.h' 2308 include 'nlte_commons.h' 2309 2310 2311 c arguments 2312 integer ihist 2313 2314 c local variables 2315 integer j, r, mm 2316 real*8 xx 2317 2318 c *************** 2319 2320 nbox = nbox_stored(ihist) 2321 do j=1,mm_stored(ihist) 2322 thist(j) = thist_stored(ihist,j) 2323 do r=1,nbox_stored(ihist) 2324 no(r) = no_stored(ihist,r) 2325 sk1(j,r) = sk1_stored(ihist,j,r) 2326 xls1(j,r) = xls1_stored(ihist,j,r) 2327 xld1(j,r) = xld1_stored(ihist,j,r) 2328 enddo 2329 enddo 2330 2331 2332 return 2333 end 2334 2335 2336 c ******************************************************************* 2337 2338 subroutine rhist_03 (ihist) 2339 2340 c ******************************************************************* 2341 2342 implicit none 2343 2344 include 'nlte_paramdef.h' 2345 include 'nlte_commons.h' 2346 2347 2348 c arguments 2349 integer ihist 2350 2351 c local variables 2352 integer j, r, mm 2353 real*8 xx 2354 2355 c *************** 2356 2357 open(unit=3,file=hisfile,status='old') 2358 2359 read(3,*) 2360 read(3,*) 2361 read(3,*) mm_stored(ihist) 2362 read(3,*) 2363 read(3,*) nbox_stored(ihist) 2364 read(3,*) 2365 2366 if ( nbox_stored(ihist) .gt. nbox_max ) then 2367 write (*,*) ' nbox too large in input file ', hisfile 2368 stop ' Check maximum number nbox_max in mz1d.par ' 2369 endif 2370 2371 do j=1,mm_stored(ihist) 2372 read(3,*) thist_stored(ihist,j) 2373 do r=1,nbox_stored(ihist) 2374 read(3,*) no_stored(ihist,r), 2375 & sk1_stored(ihist,j,r), 2376 & xls1_stored(ihist,j,r), 2377 & xx, 2378 & xld1_stored(ihist,j,r) 2379 enddo 2380 2381 enddo 2382 2383 close(unit=3) 2384 2385 2386 return 2387 end -
trunk/LMDZ.MARS/libf/phymars/nlte_calc.F
r695 r757 1 c*********************************************************************** 2 c mzescape.f 3 c*********************************************************************** 4 c 5 c program for calculating atmospheric escape functions, from 6 c a calculation of transmittances and derivatives of these ones 1 c********************************************************************** 2 c 3 c Includes the following 1-d model subroutines: 4 c 5 c -MZESC110_dlvr11_03.f 6 c -MZTUD110_dlvr11_03.f 7 c -MZMC121_dlvr11_03.f 8 c -MZTUD121_dlvr11_03.f 9 c -MZESC121_dlvr11_03.f 10 c -MZESC121sub_dlvr11_03.f 11 c -MZTVC121_dlvr11.f 12 c -MZTVC121sub_dlvr11_03.f 13 14 15 16 c *** Old MZESC110_dlvr11_03.f 17 18 c********************************************************************** 19 20 c*********************************************************************** 21 subroutine MZESC110 (nl_cts_real, nzy_cts_real) 22 c*********************************************************************** 23 24 implicit none 25 26 include 'datafile.h' 27 include 'nlte_paramdef.h' 28 include 'nlte_commons.h' 29 30 c arguments 31 integer nl_cts_real, nzy_cts_real ! i 32 33 c old arguments 34 integer ierr ! o 35 real*8 varerr ! o 36 37 c local variables and constants 38 integer i, in, ir, iaquiHIST , iaquiZ 39 integer ib, isot 40 real*8 argumento 41 real*8 tauinf(nl_cts) 42 real*8 con(nzy_cts), coninf 43 real*8 c1, c2 , ccc 44 real*8 t1, t2 45 real*8 p1, p2 46 real*8 mr1, mr2 47 real*8 st1, st2 48 real*8 c1box(nbox_max), c2box(nbox_max) 49 real*8 ff ! to avoid too small numbers 50 real*8 st, beta, ts 51 real*8 tyd(nzy_cts) 52 real*8 correc 53 real*8 deltanudbl, deltazdbl 54 real*8 yy 55 56 c external function 57 external we_clean 58 real*8 we_clean 59 60 c*********************************************************************** 61 62 c 63 ib = 1 64 beta = 1.8d5 65 ibcode1 = '1' 66 isot = 1 67 deltanudbl = dble(deltanu(1,1)) 68 deltazdbl = dble(deltaz_cts) 69 ff=1.0d10 70 71 ccc 72 do i=1,nzy_cts_real 73 tyd(i) = dble(ty_cts(i)) 74 con(i) = dble( co2y_cts(i) * imr(isot) ) 75 correc = 2.d0 * dexp( -ee*dble(elow(isot,2))/tyd(i) ) 76 con(i) = con(i) * ( 1.d0 - correc ) 77 mr_cts(i) = dble(co2y_cts(i)/nty_cts(i)) 78 end do 79 coninf = dble( con(nzy_cts_real) / 80 @ log( con(nzy_cts_real-1) / con(nzy_cts_real) ) ) 81 ! Correccion pequeña para la FB, nos la saltamos 82 !call mztf_correccion_cts ( coninf, con, ib ) 83 84 ccc 85 call gethist_03 ( 1 ) 86 87 c 88 c tauinf 89 c 90 call initial 91 92 iaquiHIST = nhist/2 93 iaquiZ = nzy_cts_real - 2 94 95 do i=nl_cts_real,1,-1 96 97 if(i.eq.nl_cts_real)then 98 99 call intzhunt_cts (iaquiZ, zl_cts(i), nzy_cts_real, 100 @ c2,p2,mr2,t2, con) 101 do kr=1,nbox 102 ta(kr)=t2 103 end do 104 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 105 ! Check interpolation errors : 106 if (c2.le.0.0d0) then 107 ierr=15 108 varerr=c2 109 return 110 elseif (p2.le.0.0d0) then 111 ierr=16 112 varerr=p2 113 return 114 elseif (mr2.le.0.0d0) then 115 ierr=17 116 varerr=mr2 117 return 118 elseif (t2.le.0.0d0) then 119 ierr=18 120 varerr=t2 121 return 122 elseif (st2.le.0.0d0) then 123 ierr=19 124 varerr=st2 125 return 126 endif 127 ! 128 aa = p2 * coninf * mr2 * (st2 * ff) 129 cc = coninf * st2 130 dd = t2 * coninf * st2 131 do kr=1,nbox 132 ccbox(kr) = coninf * ka(kr) 133 ddbox(kr) = t2 * ccbox(kr) 134 c2box(kr) = c2 * ka(kr) * deltazdbl 135 end do 136 c2 = c2 * st2 * deltazdbl 137 138 else 139 140 call intzhunt_cts (iaquiZ, zl_cts(i), nzy_cts_real, 141 @ c1,p1,mr1,t1, con) 142 do kr=1,nbox 143 ta(kr)=t1 144 end do 145 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 146 do kr=1,nbox 147 c1box(kr) = c1 * ka(kr) * deltazdbl 148 end do 149 c1 = c1 * st1 * deltazdbl 150 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 151 cc = cc + ( c1 + c2 ) / 2.d0 152 ccc = ( c1 + c2 ) / 2.d0 153 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 154 do kr=1,nbox 155 ccbox(kr) = ccbox(kr) + 156 @ ( c1box(kr) + c2box(kr) )/2.d0 157 ddbox(kr) = ddbox(kr) + 158 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 159 end do 160 161 mr2 = mr1 162 c2=c1 163 do kr=1,nbox 164 c2box(kr) = c1box(kr) 165 end do 166 t2=t1 167 p2=p1 168 end if 169 170 pp = aa / (cc*ff) 171 172 ts = dd/cc 173 do kr=1,nbox 174 ta(kr) = ddbox(kr) / ccbox(kr) 175 end do 176 call interstrhunt(iaquiHIST, st,ts,ka,ta) 177 call intershphunt(iaquiHIST, alsa,alda,ta) 178 179 c 180 eqw=0.0d0 181 do kr=1,nbox 182 yy = ccbox(kr) * beta 183 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 184 eqw = eqw + no(kr)*w 185 end do 186 187 argumento = eqw / deltanudbl 188 tauinf(i) = dexp( - argumento ) 189 190 if (i.eq.nl_cts_real) then 191 taustar11_cts(i) = 0.0d0 192 else 193 taustar11_cts(i) = deltanudbl * (tauinf(i+1)-tauinf(i)) 194 @ / ( beta * ccc ) 195 endif 196 197 end do 198 199 200 call mzescape_normaliz_02 ( taustar11_cts, nl_cts_real, 2 ) 201 202 c end 203 return 204 end 205 206 207 c *** Old MZTUD110_dlvr11_03.f 208 209 c*********************************************************************** 210 subroutine MZTUD110( ierr, varerr ) 211 c*********************************************************************** 212 213 implicit none 214 215 include 'datafile.h' 216 include 'nlte_paramdef.h' 217 include 'nlte_commons.h' 218 219 220 c arguments 221 integer ierr ! o 222 real*8 varerr ! o 223 224 c local variables and constants 225 integer i, in, ir, iaquiHIST , iaquiZ 226 integer ib, isot 227 real*8 tau(nl,nl), argumento 228 real*8 tauinf(nl) 229 real*8 con(nzy), coninf 230 real*8 c1, c2 231 real*8 t1, t2 232 real*8 p1, p2 233 real*8 mr1, mr2 234 real*8 st1, st2 235 real*8 c1box(nbox_max), c2box(nbox_max) 236 real*8 ff ! to avoid too small numbers 237 real*8 tvtbs(nzy) 238 real*8 st, beta, ts 239 real*8 zld(nl), zyd(nzy), deltazdbl 240 real*8 correc 241 real*8 deltanudbl 242 real*8 maxtau, yy 243 244 c external function 245 external we_clean 246 real*8 we_clean 247 248 c*********************************************************************** 249 250 c 251 ib = 1 252 beta = 1.8d5 253 ibcode1 = '1' 254 isot = 1 255 deltanudbl = dble(deltanu(1,1)) 256 deltazdbl = dble(deltaz) 257 ff=1.0d10 258 259 ccc 260 do i=1,nzy 261 zyd(i) = dble(zy(i)) 262 enddo 263 do i=1,nl 264 zld(i) = dble(zl(i)) 265 enddo 266 call interhuntdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 ) 267 do i=1,nzy 268 con(i) = dble( co2y(i) * imr(isot) ) 269 correc = 2.d0 * dexp( -ee*dble(elow(isot,2))/tvtbs(i) ) 270 con(i) = con(i) * ( 1.d0 - correc ) 271 mr(i) = dble(co2y(i)/nty(i)) 272 end do 273 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 274 call mztf_correccion ( coninf, con, ib ) 275 276 ccc 277 call gethist_03 ( 1 ) 278 279 c 280 c tauinf 281 c 282 call initial 283 284 iaquiHIST = nhist/2 285 iaquiZ = nzy - 2 286 287 do i=nl,1,-1 288 289 if(i.eq.nl)then 290 291 call intzhunt (iaquiZ, zl(i),c2,p2,mr2,t2, con) 292 do kr=1,nbox 293 ta(kr)=t2 294 end do 295 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 296 ! Check interpolation errors : 297 if (c2.le.0.0d0) then 298 ierr=15 299 varerr=c2 300 return 301 elseif (p2.le.0.0d0) then 302 ierr=16 303 varerr=p2 304 return 305 elseif (mr2.le.0.0d0) then 306 ierr=17 307 varerr=mr2 308 return 309 elseif (t2.le.0.0d0) then 310 ierr=18 311 varerr=t2 312 return 313 elseif (st2.le.0.0d0) then 314 ierr=19 315 varerr=st2 316 return 317 endif 318 ! 319 aa = p2 * coninf * mr2 * (st2 * ff) 320 cc = coninf * st2 321 dd = t2 * coninf * st2 322 do kr=1,nbox 323 ccbox(kr) = coninf * ka(kr) 324 ddbox(kr) = t2 * ccbox(kr) 325 c2box(kr) = c2 * ka(kr) * deltazdbl 326 end do 327 c2 = c2 * st2 * deltazdbl 328 329 else 330 331 call intzhunt (iaquiZ, zl(i),c1,p1,mr1,t1, con) 332 do kr=1,nbox 333 ta(kr)=t1 334 end do 335 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 336 do kr=1,nbox 337 c1box(kr) = c1 * ka(kr) * deltazdbl 338 end do 339 c1 = c1 * st1 * deltazdbl 340 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 341 cc = cc + ( c1 + c2 ) / 2.d0 342 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 343 do kr=1,nbox 344 ccbox(kr) = ccbox(kr) + 345 @ ( c1box(kr) + c2box(kr) )/2.d0 346 ddbox(kr) = ddbox(kr) + 347 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 348 end do 349 350 mr2 = mr1 351 c2=c1 352 do kr=1,nbox 353 c2box(kr) = c1box(kr) 354 end do 355 t2=t1 356 p2=p1 357 end if 358 359 pp = aa / (cc*ff) 360 361 ts = dd/cc 362 do kr=1,nbox 363 ta(kr) = ddbox(kr) / ccbox(kr) 364 end do 365 call interstrhunt(iaquiHIST, st,ts,ka,ta) 366 call intershphunt(iaquiHIST, alsa,alda,ta) 367 368 c 369 eqw=0.0d0 370 do kr=1,nbox 371 yy = ccbox(kr) * beta 372 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 373 eqw = eqw + no(kr)*w 374 end do 375 376 argumento = eqw / deltanudbl 377 tauinf(i) = dexp( - argumento ) 378 379 end do 380 381 382 c 383 c tau 384 c 385 386 iaquiZ = 2 387 do 1 in=1,nl-1 388 389 call initial 390 call intzhunt (iaquiZ, zl(in), c1,p1,mr1,t1, con) 391 do kr=1,nbox 392 ta(kr) = t1 393 end do 394 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 395 do kr=1,nbox 396 c1box(kr) = c1 * ka(kr) * deltazdbl 397 end do 398 c1 = c1 * st1 * deltazdbl 399 400 do 2 ir=in,nl-1 401 402 if (ir.eq.in) then 403 tau(in,ir) = 1.d0 404 goto 2 405 end if 406 407 call intzhunt (iaquiZ, zl(ir), c2,p2,mr2,t2, con) 408 do kr=1,nbox 409 ta(kr) = t2 410 end do 411 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 412 do kr=1,nbox 413 c2box(kr) = c2 * ka(kr) * deltazdbl 414 end do 415 c2 = c2 * st2 * deltazdbl 416 417 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 418 cc = cc + ( c1 + c2 ) / 2.d0 419 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 420 do kr=1,nbox 421 ccbox(kr) = ccbox(kr) + 422 $ ( c1box(kr) + c2box(kr) ) / 2.d0 423 ddbox(kr) = ddbox(kr) + 424 $ ( t1*c1box(kr) + t2*c2box(kr) ) / 2.d0 425 end do 426 427 mr1=mr2 428 t1=t2 429 c1=c2 430 p1=p2 431 do kr=1,nbox 432 c1box(kr) = c2box(kr) 433 end do 434 435 pp = aa / (cc * ff) 436 437 ts = dd/cc 438 do kr=1,nbox 439 ta(kr) = ddbox(kr) / ccbox(kr) 440 end do 441 call interstrhunt(iaquiHIST, st,ts,ka,ta) 442 call intershphunt(iaquiHIST, alsa,alda,ta) 443 c 444 eqw=0.0d0 445 do kr=1,nbox 446 yy = ccbox(kr) * beta 447 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 448 eqw = eqw + no(kr)*w 449 end do 450 451 argumento = eqw / deltanudbl 452 tau(in,ir) = exp( - argumento ) 453 454 455 2 continue 456 457 1 continue 458 459 460 c 461 c tau(in,ir) for n>r 462 c 463 464 in=nl 465 466 call initial 467 468 iaquiZ = nzy - 2 469 call intzhunt (iaquiZ, zl(in), c1,p1,mr1,t1, con) 470 do kr=1,nbox 471 ta(kr) = t1 472 end do 473 call interstrhunt (iaquiHIST,st1,t1,ka,ta) 474 do kr=1,nbox 475 c1box(kr) = c1 * ka(kr) * deltazdbl 476 end do 477 c1 = c1 * st1 * deltazdbl 478 479 do 4 ir=in-1,1,-1 480 481 call intzhunt (iaquiZ, zl(ir), c2,p2,mr2,t2, con) 482 do kr=1,nbox 483 ta(kr) = t2 484 end do 485 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 486 do kr=1,nbox 487 c2box(kr) = c2 * ka(kr) * deltazdbl 488 end do 489 c2 = c2 * st2 * deltazdbl 490 491 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 492 cc = cc + ( c1 + c2 ) / 2.d0 493 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 494 do kr=1,nbox 495 ccbox(kr) = ccbox(kr) + 496 $ ( c1box(kr) + c2box(kr) ) / 2.d0 497 ddbox(kr) = ddbox(kr) + 498 $ ( t1*c1box(kr) + t2*c2box(kr) ) / 2.d0 499 end do 500 501 mr1=mr2 502 c1=c2 503 t1=t2 504 p1=p2 505 do kr=1,nbox 506 c1box(kr) = c2box(kr) 507 end do 508 509 pp = aa / (cc * ff) 510 ts = dd / cc 511 do kr=1,nbox 512 ta(kr) = ddbox(kr) / ccbox(kr) 513 end do 514 call interstrhunt (iaquiHIST, st,ts,ka,ta) 515 call intershphunt (iaquiHIST, alsa,alda,ta) 516 517 c 518 519 eqw=0.0d0 520 do kr=1,nbox 521 yy = ccbox(kr) * beta 522 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 523 eqw = eqw + no(kr)*w 524 end do 525 526 argumento = eqw / deltanudbl 527 tau(in,ir) = exp( - argumento ) 528 529 530 4 continue 531 532 c 533 c 534 c 535 do in=nl-1,2,-1 536 do ir=in-1,1,-1 537 tau(in,ir) = tau(ir,in) 538 end do 539 end do 540 541 c 542 c Tracking potential numerical errors 543 c 544 maxtau = 0.0d0 545 do in=nl-1,2,-1 546 do ir=in-1,1,-1 547 maxtau = max( maxtau, tau(in,ir) ) 548 end do 549 end do 550 if (maxtau .gt. 1.0d0) then 551 ierr = 13 552 varerr = maxtau 553 return 554 endif 555 556 557 c 558 call MZCUD110 ( tauinf,tau ) 559 560 c end 561 return 562 end 563 564 565 c *** Old file MZCUD_dlvr11.f *** 566 567 c*********************************************************************** 568 569 subroutine MZCUD110 ( tauinf,tau ) 570 571 c*********************************************************************** 572 573 implicit none 574 575 include 'nlte_paramdef.h' 576 include 'nlte_commons.h' 577 578 c arguments 579 real*8 tau(nl,nl) ! i 580 real*8 tauinf(nl) ! i 581 582 583 c local variables 584 integer i, in, ir 585 real*8 a(nl,nl), cf(nl,nl), pideltanu, deltazdp, pi 586 587 c*********************************************************************** 588 589 pi = 3.141592 590 pideltanu = pi * dble(deltanu(1,1)) 591 deltazdp = 2.0d5 * dble(deltaz) 592 593 do in=1,nl 594 do ir=1,nl 595 cf(in,ir) = 0.0d0 596 c110(in,ir) = 0.0d0 597 a(in,ir) = 0.0d0 598 end do 599 vc110(in) = 0.0d0 600 end do 601 602 c 603 do in=1,nl 604 do ir=1,nl 605 606 if (ir.eq.1) then 607 cf(in,ir) = tau(in,ir) - tau(in,1) 608 elseif (ir.eq.nl) then 609 cf(in,ir) = tauinf(in) - tau(in,ir-1) 610 else 611 cf(in,ir) = tau(in,ir) - tau(in,ir-1) 612 end if 613 614 end do 615 end do 616 617 c 618 do in=2,nl-1 619 do ir=1,nl 620 if (ir.eq.in+1) a(in,ir) = -1.d0 621 if (ir.eq.in-1) a(in,ir) = +1.d0 622 a(in,ir) = a(in,ir) / deltazdp 623 end do 624 end do 625 626 c 627 do in=1,nl 628 do ir=1,nl 629 cf(in,ir) = cf(in,ir) * pideltanu 630 end do 631 end do 632 633 do in=2,nl-1 634 do ir=1,nl 635 do i=1,nl 636 c110(in,ir) = c110(in,ir) + a(in,i) * cf(i,ir) 637 end do 638 end do 639 end do 640 641 do in=2,nl-1 642 vc110(in) = pideltanu/deltazdp * 643 @ ( tau(in-1,1) - tau(in+1,1) ) 644 end do 645 646 647 c 648 do in=2,nl-1 649 c110(in,nl-2) = c110(in,nl-2) - c110(in,nl) 650 c110(in,nl-1) = c110(in,nl-1) + 2.d0*c110(in,nl) 651 end do 652 653 c end 654 return 655 end 656 657 658 c *** Old MZMC121_dlvr11_03.f *** 659 660 c*********************************************************************** 661 662 subroutine MZMC121 663 664 c*********************************************************************** 665 666 implicit none 667 668 ! common variables & constants 7 669 8 subroutine mzescape(ig,taustar,tauinf,tauii, 9 & ib,isot, iirw,iimu) 10 11 c jul 2011 malv+fgg adapted to LMD-MGCM 12 c nov 99 malv adapt mztf to compute taustar (pg.23b-ma 13 c nov 98 malv allow for overlaping in the lorentz line 14 c jan 98 malv version for mz1d. based on curtis/mztf.for 15 c 17-jul-96 mlp&crs change the calculation of mr. 16 c evitar: divide por cero. anhadiendo: ff 17 c oct-92 malv correct s(t) dependence for all histogr bands 18 c june-92 malv proper lower levels for laser bands 19 c may-92 malv new temperature dependence for laser bands 20 c @ 991 malv boxing for the averaged absorber amount and t 21 c ? malv extension up to 200 km altitude in mars 22 c 13-nov-86 mlp include the temperature weighted to match 23 c the eqw in the strong doppler limit. 24 c*********************************************************************** 25 26 implicit none 27 670 include 'nlte_paramdef.h' 671 include 'nlte_commons.h' 672 673 ! local variables 674 675 real*8 cax1(nl,nl) 676 real*8 v1(nl), cm_factor, vc_factor 677 real nuaux1, nuaux2, nuaux3 678 real*8 faux2,faux3, daux2,daux3 679 680 integer i,j,ik,ib 681 682 ************************************************************************ 683 684 c121(1:nl,1:nl)=0.d0 685 ! call zerom (c121,nl) 686 vc121(1:nl)=0.d0 687 ! call zerov (vc121,nl) 688 689 nuaux1 = nu(1,2) - nu(1,1) ! 667.75 690 nuaux2 = nu12_0200-nu(1,1) ! 618.03 691 nuaux3 = nu12_1000-nu(1,1) ! 720.81 692 faux2 = dble(nuaux2/nuaux1) 693 faux3 = dble(nuaux3/nuaux1) 694 daux2 = dble(nuaux1-nuaux2) 695 daux3 = dble(nuaux1-nuaux3) 696 697 do 11, ik=1,3 698 699 ib=ik+1 700 cax1(1:nl,1:nl)=0.d0 701 ! call zerom (cax1,nl) 702 call MZTUD121 ( cax1,v1, ib ) 703 704 do i=1,nl 705 706 if(ik.eq.1)then 707 cm_factor = faux2**2.d0 * exp( daux2*ee/dble(t(i)) ) 708 vc_factor = 1.d0/faux2 709 elseif(ik.eq.2)then 710 cm_factor = 1.d0 711 vc_factor = 1.d0 712 elseif(ik.eq.3)then 713 cm_factor = faux3**2.d0 * exp( daux3*ee/dble(t(i)) ) 714 vc_factor = 1.d0 / faux3 715 else 716 write (*,*) ' Error in 626 hot band index ik =', ik 717 stop ' ik can only be = 2,3,4. Check needed.' 718 end if 719 do j=1,nl 720 c121(i,j) = c121(i,j) + cax1(i,j) * cm_factor 721 end do 722 723 vc121(i) = vc121(i) + v1(i) * vc_factor 724 725 end do 726 727 11 continue 728 729 return 730 end 731 732 733 c *** Old MZTUD121_dlvr11_03.f *** 734 735 c*********************************************************************** 736 subroutine MZTUD121 ( cf,vc, ib ) 737 c*********************************************************************** 738 739 implicit none 740 741 include 'datafile.h' 28 742 include 'nlte_paramdef.h' 29 743 include 'nlte_commons.h' 30 744 31 32 c arguments 33 integer ig ! ADDED FOR TRACEBACK 34 real*8 taustar(nl) ! o 35 real*8 tauinf(nl) ! o 36 real*8 tauii(nl) ! o 37 integer ib ! i 38 integer isot ! i 39 integer iirw ! i 40 integer iimu ! i 41 42 43 c local variables and constants 44 integer i, in, ir, im, k,j 45 integer nmu 46 parameter (nmu = 8) 47 ! real*8 tauinf(nl) 48 real*8 con(nzy), coninf 49 real*8 c1, c2, ccc 50 real*8 t1, t2 51 real*8 p1, p2 52 real*8 mr1, mr2 53 real*8 st1, st2 54 real*8 c1box(70), c2box(70) 745 746 c arguments 747 real*8 cf(nl,nl) ! o. 748 real*8 vc(nl) ! o 749 integer ib ! i 750 751 752 c local variables and constants 753 integer i, in, ir, iaquiHIST, iaquiZ 754 integer nmu 755 parameter (nmu = 8) 756 real*8 tau(nl,nl), argumento, deltazdbl 757 real*8 tauinf(nl) 758 real*8 con(nzy), coninf 759 real*8 c1, c2 760 real*8 t1, t2 761 real*8 p1, p2 762 real*8 mr1, mr2 763 real*8 st1, st2 764 real*8 c1box(70), c2box(70) 55 765 real*8 ff ! to avoid too small numbers 56 real*8 tvtbs(nzy) 57 real*8 st, beta, ts, eqwmu 58 real*8 mu(nmu), amu(nmu) 59 real*8 zld(nl), zyd(nzy) 60 real*8 correc 61 real deltanux ! width of vib-rot band (cm-1) 62 character isotcode*2 63 real*8 maximum 64 real*8 csL, psL, Desp, wsL ! for Strong Lorentz limit 65 66 c formats 67 111 format(a1) 68 112 format(a2) 69 101 format(i1) 70 202 format(i2) 71 180 format(a80) 72 181 format(a80) 73 c*********************************************************************** 74 75 c some needed values 76 ! rl=sqrt(log(2.d0)) 77 ! pi2 = 3.14159265358989d0 78 beta = 1.8d0 79 ! imrco = 0.9865 80 81 c esto es para que las subroutines de mztfsub calculen we 82 c de la forma apropiada para mztf, no para fot 83 icls=icls_mztf 84 85 c codigos para filenames 86 ! if (isot .eq. 1) isotcode = '26' 87 ! if (isot .eq. 2) isotcode = '28' 88 ! if (isot .eq. 3) isotcode = '36' 89 ! if (isot .eq. 4) isotcode = '27' 90 ! if (isot .eq. 5) isotcode = '62' 91 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 92 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 93 !! encode(2,101,ibcode1)ib 94 ! write ( ibcode1, 101) ib 95 ! else 96 !! encode(2,202,ibcode2)ib 97 ! write (ibcode2, 202) ib 98 ! endif 99 ! write (*,'( 30h calculating curtis matrix : ,2x, 100 ! @ 8h band = ,i2,2x, 11h isotope = ,i2)') ib, isot 101 102 c integration in angle !!!!!!!!!!!!!!!!!!!! 103 104 c------- diffusivity approx. 105 if (iimu.eq.1) then 106 ! write (*,*) ' diffusivity approx. beta = ',beta 107 mu(1) = 1.0d0 108 amu(1)= 1.0d0 109 c-------data for 8 points integration 110 elseif (iimu.eq.4) then 111 write (*,*)' 4 points for the gauss-legendre angle quadrature.' 112 mu(1)=(1.0d0+0.339981043584856)/2.0d0 113 mu(2)=(1.0d0-0.339981043584856)/2.0d0 114 mu(3)=(1.0d0+0.861136311594053)/2.0d0 115 mu(4)=(1.0d0-0.861136311594053)/2.0d0 116 amu(1)=0.652145154862546 117 amu(2)=amu(1) 118 amu(3)=0.347854845137454 119 amu(4)=amu(3) 120 beta=1.0d0 121 c-------data for 8 points integration 122 elseif(iimu.eq.8) then 123 write (*,*)' 8 points for the gauss-legendre angle quadrature.' 124 mu(1)=(1.0d0+0.183434642495650)/2.0d0 125 mu(2)=(1.0d0-0.183434642495650)/2.0d0 126 mu(3)=(1.0d0+0.525532409916329)/2.0d0 127 mu(4)=(1.0d0-0.525532409916329)/2.0d0 128 mu(5)=(1.0d0+0.796666477413627)/2.0d0 129 mu(6)=(1.0d0-0.796666477413627)/2.0d0 130 mu(7)=(1.0d0+0.960289856497536)/2.0d0 131 mu(8)=(1.0d0-0.960289856497536)/2.0d0 132 amu(1)=0.362683783378362 133 amu(2)=amu(1) 134 amu(3)=0.313706645877887 135 amu(4)=amu(3) 136 amu(5)=0.222381034453374 137 amu(6)=amu(5) 138 amu(7)=0.101228536290376 139 amu(8)=amu(7) 140 beta=1.0d0 141 end if 142 c!!!!!!!!!!!!!!!!!!!!!!! 143 144 ccc 145 ccc determine abundances included in the absorber amount 146 ccc 147 148 c first, set up the grid ready for interpolation. 149 do i=1,nzy 150 zyd(i) = dble(zy(i)) 151 enddo 152 do i=1,nl 153 zld(i) = dble(zl(i)) 154 enddo 155 156 c vibr. temp of the bending mode : 157 if (isot.eq.1) call interdp (tvtbs,zyd,nzy,v626t1,zld,nl,1) 158 if (isot.eq.2) call interdp (tvtbs,zyd,nzy,v628t1,zld,nl,1) 159 if (isot.eq.3) call interdp (tvtbs,zyd,nzy,v636t1,zld,nl,1) 160 if (isot.eq.4) call interdp (tvtbs,zyd,nzy,v627t1,zld,nl,1) 161 162 c 2nd: correccion a la n10(i) (cantidad de absorbente en el lower state) 163 c por similitud a la que se hace en cza.for 164 165 do i=1,nzy 166 if (isot.eq.5) then 167 con(i) = dble( coy(i) * imrco ) 168 else 169 con(i) = dble( co2y(i) * imr(isot) ) 170 correc = 2.d0 * dexp( dble(-ee*elow(isot,2))/tvtbs(i) ) 171 con(i) = con(i) * ( 1.d0 - correc ) 172 endif 173 c----------------------------------------------------------------------- 174 c mlp & cristina. 17 july 1996 175 c change the calculation of mr. it is used for calculating partial press 176 c alpha = alpha(self,co2)*pp +alpha(n2)*(pt-pp) 177 c for an isotope, if mr is obtained by co2*imr(iso)/nt we are considerin 178 c collisions with other co2 isotopes (including the major one, 626) 179 c as if they were with n2. assuming mr as co2/nt, we consider collisions 180 c of type 628-626 as of 626-626 instead of as 626-n2. 181 c mrx(i)=con(i)/ntx(i) ! old malv 182 183 ! mrx(i)= dble(co2x(i)/ntx(i)) ! mlp & crs 184 185 c jan 98: 186 c esta modif de mlp implica anular el correc (deberia revisar esto) 187 mr(i) = dble(co2y(i)/nty(i)) ! malv, jan 98 188 189 c----------------------------------------------------------------------- 190 191 end do 192 193 ! como beta y 1.d5 son comunes a todas las weighted absorber amounts, 194 ! los simplificamos: 195 ! coninf = beta * 1.d5 * dble( con(n) / log( con(n-1) / con(n) ) ) 196 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 197 198 ! write (*,*) ' coninf =', coninf 199 200 ccc 201 ccc temp dependence of the band strength and 202 ccc nlte correction factor for the absorber amount 203 ccc 204 call mztf_correccion ( coninf, con, ib, isot, 0 ) 205 206 ccc 207 ccc reads histogrammed spectral data (strength for lte and vmr=1) 208 ccc 209 !hfile1 = dirspec//'hi'//dn ! Ya no distinguimos entre d/n 210 !! hfile1 = dirspec//'hid' ! (see why in his.for) 211 ! hfile1='hid' 212 !! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = dirspec//'his' 213 ! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = 'his' 214 215 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 216 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 217 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode1//'.dat' 218 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode1//'.dat' 219 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode1//'.dat' 220 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode1//'.dat' 221 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode1//'.dat' 222 ! else 223 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode2//'.dat' 224 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode2//'.dat' 225 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode2//'.dat' 226 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode2//'.dat' 227 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode2//'.dat' 228 ! endif 229 !write (*,*) ' /MZESCAPE/ hisfile: ', hisfile 230 231 ! the argument to rhist is to make this compatible with mztf_comp.f, 232 ! which is a useful modification of mztf.f (to change strengths of bands 233 ! call rhist (1.0) 234 if(ib.eq.1) then 235 if(isot.eq.1) then !Case 1 236 mm=mm_c1 237 nbox=nbox_c1 238 tmin=tmin_c1 239 tmax=tmax_c1 240 do i=1,nbox_max 241 no(i)=no_c1(i) 242 dist(i)=dist_c1(i) 243 do j=1,nhist 244 sk1(j,i)=sk1_c1(j,i) 245 xls1(j,i)=xls1_c1(j,i) 246 xln1(j,i)=xln1_c1(j,i) 247 xld1(j,i)=xld1_c1(j,i) 248 enddo 249 enddo 250 do j=1,nhist 251 thist(j)=thist_c1(j) 252 enddo 253 else if(isot.eq.2) then !Case 2 254 mm=mm_c2 255 nbox=nbox_c2 256 tmin=tmin_c2 257 tmax=tmax_c2 258 do i=1,nbox_max 259 no(i)=no_c2(i) 260 dist(i)=dist_c2(i) 261 do j=1,nhist 262 sk1(j,i)=sk1_c2(j,i) 263 xls1(j,i)=xls1_c2(j,i) 264 xln1(j,i)=xln1_c2(j,i) 265 xld1(j,i)=xld1_c2(j,i) 266 enddo 267 enddo 268 do j=1,nhist 269 thist(j)=thist_c2(j) 270 enddo 271 else if(isot.eq.3) then !Case 3 272 mm=mm_c3 273 nbox=nbox_c3 274 tmin=tmin_c3 275 tmax=tmax_c3 276 do i=1,nbox_max 277 no(i)=no_c3(i) 278 dist(i)=dist_c3(i) 279 do j=1,nhist 280 sk1(j,i)=sk1_c3(j,i) 281 xls1(j,i)=xls1_c3(j,i) 282 xln1(j,i)=xln1_c3(j,i) 283 xld1(j,i)=xld1_c3(j,i) 284 enddo 285 enddo 286 do j=1,nhist 287 thist(j)=thist_c3(j) 288 enddo 289 else if(isot.eq.4) then !Case 4 290 mm=mm_c4 291 nbox=nbox_c4 292 tmin=tmin_c4 293 tmax=tmax_c4 294 do i=1,nbox_max 295 no(i)=no_c4(i) 296 dist(i)=dist_c4(i) 297 do j=1,nhist 298 sk1(j,i)=sk1_c4(j,i) 299 xls1(j,i)=xls1_c4(j,i) 300 xln1(j,i)=xln1_c4(j,i) 301 xld1(j,i)=xld1_c4(j,i) 302 enddo 303 enddo 304 do j=1,nhist 305 thist(j)=thist_c4(j) 306 enddo 307 else 308 write(*,*)'isot must be 2,3 or 4 for ib=1!!' 309 write(*,*)'stop at mzescape/312' 310 stop 311 endif 312 else if (ib.eq.2) then 313 if(isot.eq.1) then !Case 5 314 mm=mm_c5 315 nbox=nbox_c5 316 tmin=tmin_c5 317 tmax=tmax_c5 318 do i=1,nbox_max 319 no(i)=no_c5(i) 320 dist(i)=dist_c5(i) 321 do j=1,nhist 322 sk1(j,i)=sk1_c5(j,i) 323 xls1(j,i)=xls1_c5(j,i) 324 xln1(j,i)=xln1_c5(j,i) 325 xld1(j,i)=xld1_c5(j,i) 326 enddo 327 enddo 328 do j=1,nhist 329 thist(j)=thist_c5(j) 330 enddo 331 else 332 write(*,*)'isot must be 1 for ib=2!!' 333 write(*,*)'stop at mzescape/336' 334 stop 335 endif 336 else if (ib.eq.3) then 337 if(isot.eq.1) then !Case 6 338 mm=mm_c6 339 nbox=nbox_c6 340 tmin=tmin_c6 341 tmax=tmax_c6 342 do i=1,nbox_max 343 no(i)=no_c6(i) 344 dist(i)=dist_c6(i) 345 do j=1,nhist 346 sk1(j,i)=sk1_c6(j,i) 347 xls1(j,i)=xls1_c6(j,i) 348 xln1(j,i)=xln1_c6(j,i) 349 xld1(j,i)=xld1_c6(j,i) 350 enddo 351 enddo 352 do j=1,nhist 353 thist(j)=thist_c6(j) 354 enddo 355 else 356 write(*,*)'isot must be 1 for ib=3!!' 357 write(*,*)'stop at mzescape/360' 358 stop 359 endif 360 else if (ib.eq.4) then 361 if(isot.eq.1) then !Case 7 362 mm=mm_c7 363 nbox=nbox_c7 364 tmin=tmin_c7 365 tmax=tmax_c7 366 do i=1,nbox_max 367 no(i)=no_c7(i) 368 dist(i)=dist_c7(i) 369 do j=1,nhist 370 sk1(j,i)=sk1_c7(j,i) 371 xls1(j,i)=xls1_c7(j,i) 372 xln1(j,i)=xln1_c7(j,i) 373 xld1(j,i)=xld1_c7(j,i) 374 enddo 375 enddo 376 do j=1,nhist 377 thist(j)=thist_c7(j) 378 enddo 379 else 380 write(*,*)'isot must be 1 for ib=4!!' 381 write(*,*)'stop at mzescape/384' 382 stop 383 endif 384 else 385 write(*,*)'ib must be 1,2,3 or 4!!' 386 write(*,*)'stop at mzescape/389' 387 endif 388 if (isot.ne.5) deltanux = deltanu(isot,ib) 389 if (isot.eq.5) deltanux = deltanuco 390 391 c****** 392 c****** calculation of tauinf(nl) 393 c****** 394 call initial 395 396 ff=1.0e10 397 398 do i=nl,1,-1 399 400 if(i.eq.nl)then 401 402 call intz (zl(i),c2,p2,mr2,t2, con) 403 do kr=1,nbox 404 ta(kr)=t2 405 end do 406 ! write (*,*) ' i, t2 =', i, t2 407 call interstrength (st2,t2,ka,ta) 408 aa = p2 * coninf * mr2 * (st2 * ff) 409 bb = p2 * coninf * st2 410 cc = coninf * st2 411 dd = t2 * coninf * st2 412 do kr=1,nbox 413 ccbox(kr) = coninf * ka(kr) 414 ddbox(kr) = t2 * ccbox(kr) 415 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 416 c2box(kr) = c2 * ka(kr) * dble(deltaz) 417 end do 418 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.d5 419 c2 = c2 * st2 * dble(deltaz) 420 421 else 422 call intz (zl(i),c1,p1,mr1,t1, con) 423 do kr=1,nbox 424 ta(kr)=t1 425 end do 426 ! write (*,*) ' i, t1 =', i, t1 427 call interstrength (st1,t1,ka,ta) 428 do kr=1,nbox 429 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 430 c1box(kr) = c1 * ka(kr) * dble(deltaz) 431 end do 432 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 433 c1 = c1 * st1 * dble(deltaz) 434 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 435 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 436 cc = cc + ( c1 + c2 ) / 2.d0 437 ccc = ( c1 + c2 ) / 2.d0 438 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 439 do kr=1,nbox 440 ccbox(kr) = ccbox(kr) + 441 @ ( c1box(kr) + c2box(kr) )/2.d0 442 ddbox(kr) = ddbox(kr) + 443 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 444 end do 445 446 mr2 = mr1 447 c2=c1 448 do kr=1,nbox 449 c2box(kr) = c1box(kr) 450 end do 451 t2=t1 452 p2=p1 453 end if 454 455 pt = bb / cc 456 pp = aa / (cc*ff) 457 458 ! ta=dd/cc 459 ! tdop = ta 460 ts = dd/cc 461 do kr=1,nbox 462 ta(kr) = ddbox(kr) / ccbox(kr) 463 end do 464 ! write (*,*) ' i, ts =', i, ts 465 call interstrength(st,ts,ka,ta) 466 ! call intershape(alsa,alna,alda,tdop) 467 call intershape(alsa,alna,alda,ta) 468 469 * ua = cc/st 470 471 c next loop calculates the eqw for an especified path ua,pp,pt,ta 472 473 eqwmu = 0.0d0 474 do im = 1,iimu 475 eqw=0.0d0 476 do kr=1,nbox 477 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 478 if(ua(kr).lt.0.)write(*,*)'mzescape/480',ua(kr), 479 $ ccbox(kr),ka(kr),beta,mu(im),kr,im,i,nl 480 481 call findw (ig,iirw, 0, csL,psL, Desp, wsL) 482 if ( i_supersat .eq. 0 ) then 483 eqw=eqw+no(kr)*w 484 else 485 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 486 endif 487 end do 488 eqwmu = eqwmu + eqw * mu(im)*amu(im) 489 end do 490 491 ! tauinf(i) = exp( - eqwmu / dble(deltanux) ) 492 tauinf(i) = 1.d0 - eqwmu / dble(deltanux) 493 if (tauinf(i).lt.0.d0) tauinf(i) = 0.0d0 494 495 if (i.eq.nl) then 496 taustar(i) = 0.0d0 497 else 498 taustar(i) = dble(deltanux) * (tauinf(i+1)-tauinf(i)) 499 ! ~ / ( beta * cc * 1.d5 ) 500 ~ / ( beta * ccc * 1.d5 ) 501 endif 502 503 end do ! i continue 504 505 506 c****** 507 c****** calculation of tau(in,ir) for n<=r 508 c****** 509 510 do 1 in=1,nl-1 511 512 call initial 513 514 call intz (zl(in), c1,p1,mr1,t1, con) 515 do kr=1,nbox 516 ta(kr) = t1 517 end do 518 call interstrength (st1,t1,ka,ta) 519 do kr=1,nbox 520 c1box(kr) = c1 * ka(kr) * dble(deltaz) 521 end do 522 c1 = c1 * st1 * dble(deltaz) 523 524 call intz (zl(in+1), c2,p2,mr2,t2, con) 525 do kr=1,nbox 526 ta(kr) = t2 527 end do 528 call interstrength (st2,t2,ka,ta) 529 do kr=1,nbox 530 c2box(kr) = c2 * ka(kr) * dble(deltaz) 531 end do 532 c2 = c2 * st2 * dble(deltaz) 533 534 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 535 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 536 cc = cc + ( c1 + c2 ) / 2.d0 537 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 538 do kr=1,nbox 539 ccbox(kr) = ccbox(kr) + (c1box(kr)+c2box(kr))/2.d0 540 ddbox(kr) = ddbox(kr) + (t1*c1box(kr)+t2*c2box(kr))/2.d0 541 end do 542 543 mr1=mr2 544 t1=t2 545 c1=c2 546 p1=p2 547 do kr=1,nbox 548 c1box(kr) = c2box(kr) 549 end do 550 pt = bb / cc 551 pp = aa / (cc * ff) 552 ts = dd/cc 553 do kr=1,nbox 554 ta(kr) = ddbox(kr) / ccbox(kr) 555 end do 556 call interstrength(st,ts,ka,ta) 557 call intershape(alsa,alna,alda,ta) 558 559 eqwmu = 0.0d0 560 do im = 1,iimu 561 eqw=0.0d0 562 do kr=1,nbox 563 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 564 if(ua(kr).lt.0.)write(*,*)'mzescape/566',ua(kr), 565 $ ccbox(kr),ka(kr),beta,mu(im),kr,im,i,nl 566 567 call findw (ig,iirw, 0, csL,psL, Desp, wsL) 568 if ( i_supersat .eq. 0 ) then 569 eqw=eqw+no(kr)*w 570 else 571 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 572 endif 573 end do 574 eqwmu = eqwmu + eqw * mu(im)*amu(im) 575 end do 576 577 tauii(in) = exp( - eqwmu / dble(deltanux) ) 578 !write (*,*) 'i,tauii=',in,tauii(in) 579 580 1 continue 581 tauii(nl) = 1.0d0 582 583 584 c end 585 return 586 end 587 588 589 590 c*********************************************************************** 591 c mzescape_normaliz.f 592 c*********************************************************************** 593 c 594 c program for correcting some strange values and for normalizing 595 c the atmospheric escape functions computed by mzescape_15um.f 596 c possibilities according to istyle (see mzescape_15um.f). 597 c 598 599 subroutine mzescape_normaliz ( taustar, istyle ) 600 601 602 c dic 99 malv first version 603 c jul 2011 malv+fgg Adapted to LMD-MGCM 604 c*********************************************************************** 605 606 implicit none 607 include 'nlte_paramdef.h' 608 include 'nlte_commons.h' 609 610 611 c arguments 612 real*8 taustar(nl) ! o 613 integer istyle ! i 614 615 c local variables and constants 616 integer i, imaximum 617 real*8 maximum 618 619 c*********************************************************************** 620 621 ! 622 ! correcting strange values at top, eliminating local maxima, etc... 623 ! 624 taustar(nl) = taustar(nl-1) 625 626 if ( istyle .eq. 1 ) then 627 imaximum = nl 628 maximum = taustar(nl) 629 do i=1,nl-1 630 if (taustar(i).gt.maximum) taustar(i) = taustar(nl) 631 enddo 632 elseif ( istyle .eq. 2 ) then 633 imaximum = nl 634 maximum = taustar(nl) 635 do i=nl-1,1,-1 636 if (taustar(i).gt.maximum) then 637 maximum = taustar(i) 638 imaximum = i 639 endif 640 enddo 641 do i=imaximum,nl 642 if (taustar(i).lt.maximum) taustar(i) = maximum 643 enddo 644 endif 645 646 ! 647 ! normalizing 648 ! 649 do i=1,nl 650 taustar(i) = taustar(i) / maximum 651 enddo 652 653 654 c end 655 return 656 end 657 658 659 660 c*********************************************************************** 661 c mzescape_fb.f 662 c*********************************************************************** 663 subroutine mzescape_fb(ig) 664 665 c computes the escape functions of the most important 15um bands 666 c this calls mzescape ( taustar,tauinf,tauii, ib,isot, iirw,iimu 667 668 c nov 99 malv based on cm15um_fb.f 669 c jul 2011 malv+fgg adapted to LMD-MGCM 670 c*********************************************************************** 671 672 implicit none 673 674 include 'nlte_paramdef.h' 675 include 'nlte_commons.h' 676 677 c local variables 678 integer i, ib, ik, istyle 679 integer ig !ADDED FOR TRACEBACK 680 real*8 tau_factor 681 real*8 aux(nl), aux2(nl), aux3(nl) 682 683 c*********************************************************************** 684 685 call mzescape (ig,taustar21,tauinf210,tauii210,1,2 686 & ,irw_mztf,imu) 687 call mzescape (ig,taustar31,tauinf310,tauii310,1,3 688 & ,irw_mztf,imu) 689 call mzescape (ig,taustar41,tauinf410,tauii410,1,4 690 & ,irw_mztf,imu) 691 692 istyle = 2 693 call mzescape_normaliz ( taustar21, istyle ) 694 call mzescape_normaliz ( taustar31, istyle ) 695 call mzescape_normaliz ( taustar41, istyle ) 696 697 698 c end 699 return 700 end 701 702 703 704 c*********************************************************************** 705 c mzescape_fh.f 706 c*********************************************************************** 707 subroutine mzescape_fh(ig) 708 709 c jul 2011 malv+fgg 710 c*********************************************************************** 711 712 implicit none 713 714 include 'nlte_paramdef.h' 715 include 'nlte_commons.h' 716 717 c local variables 718 integer i, ib, ik, istyle 719 integer ig ! ADDED FOR TRACEBACK 720 real*8 tau_factor 721 real*8 aux(nl), aux2(nl), aux3(nl) 722 723 c*********************************************************************** 724 725 call zero4v( aux, taustar12,tauinf121,tauii121, nl) 726 do ik=1,3 727 ib=ik+1 728 call mzescape ( ig,aux,aux2,aux3, ib, 1,irw_mztf,imu ) 729 tau_factor = 1.d0 730 if (ik.eq.1) tau_factor = dble(667.75/618.03) 731 if (ik.eq.3) tau_factor = dble(667.75/720.806) 732 do i=1,nl 733 taustar12(i) = taustar12(i) + aux(i) * tau_factor 734 tauinf121(i) = tauinf121(i) + aux2(i) * tau_factor 735 tauii121(i) = tauii121(i) + aux3(i) * tau_factor 736 enddo 737 enddo 738 739 istyle = 2 740 call mzescape_normaliz ( taustar12, istyle ) 741 742 743 744 c end 745 return 746 end 747 748 749 750 751 752 c*********************************************************************** 753 c mztud.f 754 c*********************************************************************** 755 756 subroutine mztud ( ig,cf,cfup,cfdw,vc,taugr, ib,isot, 757 @ iirw,iimu,itauout,icfout,itableout ) 758 759 c program for calculating atmospheric transmittances 760 c to be used in the calculation of curtis matrix coefficients 761 c i*out = 1 output of data 762 c i*out = 0 no output 763 c itableout = 30 output de toda la C.M. y el VC y las poblaciones de los 764 c estados 626(020), esta opcion nueva se añade porque 765 c itableout=1 saca o bien solamente de 5 en 5 capas 766 c o bien los elementos de C.M. desde una cierta capa 767 c (consultese elimin_mz1d.f que es quien lo hace); lo 768 c de las poblaciones (020) lo hace mztf_correcion.f 769 770 c jul 2011 malv+fgg Adapted to LMD-MGCM 771 c jan 07 malv Add new vertical fine grid zy, similar to zx 772 c sep-oct 01 malv update for fluxes for hb and fb, adapt to Linux 773 c nov 98 mavl allow for overlaping in the lorentz line 774 c jan 98 malv version for mz1d. based on curtis/mztf.for 775 c 17-jul-96 mlp&crs change the calculation of mr. 776 c evitar: divide por cero. anhadiendo: ff 777 c oct-92 malv correct s(t) dependence for all histogr bands 778 c june-92 malv proper lower levels for laser bands 779 c may-92 malv new temperature dependence for laser bands 780 c @ 991 malv boxing for the averaged absorber amount and t 781 c ? malv extension up to 200 km altitude in mars 782 c 13-nov-86 mlp include the temperature weighted to match 783 c the eqw in the strong doppler limit. 784 c*********************************************************************** 785 786 implicit none 787 788 include 'nlte_paramdef.h' 789 include 'nlte_commons.h' 790 791 c arguments 792 integer ig !ADDED FOR TRACEBACK 793 real*8 cf(nl,nl), cfup(nl,nl), cfdw(nl,nl) ! o 794 real*8 vc(nl), taugr(nl) ! o 795 integer ib ! i 796 integer isot ! i 797 integer iirw ! i 798 integer iimu ! i 799 integer itauout ! i 800 integer icfout ! i 801 integer itableout ! i 802 803 c local variables and constants 804 integer i, in, ir, im, k,j 805 integer nmu 806 parameter (nmu = 8) 807 real*8 tau(nl,nl) 808 real*8 tauinf(nl) 809 real*8 con(nzy), coninf 810 real*8 c1, c2 811 real*8 t1, t2 812 real*8 p1, p2 813 real*8 mr1, mr2 814 real*8 st1, st2 815 real*8 c1box(70), c2box(70) 816 real*8 ff ! to avoid too small numbers 817 real*8 tvtbs(nzy) 818 real*8 st, beta, ts, eqwmu 819 real*8 mu(nmu), amu(nmu) 766 real*8 tvtbs(nzy) 767 real*8 st, beta, ts 768 820 769 real*8 zld(nl), zyd(nzy) 821 real*8 correc 822 real deltanux ! width of vib-rot band (cm-1) 823 character isotcode*2 824 integer idummy 825 real*8 Desp,wsL 826 827 c formats 828 111 format(a1) 829 112 format(a2) 830 101 format(i1) 831 202 format(i2) 832 180 format(a80) 833 181 format(a80) 834 c*********************************************************************** 835 836 c some needed values 837 ! rl=sqrt(log(2.d0)) 838 ! pi2 = 3.14159265358989d0 839 beta = 1.8d0 840 ! beta = 1.0d0 841 idummy = 0 842 Desp = 0.0d0 843 wsL = 0.0d0 844 845 ! write (*,*) ' MZTUD/ iirw = ', iirw 846 847 848 c esto es para que las subroutines de mztfsub calculen we 849 c de la forma apropiada para mztf, no para fot 850 icls=icls_mztf 851 852 c codigos para filenames 853 ! if (isot .eq. 1) isotcode = '26' 854 ! if (isot .eq. 2) isotcode = '28' 855 ! if (isot .eq. 3) isotcode = '36' 856 ! if (isot .eq. 4) isotcode = '27' 857 ! if (isot .eq. 5) isotcode = '62' 858 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 859 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 860 ! write (ibcode1,101) ib 861 ! else 862 ! write (ibcode2,202) ib 863 ! endif 864 ! write (*,'( 30h calculating curtis matrix : ,2x, 865 ! @ 8h band = ,i2,2x, 11h isotope = ,i2)') ib, isot 866 867 c integration in angle !!!!!!!!!!!!!!!!!!!! 868 c------- diffusivity approx. 869 if (iimu.eq.1) then 870 ! write (*,*) ' diffusivity approx. beta = ',beta 871 mu(1) = 1.0d0 872 amu(1)= 1.0d0 873 c-------data for 8 points integration 874 elseif (iimu.eq.4) then 875 write (*,*)' 4 points for the gauss-legendre angle quadrature.' 876 mu(1)=(1.0d0+0.339981043584856)/2.0d0 877 mu(2)=(1.0d0-0.339981043584856)/2.0d0 878 mu(3)=(1.0d0+0.861136311594053)/2.0d0 879 mu(4)=(1.0d0-0.861136311594053)/2.0d0 880 amu(1)=0.652145154862546 881 amu(2)=amu(1) 882 amu(3)=0.347854845137454 883 amu(4)=amu(3) 884 beta=1.0d0 885 c-------data for 8 points integration 886 elseif(iimu.eq.8) then 887 write (*,*)' 8 points for the gauss-legendre angle quadrature.' 888 mu(1)=(1.0d0+0.183434642495650)/2.0d0 889 mu(2)=(1.0d0-0.183434642495650)/2.0d0 890 mu(3)=(1.0d0+0.525532409916329)/2.0d0 891 mu(4)=(1.0d0-0.525532409916329)/2.0d0 892 mu(5)=(1.0d0+0.796666477413627)/2.0d0 893 mu(6)=(1.0d0-0.796666477413627)/2.0d0 894 mu(7)=(1.0d0+0.960289856497536)/2.0d0 895 mu(8)=(1.0d0-0.960289856497536)/2.0d0 896 amu(1)=0.362683783378362 897 amu(2)=amu(1) 898 amu(3)=0.313706645877887 899 amu(4)=amu(3) 900 amu(5)=0.222381034453374 901 amu(6)=amu(5) 902 amu(7)=0.101228536290376 903 amu(8)=amu(7) 904 beta=1.0d0 905 end if 906 c!!!!!!!!!!!!!!!!!!!!!!! 907 908 ccc 909 ccc determine abundances included in the absorber amount 910 ccc 911 912 c first, set up the grid ready for interpolation. 913 do i=1,nzy 914 zyd(i) = dble(zy(i)) 915 enddo 916 do i=1,nl 917 zld(i) = dble(zl(i)) 918 enddo 919 c vibr. temp of the bending mode : 920 if (isot.eq.1) call interdp(tvtbs,zyd,nzy, v626t1,zld,nl,1) 921 if (isot.eq.2) call interdp(tvtbs,zyd,nzy, v628t1,zld,nl,1) 922 if (isot.eq.3) call interdp(tvtbs,zyd,nzy, v636t1,zld,nl,1) 923 if (isot.eq.4) call interdp(tvtbs,zyd,nzy, v627t1,zld,nl,1) 924 !if (isot.eq.5) call interdp ( tvtbs,zxd,nz, vcot1,zld,nl, 1 ) 925 926 c 2nd: correccion a la n10(i) (cantidad de absorbente en el lower state) 927 c por similitud a la que se hace en cza.for ; esto solo se hace para CO2 928 !write (*,*) 'imr(isot) = ', isot, imr(isot) 929 do i=1,nzy 930 if (isot.eq.5) then 931 con(i) = dble( coy(i) * imrco ) 932 else 933 con(i) = dble( co2y(i) * imr(isot) ) 934 correc = 2.d0 * dexp( dble(-ee*elow(isot,2))/tvtbs(i) ) 935 con(i) = con(i) * ( 1.d0 - correc ) 936 ! write (*,*) ' iz, correc, co2y(i), con(i) =', 937 ! @ i,correc,co2y(i),con(i) 938 endif 939 940 !----------------------------------------------------------------- 941 ! mlp & cristina. 17 july 1996 change the calculation of mr. 942 ! it is used for calculating partial press 943 ! alpha = alpha(self,co2)*pp +alpha(n2)*(pt-pp) 944 ! for an isotope, if mr is obtained by 945 ! co2*imr(iso)/nt 946 ! we are considerin collisions with other co2 isotopes 947 ! (including the major one, 626) as if they were with n2. 948 ! assuming mr as co2/nt, we consider collisions 949 ! of type 628-626 as of 626-626 instead of as 626-n2. 950 ! mrx(i)=con(i)/ntx(i) ! old malv 951 ! mrx(i)= dble(co2x(i)/ntx(i)) ! mlp & crs 952 953 ! jan 98: 954 ! esta modif de mlp implica anular el correc (deberia revisar esto) 955 956 mr(i) = dble(co2y(i)/nty(i)) ! malv, jan 98 957 958 !----------------------------------------------------------------- 959 960 end do 961 962 ! como beta y 1.d5 son comunes a todas las weighted absorber amounts, 963 ! los simplificamos: 964 ! coninf = beta * 1.d5 * dble( con(n) / log( con(n-1) / con(n) ) ) 965 !write (*,*) ' con(nz), con(nz-1) =', con(nz), con(nz-1) 966 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 967 !write (*,*) ' coninf =', coninf 968 969 ccc 970 ccc temp dependence of the band strength and 971 ccc nlte correction factor for the absorber amount 972 ccc 973 call mztf_correccion ( coninf, con, ib, isot, itableout ) 974 ccc 975 ccc reads histogrammed spectral data (strength for lte and vmr=1) 976 ccc 977 !hfile1 = dirspec//'hi'//dn !Ya no hacemos distincion d/n en esto 978 ! hfile1 = dirspec//'hid' !(see why in his.for) 979 ! hfile1='hid' 980 !! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = dirspec//'his' 981 ! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = 'his' 982 983 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 984 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 985 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode1//'.dat' 986 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode1//'.dat' 987 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode1//'.dat' 988 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode1//'.dat' 989 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode1//'.dat' 990 ! else 991 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode2//'.dat' 992 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode2//'.dat' 993 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode2//'.dat' 994 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode2//'.dat' 995 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode2//'.dat' 996 ! endif 997 if(ib.eq.1) then 998 if(isot.eq.1) then !Case 1 999 mm=mm_c1 1000 nbox=nbox_c1 1001 tmin=tmin_c1 1002 tmax=tmax_c1 1003 do i=1,nbox_max 1004 no(i)=no_c1(i) 1005 dist(i)=dist_c1(i) 1006 do j=1,nhist 1007 sk1(j,i)=sk1_c1(j,i) 1008 xls1(j,i)=xls1_c1(j,i) 1009 xln1(j,i)=xln1_c1(j,i) 1010 xld1(j,i)=xld1_c1(j,i) 1011 enddo 1012 enddo 1013 do j=1,nhist 1014 thist(j)=thist_c1(j) 1015 enddo 1016 else if(isot.eq.2) then !Case 2 1017 mm=mm_c2 1018 nbox=nbox_c2 1019 tmin=tmin_c2 1020 tmax=tmax_c2 1021 do i=1,nbox_max 1022 no(i)=no_c2(i) 1023 dist(i)=dist_c2(i) 1024 do j=1,nhist 1025 sk1(j,i)=sk1_c2(j,i) 1026 xls1(j,i)=xls1_c2(j,i) 1027 xln1(j,i)=xln1_c2(j,i) 1028 xld1(j,i)=xld1_c2(j,i) 1029 enddo 1030 enddo 1031 do j=1,nhist 1032 thist(j)=thist_c2(j) 1033 enddo 1034 else if(isot.eq.3) then !Case 3 1035 mm=mm_c3 1036 nbox=nbox_c3 1037 tmin=tmin_c3 1038 tmax=tmax_c3 1039 do i=1,nbox_max 1040 no(i)=no_c3(i) 1041 dist(i)=dist_c3(i) 1042 do j=1,nhist 1043 sk1(j,i)=sk1_c3(j,i) 1044 xls1(j,i)=xls1_c3(j,i) 1045 xln1(j,i)=xln1_c3(j,i) 1046 xld1(j,i)=xld1_c3(j,i) 1047 enddo 1048 enddo 1049 do j=1,nhist 1050 thist(j)=thist_c3(j) 1051 enddo 1052 else if(isot.eq.4) then !Case 4 1053 mm=mm_c4 1054 nbox=nbox_c4 1055 tmin=tmin_c4 1056 tmax=tmax_c4 1057 do i=1,nbox_max 1058 no(i)=no_c4(i) 1059 dist(i)=dist_c4(i) 1060 do j=1,nhist 1061 sk1(j,i)=sk1_c4(j,i) 1062 xls1(j,i)=xls1_c4(j,i) 1063 xln1(j,i)=xln1_c4(j,i) 1064 xld1(j,i)=xld1_c4(j,i) 1065 enddo 1066 enddo 1067 do j=1,nhist 1068 thist(j)=thist_c4(j) 1069 enddo 1070 else 1071 write(*,*)'isot must be 2,3 or 4 for ib=1!!' 1072 write(*,*)'stop at mztud/324' 1073 stop 1074 endif 1075 else if (ib.eq.2) then 1076 if(isot.eq.1) then !Case 5 1077 mm=mm_c5 1078 nbox=nbox_c5 1079 tmin=tmin_c5 1080 tmax=tmax_c5 1081 do i=1,nbox_max 1082 no(i)=no_c5(i) 1083 dist(i)=dist_c5(i) 1084 do j=1,nhist 1085 sk1(j,i)=sk1_c5(j,i) 1086 xls1(j,i)=xls1_c5(j,i) 1087 xln1(j,i)=xln1_c5(j,i) 1088 xld1(j,i)=xld1_c5(j,i) 1089 enddo 1090 enddo 1091 do j=1,nhist 1092 thist(j)=thist_c5(j) 1093 enddo 1094 else 1095 write(*,*)'isot must be 1 for ib=2!!' 1096 write(*,*)'stop at mztud/348' 1097 stop 1098 endif 1099 else if (ib.eq.3) then 1100 if(isot.eq.1) then !Case 6 1101 mm=mm_c6 1102 nbox=nbox_c6 1103 tmin=tmin_c6 1104 tmax=tmax_c6 1105 do i=1,nbox_max 1106 no(i)=no_c6(i) 1107 dist(i)=dist_c6(i) 1108 do j=1,nhist 1109 sk1(j,i)=sk1_c6(j,i) 1110 xls1(j,i)=xls1_c6(j,i) 1111 xln1(j,i)=xln1_c6(j,i) 1112 xld1(j,i)=xld1_c6(j,i) 1113 enddo 1114 enddo 1115 do j=1,nhist 1116 thist(j)=thist_c6(j) 1117 enddo 1118 else 1119 write(*,*)'isot must be 1 for ib=3!!' 1120 write(*,*)'stop at mztud/372' 1121 stop 1122 endif 1123 else if (ib.eq.4) then 1124 if(isot.eq.1) then !Case 7 1125 mm=mm_c7 1126 nbox=nbox_c7 1127 tmin=tmin_c7 1128 tmax=tmax_c7 1129 do i=1,nbox_max 1130 no(i)=no_c7(i) 1131 dist(i)=dist_c7(i) 1132 do j=1,nhist 1133 sk1(j,i)=sk1_c7(j,i) 1134 xls1(j,i)=xls1_c7(j,i) 1135 xln1(j,i)=xln1_c7(j,i) 1136 xld1(j,i)=xld1_c7(j,i) 1137 enddo 1138 enddo 1139 do j=1,nhist 1140 thist(j)=thist_c7(j) 1141 enddo 1142 else 1143 write(*,*)'isot must be 1 for ib=4!!' 1144 write(*,*)'stop at mztud/396' 1145 stop 1146 endif 1147 else 1148 write(*,*)'ib must be 1,2,3 or 4!!' 1149 write(*,*)'stop at mztud/401' 1150 endif 1151 1152 1153 1154 1155 ! write (*,*) 'hisfile: ', hisfile 1156 ! the argument to rhist is to make this compatible with mztf_comp.f, 1157 ! which is a useful modification of mztf.f (to change strengths of bands 1158 ! call rhist (1.0) 1159 if (isot.ne.5) deltanux = deltanu(isot,ib) 1160 if (isot.eq.5) deltanux = deltanuco 1161 1162 c****** 1163 c****** calculation of tauinf(nl) 1164 c****** 1165 call initial 1166 ff=1.0e10 1167 1168 do i=nl,1,-1 1169 1170 if(i.eq.nl)then 1171 1172 call intz (zl(i),c2,p2,mr2,t2, con) 1173 do kr=1,nbox 1174 ta(kr)=t2 1175 end do 1176 ! write (*,*) ' i, t2 =', i, t2 1177 call interstrength (st2,t2,ka,ta) 1178 aa = p2 * coninf * mr2 * (st2 * ff) 1179 bb = p2 * coninf * st2 1180 cc = coninf * st2 1181 dd = t2 * coninf * st2 1182 do kr=1,nbox 1183 ccbox(kr) = coninf * ka(kr) 1184 ddbox(kr) = t2 * ccbox(kr) 1185 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 1186 c2box(kr) = c2 * ka(kr) * dble(deltaz) 1187 end do 1188 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.d5 1189 c2 = c2 * st2 * dble(deltaz) 1190 1191 else 1192 call intz (zl(i),c1,p1,mr1,t1, con) 1193 do kr=1,nbox 1194 ta(kr)=t1 1195 end do 1196 ! write (*,*) ' i, t1 =', i, t1 1197 call interstrength (st1,t1,ka,ta) 1198 do kr=1,nbox 1199 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 1200 c1box(kr) = c1 * ka(kr) * dble(deltaz) 1201 end do 1202 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 1203 c1 = c1 * st1 * dble(deltaz) 1204 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1205 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 1206 cc = cc + ( c1 + c2 ) / 2.d0 1207 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1208 do kr=1,nbox 1209 ccbox(kr) = ccbox(kr) + 1210 @ ( c1box(kr) + c2box(kr) )/2.d0 1211 ddbox(kr) = ddbox(kr) + 1212 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 1213 end do 1214 1215 mr2 = mr1 1216 c2=c1 1217 do kr=1,nbox 1218 c2box(kr) = c1box(kr) 1219 end do 1220 t2=t1 1221 p2=p1 1222 end if 1223 1224 pt = bb / cc 1225 pp = aa / (cc*ff) 1226 1227 ! ta=dd/cc 1228 ! tdop = ta 1229 ts = dd/cc 1230 do kr=1,nbox 1231 ta(kr) = ddbox(kr) / ccbox(kr) 1232 end do 1233 ! write (*,*) ' i, ts =', i, ts 1234 call interstrength(st,ts,ka,ta) 1235 ! call intershape(alsa,alna,alda,tdop) 1236 call intershape(alsa,alna,alda,ta) 1237 * ua = cc/st 1238 1239 c next loop calculates the eqw for an especified path uapp,pt,ta 1240 1241 eqwmu = 0.0d0 1242 do im = 1,iimu 1243 eqw=0.0d0 1244 do kr=1,nbox 1245 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 1246 if(ua(kr).lt.0.)write(*,*)'mztud/504',ua(kr),ccbox(kr), 1247 $ ka(kr),beta,mu(im),kr,im,i,nl 1248 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 1249 if ( i_supersat .eq. 0 ) then 1250 eqw=eqw+no(kr)*w 1251 else 1252 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 1253 endif 1254 end do 1255 eqwmu = eqwmu + eqw * mu(im)*amu(im) 1256 end do 1257 1258 tauinf(i) = exp( - eqwmu / dble(deltanux) ) 1259 1260 end do 1261 ! if ( isot.eq.1 .and. ib.eq.2 ) then 1262 ! write (*,*) ' tauinf(nl) = ', tauinf(nl) 1263 ! write (*,*) ' tauinf(1) = ', tauinf(1) 1264 ! endif 1265 1266 c****** 1267 c****** calculation of tau(in,ir) for n<=r 1268 c****** 1269 1270 do 1 in=1,nl-1 1271 call initial 1272 call intz (zl(in), c1,p1,mr1,t1, con) 1273 do kr=1,nbox 1274 ta(kr) = t1 1275 end do 1276 call interstrength (st1,t1,ka,ta) 1277 do kr=1,nbox 1278 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 1279 c1box(kr) = c1 * ka(kr) * dble(deltaz) 1280 end do 1281 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 1282 c1 = c1 * st1 * dble(deltaz) 1283 1284 do 2 ir=in,nl-1 1285 1286 if (ir.eq.in) then 1287 tau(in,ir) = 1.d0 1288 goto 2 1289 end if 1290 1291 call intz (zl(ir), c2,p2,mr2,t2, con) 1292 do kr=1,nbox 1293 ta(kr) = t2 1294 end do 1295 call interstrength (st2,t2,ka,ta) 1296 do kr=1,nbox 1297 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 1298 c2box(kr) = c2 * ka(kr) * dble(deltaz) 1299 end do 1300 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.e5 1301 c2 = c2 * st2 * dble(deltaz) 1302 1303 c aa = aa + ( p1*mr1*c1 + p2*mr2*c2 ) / 2.d0 1304 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1305 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 1306 cc = cc + ( c1 + c2 ) / 2.d0 1307 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1308 do kr=1,nbox 1309 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 1310 ddbox(kr) = ddbox(kr) + 1311 $ ( t1*c1box(kr) + t2*c2box(kr) ) /2.d0 1312 end do 1313 1314 mr1=mr2 1315 t1=t2 1316 c1=c2 1317 p1=p2 1318 do kr=1,nbox 1319 c1box(kr) = c2box(kr) 1320 end do 1321 1322 pt = bb / cc 1323 pp = aa / (cc * ff) 1324 1325 * ta=dd/cc 1326 * tdop = ta 1327 ts = dd/cc 1328 do kr=1,nbox 1329 ta(kr) = ddbox(kr) / ccbox(kr) 1330 end do 1331 call interstrength(st,ts,ka,ta) 1332 call intershape(alsa,alna,alda,ta) 1333 * ua = cc/st 1334 1335 c next loop calculates the eqw for an especified path ua,pp,pt,ta 1336 1337 eqwmu = 0.0d0 1338 do im = 1,iimu 1339 eqw=0.0d0 1340 do kr=1,nbox 1341 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 1342 1343 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 1344 if ( i_supersat .eq. 0 ) then 1345 eqw=eqw+no(kr)*w 1346 else 1347 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 1348 endif 1349 end do 1350 eqwmu = eqwmu + eqw * mu(im)*amu(im) 1351 end do 1352 1353 tau(in,ir) = exp( - eqwmu / dble(deltanux) ) 1354 1355 2 continue 1356 1357 1 continue 1358 ! if ( isot.eq.1 .and. ib.eq.2 ) then 1359 ! write (*,*) ' tau(1,*) , *=1,20 ' 1360 ! write (*,*) ( sngl(tau(1,k)), k=1,20 ) 1361 ! endif 1362 1363 1364 c********** 1365 c********** calculation of tau(in,ir) for n>r 1366 c********** 1367 1368 in=nl 1369 1370 call initial 1371 call intz (zl(in), c1,p1,mr1,t1, con) 1372 do kr=1,nbox 1373 ta(kr) = t1 1374 end do 1375 call interstrength (st1,t1,ka,ta) 1376 do kr=1,nbox 1377 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 1378 c1box(kr) = c1 * ka(kr) * dble(deltaz) 1379 end do 1380 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 1381 c1 = c1 * st1 * dble(deltaz) 1382 1383 do 4 ir=in-1,1,-1 1384 1385 call intz (zl(ir), c2,p2,mr2,t2, con) 1386 do kr=1,nbox 1387 ta(kr) = t2 1388 end do 1389 call interstrength (st2,t2,ka,ta) 1390 do kr=1,nbox 1391 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 1392 c2box(kr) = c2 * ka(kr) * dble(deltaz) 1393 end do 1394 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.d5 1395 c2 = c2 * st2 * dble(deltaz) 1396 1397 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1398 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 1399 cc = cc + ( c1 + c2 ) / 2.d0 1400 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1401 do kr=1,nbox 1402 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 1403 ddbox(kr) = ddbox(kr) + 1404 $ ( t1*c1box(kr) + t2*c2box(kr) ) /2.d0 1405 end do 1406 1407 mr1=mr2 1408 c1=c2 1409 t1=t2 1410 p1=p2 1411 do kr=1,nbox 1412 c1box(kr) = c2box(kr) 1413 end do 1414 1415 pt = bb / cc 1416 pp = aa / (cc * ff) 1417 ts = dd / cc 1418 do kr=1,nbox 1419 ta(kr) = ddbox(kr) / ccbox(kr) 1420 end do 1421 call interstrength (st,ts,ka,ta) 1422 call intershape (alsa,alna,alda,ta) 1423 1424 * ua = cc/st 1425 1426 c next loop calculates the eqw for an especified path ua,pp,pt,ta 1427 1428 eqwmu = 0.0d0 1429 do im = 1,iimu 1430 eqw=0.0d0 1431 do kr=1,nbox 1432 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 1433 if(ua(kr).lt.0.)write(*,*)'mztud/691',ua(kr),ccbox(kr), 1434 $ ka(kr),beta,mu(im),kr,im,i,nl 1435 1436 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 1437 if ( i_supersat .eq. 0 ) then 1438 eqw=eqw+no(kr)*w 1439 else 1440 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 1441 endif 1442 end do 1443 eqwmu = eqwmu + eqw * mu(im)*amu(im) 1444 end do 1445 1446 tau(in,ir) = exp( - eqwmu / dble(deltanux) ) 1447 1448 4 continue 1449 1450 c 1451 c due to the simmetry of the transmittances 1452 c 1453 do in=nl-1,2,-1 1454 do ir=in-1,1,-1 1455 tau(in,ir) = tau(ir,in) 1456 end do 1457 end do 1458 1459 1460 ccc 1461 ccc writing out transmittances 1462 ccc 1463 if (itauout.eq.1) then 1464 1465 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1466 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1467 ! open( 1, file= 1468 ! @ dircurtis//'taul'//isotcode//dn//ibcode1//'.dat', 1469 ! @ access='sequential', form='unformatted' ) 1470 ! else 1471 ! open( 1, file= 1472 ! @ dircurtis//'taul'//isotcode//dn//ibcode2//'.dat', 1473 ! @ access='sequential', form='unformatted' ) 1474 ! endif 1475 1476 ! write(1) dummy 1477 ! write(1)' format: (tauinf(n),(tau(n,r),r=1,nl),n=1,nl)' 1478 ! do in=1,nl 1479 ! write (1) tauinf(in), ( tau(in,ir), ir=1,nl ) 1480 ! end do 1481 ! close(unit=1) 1482 1483 elseif (itauout.eq.2) then 1484 1485 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1486 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1487 ! open( 1, file= 1488 ! @ dircurtis//'taul'//isotcode//dn//ibcode1//'.dat') 1489 ! else 1490 ! open( 1, file= 1491 ! @ dircurtis//'taul'//isotcode//dn//ibcode2//'.dat') 1492 ! endif 1493 1494 ! !write(1,*) dummy 1495 ! !write(1,*) 'tij for curtis matrix calculations ' 1496 ! !write(1,*)' cira mars model atmosphere ' 1497 ! !write(1,*)' beta= ',beta,'deltanu= ',deltanux 1498 ! write(1,*) nl 1499 ! write(1,*) 1500 ! @ ' format: (tauinf(in),(tau(in,ir),ir=1,nl),in=1,nl)' 1501 1502 ! do in=1,nl 1503 ! write (1,*) tauinf(in) 1504 ! write (1,*) (tau(in,ir), ir=1,nl) 1505 ! end do 1506 ! close(unit=1) 1507 1508 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1509 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1510 ! write (*,'(1x, 31htransmitances written out in: ,a22)') 1511 ! @ 'taul'//isotcode//dn//ibcode1 1512 ! else 1513 ! write (*,'(1x, 31htransmitances written out in: ,a22)') 1514 ! @ 'taul'//isotcode//dn//ibcode2 1515 ! endif 1516 1517 end if 1518 1519 c cleaning of transmittances 1520 ! call elimin_tau(tau,tauinf,nl,nan,itableout,nw,dummy, 1521 ! @ isotcode,dn,ibcode2) 1522 1523 c construction of the curtis matrix 1524 1525 call mzcud ( tauinf,tau, cf,cfup,cfdw, vc,taugr, 1526 @ ib,isot,icfout,itableout ) 1527 1528 c end 1529 return 1530 end 1531 1532 1533 1534 1535 1536 c*********************************************************************** 1537 c mzcud.f 1538 c*********************************************************************** 1539 1540 subroutine mzcud( tauinf,tau, c,cup,cdw,vc,taugr, 1541 @ ib,isot,icfout,itableout ) 1542 1543 c old times mlp first version of mzcf 1544 c a.k.murphy method to avoid extrapolation in the curtis matrix 1545 c feb-89 malv AKM method to avoid extrapolation in C.M. 1546 c 25-sept-96 cristina dejar las matrices en doble precision 1547 c jan 98 malv version para mz1d 1548 c oct 01 malv update version for fluxes for hb and fb 1549 c jul 2011 malv+fgg Adapted to LMD-MGCM 1550 c*********************************************************************** 1551 1552 implicit none 1553 1554 include 'comcstfi.h' 1555 include 'nlte_paramdef.h' 1556 include 'nlte_commons.h' 1557 1558 c arguments 1559 real*8 c(nl,nl), cup(nl,nl), cdw(nl,nl) ! o 1560 real*8 vc(nl), taugr(nl) ! o 1561 real*8 tau(nl,nl) ! i 1562 real*8 tauinf(nl) ! i 1563 integer ib ! i 1564 integer isot ! i 1565 integer icfout, itableout ! i 1566 1567 c external 1568 external bandid 1569 character*2 bandid 1570 1571 c local variables 1572 integer i, in, ir, iw, itblout 1573 real*8 cfup(nl,nl), cfdw(nl,nl) 1574 real*8 a(nl,nl), cf(nl,nl) 1575 character isotcode*2, bcode*2 1576 1577 c formats 1578 101 format(i1) 1579 202 format(i2) 1580 180 format(a80) 1581 181 format(a80) 1582 c*********************************************************************** 1583 1584 if (isot.eq.1) isotcode = '26' 1585 if (isot.eq.2) isotcode = '28' 1586 if (isot.eq.3) isotcode = '36' 1587 if (isot.eq.4) isotcode = '27' 1588 if (isot.eq.5) isotcode = 'co' 1589 bcode = bandid( ib ) 1590 1591 ! write (*,*) ' ' 1592 1593 do in=1,nl 1594 1595 do ir=1,nl 1596 1597 cf(in,ir) = 0.0d0 1598 cfup(in,ir) = 0.0d0 1599 cfdw(in,ir) = 0.0d0 1600 c(in,ir) = 0.0d0 1601 cup(in,ir) = 0.0d0 1602 cdw(in,ir) = 0.0d0 1603 a(in,ir) = 0.0d0 1604 1605 end do 1606 1607 vc(in) = 0.0d0 1608 taugr(in) = 0.0d0 1609 1610 end do 1611 1612 1613 c the next lines are a reduced and equivalent way of calculating 1614 c the c(in,ir) elements for n=2,nl1 and r=1,nl 1615 1616 1617 c do in=2,nl1 1618 c do ir=1,nl 1619 c if(ir.eq.1)then 1620 c c(in,ir)=tau(in-1,1)-tau(in+1,1) 1621 c elseif(ir.eq.nl)then 1622 c c(in,ir)=tau(in+1,nl1)-tauinf(in+1)-tau(in-1,nl1)+tauinf(in-1) 1623 c else 1624 c c(in,ir)=tau(in+1,ir-1)-tau(in+1,ir)-tau(in-1,ir-1)+tau(in-1,ir) 1625 c end if 1626 c c(in,ir)=c(in,ir)*pi*deltanu(ib)/(2.*deltaz*1.0e5) 1627 c end do 1628 c end do 1629 c go to 1000 1630 1631 c calculation of the matrix cfup(nl,nl) 1632 1633 cfup(1,1) = 1.d0 - tau(1,1) 1634 1635 do in=2,nl 1636 do ir=1,in 1637 1638 if (ir.eq.1) then 1639 cfup(in,ir) = tau(in,ir) - tau(in,1) 1640 elseif (ir.eq.in) then 1641 cfup(in,ir) = 1.d0 - tau(in,ir-1) 1642 else 1643 cfup(in,ir) = tau(in,ir) - tau(in,ir-1) 1644 end if 1645 1646 end do 1647 end do 1648 1649 ! contribution to upwards fluxes from bb at bottom : 1650 do in=1,nl 1651 taugr(in) = tau(in,1) 1652 enddo 1653 1654 c calculation of the matrix cfdw(nl,nl) 1655 1656 cfdw(nl,nl) = 1.d0 - tauinf(nl) 1657 1658 do in=1,nl-1 1659 do ir=in,nl 1660 1661 if (ir.eq.in) then 1662 cfdw(in,ir) = 1.d0 - tau(in,ir) 1663 elseif (ir.eq.nl) then 1664 cfdw(in,ir) = tau(in,ir-1) - tauinf(in) 1665 else 1666 cfdw(in,ir) = tau(in,ir-1) - tau(in,ir) 1667 end if 1668 1669 end do 1670 end do 1671 1672 1673 c calculation of the matrix cf(nl,nl) 1674 1675 do in=1,nl 1676 do ir=1,nl 1677 1678 if (ir.eq.1) then 1679 ! version con l_bb(tg) = l_bb(t(1))=j(1) (see also vc below) 1680 ! cf(in,ir) = tau(in,ir) 1681 ! version con l_bb(tg) =/= l_bb(t(1))=j(1) (see also vc below) 1682 cf(in,ir) = tau(in,ir) - tau(in,1) 1683 elseif (ir.eq.nl) then 1684 cf(in,ir) = tauinf(in) - tau(in,ir-1) 1685 else 1686 cf(in,ir) = tau(in,ir) - tau(in,ir-1) 1687 end if 1688 1689 end do 1690 end do 1691 1692 1693 c definition of the a(nl,nl) matrix 1694 1695 do in=2,nl-1 1696 do ir=1,nl 1697 if (ir.eq.in+1) a(in,ir) = -1.d0 1698 if (ir.eq.in-1) a(in,ir) = +1.d0 1699 a(in,ir) = a(in,ir) / ( 2.d0*deltaz*1.d5 ) 1700 end do 1701 end do 1702 ! this is not needed anymore in the akm scheme 1703 ! a(1,1) = +3.d0 1704 ! a(1,2) = -4.d0 1705 ! a(1,3) = +1.d0 1706 ! a(nl,nl) = -3.d0 1707 ! a(nl,nl1) = +4.d0 1708 ! a(nl,nl2) = -1.d0 1709 1710 c calculation of the final curtis matrix ("reduced" by murphy's method) 1711 1712 if (isot.ne.5) then 1713 do in=1,nl 1714 do ir=1,nl 1715 cf(in,ir) = cf(in,ir) * pi*deltanu(isot,ib) 1716 cfup(in,ir) = cfup(in,ir) * pi*deltanu(isot,ib) 1717 cfdw(in,ir) = cfdw(in,ir) * pi*deltanu(isot,ib) 1718 end do 1719 taugr(in) = taugr(in) * pi*deltanu(isot,ib) 1720 end do 1721 else 1722 do in=1,nl 1723 do ir=1,nl 1724 cf(in,ir) = cf(in,ir) * pi*deltanuco 1725 enddo 1726 taugr(in) = taugr(in) * pi*deltanuco 1727 enddo 1728 endif 1729 1730 do in=2,nl-1 1731 1732 do ir=1,nl 1733 1734 do i=1,nl 1735 ! only c contains the matrix a. matrixes cup,cdw dont because 1736 ! these two will be used for flux calculations, not 1737 ! only for flux divergencies 1738 1739 c(in,ir) = c(in,ir) + a(in,i) * cf(i,ir) 1740 ! from this matrix we will extract (see below) the 1741 ! nl2 x nl2 "core" for the "reduced" final curtis matrix. 1742 1743 end do 1744 cup(in,ir) = cfup(in,ir) 1745 cdw(in,ir) = cfdw(in,ir) 1746 1747 end do 1748 ! version con l_bb(tg) = l_bb(t(1))=j(1) (see cf above) 1749 !vc(in) = c(in,1) 1750 ! version con l_bb(tg) =/= l_bb(t(1))=j(1) (see cf above) 1751 if (isot.ne.5) then 1752 vc(in) = pi*deltanu(isot,ib)/( 2.d0*deltaz*1.d5 ) * 1753 @ ( tau(in-1,1) - tau(in+1,1) ) 1754 else 1755 vc(in) = pi*deltanuco/( 2.d0*deltaz*1.d5 ) * 1756 @ ( tau(in-1,1) - tau(in+1,1) ) 1757 endif 1758 1759 end do 1760 1761 5 continue 1762 1763 ! write (*,*) 'mztf/1/ c(2,*) =', (c(2,i), i=1,nl) 1764 1765 ! call elimin_dibuja(c,nl,itableout) 1766 1767 c ventana del smoothing de c es nw=3 y de vc es 5 (puesto en lisa): 1768 c subroutine elimin_mz4(c,vc,ilayer,nl,nan,iw, nw) 1769 1770 iw = nan 1771 if (isot.eq.4) iw = 5 ! eliminates values < 1.d-19 1772 if (itableout.eq.30) then 1773 itblout = 0 1774 else 1775 itblout = itableout 1776 endif 1777 call elimin_mz1d (c,vc,0,iw,itblout,nw) 1778 1779 ! upper boundary condition 1780 ! j'(nl) = j'(nl1) ==> j(nl) = 2j(nl1) - j(nl2) ==> 1781 do in=2,nl-1 1782 c(in,nl-2) = c(in,nl-2) - c(in,nl) 1783 c(in,nl-1) = c(in,nl-1) + 2.d0*c(in,nl) 1784 cup(in,nl-2) = cup(in,nl-2) - cup(in,nl) 1785 cup(in,nl-1) = cup(in,nl-1) + 2.d0*cup(in,nl) 1786 cdw(in,nl-2) = cdw(in,nl-2) - cdw(in,nl) 1787 cdw(in,nl-1) = cdw(in,nl-1) + 2.d0*cdw(in,nl) 1788 end do 1789 ! j(nl) = j(nl1) ==> 1790 ! do in=2,nl1 1791 ! c(in,nl1) = c(in,nl1) + c(in,nl) 1792 ! end do 1793 1794 ! 1000 continue 1795 1796 1797 if (icfout.eq.1) then 1798 1799 ! if (ib.eq.1 .or. ib.eq.12 .or. ib.eq.16 .or. ib.eq.18) then 1800 ! codmatrx = codmatrx_fb 1801 ! else 1802 ! codmatrx = codmatrx_hot 1803 ! end if 1804 ! if (ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1805 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1806 ! ibcode2 = '0'//ibcode1 1807 ! else 1808 ! write ( ibcode2, 202) ib 1809 ! endif 1810 1811 ! open ( 1, access='sequential', form='unformatted', file= 1812 ! @ dircurtis//'cfl'//isotcode//dn//ibcode2//codmatrx//'.dat') 1813 ! open ( 2, access='sequential', form='unformatted', file= 1814 ! @ dircurtis//'cflup'//isotcode//dn//ibcode2//codmatrx//'.dat') 1815 ! open ( 3, access='sequential', form='unformatted', file= 1816 ! @ dircurtis//'cfldw'//isotcode//dn//ibcode2//codmatrx//'.dat') 1817 ! open ( 4, access='sequential', form='unformatted', file= 1818 ! @ dircurtis//'cflgr'//isotcode//dn//ibcode2//codmatrx//'.dat') 1819 1820 ! write(1) dummy 1821 ! write(1) ' format: (vc(n),(ch(n,r),r=2,nl-1),n=2,nl-1)' 1822 ! do in=2,nl-1 1823 ! write(1) vc(in), (c(in,ir) , ir=2,nl-1 ) 1824 !! write (*,*) in, vc(in) 1825 ! end do 1826 1827 ! write(2) dummy 1828 ! write(2)' format: (cfup(n,r),r=1,nl), n=1,nl)' 1829 ! do in=1,nl 1830 ! write(2) ( cup(in,ir) , ir=1,nl ) 1831 ! end do 1832 1833 ! write(3) dummy 1834 ! write(3)' format: (cfdw(n,r),r=1,nl), n=1,nl)' 1835 ! do in=1,nl 1836 ! write(3) (cdw(in,ir) , ir=1,nl ) 1837 ! end do 1838 1839 ! write(4) dummy 1840 ! write(4)' format: (taugr(n), n=1,nl)' 1841 ! do in=1,nl 1842 ! write(4) (taugr(in), ir=1,nl ) 1843 ! end do 1844 ! !write (*,*) ' Last value in file: ', taugr(nl) 1845 1846 ! write (*,'(1x,30hcurtis matrix written out in: ,a,a,a,a)' ) 1847 ! @ dircurtis//'cfl'//isotcode//dn//ibcode2//codmatrx//'.dat', 1848 ! @ dircurtis//'cflup'//isotcode//dn//ibcode2//codmatrx//'.dat', 1849 ! @ dircurtis//'cfldw'//isotcode//dn//ibcode2//codmatrx//'.dat', 1850 ! @ dircurtis//'cflgr'//isotcode//dn//ibcode2//codmatrx//'.dat' 1851 1852 ! close (1) 1853 ! close (2) 1854 ! close (3) 1855 ! close (4) 1856 1857 else 1858 1859 ! write (*,*) ' no curtis matrix output file ', char(10) 1860 1861 end if 1862 1863 if (itableout.eq.30) then ! Force output of C.M. in ascii file 1864 1865 ! if (ib.eq.1 .or. ib.eq.12 .or. ib.eq.16 .or. ib.eq.18) then 1866 ! codmatrx = codmatrx_fb 1867 ! else 1868 ! codmatrx = codmatrx_hot 1869 ! end if 1870 ! if (ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1871 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1872 ! ibcode2 = '0'//ibcode1 1873 ! else 1874 ! write ( ibcode2, 202) ib 1875 ! endif 1876 1877 ! open (10, file= 1878 ! & dircurtis//'table'//isotcode//dn//ibcode2//codmatrx//'.dat') 1879 ! write(10,*) nl, ' = number of layers ' 1880 ! write(10,*) ' format: (vc(n),(ch(n,r),r=2,nl-1),n=2,nl-1)' 1881 ! do in=2,nl-1 1882 ! write(10,*) vc(in), (c(in,ir) , ir=2,nl-1 ) 1883 ! enddo 1884 ! close (10) 1885 endif 1886 1887 c end 1888 return 1889 end 1890 1891 1892 1893 1894 1895 c*********************************************************************** 1896 c mztvc 1897 c*********************************************************************** 1898 1899 subroutine mztvc ( ig,vc, ib,isot, 1900 @ iirw,iimu,itauout,icfout,itableout ) 1901 1902 c jul 2011 malv+fgg 1903 c*********************************************************************** 1904 1905 implicit none 1906 1907 include 'comcstfi.h' 1908 include 'nlte_paramdef.h' 1909 include 'nlte_commons.h' 1910 1911 c arguments 1912 integer ig ! ADDED FOR TRACEBACK 1913 real*8 cf(nl,nl), cfup(nl,nl), cfdw(nl,nl) ! o 1914 real*8 vc(nl), taugr(nl) ! o 1915 integer ib ! i 1916 integer isot ! i 1917 integer iirw ! i 1918 integer iimu ! i 1919 integer itauout ! i 1920 integer icfout ! i 1921 integer itableout ! i 1922 1923 c local variables and constants 1924 integer i, in, ir, im, k ,j 1925 integer nmu 1926 parameter (nmu = 8) 1927 real*8 tau(nl,nl) 1928 real*8 tauinf(nl) 1929 real*8 con(nzy), coninf 1930 real*8 c1, c2 1931 real*8 t1, t2 1932 real*8 p1, p2 1933 real*8 mr1, mr2 1934 real*8 st1, st2 1935 real*8 c1box(70), c2box(70) 1936 real*8 ff ! to avoid too small numbers 1937 real*8 tvtbs(nzy) 1938 real*8 st, beta, ts, eqwmu 1939 real*8 mu(nmu), amu(nmu) 1940 real*8 zld(nl), zyd(nzy) 1941 real*8 correc 1942 real deltanux ! width of vib-rot band (cm-1) 1943 character isotcode*2 1944 integer idummy 1945 real*8 Desp,wsL 1946 1947 c formats 1948 111 format(a1) 1949 112 format(a2) 1950 101 format(i1) 1951 202 format(i2) 1952 180 format(a80) 1953 181 format(a80) 1954 c*********************************************************************** 1955 1956 c some needed values 1957 ! rl=sqrt(log(2.d0)) 1958 ! pi2 = 3.14159265358989d0 1959 beta = 1.8d0 1960 ! beta = 1.0d0 1961 idummy = 0 1962 Desp = 0.0d0 1963 wsL = 0.0d0 1964 1965 !write (*,*) ' MZTUD/ iirw = ', iirw 1966 1967 1968 c esto es para que las subroutines de mztfsub calculen we 1969 c de la forma apropiada para mztf, no para fot 1970 icls=icls_mztf 1971 1972 c codigos para filenames 1973 ! if (isot .eq. 1) isotcode = '26' 1974 ! if (isot .eq. 2) isotcode = '28' 1975 ! if (isot .eq. 3) isotcode = '36' 1976 ! if (isot .eq. 4) isotcode = '27' 1977 ! if (isot .eq. 5) isotcode = '62' 1978 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 1979 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 1980 ! write (ibcode1,101) ib 1981 ! else 1982 ! write (ibcode2,202) ib 1983 ! endif 1984 ! write (*,'( 30h calculating curtis matrix : ,2x, 1985 ! @ 8h band = ,i2,2x, 11h isotope = ,i2)') ib, isot 1986 1987 c integration in angle !!!!!!!!!!!!!!!!!!!! 1988 1989 c------- diffusivity approx. 1990 if (iimu.eq.1) then 1991 ! write (*,*) ' diffusivity approx. beta = ',beta 1992 mu(1) = 1.0d0 1993 amu(1)= 1.0d0 1994 c-------data for 8 points integration 1995 elseif (iimu.eq.4) then 1996 write (*,*)' 4 points for the gauss-legendre angle quadrature.' 1997 mu(1)=(1.0d0+0.339981043584856)/2.0d0 1998 mu(2)=(1.0d0-0.339981043584856)/2.0d0 1999 mu(3)=(1.0d0+0.861136311594053)/2.0d0 2000 mu(4)=(1.0d0-0.861136311594053)/2.0d0 2001 amu(1)=0.652145154862546 2002 amu(2)=amu(1) 2003 amu(3)=0.347854845137454 2004 amu(4)=amu(3) 2005 beta=1.0d0 2006 c-------data for 8 points integration 2007 elseif(iimu.eq.8) then 2008 write (*,*)' 8 points for the gauss-legendre angle quadrature.' 2009 mu(1)=(1.0d0+0.183434642495650)/2.0d0 2010 mu(2)=(1.0d0-0.183434642495650)/2.0d0 2011 mu(3)=(1.0d0+0.525532409916329)/2.0d0 2012 mu(4)=(1.0d0-0.525532409916329)/2.0d0 2013 mu(5)=(1.0d0+0.796666477413627)/2.0d0 2014 mu(6)=(1.0d0-0.796666477413627)/2.0d0 2015 mu(7)=(1.0d0+0.960289856497536)/2.0d0 2016 mu(8)=(1.0d0-0.960289856497536)/2.0d0 2017 amu(1)=0.362683783378362 2018 amu(2)=amu(1) 2019 amu(3)=0.313706645877887 2020 amu(4)=amu(3) 2021 amu(5)=0.222381034453374 2022 amu(6)=amu(5) 2023 amu(7)=0.101228536290376 2024 amu(8)=amu(7) 2025 beta=1.0d0 2026 end if 2027 c!!!!!!!!!!!!!!!!!!!!!!! 2028 2029 ccc 2030 ccc determine abundances included in the absorber amount 2031 ccc 2032 2033 c first, set up the grid ready for interpolation. 2034 do i=1,nzy 2035 zyd(i) = dble(zy(i)) 2036 enddo 2037 do i=1,nl 2038 zld(i) = dble(zl(i)) 2039 enddo 2040 2041 c vibr. temp of the bending mode : 2042 if (isot.eq.1) call interdp(tvtbs,zyd,nzy, v626t1,zld,nl,1) 2043 if (isot.eq.2) call interdp(tvtbs,zyd,nzy, v628t1,zld,nl,1) 2044 if (isot.eq.3) call interdp(tvtbs,zyd,nzy, v636t1,zld,nl,1) 2045 if (isot.eq.4) call interdp(tvtbs,zyd,nzy, v627t1,zld,nl,1) 2046 !if (isot.eq.5) call interdp ( tvtbs,zxd,nz, vcot1,zld,nl, 1 ) 2047 2048 c 2nd: correccion a la n10(i) (cantidad de absorbente en el lower state) 2049 c por similitud a la que se hace en cza.for ; esto solo se hace para CO2 2050 2051 !write (*,*) 'imr(isot) = ', isot, imr(isot) 2052 do i=1,nzy 2053 if (isot.eq.5) then 2054 con(i) = dble( coy(i) * imrco ) 2055 else 2056 con(i) = dble( co2y(i) * imr(isot) ) 2057 correc = 2.d0 * dexp( dble(-ee*elow(isot,2))/tvtbs(i) ) 2058 con(i) = con(i) * ( 1.d0 - correc ) 2059 ! write (*,*) ' iz, correc, co2y(i), con(i) =', 2060 ! @ i,correc,co2y(i),con(i) 2061 endif 2062 2063 !----------------------------------------------------------------- 2064 ! mlp & cristina. 17 july 1996 change the calculation of mr. 2065 ! it is used for calculating partial press 2066 ! alpha = alpha(self,co2)*pp +alpha(n2)*(pt-pp) 2067 ! for an isotope, if mr is obtained by 2068 ! co2*imr(iso)/nt 2069 ! we are considerin collisions with other co2 isotopes 2070 ! (including the major one, 626) as if they were with n2. 2071 ! assuming mr as co2/nt, we consider collisions 2072 ! of type 628-626 as of 626-626 instead of as 626-n2. 2073 ! mrx(i)=con(i)/ntx(i) ! old malv 2074 ! mrx(i)= dble(co2x(i)/ntx(i)) ! mlp & crs 2075 2076 ! jan 98: 2077 ! esta modif de mlp implica anular el correc (deberia revisar esto) 2078 2079 mr(i) = dble(co2y(i)/nty(i)) ! malv, jan 98 2080 2081 !----------------------------------------------------------------- 2082 2083 end do 2084 2085 ! como beta y 1.d5 son comunes a todas las weighted absorber amounts, 2086 ! los simplificamos: 2087 ! coninf = beta * 1.d5 * dble( con(n) / log( con(n-1) / con(n) ) ) 2088 !write (*,*) ' con(nz), con(nz-1) =', con(nz), con(nz-1) 2089 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 2090 !write (*,*) ' coninf =', coninf 2091 2092 ccc 2093 ccc temp dependence of the band strength and 2094 ccc nlte correction factor for the absorber amount 2095 ccc 2096 call mztf_correccion ( coninf, con, ib, isot, itableout ) 2097 2098 ccc 2099 ccc reads histogrammed spectral data (strength for lte and vmr=1) 2100 ccc 2101 !hfile1 = dirspec//'hi'//dn !Ya no hacemos distincion d/n en esto 2102 !! hfile1 = dirspec//'hid' !(see why in his.for) 2103 ! hfile1='hid' 2104 !! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = dirspec//'his' 2105 ! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = 'his' 2106 2107 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 2108 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 2109 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode1//'.dat' 2110 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode1//'.dat' 2111 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode1//'.dat' 2112 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode1//'.dat' 2113 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode1//'.dat' 2114 ! else 2115 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode2//'.dat' 2116 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode2//'.dat' 2117 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode2//'.dat' 2118 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode2//'.dat' 2119 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode2//'.dat' 2120 ! endif 2121 ! write (*,*) 'hisfile: ', hisfile 2122 2123 ! the argument to rhist is to make this compatible with mztf_comp.f, 2124 ! which is a useful modification of mztf.f (to change strengths of bands 2125 ! call rhist (1.0) 2126 if(ib.eq.1) then 2127 if(isot.eq.1) then !Case 1 2128 mm=mm_c1 2129 nbox=nbox_c1 2130 tmin=tmin_c1 2131 tmax=tmax_c1 2132 do i=1,nbox_max 2133 no(i)=no_c1(i) 2134 dist(i)=dist_c1(i) 2135 do j=1,nhist 2136 sk1(j,i)=sk1_c1(j,i) 2137 xls1(j,i)=xls1_c1(j,i) 2138 xln1(j,i)=xln1_c1(j,i) 2139 xld1(j,i)=xld1_c1(j,i) 2140 enddo 2141 enddo 2142 do j=1,nhist 2143 thist(j)=thist_c1(j) 2144 enddo 2145 else if(isot.eq.2) then !Case 2 2146 mm=mm_c2 2147 nbox=nbox_c2 2148 tmin=tmin_c2 2149 tmax=tmax_c2 2150 do i=1,nbox_max 2151 no(i)=no_c2(i) 2152 dist(i)=dist_c2(i) 2153 do j=1,nhist 2154 sk1(j,i)=sk1_c2(j,i) 2155 xls1(j,i)=xls1_c2(j,i) 2156 xln1(j,i)=xln1_c2(j,i) 2157 xld1(j,i)=xld1_c2(j,i) 2158 enddo 2159 enddo 2160 do j=1,nhist 2161 thist(j)=thist_c2(j) 2162 enddo 2163 else if(isot.eq.3) then !Case 3 2164 mm=mm_c3 2165 nbox=nbox_c3 2166 tmin=tmin_c3 2167 tmax=tmax_c3 2168 do i=1,nbox_max 2169 no(i)=no_c3(i) 2170 dist(i)=dist_c3(i) 2171 do j=1,nhist 2172 sk1(j,i)=sk1_c3(j,i) 2173 xls1(j,i)=xls1_c3(j,i) 2174 xln1(j,i)=xln1_c3(j,i) 2175 xld1(j,i)=xld1_c3(j,i) 2176 enddo 2177 enddo 2178 do j=1,nhist 2179 thist(j)=thist_c3(j) 2180 enddo 2181 else if(isot.eq.4) then !Case 4 2182 mm=mm_c4 2183 nbox=nbox_c4 2184 tmin=tmin_c4 2185 tmax=tmax_c4 2186 do i=1,nbox_max 2187 no(i)=no_c4(i) 2188 dist(i)=dist_c4(i) 2189 do j=1,nhist 2190 sk1(j,i)=sk1_c4(j,i) 2191 xls1(j,i)=xls1_c4(j,i) 2192 xln1(j,i)=xln1_c4(j,i) 2193 xld1(j,i)=xld1_c4(j,i) 2194 enddo 2195 enddo 2196 do j=1,nhist 2197 thist(j)=thist_c4(j) 2198 enddo 2199 else 2200 write(*,*)'isot must be 2,3 or 4 for ib=1!!' 2201 write(*,*)'stop at mztvc/310' 2202 stop 2203 endif 2204 else if (ib.eq.2) then 2205 if(isot.eq.1) then !Case 5 2206 mm=mm_c5 2207 nbox=nbox_c5 2208 tmin=tmin_c5 2209 tmax=tmax_c5 2210 do i=1,nbox_max 2211 no(i)=no_c5(i) 2212 dist(i)=dist_c5(i) 2213 do j=1,nhist 2214 sk1(j,i)=sk1_c5(j,i) 2215 xls1(j,i)=xls1_c5(j,i) 2216 xln1(j,i)=xln1_c5(j,i) 2217 xld1(j,i)=xld1_c5(j,i) 2218 enddo 2219 enddo 2220 do j=1,nhist 2221 thist(j)=thist_c5(j) 2222 enddo 2223 else 2224 write(*,*)'isot must be 1 for ib=2!!' 2225 write(*,*)'stop at mztvc/334' 2226 stop 2227 endif 2228 else if (ib.eq.3) then 2229 if(isot.eq.1) then !Case 6 2230 mm=mm_c6 2231 nbox=nbox_c6 2232 tmin=tmin_c6 2233 tmax=tmax_c6 2234 do i=1,nbox_max 2235 no(i)=no_c6(i) 2236 dist(i)=dist_c6(i) 2237 do j=1,nhist 2238 sk1(j,i)=sk1_c6(j,i) 2239 xls1(j,i)=xls1_c6(j,i) 2240 xln1(j,i)=xln1_c6(j,i) 2241 xld1(j,i)=xld1_c6(j,i) 2242 enddo 2243 enddo 2244 do j=1,nhist 2245 thist(j)=thist_c6(j) 2246 enddo 2247 else 2248 write(*,*)'isot must be 1 for ib=3!!' 2249 write(*,*)'stop at mztvc/358' 2250 stop 2251 endif 2252 else if (ib.eq.4) then 2253 if(isot.eq.1) then !Case 7 2254 mm=mm_c7 2255 nbox=nbox_c7 2256 tmin=tmin_c7 2257 tmax=tmax_c7 2258 do i=1,nbox_max 2259 no(i)=no_c7(i) 2260 dist(i)=dist_c7(i) 2261 do j=1,nhist 2262 sk1(j,i)=sk1_c7(j,i) 2263 xls1(j,i)=xls1_c7(j,i) 2264 xln1(j,i)=xln1_c7(j,i) 2265 xld1(j,i)=xld1_c7(j,i) 2266 enddo 2267 enddo 2268 do j=1,nhist 2269 thist(j)=thist_c7(j) 2270 enddo 2271 else 2272 write(*,*)'isot must be 1 for ib=4!!' 2273 write(*,*)'stop at mztvc/382' 2274 stop 2275 endif 2276 else 2277 write(*,*)'ib must be 1,2,3 or 4!!' 2278 write(*,*)'stop at mztvc/387' 2279 endif 2280 2281 2282 c****** 2283 c****** calculation of tau(1,ir) for 1<=r 2284 c****** 2285 call initial 2286 2287 ff=1.0e10 2288 2289 in=1 2290 2291 tau(in,1) = 1.d0 2292 2293 call initial 2294 call intz (zl(in), c1,p1,mr1,t1, con) 2295 do kr=1,nbox 2296 ta(kr) = t1 2297 end do 2298 call interstrength (st1,t1,ka,ta) 2299 do kr=1,nbox 2300 c1box(kr) = c1 * ka(kr) * dble(deltaz) 2301 end do 2302 c1 = c1 * st1 * dble(deltaz) 2303 2304 do 2 ir=2,nl 2305 2306 call intz (zl(ir), c2,p2,mr2,t2, con) 2307 do kr=1,nbox 2308 ta(kr) = t2 2309 end do 2310 call interstrength (st2,t2,ka,ta) 2311 do kr=1,nbox 2312 c2box(kr) = c2 * ka(kr) * dble(deltaz) 2313 end do 2314 c2 = c2 * st2 * dble(deltaz) 2315 2316 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 2317 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 2318 cc = cc + ( c1 + c2 ) / 2.d0 2319 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 2320 do kr=1,nbox 2321 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 2322 ddbox(kr) = ddbox(kr) + 2323 $ ( t1*c1box(kr) + t2*c2box(kr) ) /2.d0 2324 end do 2325 2326 mr1=mr2 2327 t1=t2 2328 c1=c2 2329 p1=p2 2330 do kr=1,nbox 2331 c1box(kr) = c2box(kr) 2332 end do 2333 2334 pt = bb / cc 2335 pp = aa / (cc * ff) 2336 2337 ts = dd/cc 2338 do kr=1,nbox 2339 ta(kr) = ddbox(kr) / ccbox(kr) 2340 end do 2341 call interstrength(st,ts,ka,ta) 2342 call intershape(alsa,alna,alda,ta) 2343 2344 2345 eqwmu = 0.0d0 2346 do im = 1,iimu 2347 eqw=0.0d0 2348 do kr=1,nbox 2349 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 2350 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 2351 if ( i_supersat .eq. 0 ) then 2352 eqw=eqw+no(kr)*w 2353 else 2354 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 2355 endif 2356 end do 2357 eqwmu = eqwmu + eqw * mu(im)*amu(im) 2358 end do 2359 2360 tau(in,ir) = exp( - eqwmu / dble(deltanu(isot,ib)) ) 2361 2362 2 continue 2363 2364 2365 2366 c 2367 c due to the simmetry of the transmittances 2368 c 2369 do in=nl,2,-1 2370 tau(in,1) = tau(1,in) 2371 end do 2372 2373 vc(1) = 0.0d0 2374 vc(nl) = 0.0d0 2375 do in=2,nl-1 ! poner aqui nl-1 luego 2376 vc(in) = pi*deltanu(isot,ib)/( 2.d0*deltaz*1.d5 ) * 2377 @ ( tau(in-1,1) - tau(in+1,1) ) 2378 end do 2379 2380 2381 c end 2382 return 2383 end 2384 2385 2386 2387 2388 2389 c*********************************************************************** 2390 c mztvc_626fh.F 2391 c*********************************************************************** 2392 2393 subroutine mztvc_626fh(ig) 2394 2395 c jul 2011 malv+fgg 2396 c*********************************************************************** 2397 2398 implicit none 2399 2400 !!!!!!!!!!!!!!!!!!!!!!! 2401 ! common variables & constants 2402 2403 include 'nlte_paramdef.h' 2404 include 'nlte_commons.h' 2405 2406 !!!!!!!!!!!!!!!!!!!!!!! 2407 ! arguments 2408 2409 integer ig ! ADDED FOR TRACEBACK 2410 2411 !!!!!!!!!!!!!!!!!!!!!!! 2412 ! local variables 2413 2414 real*4 cdummy(nl,nl), csngl(nl,nl) 2415 2416 real*8 cax1(nl,nl), cax2(nl,nl), cax3(nl,nl) 2417 real*8 v1(nl), v2(nl), v3(nl), cm_factor, vc_factor 2418 2419 integer itauout,icfout,itableout, interpol,ismooth, isngldble 2420 integer i,j,ik,ist,isot,ib,itt 2421 2422 !character bandcode*2 2423 character isotcode*2 2424 !character codmatrx_hot*5 2425 2426 !!!!!!!!!!!!!!!!!!!!!!! 2427 ! external functions 2428 2429 external bandid 2430 character*2 bandid 2431 2432 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2433 ! subroutines called: 2434 ! mz4sub, dmzout, readc_mz4, readcupdw, mztf 2435 2436 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2437 ! formatos 2438 132 format(i2) 2439 2440 ************************************************************************ 2441 ************************************************************************ 2442 2443 isngldble = 1 ! =1 --> dble precission 2444 2445 fileroot = 'cfl' 2446 2447 ist = 1 2448 isot = 26 2449 write (isotcode,132) isot 2450 2451 call zerov( vc121, nl ) 2452 2453 do 11, ik=1,3 2454 2455 ib=ik+1 2456 2457 call mztvc (ig,v1, ib, 1, irw_mztf, imu, 0,0,0 ) 2458 2459 do i=1,nl 2460 2461 if(ik.eq.1)then 2462 vc_factor = dble(667.75/618.03) 2463 elseif(ik.eq.2)then 2464 vc_factor = 1.d0 2465 elseif(ik.eq.3)then 2466 vc_factor = dble(667.75/720.806) 2467 end if 2468 2469 vc121(i) = vc121(i) + v1(i) * vc_factor 2470 2471 end do 2472 2473 11 continue 2474 2475 2476 return 2477 end 2478 2479 2480 2481 2482 2483 c*********************************************************************** 2484 c mztf_correccion 2485 c*********************************************************************** 2486 2487 subroutine mztf_correccion (coninf, con, ib, isot, icurt_pop) 2488 2489 c including the dependence of the absort. coeff. on temp., vibr. temp., 2490 c function, etc.., when neccessary. imr is already corrected in his.for 2491 c we follow pg.39b-43a (l5): 2492 c tvt1 is the vibr temp of the upper level 2493 c tvt is the vibr temp of the transition itself 2494 c tvtbs is the vibr temp of the bending mode (used in qv) 2495 c for fundamental bands, they are not used at the moment. 2496 c for the 15 fh and sh bands, only tvt0 is used at the moment. 2497 c for the laser band, all of them are used following pg. 41a -l5- : 2498 c we need s(z) and we can read s(tk) from the histogram (also called 2499 c what we have to calculate now is the factor s(z)/s(tk) or following 2500 c l5 notebook notation, s_nlte/s_lte. 2501 c s_nlte/s_lte = xfactor = xlower * xqv * xes 2502 2503 c icurt_pop = 30 -> Output of populations of the 0200,0220,1000 states 2504 c = otro -> no output of these populations 2505 2506 c oct 92 malv 2507 c jan 98 malv version for mz1d 2508 c jul 2011 malv+fgg adapted to LMD-MGCM 2509 c*********************************************************************** 2510 2511 implicit none 2512 2513 include 'nlte_paramdef.h' 2514 include 'nlte_commons.h' 2515 2516 c arguments 2517 integer ib, isot 2518 integer icurt_pop ! output of Fermi states population 2519 real*8 con(nzy), coninf 2520 2521 ! local variables 2522 integer i 2523 real*8 tvt0(nzy),tvt1(nzy),tvtbs(nzy), zld(nl),zyd(nzy) 2524 real xalfa, xbeta, xtv1000, xtv0200, xtv0220, xfactor 2525 real xqv, xnu_trans, xtv_trans, xes, xlower 2526 c*********************************************************************** 2527 2528 xfactor = 1.0 2529 770 real*8 correc 771 real*8 deltanudbl 772 integer isot 773 real*8 yy 774 775 c external function 776 external we_clean 777 real*8 we_clean 778 779 780 c formats 781 101 format(i1) 782 c*********************************************************************** 783 784 c some values 785 beta = 1.8d5 786 isot = 1 787 write (ibcode1,101) ib 788 deltanudbl = dble( deltanu(isot,ib) ) 789 ff=1.0d10 790 deltazdbl = dble(deltaz) 791 792 ccc 793 ccc 794 ccc 795 do i=1,nl 796 zld(i) = dble(zl(i)) 797 enddo 2530 798 do i=1,nzy 2531 799 zyd(i) = dble(zy(i)) 2532 800 enddo 2533 do i=1,nl 2534 zld(i) = dble( zl(i) ) 2535 end do 2536 2537 ! tvtbs is the bending mode of the molecule. used in xqv. 2538 if (isot.eq.1) call interdp (tvtbs,zyd,nzy,v626t1,zld,nl,1) 2539 if (isot.eq.2) call interdp (tvtbs,zyd,nzy,v628t1,zld,nl,1) 2540 if (isot.eq.3) call interdp (tvtbs,zyd,nzy,v636t1,zld,nl,1) 2541 if (isot.eq.4) call interdp (tvtbs,zyd,nzy,v627t1,zld,nl,1) 2542 if (isot.eq.5) call interdp (tvtbs,zyd,nzy,vcot1,zld,nl,1) 2543 2544 ! tvt0 is the lower level of the transition. used in xlower. 2545 if (ib.eq.2 .or. ib.eq.3 .or. ib.eq.4 .or. ib.eq.15) then 2546 if (isot.eq.1) call interdp(tvt0,zyd,nzy,v626t1,zld,nl,1) 2547 if (isot.eq.2) call interdp(tvt0,zyd,nzy,v628t1,zld,nl,1) 2548 if (isot.eq.3) call interdp(tvt0,zyd,nzy,v636t1,zld,nl,1) 2549 if (isot.eq.4) call interdp(tvt0,zyd,nzy,v627t1,zld,nl,1) 2550 elseif (ib.eq.6 .or. ib.eq.8 .or. ib.eq.10 2551 @ .or. ib.eq.13 .or. ib.eq.14 2552 @ .or. ib.eq.17 .or. ib.eq.19 .or. ib.eq.20) then 2553 if (isot.eq.1) call interdp(tvt0,zyd,nzy,v626t2,zld,nl,1) 2554 if (isot.eq.2) call interdp(tvt0,zyd,nzy,v628t2,zld,nl,1) 2555 if (isot.eq.3) call interdp(tvt0,zyd,nzy,v636t2,zld,nl,1) 2556 if (isot.eq.4) then 2557 call interdp ( tvt0,zyd,nzy, v627t2,zld,nl, 1 ) 2558 endif 2559 else 2560 do i=1,nzy 2561 tvt0(i) = dble( ty(i) ) 2562 end do 2563 end if 2564 2565 c tvt is the vt of the transition. used in xes. 2566 c since xes=1.0 except for the laser bands, tvt is only needed for them 2567 c but it is actually calculated from the tv of the upper and lower level 2568 c of the transition. hence, only tvt1 remains to be read for the laser b 2569 c tvt1 is the upper level of the transition. 2570 if (ib.eq.13 .or. ib.eq.14) then 2571 if (isot.eq.1) call interdp(tvt1,zyd,nzy,v626t4,zld,nl,1) 2572 if (isot.eq.2) call interdp(tvt1,zyd,nzy,v628t4,zld,nl,1) 2573 if (isot.eq.3) call interdp(tvt1,zyd,nzy,v636t4,zld,nl,1) 2574 if (isot.eq.4) call interdp(tvt1,zyd,nzy,v627t4,zld,nl,1) 2575 end if 2576 2577 c here we weight the absorber amount by a factor which compensate the l 2578 c value of the strength read from hitran. we use that factor in order t 2579 c correct the product s*m when we later multiply those two variables. 2580 2581 ! if ( isot.eq.1 .and. icurt_pop.eq.30 ) then 2582 ! open (30, file='020populations.dat') 2583 ! write (30,*) ' z tv(020) tv0200 tv0220 tv1000 ' 2584 ! endif 2585 2586 do i=1,nzy 2587 2588 if (isot.eq.1) then 2589 2590 !!! vt of the 3 levels in (020) (see pag. 36a-sn1 for this) 2591 xalfa = 1.d0/2.d0*exp(dble(-ee*(nu12_1000-nu(1,2))/ty(i))) 2592 xbeta = 1.d0/2.d0*exp(dble(-ee*(nu12_0200-nu(1,2))/ty(i))) 2593 xtv0200 = dble( - ee * nu12_0200 ) / 2594 @ ( log( xbeta/(1.d0+xalfa+xbeta) ) - 2595 @ dble(ee*nu(1,2))/tvt0(i) ) 2596 xtv0220 = dble( - ee * nu(1,2) ) / 2597 @ ( log( 1.d0/(1.d0+xalfa+xbeta) ) - 2598 @ dble(ee*nu(1,2))/tvt0(i) ) 2599 xtv1000 = dble( - ee * nu12_1000 ) / 2600 @ ( log( xalfa/(1.d0+xalfa+xbeta) ) - 2601 @ dble(ee*nu(1,2))/tvt0(i) ) 2602 !!! correccion 8-Nov-04 (see pag.9b-Marte4-) 2603 xtv0200 = dble( - ee * nu12_0200 / 2604 @ (log(4.*xbeta/(1.d0+xalfa+xbeta))-ee*nu(1,2)/tvt0(i))) 2605 xtv0220 = dble( - ee * nu(1,2) / 2606 @ ( log(2./(1.d0+xalfa+xbeta)) - ee*nu(1,2)/tvt0(i) ) ) 2607 xtv1000 = dble( - ee * nu12_1000 / 2608 @ (log(4.*xalfa/(1.d0+xalfa+xbeta))-ee*nu(1,2)/tvt0(i))) 2609 2610 ! if ( icurt_pop.eq.30 ) then 2611 ! write (30,'( 1x,f7.2, 3x,f8.3, 2x,3(1x,f8.3) )') 2612 ! @ zx(i), tvt0(i), xtv0200, xtv0220, xtv1000 2613 ! endif 2614 2615 !!! xlower and xes for the band 2616 if (ib.eq.19) then 2617 xlower = exp( dble(ee*elow(isot,ib)) * 2618 @ ( 1.d0/dble(ty(i))-1.d0/xtv0200 ) ) 2619 xes = 1.0d0 2620 elseif (ib.eq.17) then 2621 xlower = exp( dble(ee*elow(isot,ib)) * 2622 @ ( 1.d0/dble(ty(i))-1.d0/xtv1000 ) ) 2623 xes = 1.0d0 2624 elseif (ib.eq.20) then 2625 xlower = exp( dble(ee*elow(isot,ib)) * 2626 @ ( 1.d0/dble(ty(i))-1.d0/xtv0220 ) ) 2627 xes = 1.0d0 2628 elseif (ib.eq.14) then 2629 xlower = exp( dble(ee*nu12_1000) * 2630 @ ( 1.d0/dble(ty(i))-1.d0/xtv1000 ) ) 2631 xnu_trans = dble( nu(1,4)-nu12_1000 ) 2632 xtv_trans = xnu_trans / dble(nu(1,4)/tvt1(i)- 2633 @ nu12_1000/xtv1000) 2634 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2635 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2636 elseif (ib.eq.13) then 2637 xlower = exp( dble(ee*nu12_0200) * 2638 @ ( 1.d0/dble(ty(i))-1.d0/xtv0200 ) ) 2639 xnu_trans = dble(nu(1,4)-nu12_0200) 2640 xtv_trans = xnu_trans / dble(nu(1,4)/tvt1(i)- 2641 @ nu12_0200/xtv0200) 2642 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2643 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2644 else 2645 xlower = exp( dble(ee*elow(isot,ib)) * 2646 @ ( 1.d0/dble(ty(i))-1.d0/tvt0(i) ) ) 2647 xes = 1.0d0 2648 end if 2649 xqv = (1.d0-exp( dble(-ee*667.3801/tvtbs(i)) )) / 2650 @ (1.d0-exp( dble(-ee*667.3801/ty(i)) )) 2651 xfactor = xlower * xqv**2.d0 * xes 2652 2653 elseif (isot.eq.2) then 2654 2655 xalfa = 1.d0/2.d0* exp( dble(-ee*(nu22_1000-nu(2,2))/ 2656 @ ty(i)) ) 2657 xbeta = 1.d0/2.d0* exp( dble(-ee*(nu22_0200-nu(2,2))/ 2658 @ ty(i)) ) 2659 xtv0200 = dble( - ee * nu22_0200 ) / 2660 @ ( log( xbeta/(1.d0+xalfa+xbeta) ) - dble(ee*nu(2,2))/ 2661 @ tvt0(i) ) 2662 xtv1000 = dble( - ee * nu22_1000 ) / 2663 @ ( log( xalfa/(1.d0+xalfa+xbeta) ) - dble(ee*nu(2,2))/ 2664 @ tvt0(i) ) 2665 2666 if (ib.eq.14) then 2667 xlower = exp( dble(ee*nu22_1000) * 2668 @ ( 1.d0/dble(ty(i))-1.d0/xtv1000 ) ) 2669 xnu_trans = dble(nu(2,4)-nu22_1000) 2670 xtv_trans = xnu_trans / dble(nu(2,4)/tvt1(i)-nu22_1000/ 2671 @ xtv1000) 2672 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2673 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2674 elseif (ib.eq.13) then 2675 xlower = exp( dble(ee*nu22_0200) * 2676 @ ( 1.d0/dble(ty(i))-1.d0/xtv0200 ) ) 2677 xnu_trans = dble( nu(2,4)-nu22_0200 ) 2678 xtv_trans = xnu_trans / dble(nu(2,4)/tvt1(i)-nu22_0200/ 2679 @ xtv0200) 2680 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2681 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2682 else 2683 xlower = exp( dble(ee*elow(isot,ib)) * 2684 @ ( 1.d0/dble(ty(i))-1.d0/tvt0(i) ) ) 2685 xes = 1.0d0 2686 end if 2687 xqv = (1.d0-exp( dble(-ee*662.3734/tvtbs(i)) )) / 2688 @ (1.d0-exp( dble(-ee*662.3734/ty(i)) )) 2689 xfactor = xlower * xqv**2.d0 * xes 2690 2691 elseif (isot.eq.3) then 2692 2693 xalfa = 1.d0/2.d0* exp( dble(-ee*(nu32_1000-nu(3,2))/ 2694 @ ty(i)) ) 2695 xbeta = 1.d0/2.d0* exp( dble(-ee*(nu32_0200-nu(3,2))/ 2696 @ ty(i)) ) 2697 xtv0200 = dble( - ee * nu32_0200 ) / 2698 @ ( log( xbeta/(1.d0+xalfa+xbeta) ) - dble(ee*nu(3,2))/ 2699 @ tvt0(i) ) 2700 xtv1000 = dble( - ee * nu32_1000 ) / 2701 @ ( log( xalfa/(1.d0+xalfa+xbeta) ) - dble(ee*nu(3,2))/ 2702 @ tvt0(i) ) 2703 2704 if (ib.eq.14) then 2705 xlower = exp( dble(ee*nu32_1000) * 2706 @ ( 1.d0/dble(ty(i))-1.d0/xtv1000 ) ) 2707 xnu_trans = dble( nu(3,4)-nu32_1000 ) 2708 xtv_trans = xnu_trans / dble(nu(3,4)/tvt1(i)-nu32_1000/ 2709 @ xtv1000) 2710 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2711 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2712 elseif (ib.eq.13) then 2713 xlower = exp( dble(ee*nu32_0200) * 2714 @ ( 1.d0/dble(ty(i))-1.d0/xtv0200 ) ) 2715 xnu_trans = dble( nu(3,4)-nu32_0200 ) 2716 xtv_trans = xnu_trans / dble(nu(3,4)/tvt1(i)-nu32_0200/ 2717 @ xtv0200) 2718 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2719 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2720 else 2721 xlower = exp( dble(ee*elow(isot,ib)) * 2722 @ ( 1.d0/dble(ty(i))-1.d0/tvt0(i) ) ) 2723 xes = 1.0d0 2724 end if 2725 xqv = (1.d0-exp( dble(-ee*648.4784/tvtbs(i)) )) / 2726 @ (1.d0-exp( dble(-ee*648.4784/ty(i)) )) 2727 xfactor = xlower * xqv**2.d0 * xes 2728 2729 elseif (isot.eq.4) then 2730 2731 xalfa = 1.d0/2.d0* exp( dble(-ee*(nu42_1000-nu(4,2))/ 2732 @ ty(i)) ) 2733 xbeta = 1.d0/2.d0* exp( dble(-ee*(nu42_0200-nu(4,2))/ 2734 @ ty(i)) ) 2735 xtv0200 = dble( - ee * nu42_0200 ) / 2736 @ ( log( xbeta/(1.d0+xalfa+xbeta) ) - dble(ee*nu(4,2))/ 2737 @ tvt0(i) ) 2738 xtv1000 = dble( - ee * nu42_1000 ) / 2739 @ ( log( xalfa/(1.d0+xalfa+xbeta) ) - dble(ee*nu(4,2))/ 2740 @ tvt0(i) ) 2741 2742 if (ib.eq.14) then 2743 xlower = exp( dble(ee*nu42_1000) * 2744 @ ( 1.d0/dble(ty(i))-1.d0/xtv1000 ) ) 2745 xnu_trans = dble( nu(4,4)-nu42_1000 ) 2746 xtv_trans = xnu_trans / dble(nu(4,4)/tvt1(i)-nu42_1000/ 2747 @ xtv1000) 2748 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2749 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2750 elseif (ib.eq.13) then 2751 xlower = exp( dble(ee*nu42_0200) * 2752 $ ( 1.d0/dble(ty(i))-1.d0/xtv0200 ) ) 2753 xnu_trans = dble( nu(4,4)-nu42_0200 ) 2754 xtv_trans = xnu_trans / dble(nu(4,4)/tvt1(i)-nu42_0200/ 2755 @ xtv0200) 2756 xes = (1.d0-exp( dble(-ee*xnu_trans/xtv_trans) )) / 2757 @ (1.d0-exp( dble(-ee*xnu_trans/ty(i)) )) 2758 else 2759 xlower = exp( dble(ee*elow(isot,ib)) * 2760 @ ( 1.d0/dble(ty(i))-1.d0/tvt0(i) ) ) 2761 xes = 1.0d0 2762 end if 2763 xqv = (1.d0-exp( dble(-ee*664.7289/tvtbs(i)) )) / 2764 @ (1.d0-exp( dble(-ee*664.7289/ty(i)) )) 2765 xfactor = xlower * xqv**2.d0 * xes 2766 2767 elseif (isot.eq.5 .and. ib.eq.1) then 2768 2769 xlower = 1.d0 2770 xes = 1.0d0 2771 xqv = (1.d0-exp( dble(-ee*nuco_10/tvtbs(i)) )) / 2772 @ (1.d0-exp( dble(-ee*nuco_10/ty(i)) )) 2773 xfactor = xlower * xqv * xes 2774 2775 end if 2776 2777 con(i) = con(i) * xfactor 2778 if (i.eq.nzy) coninf = coninf * xfactor 2779 2780 end do 2781 2782 ! if ( isot.eq.1 .and. icurt_pop.eq.30 ) then 2783 ! close (30) 2784 ! endif 2785 2786 return 2787 end 2788 2789 2790 2791 2792 2793 c*********************************************************************** 2794 c mztf.f 2795 c*********************************************************************** 2796 c 2797 c program for calculating atmospheric transmittances 2798 c to be used in the calculation of curtis matrix coefficients 2799 2800 subroutine mztf ( ig,cf,cfup,cfdw,vc,taugr, ib,isot, 2801 @ iirw,iimu,itauout,icfout,itableout ) 2802 2803 c i*out = 1 output of data 2804 c i*out = 0 no output 2805 c 2806 c jul 2011 malv+fgg adapted to LMD-MGCM 2807 c nov 98 mavl allow for overlaping in the lorentz line 2808 c jan 98 malv version for mz1d. based on curtis/mztf.for 2809 c 17-jul-96 mlp&crs change the calculation of mr. 2810 c evitar: divide por cero. anhadiendo: ff 2811 c oct-92 malv correct s(t) dependence for all histogr bands 2812 c june-92 malv proper lower levels for laser bands 2813 c may-92 malv new temperature dependence for laser bands 2814 c @ 991 malv boxing for the averaged absorber amount and t 2815 c ? malv extension up to 200 km altitude in mars 2816 c 13-nov-86 mlp include the temperature weighted to match 2817 c the eqw in the strong doppler limit. 2818 c*********************************************************************** 2819 2820 implicit none 2821 801 802 call interhuntdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 ) 803 804 do i=1,nzy 805 con(i) = dble( co2y(i) * imr(isot) ) 806 correc = 2.d0 * exp( -ee*dble(elow(isot,2))/tvtbs(i) ) 807 con(i) = con(i) * ( 1.d0 - correc ) 808 mr(i) = dble( co2y(i) / nty(i) ) 809 end do 810 811 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 812 call mztf_correccion ( coninf, con, ib ) 813 814 ccc 815 call gethist_03 ( ib ) 816 817 818 c 819 c tauinf(nl) 820 c 821 call initial 822 823 iaquiZ = nzy - 2 824 iaquiHIST = nhist / 2 825 826 do i=nl,1,-1 827 828 if(i.eq.nl)then 829 830 call intzhunt ( iaquiZ, zl(i),c2,p2,mr2,t2, con) 831 do kr=1,nbox 832 ta(kr)=t2 833 end do 834 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 835 aa = p2 * coninf * mr2 * (st2 * ff) 836 cc = coninf * st2 837 dd = t2 * coninf * st2 838 do kr=1,nbox 839 ccbox(kr) = coninf * ka(kr) 840 ddbox(kr) = t2 * ccbox(kr) 841 c2box(kr) = c2 * ka(kr) * deltazdbl 842 end do 843 c2 = c2 * st2 * deltazdbl 844 845 else 846 call intzhunt ( iaquiZ, zl(i),c1,p1,mr1,t1, con) 847 do kr=1,nbox 848 ta(kr)=t1 849 end do 850 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 851 do kr=1,nbox 852 c1box(kr) = c1 * ka(kr) * deltazdbl 853 end do 854 c1 = c1 * st1 * deltazdbl 855 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 856 cc = cc + ( c1 + c2 ) / 2.d0 857 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 858 do kr=1,nbox 859 ccbox(kr) = ccbox(kr) + 860 @ ( c1box(kr) + c2box(kr) )/2.d0 861 ddbox(kr) = ddbox(kr) + 862 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 863 end do 864 865 mr2 = mr1 866 c2=c1 867 do kr=1,nbox 868 c2box(kr) = c1box(kr) 869 end do 870 t2=t1 871 p2=p1 872 end if 873 874 pp = aa / (cc*ff) 875 876 ts = dd/cc 877 do kr=1,nbox 878 ta(kr) = ddbox(kr) / ccbox(kr) 879 end do 880 call interstrhunt(iaquiHIST, st,ts,ka,ta) 881 call intershphunt(iaquiHIST, alsa,alda,ta) 882 883 c 884 885 eqw = 0.0d0 886 do kr=1,nbox 887 yy = ccbox(kr) * beta 888 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 889 eqw = eqw + no(kr)*w 890 end do 891 892 argumento = eqw / deltanudbl 893 tauinf(i) = dexp( - argumento ) 894 895 896 end do ! i continue 897 898 899 c 900 c tau(in,ir) for n<=r 901 c 902 903 iaquiZ = 2 904 do 1 in=1,nl-1 905 906 call initial 907 call intzhunt ( iaquiZ, zl(in), c1,p1,mr1,t1, con) 908 do kr=1,nbox 909 ta(kr) = t1 910 end do 911 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 912 do kr=1,nbox 913 c1box(kr) = c1 * ka(kr) * deltazdbl 914 end do 915 c1 = c1 * st1 * deltazdbl 916 917 do 2 ir=in,nl-1 918 919 if (ir.eq.in) then 920 tau(in,ir) = 1.d0 921 goto 2 922 end if 923 924 call intzhunt ( iaquiZ, zl(ir), c2,p2,mr2,t2, con) 925 do kr=1,nbox 926 ta(kr) = t2 927 end do 928 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 929 do kr=1,nbox 930 c2box(kr) = c2 * ka(kr) * deltazdbl 931 end do 932 c2 = c2 * st2 * deltazdbl 933 934 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 935 cc = cc + ( c1 + c2 ) / 2.d0 936 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 937 do kr=1,nbox 938 ccbox(kr) = ccbox(kr) + 939 $ ( c1box(kr) + c2box(kr) ) / 2.d0 940 ddbox(kr) = ddbox(kr) + 941 $ ( t1*c1box(kr) + t2*c2box(kr) ) / 2.d0 942 end do 943 944 mr1=mr2 945 t1=t2 946 c1=c2 947 p1=p2 948 do kr=1,nbox 949 c1box(kr) = c2box(kr) 950 end do 951 952 pp = aa / (cc * ff) 953 954 ts = dd/cc 955 do kr=1,nbox 956 ta(kr) = ddbox(kr) / ccbox(kr) 957 end do 958 call interstrhunt(iaquiHIST, st,ts,ka,ta) 959 call intershphunt(iaquiHIST, alsa,alda,ta) 960 961 c 962 963 eqw = 0.0d0 964 do kr=1,nbox 965 yy = ccbox(kr) * beta 966 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 967 eqw = eqw + no(kr)*w 968 end do 969 970 argumento = eqw / deltanudbl 971 tau(in,ir) = dexp( - argumento ) 972 973 2 continue 974 975 1 continue 976 977 c 978 c tau(in,ir) for n>r 979 c 980 981 in=nl 982 983 call initial 984 iaquiZ = nzy - 2 985 call intzhunt ( iaquiZ, zl(in), c1,p1,mr1,t1, con) 986 do kr=1,nbox 987 ta(kr) = t1 988 end do 989 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 990 do kr=1,nbox 991 c1box(kr) = c1 * ka(kr) * deltazdbl 992 end do 993 c1 = c1 * st1 * deltazdbl 994 995 do 4 ir=in-1,1,-1 996 997 call intzhunt ( iaquiZ, zl(ir), c2,p2,mr2,t2, con) 998 do kr=1,nbox 999 ta(kr) = t2 1000 end do 1001 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 1002 do kr=1,nbox 1003 c2box(kr) = c2 * ka(kr) * deltazdbl 1004 end do 1005 c2 = c2 * st2 * deltazdbl 1006 1007 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1008 cc = cc + ( c1 + c2 ) / 2.d0 1009 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1010 do kr=1,nbox 1011 ccbox(kr) = ccbox(kr) + 1012 $ ( c1box(kr) + c2box(kr) ) / 2.d0 1013 ddbox(kr) = ddbox(kr) + 1014 $ ( t1*c1box(kr) + t2*c2box(kr) ) / 2.d0 1015 end do 1016 1017 mr1=mr2 1018 c1=c2 1019 t1=t2 1020 p1=p2 1021 do kr=1,nbox 1022 c1box(kr) = c2box(kr) 1023 end do 1024 1025 pp = aa / (cc * ff) 1026 ts = dd / cc 1027 do kr=1,nbox 1028 ta(kr) = ddbox(kr) / ccbox(kr) 1029 end do 1030 call interstrhunt (iaquiHIST, st,ts,ka,ta) 1031 call intershphunt (iaquiHIST, alsa,alda,ta) 1032 1033 c 1034 eqw=0.0d0 1035 do kr=1,nbox 1036 yy = ccbox(kr) * beta 1037 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 1038 eqw = eqw + no(kr)*w 1039 end do 1040 1041 argumento = eqw / deltanudbl 1042 tau(in,ir) = dexp( - argumento ) 1043 1044 4 continue 1045 1046 c 1047 c 1048 c 1049 do in=nl-1,2,-1 1050 do ir=in-1,1,-1 1051 tau(in,ir) = tau(ir,in) 1052 end do 1053 end do 1054 1055 c 1056 call MZCUD121 ( tauinf,tau, cf, vc, ib ) 1057 1058 1059 c end 1060 return 1061 end 1062 1063 1064 1065 c *** Old MZCUD121_dlvr11.f *** 1066 1067 c*********************************************************************** 1068 1069 subroutine MZCUD121 ( tauinf,tau, c,vc, ib ) 1070 1071 c*********************************************************************** 1072 1073 implicit none 1074 2822 1075 include 'nlte_paramdef.h' 2823 1076 include 'nlte_commons.h' 2824 2825 2826 c arguments 2827 integer ig !ADDED FOR TRACEBACK 2828 real*8 cf(nl,nl), cfup(nl,nl), cfdw(nl,nl) ! o. 2829 real*8 vc(nl), taugr(nl) ! o 2830 integer ib ! i 2831 integer isot ! i 2832 integer iirw ! i 2833 integer iimu ! i 2834 integer itauout ! i 2835 integer icfout ! i 2836 integer itableout ! i 2837 2838 c local variables and constants 2839 integer i, in, ir, im, k ,j 2840 integer nmu 2841 parameter (nmu = 8) 2842 real*8 tau(nl,nl) 2843 real*8 tauinf(nl) 2844 real*8 con(nzy), coninf 2845 real*8 c1, c2 2846 real*8 t1, t2 2847 real*8 p1, p2 2848 real*8 mr1, mr2 2849 real*8 st1, st2 2850 real*8 c1box(70), c2box(70) 2851 real*8 ff ! to avoid too small numbers 2852 real*8 tvtbs(nzy) 2853 real*8 st, beta, ts, eqwmu 2854 real*8 mu(nmu), amu(nmu) 2855 real*8 zld(nl), zyd(nzy) 2856 real*8 correc 2857 real deltanux ! width of vib-rot band (cm-1) 2858 ! character isotcode*2 2859 integer idummy 2860 real*8 Desp,wsL 2861 2862 c formats 2863 ! 111 format(a1) 2864 ! 112 format(a2) 2865 101 format(i1) 2866 202 format(i2) 2867 ! 180 format(a80) 2868 ! 181 format(a80) 2869 c*********************************************************************** 2870 2871 c some needed values 2872 ! rl=sqrt(log(2.d0)) 2873 ! pi2 = 3.14159265358989d0 2874 beta = 1.8d0 2875 idummy = 0 2876 Desp = 0.d0 2877 wsL = 0.d0 2878 2879 c esto es para que las subroutines de mztfsub calculen we 2880 c de la forma apropiada para mztf, no para fot 2881 icls=icls_mztf 2882 2883 c codigos para filenames 2884 ! if (isot .eq. 1) isotcode = '26' 2885 ! if (isot .eq. 2) isotcode = '28' 2886 ! if (isot .eq. 3) isotcode = '36' 2887 ! if (isot .eq. 4) isotcode = '27' 2888 ! if (isot .eq. 5) isotcode = '62' 2889 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 2890 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 2891 ! write (ibcode1,101) ib 2892 ! else 2893 ! write (ibcode2,202) ib 2894 ! endif 2895 ! write (*,'( 30h calculating curtis matrix : ,2x, 2896 ! @ 8h band = ,i2,2x, 11h isotope = ,i2)') ib, isot 2897 2898 c integration in angle !!!!!!!!!!!!!!!!!!!! 2899 2900 c------- diffusivity approx. 2901 if (iimu.eq.1) then 2902 ! write (*,*) ' diffusivity approx. beta = ',beta 2903 mu(1) = 1.0d0 2904 amu(1)= 1.0d0 2905 c-------data for 8 points integration 2906 elseif (iimu.eq.4) then 2907 write (*,*)' 4 points for the gauss-legendre angle quadrature.' 2908 mu(1)=(1.0d0+0.339981043584856)/2.0d0 2909 mu(2)=(1.0d0-0.339981043584856)/2.0d0 2910 mu(3)=(1.0d0+0.861136311594053)/2.0d0 2911 mu(4)=(1.0d0-0.861136311594053)/2.0d0 2912 amu(1)=0.652145154862546 2913 amu(2)=amu(1) 2914 amu(3)=0.347854845137454 2915 amu(4)=amu(3) 2916 beta=1.0d0 2917 c-------data for 8 points integration 2918 elseif(iimu.eq.8) then 2919 write (*,*)' 8 points for the gauss-legendre angle quadrature.' 2920 mu(1)=(1.0d0+0.183434642495650)/2.0d0 2921 mu(2)=(1.0d0-0.183434642495650)/2.0d0 2922 mu(3)=(1.0d0+0.525532409916329)/2.0d0 2923 mu(4)=(1.0d0-0.525532409916329)/2.0d0 2924 mu(5)=(1.0d0+0.796666477413627)/2.0d0 2925 mu(6)=(1.0d0-0.796666477413627)/2.0d0 2926 mu(7)=(1.0d0+0.960289856497536)/2.0d0 2927 mu(8)=(1.0d0-0.960289856497536)/2.0d0 2928 amu(1)=0.362683783378362 2929 amu(2)=amu(1) 2930 amu(3)=0.313706645877887 2931 amu(4)=amu(3) 2932 amu(5)=0.222381034453374 2933 amu(6)=amu(5) 2934 amu(7)=0.101228536290376 2935 amu(8)=amu(7) 2936 beta=1.0d0 2937 end if 2938 c!!!!!!!!!!!!!!!!!!!!!!! 2939 2940 ccc 2941 ccc determine abundances included in the absorber amount 2942 ccc 2943 2944 c first, set up the grid ready for interpolation. 2945 do i=1,nzy 2946 zyd(i) = dble(zy(i)) 2947 enddo 2948 do i=1,nl 2949 zld(i) = dble(zl(i)) 2950 enddo 2951 2952 2953 c 2nd: correccion a la n10(i) (cantidad de absorbente en el lower state) 2954 c por similitud a la que se hace en cza.for 2955 2956 do i=1,nzy 2957 if (isot.eq.5) then 2958 con(i) = dble( coy(i) * imrco ) 2959 else 2960 con(i) = dble( co2y(i) * imr(isot) ) 2961 c vibr. temp of the bending mode : 2962 if(isot.eq.1) call interdp(tvtbs,zyd,nzy,v626t1,zld,nl,1) 2963 if(isot.eq.2) call interdp(tvtbs,zyd,nzy,v628t1,zld,nl,1) 2964 if(isot.eq.3) call interdp(tvtbs,zyd,nzy,v636t1,zld,nl,1) 2965 if(isot.eq.4) call interdp(tvtbs,zyd,nzy,v627t1,zld,nl,1) 2966 correc = 2.d0 * dexp( dble(-ee*elow(isot,2))/tvtbs(i) ) 2967 con(i) = con(i) * ( 1.d0 - correc ) 2968 endif 2969 c----------------------------------------------------------------------- 2970 c mlp & cristina. 17 july 1996 2971 c change the calculation of mr. it is used for calculating partial press 2972 c alpha = alpha(self,co2)*pp +alpha(n2)*(pt-pp) 2973 c for an isotope, if mr is obtained by co2*imr(iso)/nt we are considerin 2974 c collisions with other co2 isotopes (including the major one, 626) 2975 c as if they were with n2. assuming mr as co2/nt, we consider collisions 2976 c of type 628-626 as of 626-626 instead of as 626-n2. 2977 c mrx(i)=con(i)/ntx(i) ! old malv 2978 2979 ! mrx(i)= dble(co2x(i)/ntx(i)) ! mlp & crs 2980 2981 c jan 98: 2982 c esta modif de mlp implica anular el correc (deberia revisar esto) 2983 mr(i) = dble(co2y(i)/nty(i)) ! malv, jan 98 2984 2985 c----------------------------------------------------------------------- 2986 2987 end do 2988 2989 ! como beta y 1.d5 son comunes a todas las weighted absorber amounts, 2990 ! los simplificamos: 2991 ! coninf = beta * 1.d5 * dble( con(n) / log( con(n-1) / con(n) ) ) 2992 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 2993 2994 ! write (*,*) ' coninf =', coninf 2995 2996 ccc 2997 ccc temp dependence of the band strength and 2998 ccc nlte correction factor for the absorber amount 2999 ccc 3000 call mztf_correccion ( coninf, con, ib, isot, itableout ) 3001 3002 ccc 3003 ccc reads histogrammed spectral data (strength for lte and vmr=1) 3004 ccc 3005 !hfile1 = dirspec//'hi'//dn ! ya no distinguimos entre d/n 3006 !! hfile1 = dirspec//'hid' ! (see why in his.for) 3007 ! hfile='hid' 3008 !! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = dirspec//'his' 3009 ! if (ib.eq.13 .or. ib.eq.14 ) hfile1 = 'his' 3010 ! 3011 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3012 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3013 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode1//'.dat' 3014 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode1//'.dat' 3015 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode1//'.dat' 3016 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode1//'.dat' 3017 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode1//'.dat' 3018 ! else 3019 ! if (isot.eq.1) hisfile = hfile1//'26-'//ibcode2//'.dat' 3020 ! if (isot.eq.2) hisfile = hfile1//'28-'//ibcode2//'.dat' 3021 ! if (isot.eq.3) hisfile = hfile1//'36-'//ibcode2//'.dat' 3022 ! if (isot.eq.4) hisfile = hfile1//'27-'//ibcode2//'.dat' 3023 ! if (isot.eq.5) hisfile = hfile1//'62-'//ibcode2//'.dat' 3024 ! endif 3025 ! write (*,*) 'hisfile: ', hisfile 3026 3027 ! the argument to rhist is to make this compatible with mztf_comp.f, 3028 ! which is a useful modification of mztf.f (to change strengths of bands 3029 ! call rhist (1.0) 3030 if(ib.eq.1) then 3031 if(isot.eq.1) then !Case 1 3032 mm=mm_c1 3033 nbox=nbox_c1 3034 tmin=tmin_c1 3035 tmax=tmax_c1 3036 do i=1,nbox_max 3037 no(i)=no_c1(i) 3038 dist(i)=dist_c1(i) 3039 do j=1,nhist 3040 sk1(j,i)=sk1_c1(j,i) 3041 xls1(j,i)=xls1_c1(j,i) 3042 xln1(j,i)=xln1_c1(j,i) 3043 xld1(j,i)=xld1_c1(j,i) 3044 enddo 3045 enddo 3046 do j=1,nhist 3047 thist(j)=thist_c1(j) 3048 enddo 3049 else if(isot.eq.2) then !Case 2 3050 mm=mm_c2 3051 nbox=nbox_c2 3052 tmin=tmin_c2 3053 tmax=tmax_c2 3054 do i=1,nbox_max 3055 no(i)=no_c2(i) 3056 dist(i)=dist_c2(i) 3057 do j=1,nhist 3058 sk1(j,i)=sk1_c2(j,i) 3059 xls1(j,i)=xls1_c2(j,i) 3060 xln1(j,i)=xln1_c2(j,i) 3061 xld1(j,i)=xld1_c2(j,i) 3062 enddo 3063 enddo 3064 do j=1,nhist 3065 thist(j)=thist_c2(j) 3066 enddo 3067 else if(isot.eq.3) then !Case 3 3068 mm=mm_c3 3069 nbox=nbox_c3 3070 tmin=tmin_c3 3071 tmax=tmax_c3 3072 do i=1,nbox_max 3073 no(i)=no_c3(i) 3074 dist(i)=dist_c3(i) 3075 do j=1,nhist 3076 sk1(j,i)=sk1_c3(j,i) 3077 xls1(j,i)=xls1_c3(j,i) 3078 xln1(j,i)=xln1_c3(j,i) 3079 xld1(j,i)=xld1_c3(j,i) 3080 enddo 3081 enddo 3082 do j=1,nhist 3083 thist(j)=thist_c3(j) 3084 enddo 3085 else if(isot.eq.4) then !Case 4 3086 mm=mm_c4 3087 nbox=nbox_c4 3088 tmin=tmin_c4 3089 tmax=tmax_c4 3090 do i=1,nbox_max 3091 no(i)=no_c4(i) 3092 dist(i)=dist_c4(i) 3093 do j=1,nhist 3094 sk1(j,i)=sk1_c4(j,i) 3095 xls1(j,i)=xls1_c4(j,i) 3096 xln1(j,i)=xln1_c4(j,i) 3097 xld1(j,i)=xld1_c4(j,i) 3098 enddo 3099 enddo 3100 do j=1,nhist 3101 thist(j)=thist_c4(j) 3102 enddo 3103 else 3104 write(*,*)'isot must be 2,3 or 4 for ib=1!!' 3105 write(*,*)'stop at mztf_overlap/317' 3106 stop 3107 endif 3108 else if (ib.eq.2) then 3109 if(isot.eq.1) then !Case 5 3110 mm=mm_c5 3111 nbox=nbox_c5 3112 tmin=tmin_c5 3113 tmax=tmax_c5 3114 do i=1,nbox_max 3115 no(i)=no_c5(i) 3116 dist(i)=dist_c5(i) 3117 do j=1,nhist 3118 sk1(j,i)=sk1_c5(j,i) 3119 xls1(j,i)=xls1_c5(j,i) 3120 xln1(j,i)=xln1_c5(j,i) 3121 xld1(j,i)=xld1_c5(j,i) 3122 enddo 3123 enddo 3124 do j=1,nhist 3125 thist(j)=thist_c5(j) 3126 enddo 3127 else 3128 write(*,*)'isot must be 1 for ib=2!!' 3129 write(*,*)'stop at mztf_overlap/341' 3130 stop 3131 endif 3132 else if (ib.eq.3) then 3133 if(isot.eq.1) then !Case 6 3134 mm=mm_c6 3135 nbox=nbox_c6 3136 tmin=tmin_c6 3137 tmax=tmax_c6 3138 do i=1,nbox_max 3139 no(i)=no_c6(i) 3140 dist(i)=dist_c6(i) 3141 do j=1,nhist 3142 sk1(j,i)=sk1_c6(j,i) 3143 xls1(j,i)=xls1_c6(j,i) 3144 xln1(j,i)=xln1_c6(j,i) 3145 xld1(j,i)=xld1_c6(j,i) 3146 enddo 3147 enddo 3148 do j=1,nhist 3149 thist(j)=thist_c6(j) 3150 enddo 3151 else 3152 write(*,*)'isot must be 1 for ib=3!!' 3153 write(*,*)'stop at mztf_overlap/365' 3154 stop 3155 endif 3156 else if (ib.eq.4) then 3157 if(isot.eq.1) then !Case 7 3158 mm=mm_c7 3159 nbox=nbox_c7 3160 tmin=tmin_c7 3161 tmax=tmax_c7 3162 do i=1,nbox_max 3163 no(i)=no_c7(i) 3164 dist(i)=dist_c7(i) 3165 do j=1,nhist 3166 sk1(j,i)=sk1_c7(j,i) 3167 xls1(j,i)=xls1_c7(j,i) 3168 xln1(j,i)=xln1_c7(j,i) 3169 xld1(j,i)=xld1_c7(j,i) 3170 enddo 3171 enddo 3172 do j=1,nhist 3173 thist(j)=thist_c7(j) 3174 enddo 3175 else 3176 write(*,*)'isot must be 1 for ib=4!!' 3177 write(*,*)'stop at mztf_overlap/389' 3178 stop 3179 endif 3180 else 3181 write(*,*)'ib must be 1,2,3 or 4!!' 3182 write(*,*)'stop at mztf_overlap/394' 3183 endif 3184 3185 if (isot.ne.5) deltanux = deltanu(isot,ib) 3186 if (isot.eq.5) deltanux = deltanuco 3187 3188 c****** 3189 c****** calculation of tauinf(nl) 3190 c****** 3191 call initial 3192 3193 ff=1.0e10 3194 3195 do i=nl,1,-1 3196 3197 if(i.eq.nl)then 3198 3199 call intz (zl(i),c2,p2,mr2,t2, con) 3200 do kr=1,nbox 3201 ta(kr)=t2 3202 end do 3203 ! write (*,*) ' i, t2 =', i, t2 3204 call interstrength (st2,t2,ka,ta) 3205 aa = p2 * coninf * mr2 * (st2 * ff) 3206 bb = p2 * coninf * st2 3207 cc = coninf * st2 3208 dd = t2 * coninf * st2 3209 do kr=1,nbox 3210 ccbox(kr) = coninf * ka(kr) 3211 ddbox(kr) = t2 * ccbox(kr) 3212 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 3213 c2box(kr) = c2 * ka(kr) * dble(deltaz) 3214 end do 3215 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.d5 3216 c2 = c2 * st2 * dble(deltaz) 3217 3218 else 3219 call intz (zl(i),c1,p1,mr1,t1, con) 3220 do kr=1,nbox 3221 ta(kr)=t1 3222 end do 3223 ! write (*,*) ' i, t1 =', i, t1 3224 call interstrength (st1,t1,ka,ta) 3225 do kr=1,nbox 3226 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 3227 c1box(kr) = c1 * ka(kr) * dble(deltaz) 3228 end do 3229 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 3230 c1 = c1 * st1 * dble(deltaz) 3231 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 3232 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 3233 cc = cc + ( c1 + c2 ) / 2.d0 3234 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 3235 do kr=1,nbox 3236 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) )/2.d0 3237 ddbox(kr) = ddbox(kr) + (t1*c1box(kr)+t2*c2box(kr))/2.d0 3238 end do 3239 3240 mr2 = mr1 3241 c2=c1 3242 do kr=1,nbox 3243 c2box(kr) = c1box(kr) 3244 end do 3245 t2=t1 3246 p2=p1 3247 end if 3248 3249 pt = bb / cc 3250 pp = aa / (cc*ff) 3251 3252 ! ta=dd/cc 3253 ! tdop = ta 3254 ts = dd/cc 3255 do kr=1,nbox 3256 ta(kr) = ddbox(kr) / ccbox(kr) 3257 end do 3258 ! write (*,*) ' i, ts =', i, ts 3259 call interstrength(st,ts,ka,ta) 3260 ! call intershape(alsa,alna,alda,tdop) 3261 call intershape(alsa,alna,alda,ta) 3262 3263 * ua = cc/st 3264 3265 c next loop calculates the eqw for an especified path ua,pp,pt,ta 3266 3267 eqwmu = 0.0d0 3268 do im = 1,iimu 3269 eqw=0.0d0 3270 do kr=1,nbox 3271 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 3272 if(ua(kr).lt.0.)write(*,*)'mztf_overlap/483',ua(kr), 3273 $ ccbox(kr),ka(kr),beta,mu(im),kr,im,i,nl 3274 3275 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 3276 if ( i_supersat .eq. 0 ) then 3277 eqw=eqw+no(kr)*w 3278 else 3279 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 3280 endif 3281 end do 3282 eqwmu = eqwmu + eqw * mu(im)*amu(im) 3283 end do 3284 3285 tauinf(i) = exp( - eqwmu / dble(deltanux) ) 3286 3287 end do ! i continue 3288 3289 ! if ( isot.eq.1 .and. ib.eq.2 ) then 3290 ! write (*,*) ' tauinf(nl) = ', tauinf(nl) 3291 ! write (*,*) ' tauinf(1) = ', tauinf(1) 3292 ! endif 3293 3294 c****** 3295 c****** calculation of tau(in,ir) for n<=r 3296 c****** 3297 3298 do 1 in=1,nl-1 3299 3300 call initial 3301 call intz (zl(in), c1,p1,mr1,t1, con) 3302 do kr=1,nbox 3303 ta(kr) = t1 3304 end do 3305 call interstrength (st1,t1,ka,ta) 3306 do kr=1,nbox 3307 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 3308 c1box(kr) = c1 * ka(kr) * dble(deltaz) 3309 end do 3310 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 3311 c1 = c1 * st1 * dble(deltaz) 3312 3313 do 2 ir=in,nl-1 3314 3315 if (ir.eq.in) then 3316 tau(in,ir) = 1.d0 3317 goto 2 3318 end if 3319 3320 call intz (zl(ir), c2,p2,mr2,t2, con) 3321 do kr=1,nbox 3322 ta(kr) = t2 3323 end do 3324 call interstrength (st2,t2,ka,ta) 3325 do kr=1,nbox 3326 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 3327 c2box(kr) = c2 * ka(kr) * dble(deltaz) 3328 end do 3329 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.e5 3330 c2 = c2 * st2 * dble(deltaz) 3331 3332 c aa = aa + ( p1*mr1*c1 + p2*mr2*c2 ) / 2.d0 3333 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 3334 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 3335 cc = cc + ( c1 + c2 ) / 2.d0 3336 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 3337 do kr=1,nbox 3338 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 3339 ddbox(kr) = ddbox(kr) + 3340 $ ( t1*c1box(kr) + t2*c2box(kr) ) /2.d0 3341 end do 3342 3343 mr1=mr2 3344 t1=t2 3345 c1=c2 3346 p1=p2 3347 do kr=1,nbox 3348 c1box(kr) = c2box(kr) 3349 end do 3350 3351 pt = bb / cc 3352 pp = aa / (cc * ff) 3353 3354 * ta=dd/cc 3355 * tdop = ta 3356 ts = dd/cc 3357 do kr=1,nbox 3358 ta(kr) = ddbox(kr) / ccbox(kr) 3359 end do 3360 call interstrength(st,ts,ka,ta) 3361 call intershape(alsa,alna,alda,ta) 3362 * ua = cc/st 3363 3364 c next loop calculates the eqw for an especified path ua,pp,pt,ta 3365 3366 eqwmu = 0.0d0 3367 do im = 1,iimu 3368 eqw=0.0d0 3369 do kr=1,nbox 3370 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 3371 if(ua(kr).lt.0.)write(*,*)'mztf_overlap/581',ua(kr), 3372 $ ccbox(kr),ka(kr),beta,mu(im),kr,im,i,nl 3373 3374 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 3375 if ( i_supersat .eq. 0 ) then 3376 eqw=eqw+no(kr)*w 3377 else 3378 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 3379 endif 3380 end do 3381 eqwmu = eqwmu + eqw * mu(im)*amu(im) 3382 end do 3383 3384 tau(in,ir) = exp( - eqwmu / dble(deltanux) ) 3385 3386 2 continue 3387 3388 1 continue 3389 3390 ! if ( isot.eq.1 .and. ib.eq.2 ) then 3391 ! write (*,*) ' tau(1,*) , *=1,20 ' 3392 ! write (*,*) ( sngl(tau(1,k)), k=1,20 ) 3393 ! endif 3394 3395 3396 c********** 3397 c********** calculation of tau(in,ir) for n>r 3398 c********** 3399 3400 in=nl 3401 3402 call initial 3403 call intz (zl(in), c1,p1,mr1,t1, con) 3404 do kr=1,nbox 3405 ta(kr) = t1 3406 end do 3407 call interstrength (st1,t1,ka,ta) 3408 do kr=1,nbox 3409 ! c1box(kr) = c1 * ka(kr) * beta * dble(deltaz) * 1.d5 3410 c1box(kr) = c1 * ka(kr) * dble(deltaz) 3411 end do 3412 ! c1 = c1 * st1 * beta * dble(deltaz) * 1.d5 3413 c1 = c1 * st1 * dble(deltaz) 3414 3415 do 4 ir=in-1,1,-1 3416 3417 call intz (zl(ir), c2,p2,mr2,t2, con) 3418 do kr=1,nbox 3419 ta(kr) = t2 3420 end do 3421 call interstrength (st2,t2,ka,ta) 3422 do kr=1,nbox 3423 ! c2box(kr) = c2 * ka(kr) * beta * dble(deltaz) * 1.d5 3424 c2box(kr) = c2 * ka(kr) * dble(deltaz) 3425 end do 3426 ! c2 = c2 * st2 * beta * dble(deltaz) * 1.d5 3427 c2 = c2 * st2 * dble(deltaz) 3428 3429 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 3430 bb = bb + ( p1*c1 + p2*c2 ) / 2.d0 3431 cc = cc + ( c1 + c2 ) / 2.d0 3432 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 3433 do kr=1,nbox 3434 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 3435 ddbox(kr) = ddbox(kr) + ( t1*c1box(kr) + t2*c2box(kr) )/2.d0 3436 end do 3437 3438 mr1=mr2 3439 c1=c2 3440 t1=t2 3441 p1=p2 3442 do kr=1,nbox 3443 c1box(kr) = c2box(kr) 3444 end do 3445 3446 pt = bb / cc 3447 pp = aa / (cc * ff) 3448 ts = dd / cc 3449 do kr=1,nbox 3450 ta(kr) = ddbox(kr) / ccbox(kr) 3451 end do 3452 call interstrength (st,ts,ka,ta) 3453 call intershape (alsa,alna,alda,ta) 3454 3455 * ua = cc/st 3456 3457 c next loop calculates the eqw for an especified path ua,pp,pt,ta 3458 3459 eqwmu = 0.0d0 3460 do im = 1,iimu 3461 eqw=0.0d0 3462 do kr=1,nbox 3463 ua(kr) = ccbox(kr) / ka(kr) * beta * 1.0d5 / mu(im) 3464 if(ua(kr).lt.0.)write(*,*)'mztf_overlap/674',ua(kr), 3465 $ ccbox(kr),ka(kr),beta,mu(im),kr,im,i,nl 3466 3467 call findw(ig,iirw, idummy,c1,p1,Desp,wsL) 3468 if ( i_supersat .eq. 0 ) then 3469 eqw=eqw+no(kr)*w 3470 else 3471 eqw = w + (no(kr)-1) * ( asat_box*dist(kr) ) 3472 endif 3473 end do 3474 eqwmu = eqwmu + eqw * mu(im)*amu(im) 3475 end do 3476 3477 tau(in,ir) = exp( - eqwmu / dble(deltanux) ) 3478 3479 4 continue 3480 3481 c 3482 c due to the simmetry of the transmittances 3483 c 3484 do in=nl-1,2,-1 3485 do ir=in-1,1,-1 3486 tau(in,ir) = tau(ir,in) 3487 end do 3488 end do 3489 3490 3491 ccc 3492 ccc writing out transmittances 3493 ccc 3494 if (itauout.eq.1) then 3495 3496 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3497 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3498 ! open( 1, file= 3499 ! @ dircurtis//'taul'//isotcode//dn//ibcode1//'.dat', 3500 ! @ access='sequential', form='unformatted' ) 3501 ! else 3502 ! open( 1, file= 3503 ! @ dircurtis//'taul'//isotcode//dn//ibcode2//'.dat', 3504 ! @ access='sequential', form='unformatted' ) 3505 ! endif 3506 3507 ! write(1) dummy 3508 ! write(1)' format: (tauinf(n),(tau(n,r),r=1,nl),n=1,nl)' 3509 ! do in=1,nl 3510 ! write (1) tauinf(in), ( tau(in,ir), ir=1,nl ) 3511 ! end do 3512 ! close(unit=1) 3513 3514 elseif (itauout.eq.2) then 3515 3516 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3517 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3518 ! open( 1, file= 3519 ! @ dircurtis//'taul'//isotcode//dn//ibcode1//'.dat') 3520 ! else 3521 ! open( 1, file= 3522 ! @ dircurtis//'taul'//isotcode//dn//ibcode2//'.dat') 3523 ! endif 3524 3525 ! !write(1,*) dummy 3526 ! !write(1,*) 'tij for curtis matrix calculations ' 3527 ! !write(1,*)' cira mars model atmosphere ' 3528 ! write(1,*)' beta= ',beta,'deltanu= ',deltanux 3529 ! write(1,*)' number of elements (in,ir)= ',nl,nl 3530 ! write(1,*)' format: (tauinf(in),(tau(in,ir),ir=1,nl),in=1,nl)' 3531 3532 ! do in=1,nl 3533 ! write (1,*) tauinf(in) 3534 ! do ir=1,nl 3535 ! write(1,*) tau(in,ir) 3536 ! end do 3537 ! end do 3538 ! close(unit=1) 3539 3540 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3541 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3542 ! write (*,'(1x, 31htransmitances written out in: ,a22)') 3543 ! @ 'taul'//isotcode//dn//ibcode1 3544 ! else 3545 ! write (*,'(1x, 31htransmitances written out in: ,a22)') 3546 ! @ 'taul'//isotcode//dn//ibcode2 3547 ! endif 3548 3549 end if 3550 3551 c cleaning of transmittances 3552 ! call elimin_tau(tau,tauinf,nl,nan,itableout,nw,dummy, 3553 ! @ isotcode,dn,ibcode2) 3554 3555 c construction of the curtis matrix 3556 3557 call mzcf ( tauinf,tau, cf,cfup,cfdw, vc,taugr, 3558 @ ib,isot,icfout,itableout ) 3559 3560 3561 c end 3562 return 3563 end 3564 3565 3566 3567 3568 c*********************************************************************** 3569 c mzcf 3570 c*********************************************************************** 3571 3572 subroutine mzcf( tauinf,tau, c,cup,cdw,vc,taugr, 3573 @ ib,isot,icfout,itableout ) 3574 3575 c a.k.murphy method to avoid extrapolation in the curtis matrix 3576 c feb-89 m. angel granada 3577 c 25-sept-96 cristina dejar las matrices en doble precision 3578 c jan 98 malv version para mz1d 3579 c jul 2011 malv+fgg adapted to LMD-MGCM 3580 c*********************************************************************** 3581 3582 implicit none 3583 3584 include 'comcstfi.h' 1077 1078 1079 c arguments 1080 real*8 c(nl,nl) ! o 1081 real*8 vc(nl) ! o 1082 real*8 tau(nl,nl) ! i 1083 real*8 tauinf(nl) ! i 1084 integer ib ! i 1085 1086 c local variables 1087 integer i, in, ir, isot 1088 real*8 a(nl,nl), cf(nl,nl), pideltanu, deltazdbl,pi 1089 1090 c*********************************************************************** 1091 1092 pi=3.141592 1093 isot = 1 1094 pideltanu = pi*dble(deltanu(isot,ib)) 1095 deltazdbl = dble(deltaz) 1096 c 1097 do in=1,nl 1098 1099 do ir=1,nl 1100 1101 cf(in,ir) = 0.0d0 1102 c(in,ir) = 0.0d0 1103 a(in,ir) = 0.0d0 1104 1105 end do 1106 1107 vc(in) = 0.0d0 1108 1109 end do 1110 1111 1112 c 1113 do in=1,nl 1114 do ir=1,nl 1115 1116 if (ir.eq.1) then 1117 cf(in,ir) = tau(in,ir) - tau(in,1) 1118 elseif (ir.eq.nl) then 1119 cf(in,ir) = tauinf(in) - tau(in,ir-1) 1120 else 1121 cf(in,ir) = tau(in,ir) - tau(in,ir-1) 1122 end if 1123 1124 end do 1125 end do 1126 1127 1128 c 1129 do in=2,nl-1 1130 do ir=1,nl 1131 if (ir.eq.in+1) a(in,ir) = -1.d0 1132 if (ir.eq.in-1) a(in,ir) = +1.d0 1133 a(in,ir) = a(in,ir) / ( 2.d5*deltazdbl ) 1134 end do 1135 end do 1136 1137 c 1138 do in=1,nl 1139 do ir=1,nl 1140 cf(in,ir) = cf(in,ir) * pideltanu 1141 end do 1142 end do 1143 1144 1145 do in=2,nl-1 1146 do ir=1,nl 1147 do i=1,nl 1148 c(in,ir) = c(in,ir) + a(in,i) * cf(i,ir) 1149 end do 1150 end do 1151 vc(in) = pideltanu /( 2.d5*deltazdbl ) * 1152 @ ( tau(in-1,1) - tau(in+1,1) ) 1153 end do 1154 1155 c 1156 do in=2,nl-1 1157 c(in,nl-2) = c(in,nl-2) - c(in,nl) 1158 c(in,nl-1) = c(in,nl-1) + 2.d0*c(in,nl) 1159 end do 1160 1161 1162 c end 1163 return 1164 end 1165 1166 1167 1168 c *** Old MZESC121_dlvr11_03.f *** 1169 1170 c*********************************************************************** 1171 subroutine MZESC121 1172 c*********************************************************************** 1173 1174 implicit none 1175 3585 1176 include 'nlte_paramdef.h' 3586 1177 include 'nlte_commons.h' 3587 3588 c arguments 3589 real*8 c(nl,nl), cup(nl,nl), cdw(nl,nl) ! o 3590 real*8 vc(nl), taugr(nl) ! o 3591 real*8 tau(nl,nl) ! i 3592 real*8 tauinf(nl) ! i 3593 integer ib ! i 3594 integer isot ! i 3595 integer icfout, itableout ! i 3596 3597 c external 3598 external bandid 3599 character*2 bandid 3600 3601 c local variables 3602 integer i, in, ir, iw 3603 real*8 cfup(nl,nl), cfdw(nl,nl) 3604 real*8 a(nl,nl), cf(nl,nl) 3605 character isotcode*2, bcode*2 3606 3607 c formats 3608 101 format(i1) 3609 202 format(i2) 3610 180 format(a80) 3611 181 format(a80) 3612 c*********************************************************************** 3613 3614 if (isot.eq.1) isotcode = '26' 3615 if (isot.eq.2) isotcode = '28' 3616 if (isot.eq.3) isotcode = '36' 3617 if (isot.eq.4) isotcode = '27' 3618 if (isot.eq.5) isotcode = 'co' 3619 bcode = bandid( ib ) 3620 3621 ! write (*,*) ' ' 3622 3623 do in=1,nl 3624 3625 do ir=1,nl 3626 3627 cf(in,ir) = 0.0d0 3628 cfup(in,ir) = 0.0d0 3629 cfdw(in,ir) = 0.0d0 3630 c(in,ir) = 0.0d0 3631 cup(in,ir) = 0.0d0 3632 cdw(in,ir) = 0.0d0 3633 a(in,ir) = 0.0d0 3634 3635 end do 3636 3637 vc(in) = 0.0d0 3638 taugr(in) = 0.0d0 3639 3640 end do 3641 3642 3643 c the next lines are a reduced and equivalent way of calculating 3644 c the c(in,ir) elements for n=2,nl1 and r=1,nl 3645 3646 3647 c do in=2,nl1 3648 c do ir=1,nl 3649 c if(ir.eq.1)then 3650 c c(in,ir)=tau(in-1,1)-tau(in+1,1) 3651 c elseif(ir.eq.nl)then 3652 c c(in,ir)=tau(in+1,nl1)-tauinf(in+1)-tau(in-1,nl1)+tauinf(in-1) 3653 c else 3654 c c(in,ir)=tau(in+1,ir-1)-tau(in+1,ir)-tau(in-1,ir-1)+tau(in-1,ir) 3655 c end if 3656 c c(in,ir)=c(in,ir)*pi*deltanu(ib)/(2.*deltaz*1.0e5) 3657 c end do 3658 c end do 3659 c go to 1000 3660 3661 c calculation of the matrix cfup(nl,nl) 3662 3663 cfup(1,1) = 1.d0 - tau(1,1) 3664 3665 do in=2,nl 3666 do ir=1,in 3667 3668 if (ir.eq.1) then 3669 cfup(in,ir) = tau(in,ir) - tau(in,1) 3670 elseif (ir.eq.in) then 3671 cfup(in,ir) = 1.d0 - tau(in,ir-1) 3672 else 3673 cfup(in,ir) = tau(in,ir) - tau(in,ir-1) 3674 end if 3675 3676 end do 3677 end do 3678 3679 ! contribution to upwards fluxes from bb at bottom : 3680 do in=1,nl 3681 taugr(in) = tau(in,1) 3682 enddo 3683 3684 c calculation of the matrix cfdw(nl,nl) 3685 3686 cfdw(nl,nl) = 1.d0 - tauinf(nl) 3687 3688 do in=1,nl-1 3689 do ir=in,nl 3690 3691 if (ir.eq.in) then 3692 cfdw(in,ir) = 1.d0 - tau(in,ir) 3693 elseif (ir.eq.nl) then 3694 cfdw(in,ir) = tau(in,ir-1) - tauinf(in) 3695 else 3696 cfdw(in,ir) = tau(in,ir-1) - tau(in,ir) 3697 end if 3698 3699 end do 3700 end do 3701 3702 3703 c calculation of the matrix cf(nl,nl) 3704 3705 do in=1,nl 3706 do ir=1,nl 3707 3708 if (ir.eq.1) then 3709 ! version con l_bb(tg) = l_bb(t(1))=j(1) (see also vc below) 3710 ! cf(in,ir) = tau(in,ir) 3711 ! version con l_bb(tg) =/= l_bb(t(1))=j(1) (see also vc below) 3712 cf(in,ir) = tau(in,ir) - tau(in,1) 3713 elseif (ir.eq.nl) then 3714 cf(in,ir) = tauinf(in) - tau(in,ir-1) 3715 else 3716 cf(in,ir) = tau(in,ir) - tau(in,ir-1) 3717 end if 3718 3719 end do 3720 end do 3721 3722 3723 c definition of the a(nl,nl) matrix 3724 3725 do in=2,nl-1 3726 do ir=1,nl 3727 if (ir.eq.in+1) a(in,ir) = -1.d0 3728 if (ir.eq.in-1) a(in,ir) = +1.d0 3729 a(in,ir) = a(in,ir) / ( 2.d0*deltaz*1.d5 ) 3730 end do 3731 end do 3732 ! this is not needed anymore in the akm scheme 3733 ! a(1,1) = +3.d0 3734 ! a(1,2) = -4.d0 3735 ! a(1,3) = +1.d0 3736 ! a(nl,nl) = -3.d0 3737 ! a(nl,nl1) = +4.d0 3738 ! a(nl,nl2) = -1.d0 3739 3740 c calculation of the final curtis matrix ("reduced" by murphy's method) 3741 3742 if (isot.ne.5) then 3743 do in=1,nl 3744 do ir=1,nl 3745 cf(in,ir) = cf(in,ir) * pi*deltanu(isot,ib) 3746 cfup(in,ir) = cfup(in,ir) * pi*deltanu(isot,ib) 3747 cfdw(in,ir) = cfdw(in,ir) * pi*deltanu(isot,ib) 3748 end do 3749 taugr(in) = taugr(in) * pi*deltanu(isot,ib) 3750 end do 3751 else 3752 do in=1,nl 3753 do ir=1,nl 3754 cf(in,ir) = cf(in,ir) * pi*deltanuco 3755 enddo 3756 taugr(in) = taugr(in) * pi*deltanuco 3757 enddo 3758 endif 3759 3760 do in=2,nl-1 3761 3762 do ir=1,nl 3763 3764 do i=1,nl 3765 ! only c contains the matrix a. matrixes cup,cdw dont because 3766 ! these two will be used for flux calculations, not 3767 ! only for flux divergencies 3768 3769 c(in,ir) = c(in,ir) + a(in,i) * cf(i,ir) 3770 ! from this matrix we will extract (see below) the 3771 ! nl2 x nl2 "core" for the "reduced" final curtis matrix. 3772 3773 end do 3774 cup(in,ir) = cfup(in,ir) 3775 cdw(in,ir) = cfdw(in,ir) 3776 3777 end do 3778 ! version con l_bb(tg) = l_bb(t(1))=j(1) (see cf above) 3779 !vc(in) = c(in,1) 3780 ! version con l_bb(tg) =/= l_bb(t(1))=j(1) (see cf above) 3781 vc(in) = pi*deltanu(isot,ib)/( 2.d0*deltaz*1.d5 ) * 3782 @ ( tau(in-1,1) - tau(in+1,1) ) 3783 3784 end do 3785 3786 5 continue 3787 3788 ! write (*,*) 'mztf/1/ c(2,*) =', (c(2,i), i=1,nl) 3789 3790 ! call elimin_dibuja(c,nl,itableout) 3791 3792 c ventana del smoothing de c es nw=3 y de vc es 5 (puesto en lisa): 3793 c subroutine elimin_mz4(c,vc,ilayer,nl,nan,iw, nw) 3794 3795 iw = nan 3796 if (isot.eq.4) iw = 5 3797 call elimin_mz1d (c,vc,0,iw,itableout,nw) 3798 3799 ! upper boundary condition 3800 ! j'(nl) = j'(nl1) ==> j(nl) = 2j(nl1) - j(nl2) ==> 3801 do in=2,nl-1 3802 c(in,nl-2) = c(in,nl-2) - c(in,nl) 3803 c(in,nl-1) = c(in,nl-1) + 2.d0*c(in,nl) 3804 cup(in,nl-2) = cup(in,nl-2) - cup(in,nl) 3805 cup(in,nl-1) = cup(in,nl-1) + 2.d0*cup(in,nl) 3806 cdw(in,nl-2) = cdw(in,nl-2) - cdw(in,nl) 3807 cdw(in,nl-1) = cdw(in,nl-1) + 2.d0*cdw(in,nl) 3808 end do 3809 ! j(nl) = j(nl1) ==> 3810 ! do in=2,nl1 3811 ! c(in,nl1) = c(in,nl1) + c(in,nl) 3812 ! end do 3813 3814 ! 1000 continue 3815 3816 if (icfout.eq.1) then 3817 3818 ! if (ib.eq.1 .or. ib.eq.12 .or. ib.eq.16 .or. ib.eq.18) then 3819 ! codmatrx = codmatrx_fb 3820 ! else 3821 ! codmatrx = codmatrx_hot 3822 ! end if 3823 3824 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3825 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3826 3827 ! open ( 1, access='sequential', form='unformatted', file= 3828 ! @ dircurtis//'cfl'//isotcode//dn//ibcode1//codmatrx//'.dat') 3829 ! open ( 2, access='sequential', form='unformatted', file= 3830 ! @ dircurtis//'cflup'//isotcode//dn//ibcode1//codmatrx//'.dat') 3831 ! open ( 3, access='sequential', form='unformatted', file= 3832 ! @ dircurtis//'cfldw'//isotcode//dn//ibcode1//codmatrx//'.dat') 3833 3834 ! else 3835 3836 ! open ( 1, access='sequential', form='unformatted', file= 3837 ! @ dircurtis//'cfl'//isotcode//dn//ibcode2//codmatrx//'.dat') 3838 ! open ( 2, access='sequential', form='unformatted', file= 3839 ! @ dircurtis//'cflup'//isotcode//dn//ibcode2//codmatrx//'.dat') 3840 ! open ( 3, access='sequential', form='unformatted', file= 3841 ! @ dircurtis//'cfldw'//isotcode//dn//ibcode2//codmatrx//'.dat') 3842 3843 ! endif 3844 3845 ! write(1) dummy 3846 ! write(1)' format: (vc(n),(ch(n,r),r=2,nl-1),n=2,nl-1)' 3847 ! do in=2,nl-1 3848 ! write(1) vc(in), (c(in,ir) , ir=2,nl-1 ) 3849 ! es mas importante la precision que ocupar mucho espacio asi que 3850 ! escribiremos las matrices en doble precision y por tanto en 3851 ! [lib]readc_mz4.for no hay que reconvertirlas a doble precision. 3852 ! ch is stored in single prec. to save storage space. 3853 ! end do 3854 3855 ! write(2) dummy 3856 ! write(2)' format: (cfup(n,r),r=1,nl), n=1,nl)' 3857 ! do in=1,nl 3858 ! write(2) ( cup(in,ir) , ir=1,nl ) 3859 ! end do 3860 3861 ! write(3) dummy 3862 ! write(3)' format: (cfdw(n,r),r=1,nl), n=1,nl)' 3863 ! do in=1,nl 3864 ! write(3) (cdw(in,ir) , ir=1,nl ) 3865 ! end do 3866 3867 ! if(ib.eq.1.or.ib.eq.2.or.ib.eq.3.or.ib.eq.4.or.ib.eq.5 3868 ! @ .or.ib.eq.6.or.ib.eq.7.or.ib.eq.8.or.ib.eq.9) then 3869 ! write (*,'(1x,30hcurtis matrix written out in: ,a50)' ) 3870 ! @ dircurtis//'cfl'//isotcode//dn//ibcode1//codmatrx//'.dat' 3871 ! else 3872 ! write (*,'(1x,30hcurtis matrix written out in: ,a50)' ) 3873 ! @ dircurtis//'cfl'//isotcode//dn//ibcode2//codmatrx//'.dat' 3874 ! endif 3875 3876 else 3877 3878 ! write (*,*) ' no curtis matrix output file ', char(10) 3879 3880 end if 3881 3882 3883 c end 3884 return 1178 1179 1180 c local variables 1181 integer i 1182 real*8 factor0200, factor0220, factor1000 1183 real*8 aux_0200(nl), aux2_0200(nl) 1184 real*8 aux_0220(nl), aux2_0220(nl) 1185 real*8 aux_1000(nl), aux2_1000(nl) 1186 1187 c*********************************************************************** 1188 1189 ! call zerov (taustar12, nl) 1190 taustar12(1:nl)=0.d0 1191 call zero2v(aux_0200,aux2_0200, nl) 1192 call zero2v(aux_0220,aux2_0220, nl) 1193 call zero2v(aux_1000,aux2_1000, nl) 1194 1195 call MZESC121sub (aux_0200,aux2_0200, 2 ) 1196 call MZESC121sub (aux_0220,aux2_0220, 3 ) 1197 call MZESC121sub (aux_1000,aux2_1000, 4 ) 1198 1199 factor0220 = 1.d0 1200 factor0200 = dble( (nu(1,2)-nu(1,1)) / (nu12_0200-nu(1,1)) ) 1201 factor1000 = dble( (nu(1,2)-nu(1,1)) / (nu12_1000-nu(1,1)) ) 1202 do i=1,nl 1203 taustar12(i) = taustar12(i) 1204 @ + aux_0200(i) * factor0200 1205 @ + aux_0220(i) * factor0220 1206 @ + aux_1000(i) * factor1000 1207 enddo 1208 1209 call mzescape_normaliz ( taustar12, 2 ) 1210 1211 c end 1212 return 3885 1213 end 3886 1214 3887 1215 3888 3889 3890 3891 c*********************************************************************** 3892 c cm15um_hb_simple 3893 c*********************************************************************** 3894 3895 subroutine cm15um_hb_simple (ig,icurt) 3896 3897 c computing the curtix matrixes for the 15 um hot bands 3898 c (las de las bandas fudnamentales las calcula cm15um_fb) 3899 3900 c jan 98 malv version de mod3/cm_15um.f para mz1d 3901 c jul 2011 malv+fgg adapted to LMD-MGCM 3902 c*********************************************************************** 3903 3904 implicit none 3905 3906 !!!!!!!!!!!!!!!!!!!!!!! 3907 ! common variables & constants 3908 1216 c *** Old MZESC121sub_dlvr11_03.f *** 1217 1218 c*********************************************************************** 1219 1220 subroutine MZESC121sub (taustar,tauinf, ib ) 1221 1222 c*********************************************************************** 1223 1224 implicit none 1225 1226 include 'datafile.h' 3909 1227 include 'nlte_paramdef.h' 3910 1228 include 'nlte_commons.h' 3911 3912 !!!!!!!!!!!!!!!!!!!!!!! 3913 ! arguments 3914 3915 integer ig ! ADDED FOR TRACEBACK 3916 integer icurt ! icurt=0,1,2 3917 ! new calculations? (see caa.f heads) 3918 3919 !!!!!!!!!!!!!!!!!!!!!!! 3920 ! local variables 3921 3922 real*4 cdummy(nl,nl), csngl(nl,nl) 3923 3924 real*8 cax1(nl,nl), cax2(nl,nl), cax3(nl,nl) 3925 real*8 v1(nl), v2(nl), v3(nl), cm_factor, vc_factor 3926 3927 integer itauout,icfout,itableout, interpol,ismooth, isngldble 3928 integer i,j,ik,ist,isot,ib,itt 3929 3930 !character bandcode*2 3931 character isotcode*2 3932 character codmatrx_hot*5 3933 3934 !!!!!!!!!!!!!!!!!!!!!!! 3935 ! external functions 3936 3937 external bandid 3938 character*2 bandid 3939 3940 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3941 ! subroutines called: 3942 ! mz4sub, dmzout, readc_mz4, readcupdw, mztf 3943 3944 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3945 ! formatos 3946 132 format(i2) 3947 1229 1230 1231 c arguments 1232 real*8 taustar(nl) ! o 1233 real*8 tauinf(nl) ! o 1234 integer ib ! i 1235 1236 1237 c local variables and constants 1238 integer i, iaquiHIST, iaquiZ, isot 1239 real*8 con(nzy), coninf 1240 real*8 c1, c2, ccc 1241 real*8 t1, t2 1242 real*8 p1, p2 1243 real*8 mr1, mr2 1244 real*8 st1, st2 1245 real*8 c1box(70), c2box(70) 1246 real*8 ff ! to avoid too small numbers 1247 real*8 tvtbs(nzy) 1248 real*8 st, beta, ts 1249 real*8 zld(nl), zyd(nzy) 1250 real*8 correc 1251 real*8 deltanudbl, deltazdbl 1252 real*8 yy 1253 1254 c external function 1255 external we_clean 1256 real*8 we_clean 1257 1258 c formats 1259 101 format(i1) 1260 1261 c*********************************************************************** 1262 1263 c 1264 beta = 1.8d5 1265 isot = 1 1266 write ( ibcode1, 101) ib 1267 deltanudbl = dble( deltanu(isot,ib) ) 1268 ff=1.0d10 1269 deltazdbl = dble(deltaz) 1270 1271 c 1272 do i=1,nzy 1273 zyd(i) = dble(zy(i)) 1274 enddo 1275 do i=1,nl 1276 zld(i) = dble(zl(i)) 1277 enddo 1278 1279 call interhuntdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 ) 1280 1281 do i=1,nzy 1282 con(i) = dble( co2y(i) * imr(isot) ) 1283 correc = 2.d0 * dexp( -ee*dble(elow(isot,2))/tvtbs(i) ) 1284 con(i) = con(i) * ( 1.d0 - correc ) 1285 mr(i) = dble(co2y(i)/nty(i)) 1286 end do 1287 1288 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 1289 call mztf_correccion ( coninf, con, ib ) 1290 1291 c 1292 call gethist_03 ( ib ) 1293 1294 c 1295 c tauinf 1296 c 1297 call initial 1298 1299 iaquiHIST = nhist/2 1300 iaquiZ = nzy - 2 1301 1302 do i=nl,1,-1 1303 1304 if(i.eq.nl)then 1305 1306 call intzhunt (iaquiZ, zl(i),c2,p2,mr2,t2, con) 1307 do kr=1,nbox 1308 ta(kr)=t2 1309 end do 1310 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 1311 aa = p2 * coninf * mr2 * (st2 * ff) 1312 cc = coninf * st2 1313 dd = t2 * coninf * st2 1314 do kr=1,nbox 1315 ccbox(kr) = coninf * ka(kr) 1316 ddbox(kr) = t2 * ccbox(kr) 1317 c2box(kr) = c2 * ka(kr) * deltazdbl 1318 end do 1319 c2 = c2 * st2 * deltazdbl 1320 1321 else 1322 call intzhunt (iaquiZ, zl(i),c1,p1,mr1,t1, con) 1323 do kr=1,nbox 1324 ta(kr)=t1 1325 end do 1326 call interstrhunt (iaquiHIST,st1,t1,ka,ta) 1327 do kr=1,nbox 1328 c1box(kr) = c1 * ka(kr) * deltazdbl 1329 end do 1330 c1 = c1 * st1 * deltazdbl 1331 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1332 cc = cc + ( c1 + c2 ) / 2.d0 1333 ccc = ( c1 + c2 ) / 2.d0 1334 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1335 do kr=1,nbox 1336 ccbox(kr) = ccbox(kr) + 1337 @ ( c1box(kr) + c2box(kr) )/2.d0 1338 ddbox(kr) = ddbox(kr) + 1339 @ ( t1*c1box(kr)+t2*c2box(kr) )/2.d0 1340 end do 1341 1342 mr2 = mr1 1343 c2=c1 1344 do kr=1,nbox 1345 c2box(kr) = c1box(kr) 1346 end do 1347 t2=t1 1348 p2=p1 1349 end if 1350 1351 pp = aa / (cc*ff) 1352 1353 ts = dd/cc 1354 do kr=1,nbox 1355 ta(kr) = ddbox(kr) / ccbox(kr) 1356 end do 1357 call interstrhunt(iaquiHIST,st,ts,ka,ta) 1358 call intershphunt(iaquiHIST,alsa,alda,ta) 1359 1360 c 1361 eqw=0.0d0 1362 do kr=1,nbox 1363 yy = ccbox(kr) * beta 1364 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 1365 eqw = eqw + no(kr)*w 1366 end do 1367 tauinf(i) = dexp( - eqw / deltanudbl ) 1368 if (tauinf(i).lt.0.d0) tauinf(i) = 0.0d0 1369 1370 if (i.eq.nl) then 1371 taustar(i) = 0.0d0 1372 else 1373 taustar(i) = deltanudbl * (tauinf(i+1)-tauinf(i)) 1374 @ / ( beta * ccc ) 1375 endif 1376 1377 end do 1378 1379 1380 1381 c end 1382 return 1383 end 1384 1385 1386 c *** Old MZTVC121_dlvr11.f *** 1387 1388 c*********************************************************************** 1389 1390 subroutine MZTVC121 1391 1392 c*********************************************************************** 1393 1394 implicit none 1395 1396 !!!!!!!!!!!!!!!!!!!!!!! 1397 ! common variables & constants 1398 1399 include 'nlte_paramdef.h' 1400 include 'nlte_commons.h' 1401 1402 1403 ! arguments 1404 integer ierr 1405 real*8 varerr 1406 1407 1408 ! local variables 1409 1410 real*8 v1(nl), vc_factor 1411 integer i,ik,ib 1412 3948 1413 ************************************************************************ 3949 ************************************************************************ 3950 3951 call zerom (c121,nl) 3952 3953 call zerov (vc121,nl) 3954 3955 call zerom (cup121,nl) 3956 call zerom (cdw121,nl) 3957 3958 call zerov (taugr121,nl) 3959 3960 3961 itauout = 0 ! =1 --> with output of tau 3962 icfout = 0 ! =1 --> with output of cf 3963 itableout = 0 ! =1 --> with output of table of taus 3964 isngldble = 1 ! =1 --> dble precission 3965 3966 codmatrx_hot=' ' 3967 if (icurt.eq.2) then 3968 icfout=1 3969 elseif (icurt.eq.0) then 3970 write (*,'(a,a$)') 3971 @ ' hot bands. code for old matrixes (5 chars): ' 3972 read (*,'(a)') codmatrx_hot 3973 endif 3974 3975 fileroot = 'cfl' 3976 3977 ! ====================== curtis matrixes for fh bands ================== 3978 3979 3980 ! una piedra en el camino ... 3981 ! write (*,*) ' cm15um_hb/1 ' 3982 3983 ccc 3984 if ( input_cza.ge.1 ) then 3985 ccc 3986 3987 if (icurt.eq.2) then 3988 write (*,'(a,a$)') 3989 @ ' new calculation of curt. mat. for fh bands.', 3990 @ ' code for new matrixes : ' 3991 read (*,'(a)') codmatrx_hot 3992 elseif (icurt.eq.0) then 3993 write (*,'(a,a$)') 3994 @ ' reading in curt. mat. for fh bands.', 3995 @ ' code for old matrixes : ' 3996 read (*,'(a)') codmatrx_hot 3997 else 3998 ! write (*,'(a)') 3999 ! @ ' new calculation of curt. mat. for fh bands.' 4000 end if 4001 4002 ! fh bands for the 626 isotope ================================- 4003 4004 ist = 1 4005 isot = 26 4006 ! encode (2,132,isotcode) isot 4007 write (isotcode,132) isot 4008 4009 do 11, ik=1,3 4010 4011 ib=ik+1 4012 4013 if (icurt.gt.0) then 4014 call zero3m (cax1,cax2,cax3,nl) 4015 ! una piedra en el camino ... 4016 !write (*,*) ' cm15um_hb/11 ' 4017 !write (*,*) ' ib, ist, irw, imu =', ib, ist, irw_mztf, imu 4018 call mztf(ig,cax1,cax2,cax3,v1,v2,ib,ist,irw_mztf,imu, 4019 @ itauout,icfout,itableout) 4020 ! else 4021 ! bandcode = bandid(ib) 4022 ! filend=isotcode//dn//bandcode//codmatrx_hot 4023 !! write (*,*) char(9), fileroot//filend 4024 ! call zero3m (cax1,cax2,cax3,nl) 4025 ! call readcud_mz1d ( cax1,cax2,cax3, v1, v2, 4026 ! @ fileroot,filend, csngl, nl,nan,0,isngldble) 4027 end if 4028 4029 c calculating the total c121(n,r) matrix for the first hot band 4030 do i=1,nl 4031 4032 if ( ib .eq. 4 ) then 4033 ! write (*,*) ' ' 4034 ! write (*,*) i, ' ib,ist, altura :', ib,ist, zl(i) 4035 endif 4036 4037 ! if ( v1(i) .le. 1.d-99 ) v1(i) = 0.0d0 4038 ! if ( v2(i) .le. 1.d-99 ) v2(i) = 0.0d0 4039 4040 4041 if(ik.eq.1)then 4042 cm_factor = (dble(618.03/667.75))**2.d0* 4043 @ exp( dble(ee*(667.75-618.03)/t(i)) ) 4044 vc_factor = dble(667.75/618.03) 4045 elseif(ik.eq.2)then 4046 cm_factor = 1.d0 4047 vc_factor = 1.d0 4048 elseif(ik.eq.3)then 4049 cm_factor = ( dble(720.806/667.75) )**2.d0* 4050 @ exp( dble(ee*(667.75-720.806)/t(i)) ) 4051 vc_factor = dble(667.75/720.806) 4052 end if 4053 do j=1,nl 4054 ! if (cax1(i,j) .le. 1.d-99 ) cax1(i,j) = 0.0d0 4055 ! if (cax2(i,j) .le. 1.d-99 ) cax2(i,j) = 0.0d0 4056 ! if (cax3(i,j) .le. 1.d-99 ) cax3(i,j) = 0.0d0 4057 c121(i,j) = c121(i,j) + cax1(i,j) * cm_factor 4058 cup121(i,j) = cup121(i,j) + cax2(i,j) * cm_factor 4059 cdw121(i,j) = cdw121(i,j) + cax3(i,j) * cm_factor 4060 end do 4061 4062 ! write (*,*) ' i =', i 4063 ! write (*,*) ' vc_factor =', vc_factor 4064 ! write (*,*) ' v1 =', v1(i) 4065 ! write (*,*) ' v2 =', v2(i) 4066 ! write (*,*) vc121(i), taugr121(i) 4067 ! write (*,*) v1(i) * vc_factor 4068 ! write (*,*) vc121(i) + v1(i) * vc_factor 4069 4070 vc121(i) = vc121(i) + v1(i) * vc_factor 4071 4072 4073 ! write (*,*) v2(i) * vc_factor 4074 ! write (*,*) taugr121(i) + v2(i) * vc_factor 4075 4076 taugr121(i) = taugr121(i) + v2(i) * vc_factor 4077 4078 end do 4079 11 continue 4080 4081 ccc 4082 end if 4083 ccc 4084 4085 4086 return 4087 end 4088 4089 4090 4091 4092 1414 1415 ! call zerov( vc121, nl ) 1416 vc121(1:nl)=0.d0 1417 1418 do 11, ik=1,3 1419 1420 ib=ik+1 1421 1422 call MZTVC121sub (v1, ib, ierr,varerr ) 1423 1424 do i=1,nl 1425 1426 if(ik.eq.1)then 1427 vc_factor = 1428 @ dble( (nu(1,2)-nu(1,1)) / (nu12_0200-nu(1,1)) ) 1429 elseif(ik.eq.2)then 1430 vc_factor = 1.d0 1431 elseif(ik.eq.3)then 1432 vc_factor = 1433 @ dble( (nu(1,2)-nu(1,1)) / (nu12_1000-nu(1,1)) ) 1434 end if 1435 1436 vc121(i) = vc121(i) + v1(i) * vc_factor 1437 1438 end do 1439 1440 11 continue 1441 1442 1443 return 1444 end 1445 1446 1447 c *** Old MZTVC121sub_dlvr11_03.f *** 1448 1449 c*********************************************************************** 1450 c mztf.f 1451 c*********************************************************************** 1452 1453 subroutine MZTVC121sub ( vc, ib, ierr, varerr ) 1454 1455 c*********************************************************************** 1456 1457 implicit none 1458 1459 include 'datafile.h' 1460 include 'nlte_paramdef.h' 1461 include 'nlte_commons.h' 1462 1463 1464 c arguments 1465 real*8 vc(nl) ! o 1466 integer ib ! i 1467 integer ierr ! o 1468 real*8 varerr ! o 1469 1470 c local variables and constants 1471 integer i, in, ir, iaquiHIST , iaquiZ, isot 1472 integer nmu 1473 parameter (nmu = 8) 1474 real*8 tau(nl,nl), argumento 1475 real*8 con(nzy), coninf 1476 real*8 c1, c2 1477 real*8 t1, t2 1478 real*8 p1, p2 1479 real*8 mr1, mr2 1480 real*8 st1, st2 1481 real*8 c1box(70), c2box(70) 1482 real*8 ff ! to avoid too small numbers 1483 real*8 tvtbs(nzy) 1484 real*8 st, beta, ts 1485 real*8 zld(nl), zyd(nzy), deltazdbl 1486 real*8 correc 1487 real*8 deltanudbl, pideltanu,pi 1488 real*8 yy 1489 real*8 minvc, maxtau 1490 1491 c external function 1492 external we_clean 1493 real*8 we_clean 1494 1495 c formats 1496 101 format(i1) 1497 1498 c*********************************************************************** 1499 1500 c 1501 pi=3.141592 1502 isot = 1 1503 beta = 1.8d5 1504 write (ibcode1,101) ib 1505 deltanudbl = dble( deltanu(isot,ib) ) 1506 pideltanu = pi*deltanudbl 1507 ff=1.0d10 1508 deltazdbl = dble(deltaz) 1509 c 1510 c 1511 c 1512 1513 do i=1,nzy 1514 zyd(i) = dble(zy(i)) 1515 enddo 1516 do i=1,nl 1517 zld(i) = dble(zl(i)) 1518 enddo 1519 1520 call interhuntdp ( tvtbs,zyd,nzy, v626t1,zld,nl, 1 ) 1521 1522 do i=1,nzy 1523 con(i) = dble( co2y(i) * imr(isot) ) 1524 correc = 2.d0 * dexp( -ee*dble(elow(isot,2))/tvtbs(i) ) 1525 con(i) = con(i) * ( 1.d0 - correc ) 1526 mr(i) = dble(co2y(i)/nty(i)) 1527 end do 1528 1529 coninf = dble( con(nzy) / log( con(nzy-1) / con(nzy) ) ) 1530 call mztf_correccion ( coninf, con, ib ) 1531 1532 ccc 1533 call gethist_03 ( ib ) 1534 1535 c 1536 c tau(1,ir) 1537 c 1538 call initial 1539 1540 iaquiHIST = nhist/2 1541 1542 in=1 1543 1544 tau(in,1) = 1.d0 1545 1546 call initial 1547 iaquiZ = 2 1548 call intzhunt ( iaquiZ, zl(in), c1,p1,mr1,t1, con) 1549 do kr=1,nbox 1550 ta(kr) = t1 1551 end do 1552 call interstrhunt (iaquiHIST, st1,t1,ka,ta) 1553 do kr=1,nbox 1554 c1box(kr) = c1 * ka(kr) * deltazdbl 1555 end do 1556 c1 = c1 * st1 * deltazdbl 1557 ! Check interpolation errors : 1558 if (c1.le.0.0d0) then 1559 ierr=15 1560 varerr=c1 1561 return 1562 elseif (p1.le.0.0d0) then 1563 ierr=16 1564 varerr=p1 1565 return 1566 elseif (mr1.le.0.0d0) then 1567 ierr=17 1568 varerr=mr1 1569 return 1570 elseif (t1.le.0.0d0) then 1571 ierr=18 1572 varerr=t1 1573 return 1574 elseif (st1.le.0.0d0) then 1575 ierr=19 1576 varerr=st1 1577 return 1578 endif 1579 ! 1580 1581 do 2 ir=2,nl 1582 1583 call intzhunt (iaquiZ, zl(ir), c2,p2,mr2,t2, con) 1584 do kr=1,nbox 1585 ta(kr) = t2 1586 end do 1587 call interstrhunt (iaquiHIST, st2,t2,ka,ta) 1588 do kr=1,nbox 1589 c2box(kr) = c2 * ka(kr) * deltazdbl 1590 end do 1591 c2 = c2 * st2 * deltazdbl 1592 1593 aa = aa + ( p1*mr1*(c1*ff) + p2*mr2*(c2*ff)) / 2.d0 1594 cc = cc + ( c1 + c2 ) / 2.d0 1595 dd = dd + ( t1*c1 + t2*c2 ) / 2.d0 1596 do kr=1,nbox 1597 ccbox(kr) = ccbox(kr) + ( c1box(kr) + c2box(kr) ) /2.d0 1598 ddbox(kr) = ddbox(kr) + 1599 $ ( t1*c1box(kr) + t2*c2box(kr) ) / 2.d0 1600 end do 1601 1602 mr1=mr2 1603 t1=t2 1604 c1=c2 1605 p1=p2 1606 do kr=1,nbox 1607 c1box(kr) = c2box(kr) 1608 end do 1609 1610 pp = aa / (cc * ff) 1611 1612 ts = dd/cc 1613 do kr=1,nbox 1614 ta(kr) = ddbox(kr) / ccbox(kr) 1615 end do 1616 call interstrhunt(iaquiHIST, st,ts,ka,ta) 1617 call intershphunt(iaquiHIST, alsa,alda,ta) 1618 1619 eqw=0.0d0 1620 do kr=1,nbox 1621 yy = ccbox(kr) * beta 1622 w = we_clean ( yy, pp, alsa(kr),alda(kr) ) 1623 eqw = eqw + no(kr)*w 1624 end do 1625 1626 argumento = eqw / deltanudbl 1627 tau(in,ir) = dexp( - argumento ) 1628 1629 2 continue 1630 1631 1632 c 1633 c 1634 c 1635 do in=nl,2,-1 1636 tau(in,1) = tau(1,in) 1637 end do 1638 1639 c 1640 vc(1) = 0.0d0 1641 vc(nl) = 0.0d0 1642 do in=2,nl-1 1643 vc(in) = pideltanu /( 2.d5*deltazdbl ) * 1644 @ ( tau(in-1,1) - tau(in+1,1) ) 1645 if (vc(in) .lt. 0.0d0) vc(in) = vc(in-1) 1646 end do 1647 1648 c 1649 c Tracking potential numerical errors 1650 c 1651 minvc = 1.d6 1652 maxtau = tau(nl,1) 1653 do in=2,nl-1 1654 minvc = min( minvc, vc(in) ) 1655 maxtau = max( maxtau, tau(in,1) ) 1656 end do 1657 if (maxtau .gt. 1.0d0) then 1658 ierr = 13 1659 varerr = maxtau 1660 return 1661 else if (minvc .lt. 0.0d0) then 1662 ierr = 14 1663 varerr = minvc 1664 return 1665 endif 1666 1667 c end 1668 return 1669 end 1670 1671 1672 1673 1674 1675 1676 1677 1678 -
trunk/LMDZ.MARS/libf/phymars/nlte_commons.h
r498 r757 5 5 c jan 2012 fgg+malv 6 6 c**************************************************************************** 7 c *** Old nlte_atm.h *** 8 c Subgrid atmosphere interpolated 9 c 10 common /atm_nl/ zl, t, pl, sh, nt, co2, n2, co, o3p, o2, h2, ar, 11 @ co2vmr, n2vmr, covmr, o3pvmr,hrkday_factor 12 13 real zl(nl), t(nl), pl(nl), nt(nl), sh(nl), 14 @ co2(nl), n2(nl), co(nl), o3p(nl), o2(nl), h2(nl), ar(nl), 15 @ co2vmr(nl),n2vmr(nl),covmr(nl),o3pvmr(nl),hrkday_factor(nl) 16 17 c Subgrid atmosphere obtained from the input atmosphere and limited to the 18 c NLTE grid. Only used for computing transmitances. 19 c 20 common /atm_ny/ zy, ty, py, nty, co2y, coy 21 real zy(nzy), ty(nzy), py(nzy), nty(nzy), co2y(nzy), coy(nzy) 22 23 c 24 common/deltazetas/ deltaz, deltazy, 25 @ jlowerboundary, jtopboundary 26 real deltaz, deltazy 27 integer jlowerboundary, jtopboundary 28 29 30 c *** Old nlte_results.h *** 31 c Next common: parameter that decides which level populations 32 c are already known and therefore are read and used in this program. 33 common/input_avilable_from/ input_cza, input_czb, input_czc, 34 @ input_czco 35 integer input_cza, input_czb, input_czc, input_czco 7 c *** Old datitos.cmn *** 8 c 9 common /spectralv11/ elow, deltanu 10 real elow(nisot,nb), deltanu(nisot,nb) 11 12 13 common/nu_levs_bands_v11/ nu11, nu12, nu121, 14 @ nu21, nu31, nu41 15 real*8 nu11, nu12, nu121 16 real*8 nu21 17 real*8 nu31 18 real*8 nu41 19 20 21 common /aeinstein1v11/ a1_010_000, a1_020_010 22 common /aeinstein2v11/ a2_010_000 23 common /aeinstein3v11/ a3_010_000 24 common /aeinstein4v11/ a4_010_000 25 26 real*8 a1_010_000, a1_020_010 27 real*8 a2_010_000 28 real*8 a3_010_000 29 real*8 a4_010_000 30 31 32 c *** Old tabulation.cmn *** 33 34 common/input_tab_v11/ lnpnbtab, 35 @ tstar11tab, tstar21tab, tstar31tab, tstar41tab, 36 @ vc210tab, vc310tab, vc410tab 37 38 real*8 lnpnbtab(nztabul) 39 real*8 vc210tab(nztabul), vc310tab(nztabul), vc410tab(nztabul) 40 real*8 tstar11tab(nztabul), tstar21tab(nztabul), 41 @ tstar31tab(nztabul), tstar41tab(nztabul) 42 43 44 c *** Old nlte_results.cmn *** 45 46 common/input_avilable_from/ input_cza 47 integer input_cza 36 48 37 49 c temperatura vibracional de entrada: 38 common/temp626/ v626t1,v626t2,v626t3,v626t4, 39 @ v626t5,v626t6,v626t7,v626t8 40 common/temp628/ v628t1, v628t2, v628t3, v628t4 41 common/temp636/ v636t1, v636t2, v636t3, v636t4 42 common/temp627/ v627t1, v627t2, v627t3, v627t4 43 common/tempco/ vcot1, vcot2, vcot3, vcot4, v63t1,v63t2,v63t3 44 real*8 v626t4(nl), v628t4(nl), v636t4(nl), v627t4(nl) 45 real*8 v626t1(nl), v626t2(nl), v626t3(nl) 46 real*8 v626t5(nl), v626t6(nl), v626t7(nl), v626t8(nl) 47 real*8 v628t1(nl), v628t2(nl), v628t3(nl) 48 real*8 v636t1(nl), v636t2(nl), v636t3(nl) 49 real*8 v627t1(nl), v627t2(nl), v627t3(nl) 50 real*8 vcot1(nl), vcot2(nl), vcot3(nl), vcot4(nl) 51 real*8 v63t1(nl), v63t2(nl), v63t3(nl) 50 common/temp626/ v626t1 51 common/temp628/ v628t1 52 common/temp636/ v636t1 53 common/temp627/ v627t1 54 real*8 v626t1(nl) 55 real*8 v628t1(nl) 56 real*8 v636t1(nl) 57 real*8 v627t1(nl) 52 58 53 59 c output de cza.for 54 common /tv15um/ vt11, vt12, vt13, 55 @ vt21, vt22, vt23, 56 @ vt31, vt32, vt33, 57 @ vt41, vt42, vt43 58 real*8 vt11(nl), vt12(nl), vt13(nl), 59 @ vt21(nl), vt22(nl), vt23(nl), 60 @ vt31(nl), vt32(nl), vt33(nl), 61 @ vt41(nl), vt42(nl), vt43(nl) 62 63 common /hr15um/ hr110,hr210,hr310,hr410, 64 @ hr121,hr221,hr321,hr421, 65 @ hr132,hr232,hr332,hr432 66 real*8 hr110(nl),hr121(nl),hr132(nl), 67 @ hr210(nl),hr310(nl),hr410(nl), 68 @ hr221(nl),hr232(nl),hr321(nl), 69 @ hr332(nl),hr421(nl),hr432(nl) 70 71 common/sf15um/ el11,el12,el13, el21,el22,el23, 72 @ el31,el32,el33, el41,el42,el43 73 real*8 el11(nl), el12(nl), el13(nl) 74 real*8 el21(nl), el22(nl), el23(nl) 75 real*8 el31(nl), el32(nl), el33(nl) 76 real*8 el41(nl), el42(nl), el43(nl) 77 78 common/sl15um/ sl110,sl121,sl132, sl210,sl221,sl232, 79 @ sl310,sl321,sl332, sl410,sl421,sl432 80 real*8 sl110(nl), sl121(nl), sl132(nl) 81 real*8 sl210(nl), sl221(nl), sl232(nl) 82 real*8 sl310(nl), sl321(nl), sl332(nl) 83 real*8 sl410(nl), sl421(nl), sl432(nl) 84 85 86 c *** Old nlte_matrix.h*** 60 common /tv15um/ vt11, vt12, vt21, vt31, vt41 61 real*8 vt11(nl), vt12(nl), vt21(nl), vt31(nl), vt41(nl) 62 63 common /hr15um/ hr110,hr210,hr310,hr410,hr121 64 real*8 hr110(nl),hr121(nl), 65 @ hr210(nl),hr310(nl),hr410(nl) 66 67 common/sf15um/ el11,el12, el21, el31, el41 68 real*8 el11(nl), el12(nl) 69 real*8 el21(nl) 70 real*8 el31(nl) 71 real*8 el41(nl) 72 73 common/sl15um/ sl110,sl121, sl210,sl310,sl410 74 real*8 sl110(nl), sl121(nl) 75 real*8 sl210(nl) 76 real*8 sl310(nl) 77 real*8 sl410(nl) 78 79 80 c *** Old matrices.cmn *** 81 82 87 83 c curtis matrix de cza: 88 84 common/curtis_matrixes_15um/ c110,c121, c210, 89 @ c310, c410, 90 @ vc110,vc121, vc210, 91 @ vc310, vc410 85 @ c310,c410, 86 @ vc110,vc121,vc210,vc310,vc410 92 87 real*8 c110(nl,nl), c121(nl,nl) 93 88 real*8 c210(nl,nl) … … 97 92 real*8 vc210(nl), vc310(nl), vc410(nl) 98 93 99 common/curtis_matr_up_15um/100 @ cup110,cup121101 real*8 cup110(nl,nl), cup121(nl,nl)102 103 common/curtis_matr_dw_15um/104 @ cdw110,cdw121105 real*8 cdw110(nl,nl), cdw121(nl,nl)106 107 common/curtis_matr_taugr_15um/108 @ taugr110,taugr121109 real*8 taugr110(nl), taugr121(nl)110 111 ! for the new flux formulation:112 !113 !114 common/tauinf_15um/ tauinf121,115 @ tauinf210,tauinf310,tauinf410,tauinf110116 real*8 tauinf121(nl)117 real*8 tauinf210(nl), tauinf310(nl), tauinf410(nl)118 real*8 tauinf110(nl)119 120 94 ! for the cool-to-space formulation: 121 95 ! 122 96 common/taustar_15um/ taustar11, taustar21, taustar31, 123 @ taustar41, taustar12 97 @ taustar41, taustar12, taustar11_cts 124 98 real*8 taustar11(nl), taustar21(nl), taustar31(nl) 125 99 real*8 taustar41(nl), taustar12(nl) 126 127 common/tauii_15um/ tauii110, tauii210, tauii310, 128 @ tauii410, tauii121 129 real*8 tauii110(nl), tauii210(nl), tauii310(nl) 130 real*8 tauii410(nl), tauii121(nl) 131 132 ! for the name of the C.Matrix files 133 ! 134 common/cm_names/ fileroot 135 character fileroot*3 136 137 138 c *** Old nlte_rates.h *** 139 common/rates_vt/ k7a(4),k7b(4), k7ap(4),k7bp(4), 140 @ k3aa(4),k3ab(4),k3ac(4), k3aap(4),k3abp(4),k3acp(4), 141 @ k3ba(4),k3bb(4),k3bc(4), k3bap(4),k3bbp(4),k3bcp(4), 142 @ k19aa(4),k19ab(4),k19ac(4), k19aap(4),k19abp(4),k19acp(4), 143 @ k19ba(4),k19bb(4),k19bc(4), k19bap(4),k19bbp(4),k19bcp(4), 144 @ k19ca(4),k19cb(4),k19cc(4), k19cap(4),k19cbp(4),k19ccp(4), 145 @ k20a(4),k20b(4),k20c(4), k20ap(4),k20bp(4),k20cp(4), 146 @ k27a,k27b,k27c, k27ap,k27bp,k27cp 147 148 real*8 k7a,k7b, k7ap,k7bp 149 real*8 k3aa,k3ab,k3ac, k3aap,k3abp,k3acp 150 real*8 k3ba,k3bb,k3bc, k3bap,k3bbp,k3bcp 151 real*8 k19aa,k19ab,k19ac, k19aap,k19abp,k19acp 100 real*8 taustar11_cts(nl_cts) 101 102 103 c *** Old atmref.cmn *** 104 105 106 c NLTE Subgrid 107 c 108 common /atm_nl/ zl, t, pl, nt, co2, n2, co, o3p, 109 @ co2vmr, n2vmr, covmr, o3pvmr, 110 @ hrkday_factor 111 112 real zl(nl), t(nl), pl(nl), nt(nl), 113 @ co2(nl), n2(nl), co(nl), o3p(nl), 114 @ co2vmr(nl), n2vmr(nl), covmr(nl), o3pvmr(nl), 115 @ hrkday_factor(nl) 116 117 118 c Subgrid Transmittances 119 c 120 common /atm_ny/ zy, ty, py, nty, co2y 121 real zy(nzy), ty(nzy), py(nzy), nty(nzy), co2y(nzy) 122 123 c Grids and indexes 124 common/deltazetas/ deltaz, deltazy, deltaz_cts, deltazy_cts, 125 @ jlowerboundary, jtopboundary, jtopCTS 126 real deltaz, deltazy, deltaz_cts, deltazy_cts 127 integer jlowerboundary, jtopboundary, jtopCTS 128 129 130 c NLTE-CTS Subgrid 131 c 132 common /atm_nl_cts/ zl_cts, t_cts, pl_cts, nt_cts, 133 @ co2_cts, n2_cts, co_cts, o3p_cts, 134 @ co2vmr_cts, n2vmr_cts, covmr_cts, o3pvmr_cts, 135 @ hrkday_factor_cts,mmean_cts,cpnew_cts 136 137 real zl_cts(nl_cts), t_cts(nl_cts), pl_cts(nl_cts), 138 @ nt_cts(nl_cts), co2_cts(nl_cts), 139 @ n2_cts(nl_cts), co_cts(nl_cts), 140 @ o3p_cts(nl_cts), co2vmr_cts(nl_cts), n2vmr_cts(nl_cts), 141 @ covmr_cts(nl_cts), o3pvmr_cts(nl_cts), 142 @ hrkday_factor_cts(nl_cts),mmean_cts(nl_cts), 143 @ cpnew_cts(nl_cts) 144 145 146 c CTS Subgrid Transmittances 147 c 148 common /atm_ny_cts/ zy_cts, ty_cts, py_cts, nty_cts, co2y_cts 149 real zy_cts(nzy_cts), ty_cts(nzy_cts), py_cts(nzy_cts), 150 @ nty_cts(nzy_cts), co2y_cts(nzy_cts) 151 152 153 c *** Old rates.cmn *** 154 155 common/rates_vt/ 156 @ k19ba(4),k19bb(4),k19bc(4), k19bap(4),k19bbp(4),k19bcp(4), 157 @ k19ca(4),k19cb(4),k19cc(4), k19cap(4),k19cbp(4),k19ccp(4), 158 @ k20b(4),k20c(4), k20bp(4),k20cp(4) 159 152 160 real*8 k19ba,k19bb,k19bc, k19bap,k19bbp,k19bcp 153 161 real*8 k19ca,k19cb,k19cc, k19cap,k19cbp,k19ccp 154 real*8 k20a,k20b,k20c, k20ap,k20bp,k20cp 155 real*8 k27a,k27b,k27c, k27ap,k27bp,k27cp 156 157 common/rates_vv/ k1(4),k1p(4), 158 @ k2a,k2b, k2x,k2y,k2z, k2xp,k2yp,k2zp, 159 @ k6,k6p, k6a(2:4),k6b(2:4), k6ap(2:4),k6bp(2:4), 160 @ k21a,k21ap, k21a1(2:4),k21a2(2:4), k21a1p(2:4),k21a2p(2:4), 162 real*8 k20b,k20c, k20bp,k20cp 163 164 common/rates_vv/ 161 165 @ k21b(4),k21c(4), k21bp(4),k21cp(4), 162 @ k31,k32, 163 @ k33a1,k33a2,k33b1,k33b2,k33c, 164 @ k33a1p(2:4),k33a2p(2:4),k33b1p(2:4),k33b2p(2:4),k33cp(2:4), 165 @ k28a,k28b,k28c, k28ap,k28bp,k28cp, 166 @ k26a,k26b,k26c,k26d, k26ap(4),k26bp(4),k26cp(4),k26dp(4), 167 @ k41p_taylor, k41p_shved, k41p_starr_hannock, 168 @ k41_1,k41p_1, k41_2,k41p_2, k42,k42p 169 170 real*8 k1,k1p 171 real*8 k2a,k2b, k2x,k2y,k2z, k2xp,k2yp,k2zp 172 real*8 k6,k6p, k6a,k6b, k6ap,k6bp 173 real*8 k21a,k21ap, k21a1,k21a2, k21a1p,k21a2p 166 @ k33c, k33cp(2:4) 167 174 168 real*8 k21b,k21c, k21bp,k21cp 175 real*8 k31,k32 176 real*8 k33a1,k33a2,k33b1,k33b2,k33c 177 real*8 k33a1p,k33a2p,k33b1p,k33b2p,k33cp 178 real*8 k28a,k28b,k28c, k28ap,k28bp,k28cp 179 real*8 k26a,k26b,k26c,k26d, k26ap,k26bp,k26cp,k26dp 180 real*8 k41p_taylor, k41p_shved, k41p_starr_hannock 181 real*8 k41_1,k41p_1, k41_2,k41p_2, k42,k42p 182 183 184 common/rates_k26isot/ k26a21,k26c21,k26d21, 185 @ k26a22,k26c22,k26d22, k26a23,k26c23,k26d23, 186 @ k26a24,k26c24,k26d24, 187 @ k26a32,k26c32,k26d32, k26a33,k26c33,k26d33, 188 @ k26a31,k26c31,k26d31, 189 @ k26a34,k26c34,k26d34, k26a42,k26c42,k26d42, 190 @ k26a41,k26c41,k26d41, 191 @ k26a43,k26c43,k26d43, k26a44,k26c44,k26d44 192 193 real*8 k26a21,k26c21,k26d21, 194 @ k26a22,k26c22,k26d22, k26a23,k26c23,k26d23, 195 @ k26a24,k26c24,k26d24, 196 @ k26a32,k26c32,k26d32, k26a33,k26c33,k26d33, 197 @ k26a31,k26c31,k26d31, 198 @ k26a34,k26c34,k26d34, k26a42,k26c42,k26d42, 199 @ k26a41,k26c41,k26d41, 200 @ k26a43,k26c43,k26d43, k26a44,k26c44,k26d44 201 169 real*8 k33c, k33cp 202 170 203 171 common/rates_last/ k23k21c, k24k21c, k34k21c, 204 @ k23k21cp, k24k21cp, k34k21cp , k43,k43p, k_vthcl172 @ k23k21cp, k24k21cp, k34k21cp 205 173 206 174 real*8 k23k21c,k24k21c,k34k21c, k23k21cp,k24k21cp,k34k21cp 207 real*8 k43,k43p, k_vthcl 208 209 common/rates_V09/ k41_3,k41p_3, k41_4,k41p_4, k41iso_1,k41iso_1p, 210 @ k41iso_2,k41iso_2p, k41iso_3,k41iso_3p, 211 @ k42b, k42c, k42bp, k42cp, k43iso,k43isop, 212 @ k44a,k44b,k44c,k44d, k44ap,k44bp,k44cp,k44dp, 213 @ k42iso,k42isop, k42isob,k42isobp 214 real*8 k41_3,k41p_3, k41_4,k41p_4, k41iso_1,k41iso_1p 215 real*8 k41iso_2,k41iso_2p, k41iso_3,k41iso_3p 216 real*8 k42b, k42c, k42bp, k42cp, k43iso,k43isop 217 real*8 k44a,k44b,k44c,k44d, k44ap,k44bp,k44cp,k44dp 218 real*8 k42iso,k42isop, k42isob,k42isobp 219 220 221 c *** Old nlte_curtis.h *** 222 223 224 common/block1/s,alsa,alna,alda,ka,kr 225 real*8 ka(nbox_max),alsa(nbox_max),alna(nbox_max),alda(nbox_max) 226 &,s 175 176 177 178 c *** Old curtis.cmn *** 179 180 common /ini_file/ ibcode1 181 character ibcode1*1 182 183 common/block1/ alsa,alda,ka,kr 184 real*8 ka(nbox_max),alsa(nbox_max),alda(nbox_max) 227 185 integer kr 228 186 229 common/block2/hisfile, hfile1 230 character hisfile*75, hfile1*3 231 232 common/block3/sl_ua,ua,pt,pp,ta,w, icls 233 real*8 sl_ua,ua(nbox_max),pt,pp,ta(nbox_max),w 234 integer icls 235 236 common/block4/no,sk1,xls1,xln1,xld1,thist,dist, nbox 237 real*8 sk1(nhist,nbox_max) ! line intensity 238 real*8 xls1(nhist,nbox_max) ! Lorentz half width (self-col.) 239 real*8 xln1(nhist,nbox_max) ! Lorentz half width 240 real*8 xld1(nhist,nbox_max) ! Doppler half width 241 real*8 thist(nhist) ! temperatures in the histogram 242 real*8 no(nbox_max) ! number of lines in box 243 real*8 dist(nbox_max) ! mean distance between lines in box 244 integer nbox ! actual number of boxes 245 246 common/block5/eqw, aa, bb, cc, dd, ddbox, ccbox 247 real*8 eqw, aa, bb, cc, dd 187 common/block2/ hisfile 188 character hisfile*75 189 190 common/block3/ pp,ta,w 191 real*8 pp,ta(nbox_max),w 192 193 common/block4/ no,sk1,xls1,xld1,thist,nbox 194 real*8 sk1(nhist,nbox_max) 195 real*8 xls1(nhist,nbox_max) 196 real*8 xld1(nhist,nbox_max) 197 real*8 thist(nhist) 198 real*8 no(nbox_max) 199 integer nbox 200 201 common/block5/eqw, aa, cc, dd, ddbox, ccbox, mr, mr_cts 202 real*8 eqw, aa, cc, dd 248 203 real*8 ddbox(nbox_max), ccbox(nbox_max) 249 250 common/block7/ mr, p 251 real*8 mr(nzy), p(nzy) 252 253 common/block8/ tmin,tmax, mm 254 real*8 tmin,tmax 255 integer mm 256 257 common/block9/ w_strongLor_prev 258 real*8 w_strongLor_prev(nbox_max) 259 260 common/block10/no_c1,no_c2,no_c3,no_c4,no_c5,no_c6,no_c7 261 real*8 no_c1(nbox_max) 262 real*8 no_c2(nbox_max) 263 real*8 no_c3(nbox_max) 264 real*8 no_c4(nbox_max) 265 real*8 no_c5(nbox_max) 266 real*8 no_c6(nbox_max) 267 real*8 no_c7(nbox_max) 268 269 common/block11/nbox_c1,nbox_c2,nbox_c3,nbox_c4, 270 $ nbox_c5,nbox_c6,nbox_c7 271 integer nbox_c1 272 integer nbox_c2 273 integer nbox_c3 274 integer nbox_c4 275 integer nbox_c5 276 integer nbox_c6 277 integer nbox_c7 278 279 common/block12/thist_c1,thist_c2,thist_c3,thist_c4,thist_c5, 280 $ thist_c6,thist_c7 281 real*8 thist_c1(nhist) 282 real*8 thist_c2(nhist) 283 real*8 thist_c3(nhist) 284 real*8 thist_c4(nhist) 285 real*8 thist_c5(nhist) 286 real*8 thist_c6(nhist) 287 real*8 thist_c7(nhist) 288 289 common/block13/dist_c1,dist_c2,dist_c3,dist_c4,dist_c5, 290 $ dist_c6,dist_c7 291 real*8 dist_c1(nbox_max) 292 real*8 dist_c2(nbox_max) 293 real*8 dist_c3(nbox_max) 294 real*8 dist_c4(nbox_max) 295 real*8 dist_c5(nbox_max) 296 real*8 dist_c6(nbox_max) 297 real*8 dist_c7(nbox_max) 298 299 common/block14/sk1_c1,sk1_c2,sk1_c3,sk1_c4,sk1_c5,sk1_c6,sk1_c7 300 real*8 sk1_c1(nhist,nbox_max) 301 real*8 sk1_c2(nhist,nbox_max) 302 real*8 sk1_c3(nhist,nbox_max) 303 real*8 sk1_c4(nhist,nbox_max) 304 real*8 sk1_c5(nhist,nbox_max) 305 real*8 sk1_c6(nhist,nbox_max) 306 real*8 sk1_c7(nhist,nbox_max) 307 308 common/block15/xls1_c1,xls1_c2,xls1_c3,xls1_c4,xls1_c5,xls1_c6, 309 $ xls1_c7 310 real*8 xls1_c1(nhist,nbox_max) 311 real*8 xls1_c2(nhist,nbox_max) 312 real*8 xls1_c3(nhist,nbox_max) 313 real*8 xls1_c4(nhist,nbox_max) 314 real*8 xls1_c5(nhist,nbox_max) 315 real*8 xls1_c6(nhist,nbox_max) 316 real*8 xls1_c7(nhist,nbox_max) 317 318 common/block16/xln1_c1,xln1_c2,xln1_c3,xln1_c4,xln1_c5,xln1_c6, 319 $ xln1_c7 320 real*8 xln1_c1(nhist,nbox_max) 321 real*8 xln1_c2(nhist,nbox_max) 322 real*8 xln1_c3(nhist,nbox_max) 323 real*8 xln1_c4(nhist,nbox_max) 324 real*8 xln1_c5(nhist,nbox_max) 325 real*8 xln1_c6(nhist,nbox_max) 326 real*8 xln1_c7(nhist,nbox_max) 327 328 common/block17/xld1_c1,xld1_c2,xld1_c3,xld1_c4,xld1_c5,xld1_c6, 329 $ xld1_c7 330 real*8 xld1_c1(nhist,nbox_max) 331 real*8 xld1_c2(nhist,nbox_max) 332 real*8 xld1_c3(nhist,nbox_max) 333 real*8 xld1_c4(nhist,nbox_max) 334 real*8 xld1_c5(nhist,nbox_max) 335 real*8 xld1_c6(nhist,nbox_max) 336 real*8 xld1_c7(nhist,nbox_max) 337 338 common/block18/mm_c1,mm_c2,mm_c3,mm_c4,mm_c5,mm_c6,mm_c7 339 integer mm_c1 340 integer mm_c2 341 integer mm_c3 342 integer mm_c4 343 integer mm_c5 344 integer mm_c6 345 integer mm_c7 346 347 common/block19/tmin_c1,tmin_c2,tmin_c3,tmin_c4,tmin_c5,tmin_c6, 348 $ tmin_c7 349 real*8 tmin_c1 350 real*8 tmin_c2 351 real*8 tmin_c3 352 real*8 tmin_c4 353 real*8 tmin_c5 354 real*8 tmin_c6 355 real*8 tmin_c7 356 357 common/block20/tmax_c1,tmax_c2,tmax_c3,tmax_c4,tmax_c5,tmax_c6, 358 $ tmax_c7 359 real*8 tmax_c1 360 real*8 tmax_c2 361 real*8 tmax_c3 362 real*8 tmax_c4 363 real*8 tmax_c5 364 real*8 tmax_c6 365 real*8 tmax_c7 366 367 common /lor_overlap/ asat_box, i_supersat 368 real*8 asat_box 369 integer i_supersat 370 371 372 c *** Variables formerly included in nlte_data.h *** 373 common /nltedata/ elow, deltanu 374 real elow(nisot,nb), deltanu(nisot,nb) 204 real*8 mr(nzy), mr_cts(nzy_cts) 205 206 common/blockstore/no_stored, sk1_stored, xls1_stored, 207 & xld1_stored, thist_stored, nbox_stored, 208 & mm_stored 209 real*8 sk1_stored(nb,nhist,nbox_max) 210 real*8 xls1_stored(nb,nhist,nbox_max) 211 real*8 xld1_stored(nb,nhist,nbox_max) 212 real*8 thist_stored(nb,nhist) 213 real*8 no_stored(nb,nbox_max) 214 integer nbox_stored(nb), mm_stored(nb) 215 216 c***************************************************** 217 218 219 c************************************************************* 220 221 222 375 223 376 224 c**************************************************************************** 225 226 227 -
trunk/LMDZ.MARS/libf/phymars/nlte_paramdef.h
r498 r757 3 3 c Merging of different parameters definitions for new NLTE 15um param 4 4 c 5 c j an2012 fgg+malv5 c jul 2012 fgg+malv 6 6 c**************************************************************************** 7 c *** Old nltedefs.h***8 ! NLTE grid parameters:7 c *** Old mz1d.par *** 8 ! Grids parameters : 9 9 10 integer n l ! actual # alt in NLTE module11 parameter ( n l=20 )10 integer nztabul ! # points in tabulation of Tesc & VC (ISO) 11 parameter ( nztabul=79 ) 12 12 13 ! NLTE parameters: 14 15 integer nltot ! incluye el actual # alt in NLTE module 16 parameter ( nltot=20 ) ! y el # alturas del Tstar110 17 18 integer nl ! actual # alt in NLTE module & C.Matrix 19 parameter ( nl=12 ) 13 20 integer nl2 ! = nl-2, needed for matrix inversion (mmh2) 14 21 parameter ( nl2=nl-2 ) 15 22 16 23 integer nzy 17 parameter ( nzy = (nl-1)*4 + 1 ) ! Fine grid for mztud.f 24 parameter ( nzy = (nl-1)*4 + 1 ) ! Fine grid for C.Matrix 25 26 integer nl_cts ! actual # alt para Tstar110 27 parameter ( nl_cts = 2 + nltot-nl ) 28 integer nzy_cts ! fine grid for transmit calculation 29 parameter ( nzy_cts = (nl_cts-1)*4 + 1 ) 18 30 19 31 … … 27 39 28 40 integer nbox_max 29 parameter ( nbox_max = 70) ! max.# boxes in histogram41 parameter ( nbox_max = 4 ) ! max.# boxes in histogram 30 42 31 43 32 c *** Old tcr15um.h *** 33 integer irw_mztf,imu,ioverlap,nw,itt_cza,icls_mztf,nan 34 c 35 parameter (irw_mztf = 2) 36 parameter (imu = 1) 37 parameter (ioverlap = 0) 38 parameter (nw = 3) 39 parameter (itt_cza = 13) 40 parameter (icls_mztf = 5) 41 parameter (nan = 0) 42 c 43 c 44 integer iopt3, iopt19,iopt20, iopt21,iopt27,iopt26 45 c 46 parameter (iopt3 = 1) 47 parameter (iopt19 = 2) 48 parameter (iopt20 = 2) 49 parameter (iopt21 = 1) 50 parameter (iopt27 = 1) 51 parameter (iopt26 = 2) 52 c 53 c 54 integer iopt41,iopt43, iopt6 55 c 56 parameter (iopt6 = 2) 57 parameter (iopt41 = 2) 58 parameter (iopt43 = 2) 59 c 60 c 61 real tsurf_excess,Pbottom_atm,Ptop_atm 62 c 63 parameter (tsurf_excess = 0.) 64 parameter (Pbottom_atm = 2.e-5) 65 parameter (Ptop_atm = 5.e-12) 66 c 67 c 68 real*8 rf1,rf2desac,rf2iso,rf3,rf6 69 c 70 parameter (rf1 = 1.d0) 71 parameter (rf2desac = 1.d0) 72 parameter (rf2iso = 1.d0) 73 parameter (rf3 = 1.d0) 74 parameter (rf6 = 1.d0) 75 c 76 c 77 real*8 rf7,rf19,rf20,rf21a,rf21b,rf21c 78 c 79 parameter (rf7 = 1.d0) 80 parameter (rf19 = 1.d0) 81 parameter (rf20 = 1.d0) 82 parameter (rf21a = 1.d0) 83 parameter (rf21b = 1.d0) 84 parameter (rf21c = 1.d0) 85 c 86 c 87 real*8 rf26,rf27f,rf27s,rf28,rf31,rf32,rf33a,rf33bc 88 c 89 parameter (rf26 = 1.d0) 90 parameter (rf27f = 1.d0) 91 parameter (rf27s = 1.d0) 92 parameter (rf28 = 1.d0) 93 parameter (rf31 = 1.d0) 94 parameter (rf32 = 1.d0) 95 parameter (rf33a = 1.d0) 96 parameter (rf33bc = 1.d0) 97 c 98 c 99 real*8 rf41,rf42,rf43,rf_hcl,rf44 100 c 101 parameter (rf41 = 1.d0) 102 parameter (rf42 = 1.d0) 103 parameter (rf43 = 1.d0) 104 parameter (rf_hcl = 1.d0) 105 parameter (rf44 = 1.d0) 106 c 107 c 108 real*8 frac6,frac21,frac33 109 c 110 parameter (frac6 = 1.d0) 111 parameter (frac21 = 1.d0) 112 parameter (frac33 = 1.d0) 44 c *** Old tcr_15um.h *** 45 46 integer itt_cza ! Selection of NLTE scheme 47 parameter ( itt_cza = 13 ) 48 49 real Ptop_atm, Pbottom_atm ! Upper and lower limits of 50 ! NLTE model 51 parameter ( Ptop_atm = 3.e-10 , Pbottom_atm = 2.e-5 ) 52 53 54 real*8 rf19,rf20,rf21a,rf21b,rf21c,rf33bc 55 parameter ( rf19 = 1.d0, rf20 = 1.d0, rf21a = 1.d0) 56 parameter ( rf21b = 1.d0, rf21c = 1.d0, rf33bc = 1.d0 ) 113 57 114 58 115 c *** Old nlte_data.h and bloque.F *** 116 real*8 vlight, ee, hplanck, gamma 117 parameter (vlight = 2.9979245e10) 118 parameter (ee = 1.43876866) 119 parameter (hplanck = 6.6260755e-27) 120 parameter (gamma = 1.191043934e-5) 59 c *** Old bloque_dlvr11.f *** 121 60 122 real imr(nisot), imrco 123 parameter (imrco = 0.9865) 124 data imr / 0.987, 0.00408, 0.0112, 0.000742 / 61 real nu(nisot,8) 62 c data 63 data nu(1,1),nu(1,2) /667.3801, 1335.1317/ 64 data nu(2,1)/662.3734/ 65 data nu(3,1)/648.4784/ 66 data nu(4,1)/664.7289/ 125 67 126 integer indexisot(nisot) 127 data indexisot/26,28,36,27/ 68 real nu12_0200,nu12_1000 69 parameter (nu12_0200 = 1285.4087) 70 parameter (nu12_1000 = 1388.1847) 128 71 129 real deltanuco130 parameter (deltanuco = 306.)72 integer indexisot(nisot) 73 data indexisot/26,28,36,27/ 131 74 132 real nuco_10 133 parameter (nuco_10 = 2143.2716) 75 ! ctes en el sistema cgs 76 real*8 vlight, ee, hplanck, gamma 77 parameter (vlight = 2.9979245e10) 78 parameter (ee = 1.43876866) 79 parameter (hplanck = 6.6260755e-27) 80 parameter (gamma = 1.191043934e-5) 134 81 135 real nun2,nu12_0200,nu12_1000,nu22_0200,nu22_1000136 parameter (nun2 = 2331.0)137 parameter (nu12_0200 = 1285.4087)138 parameter (nu12_1000 = 1388.1847)139 parameter (nu22_0200 = 1259.4257)140 parameter (nu22_1000 = 1365.8439)141 82 142 real nu32_0200,nu32_1000, nu42_0200,nu42_1000 143 parameter (nu32_0200 = 1265.8282) 144 parameter (nu32_1000 = 1370.0626) 145 parameter (nu42_0200 = 1272.2866) 146 parameter (nu42_1000 = 1376.0275) 83 ! datos de marte 84 real imr(nisot) 85 data imr / 0.987, 0.00408, 0.0112, 0.000742 / 147 86 148 real nu(nisot,8)149 data nu(1,1),nu(1,2),nu(1,3),nu(1,4)150 @ /667.3801, 1335.1317, 2003.2463, 2349.1433/151 data nu(1,5),nu(1,6),nu(1,7),nu(1,8)152 @ /3004.0112, 3612.8417, 3659.2728, 3714.7828/153 data nu(2,1),nu(2,2),nu(2,3),nu(2,4)154 @ /662.3734, 1325.1410, 1988.3280, 2332.1128/155 data nu(2,5),nu(2,6),nu(2,7),nu(2,8)156 @ /2982.1115, 3571.1404, 3632.5240, 3675.1332/157 data nu(3,1),nu(3,2),nu(3,3),nu(3,4)158 @ /648.4784, 1297.2640, 1946.3507, 2283.4876/159 data nu(3,5),nu(3,6),nu(3,7),nu(3,8)160 @ /2920.2387, 3527.7380, 3557.3145, 3632.9112/161 data nu(4,1),nu(4,2),nu(4,3),nu(4,4)162 @ /664.7289, 1329.8430, 1995.3520, 2340.0136/163 data nu(4,5),nu(4,6),nu(4,7),nu(4,8)164 @ /2992.3100, 3591.2510, 3644.9900, 3693.3460/165 87 166 88 89 -
trunk/LMDZ.MARS/libf/phymars/nlte_tcool.F
r695 r757 1 c********************************************************************** 2 c 3 c Contains the following old 1-d model subroutines: 4 c 5 c -NLTEdlvr11_TCOOL_03 6 c -NLTEdlvr11_CZALU_03 7 c -NLTEdlvr11_FB626CTS_03 8 c 9 c 10 c 11 c *** Old NLTEdlvr11_TCOOL_02 *** 12 c 1 13 c*********************************************************************** 2 3 subroutine NLTEdlvr09_TCOOL (ngridgcm,n_gcm, 4 @ p_gcm, t_gcm, z_gcm, 5 @ co2vmr_gcm, n2vmr_gcm, covmr_gcm, o3pvmr_gcm, 6 @ q15umco2_gcm ) 7 8 c jul 2011 malv+fgg 14 9 15 c*********************************************************************** 10 11 implicit none 12 16 17 subroutine nlte_tcool(ngridgcm,n_gcm, 18 $ p_gcm, t_gcm, z_gcm, 19 $ co2vmr_gcm, n2vmr_gcm, covmr_gcm, o3pvmr_gcm, 20 $ q15umco2_gcm ) 21 22 c*********************************************************************** 23 24 implicit none 25 13 26 include "dimensions.h" 14 27 include "dimphys.h" … … 18 31 include "conc.h" 19 32 20 c Arguments 33 34 c Arguments 21 35 integer n_gcm,ngridgcm 22 36 real p_gcm(ngridgcm,n_gcm), t_gcm(ngridgcm,n_gcm) 37 real z_gcm(ngridgcm,n_gcm) 23 38 real co2vmr_gcm(ngridgcm,n_gcm), n2vmr_gcm(ngridgcm,n_gcm) 24 39 real covmr_gcm(ngridgcm,n_gcm), o3pvmr_gcm(ngridgcm,n_gcm) 25 40 real q15umco2_gcm(ngridgcm,n_gcm) 26 real z_gcm(ngridgcm,n_gcm) 27 28 c local variables and constants 29 integer iz, i, j, k, l, ig,istyle 30 31 real*8 q15umco2_nl(nl) 32 real*8 zld(nl), zgcmd(n_gcm) 33 real*8 auxdgcm(n_gcm) 34 41 ! real auxgcm(n_gcm) 42 real*8 auxgcmd(n_gcm), aux2gcmd(n_gcm) 43 real zmin_gcm 44 integer ierr 45 real*8 varerr 46 47 48 49 c local variables and constants 50 integer i,ig,l, indice, nl_cts_real, nzy_cts_real 51 real*8 q15umco2_nltot(nltot), zld(nltot) 52 real*8 hr110CTS(nl_cts) 53 real xx,factor 35 54 36 55 real p_ig(n_gcm),z_ig(n_gcm) … … 38 57 real co2_ig(n_gcm),n2_ig(n_gcm),co_ig(n_gcm),o3p_ig(n_gcm) 39 58 real mmean_ig(n_gcm),cpnew_ig(n_gcm) 40 41 42 c********************************************************************** 59 60 61 c*************** 62 c*************** 43 63 44 64 do ig=1,ngridgcm 65 ierr = 0 66 nl_cts_real = 0 67 nzy_cts_real = 0 45 68 do l=1,n_gcm 46 69 p_ig(l)=p_gcm(ig,l) … … 55 78 enddo 56 79 57 call NLTEdlvr09_ZGRID (n_gcm, 58 @ p_ig, t_ig, z_ig, 59 @ co2_ig,n2_ig,co_ig, 60 $ o3p_ig , mmean_ig, cpnew_ig) 61 62 c And sets zero to all Curtis Matrixes and Escape Transmissions 80 ! From GCM's grid to NLTE's grid 81 call NLTEdlvr11_ZGRID_02 (n_gcm, 82 $ p_ig, t_ig, z_ig, 83 $ co2_ig, n2_ig, co_ig, o3p_ig, 84 $ mmean_ig,cpnew_ig, 85 $ nl_cts_real, nzy_cts_real ) 86 87 88 ! Isotopic Tstar & VC at the NLTE grid 89 call interdp_ESCTVCISO 90 91 ! Tstar para NLTE-CTS 92 call MZESC110 ( nl_cts_real, nzy_cts_real ) 93 94 ! 626FB C.M. 63 95 call leetvt 64 call zero3m (c110,cup110,cdw110, nl) 65 call zero2v (taugr110,vc110, nl) 66 if (itt_cza.eq.24) then 67 call mzescape ( ig,taustar11,tauinf110,tauii110, 68 @ 1, 1,irw_mztf,imu ) 69 istyle=2 70 call mzescape_normaliz ( taustar11, istyle ) 71 else 72 call mztud (ig, c110,cup110,cdw110, vc110,taugr110, 73 @ 1, 1, irw_mztf, imu, 0,0,0 ) 74 endif 75 call mztvc (ig,vc210, 1, 2, irw_mztf, imu, 0,0,0 ) 76 call mztvc (ig,vc310, 1, 3, irw_mztf, imu, 0,0,0 ) 77 call mztvc (ig,vc410, 1, 4, irw_mztf, imu, 0,0,0 ) 78 79 call mzescape_fb (ig) 80 input_cza = 0 81 call NLTEdlvr09_CZALU(ig) 96 c110(1:nl,1:nl)=0.d0 97 ! call zerom (c110, nl) 98 call zero2v (vc110,taustar11, nl) 99 call MZTUD110 ( ierr, varerr ) 100 if (ierr .gt. 0) goto 900 101 102 input_cza = 0 103 call NLTEdlvr11_CZALU 104 105 input_cza = 1 106 call NLTEdlvr11_CZALU 107 108 ! call NLTEdlvr11_FB626CTS 109 ! Falta un merging del hr110CTS con el HR110 110 111 112 ! ! Interpolation of Tstar11(nl) to the GCM grid (será auxgcm) 113 ! ! solo entre jlowerboundary y jtopboundary (la extension del NLTE 114 ! ! model) 115 ! call interhuntlimits( auxgcm, p_gcm,n_gcm, 116 ! @ jlowerboundary,jtopboundary, 117 ! @ taustar11, pl, nl, 3 ) 118 ! ! Mejor inter+extra polacion de Tstar11(nl) to the GCM grid 119 ! call TSTAR11_extension (n_gcm, p_gcm, auxgcm ) 120 121 ! NLTE-CTS 122 call NLTEdlvr11_FB626CTS ( hr110CTS , nl_cts_real ) 123 124 125 126 ! total TCR 127 do i = 1, nl 128 q15umco2_nltot(i) =hr110(i) + hr210(i) + hr310(i) + hr410(i) 129 @ + hr121(i) 130 enddo 131 82 132 83 if (itt_cza.ne.24) then 84 call mzescape_fh (ig) 85 input_cza = 1 86 call NLTEdlvr09_CZALU(ig) 87 endif 88 89 c total cooling rate 90 c smoothing and 91 c interpolation back to original Pgrid 92 c 93 do i = 1, nl 94 q15umco2_nl(i) = hr110(i) + hr210(i) + hr310(i) + hr410(i) 95 @ + hr121(i) 96 enddo 97 98 do i=1,nl 99 zld(i) = - dble ( alog(pl(i)) ) 100 enddo 101 do i=1,n_gcm 102 zgcmd(i) = - dble( alog(p_gcm(ig,i)) ) 103 enddo 104 call zerov( auxdgcm, n_gcm ) 105 call interdp_limits 106 @ (auxdgcm,zgcmd,n_gcm,jlowerboundary,jtopboundary, 107 @ q15umco2_nl,zld,nl,1,nl,1) 108 call suaviza ( auxdgcm, n_gcm, 1, zgcmd ) 109 110 do i=1,n_gcm 111 q15umco2_gcm(ig,i) = sngl( auxdgcm(i) ) 133 ! Merging con / actualizacion del HR_total 134 ! Eliminamos el ultimo pto de hrTotal, y en el penultimo 135 ! (que coincide con i=1 en el grid nl_cts) 136 ! hacemos la media entre hrTotal y hr110CTS : 137 i=nl-1 138 q15umco2_nltot(i) = 0.5*( q15umco2_nltot(i) + hr110CTS(1) ) 139 do i=2,nl_cts_real 140 indice = (nl-2) + i 141 q15umco2_nltot(indice) = hr110CTS(i) 112 142 enddo 113 114 enddo 115 116 117 c end subroutine 143 do i=nl_cts_real+1,nl_cts 144 indice = (nl-2) + i 145 q15umco2_nltot(indice) = 0.0d0 146 enddo 147 148 ! Interpol to original Pgrid 149 ! 150 ! Primero, la parte conocida ([1,nl_cts_real]) 151 do i=1,nl 152 zld(i) = - dble ( alog(pl(i)) ) 153 !write (*,*) i, zld(i), q15umco2_nltot(i) 154 enddo 155 do i=3,nl_cts_real 156 indice = (nl-2) + i 157 zld(indice) = - dble ( alog(pl_cts(i)) ) 158 !write (*,*) indice, zld(indice), q15umco2_nltot(indice) 159 enddo 160 ! En caso que nl_cts_real < nl_cts , extrapolo el grid alegremente 161 factor = pl_cts(nl_cts_real)/pl_cts(nl_cts_real-1) 162 xx = pl_cts(nl_cts_real) 163 do i=nl_cts_real+1,nl_cts 164 indice = (nl-2) + i 165 xx = xx * factor 166 zld(indice) = - dble ( alog(xx) ) 167 enddo 168 169 do i=1,n_gcm 170 auxgcmd(i) = - dble( alog(p_gcm(ig,i)) ) 171 enddo 172 ! call zerov( aux2gcmd, n_gcm ) 173 aux2gcmd(1:n_gcm)=0.d0 174 call interdp_limits 175 $ ( aux2gcmd, auxgcmd, n_gcm, jlowerboundary,jtopCTS, 176 $ q15umco2_nltot, zld, nltot, 1, nltot, 177 $ 1 ) 178 179 ! Smoothing 180 call suaviza ( aux2gcmd, n_gcm, 1, auxgcmd ) 181 182 do i=1,n_gcm 183 q15umco2_gcm(ig,i) = sngl( aux2gcmd(i) ) 184 enddo 185 186 enddo 187 c end subroutine 118 188 return 119 end 120 189 190 c Error messages 191 900 write (*,*) ' ERROR in MZTUD (banda 110). ierr=',ierr 192 write (*,*) ' VAR available : ', varerr 193 return 194 195 901 write (*,*) ' ERROR in MZTVC for vc210. ierr=',ierr 196 write (*,*) ' VAR available : ', varerr 197 return 198 199 902 write (*,*) ' ERROR in MZTVC for vc310. ierr=',ierr 200 write (*,*) ' VAR available : ', varerr 201 return 202 203 903 write (*,*) ' ERROR in MZTVC for vc410. ierr=',ierr 204 write (*,*) ' VAR available : ', varerr 205 return 206 207 904 write (*,*) ' ERROR in mzescape_fb ierr=',ierr 208 write (*,*) ' VAR available : ', varerr 209 return 210 211 930 write (*,*) ' ERROR in mztvc3iso. Temp is NaN' 212 write (*,*) ' ierr , VAR =', ierr, varerr 213 if (ierr.eq.30) write (*,*) ' During computation of VC210.' 214 if (ierr.eq.31) write (*,*) ' During computation of VC310.' 215 if (ierr.eq.32) write (*,*) ' During computation of VC410.' 216 return 217 218 c end subroutine 219 end 121 220 122 221 123 222 c*********************************************************************** 124 223 125 subroutine NLTEdlvr09_ZGRID (n_gcm, 126 @ p_gcm, t_gcm, z_gcm, 127 @ co2vmr_gcm, n2vmr_gcm, covmr_gcm, o3pvmr_gcm ,mmean_gcm, 128 @ cpnew_gcm) 129 130 c jul 2011 malv+fgg First version 224 subroutine NLTEdlvr11_ZGRID_02 (n_gcm, 225 $ p_gcm, t_gcm, z_gcm, co2vmr_gcm, n2vmr_gcm, 226 $ covmr_gcm, o3pvmr_gcm, mmean_gcm,cpnew_gcm, 227 $ nl_cts_real, nzy_cts_real ) 228 131 229 c*********************************************************************** 132 133 implicit none 134 135 include "dimensions.h" 136 include "dimphys.h" 230 231 implicit none 232 137 233 include 'nlte_paramdef.h' 138 234 include 'nlte_commons.h' 139 include 'chimiedata.h' 140 include 'conc.h' 141 142 c Arguments 143 integer n_gcm 144 real p_gcm(n_gcm), t_gcm(n_gcm) 145 real co2vmr_gcm(n_gcm), n2vmr_gcm(n_gcm) 146 real covmr_gcm(n_gcm), o3pvmr_gcm(n_gcm) 147 real z_gcm(n_gcm) 148 real mmean_gcm(n_gcm) 149 real cpnew_gcm(n_gcm) 150 151 c local variables 152 integer i, j , iz 153 ! real distancia, meanm, gz, Hkm 154 real zmin, zmax, deltazz, deltazzy 155 real nt_gcm(n_gcm) 235 236 c Arguments 237 integer n_gcm ! I 238 real p_gcm(n_gcm), t_gcm(n_gcm) ! I 239 real co2vmr_gcm(n_gcm), n2vmr_gcm(n_gcm) ! I 240 real covmr_gcm(n_gcm), o3pvmr_gcm(n_gcm) ! I 241 real z_gcm(n_gcm) ! I 242 real mmean_gcm(n_gcm) ! I 243 real cpnew_gcm(n_gcm) ! I 244 integer nl_cts_real, nzy_cts_real ! O 245 246 c local variables 247 integer i, iz 248 real distancia, meanm, gz, Hkm 249 real zmin, zmax 156 250 real mmean_nlte(n_gcm),cpnew_nlte(n_gcm) 157 158 c functions159 external hrkday_convert 160 real hrkday_convert161 251 252 c functions 253 external hrkday_convert 254 real hrkday_convert 255 162 256 c*********************************************************************** 163 257 164 165 ! Define working grid for MZ1D model (NL, ZL, ZMIN) 166 ! y otro mas fino para M.Curtis (NZ, ZX, ZXMIN = ZMIN 167 168 ! Para ello hace falta una z de ref del GCM, que voy a suponer la inferior 169 170 ! Primero, construimos escala z_gcm 171 172 ! z_gcm (1) = zmin_gcm ! [km] 173 174 !write (*,*) ' iz, p, g, H, z =', 1, p_gcm(1), z_gcm(1) 175 ! do iz = 2, n_gcm 176 ! do iz=1,n_gcm 177 ! z_gcm(iz)=zlay(iz)/1.e3 178 179 ! meanm = ( co2vmr_gcm(iz)*44. + o3pvmr_gcm(iz)*16. 180 ! @ + n2vmr_gcm(iz)*28. + covmr_gcm(iz)*28. ) 181 ! meanm = meanm / n_avog 182 ! distancia = ( radio + z_gcm(iz-1) )*1.e5 183 ! gz = gg * masa / ( distancia * distancia ) 184 ! Hkm = 0.5*( t_gcm(iz)+t_gcm(iz-1) ) / ( meanm * gz ) 185 ! Hkm = kboltzman * Hkm *1e-5 ! [km] 186 ! z_gcm(iz) = z_gcm(iz-1) - Hkm * log( p_gcm(iz)/p_gcm(iz-1) ) 187 188 !write (*,*) iz, p_gcm(iz), gz, Hkm, z_gcm(iz) 189 190 ! enddo 191 ! Segundo, definimos los límites del modelo, entre las 2 presiones clave 192 193 ! Bottom boundary for NLTE model : Pbottom=2e-2mb=1.974e-5 atm 194 jlowerboundary = 1 258 ! Define el working grid para MZ1D (NL, ZL, ZMIN) 259 ! y otro mas fino para M.Curtis (NZ, ZX, ZXMIN = ZMIN) 260 ! Tambien el working grid para MZESC110 (NL_cts, ZL_cts, ZMIN_cts=??) 261 ! Para ello hace falta una z de ref del GCM, que voy a suponer la inferior 262 263 ! Primero, construimos escala z_gcm 264 265 ! z_gcm(1) = zmin_gcm ! [km] 266 267 ! do iz = 2, n_gcm 268 ! meanm = ( co2vmr_gcm(iz)*44. + o3pvmr_gcm(iz)*16. 269 ! @ + n2vmr_gcm(iz)*28. + covmr_gcm(iz)*28. ) 270 ! meanm = meanm / n_avog 271 ! distancia = ( radio + z_gcm(iz-1) )*1.e5 272 ! gz = gg * masa / ( distancia * distancia ) 273 ! Hkm = 0.5*( t_gcm(iz)+t_gcm(iz-1) ) / ( meanm * gz ) 274 ! Hkm = kboltzman * Hkm *1e-5 ! [km] 275 ! z_gcm(iz) = z_gcm(iz-1) - Hkm * log( p_gcm(iz)/p_gcm(iz-1) ) 276 ! enddo 277 278 ! Segundo, definimos los límites de los 2 modelos de NLTE. 279 ! NLTE model completo: indices [jlowerboundary,jtopboundary] 280 ! NLTE CTS : indices [jbotCTS,jtopCTS] donde jbotCTS = jtopboundary-2 281 282 !!!!!!!!!Primero el NLTE completo !!!!!!!! 283 284 ! Bottom boundary for NLTE model : 285 ! Pbot_atm = 2e-2 mb = 1.974e-5 atm , lnp(nb)=9.9 (see mz1d.par) 286 jlowerboundary = 1 195 287 do while ( p_gcm(jlowerboundary) .gt. Pbottom_atm ) 196 288 jlowerboundary = jlowerboundary + 1 197 enddo 289 if (jlowerboundary .gt. n_gcm) then 290 write (*,*) 'Error in lower boundary pressure.' 291 write (*,*) ' p_gcm too low or wrong. ' 292 write (*,*) ' p_gcm, Pbottom_atm =', 293 $ p_gcm(n_gcm), Pbottom_atm 294 stop ' Check input value "p_gcm" or modify "Pbottom_atm" ' 295 endif 296 enddo 297 298 ! Top boundary for NLTE model : 299 ! Ptop_atm = 1e-9 atm (see mz1d.par) 300 jtopboundary = jlowerboundary 301 do while ( p_gcm(jtopboundary) .gt. Ptop_atm ) 302 jtopboundary = jtopboundary + 1 303 if (jtopboundary .gt. n_gcm) then 304 write (*,*) '!!!!!!!! Warning in top boundary pressure. ' 305 write (*,*) ' Ptop_atm too high for p_gcm. ' 306 write (*,*) ' p_gcm, Ptop_atm =', 307 $ p_gcm(n_gcm), Ptop_atm 308 write (*,*) '!!!!!!!! NLTE upper boundary modified '// 309 $ ' to match p_gcm' 310 jtopboundary=n_gcm 311 goto 5000 312 endif 313 enddo 314 5000 continue 315 316 ! Grid steps 317 198 318 zmin = z_gcm(jlowerboundary) 199 ! write (*,*) ' jlowerboundary, Pmin, zmin =',200 ! @ jlowerboundary, p_gcm(jlowerboundary), zmin201 202 ! Top boundary for NLTE model : Ptop=2e-7mb = 1.974e-5 atm203 jtopboundary = jlowerboundary204 do while ( p_gcm(jtopboundary) .gt. Ptop_atm )205 jtopboundary = jtopboundary + 1206 enddo207 319 zmax = z_gcm(jtopboundary) 208 ! write (*,*) ' jtopboundary, Pmax, zmax =', 209 ! @ jtopboundary, p_gcm(jtopboundary),zmax 210 211 deltaz = (zmax-zmin) / (nl-1) 212 do i=1,nl 320 deltaz = (zmax-zmin) / (nl-1) 321 do i=1,nl 213 322 zl(i) = zmin + (i-1) * deltaz 214 enddo 215 ! write (*,*) ' ZL grid: dz,zmin,zmax ', deltaz, zl(1),zl(nl) 216 ! Creamos el perfil interpolando 217 call intersp ( pl,zl,nl, p_gcm,z_gcm,n_gcm, 2) ! [atm] 218 call intersp ( t,zl,nl, t_gcm,z_gcm,n_gcm, 1) 219 do i = 1, n_gcm 220 nt_gcm(i) = 7.339e+21 * p_gcm(i) / t_gcm(i) ! [cm-3] 221 enddo 222 call intersp ( nt,zl,nl, nt_gcm,z_gcm,n_gcm, 2) 223 call intersp (co2vmr,zl,nl, co2vmr_gcm,z_gcm,n_gcm, 1) 224 call intersp ( n2vmr,zl,nl, n2vmr_gcm,z_gcm,n_gcm, 1) 225 call intersp ( covmr,zl,nl, covmr_gcm,z_gcm,n_gcm, 1) 226 call intersp (o3pvmr,zl,nl, o3pvmr_gcm,z_gcm,n_gcm, 1) 227 call intersp (mmean_nlte,zl,nl,mmean_gcm,z_gcm,n_gcm,1) 228 call intersp (cpnew_nlte,zl,nl,cpnew_gcm,z_gcm,n_gcm,1) 229 323 enddo 324 325 326 ! Creamos el perfil del NLTE modelo completo interpolando 327 328 call interhunt ( pl,zl,nl, p_gcm,z_gcm,n_gcm, 2) ! [atm] 329 call interhunt5veces 330 $ ( t, co2vmr, n2vmr, covmr, o3pvmr, 331 $ zl, nl, 332 $ t_gcm, co2vmr_gcm, n2vmr_gcm, covmr_gcm, o3pvmr_gcm, 333 $ z_gcm, n_gcm, 334 $ 1 ) 335 call interhunt ( mmean_nlte,zl,nl,mmean_gcm,z_gcm,n_gcm,1) 336 call interhunt ( cpnew_nlte,zl,nl,cpnew_gcm,z_gcm,n_gcm,1) 230 337 231 338 do i = 1, nl 232 339 nt(i) = 7.339e+21 * pl(i) / t(i) ! --> [cm-3] 233 340 co2(i) = nt(i) * co2vmr(i) 234 341 n2(i) = nt(i) * n2vmr(i) 235 342 co(i) = nt(i) * covmr(i) 236 343 o3p(i) = nt(i) * o3pvmr(i) 237 238 ! hrkday_factor(i) = hrkday_convert( t(i), 239 ! @ co2vmr(i), o3pvmr(i), n2vmr(i), covmr(i) ) 344 ! hrkday_factor(i) = hrkday_convert( t(i), 345 ! $ co2vmr(i), o3pvmr(i), n2vmr(i), covmr(i) ) 240 346 hrkday_factor(i) = hrkday_convert(mmean_nlte(i) 241 & ,cpnew_nlte(i)) 242 243 enddo 244 245 246 247 c Fine grid for transmittance calculations 248 249 deltazy = (zmax-zmin) / (nzy-1) 250 do i=1,nzy 251 zy(i) = zmin + (i-1) * deltazy 252 enddo 253 ! write (*,*) ' ZY grid: nzy,dzy,zmin,zmax ', 254 ! @ nzy, deltazy, zy(1),zy(nzy) 255 256 call intersp ( py,zy,nzy, p_gcm,z_gcm,n_gcm, 2) ! [atm] 257 call intersp ( ty,zy,nzy, t_gcm,z_gcm,n_gcm, 1) 258 call intersp ( nty,zy,nzy, nt_gcm,z_gcm,n_gcm, 2) 347 & ,cpnew_nlte(i)) 348 enddo 259 349 260 call intersp ( co2y,zy,nzy, co2vmr_gcm,z_gcm,n_gcm, 1) 261 do i=1,nzy 350 ! Comprobar que las temps no se salen del grid del histograma 351 352 do i=1,nl 353 if (t(i) .gt. 400.0) then 354 write (*,*) '!!!! WARNING Temp higher than Histogram.' 355 write (*,*) ' Histogram will be extrapolated. ' 356 write (*,*) ' i, t(i), pl(i) =', i, t(i), pl(i) 357 endif 358 if (t(i) .lt. 50.0) then 359 write (*,*) '!!!! WARNING Temp lower than Histogram.' 360 write (*,*) ' Histogram will be extrapolated. ' 361 write (*,*) ' i, t(i), pl(i) =', i, t(i), pl(i) 362 endif 363 enddo 364 365 ! Fine grid for transmittance calculations 366 367 zmin = z_gcm(jlowerboundary) 368 zmax = z_gcm(jtopboundary) 369 deltazy = (zmax-zmin) / (nzy-1) 370 do i=1,nzy 371 zy(i) = zmin + (i-1) * deltazy 372 enddo 373 call interhunt ( py,zy,nzy, p_gcm,z_gcm,n_gcm, 2) ! [atm] 374 call interhunt2veces ( ty,co2y, zy,nzy, 375 $ t_gcm,co2vmr_gcm, z_gcm,n_gcm, 1) 376 377 do i=1,nzy 378 nty(i) = 7.339e+21 * py(i) / ty(i) ! --> [cm-3] 262 379 co2y(i) = co2y(i) * nty(i) 263 380 enddo 264 381 265 382 266 267 268 c end 269 return 270 end 271 272 383 !!!!!!!!!Segundo, el NLTE - CTS !!!!!!!! 384 385 ! Grid steps 386 deltaz_cts = deltaz 387 zl_cts(1) = zl(nl-1) 388 nl_cts_real = 1 389 do i=2,nl_cts 390 zl_cts(i) = zl_cts(1) + (i-1)*deltaz_cts 391 if (zl_cts(i) .gt. z_gcm(n_gcm)) then 392 write (*,*) '!!!!!!!! Warning in top CTS layers. ' 393 write (*,*) ' zl_Cts too high for z_gcm. ' 394 write (*,*) ' z_gcm, zl_cts(i), i =', 395 $ z_gcm(n_gcm), zl_cts(i), i 396 write (*,*) '!!!!!!!! NLTE-CTS upper boundary modified '// 397 $ ' to match z_gcm' 398 nl_cts_real=i-1 399 write (*,*) ' Original,Real NL_CTS=', nl_cts,nl_cts_real 400 goto 6000 401 endif 402 enddo 403 nl_cts_real = nl_cts 404 6000 continue 273 405 274 406 ! Creamos perfil por interpolacion 407 408 call interhuntlimits ( pl_cts,zl_cts,nl_cts, 1,nl_cts_real, 409 $ p_gcm,z_gcm,n_gcm, 2) 410 call interhuntlimits5veces 411 $ ( t_cts, co2vmr_cts, n2vmr_cts, covmr_cts, o3pvmr_cts, 412 $ zl_cts, nl_cts, 413 $ 1,nl_cts_real, 414 $ t_gcm, co2vmr_gcm, n2vmr_gcm, covmr_gcm, o3pvmr_gcm, 415 $ z_gcm, n_gcm, 416 $ 1 ) 417 call interhuntlimits( cpnew_cts,zl_cts,nl_cts,1,nl_cts_real, 418 $ cpnew_gcm,z_gcm,n_gcm, 1) 419 call interhuntlimits( mmean_cts,zl_cts,nl_cts,1,nl_cts_real, 420 $ mmean_gcm,z_gcm,n_gcm, 1) 421 422 do i = 1, nl_cts_real 423 nt_cts(i) = 7.339e+21 * pl_cts(i) / t_cts(i) ! --> [cm-3] 424 co2_cts(i) = nt_cts(i) * co2vmr_cts(i) 425 n2_cts(i) = nt_cts(i) * n2vmr_cts(i) 426 co_cts(i) = nt_cts(i) * covmr_cts(i) 427 o3p_cts(i) = nt_cts(i) * o3pvmr_cts(i) 428 hrkday_factor_cts(i) = hrkday_convert( mmean_cts(i) 429 & ,cpnew_cts(i) ) 430 enddo 431 432 ! Comprobar que las temps no se salen del grid del histograma 433 do i=1,nl_cts_real 434 if (t_cts(i) .gt. 400.0) then 435 write (*,*) '!!!! WARNING Temp higher than Histogram.' 436 write (*,*) ' ZGRID: Histogram will be extrapolated. ' 437 write (*,*) ' i, t(i), pl(i) =', i, t_cts(i), pl_cts(i) 438 endif 439 if (t_cts(i) .lt. 50.0) then 440 write (*,*) '!!!! WARNING Temp lower than Histogram.' 441 write (*,*) ' ZGRID: Histogram will be extrapolated. ' 442 write (*,*) ' i, t(i), pl(i) =', i, t_cts(i), pl_cts(i) 443 endif 444 enddo 445 446 ! Calculo del indice maximo del GCM hasta donde llega el NLTE-CTS 447 jtopCTS = jtopboundary 448 do while ( p_gcm(jtopCTS) .gt. pl_cts(nl_cts_real) ) 449 jtopCTS = jtopCTS + 1 450 if (jtopCTS .gt. n_gcm) then 451 write (*,*) '!!!!!!!! Warning in top boundary pressure. ' 452 write (*,*) ' Ptop_NLTECTS too high for p_gcm. ' 453 write (*,*) ' p_gcm, Ptop_NLTECTS =', 454 $ p_gcm(n_gcm), pl_cts(nl_cts_real) 455 write (*,*) '!!!!!!!! NLTE-CTS upper boundary modified '// 456 $ ' to match p_gcm' 457 jtopCTS=n_gcm 458 goto 7000 459 endif 460 enddo 461 7000 continue 462 463 ! Fine grid for transmittance calculations 464 465 deltazy_cts = 0.25*deltaz_cts ! Comprobar el factor 4 en mz1d.par 466 do i=1,nzy_cts 467 zy_cts(i) = zl_cts(1) + (i-1) * deltazy_cts 468 enddo 469 nzy_cts_real = (nl_cts_real - 1)*4 + 1 470 call interhuntlimits ( py_cts,zy_cts,nzy_cts, 1,nzy_cts_real, 471 $ p_gcm, z_gcm, n_gcm, 2) ! [atm] 472 call interhuntlimits2veces 473 $ ( ty_cts,co2y_cts, zy_cts,nzy_cts, 1,nzy_cts_real, 474 $ t_gcm,co2vmr_gcm, z_gcm,n_gcm, 1) 475 476 do i=1,nzy_cts_real 477 nty_cts(i) = 7.339e+21 * py_cts(i) / ty_cts(i) ! --> [cm-3] 478 co2y_cts(i) = co2y_cts(i) * nty_cts(i) 479 enddo 480 481 ! write (*,*) ' NL = ', NL 482 ! write (*,*) ' Original,Real NL_CTS=', nl_cts,nl_cts_real 483 ! write (*,*) ' Original,Real NZY_CTS =', nzy_cts,nzy_cts_real 484 485 486 487 c end 488 return 489 end 490 491 492 c *** Old NLTEdlvr11_CZALU_03 *** 493 494 c********************************************************************** 495 496 497 subroutine NLTEdlvr11_CZALU 498 275 499 c*********************************************************************** 276 277 subroutine NLTEdlvr09_CZALU(ig) 278 279 c jul 2011 malv+fgg 280 c*********************************************************************** 281 282 implicit none 283 284 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! common variables and constants 285 500 501 implicit none 502 503 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!common variables and constants 504 286 505 include 'nlte_paramdef.h' 287 506 include 'nlte_commons.h' 288 289 c arguments 290 291 integer ig !ADDED FOR TRACEBACK 292 293 c local variables 294 295 ! matrixes and vectors 296 297 real*8 e110(nl), e210(nl), e310(nl), e410(nl) 298 real*8 e121(nl), e112(nl) 299 507 508 509 c local variables 510 511 ! matrixes and vectors 512 513 real*8 e110(nl), e210(nl), e310(nl), e410(nl) 514 real*8 e121(nl) 300 515 real*8 f1(nl,nl) 301 302 real*8 cax1(nl,nl), cax2(nl,nl), cax3(nl,nl) 516 517 real*8 cax1(nl,nl), cax2(nl,nl), cax3(nl,nl) 303 518 real*8 v1(nl), v2(nl), v3(nl) 304 305 real*8 alf11(nl,nl), alf12(nl,nl) 306 real*8 alf21(nl,nl), alf31(nl,nl), alf41(nl,nl) 307 real*8 a11(nl), a1112(nl,nl) 308 real*8 a1121(nl,nl), a1131(nl,nl), a1141(nl,nl) 309 real*8 a21(nl), a2131(nl,nl), a2141(nl,nl) 310 real*8 a2111(nl,nl), a2112(nl,nl) 311 real*8 a31(nl), a3121(nl,nl), a3141(nl,nl) 312 real*8 a3111(nl,nl), a3112(nl,nl) 313 real*8 a41(nl), a4121(nl,nl), a4131(nl,nl) 314 real*8 a4111(nl,nl), a4112(nl,nl) 315 real*8 a12(nl), a1211(nl,nl) 316 real*8 a1221(nl,nl), a1231(nl,nl), a1241(nl,nl) 317 318 real*8 aalf11(nl,nl),aalf21(nl,nl),aalf31(nl,nl),aalf41(nl,nl) 319 real*8 aa11(nl), aa1121(nl,nl), aa1131(nl,nl), aa1141(nl,nl) 320 real*8 aa21(nl), aa2111(nl,nl), aa2131(nl,nl), aa2141(nl,nl) 321 real*8 aa31(nl), aa3111(nl,nl), aa3121(nl,nl), aa3141(nl,nl) 322 real*8 aa41(nl), aa4111(nl,nl), aa4121(nl,nl), aa4131(nl,nl) 323 real*8 aa12(nl) 324 real*8 aa1211(nl,nl), aa1221(nl,nl), aa1231(nl,nl), aa1241(nl,nl) 325 real*8 aa1112(nl,nl), aa2112(nl,nl), aa3112(nl,nl), aa4112(nl,nl) 326 327 real*8 aaalf11(nl,nl),aaalf21(nl,nl),aaalf31(nl,nl), 328 & aaalf41(nl,nl) 329 real*8 aaa11(nl),aaa1121(nl,nl),aaa1131(nl,nl),aaa1141(nl,nl) 330 real*8 aaa21(nl),aaa2111(nl,nl),aaa2131(nl,nl),aaa2141(nl,nl) 331 real*8 aaa31(nl),aaa3111(nl,nl),aaa3121(nl,nl),aaa3141(nl,nl) 332 real*8 aaa41(nl),aaa4111(nl,nl),aaa4121(nl,nl),aaa4131(nl,nl) 333 334 real*8 aaaalf11(nl,nl),aaaalf41(nl,nl) 335 real*8 aaaa11(nl),aaaa1141(nl,nl) 336 real*8 aaaa41(nl),aaaa4111(nl,nl) 337 338 339 340 ! populations 341 real*8 n10(nl), n11(nl) 519 real*8 alf11(nl,nl), alf12(nl,nl) 520 real*8 alf21(nl,nl), alf31(nl,nl), alf41(nl,nl) 521 real*8 a11(nl), a1112(nl,nl) 522 real*8 a1121(nl,nl), a1131(nl,nl), a1141(nl,nl) 523 real*8 a21(nl), a2131(nl,nl), a2141(nl,nl) 524 real*8 a2111(nl,nl), a2112(nl,nl) 525 real*8 a31(nl), a3121(nl,nl), a3141(nl,nl) 526 real*8 a3111(nl,nl), a3112(nl,nl) 527 real*8 a41(nl), a4121(nl,nl), a4131(nl,nl) 528 real*8 a4111(nl,nl), a4112(nl,nl) 529 real*8 a12(nl), a1211(nl,nl) 530 real*8 a1221(nl,nl), a1231(nl,nl), a1241(nl,nl) 531 532 real*8 aalf11(nl,nl),aalf21(nl,nl), 533 @ aalf31(nl,nl),aalf41(nl,nl) 534 real*8 aa11(nl), aa1121(nl,nl), aa1131(nl,nl), aa1141(nl,nl) 535 real*8 aa21(nl), aa2111(nl,nl), aa2131(nl,nl), aa2141(nl,nl) 536 real*8 aa31(nl), aa3111(nl,nl), aa3121(nl,nl), aa3141(nl,nl) 537 real*8 aa41(nl), aa4111(nl,nl), aa4121(nl,nl), aa4131(nl,nl) 538 real*8 aa1211(nl,nl),aa1221(nl,nl), 539 @ aa1231(nl,nl),aa1241(nl,nl) 540 real*8 aa1112(nl,nl),aa2112(nl,nl), 541 @ aa3112(nl,nl),aa4112(nl,nl) 542 543 real*8 aaalf11(nl,nl), aaalf31(nl,nl), aaalf41(nl,nl) 544 real*8 aaa11(nl),aaa1131(nl,nl),aaa1141(nl,nl) 545 real*8 aaa31(nl),aaa3111(nl,nl),aaa3141(nl,nl) 546 real*8 aaa41(nl),aaa4111(nl,nl),aaa4131(nl,nl) 547 548 real*8 aaaalf11(nl,nl),aaaalf41(nl,nl) 549 real*8 aaaa11(nl),aaaa1141(nl,nl) 550 real*8 aaaa41(nl),aaaa4111(nl,nl) 551 552 553 ! populations 554 real*8 n10(nl), n11(nl), n12(nl) 342 555 real*8 n20(nl), n21(nl) 343 556 real*8 n30(nl), n31(nl) 344 557 real*8 n40(nl), n41(nl) 345 346 347 ! productions and loses 348 real*8 d19a1,d19b1,d19c1 349 real*8 d19ap1,d19bp1,d19cp1 350 real*8 d19a2,d19b2,d19c2 351 real*8 d19ap2,d19bp2,d19cp2 352 real*8 d19a3,d19b3,d19c3 353 real*8 d19ap3,d19bp3,d19cp3 354 real*8 d19a4,d19b4,d19c4 355 real*8 d19ap4,d19bp4,d19cp4 356 357 real*8 l11, l12, l21, l31, l41 358 real*8 p11, p12, p21, p31, p41 359 real*8 p1112, p1211, p1221, p1231, p1241 360 real*8 p1121, p1131, p1141 361 real*8 p2111, p2112, p2131, p2141 362 real*8 p3111, p3112, p3121, p3141 363 real*8 p4111, p4112, p4121, p4131 364 365 366 real*8 ps11, ps21, ps31, ps41, ps12 367 368 real*8 pl11, pl12, pl21, pl31, pl41 369 370 c local constants and indexes 371 372 integer ii ! decides if output of tv,hr 373 integer icurt ! decides if read/comp c.matrix 374 375 real*8 co2t 376 real*8 ftest 377 378 real*8 a11_einst(nl), a12_einst(nl) 379 real*8 a21_einst(nl), a31_einst(nl), a41_einst(nl) 380 real tsurf 381 382 real*8 nu11, nu12, nu121, nu21, nu31, nu41 383 384 integer i, j, ik, isot , icurtishb 385 integer i_by15sh, i_col020, i_col010636 386 387 388 c external functions and subroutines 389 390 external planckdp 391 real*8 planckdp 392 393 ! subroutines called: 394 ! mz4sub, dmzout, readc_mz4, mztf 395 396 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! start program 397 398 399 ii = 4 400 icurt = 1 558 559 ! productions and loses 560 real*8 d19b1,d19c1 561 real*8 d19bp1,d19cp1 562 real*8 d19c2 563 real*8 d19cp2 564 real*8 d19c3 565 real*8 d19cp3 566 real*8 d19c4 567 real*8 d19cp4 568 569 real*8 l11, l12, l21, l31, l41 570 real*8 p11, p12, p21, p31, p41 571 real*8 p1112, p1211, p1221, p1231, p1241 572 real*8 p1121, p1131, p1141 573 real*8 p2111, p2112, p2131, p2141 574 real*8 p3111, p3112, p3121, p3141 575 real*8 p4111, p4112, p4121, p4131 576 577 real*8 pl11, pl12, pl21, pl31, pl41 578 579 580 c local constants and indexes 581 582 real*8 co2t, o3pdbl, codble, n2dble 583 real*8 a12_einst(nl) 584 real*8 a21_einst(nl), a31_einst(nl), a41_einst(nl) 585 real tsurf 586 587 integer i, isot 588 589 c external functions and subroutines 590 591 external planckdp 592 real*8 planckdp 593 594 595 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!start program 596 401 597 402 598 call zero4v( aa11, aa21, aa31, aa41, nl) … … 414 610 call zero2m( aaaa1141, aaaalf11, nl) 415 611 call zero2m( aaaa4111, aaaalf41, nl) 416 417 !write (*,*) ' --- c z a simple --- input_cza : ', input_cza 418 419 420 call zero3v (vt11,vt12,vt13,nl) 421 call zero3v (vt21,vt22,vt23,nl) 422 call zero3v (vt31,vt32,vt33,nl) 423 call zero3v (vt41,vt42,vt43,nl) 424 425 call zero3v (hr110,hr121,hr132,nl) 426 call zero3v (hr210,hr221,hr232,nl) 427 call zero3v (hr310,hr321,hr332,nl) 428 call zero3v (hr410,hr421,hr432,nl) 429 call zero3v (sl110,sl121,sl132,nl) 430 call zero3v (sl210,sl221,sl232,nl) 431 call zero3v (sl310,sl321,sl332,nl) 432 call zero3v (sl410,sl421,sl432,nl) 433 434 call zero4v (el11,el21,el31,el41,nl) 435 call zero4v (e110,e210,e310,e410,nl) 436 call zero3v (el12,e121,e112,nl) 437 438 call zero3m (cax1,cax2,cax3,nl) 439 call zerom (f1,nl) 440 call zero3v (v1,v2,v3,nl) 441 442 call zero4m (alf11,alf21,alf31,alf41,nl) 443 call zerom (alf12,nl) 444 call zero2v (a11,a12,nl) 445 call zero3v (a21,a31,a41,nl) 446 447 call zero3m (a1121,a1131,a1141,nl) 448 call zerom (a1112,nl) 449 450 call zero3m (a1221,a1231,a1241,nl) 451 call zerom (a1211,nl) 452 453 call zero2m (a2111,a2112,nl) 454 call zero2m (a2131,a2141,nl) 455 call zero2m (a3111,a3112,nl) 456 call zero2m (a3121,a3141,nl) 457 call zero2m (a4111,a4112,nl) 458 call zero2m (a4121,a4131,nl) 459 460 461 call zero4v (n11,n21,n31,n41,nl) 462 463 nu11 = nu(1,1) 464 nu12 = nu(1,2) 465 nu121 = nu12-nu11 466 467 nu21 = nu(2,1) 468 469 nu31 = nu(3,1) 470 471 nu41 = nu(4,1) 472 473 ftest = 1.d0 474 i_by15sh = 1 475 i_col020 = 1 476 477 i_col010636 = 1 478 479 480 101 format(a1) 481 180 format(a80) 482 483 484 c establishing molecular populations needed as input 485 do i=1,nl 486 n10(i) = dble( co2(i) * imr(1) ) 487 n20(i) = dble( co2(i) * imr(2) ) 488 n30(i) = dble( co2(i) * imr(3) ) 489 n40(i) = dble( co2(i) * imr(4) ) 490 if ( input_cza.ge.1 ) then 491 n11(i) = n10(i) *2.d0 *exp( dble(-ee*nu(1,1))/v626t1(i) ) 492 n21(i) = n20(i) *2.d0 *exp( dble(-ee*nu(2,1))/v628t1(i) ) 493 n31(i) = n30(i) *2.d0* exp( dble(-ee*nu(3,1))/v636t1(i) ) 494 n41(i) = n40(i) *2.d0* exp( dble(-ee*nu(4,1))/v627t1(i) ) 495 end if 496 enddo 497 498 cc 499 cc curtis matrix calculation 500 cc 501 if ( input_cza.ge.1 ) then 502 503 if (itt_cza.eq.15 ) then 504 505 call cm15um_hb_simple ( ig,icurt ) 506 507 elseif (itt_cza.eq.13) then 508 509 call mztvc_626fh(ig) 612 613 call zero2v (vt11,vt12,nl) 614 call zero3v (vt21,vt31,vt41,nl) 615 call zero2v (hr110,hr121,nl) 616 call zero3v (hr210,hr310,hr410,nl) 617 call zero2v (sl110,sl121,nl) 618 call zero3v (sl210,sl310,sl410,nl) 619 620 call zero4v (el11,el21,el31,el41,nl) 621 call zero4v (e110,e210,e310,e410,nl) 622 call zero2v (el12,e121,nl) 623 624 call zero3m (cax1,cax2,cax3,nl) 625 f1(1:nl,1:nl)=0.d0 626 ! call zerom (f1,nl) 627 628 call zero3v (v1,v2,v3,nl) 629 630 call zero4m (alf11,alf21,alf31,alf41,nl) 631 alf12(1:nl,1:nl)=0.d0 632 ! call zerom (alf12,nl) 633 call zero2v (a11,a12,nl) 634 call zero3v (a21,a31,a41,nl) 635 636 call zero3m (a1121,a1131,a1141,nl) 637 a1112(1:nl,1:nl)=0.d0 638 ! call zerom (a1112,nl) 639 640 call zero3m (a1221,a1231,a1241,nl) 641 a1211(1:nl,1:nl)=0.d0 642 ! call zerom (a1211,nl) 643 644 call zero2m (a2111,a2112,nl) 645 call zero2m (a2131,a2141,nl) 646 call zero2m (a3111,a3112,nl) 647 call zero2m (a3121,a3141,nl) 648 call zero2m (a4111,a4112,nl) 649 call zero2m (a4121,a4131,nl) 650 651 call zero2v (n11,n12,nl) 652 call zero3v (n21,n31,n41,nl) 653 654 nu11 = dble(nu(1,1)) 655 nu12 = dble(nu(1,2)) 656 nu121 = nu12-nu11 657 nu21 = dble(nu(2,1)) 658 nu31 = dble(nu(3,1)) 659 nu41 = dble(nu(4,1)) 660 661 c 662 c 663 do i=1,nl 664 n10(i) = dble( co2(i) * imr(1) ) 665 n20(i) = dble( co2(i) * imr(2) ) 666 n30(i) = dble( co2(i) * imr(3) ) 667 n40(i) = dble( co2(i) * imr(4) ) 668 if ( input_cza.ge.1 ) then 669 n11(i) = n10(i) *2.d0 *exp( -ee*nu11/v626t1(i) ) 670 n21(i) = n20(i) *2.d0 *exp( -ee*nu21/v628t1(i) ) 671 n31(i) = n30(i) *2.d0* exp( -ee*nu31/v636t1(i) ) 672 n41(i) = n40(i) *2.d0* exp( -ee*nu41/v627t1(i) ) 673 end if 674 enddo 675 676 c 677 c curtis matrix calculation 678 c 679 call zero3m (c210,c310,c410, nl) 680 681 if ( input_cza.ge.1 ) then 682 683 if (itt_cza.eq.15 ) then 684 685 call MZMC121 686 687 elseif (itt_cza.eq.13) then 688 689 ! call zerom ( c121, nl ) 690 c121(1:nl,1:nl)=0.d0 691 call MZESC121 692 call MZTVC121 510 693 511 694 endif … … 513 696 endif 514 697 698 ! Lower Boundary 699 tsurf = t(1) 700 do i=1,nl 701 sl110(i) = vc110(i) * planckdp( tsurf, nu11 ) 702 sl210(i) = vc210(i) * planckdp( tsurf, nu21 ) 703 sl310(i) = vc310(i) * planckdp( tsurf, nu31 ) 704 sl410(i) = vc410(i) * planckdp( tsurf, nu41 ) 705 end do 706 if (input_cza.ge.1) then 707 do i=1,nl 708 sl121(i) = vc121(i) * planckdp( tsurf, nu121 ) 709 end do 710 endif 711 515 712 516 713 517 714 do 4,i=nl,1,-1 !---------------------------------------------- 518 715 519 co2t = dble ( co2(i) *(imr(1)+imr(3)+imr(2)+imr(4)) ) 520 521 call getk ( t(i) ) 522 523 ps11 = 0.d0 524 ps21 = 0.d0 525 ps31 = 0.d0 526 ps41 = 0.d0 527 ps12 = 0.d0 528 529 ! V-T productions and losses V-T 530 716 co2t = dble( co2(i) *(imr(1)+imr(3)+imr(2)+imr(4)) ) 717 o3pdbl = dble( o3p(i) ) 718 n2dble = dble( n2(i) ) 719 codble = dble ( co(i) ) 720 721 call GETK_dlvr11 ( t(i) ) 722 723 ! V-T productions and losses V-T 724 531 725 isot = 1 532 d19b1 = dble(k19ba(isot)*co2t+k19bb(isot)*n2(i))533 @ + dble(k19bc(isot)*co(i))534 d19c1 = dble(k19ca(isot)*co2t+k19cb(isot)*n2(i))535 @ + dble(k19cc(isot)*co(i))536 d19bp1 = dble( k19bap(isot)*co2t + k19bbp(isot)*n2(i) )537 @ + dble( k19bcp(isot)*co(i) )538 d19cp1 = dble( k19cap(isot)*co2t + k19cbp(isot)*n2(i) )539 @ + dble( k19ccp(isot)*co(i) )726 d19b1 = k19ba(isot)*co2t + k19bb(isot)*n2dble 727 @ + k19bc(isot)*codble 728 d19c1 = k19ca(isot)*co2t + k19cb(isot)*n2dble 729 @ + k19cc(isot)*codble 730 d19bp1 = k19bap(isot)*co2t + k19bbp(isot)*n2dble 731 @ + k19bcp(isot)*codble 732 d19cp1 = k19cap(isot)*co2t + k19cbp(isot)*n2dble 733 @ + k19ccp(isot)*codble 540 734 isot = 2 541 d19c2 = dble(k19ca(isot)*co2t+k19cb(isot)*n2(i))542 @ + dble(k19cc(isot)*co(i))543 d19cp2 = dble( k19cap(isot)*co2t + k19cbp(isot)*n2(i) )544 @ + dble( k19ccp(isot)*co(i) )735 d19c2 = k19ca(isot)*co2t + k19cb(isot)*n2dble 736 @ + k19cc(isot)*codble 737 d19cp2 = k19cap(isot)*co2t + k19cbp(isot)*n2dble 738 @ + k19ccp(isot)*codble 545 739 isot = 3 546 d19c3 = dble(k19ca(isot)*co2t+k19cb(isot)*n2(i))547 @ + dble(k19cc(isot)*co(i))548 d19cp3 = dble( k19cap(isot)*co2t + k19cbp(isot)*n2(i) )549 @ + dble( k19ccp(isot)*co(i) )740 d19c3 = k19ca(isot)*co2t + k19cb(isot)*n2dble 741 @ + k19cc(isot)*codble 742 d19cp3 = k19cap(isot)*co2t + k19cbp(isot)*n2dble 743 @ + k19ccp(isot)*codble 550 744 isot = 4 551 d19c4 =dble(k19ca(isot)*co2t+k19cb(isot)*n2(i)) 552 @ + dble(k19cc(isot)*co(i)) 553 d19cp4 =dble( k19cap(isot)*co2t + k19cbp(isot)*n2(i) ) 554 @ + dble(k19ccp(isot)*co(i) ) 555 ! 556 l11 = d19c1 + k20c(1)*dble(o3p(i)) 557 p11 = ( d19cp1 + k20cp(1)*dble(o3p(i)) ) * n10(i) 558 l21 = d19c2 + k20c(2)*dble(o3p(i)) 559 p21 = ( d19cp2 + k20cp(2)*dble(o3p(i)) ) *n20(i) 560 l31 = d19c3 + k20c(3)*dble(o3p(i)) 561 p31 = ( d19cp3 + k20cp(3)*dble(o3p(i)) ) *n30(i) 562 l41 = d19c4 + k20c(4)*dble(o3p(i)) 563 p41 = ( d19cp4 + k20cp(4)*dble(o3p(i)) ) *n40(i) 564 565 ! Addition of V-V 566 567 l11 = l11 + k21cp(2)*n20(i) + k21cp(3)*n30(i) + k21cp(4)*n40(i) 568 p1121 = k21c(2) * n10(i) 569 p1131 = k21c(3) * n10(i) 570 p1141 = k21c(4) * n10(i) 571 ! 572 l21 = l21 + k21c(2)*n10(i) + k23k21c*n30(i) + k24k21c*n40(i) 573 p2111 = k21cp(2) * n20(i) 574 p2131 = k23k21cp * n20(i) 575 p2141 = k24k21cp * n20(i) 576 ! 577 l31 = l31 + k21c(3)*n10(i) + k23k21cp*n20(i) + k34k21c*n40(i) 578 p3111 = k21cp(3)* n30(i) 579 p3121 = k23k21c * n30(i) 580 p3141 = k34k21cp* n30(i) 581 ! 582 l41 = l41 + k21c(4)*n10(i) + k24k21cp*n20(i) + k34k21cp*n30(i) 583 p4111 = k21cp(4)* n40(i) 584 p4121 = k24k21c * n40(i) 585 p4131 = k34k21c * n40(i) 586 587 588 if ( input_cza.ge.1 ) then 589 590 l12 = d19b1 591 @ + k20b(1)*dble(o3p(i)) 592 @ + k21b(1)*n10(i) 593 @ + k33c*( n20(i) + n30(i) + n40(i) ) 594 p12 = k21bp(1)*n11(i) * n11(i) 595 p1211 = d19bp1 + k20bp(1)*dble(o3p(i)) 596 p1221 = k33cp(2)*n11(i) 597 p1231 = k33cp(3)*n11(i) 598 p1241 = k33cp(4)*n11(i) 599 600 l11 = l11 + d19bp1 601 @ + k20bp(1)*dble(o3p(i)) 602 @ + 2.d0 * k21bp(1) * n11(i) 745 d19c4 = k19ca(isot)*co2t + k19cb(isot)*n2dble 746 @ + k19cc(isot)*codble 747 d19cp4 = k19cap(isot)*co2t + k19cbp(isot)*n2dble 748 @ + k19ccp(isot)*codble 749 ! 750 l11 = d19c1 + k20c(1)*o3pdbl 751 p11 = ( d19cp1 + k20cp(1)*o3pdbl ) * n10(i) 752 l21 = d19c2 + k20c(2)*o3pdbl 753 p21 = ( d19cp2 + k20cp(2)*o3pdbl ) *n20(i) 754 l31 = d19c3 + k20c(3)*o3pdbl 755 p31 = ( d19cp3 + k20cp(3)*o3pdbl ) *n30(i) 756 l41 = d19c4 + k20c(4)*o3pdbl 757 p41 = ( d19cp4 + k20cp(4)*o3pdbl ) *n40(i) 758 759 ! Addition of V-V 760 761 l11 = l11 + k21cp(2)*n20(i) + k21cp(3)*n30(i) 762 @ + k21cp(4)*n40(i) 763 p1121 = k21c(2) * n10(i) 764 p1131 = k21c(3) * n10(i) 765 p1141 = k21c(4) * n10(i) 766 ! 767 l21 = l21 + k21c(2)*n10(i) + k23k21c*n30(i) + k24k21c*n40(i) 768 p2111 = k21cp(2) * n20(i) 769 p2131 = k23k21cp * n20(i) 770 p2141 = k24k21cp * n20(i) 771 ! 772 l31 = l31 + k21c(3)*n10(i) + k23k21cp*n20(i) + k34k21c*n40(i) 773 p3111 = k21cp(3)* n30(i) 774 p3121 = k23k21c * n30(i) 775 p3141 = k34k21cp* n30(i) 776 ! 777 l41 = l41 + k21c(4)*n10(i) + k24k21cp*n20(i) + k34k21cp*n30(i) 778 p4111 = k21cp(4)* n40(i) 779 p4121 = k24k21c * n40(i) 780 p4131 = k34k21c * n40(i) 781 782 783 if ( input_cza.ge.1 ) then 784 785 l12 = d19b1 786 @ + k20b(1)*o3pdbl 787 @ + k21b(1)*n10(i) 788 @ + k33c*( n20(i) + n30(i) + n40(i) ) 789 p12 = k21bp(1)*n11(i) * n11(i) 790 p1211 = d19bp1 + k20bp(1)*o3pdbl 791 p1221 = k33cp(2)*n11(i) 792 p1231 = k33cp(3)*n11(i) 793 p1241 = k33cp(4)*n11(i) 794 795 l11 = l11 + d19bp1 796 @ + k20bp(1)*o3pdbl 797 @ + 2.d0 * k21bp(1) * n11(i) 603 798 @ + k33cp(2)*n21(i) + k33cp(3)*n31(i) + k33cp(4)*n41(i) 604 p1112 = d19b1 605 @ + k20b(1)*dble(o3p(i)) 606 @ + 2.d0*k21b(1)*n10(i) 607 @ + k33c*( n20(i) + n30(i) + n40(i) ) 608 609 l21 = l21 + k33cp(2)*n11(i) 610 p2112 = k33c*n20(i) 611 612 l31 = l31 + k33cp(3)*n11(i) 613 p3112 = k33c*n30(i) 614 615 l41 = l41 + k33cp(4)*n11(i) 616 p4112 = k33c*n40(i) 617 618 end if 619 620 621 ! Changes in local losses for ITT=13,15 cases 622 623 a21_einst(i) = 1.3452d00 * 1.8 / 4.0 * taustar21(i) 624 a31_einst(i) = 1.1878d00 * 1.8 / 4.0 * taustar31(i) 625 a41_einst(i) = 1.2455d00 * 1.8 / 4.0 * taustar41(i) 626 627 l21 = l21 + a21_einst(i) 628 l31 = l31 + a31_einst(i) 629 l41 = l41 + a41_einst(i) 630 631 if (input_cza.ge.1 .and. itt_cza.eq.13) then 632 a12_einst(i) = 4.35d00 / 3.0d0 * 1.8 / 4.0 * taustar12(i) 633 l12=l12+a12_einst(i) 799 p1112 = d19b1 800 @ + k20b(1)*o3pdbl 801 @ + 2.d0*k21b(1)*n10(i) 802 @ + k33c*( n20(i) + n30(i) + n40(i) ) 803 804 l21 = l21 + k33cp(2)*n11(i) 805 p2112 = k33c*n20(i) 806 807 l31 = l31 + k33cp(3)*n11(i) 808 p3112 = k33c*n30(i) 809 810 l41 = l41 + k33cp(4)*n11(i) 811 p4112 = k33c*n40(i) 812 813 end if 814 815 816 ! For ITT=13,15 817 818 a21_einst(i) = a2_010_000 * 1.8d0 / 4.d0 * taustar21(i) 819 a31_einst(i) = a3_010_000 * 1.8d0 / 4.d0 * taustar31(i) 820 a41_einst(i) = a4_010_000 * 1.8d0 / 4.d0 * taustar41(i) 821 822 l21 = l21 + a21_einst(i) 823 l31 = l31 + a31_einst(i) 824 l41 = l41 + a41_einst(i) 825 826 ! For ITT=13 827 if (input_cza.ge.1 .and. itt_cza.eq.13) then 828 a12_einst(i) = a1_020_010/3.d0 * 1.8d0/4.d0 * taustar12(i) 829 l12=l12+a12_einst(i) 634 830 endif 635 831 636 if (itt_cza.eq.24) then 637 a11_einst(i) = a11_einst(i) * 1.8 / 4.0 * taustar11(i) 638 l11 = l11 + a11_einst(i) 639 endif 640 641 642 ! vectors and matrices for the formulation 643 644 a11(i) = dble(gamma*nu11**3.) * 1.d0/2.d0 * (p11+ps11) / 645 @ (n10(i)*l11) 646 a1121(i,i) = dble((nu11/nu21))**3.d0 * n20(i)/n10(i) *p1121/l11 647 a1131(i,i) = dble((nu11/nu31))**3.d0 * n30(i)/n10(i) *p1131/l11 648 a1141(i,i) = dble((nu11/nu41))**3.d0 * n40(i)/n10(i) *p1141/l11 649 e110(i) = 2.d0* dble(vlight*nu11**2.) * 1.d0/2.d0 / 650 @ ( n10(i) * l11 ) 651 652 a21(i) = dble( gamma*nu21**3.) * 1.d0/2.d0 * 653 @ (p21+ps21)/(n20(i)*l21) 654 a2111(i,i) = dble((nu21/nu11))**3.d0 * n10(i)/n20(i) *p2111/l21 655 a2131(i,i) = dble((nu21/nu31))**3.d0 * n30(i)/n20(i) *p2131/l21 656 a2141(i,i) = dble((nu21/nu41))**3.d0 * n40(i)/n20(i) *p2141/l21 657 e210(i) = 2.d0*dble(vlight*nu21**2.) * 1.d0/2.d0 / 658 @ ( n20(i) * l21 ) 659 660 a31(i) = dble(gamma*nu31**3.) * 1.d0/2.d0 * (p31+ps31) / 661 @ (n30(i)*l31) 662 a3111(i,i) = dble((nu31/nu11))**3.d0 * n10(i)/n30(i) *p3111/l31 663 a3121(i,i) = dble((nu31/nu21))**3.d0 * n20(i)/n30(i) *p3121/l31 664 a3141(i,i) = dble((nu31/nu41))**3.d0 * n40(i)/n30(i) *p3141/l31 665 e310(i) = 2.d0*dble(vlight*nu31**2.) * 1.d0/2.d0 / 666 @ ( n30(i) * l31 ) 667 668 a41(i) = dble(gamma*nu41**3.) * 1.d0/2.d0 * (p41+ps41) / 669 @ (n40(i)*l41) 670 a4111(i,i) = dble((nu41/nu11))**3.d0 * n10(i)/n40(i) *p4111/l41 671 a4121(i,i) = dble((nu41/nu21))**3.d0 * n20(i)/n40(i) *p4121/l41 672 a4131(i,i) = dble((nu41/nu31))**3.d0 * n30(i)/n40(i) *p4131/l41 673 e410(i) = 2.d0*dble(vlight*nu41**2.) * 1.d0/2.d0 / 674 @ ( n40(i) * l41 ) 675 676 if (input_cza.ge.1) then 677 678 a1112(i,i) = dble((nu11/nu121))**3.d0 * n11(i)/n10(i) * 679 @ p1112/l11 680 a2112(i,i) = dble((nu21/nu121))**3.d0 * n11(i)/n20(i) * 681 @ p2112/l21 682 a3112(i,i) = dble((nu31/nu121))**3.d0 * n11(i)/n30(i) * 683 @ p3112/l31 684 a4112(i,i) = dble((nu41/nu121))**3.d0 * n11(i)/n40(i) * 685 @ p4112/l41 686 e112(i) = -2.d0*dble(vlight*nu11**3.)/nu121 /2.d0 / 687 @ ( n10(i)*l11 ) 688 a12(i) = dble( gamma*nu121**3.) *2.d0/4.d0* (p12+ps12)/ 689 @ (n11(i)*l12) 690 a1211(i,i) = dble((nu121/nu11))**3.d0 * n10(i)/n11(i) * 691 @ p1211/l12 692 a1221(i,i) = dble((nu121/nu21))**3.d0 * n20(i)/n11(i) * 693 @ p1221/l12 694 a1231(i,i) = dble((nu121/nu31))**3.d0 * n30(i)/n11(i) * 695 @ p1231/l12 696 a1241(i,i) = dble((nu121/nu41))**3.d0 * n40(i)/n11(i) * 697 @ p1241/l12 698 e121(i) = 2.d0*dble(vlight*nu121**2.) *2.d0/4.d0 / 699 @ ( n11(i) * l12 ) 700 701 end if 702 703 704 4 continue !------------------------------------------------------- 705 706 707 ! Change C.M. 708 709 do i=1,nl 710 do j=1,nl 711 c210(i,j) = 0.0d0 712 c310(i,j) = 0.0d0 713 c410(i,j) = 0.0d0 714 end do 715 end do 716 if ( itt_cza.eq.13 ) then 717 do i=1,nl 718 do j=1,nl 719 c121(i,j) = 0.0d0 720 end do 721 end do 832 833 ! 834 835 a11(i) = gamma*nu11**3.d0 * 1.d0/2.d0 * (p11) / 836 @ (n10(i)*l11) 837 a1121(i,i) = (nu11/nu21)**3.d0 * n20(i)/n10(i) * p1121/l11 838 a1131(i,i) = (nu11/nu31)**3.d0 * n30(i)/n10(i) * p1131/l11 839 a1141(i,i) = (nu11/nu41)**3.d0 * n40(i)/n10(i) * p1141/l11 840 e110(i) = 2.d0* vlight*nu11**2.d0 * 1.d0/2.d0 / 841 @ ( n10(i) * l11 ) 842 843 a21(i) = gamma*nu21**3.d0 * 1.d0/2.d0 * 844 @ (p21)/(n20(i)*l21) 845 a2111(i,i) = (nu21/nu11)**3.d0 * n10(i)/n20(i) * p2111/l21 846 a2131(i,i) = (nu21/nu31)**3.d0 * n30(i)/n20(i) * p2131/l21 847 a2141(i,i) = (nu21/nu41)**3.d0 * n40(i)/n20(i) * p2141/l21 848 e210(i) = 2.d0*vlight*nu21**2.d0 * 1.d0/2.d0 / 849 @ ( n20(i) * l21 ) 850 851 a31(i) = gamma*nu31**3.d0 * 1.d0/2.d0 * (p31) / 852 @ (n30(i)*l31) 853 a3111(i,i) = (nu31/nu11)**3.d0 * n10(i)/n30(i) * p3111/l31 854 a3121(i,i) = (nu31/nu21)**3.d0 * n20(i)/n30(i) * p3121/l31 855 a3141(i,i) = (nu31/nu41)**3.d0 * n40(i)/n30(i) * p3141/l31 856 e310(i) = 2.d0*vlight*nu31**2.d0 * 1.d0/2.d0 / 857 @ ( n30(i) * l31 ) 858 859 a41(i) = gamma*nu41**3.d0 * 1.d0/2.d0 * (p41) / 860 @ (n40(i)*l41) 861 a4111(i,i) = (nu41/nu11)**3.d0 * n10(i)/n40(i) * p4111/l41 862 a4121(i,i) = (nu41/nu21)**3.d0 * n20(i)/n40(i) * p4121/l41 863 a4131(i,i) = (nu41/nu31)**3.d0 * n30(i)/n40(i) * p4131/l41 864 e410(i) = 2.d0*vlight*nu41**2.d0 * 1.d0/2.d0 / 865 @ ( n40(i) * l41 ) 866 867 if (input_cza.ge.1) then 868 869 a1112(i,i) = (nu11/nu121)**3.d0 * n11(i)/n10(i) * 870 @ p1112/l11 871 a2112(i,i) = (nu21/nu121)**3.d0 * n11(i)/n20(i) * 872 @ p2112/l21 873 a3112(i,i) = (nu31/nu121)**3.d0 * n11(i)/n30(i) * 874 @ p3112/l31 875 a4112(i,i) = (nu41/nu121)**3.d0 * n11(i)/n40(i) * 876 @ p4112/l41 877 a12(i) = gamma*nu121**3.d0 *2.d0/4.d0* (p12)/ 878 @ (n11(i)*l12) 879 a1211(i,i) = (nu121/nu11)**3.d0 * n10(i)/n11(i) * 880 @ p1211/l12 881 a1221(i,i) = (nu121/nu21)**3.d0 * n20(i)/n11(i) * 882 @ p1221/l12 883 a1231(i,i) = (nu121/nu31)**3.d0 * n30(i)/n11(i) * 884 @ p1231/l12 885 a1241(i,i) = (nu121/nu41)**3.d0 * n40(i)/n11(i) * 886 @ p1241/l12 887 e121(i) = 2.d0*vlight*nu121**2.d0 *2.d0/4.d0 / 888 @ ( n11(i) * l12 ) 889 890 end if 891 892 893 4 continue !------------------------------------------------------- 894 895 896 897 !!!!!!!!!!!! Solucion del sistema 898 899 !! Paso 0 : Calculo de los alphas alf11, alf21, alf31, alf41, alf12 900 901 call unit ( cax2, nl ) 902 903 call diago ( cax1, e110, nl ) 904 call mulmmf90 ( cax3, cax1,c110, nl ) 905 call resmmf90 ( alf11, cax2,cax3, nl ) 906 907 call diago ( cax1, e210, nl ) 908 call mulmmf90 ( cax3, cax1,c210, nl ) 909 call resmmf90 ( alf21, cax2,cax3, nl ) 910 911 call diago ( cax1, e310, nl ) 912 call mulmmf90 ( cax3, cax1,c310, nl ) 913 call resmmf90 ( alf31, cax2,cax3, nl ) 914 915 call diago ( cax1, e410, nl ) 916 call mulmmf90 ( cax3, cax1,c410, nl ) 917 call resmmf90 ( alf41, cax2,cax3, nl ) 918 919 if (input_cza.ge.1) then 920 call diago ( cax1, e121, nl ) 921 call mulmmf90 ( cax3, cax1,c121, nl ) 922 call resmmf90 ( alf12, cax2,cax3, nl ) 722 923 endif 723 !Añadido para hacer diagonal C121 724 ! if ( itt_cza.eq.15 ) then 725 ! do i=1,nl 726 ! do j=1,nl 727 ! if(abs(i-j).eq.1.or.abs(i-j).eq.2) c121(i,j) = 0.0d0 728 ! end do 729 ! end do 730 ! endif 731 if ( itt_cza.eq.24 ) then 732 do i=1,nl 733 do j=1,nl 734 c110(i,j) = 0.0d0 735 end do 736 end do 737 endif 738 739 ! Lower Boundary 740 tsurf = t(1) + tsurf_excess 741 do i=1,nl 742 sl110(i) = sl110(i) + vc110(i) * planckdp( tsurf, nu11 ) 743 sl210(i) = sl210(i) + vc210(i) * planckdp( tsurf, nu21 ) 744 sl310(i) = sl310(i) + vc310(i) * planckdp( tsurf, nu31 ) 745 sl410(i) = sl410(i) + vc410(i) * planckdp( tsurf, nu41 ) 746 end do 747 if (input_cza.ge.1) then 748 do i=1,nl 749 sl121(i) = sl121(i) + vc121(i) * planckdp( tsurf, nu121 ) 750 end do 751 endif 752 753 754 !!!!!!!!!!!! Solucion del sistema 755 756 !! Paso 0 : Calculo de los alphas alf11, alf21, alf31, alf41, alf12 757 758 call unit ( cax2, nl ) 759 760 call diago ( cax1, e110, nl ) 761 call mulmm ( cax3, cax1,c110, nl ) 762 ! cax3=matmul(cax1,c110) 763 call resmm ( alf11, cax2,cax3, nl ) 764 765 call diago ( cax1, e210, nl ) 766 call mulmm ( cax3, cax1,c210, nl ) 767 ! cax3=matmul(cax1,c210) 768 call resmm ( alf21, cax2,cax3, nl ) 769 770 call diago ( cax1, e310, nl ) 771 call mulmm ( cax3, cax1,c310, nl ) 772 ! cax3=matmul(cax1,c310) 773 call resmm ( alf31, cax2,cax3, nl ) 774 ! 775 call diago ( cax1, e410, nl ) 776 call mulmm ( cax3, cax1,c410, nl ) 777 ! cax3=matmul(cax1,c410) 778 call resmm ( alf41, cax2,cax3, nl ) 779 ! 780 ! if(ig.eq.2223.and.input_cza.eq.1) then 781 ! open(168,file='output_curtis_c121diagminus2.dat') 782 ! do i=1,nl 783 ! do j=1,nl 784 ! write(168,*)i,j,c110(i,j),c121(i,j) 785 ! enddo 786 ! enddo 787 ! close(168) 788 ! open(178,file='output_taustar.dat') 789 ! do i=1,nl 790 ! write(178,*)i,taustar21(i),taustar31(i),taustar41(i) 791 ! enddo 792 ! close(178) 793 ! endif 794 if (input_cza.ge.1) then 795 call diago ( cax1, e121, nl ) 796 call mulmm ( cax3, cax1,c121, nl ) 797 ! cax3=matmul(cax1,c121) 798 call resmm ( alf12, cax2,cax3, nl ) 799 endif 800 801 !! Paso 1 : Calculo de vectores y matrices con 1 barra (aa***) 802 924 925 !! Paso 1 : Calculo de vectores y matrices con 1 barra (aa***) 926 803 927 if (input_cza.eq.0) then ! Skip paso 1, pues el12 no se calcula 804 928 805 ! el11929 ! el11 806 930 call sypvvv( aa11, a11,e110,sl110, nl ) 807 931 call samem( aa1121, a1121, nl ) … … 809 933 call samem( aa1141, a1141, nl ) 810 934 call samem( aalf11, alf11, nl ) 811 812 ! el21935 936 ! el21 813 937 call sypvvv( aa21, a21,e210,sl210, nl ) 814 938 call samem( aa2111, a2111, nl ) … … 817 941 call samem( aalf21, alf21, nl ) 818 942 819 ! el31943 ! el31 820 944 call sypvvv( aa31, a31,e310,sl310, nl ) 821 945 call samem( aa3111, a3111, nl ) … … 824 948 call samem( aalf31, alf31, nl ) 825 949 826 ! el41950 ! el41 827 951 call sypvvv( aa41, a41,e410,sl410, nl ) 828 952 call samem( aa4111, a4111, nl ) … … 837 961 call sypvvv( v1, a12,e121,sl121, nl ) ! a12 + e121 * sl121 838 962 839 ! aa11963 ! aa11 840 964 call sypvvv( v2, a11,e110,sl110, nl ) 841 965 call trucommvv( aa11 , alf12,a1112,v2, v1, nl ) 842 843 ! aalf11966 967 ! aalf11 844 968 call invdiag( cax1, a1112, nl ) 845 call mulmm( cax2, alf12, cax1, nl ) ! alf12 * (1/a1112) 846 ! cax2=matmul(alf12,cax1) 847 call mulmm( cax3, cax2, alf11, nl ) 848 ! cax3=matmul(cax2,alf11) 849 850 call resmm( aalf11, cax3, a1211, nl ) 851 ! aa1121 969 call mulmmf90( cax2, alf12, cax1, nl ) ! alf12 * (1/a1112) 970 call mulmmf90( cax3, cax2, alf11, nl ) 971 call resmmf90( aalf11, cax3, a1211, nl ) 972 ! aa1121 852 973 call trucodiag(aa1121, alf12,a1112,a1121, a1221, nl) 853 ! aa1131974 ! aa1131 854 975 call trucodiag(aa1131, alf12,a1112,a1131, a1231, nl) 855 ! aa1141976 ! aa1141 856 977 call trucodiag(aa1141, alf12,a1112,a1141, a1241, nl) 857 978 858 859 ! aa21979 980 ! aa21 860 981 call sypvvv( v2, a21,e210,sl210, nl ) 861 982 call trucommvv( aa21 , alf12,a2112,v2, v1, nl ) 862 983 863 ! aalf21984 ! aalf21 864 985 call invdiag( cax1, a2112, nl ) 865 call mulmm( cax2, alf12, cax1, nl ) ! alf12 * (1/a2112) 866 ! cax2=matmul(alf12,cax1) 867 call mulmm( cax3, cax2, alf21, nl ) 868 ! cax3=matmul(cax2,alf21) 869 call resmm( aalf21, cax3, a1221, nl ) 870 ! aa2111 986 call mulmmf90( cax2, alf12, cax1, nl ) ! alf12 * (1/a2112) 987 call mulmmf90( cax3, cax2, alf21, nl ) 988 call resmmf90( aalf21, cax3, a1221, nl ) 989 ! aa2111 871 990 call trucodiag(aa2111, alf12,a2112,a2111, a1211, nl) 872 ! aa2131991 ! aa2131 873 992 call trucodiag(aa2131, alf12,a2112,a2131, a1231, nl) 874 ! aa2141993 ! aa2141 875 994 call trucodiag(aa2141, alf12,a2112,a2141, a1241, nl) 876 995 877 878 ! aa31879 call sypvvv ( v2, a31,e310,sl310, nl )996 997 ! aa31 998 call sypvvv ( v2, a31,e310,sl310, nl ) 880 999 call trucommvv( aa31 , alf12,a3112,v2, v1, nl ) 881 ! aalf311000 ! aalf31 882 1001 call invdiag( cax1, a3112, nl ) 883 call mulmm( cax2, alf12, cax1, nl ) ! alf12 * (1/a3112) 884 ! cax2=matmul(alf12,cax1) 885 call mulmm( cax3, cax2, alf31, nl ) 886 ! cax3=matmul(cax2,alf31) 887 call resmm( aalf31, cax3, a1231, nl ) 888 ! aa3111 1002 call mulmmf90( cax2, alf12, cax1, nl ) ! alf12 * (1/a3112) 1003 call mulmmf90( cax3, cax2, alf31, nl ) 1004 call resmmf90( aalf31, cax3, a1231, nl ) 1005 ! aa3111 889 1006 call trucodiag(aa3111, alf12,a3112,a3111, a1211, nl) 890 ! aa31211007 ! aa3121 891 1008 call trucodiag(aa3121, alf12,a3112,a3121, a1221, nl) 892 ! aa31411009 ! aa3141 893 1010 call trucodiag(aa3141, alf12,a3112,a3141, a1241, nl) 894 895 896 ! aa411011 1012 1013 ! aa41 897 1014 call sypvvv( v2, a41,e410,sl410, nl ) 898 1015 call trucommvv( aa41 , alf12,a4112,v2, v1, nl ) 899 ! aalf411016 ! aalf41 900 1017 call invdiag( cax1, a4112, nl ) 901 call mulmm( cax2, alf12, cax1, nl ) ! alf12 * (1/a4112) 902 ! cax2=matmul(alf12,cax1) 903 call mulmm( cax3, cax2, alf41, nl ) 904 ! cax3=matmul(cax2,alf41) 905 call resmm( aalf41, cax3, a1241, nl ) 906 ! aa4111 1018 call mulmmf90( cax2, alf12, cax1, nl ) ! alf12 * (1/a4112) 1019 call mulmmf90( cax3, cax2, alf41, nl ) 1020 call resmmf90( aalf41, cax3, a1241, nl ) 1021 ! aa4111 907 1022 call trucodiag(aa4111, alf12,a4112,a4111, a1211, nl) 908 ! aa41211023 ! aa4121 909 1024 call trucodiag(aa4121, alf12,a4112,a4121, a1221, nl) 910 ! aa41311025 ! aa4131 911 1026 call trucodiag(aa4131, alf12,a4112,a4131, a1231, nl) 912 1027 … … 914 1029 915 1030 916 !! Paso 2 : Calculo de vectores y matrices con 2 barras (aaa***)917 918 ! aaalf411031 !! Paso 2 : Calculo de vectores y matrices con 2 barras (aaa***) 1032 1033 ! aaalf41 919 1034 call invdiag( cax1, aa4121, nl ) 920 call mulmm( cax2, aalf21, cax1, nl ) ! alf21 * (1/a4121) 921 ! cax2=matmul(aalf21,cax1) 922 call mulmm( cax3, cax2, aalf41, nl ) 923 ! cax3=matmul(cax2,aalf41) 924 call resmm( aaalf41, cax3, aa2141, nl ) 925 ! aaa41 1035 call mulmmf90( cax2, aalf21, cax1, nl ) ! alf21 * (1/a4121) 1036 call mulmmf90( cax3, cax2, aalf41, nl ) 1037 call resmmf90( aaalf41, cax3, aa2141, nl ) 1038 ! aaa41 926 1039 call trucommvv(aaa41, aalf21,aa4121,aa41, aa21, nl) 927 ! aaa41111040 ! aaa4111 928 1041 call trucodiag(aaa4111, aalf21,aa4121,aa4111, aa2111, nl) 929 ! aaa41311042 ! aaa4131 930 1043 call trucodiag(aaa4131, aalf21,aa4121,aa4131, aa2131, nl) 931 1044 932 ! aaalf311045 ! aaalf31 933 1046 call invdiag( cax1, aa3121, nl ) 934 call mulmm( cax2, aalf21, cax1, nl ) ! alf21 * (1/a3121) 935 ! cax2=matmul(aalf21,cax1) 936 call mulmm( cax3, cax2, aalf31, nl ) 937 ! cax3=matmul(cax2,aalf31) 938 call resmm( aaalf31, cax3, aa2131, nl ) 939 ! aaa31 1047 call mulmmf90( cax2, aalf21, cax1, nl ) ! alf21 * (1/a3121) 1048 call mulmmf90( cax3, cax2, aalf31, nl ) 1049 call resmmf90( aaalf31, cax3, aa2131, nl ) 1050 ! aaa31 940 1051 call trucommvv(aaa31, aalf21,aa3121,aa31, aa21, nl) 941 ! aaa31111052 ! aaa3111 942 1053 call trucodiag(aaa3111, aalf21,aa3121,aa3111, aa2111, nl) 943 ! aaa31411054 ! aaa3141 944 1055 call trucodiag(aaa3141, aalf21,aa3121,aa3141, aa2141, nl) 945 1056 946 ! aaalf111057 ! aaalf11 947 1058 call invdiag( cax1, aa1121, nl ) 948 call mulmm( cax2, aalf21, cax1, nl ) ! alf21 * (1/a1121) 949 ! cax2=matmul(aalf21,cax1) 950 call mulmm( cax3, cax2, aalf11, nl ) 951 ! cax3=matmul(cax2,aalf11) 952 call resmm( aaalf11, cax3, aa2111, nl ) 953 ! aaa11 1059 call mulmmf90( cax2, aalf21, cax1, nl ) ! alf21 * (1/a1121) 1060 call mulmmf90( cax3, cax2, aalf11, nl ) 1061 call resmmf90( aaalf11, cax3, aa2111, nl ) 1062 ! aaa11 954 1063 call trucommvv(aaa11, aalf21,aa1121,aa11, aa21, nl) 955 ! aaa11311064 ! aaa1131 956 1065 call trucodiag(aaa1131, aalf21,aa1121,aa1131, aa2131, nl) 957 ! aaa11411066 ! aaa1141 958 1067 call trucodiag(aaa1141, aalf21,aa1121,aa1141, aa2141, nl) 959 1068 960 1069 961 !! Paso 3 : Calculo de vectores y matrices con 3 barras (aaaa***)962 963 ! aaaalf411070 !! Paso 3 : Calculo de vectores y matrices con 3 barras (aaaa***) 1071 1072 ! aaaalf41 964 1073 call invdiag( cax1, aaa4131, nl ) 965 call mulmm( cax2, aaalf31, cax1, nl ) ! aaalf31 * (1/aaa4131) 966 ! cax2=matmul(aaalf31,cax1) 967 call mulmm( cax3, cax2, aaalf41, nl ) 968 ! cax3=matmul(cax2,aaalf41) 969 call resmm( aaaalf41, cax3, aaa3141, nl ) 970 971 ! aaaa41 1074 call mulmmf90( cax2, aaalf31, cax1, nl ) ! aaalf31 * (1/aaa4131) 1075 call mulmmf90( cax3, cax2, aaalf41, nl ) 1076 call resmmf90( aaaalf41, cax3, aaa3141, nl ) 1077 ! aaaa41 972 1078 call trucommvv(aaaa41, aaalf31,aaa4131,aaa41, aaa31, nl) 973 ! aaaa41111079 ! aaaa4111 974 1080 call trucodiag(aaaa4111, aaalf31,aaa4131,aaa4111,aaa3111, nl) 975 1081 976 ! aaaalf111082 ! aaaalf11 977 1083 call invdiag( cax1, aaa1131, nl ) 978 call mulmm( cax2, aaalf31, cax1, nl ) ! aaalf31 * (1/aaa4131) 979 ! cax2=matmul(aaalf31,cax1) 980 call mulmm( cax3, cax2, aaalf11, nl ) 981 ! cax3=matmul(cax2,aaalf11) 982 call resmm( aaaalf11, cax3, aaa3111, nl ) 983 ! aaaa11 1084 call mulmmf90( cax2, aaalf31, cax1, nl ) ! aaalf31 * (1/aaa4131) 1085 call mulmmf90( cax3, cax2, aaalf11, nl ) 1086 call resmmf90( aaaalf11, cax3, aaa3111, nl ) 1087 ! aaaa11 984 1088 call trucommvv(aaaa11, aaalf31,aaa1131,aaa11, aaa31, nl) 985 ! aaaa11411089 ! aaaa1141 986 1090 call trucodiag(aaaa1141, aaalf31,aaa1131,aaa1141,aaa3141, nl) 987 1091 988 1092 989 !! Paso 4 : Calculo de vectores y matrices finales y calculo de J11093 !! Paso 4 : Calculo de vectores y matrices finales y calculo de J1 990 1094 991 1095 call trucommvv(v1, aaaalf41,aaaa1141,aaaa11, aaaa41, nl) 992 !1096 ! 993 1097 call invdiag( cax1, aaaa1141, nl ) 994 call mulmm( cax2, aaaalf41, cax1, nl ) ! aaaalf41 * (1/aaaa1141) 995 ! cax2=matmul(aaaalf41,cax1) 996 call mulmm( cax3, cax2, aaaalf11, nl ) 997 ! cax3=matmul(cax2,aaaalf11) 998 call resmm( cax1, cax3, aaaa4111, nl ) 999 ! 1098 call mulmmf90( cax2, aaaalf41, cax1, nl ) ! aaaalf41 * (1/aaaa1141) 1099 call mulmmf90( cax3, cax2, aaaalf11, nl ) 1100 call resmmf90( cax1, cax3, aaaa4111, nl ) 1101 ! 1000 1102 call LUdec ( el11, cax1, v1, nl, nl2 ) 1001 1103 1002 ! Solucion para el411104 ! Solucion para el41 1003 1105 call sypvmv( v1, aaaa41, aaaa4111,el11, nl ) 1004 1106 call LUdec ( el41, aaaalf41, v1, nl, nl2 ) 1005 1107 1006 ! Solucion para el311108 ! Solucion para el31 1007 1109 call sypvmv( v2, aaa31, aaa3111,el11, nl ) 1008 1110 call sypvmv( v1, v2, aaa3141,el41, nl ) 1009 1111 call LUdec ( el31, aaalf31, v1, nl, nl2 ) 1010 1112 1011 ! Solucion para el211113 ! Solucion para el21 1012 1114 call sypvmv( v3, aa21, aa2111,el11, nl ) 1013 1115 call sypvmv( v2, v3, aa2131,el31, nl ) … … 1015 1117 call LUdec ( el21, aalf21, v1, nl, nl2 ) 1016 1118 1017 !!!1018 el11(1) = planckdp( t(1), nu11 ) 1019 el21(1) = planckdp( t(1), nu21 ) 1020 el31(1) = planckdp( t(1), nu31 ) 1021 el41(1) = planckdp( t(1), nu41 ) 1022 el11(nl) = 2.d0 * el11(nl-1) - el11(nl2) 1023 el21(nl) = 2.d0 * el21(nl-1) - el21(nl2) 1024 el31(nl) = 2.d0 * el31(nl-1) - el31(nl2) 1025 el41(nl) = 2.d0 * el41(nl-1) - el41(nl2) 1026 1027 call mulmv ( v1, c110,el11, nl ) 1028 call sumvv ( hr110, v1,sl110, nl ) 1029 1030 ! Solucion para el121031 if (input_cza.ge.1) then 1119 !!! 1120 el11(1) = planckdp( t(1), nu11 ) 1121 el21(1) = planckdp( t(1), nu21 ) 1122 el31(1) = planckdp( t(1), nu31 ) 1123 el41(1) = planckdp( t(1), nu41 ) 1124 el11(nl) = 2.d0 * el11(nl-1) - el11(nl2) 1125 el21(nl) = 2.d0 * el21(nl-1) - el21(nl2) 1126 el31(nl) = 2.d0 * el31(nl-1) - el31(nl2) 1127 el41(nl) = 2.d0 * el41(nl-1) - el41(nl2) 1128 1129 call mulmv ( v1, c110,el11, nl ) 1130 call sumvv ( hr110, v1,sl110, nl ) 1131 1132 ! Solucion para el12 1133 if (input_cza.ge.1) then 1032 1134 1033 1135 call sypvmv( v1, a12, a1211,el11, nl ) … … 1037 1139 call LUdec ( el12, alf12, v1, nl, nl2 ) 1038 1140 1039 el12(1) = planckdp( t(1), nu121 ) 1040 el12(nl) = 2.d0 * el12(nl-1) - el12(nl2) 1041 1042 if (itt_cza.eq.15) then 1043 call mulmv ( v1, c121,el12, nl ) 1044 call sumvv ( hr121, v1,sl121, nl ) 1141 el12(1) = planckdp( t(1), nu121 ) 1142 el12(nl) = 2.d0 * el12(nl-1) - el12(nl2) 1143 1144 if (itt_cza.eq.15) then 1145 call mulmv ( v1, c121,el12, nl ) 1146 call sumvv ( hr121, v1,sl121, nl ) 1045 1147 endif 1148 1149 end if 1150 1151 1152 1153 if (input_cza.lt.1) then 1154 1155 do i=1,nl 1156 pl11 = el11(i)/( gamma * nu11**3.0d0 * 1.d0/2.d0 /n10(i) ) 1157 pl21 = el21(i)/( gamma * nu21**3.0d0 * 1.d0/2.d0 /n20(i) ) 1158 pl31 = el31(i)/( gamma * nu31**3.0d0 * 1.d0/2.d0 /n30(i) ) 1159 pl41 = el41(i)/( gamma * nu41**3.0d0 * 1.d0/2.d0 /n40(i) ) 1160 vt11(i) = -ee*nu11 / log( abs(pl11) / (2.0d0*n10(i)) ) 1161 vt21(i) = -ee*nu21 / log( abs(pl21) / (2.0d0*n20(i)) ) 1162 vt31(i) = -ee*nu31 / log( abs(pl31) / (2.0d0*n30(i)) ) 1163 vt41(i) = -ee*nu41 / log( abs(pl41) / (2.0d0*n40(i)) ) 1164 hr210(i) = sl210(i) -hplanck*vlight*nu21 *a21_einst(i)*pl21 1165 hr310(i) = sl310(i) -hplanck*vlight*nu31 *a31_einst(i)*pl31 1166 hr410(i) = sl410(i) -hplanck*vlight*nu41 *a41_einst(i)*pl41 1167 enddo 1168 1169 v626t1(1:nl)=vt11(1:nl) 1170 v628t1(1:nl)=vt21(1:nl) 1171 v636t1(1:nl)=vt31(1:nl) 1172 v627t1(1:nl)=vt41(1:nl) 1173 ! call dinterconnection( v626t1, vt11 ) 1174 ! call dinterconnection ( v628t1, vt21 ) 1175 ! call dinterconnection ( v636t1, vt31 ) 1176 ! call dinterconnection ( v627t1, vt41 ) 1177 1178 else 1179 1180 do i=1,nl 1181 pl21 = el21(i)/( gamma * nu21**3.0d0 * 1.d0/2.d0 / n20(i) ) 1182 pl31 = el31(i)/( gamma * nu31**3.0d0 * 1.d0/2.d0 / n30(i) ) 1183 pl41 = el41(i)/( gamma * nu41**3.0d0 * 1.d0/2.d0 / n40(i) ) 1184 hr210(i) = sl210(i) -hplanck*vlight*nu21 *a21_einst(i)*pl21 1185 hr310(i) = sl310(i) -hplanck*vlight*nu31 *a31_einst(i)*pl31 1186 hr410(i) = sl410(i) -hplanck*vlight*nu41 *a41_einst(i)*pl41 1187 if (itt_cza.eq.13) then 1188 pl12 = el12(i)/( gamma*nu121**3.0d0 * 2.d0/4.d0 /n11(i) ) 1189 hr121(i) = - hplanck*vlight * nu121 * a12_einst(i)*pl12 1190 hr121(i) = hr121(i) + sl121(i) 1191 endif 1192 enddo 1193 1194 endif 1195 1196 ! K/Dday 1197 do i=1,nl 1198 hr110(i)=hr110(i)*dble( hrkday_factor(i) / nt(i) ) 1199 hr210(i)=hr210(i)*dble( hrkday_factor(i) / nt(i) ) 1200 hr310(i)=hr310(i)*dble( hrkday_factor(i) / nt(i) ) 1201 hr410(i)=hr410(i)*dble( hrkday_factor(i) / nt(i) ) 1202 hr121(i)=hr121(i)*dble( hrkday_factor(i) / nt(i) ) 1203 end do 1204 1205 1206 c final 1207 return 1208 c 1209 end 1210 1211 1212 c *** Old NLTEdlvr11_FB626CTS_02 *** 1213 1214 c*********************************************************************** 1215 1216 subroutine NLTEdlvr11_FB626CTS ( hr110CTS, nl_cts_real ) 1217 1218 c*********************************************************************** 1219 1220 implicit none 1221 1222 !!!!!!!!!!!!!!!!!! common variables and constants 1223 1224 include 'nlte_paramdef.h' 1225 include 'nlte_commons.h' 1226 1227 1228 c Arguments 1229 real*8 hr110CTS(nl_cts) ! output 1230 integer nl_cts_real ! i 1231 1232 c local variables 1233 1234 real*8 n11CTS(nl_cts), slopeTstar110(nl_cts) 1235 real*8 n10(nl_cts), co2t, codbl, n2dbl, o3pdbl 1236 real*8 d19c1, d19cp1, l11, p11 1237 real*8 a11_einst(nl_cts), hcv, maxslope 1238 integer i, isot 1239 1240 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! start program 1241 1242 nu11 = dble(nu(1,1)) 1243 hcv = hplanck*vlight*nu11 1244 1245 call zero2v (hr110CTS,n11CTS,nl_cts) 1246 1247 do i=1,nl_cts_real 1248 1249 co2t = dble ( co2_cts(i) *(imr(1)+imr(3)+imr(2)+imr(4)) ) 1250 n10(i) = dble( co2_cts(i) * imr(1) ) 1251 codbl = dble(co_cts(i)) 1252 o3pdbl = dble(o3p_cts(i)) 1253 n2dbl = dble(n2_cts(i)) 1254 1255 call GETK_dlvr11 ( t_cts(i) ) 1256 isot = 1 1257 d19c1 = k19ca(isot)*co2t + k19cb(isot)*n2dbl 1258 $ + k19cc(isot)*codbl 1259 d19cp1 = k19cap(isot)*co2t + k19cbp(isot)*n2dbl 1260 $ + k19ccp(isot)*codbl 1261 l11 = d19c1 + k20c(1)*o3pdbl 1262 p11 = ( d19cp1 + k20cp(1)*o3pdbl ) * n10(i) 1046 1263 1047 end if 1048 1049 1050 1051 if (input_cza.lt.1) then 1052 1053 do i=1,nl 1054 pl11 = el11(i)/dble( gamma * nu11**3.0d0 * 1./2. / n10(i) ) 1055 pl21 = el21(i)/dble( gamma * nu21**3.0d0 * 1./2. / n20(i) ) 1056 pl31 = el31(i)/dble( gamma * nu31**3.0d0 * 1./2. / n30(i) ) 1057 pl41 = el41(i)/dble( gamma * nu41**3.0d0 * 1./2. / n40(i) ) 1058 vt11(i) = dble(-ee*nu11) / log( abs(pl11) / (2.0d0*n10(i)) ) 1059 vt21(i) = dble(-ee*nu21) / log( abs(pl21) / (2.0d0*n20(i)) ) 1060 vt31(i) = dble(-ee*nu31) / log( abs(pl31) / (2.0d0*n30(i)) ) 1061 vt41(i) = dble(-ee*nu41) / log( abs(pl41) / (2.0d0*n40(i)) ) 1062 hr210(i) = sl210(i) - hplanck*vlight*nu21 * a21_einst(i)*pl21 1063 hr310(i) = sl310(i) - hplanck*vlight*nu31 * a31_einst(i)*pl31 1064 hr410(i) = sl410(i) - hplanck*vlight*nu41 * a41_einst(i)*pl41 1065 ! hr410(i) = 0. 1066 enddo 1067 1068 call dinterconnection ( v626t1, vt11 ) 1069 call dinterconnection ( v628t1, vt21 ) 1070 call dinterconnection ( v636t1, vt31 ) 1071 call dinterconnection ( v627t1, vt41 ) 1072 1073 else 1074 1075 do i=1,nl 1076 pl21 = el21(i)/dble( gamma * nu21**3.0d0 * 1./2. / n20(i) ) 1077 pl31 = el31(i)/dble( gamma * nu31**3.0d0 * 1./2. / n30(i) ) 1078 pl41 = el41(i)/dble( gamma * nu41**3.0d0 * 1./2. / n40(i) ) 1079 hr210(i) = sl210(i) - hplanck*vlight*nu21 * a21_einst(i)*pl21 1080 hr310(i) = sl310(i) - hplanck*vlight*nu31 * a31_einst(i)*pl31 1081 hr410(i) = sl410(i) - hplanck*vlight*nu41 * a41_einst(i)*pl41 1082 ! hr410(i) = 0. 1083 if (itt_cza.eq.13) then 1084 pl12 = el12(i)/dble(gamma*nu121**3.0d0*2./4./n11(i)) 1085 hr121(i) = - hplanck*vlight * nu121 * a12_einst(i) * pl12 1086 hr121(i) = hr121(i) + sl121(i) 1087 endif 1264 a11_einst(i) = a1_010_000 * 1.8d0/4.d0 * taustar11_cts(i) 1265 1266 n11CTS(i) = p11 / (l11 + a11_einst(i)) 1267 1268 hr110CTS(i) = - n11CTS(i) * a11_einst(i) * hcv 1269 hr110CTS(i) = hr110CTS(i)* 1270 $ dble( hrkday_factor_cts(i) / nt_cts(i) ) !K/Day 1271 1272 enddo 1273 1274 1275 c calculo de la altura de transicion, a partir de Tstar 1276 c y merging con el hr110(i), ya calculado con CZALU 1277 1278 slopeTstar110(1) = taustar11_cts(2)-taustar11_cts(1) 1279 slopeTstar110(nl_cts_real) = taustar11_cts(nl_cts_real) - 1280 $ taustar11_cts(nl_cts_real-1) 1281 maxslope = max( slopeTstar110(1),slopeTstar110(nl_cts_real)) 1282 if (nl_cts_real .gt. 2) then 1283 do i=2,nl_cts_real-1 1284 slopeTstar110(i) = ( taustar11_cts(i+1) - 1285 $ taustar11_cts(i-1) ) * 0.5d0 1286 if ( slopeTstar110(i) .gt. maxslope ) then 1287 !write (*,*) i, pl_cts(i), maxslope, slopeTstar110(i) 1288 maxslope=slopeTstar110(i) 1289 endif 1088 1290 enddo 1089 1090 1291 endif 1091 1292 1092 ! K/Dday 1093 do i=1,nl 1094 hr110(i)=hr110(i)*( hrkday_factor(i) / nt(i) ) 1095 hr210(i)=hr210(i)*( hrkday_factor(i) / nt(i) ) 1096 hr310(i)=hr310(i)*( hrkday_factor(i) / nt(i) ) 1097 hr410(i)=hr410(i)*( hrkday_factor(i) / nt(i) ) 1098 hr121(i)=hr121(i)*( hrkday_factor(i) / nt(i) ) 1099 end do 1100 1101 1102 1103 c output 1104 1105 !codigo = codeout 1106 !call dmzout_tv ( 1 ) 1107 !call dmzout_hr ( 1 ) 1108 1109 c final subrutina 1110 return 1111 end 1293 c 1294 return 1295 end 1296 1112 1297 1113 1298 c*********************************************************************** 1114 c 1115 c 1116 c 1117 c 1118 c 1119 c 1120 c 1121 c 1122 c 1299 c hrkday_convert.f 1300 c 1301 c fortran function that returns the factor for conversion from 1302 c hr' [erg s-1 cm-3] to hr [ k day-1 ] 1303 c 1304 c mar 2010 fgg adapted to GCM 1305 c jan 99 malv add o2 as major component. 1306 c ago 98 malv also returns cp_avg,pm_avg 1307 c jul 98 malv first version. 1123 1308 c*********************************************************************** 1124 1125 1309 1310 function hrkday_convert 1126 1311 @ ( mmean_nlte,cpmean_nlte ) 1127 1128 implicit none 1129 1130 include 'comcstfi.h' 1131 include 'param.h' 1132 1133 c argumentos 1134 real mmean_nlte,cpmean_nlte 1135 real hrkday_convert 1136 1137 ccccccccccccccccccccccccccccccccccccc 1138 1139 hrkday_convert = daysec * n_avog / 1140 & ( cpmean_nlte * 1.e4 * mmean_nlte ) 1141 1142 c end 1143 return 1144 end 1145 1146 c*********************************************************************** 1147 subroutine sypvvv(a,b,c,d,n) 1148 c a(i)=b(i)+c(i)*d(i) 1149 c jul 2011 malv+fgg 1150 c*********************************************************************** 1151 real*8 a(n),b(n),c(n),d(n) 1152 integer n,i 1153 do 1,i=2,n-1 1154 a(i)= b(i) + c(i) * d(i) 1155 1 continue 1156 a(1) = 0.0d0 1157 a(n) = 0.0d0 1158 return 1159 end 1160 1161 c*********************************************************************** 1162 subroutine sypvmv(v,u,c,w,n) 1163 c inputs: matriz diagonal c , vectores u,w 1164 c output: vector v 1165 c Operacion a realizar: v = u + c * w 1166 1167 c jul 2011 malv+fgg 1168 c*********************************************************************** 1169 real*8 v(n),u(n),c(n,n),w(n) 1170 integer n,i 1171 do 1,i=2,n-1 1172 v(i)= u(i) + c(i,i) * w(i) 1173 1 continue 1174 v(1) = 0.0d0 1175 v(n) = 0.0d0 1176 return 1177 end 1178 1179 c*********************************************************************** 1180 subroutine trucommvv(v,b,c,u,w,n) 1181 c inputs: matrices b,c , vectores u,w 1182 c output: vector v 1183 c Operacion a realizar: v = b * c^(-1) * u + w 1184 c La matriz c va a ser invertida 1185 c c es diagonal, b no 1186 c Aprovechamos esa condicion para invertir c, y acelerar el calculo 1187 c jul 2011 malv+fgg 1188 c*********************************************************************** 1189 real*8 v(n),b(n,n),c(n,n),u(n),w(n), sum 1190 integer n,i,j,k 1191 do 1,i=2,n-1 1192 sum=0.0d0 1193 do 2,j=2,n-1 1194 sum=sum+ (b(i,j)) * (u(j)/c(j,j)) 1195 2 continue 1196 v(i) = sum + w(i) 1197 1 continue 1198 v(1) = 0.d0 1199 v(n) = 0.d0 1200 return 1201 end 1202 1203 c*********************************************************************** 1204 subroutine trucodiag(a,b,c,d,e,n) 1205 c inputs: matrices b,c,d,e 1206 c output: matriz diagonal a 1207 c Operacion a realizar: a = b * c^(-1) * d + e 1208 c La matriz c va a ser invertida 1209 c Todas las matrices de entrada son diagonales excepto b 1210 c Aprovechamos esa condicion para invertir c, acelerar el calculo, y 1211 c ademas, para forzar que a sea diagonal 1212 c jul 2011 malv+fgg 1213 c*********************************************************************** 1214 real*8 a(n,n),b(n,n),c(n,n),d(n,n),e(n,n), sum 1215 integer n,i,j,k 1216 do 1,i=2,n-1 1217 sum=0.0d0 1218 do 2,j=2,n-1 1219 sum=sum+ (b(i,j)) * (d(j,j)/c(j,j)) 1220 2 continue 1221 a(i,i) = sum + e(i,i) 1222 1 continue 1223 do k=1,n 1224 a(n,k) = 0.0d0 1225 a(1,k) = 0.0d0 1226 a(k,1) = 0.0d0 1227 a(k,n) = 0.0d0 1228 end do 1229 return 1230 end 1231 1232 c*********************************************************************** 1233 subroutine invdiag(a,b,n) 1234 c inverse of a diagonal matrix 1235 c jul 2011 malv 1236 c*********************************************************************** 1237 implicit none 1238 1239 integer n,i,j,k 1240 real*8 a(n,n),b(n,n) 1241 1242 do 1,i=2,n-1 1243 do 2,j=2,n-1 1244 if (i.eq.j) then 1245 a(i,j) = 1.d0/b(i,i) 1246 else 1247 a(i,j)=0.0d0 1248 end if 1249 2 continue 1250 1 continue 1251 do k=1,n 1252 a(n,k) = 0.0d0 1253 a(1,k) = 0.0d0 1254 a(k,1) = 0.0d0 1255 a(k,n) = 0.0d0 1256 end do 1257 return 1258 end 1312 1313 implicit none 1314 1315 include 'comcstfi.h' 1316 include 'param.h' 1317 1318 c argumentos 1319 real mmean_nlte,cpmean_nlte 1320 real hrkday_convert 1321 1322 ccccccccccccccccccccccccccccccccccccc 1323 1324 hrkday_convert = daysec * n_avog / 1325 & ( cpmean_nlte * 1.e4 * mmean_nlte ) 1326 1327 c end 1328 return 1329 end -
trunk/LMDZ.MARS/libf/phymars/physiq.F
r756 r757 454 454 endif 455 455 456 if(callnlte.and.nltemodel.eq.2) call NLTE_leedat456 if(callnlte.and.nltemodel.eq.2) call nlte_setup 457 457 if(callnirco2.and.nircorr.eq.1) call NIR_leedat 458 458 … … 585 585 & mmean(1:ngrid,1:nlayer)/mmol(igcm_o) 586 586 587 CALL NLTEdlvr09_TCOOL(ngrid,nlayer,pplay*9.869e-6,587 CALL nlte_tcool(ngrid,nlayer,pplay*9.869e-6, 588 588 $ pt,zzlay,co2vmr_gcm, n2vmr_gcm, covmr_gcm, 589 589 $ ovmr_gcm, zdtnlte )
Note: See TracChangeset
for help on using the changeset viewer.