[716] | 1 | subroutine optci(PLEV,TLEV,DTAUI,TAUCUMI, & |
---|
| 2 | QXIAER,QSIAER,GIAER,COSBI,WBARI,TAUAERO, & |
---|
| 3 | TMID,PMID,TAUGSURF,QVAR,MUVAR) |
---|
[135] | 4 | |
---|
[716] | 5 | use radinc_h |
---|
[1194] | 6 | use radcommon_h, only: gasi,tlimit,wrefVAR,Cmk,tgasref,pfgasref,wnoi,scalep,indi,glat_ig |
---|
[716] | 7 | use gases_h |
---|
[1384] | 8 | use comcstfi_mod, only: g, r, mugaz |
---|
[1397] | 9 | use callkeys_mod, only: kastprof,continuum,graybody,H2Ocont_simple |
---|
[716] | 10 | implicit none |
---|
[135] | 11 | |
---|
[716] | 12 | !================================================================== |
---|
| 13 | ! |
---|
| 14 | ! Purpose |
---|
| 15 | ! ------- |
---|
| 16 | ! Calculates longwave optical constants at each level. For each |
---|
| 17 | ! layer and spectral interval in the IR it calculates WBAR, DTAU |
---|
| 18 | ! and COSBAR. For each level it calculates TAU. |
---|
| 19 | ! |
---|
| 20 | ! TAUI(L,LW) is the cumulative optical depth at level L (or alternatively |
---|
| 21 | ! at the *bottom* of layer L), LW is the spectral wavelength interval. |
---|
| 22 | ! |
---|
| 23 | ! TLEV(L) - Temperature at the layer boundary (i.e., level) |
---|
| 24 | ! PLEV(L) - Pressure at the layer boundary (i.e., level) |
---|
| 25 | ! |
---|
| 26 | ! Authors |
---|
| 27 | ! ------- |
---|
| 28 | ! Adapted from the NASA Ames code by R. Wordsworth (2009) |
---|
| 29 | ! |
---|
| 30 | !================================================================== |
---|
[135] | 31 | |
---|
| 32 | |
---|
[716] | 33 | real*8 DTAUI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
[1715] | 34 | real*8 DTAUKI(L_LEVELS,L_NSPECTI,L_NGAUSS) |
---|
[716] | 35 | real*8 TAUI(L_NLEVRAD,L_NSPECTI,L_NGAUSS) |
---|
| 36 | real*8 TAUCUMI(L_LEVELS,L_NSPECTI,L_NGAUSS) |
---|
| 37 | real*8 PLEV(L_LEVELS) |
---|
| 38 | real*8 TLEV(L_LEVELS) |
---|
| 39 | real*8 TMID(L_LEVELS), PMID(L_LEVELS) |
---|
| 40 | real*8 COSBI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
| 41 | real*8 WBARI(L_NLAYRAD,L_NSPECTI,L_NGAUSS) |
---|
[135] | 42 | |
---|
[716] | 43 | ! for aerosols |
---|
[1715] | 44 | real*8 QXIAER(L_LEVELS,L_NSPECTI,NAERKIND) |
---|
| 45 | real*8 QSIAER(L_LEVELS,L_NSPECTI,NAERKIND) |
---|
| 46 | real*8 GIAER(L_LEVELS,L_NSPECTI,NAERKIND) |
---|
| 47 | real*8 TAUAERO(L_LEVELS,NAERKIND) |
---|
| 48 | real*8 TAUAEROLK(L_LEVELS,L_NSPECTI,NAERKIND) |
---|
[716] | 49 | real*8 TAEROS(L_LEVELS,L_NSPECTI,NAERKIND) |
---|
[135] | 50 | |
---|
[716] | 51 | integer L, NW, NG, K, LK, IAER |
---|
| 52 | integer MT(L_LEVELS), MP(L_LEVELS), NP(L_LEVELS) |
---|
| 53 | real*8 ANS, TAUGAS |
---|
| 54 | real*8 DPR(L_LEVELS), U(L_LEVELS) |
---|
| 55 | real*8 LCOEF(4), LKCOEF(L_LEVELS,4) |
---|
[135] | 56 | |
---|
[716] | 57 | real*8 taugsurf(L_NSPECTI,L_NGAUSS-1) |
---|
[918] | 58 | real*8 DCONT,DAERO |
---|
[716] | 59 | double precision wn_cont, p_cont, p_air, T_cont, dtemp, dtempc |
---|
| 60 | double precision p_cross |
---|
[135] | 61 | |
---|
[716] | 62 | ! variable species mixing ratio variables |
---|
| 63 | real*8 QVAR(L_LEVELS), WRATIO(L_LEVELS), MUVAR(L_LEVELS) |
---|
| 64 | real*8 KCOEF(4) |
---|
| 65 | integer NVAR(L_LEVELS) |
---|
[1725] | 66 | |
---|
| 67 | ! temporary variables to reduce memory access time to gasi |
---|
| 68 | real*8 tmpk(2,2) |
---|
| 69 | real*8 tmpkvar(2,2,2) |
---|
[135] | 70 | |
---|
[716] | 71 | ! temporary variables for multiple aerosol calculation |
---|
[918] | 72 | real*8 atemp |
---|
| 73 | real*8 btemp(L_NLAYRAD,L_NSPECTI) |
---|
[135] | 74 | |
---|
[716] | 75 | ! variables for k in units m^-1 |
---|
[873] | 76 | real*8 dz(L_LEVELS) |
---|
| 77 | !real*8 rho !! see test below |
---|
[135] | 78 | |
---|
[716] | 79 | integer igas, jgas |
---|
[253] | 80 | |
---|
[873] | 81 | integer interm |
---|
| 82 | |
---|
[716] | 83 | !--- Kasting's CIA ---------------------------------------- |
---|
| 84 | !real*8, parameter :: Ci(L_NSPECTI)=[ & |
---|
| 85 | ! 3.8E-5, 1.2E-5, 2.8E-6, 7.6E-7, 4.5E-7, 2.3E-7, & |
---|
| 86 | ! 5.4E-7, 1.6E-6, 0.0, & |
---|
| 87 | ! 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 88 | ! 0.0, 4.0E-7, 4.0E-6, 1.4E-5, & |
---|
| 89 | ! 1.0E-5, 1.2E-6, 2.0E-7, 5.0E-8, 3.0E-8, 0.0 ] |
---|
| 90 | !real*8, parameter :: Ti(L_NSPECTI)=[ -2.2, -1.9, & |
---|
| 91 | ! -1.7, -1.7, -1.7, -1.7, -1.7, -1.7, & |
---|
| 92 | ! 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, & |
---|
| 93 | ! -1.7,-1.7,-1.7,-1.7,-1.7,-1.7,-1.7, -1.7,0.0 ] |
---|
| 94 | !---------------------------------------------------------- |
---|
[253] | 95 | |
---|
[873] | 96 | !! AS: to save time in computing continuum (see bilinearbig) |
---|
| 97 | IF (.not.ALLOCATED(indi)) THEN |
---|
[878] | 98 | ALLOCATE(indi(L_NSPECTI,ngasmx,ngasmx)) |
---|
[873] | 99 | indi = -9999 ! this initial value means "to be calculated" |
---|
| 100 | ENDIF |
---|
| 101 | |
---|
[716] | 102 | !======================================================================= |
---|
| 103 | ! Determine the total gas opacity throughout the column, for each |
---|
| 104 | ! spectral interval, NW, and each Gauss point, NG. |
---|
[135] | 105 | |
---|
[716] | 106 | taugsurf(:,:) = 0.0 |
---|
| 107 | dpr(:) = 0.0 |
---|
| 108 | lkcoef(:,:) = 0.0 |
---|
[135] | 109 | |
---|
[716] | 110 | do K=2,L_LEVELS |
---|
| 111 | DPR(k) = PLEV(K)-PLEV(K-1) |
---|
[135] | 112 | |
---|
[716] | 113 | !--- Kasting's CIA ---------------------------------------- |
---|
| 114 | !dz(k)=dpr(k)*189.02*TMID(K)/(0.03720*PMID(K)) |
---|
| 115 | ! this is CO2 path length (in cm) as written by Francois |
---|
| 116 | ! delta_z = delta_p * R_specific * T / (g * P) |
---|
| 117 | ! But Kasting states that W is in units of _atmosphere_ cm |
---|
| 118 | ! So we do |
---|
| 119 | !dz(k)=dz(k)*(PMID(K)/1013.25) |
---|
| 120 | !dz(k)=dz(k)/100.0 ! in m for SI calc |
---|
| 121 | !---------------------------------------------------------- |
---|
[135] | 122 | |
---|
[716] | 123 | ! if we have continuum opacities, we need dz |
---|
| 124 | if(kastprof)then |
---|
[961] | 125 | dz(k) = dpr(k)*(1000.0d0*8.3145d0/muvar(k))*TMID(K)/(g*PMID(K)) |
---|
[1016] | 126 | U(k) = Cmk*DPR(k)*mugaz/muvar(k) |
---|
[716] | 127 | else |
---|
[1194] | 128 | dz(k) = dpr(k)*R*TMID(K)/(glat_ig*PMID(K))*mugaz/muvar(k) |
---|
[1016] | 129 | U(k) = Cmk*DPR(k)*mugaz/muvar(k) ! only Cmk line in optci.F |
---|
| 130 | !JL13 the mugaz/muvar factor takes into account water meanmolecular weight if water is present |
---|
[716] | 131 | endif |
---|
[135] | 132 | |
---|
[716] | 133 | call tpindex(PMID(K),TMID(K),QVAR(K),pfgasref,tgasref,WREFVAR, & |
---|
| 134 | LCOEF,MT(K),MP(K),NVAR(K),WRATIO(K)) |
---|
[135] | 135 | |
---|
[716] | 136 | do LK=1,4 |
---|
| 137 | LKCOEF(K,LK) = LCOEF(LK) |
---|
| 138 | end do |
---|
[918] | 139 | end do ! levels |
---|
[253] | 140 | |
---|
[1715] | 141 | ! Spectral dependance of aerosol absorption |
---|
[918] | 142 | do iaer=1,naerkind |
---|
[716] | 143 | DO NW=1,L_NSPECTI |
---|
[918] | 144 | do K=2,L_LEVELS |
---|
[716] | 145 | TAEROS(K,NW,IAER) = TAUAERO(K,IAER) * QXIAER(K,NW,IAER) |
---|
[918] | 146 | end do ! levels |
---|
[716] | 147 | END DO |
---|
[918] | 148 | end do |
---|
[135] | 149 | |
---|
[918] | 150 | do NW=1,L_NSPECTI |
---|
[135] | 151 | |
---|
[918] | 152 | do K=2,L_LEVELS |
---|
[1715] | 153 | |
---|
| 154 | DAERO=SUM(TAEROS(K,NW,1:naerkind)) ! aerosol absorption |
---|
[873] | 155 | |
---|
[1715] | 156 | DCONT = 0.0d0 ! continuum absorption |
---|
[135] | 157 | |
---|
[873] | 158 | if(continuum.and.(.not.graybody))then |
---|
[716] | 159 | ! include continua if necessary |
---|
| 160 | wn_cont = dble(wnoi(nw)) |
---|
| 161 | T_cont = dble(TMID(k)) |
---|
| 162 | do igas=1,ngasmx |
---|
[135] | 163 | |
---|
[716] | 164 | if(gfrac(igas).eq.-1)then ! variable |
---|
| 165 | p_cont = dble(PMID(k)*scalep*QVAR(k)) ! qvar = mol/mol |
---|
| 166 | else |
---|
| 167 | p_cont = dble(PMID(k)*scalep*gfrac(igas)*(1.-QVAR(k))) |
---|
| 168 | endif |
---|
[253] | 169 | |
---|
[961] | 170 | dtemp=0.0d0 |
---|
[716] | 171 | if(igas.eq.igas_N2)then |
---|
[305] | 172 | |
---|
[878] | 173 | interm = indi(nw,igas,igas) |
---|
| 174 | call interpolateN2N2(wn_cont,T_cont,p_cont,dtemp,.false.,interm) |
---|
| 175 | indi(nw,igas,igas) = interm |
---|
[253] | 176 | |
---|
[716] | 177 | elseif(igas.eq.igas_H2)then |
---|
[253] | 178 | |
---|
[716] | 179 | ! first do self-induced absorption |
---|
[878] | 180 | interm = indi(nw,igas,igas) |
---|
[873] | 181 | call interpolateH2H2(wn_cont,T_cont,p_cont,dtemp,.false.,interm) |
---|
[878] | 182 | indi(nw,igas,igas) = interm |
---|
[253] | 183 | |
---|
[716] | 184 | ! then cross-interactions with other gases |
---|
| 185 | do jgas=1,ngasmx |
---|
| 186 | p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) |
---|
[961] | 187 | dtempc = 0.0d0 |
---|
[716] | 188 | if(jgas.eq.igas_N2)then |
---|
[878] | 189 | interm = indi(nw,igas,jgas) |
---|
| 190 | call interpolateN2H2(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm) |
---|
| 191 | indi(nw,igas,jgas) = interm |
---|
[716] | 192 | elseif(jgas.eq.igas_He)then |
---|
[878] | 193 | interm = indi(nw,igas,jgas) |
---|
[873] | 194 | call interpolateH2He(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm) |
---|
[878] | 195 | indi(nw,igas,jgas) = interm |
---|
[716] | 196 | endif |
---|
| 197 | dtemp = dtemp + dtempc |
---|
| 198 | enddo |
---|
[135] | 199 | |
---|
[716] | 200 | elseif(igas.eq.igas_H2O.and.T_cont.gt.200.0)then |
---|
[135] | 201 | |
---|
[716] | 202 | p_air = dble(PMID(k)*scalep) - p_cont ! note assumes background is air! |
---|
| 203 | if(H2Ocont_simple)then |
---|
| 204 | call interpolateH2Ocont_PPC(wn_cont,T_cont,p_cont,p_air,dtemp,.false.) |
---|
| 205 | else |
---|
[878] | 206 | interm = indi(nw,igas,igas) |
---|
| 207 | call interpolateH2Ocont_CKD(wn_cont,T_cont,p_cont,p_air,dtemp,.false.,interm) |
---|
| 208 | indi(nw,igas,igas) = interm |
---|
[716] | 209 | endif |
---|
[135] | 210 | |
---|
[716] | 211 | endif |
---|
[135] | 212 | |
---|
[716] | 213 | DCONT = DCONT + dtemp |
---|
[135] | 214 | |
---|
[716] | 215 | enddo |
---|
[135] | 216 | |
---|
[716] | 217 | ! Oobleck test |
---|
| 218 | !rho = PMID(k)*scalep / (TMID(k)*286.99) |
---|
| 219 | !if(WNOI(nw).gt.300.0 .and. WNOI(nw).lt.500.0)then |
---|
| 220 | ! DCONT = rho * 0.125 * 4.6e-4 |
---|
| 221 | !elseif(WNOI(nw).gt.500.0 .and. WNOI(nw).lt.700.0)then |
---|
| 222 | ! DCONT = 1000*dpr(k) * 1.0 * 4.6e-4 / g |
---|
| 223 | ! DCONT = rho * 1.0 * 4.6e-4 |
---|
| 224 | !elseif(WNOI(nw).gt.700.0 .and. WNOI(nw).lt.900.0)then |
---|
| 225 | ! DCONT = rho * 0.125 * 4.6e-4 |
---|
| 226 | !endif |
---|
[135] | 227 | |
---|
[716] | 228 | DCONT = DCONT*dz(k) |
---|
[135] | 229 | |
---|
[716] | 230 | endif |
---|
[135] | 231 | |
---|
[716] | 232 | do ng=1,L_NGAUSS-1 |
---|
[135] | 233 | |
---|
[716] | 234 | ! Now compute TAUGAS |
---|
[135] | 235 | |
---|
[716] | 236 | ! Interpolate between water mixing ratios |
---|
| 237 | ! WRATIO = 0.0 if the requested water amount is equal to, or outside the |
---|
| 238 | ! the water data range |
---|
[253] | 239 | |
---|
[716] | 240 | if(L_REFVAR.eq.1)then ! added by RW for special no variable case |
---|
[1725] | 241 | |
---|
| 242 | ! JVO 2017 : added tmpk because the repeated calls to gasi/v increased dramatically |
---|
| 243 | ! the execution time of optci/v -> ~ factor 2 on the whole radiative |
---|
| 244 | ! transfer on the tested simulations ! |
---|
| 245 | |
---|
| 246 | tmpk = GASI(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) |
---|
| 247 | |
---|
| 248 | KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASI(MT(K),MP(K),1,NW,NG) |
---|
| 249 | KCOEF(2) = tmpk(1,2) ! KCOEF(2) = GASI(MT(K),MP(K)+1,1,NW,NG) |
---|
| 250 | KCOEF(3) = tmpk(2,2) ! KCOEF(3) = GASI(MT(K)+1,MP(K)+1,1,NW,NG) |
---|
| 251 | KCOEF(4) = tmpk(2,1) ! KCOEF(4) = GASI(MT(K)+1,MP(K),1,NW,NG) |
---|
| 252 | |
---|
[716] | 253 | else |
---|
[135] | 254 | |
---|
[1725] | 255 | tmpkvar = GASI(MT(K):MT(K)+1,MP(K):MP(K)+1,NVAR(K):NVAR(K)+1,NW,NG) |
---|
[135] | 256 | |
---|
[1725] | 257 | KCOEF(1) = tmpkvar(1,1,1) + WRATIO(K) * & |
---|
| 258 | ( tmpkvar(1,1,2)-tmpkvar(1,1,1) ) |
---|
[135] | 259 | |
---|
[1725] | 260 | KCOEF(2) = tmpkvar(1,2,1) + WRATIO(K) * & |
---|
| 261 | ( tmpkvar(1,2,2)-tmpkvar(1,2,1) ) |
---|
[135] | 262 | |
---|
[1725] | 263 | KCOEF(3) = tmpkvar(2,2,1) + WRATIO(K) * & |
---|
| 264 | ( tmpkvar(2,2,2)-tmpkvar(2,2,1) ) |
---|
| 265 | |
---|
| 266 | KCOEF(4) = tmpkvar(2,1,1) + WRATIO(K) * & |
---|
| 267 | ( tmpkvar(2,1,2)-tmpkvar(2,1,1) ) |
---|
[873] | 268 | |
---|
[716] | 269 | endif |
---|
[135] | 270 | |
---|
[716] | 271 | ! Interpolate the gaseous k-coefficients to the requested T,P values |
---|
[135] | 272 | |
---|
[716] | 273 | ANS = LKCOEF(K,1)*KCOEF(1) + LKCOEF(K,2)*KCOEF(2) + & |
---|
| 274 | LKCOEF(K,3)*KCOEF(3) + LKCOEF(K,4)*KCOEF(4) |
---|
[135] | 275 | |
---|
[716] | 276 | TAUGAS = U(k)*ANS |
---|
[135] | 277 | |
---|
[716] | 278 | TAUGSURF(NW,NG) = TAUGSURF(NW,NG) + TAUGAS + DCONT |
---|
[918] | 279 | DTAUKI(K,nw,ng) = TAUGAS & |
---|
| 280 | + DCONT & ! For parameterized continuum absorption |
---|
| 281 | + DAERO ! For aerosol absorption |
---|
[135] | 282 | |
---|
[716] | 283 | end do |
---|
[135] | 284 | |
---|
[716] | 285 | ! Now fill in the "clear" part of the spectrum (NG = L_NGAUSS), |
---|
| 286 | ! which holds continuum opacity only |
---|
[135] | 287 | |
---|
[716] | 288 | NG = L_NGAUSS |
---|
[918] | 289 | DTAUKI(K,nw,ng) = 0.d0 & |
---|
| 290 | + DCONT & ! For parameterized continuum absorption |
---|
| 291 | + DAERO ! For aerosol absorption |
---|
[135] | 292 | |
---|
[716] | 293 | end do |
---|
| 294 | end do |
---|
[135] | 295 | |
---|
[716] | 296 | !======================================================================= |
---|
| 297 | ! Now the full treatment for the layers, where besides the opacity |
---|
| 298 | ! we need to calculate the scattering albedo and asymmetry factors |
---|
[135] | 299 | |
---|
[873] | 300 | do iaer=1,naerkind |
---|
[918] | 301 | DO NW=1,L_NSPECTI |
---|
[1715] | 302 | DO K=2,L_LEVELS |
---|
| 303 | TAUAEROLK(K,NW,IAER) = TAUAERO(K,IAER)*QSIAER(K,NW,IAER) ! effect of scattering albedo |
---|
[716] | 304 | ENDDO |
---|
[918] | 305 | ENDDO |
---|
[873] | 306 | end do |
---|
[918] | 307 | |
---|
| 308 | DO NW=1,L_NSPECTI |
---|
[1715] | 309 | DO L=1,L_NLAYRAD-1 |
---|
[918] | 310 | K = 2*L+1 |
---|
| 311 | btemp(L,NW) = SUM(TAUAEROLK(K,NW,1:naerkind)) + SUM(TAUAEROLK(K+1,NW,1:naerkind)) |
---|
| 312 | END DO ! L vertical loop |
---|
[1715] | 313 | |
---|
| 314 | ! Last level |
---|
| 315 | L = L_NLAYRAD |
---|
| 316 | K = 2*L+1 |
---|
| 317 | btemp(L,NW) = SUM(TAUAEROLK(K,NW,1:naerkind)) |
---|
| 318 | |
---|
[918] | 319 | END DO ! NW spectral loop |
---|
| 320 | |
---|
[135] | 321 | |
---|
[716] | 322 | DO NW=1,L_NSPECTI |
---|
| 323 | NG = L_NGAUSS |
---|
[1715] | 324 | DO L=1,L_NLAYRAD-1 |
---|
[135] | 325 | |
---|
[716] | 326 | K = 2*L+1 |
---|
| 327 | DTAUI(L,nw,ng) = DTAUKI(K,NW,NG) + DTAUKI(K+1,NW,NG)! + 1.e-50 |
---|
[135] | 328 | |
---|
[716] | 329 | atemp = 0. |
---|
[961] | 330 | if(DTAUI(L,NW,NG) .GT. 1.0D-9) then |
---|
[716] | 331 | do iaer=1,naerkind |
---|
| 332 | atemp = atemp + & |
---|
| 333 | GIAER(K,NW,IAER) * TAUAEROLK(K,NW,IAER) + & |
---|
| 334 | GIAER(K+1,NW,IAER) * TAUAEROLK(K+1,NW,IAER) |
---|
| 335 | end do |
---|
[918] | 336 | WBARI(L,nw,ng) = btemp(L,nw) / DTAUI(L,NW,NG) |
---|
[716] | 337 | else |
---|
| 338 | WBARI(L,nw,ng) = 0.0D0 |
---|
[961] | 339 | DTAUI(L,NW,NG) = 1.0D-9 |
---|
[716] | 340 | endif |
---|
[135] | 341 | |
---|
[961] | 342 | if(btemp(L,nw) .GT. 0.0d0) then |
---|
[918] | 343 | cosbi(L,NW,NG) = atemp/btemp(L,nw) |
---|
[716] | 344 | else |
---|
| 345 | cosbi(L,NW,NG) = 0.0D0 |
---|
| 346 | end if |
---|
[135] | 347 | |
---|
[716] | 348 | END DO ! L vertical loop |
---|
[1715] | 349 | |
---|
| 350 | ! Last level |
---|
| 351 | |
---|
| 352 | L = L_NLAYRAD |
---|
| 353 | K = 2*L+1 |
---|
| 354 | DTAUI(L,nw,ng) = DTAUKI(K,NW,NG) ! + 1.e-50 |
---|
[135] | 355 | |
---|
[1715] | 356 | atemp = 0. |
---|
| 357 | if(DTAUI(L,NW,NG) .GT. 1.0D-9) then |
---|
| 358 | do iaer=1,naerkind |
---|
| 359 | atemp = atemp + GIAER(K,NW,IAER) * TAUAEROLK(K,NW,IAER) |
---|
| 360 | end do |
---|
| 361 | WBARI(L,nw,ng) = btemp(L,nw) / DTAUI(L,NW,NG) |
---|
| 362 | else |
---|
| 363 | WBARI(L,nw,ng) = 0.0D0 |
---|
| 364 | DTAUI(L,NW,NG) = 1.0D-9 |
---|
| 365 | endif |
---|
| 366 | |
---|
| 367 | if(btemp(L,nw) .GT. 0.0d0) then |
---|
| 368 | cosbi(L,NW,NG) = atemp/btemp(L,nw) |
---|
| 369 | else |
---|
| 370 | cosbi(L,NW,NG) = 0.0D0 |
---|
| 371 | end if |
---|
| 372 | |
---|
| 373 | |
---|
[716] | 374 | ! Now the other Gauss points, if needed. |
---|
[135] | 375 | |
---|
[716] | 376 | DO NG=1,L_NGAUSS-1 |
---|
| 377 | IF(TAUGSURF(NW,NG) .gt. TLIMIT) THEN |
---|
[135] | 378 | |
---|
[1715] | 379 | DO L=1,L_NLAYRAD-1 |
---|
[716] | 380 | K = 2*L+1 |
---|
| 381 | DTAUI(L,nw,ng) = DTAUKI(K,NW,NG)+DTAUKI(K+1,NW,NG)! + 1.e-50 |
---|
| 382 | |
---|
[961] | 383 | if(DTAUI(L,NW,NG) .GT. 1.0D-9) then |
---|
[716] | 384 | |
---|
[918] | 385 | WBARI(L,nw,ng) = btemp(L,nw) / DTAUI(L,NW,NG) |
---|
[716] | 386 | |
---|
| 387 | else |
---|
| 388 | WBARI(L,nw,ng) = 0.0D0 |
---|
[961] | 389 | DTAUI(L,NW,NG) = 1.0D-9 |
---|
[716] | 390 | endif |
---|
| 391 | |
---|
| 392 | cosbi(L,NW,NG) = cosbi(L,NW,L_NGAUSS) |
---|
| 393 | END DO ! L vertical loop |
---|
[1715] | 394 | |
---|
| 395 | ! Last level |
---|
| 396 | L = L_NLAYRAD |
---|
| 397 | K = 2*L+1 |
---|
| 398 | DTAUI(L,nw,ng) = DTAUKI(K,NW,NG)! + 1.e-50 |
---|
| 399 | |
---|
| 400 | if(DTAUI(L,NW,NG) .GT. 1.0D-9) then |
---|
| 401 | |
---|
| 402 | WBARI(L,nw,ng) = btemp(L,nw) / DTAUI(L,NW,NG) |
---|
| 403 | |
---|
| 404 | else |
---|
| 405 | WBARI(L,nw,ng) = 0.0D0 |
---|
| 406 | DTAUI(L,NW,NG) = 1.0D-9 |
---|
| 407 | endif |
---|
| 408 | |
---|
| 409 | cosbi(L,NW,NG) = cosbi(L,NW,L_NGAUSS) |
---|
| 410 | |
---|
[716] | 411 | END IF |
---|
| 412 | |
---|
| 413 | END DO ! NG Gauss loop |
---|
| 414 | END DO ! NW spectral loop |
---|
| 415 | |
---|
| 416 | ! Total extinction optical depths |
---|
| 417 | |
---|
[918] | 418 | DO NG=1,L_NGAUSS ! full gauss loop |
---|
| 419 | DO NW=1,L_NSPECTI |
---|
[716] | 420 | TAUCUMI(1,NW,NG)=0.0D0 |
---|
| 421 | DO K=2,L_LEVELS |
---|
| 422 | TAUCUMI(K,NW,NG)=TAUCUMI(K-1,NW,NG)+DTAUKI(K,NW,NG) |
---|
| 423 | END DO |
---|
| 424 | END DO ! end full gauss loop |
---|
| 425 | END DO |
---|
| 426 | |
---|
| 427 | ! be aware when comparing with textbook results |
---|
| 428 | ! (e.g. Pierrehumbert p. 218) that |
---|
| 429 | ! taucumi does not take the <cos theta>=0.5 factor into |
---|
| 430 | ! account. It is the optical depth for a vertically |
---|
| 431 | ! ascending ray with angle theta = 0. |
---|
| 432 | |
---|
| 433 | !open(127,file='taucum.out') |
---|
| 434 | !do nw=1,L_NSPECTI |
---|
| 435 | ! write(127,*) taucumi(L_LEVELS,nw,L_NGAUSS) |
---|
| 436 | !enddo |
---|
| 437 | !close(127) |
---|
[918] | 438 | |
---|
| 439 | ! print*,'WBARI' |
---|
| 440 | ! print*,WBARI |
---|
| 441 | ! print*,'DTAUI' |
---|
| 442 | ! print*,DTAUI |
---|
| 443 | ! call abort |
---|
| 444 | |
---|
[716] | 445 | |
---|
| 446 | return |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | end subroutine optci |
---|
| 450 | |
---|
| 451 | |
---|
| 452 | |
---|