[3083] | 1 | SUBROUTINE OPTCV(PQMO,NLAY,ZLEV,PLEV,TMID,PMID, & |
---|
| 2 | DTAUV,TAUV,TAUCUMV,WBARV,COSBV,TAURAY,TAUGSURF,SEASHAZEFACT,& |
---|
[3318] | 3 | DIAG_OPTH,DIAG_OPTT,CDCOLUMN) |
---|
[253] | 4 | |
---|
[716] | 5 | use radinc_h |
---|
[2050] | 6 | use radcommon_h, only: gasv,gasv_recomb,tlimit,Cmk,gzlat_ig, & |
---|
[2133] | 7 | tgasref,pfgasref,wnov,scalep,indv |
---|
[716] | 8 | use gases_h |
---|
[2242] | 9 | use datafile_mod, only: haze_opt_file |
---|
[3083] | 10 | use comcstfi_mod, only: pi,r |
---|
| 11 | use callkeys_mod, only: continuum,graybody,callgasvis,corrk_recombin, & |
---|
| 12 | callclouds,callmufi,seashaze,uncoupl_optic_haze,& |
---|
[3318] | 13 | opt4clouds,FHVIS,FCVIS |
---|
[3083] | 14 | use tracer_h, only: nmicro,nice,ices_indx |
---|
[253] | 15 | |
---|
[716] | 16 | implicit none |
---|
[253] | 17 | |
---|
[716] | 18 | !================================================================== |
---|
| 19 | ! |
---|
| 20 | ! Purpose |
---|
| 21 | ! ------- |
---|
| 22 | ! Calculates shortwave optical constants at each level. |
---|
| 23 | ! |
---|
| 24 | ! Authors |
---|
| 25 | ! ------- |
---|
| 26 | ! Adapted from the NASA Ames code by R. Wordsworth (2009) |
---|
| 27 | ! |
---|
[3090] | 28 | ! Modified |
---|
| 29 | ! -------- |
---|
| 30 | ! J. Vatant d'Ollone (2016-17) |
---|
| 31 | ! --> Clean and adaptation to Titan |
---|
| 32 | ! B. de Batz de Trenquelléon (2022-2023) |
---|
| 33 | ! --> Clean and correction to Titan |
---|
| 34 | ! --> New optics added for Titan's clouds |
---|
| 35 | ! |
---|
[716] | 36 | !================================================================== |
---|
| 37 | ! |
---|
| 38 | ! THIS SUBROUTINE SETS THE OPTICAL CONSTANTS IN THE VISUAL |
---|
[1722] | 39 | ! IT CALCULATES FOR EACH LAYER, FOR EACH SPECTRAL INTERVAL IN THE VISUAL |
---|
[716] | 40 | ! LAYER: WBAR, DTAU, COSBAR |
---|
| 41 | ! LEVEL: TAU |
---|
| 42 | ! |
---|
| 43 | ! TAUV(L,NW,NG) is the cumulative optical depth at the top of radiation code |
---|
| 44 | ! layer L. NW is spectral wavelength interval, ng the Gauss point index. |
---|
| 45 | ! |
---|
| 46 | ! TLEV(L) - Temperature at the layer boundary |
---|
| 47 | ! PLEV(L) - Pressure at the layer boundary (i.e. level) |
---|
| 48 | ! GASV(NT,NPS,NW,NG) - Visible k-coefficients |
---|
| 49 | ! |
---|
| 50 | !------------------------------------------------------------------- |
---|
[253] | 51 | |
---|
| 52 | |
---|
[1822] | 53 | !========================================================== |
---|
| 54 | ! Input/Output |
---|
| 55 | !========================================================== |
---|
[2050] | 56 | REAL*8, INTENT(IN) :: PQMO(nlay,nmicro) ! Tracers for microphysics optics (X/m2). |
---|
| 57 | INTEGER, INTENT(IN) :: NLAY ! Number of pressure layers (for pqmo) |
---|
[3083] | 58 | REAL*8, INTENT(IN) :: ZLEV(NLAY+1) |
---|
[1822] | 59 | REAL*8, INTENT(IN) :: PLEV(L_LEVELS) |
---|
| 60 | REAL*8, INTENT(IN) :: TMID(L_LEVELS), PMID(L_LEVELS) |
---|
[1826] | 61 | REAL*8, INTENT(IN) :: TAURAY(L_NSPECTV) |
---|
[2046] | 62 | REAL*8, INTENT(IN) :: SEASHAZEFACT(L_LEVELS) |
---|
[3083] | 63 | INTEGER, INTENT(IN) :: CDCOLUMN |
---|
[1822] | 64 | |
---|
| 65 | REAL*8, INTENT(OUT) :: DTAUV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 66 | REAL*8, INTENT(OUT) :: TAUV(L_NLEVRAD,L_NSPECTV,L_NGAUSS) |
---|
| 67 | REAL*8, INTENT(OUT) :: TAUCUMV(L_LEVELS,L_NSPECTV,L_NGAUSS) |
---|
| 68 | REAL*8, INTENT(OUT) :: COSBV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
| 69 | REAL*8, INTENT(OUT) :: WBARV(L_NLAYRAD,L_NSPECTV,L_NGAUSS) |
---|
[1823] | 70 | REAL*8, INTENT(OUT) :: TAUGSURF(L_NSPECTV,L_NGAUSS-1) |
---|
[3318] | 71 | REAL*8, INTENT(OUT) :: DIAG_OPTH(L_LEVELS,L_NSPECTV,6) |
---|
| 72 | REAL*8, INTENT(OUT) :: DIAG_OPTT(L_LEVELS,L_NSPECTV,6) |
---|
[1822] | 73 | ! ========================================================== |
---|
| 74 | |
---|
[1722] | 75 | real*8 DTAUKV(L_LEVELS,L_NSPECTV,L_NGAUSS) |
---|
[253] | 76 | |
---|
[1648] | 77 | ! Titan customisation |
---|
| 78 | ! J. Vatant d'Ollone (2016) |
---|
[3083] | 79 | real*8 DHAZE_T(L_LEVELS,L_NSPECTV) |
---|
| 80 | real*8 DHAZES_T(L_LEVELS,L_NSPECTV) |
---|
| 81 | real*8 SSA_T(L_LEVELS,L_NSPECTV) |
---|
| 82 | real*8 ASF_T(L_LEVELS,L_NSPECTV) |
---|
[1648] | 83 | ! ========================== |
---|
| 84 | |
---|
[873] | 85 | integer L, NW, NG, K, LK, IAER |
---|
[716] | 86 | integer MT(L_LEVELS), MP(L_LEVELS), NP(L_LEVELS) |
---|
| 87 | real*8 ANS, TAUGAS |
---|
| 88 | real*8 TRAY(L_LEVELS,L_NSPECTV) |
---|
| 89 | real*8 DPR(L_LEVELS), U(L_LEVELS) |
---|
| 90 | real*8 LCOEF(4), LKCOEF(L_LEVELS,4) |
---|
[253] | 91 | |
---|
[1788] | 92 | real*8 DCONT |
---|
[1722] | 93 | real*8 DRAYAER |
---|
[873] | 94 | double precision wn_cont, p_cont, p_air, T_cont, dtemp, dtempc |
---|
| 95 | double precision p_cross |
---|
[253] | 96 | |
---|
[873] | 97 | real*8 KCOEF(4) |
---|
[1725] | 98 | |
---|
| 99 | ! temporary variable to reduce memory access time to gasv |
---|
| 100 | real*8 tmpk(2,2) |
---|
[253] | 101 | |
---|
[716] | 102 | ! temporary variables for multiple aerosol calculation |
---|
[918] | 103 | real*8 atemp(L_NLAYRAD,L_NSPECTV) |
---|
| 104 | real*8 btemp(L_NLAYRAD,L_NSPECTV) |
---|
| 105 | real*8 ctemp(L_NLAYRAD,L_NSPECTV) |
---|
[253] | 106 | |
---|
[716] | 107 | ! variables for k in units m^-1 |
---|
[873] | 108 | real*8 dz(L_LEVELS) |
---|
[253] | 109 | |
---|
[1648] | 110 | integer igas, jgas, ilay |
---|
[253] | 111 | |
---|
[873] | 112 | integer interm |
---|
| 113 | |
---|
[2242] | 114 | ! Variables for haze optics |
---|
| 115 | character(len=200) file_path |
---|
| 116 | logical file_ok |
---|
| 117 | integer dumch |
---|
| 118 | real*8 dumwvl |
---|
[3340] | 119 | integer ilev_cutoff ! pressure level index of cutoff |
---|
| 120 | real*8 corr_haze |
---|
| 121 | real*8 corr_alb |
---|
[2242] | 122 | |
---|
[3083] | 123 | ! Variables for new optics |
---|
| 124 | integer iq, iw, FTYPE, CTYPE |
---|
[3090] | 125 | real*8 m0as,m0af,m0ccn,m3as,m3af,m3ccn,m3cld |
---|
[3083] | 126 | real*8 dtauaer_s,dtauaer_f,dtau_ccn,dtau_cld |
---|
[2242] | 127 | real*8,save :: rhoaer_s(L_NSPECTV),ssa_s(L_NSPECTV),asf_s(L_NSPECTV) |
---|
| 128 | real*8,save :: rhoaer_f(L_NSPECTV),ssa_f(L_NSPECTV),asf_f(L_NSPECTV) |
---|
[3318] | 129 | real*8,save :: ssa_ccn(L_NSPECTV),asf_ccn(L_NSPECTV) |
---|
[3083] | 130 | real*8,save :: ssa_cld(L_NSPECTV),asf_cld(L_NSPECTV) |
---|
| 131 | !$OMP THREADPRIVATE(rhoaer_s,rhoaer_f,ssa_s,ssa_f,ssa_cld,asf_s,asf_f,asf_cld) |
---|
[2242] | 132 | |
---|
[1897] | 133 | logical,save :: firstcall=.true. |
---|
[2242] | 134 | !$OMP THREADPRIVATE(firstcall) |
---|
[1897] | 135 | |
---|
| 136 | |
---|
[873] | 137 | !! AS: to save time in computing continuum (see bilinearbig) |
---|
| 138 | IF (.not.ALLOCATED(indv)) THEN |
---|
[878] | 139 | ALLOCATE(indv(L_NSPECTV,ngasmx,ngasmx)) |
---|
[873] | 140 | indv = -9999 ! this initial value means "to be calculated" |
---|
| 141 | ENDIF |
---|
[1792] | 142 | |
---|
| 143 | ! Some initialisation beacause there's a pb with disr_haze at the limits (nw=1) |
---|
| 144 | ! I should check this - For now we set vars to zero : better than nans - JVO 2017 |
---|
[2242] | 145 | DHAZE_T(:,:) = 0.0 |
---|
| 146 | SSA_T(:,:) = 0.0 |
---|
| 147 | ASF_T(:,:) = 0.0 |
---|
[1792] | 148 | |
---|
[2242] | 149 | ! Load tabulated haze optical properties if needed. |
---|
| 150 | ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 151 | IF (firstcall .AND. callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN |
---|
| 152 | OPEN(12,file=TRIM(haze_opt_file),form='formatted') ! The file has been inquired in physiq_mod firstcall |
---|
| 153 | READ(12,*) ! dummy header |
---|
| 154 | DO NW=1,L_NSPECTI |
---|
| 155 | READ(12,*) ! there's IR 1st |
---|
| 156 | ENDDO |
---|
| 157 | DO NW=1,L_NSPECTV |
---|
| 158 | READ(12,*) dumch, dumwvl, rhoaer_f(nw), ssa_f(nw), asf_f(nw), rhoaer_s(nw), ssa_s(nw), asf_s(nw) |
---|
| 159 | ENDDO |
---|
| 160 | CLOSE(12) |
---|
| 161 | ENDIF |
---|
[873] | 162 | |
---|
[3083] | 163 | !======================================================================= |
---|
| 164 | ! Determine the total gas opacity throughout the column, for each |
---|
| 165 | ! spectral interval, NW, and each Gauss point, NG. |
---|
| 166 | ! Calculate the continuum opacities, i.e., those that do not depend on |
---|
| 167 | ! NG, the Gauss index. |
---|
[253] | 168 | |
---|
[3083] | 169 | taugsurf(:,:) = 0.0 |
---|
| 170 | dpr(:) = 0.0 |
---|
| 171 | lkcoef(:,:) = 0.0 |
---|
[253] | 172 | |
---|
[3340] | 173 | ! Level of cutoff |
---|
| 174 | !~~~~~~~~~~~~~~~~ |
---|
| 175 | ilev_cutoff = 26 |
---|
| 176 | |
---|
[3083] | 177 | do K=2,L_LEVELS |
---|
| 178 | ilay = L_NLAYRAD+1 - k/2 ! int. arithmetic => gives the gcm layer index (reversed) |
---|
| 179 | DPR(k) = PLEV(K)-PLEV(K-1) |
---|
[253] | 180 | |
---|
[3083] | 181 | ! if we have continuum opacities, we need dz |
---|
[1947] | 182 | dz(k) = dpr(k)*R*TMID(K)/(gzlat_ig(ilay)*PMID(K)) |
---|
| 183 | U(k) = Cmk(ilay)*DPR(k) ! only Cmk line in optcv.F |
---|
[1647] | 184 | |
---|
[3083] | 185 | call tpindex(PMID(K),TMID(K),pfgasref,tgasref,LCOEF,MT(K),MP(K)) |
---|
[253] | 186 | |
---|
[3083] | 187 | do LK=1,4 |
---|
| 188 | LKCOEF(K,LK) = LCOEF(LK) |
---|
| 189 | end do |
---|
| 190 | end do ! L_LEVELS |
---|
[253] | 191 | |
---|
[3083] | 192 | ! Rayleigh scattering |
---|
| 193 | do NW=1,L_NSPECTV |
---|
| 194 | TRAY(1:4,NW) = 1.d-30 |
---|
| 195 | do K=5,L_LEVELS |
---|
| 196 | TRAY(K,NW) = TAURAY(NW) * DPR(K) |
---|
| 197 | end do ! L_LEVELS |
---|
| 198 | end do |
---|
[1722] | 199 | |
---|
[3318] | 200 | DIAG_OPTH(:,:,:) = 0.D0 |
---|
| 201 | DIAG_OPTT(:,:,:) = 0.D0 |
---|
| 202 | |
---|
[3083] | 203 | do NW=1,L_NSPECTV |
---|
| 204 | ! We ignore K=1... |
---|
| 205 | do K=2,L_LEVELS |
---|
| 206 | ! int. arithmetic => gives the gcm layer index (reversed) |
---|
| 207 | ilay = L_NLAYRAD+1 - k/2 |
---|
| 208 | |
---|
| 209 | ! Optics coupled with the microphysics : |
---|
| 210 | IF (callmufi .AND. (.NOT. uncoupl_optic_haze)) THEN |
---|
[873] | 211 | |
---|
[3083] | 212 | !========================================================================================== |
---|
| 213 | ! Old optics (must have callclouds = .false.): |
---|
| 214 | !========================================================================================== |
---|
| 215 | IF (.NOT. opt4clouds) THEN |
---|
| 216 | m3as = pqmo(ilay,2) / 2.0 |
---|
| 217 | m3af = pqmo(ilay,4) / 2.0 |
---|
[3090] | 218 | ! Cut-off (here for p = 2.7e3Pa / alt = 70km) |
---|
[3340] | 219 | IF (ilay .lt. ilev_cutoff) THEN |
---|
| 220 | m3as = pqmo(ilev_cutoff,2) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
| 221 | m3af = pqmo(ilev_cutoff,4) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
[3083] | 222 | ENDIF |
---|
| 223 | |
---|
| 224 | dtauaer_s = m3as*rhoaer_s(nw) |
---|
| 225 | dtauaer_f = m3af*rhoaer_f(nw) |
---|
[253] | 226 | |
---|
[3083] | 227 | !========================================================================================== |
---|
| 228 | ! New optics : |
---|
| 229 | !========================================================================================== |
---|
| 230 | ELSE |
---|
| 231 | iw = (L_NSPECTV + 1) - NW ! Visible first and return |
---|
| 232 | !----------------------------- |
---|
| 233 | ! HAZE (Spherical + Fractal) : |
---|
| 234 | !----------------------------- |
---|
| 235 | FTYPE = 1 |
---|
[2242] | 236 | |
---|
[3083] | 237 | ! Spherical aerosols : |
---|
| 238 | !--------------------- |
---|
| 239 | CTYPE = 5 |
---|
| 240 | m0as = pqmo(ilay,1) / 2.0 |
---|
| 241 | m3as = pqmo(ilay,2) / 2.0 |
---|
[3090] | 242 | ! If not callclouds : must have a cut-off (here for p = 2.7e3Pa / alt = 70km) |
---|
[3083] | 243 | IF (.NOT. callclouds) THEN |
---|
[3340] | 244 | IF (ilay .lt. ilev_cutoff) THEN |
---|
| 245 | m0as = pqmo(ilev_cutoff,1) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
| 246 | m3as = pqmo(ilev_cutoff,2) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
[3083] | 247 | ENDIF |
---|
| 248 | ENDIF |
---|
| 249 | call get_haze_and_cloud_opacity(FTYPE,CTYPE,m0as,m3as,iw,dtauaer_s,ssa_s(nw),asf_s(nw)) |
---|
[1722] | 250 | |
---|
[3083] | 251 | ! Fractal aerosols : |
---|
| 252 | !------------------- |
---|
| 253 | CTYPE = FTYPE |
---|
| 254 | m0af = pqmo(ilay,3) / 2.0 |
---|
| 255 | m3af = pqmo(ilay,4) / 2.0 |
---|
[3090] | 256 | ! If not callclouds : must have a cut-off (here for p = 2.7e3Pa / alt = 70km) |
---|
[3083] | 257 | IF (.NOT. callclouds) THEN |
---|
[3340] | 258 | IF (ilay .lt. ilev_cutoff) THEN |
---|
| 259 | m0af = pqmo(ilev_cutoff,3) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
| 260 | m3af = pqmo(ilev_cutoff,4) / 2.0 * (zlev(ilay+1)-zlev(ilay)) / (zlev(ilev_cutoff+1)-zlev(ilev_cutoff)) |
---|
[3083] | 261 | ENDIF |
---|
| 262 | ENDIF |
---|
| 263 | call get_haze_and_cloud_opacity(FTYPE,CTYPE,m0af,m3af,iw,dtauaer_f,ssa_f(nw),asf_f(nw)) |
---|
| 264 | ENDIF |
---|
[253] | 265 | |
---|
[3318] | 266 | ! Tuning of optical properties for haze : |
---|
| 267 | !dtauaer_s = dtauaer_s * (FHVIS * (1-ssa_s(nw)) + ssa_s(nw)) |
---|
| 268 | !ssa_s(nw) = ssa_s(nw) / (FHVIS * (1-ssa_s(nw)) + ssa_s(nw)) |
---|
| 269 | dtauaer_f = dtauaer_f * (FHVIS * (1-ssa_f(nw)) + ssa_f(nw)) |
---|
| 270 | ssa_f(nw) = ssa_f(nw) / (FHVIS * (1-ssa_f(nw)) + ssa_f(nw)) |
---|
| 271 | |
---|
[3083] | 272 | ! Total of Haze opacity (dtau), SSA (w) and ASF (COS) : |
---|
| 273 | DHAZE_T(k,nw) = dtauaer_s + dtauaer_f |
---|
| 274 | IF (dtauaer_s + dtauaer_f .GT. 1.D-30) THEN |
---|
| 275 | SSA_T(k,nw) = ( dtauaer_s*ssa_s(nw) + dtauaer_f*ssa_f(nw) ) / ( dtauaer_s+dtauaer_f ) |
---|
| 276 | ASF_T(k,nw) = ( dtauaer_s*ssa_s(nw)*asf_s(nw) + dtauaer_f*ssa_f(nw)*asf_f(nw) ) & |
---|
| 277 | / ( ssa_s(nw)*dtauaer_s + ssa_f(nw)*dtauaer_f ) |
---|
| 278 | ELSE |
---|
| 279 | DHAZE_T(k,nw) = 0.D0 |
---|
| 280 | SSA_T(k,nw) = 1.0 |
---|
| 281 | ASF_T(k,nw) = 1.0 |
---|
| 282 | ENDIF |
---|
[3318] | 283 | |
---|
[3340] | 284 | ! Opacity and albedo adjustement below cutoff |
---|
| 285 | !---------------------------------------------- |
---|
| 286 | corr_haze=0.85-0.15*TANH((PMID(k)*100.-2500.)/250.) |
---|
| 287 | corr_alb =0.85-0.15*TANH((PMID(k)*100.-4500.)/1000.) |
---|
| 288 | IF (.NOT. callclouds) THEN |
---|
| 289 | IF (ilay .lt. ilev_cutoff) THEN |
---|
| 290 | DHAZE_T(k,nw) = DHAZE_T(k,nw) * corr_haze |
---|
| 291 | SSA_T(k,nw) = SSA_T(k,nw) * corr_alb |
---|
| 292 | ENDIF |
---|
| 293 | ENDIF |
---|
| 294 | |
---|
[3083] | 295 | ! Diagnostics for the haze : |
---|
[3318] | 296 | DIAG_OPTH(k,nw,1) = DHAZE_T(k,nw) ! dtau |
---|
| 297 | DIAG_OPTH(k,nw,2) = SSA_T(k,nw) ! wbar |
---|
| 298 | DIAG_OPTH(k,nw,3) = ASF_T(k,nw) ! gbar |
---|
[305] | 299 | |
---|
[3083] | 300 | !--------------------- |
---|
| 301 | ! CLOUDS (Spherical) : |
---|
| 302 | !--------------------- |
---|
| 303 | IF (callclouds) THEN |
---|
| 304 | CTYPE = 0 |
---|
| 305 | m0ccn = pqmo(ilay,5) / 2.0 |
---|
| 306 | m3ccn = pqmo(ilay,6) / 2.0 |
---|
[3318] | 307 | m3cld = pqmo(ilay,6) / 2.0 |
---|
[3083] | 308 | |
---|
| 309 | ! Clear / Dark column method : |
---|
| 310 | !----------------------------- |
---|
[305] | 311 | |
---|
[3083] | 312 | ! CCN's SSA : |
---|
| 313 | call get_haze_and_cloud_opacity(FTYPE,FTYPE,m0ccn,m3ccn,iw,dtau_ccn,ssa_ccn(nw),asf_ccn(nw)) |
---|
[253] | 314 | |
---|
[3083] | 315 | ! Clear column (CCN, C2H2, C2H6, HCN) : |
---|
| 316 | IF (CDCOLUMN == 0) THEN |
---|
| 317 | DO iq = 2, nice |
---|
| 318 | m3cld = m3cld + (pqmo(ilay,ices_indx(iq)) / 2.0) |
---|
| 319 | ENDDO |
---|
| 320 | call get_haze_and_cloud_opacity(FTYPE,CTYPE,m0ccn,m3cld,iw,dtau_cld,ssa_cld(nw),asf_cld(nw)) |
---|
| 321 | |
---|
| 322 | ! Dark column (CCN, CH4, C2H2, C2H6, HCN) : |
---|
| 323 | ELSEIF (CDCOLUMN == 1) THEN |
---|
| 324 | DO iq = 1, nice |
---|
| 325 | m3cld = m3cld + (pqmo(ilay,ices_indx(iq)) / 2.0) |
---|
| 326 | ENDDO |
---|
| 327 | call get_haze_and_cloud_opacity(FTYPE,CTYPE,m0ccn,m3cld,iw,dtau_cld,ssa_cld(nw),asf_cld(nw)) |
---|
| 328 | |
---|
| 329 | ELSE |
---|
| 330 | WRITE(*,*) 'WARNING OPTCV.F90 : CDCOLUMN MUST BE 0 OR 1' |
---|
| 331 | WRITE(*,*) 'WE USE DARK COLUMN ...' |
---|
| 332 | DO iq = 1, nice |
---|
| 333 | m3cld = m3cld + (pqmo(ilay,ices_indx(iq)) / 2.0) |
---|
| 334 | ENDDO |
---|
| 335 | call get_haze_and_cloud_opacity(FTYPE,CTYPE,m0ccn,m3cld,iw,dtau_cld,ssa_cld(nw),asf_cld(nw)) |
---|
| 336 | ENDIF |
---|
[253] | 337 | |
---|
[3083] | 338 | ! For small dropplets, opacity of nucleus dominates |
---|
[3318] | 339 | dtau_cld = (dtau_cld*m3ccn + dtau_cld*m3cld) / (m3ccn + m3cld) |
---|
[3083] | 340 | ssa_cld(nw) = (ssa_ccn(nw)*m3ccn + ssa_cld(nw)*m3cld) / (m3ccn + m3cld) |
---|
[253] | 341 | |
---|
[3318] | 342 | ! Tuning of optical properties for clouds : |
---|
| 343 | dtau_cld = dtau_cld * (FCVIS * (1-ssa_cld(nw)) + ssa_cld(nw)) |
---|
| 344 | ssa_cld(nw) = ssa_cld(nw) / (FCVIS * (1-ssa_cld(nw)) + ssa_cld(nw)) |
---|
| 345 | |
---|
[3083] | 346 | ! Total of Haze + Clouds opacity (dtau), SSA (w) and ASF (COS) : |
---|
| 347 | DHAZE_T(k,nw) = dtauaer_s + dtauaer_f + dtau_cld |
---|
| 348 | IF (DHAZE_T(k,nw) .GT. 1.D-30) THEN |
---|
| 349 | SSA_T(k,nw) = ( dtauaer_s*ssa_s(nw) + dtauaer_f*ssa_f(nw) + dtau_cld*ssa_cld(nw) ) / ( dtauaer_s+dtauaer_f+dtau_cld ) |
---|
| 350 | ASF_T(k,nw) = ( dtauaer_s*ssa_s(nw)*asf_s(nw) + dtauaer_f*ssa_f(nw)*asf_f(nw) + dtau_cld*ssa_cld(nw)*asf_cld(nw) ) & |
---|
| 351 | / ( ssa_s(nw)*dtauaer_s + ssa_f(nw)*dtauaer_f + ssa_cld(nw)*dtau_cld ) |
---|
| 352 | ELSE |
---|
| 353 | DHAZE_T(k,nw) = 0.D0 |
---|
| 354 | SSA_T(k,nw) = 1.0 |
---|
| 355 | ASF_T(k,nw) = 1.0 |
---|
| 356 | ENDIF |
---|
| 357 | |
---|
| 358 | ! Diagnostics for clouds : |
---|
[3318] | 359 | DIAG_OPTT(k,nw,1) = DHAZE_T(k,nw) ! dtau |
---|
| 360 | DIAG_OPTT(k,nw,2) = SSA_T(k,nw) ! wbar |
---|
| 361 | DIAG_OPTT(k,nw,3) = ASF_T(k,nw) ! gbar |
---|
[3083] | 362 | |
---|
| 363 | ELSE |
---|
| 364 | ! Diagnostics for clouds : |
---|
[3318] | 365 | DIAG_OPTT(k,nw,1) = 0.D0 ! dtau |
---|
| 366 | DIAG_OPTT(k,nw,2) = 1.0 ! wbar |
---|
| 367 | DIAG_OPTT(k,nw,3) = 1.0 ! gbar |
---|
[3083] | 368 | ENDIF |
---|
| 369 | |
---|
| 370 | ! Optics and microphysics no coupled : |
---|
| 371 | ELSE |
---|
| 372 | ! Call fixed vertical haze profile of extinction - same for all columns |
---|
| 373 | call disr_haze(dz(k),plev(k),wnov(nw),DHAZE_T(k,nw),SSA_T(k,nw),ASF_T(k,nw)) |
---|
| 374 | if (seashaze) DHAZE_T(k,nw) = DHAZE_T(k,nw)*seashazefact(k) |
---|
| 375 | ! Diagnostics for the haze : |
---|
[3318] | 376 | DIAG_OPTH(k,nw,1) = DHAZE_T(k,nw) ! dtau |
---|
| 377 | DIAG_OPTH(k,nw,2) = SSA_T(k,nw) ! wbar |
---|
| 378 | DIAG_OPTH(k,nw,3) = ASF_T(k,nw) ! gbar |
---|
[3083] | 379 | ! Diagnostics for clouds : |
---|
[3318] | 380 | DIAG_OPTT(k,nw,1) = 0.D0 ! dtau |
---|
| 381 | DIAG_OPTT(k,nw,2) = 1.0 ! wbar |
---|
| 382 | DIAG_OPTT(k,nw,3) = 1.0 ! gbar |
---|
[3083] | 383 | ENDIF ! ENDIF callmufi |
---|
| 384 | |
---|
| 385 | !JL18 It seems to be good to have aerosols in the first "radiative layer" of the gcm in the IR |
---|
| 386 | ! but visible does not handle very well diffusion in first layer. |
---|
| 387 | ! The tauaero and tauray are thus set to 0 (a small value for rayleigh because the code crashes otherwise) |
---|
| 388 | ! in the 4 first semilayers in optcv, but not optci. |
---|
| 389 | ! This solves random variations of the sw heating at the model top. |
---|
| 390 | if (k<5) DHAZE_T(K,:) = 0.0 |
---|
| 391 | |
---|
| 392 | DRAYAER = TRAY(K,NW) |
---|
| 393 | ! DRAYAER is Tau RAYleigh scattering, plus AERosol opacity |
---|
| 394 | DRAYAER = DRAYAER + DHAZE_T(K,NW) ! Titan's aerosol |
---|
[253] | 395 | |
---|
[3083] | 396 | DCONT = 0.0 ! continuum absorption |
---|
[1648] | 397 | |
---|
[3083] | 398 | if(continuum.and.(.not.graybody).and.callgasvis)then |
---|
| 399 | ! include continua if necessary |
---|
| 400 | wn_cont = dble(wnov(nw)) |
---|
| 401 | T_cont = dble(TMID(k)) |
---|
| 402 | do igas=1,ngasmx |
---|
[1648] | 403 | |
---|
[3083] | 404 | p_cont = dble(PMID(k)*scalep*gfrac(igas,ilay)) |
---|
[1648] | 405 | |
---|
[3083] | 406 | dtemp=0.0 |
---|
| 407 | if(igas.eq.igas_N2)then |
---|
[253] | 408 | |
---|
[3083] | 409 | interm = indv(nw,igas,igas) |
---|
| 410 | ! call interpolateN2N2(wn_cont,T_cont,p_cont,dtemp,.false.,interm) |
---|
| 411 | indv(nw,igas,igas) = interm |
---|
| 412 | ! only goes to 500 cm^-1, so unless we're around a cold brown dwarf, this is irrelevant in the visible |
---|
[253] | 413 | |
---|
[3083] | 414 | elseif(igas.eq.igas_H2)then |
---|
[253] | 415 | |
---|
[3083] | 416 | ! first do self-induced absorption |
---|
| 417 | interm = indv(nw,igas,igas) |
---|
| 418 | call interpolateH2H2(wn_cont,T_cont,p_cont,dtemp,.false.,interm) |
---|
| 419 | indv(nw,igas,igas) = interm |
---|
[873] | 420 | |
---|
[3083] | 421 | ! then cross-interactions with other gases |
---|
| 422 | do jgas=1,ngasmx |
---|
| 423 | p_cross = dble(PMID(k)*scalep*gfrac(jgas,ilay)) |
---|
| 424 | dtempc = 0.0 |
---|
| 425 | if(jgas.eq.igas_N2)then |
---|
| 426 | interm = indv(nw,igas,jgas) |
---|
| 427 | call interpolateN2H2(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm) |
---|
| 428 | indv(nw,igas,jgas) = interm |
---|
| 429 | ! should be irrelevant in the visible |
---|
| 430 | endif |
---|
| 431 | dtemp = dtemp + dtempc |
---|
| 432 | enddo |
---|
[253] | 433 | |
---|
[3083] | 434 | elseif(igas.eq.igas_CH4)then |
---|
[305] | 435 | |
---|
[3083] | 436 | ! first do self-induced absorption |
---|
| 437 | interm = indv(nw,igas,igas) |
---|
| 438 | call interpolateCH4CH4(wn_cont,T_cont,p_cont,dtemp,.false.,interm) |
---|
| 439 | indv(nw,igas,igas) = interm |
---|
[253] | 440 | |
---|
[3083] | 441 | ! then cross-interactions with other gases |
---|
| 442 | do jgas=1,ngasmx |
---|
| 443 | p_cross = dble(PMID(k)*scalep*gfrac(jgas,ilay)) |
---|
| 444 | dtempc = 0.0 |
---|
| 445 | if(jgas.eq.igas_N2)then |
---|
| 446 | interm = indv(nw,igas,jgas) |
---|
| 447 | call interpolateN2CH4(wn_cont,T_cont,p_cross,p_cont,dtempc,.false.,interm) |
---|
| 448 | indv(nw,igas,jgas) = interm |
---|
| 449 | endif |
---|
| 450 | dtemp = dtemp + dtempc |
---|
| 451 | enddo |
---|
[873] | 452 | |
---|
[3083] | 453 | endif |
---|
[1725] | 454 | |
---|
[3083] | 455 | DCONT = DCONT + dtemp |
---|
[253] | 456 | |
---|
[3083] | 457 | enddo |
---|
[253] | 458 | |
---|
[3083] | 459 | DCONT = DCONT*dz(k) |
---|
[1722] | 460 | |
---|
[3083] | 461 | endif |
---|
[253] | 462 | |
---|
[3083] | 463 | do ng=1,L_NGAUSS-1 |
---|
[253] | 464 | |
---|
[3083] | 465 | ! Now compute TAUGAS |
---|
[253] | 466 | |
---|
[3083] | 467 | ! JVO 2017 : added tmpk because the repeated calls to gasi/v increased dramatically |
---|
| 468 | ! the execution time of optci/v -> ~ factor 2 on the whole radiative |
---|
| 469 | ! transfer on the tested simulations ! |
---|
[253] | 470 | |
---|
[3083] | 471 | if (corrk_recombin) then |
---|
| 472 | tmpk = GASV_RECOMB(MT(K):MT(K)+1,MP(K):MP(K)+1,NW,NG) |
---|
| 473 | else |
---|
| 474 | tmpk = GASV(MT(K):MT(K)+1,MP(K):MP(K)+1,1,NW,NG) |
---|
| 475 | endif |
---|
| 476 | |
---|
| 477 | KCOEF(1) = tmpk(1,1) ! KCOEF(1) = GASV(MT(K),MP(K),1,NW,NG) |
---|
| 478 | KCOEF(2) = tmpk(1,2) ! KCOEF(2) = GASV(MT(K),MP(K)+1,1,NW,NG) |
---|
| 479 | KCOEF(3) = tmpk(2,2) ! KCOEF(3) = GASV(MT(K)+1,MP(K)+1,1,NW,NG) |
---|
| 480 | KCOEF(4) = tmpk(2,1) ! KCOEF(4) = GASV(MT(K)+1,MP(K),1,NW,NG) |
---|
[253] | 481 | |
---|
[3083] | 482 | ! Interpolate the gaseous k-coefficients to the requested T,P values |
---|
[253] | 483 | |
---|
[3083] | 484 | ANS = LKCOEF(K,1)*KCOEF(1) + LKCOEF(K,2)*KCOEF(2) + & |
---|
| 485 | LKCOEF(K,3)*KCOEF(3) + LKCOEF(K,4)*KCOEF(4) |
---|
[253] | 486 | |
---|
[3083] | 487 | |
---|
| 488 | TAUGAS = U(k)*ANS |
---|
| 489 | |
---|
| 490 | TAUGSURF(NW,NG) = TAUGSURF(NW,NG) + TAUGAS + DCONT |
---|
| 491 | DTAUKV(K,nw,ng) = TAUGAS & |
---|
| 492 | + DRAYAER & ! DRAYAER includes all scattering contributions |
---|
| 493 | + DCONT ! For parameterized continuum aborption |
---|
| 494 | end do |
---|
| 495 | |
---|
| 496 | ! Now fill in the "clear" part of the spectrum (NG = L_NGAUSS), |
---|
| 497 | ! which holds continuum opacity only |
---|
| 498 | |
---|
| 499 | NG = L_NGAUSS |
---|
| 500 | DTAUKV(K,nw,ng) = DRAYAER + DCONT ! Scattering + parameterized continuum absorption, including Titan's haze |
---|
| 501 | |
---|
[3318] | 502 | DIAG_OPTH(K,nw,4) = DRAYAER |
---|
| 503 | DIAG_OPTH(K,nw,5) = TAUGAS |
---|
| 504 | DIAG_OPTH(K,nw,6) = DCONT |
---|
| 505 | DIAG_OPTT(K,nw,4) = DRAYAER |
---|
| 506 | DIAG_OPTT(K,nw,5) = TAUGAS |
---|
| 507 | DIAG_OPTT(K,nw,6) = DCONT |
---|
[3083] | 508 | |
---|
[3318] | 509 | end do ! K = L_LEVELS |
---|
| 510 | end do ! nw = L_NSPECTV |
---|
| 511 | |
---|
[716] | 512 | !======================================================================= |
---|
| 513 | ! Now the full treatment for the layers, where besides the opacity |
---|
| 514 | ! we need to calculate the scattering albedo and asymmetry factors |
---|
[2050] | 515 | ! ====================================================================== |
---|
[1722] | 516 | |
---|
[1648] | 517 | ! Haze scattering |
---|
[2095] | 518 | !JL18 It seems to be good to have aerosols in the first "radiative layer" of the gcm in the IR |
---|
[2242] | 519 | ! but not in the visible |
---|
| 520 | ! The dhaze_s is thus set to 0 in the 4 first semilayers in optcv, but not optci. |
---|
| 521 | ! This solves random variations of the sw heating at the model top. |
---|
[1648] | 522 | DO NW=1,L_NSPECTV |
---|
[2242] | 523 | DHAZES_T(1:4,NW) = 0.d0 |
---|
[2095] | 524 | DO K=5,L_LEVELS |
---|
[1722] | 525 | DHAZES_T(K,NW) = DHAZE_T(K,NW) * SSA_T(K,NW) ! effect of scattering albedo on haze |
---|
[1648] | 526 | ENDDO |
---|
| 527 | ENDDO |
---|
[253] | 528 | |
---|
[3083] | 529 | ! NW spectral loop |
---|
[716] | 530 | DO NW=1,L_NSPECTV |
---|
[3083] | 531 | ! L vertical loop |
---|
| 532 | DO L=1,L_NLAYRAD-1 |
---|
| 533 | K = 2*L+1 |
---|
| 534 | atemp(L,NW) = ASF_T(K,NW)*DHAZES_T(K,NW) + ASF_T(K+1,NW)*DHAZES_T(K+1,NW) |
---|
| 535 | btemp(L,NW) = DHAZES_T(K,NW) + DHAZES_T(K+1,NW) |
---|
| 536 | ctemp(L,NW) = btemp(L,NW) + 0.9999*(TRAY(K,NW) + TRAY(K+1,NW)) ! JVO 2017 : does this 0.999 is really meaningful ? |
---|
| 537 | btemp(L,NW) = btemp(L,NW) + TRAY(K,NW) + TRAY(K+1,NW) |
---|
| 538 | COSBV(L,NW,1:L_NGAUSS) = atemp(L,NW)/btemp(L,NW) |
---|
| 539 | END DO |
---|
[919] | 540 | |
---|
[3083] | 541 | ! Last level |
---|
| 542 | L = L_NLAYRAD |
---|
| 543 | K = 2*L+1 |
---|
| 544 | atemp(L,NW) = ASF_T(K,NW)*DHAZES_T(K,NW) |
---|
| 545 | btemp(L,NW) = DHAZES_T(K,NW) |
---|
| 546 | ctemp(L,NW) = btemp(L,NW) + 0.9999*TRAY(K,NW) ! JVO 2017 : does this 0.999 is really meaningful ? |
---|
| 547 | btemp(L,NW) = btemp(L,NW) + TRAY(K,NW) |
---|
| 548 | COSBV(L,NW,1:L_NGAUSS) = atemp(L,NW)/btemp(L,NW) |
---|
| 549 | END DO |
---|
[918] | 550 | |
---|
[3083] | 551 | ! NG Gauss loop |
---|
[918] | 552 | DO NG=1,L_NGAUSS |
---|
[3083] | 553 | ! NW spectral loop |
---|
| 554 | DO NW=1,L_NSPECTV |
---|
| 555 | ! L vertical loop |
---|
| 556 | DO L=1,L_NLAYRAD-1 |
---|
| 557 | K = 2*L+1 |
---|
| 558 | DTAUV(L,nw,ng) = DTAUKV(K,NW,NG) + DTAUKV(K+1,NW,NG) |
---|
| 559 | WBARV(L,nw,ng) = ctemp(L,NW) / DTAUV(L,nw,ng) |
---|
| 560 | END DO |
---|
[253] | 561 | |
---|
[3083] | 562 | ! Last level |
---|
| 563 | L = L_NLAYRAD |
---|
| 564 | K = 2*L+1 |
---|
| 565 | DTAUV(L,nw,ng) = DTAUKV(K,NW,NG) |
---|
| 566 | WBARV(L,NW,NG) = ctemp(L,NW) / DTAUV(L,NW,NG) |
---|
| 567 | END DO |
---|
| 568 | END DO |
---|
[253] | 569 | |
---|
[716] | 570 | ! Total extinction optical depths |
---|
[3083] | 571 | !DO NG=1,L_NGAUSS ! full gauss loop |
---|
| 572 | ! DO NW=1,L_NSPECTV |
---|
| 573 | ! TAUCUMV(1,NW,NG)=0.0D0 |
---|
| 574 | ! DO K=2,L_LEVELS |
---|
| 575 | ! TAUCUMV(K,NW,NG)=TAUCUMV(K-1,NW,NG)+DTAUKV(K,NW,NG) |
---|
| 576 | ! END DO |
---|
| 577 | ! DO L=1,L_NLAYRAD |
---|
| 578 | ! TAUV(L,NW,NG)=TAUCUMV(2*L,NW,NG) |
---|
| 579 | ! END DO |
---|
| 580 | ! TAUV(L,NW,NG)=TAUCUMV(2*L_NLAYRAD+1,NW,NG) |
---|
| 581 | ! END DO |
---|
| 582 | !END DO ! end full gauss loop |
---|
| 583 | |
---|
| 584 | TAUCUMV(:,:,:) = DTAUKV(:,:,:) |
---|
| 585 | DO L=1,L_NLAYRAD |
---|
| 586 | TAUV(L,:,:)=TAUCUMV(2*L,:,:) |
---|
| 587 | END DO |
---|
| 588 | TAUV(L,:,:)=TAUCUMV(2*L_NLAYRAD+1,:,:) |
---|
[716] | 589 | |
---|
[1897] | 590 | if(firstcall) firstcall = .false. |
---|
[1648] | 591 | |
---|
[873] | 592 | return |
---|
| 593 | |
---|
| 594 | |
---|
| 595 | end subroutine optcv |
---|