⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 radclwmx.f90

📁 CCSM Research Tools: Community Atmosphere Model (CAM)
💻 F90
📖 第 1 页 / 共 3 页
字号:
         else            do i=1,ncol               bk2(i) = (abstot(i,k,km-1) + abstot(i,k,km))*0.5               bk1(i) = bk2(i)            end do         end if         do i=1,ncol            s(i,k,km) = s(i,k,km+1) + stebol*(bk2(i)*delt(i) + bk1(i)*delt1(i))         end do      end do   end do!! Computation of clear sky fluxes always set first level of fsul!   do i=1,ncol      fsul(i,pverp) = lwupcgs(i)   end do!! Downward clear sky fluxes store intermediate quantities in down flux! Initialize fluxes to clear sky values.!   do i=1,ncol      tmp(i) = fsul(i,pverp) - stebol*tint4(i,pverp)      fsul(i,ntoplw) = fsul(i,pverp) - abstot(i,ntoplw,pverp)*tmp(i) + s(i,ntoplw,ntoplw+1)      fsdl(i,ntoplw) = stebol*(tplnke(i)**4)*emstot(i,ntoplw)   end do!! fsdl(i,pverp) assumes isothermal layer!   do k=ntoplw+1,pver      do i=1,ncol         fsul(i,k) = fsul(i,pverp) - abstot(i,k,pverp)*tmp(i) + s(i,k,k+1)         fsdl(i,k) = stebol*(tplnke(i)**4)*emstot(i,k) - (s(i,k,ntoplw+1) - s(i,k,k+1))      end do   end do!! Store the downward emission from level 1 = total gas emission * sigma! t**4.  fsdl does not yet include all terms!   do i=1,ncol      absbt(i) = stebol*(tplnke(i)**4)*emstot(i,pverp)      fsdl(i,pverp) = absbt(i) - s(i,pverp,ntoplw+1)   end do!!----------------------------------------------------------------------! Modifications for clouds -- max/random overlap assumption!! The column is divided into sets of adjacent layers, called regions,!   in which the clouds are maximally overlapped.  The clouds are!   randomly overlapped between different regions.  The number of!   regions in a column is set by nmxrgn, and the range of pressures!   included in each region is set by pmxrgn.  The max/random overlap!   can be written in terms of the solutions of random overlap with!   cloud amounts = 1.  The random overlap assumption is equivalent to!   setting the flux boundary conditions (BCs) at the edges of each region!   equal to the mean all-sky flux at those boundaries.  Since the!   emissivity array for propogating BCs is only computed for the!   TOA BC, the flux BCs elsewhere in the atmosphere have to be formulated!   in terms of solutions to the random overlap equations.  This is done!   by writing the flux BCs as the sum of a clear-sky flux and emission!   from a cloud outside the region weighted by an emissivity.  This!   emissivity is determined from the location of the cloud and the!   flux BC.!! Copy cloud amounts to buffer with extra layer (needed for overlap logic)!   cldp(:ncol,ntoplw:pver) = cld(:ncol,ntoplw:pver)   cldp(:ncol,pverp) = 0.0!!! Select only those locations where there are no clouds!    (maximum cloud fraction <= 1.e-3 treated as clear)!    Set all-sky fluxes to clear-sky values.!   maxcld(1:ncol) = maxval(cldp(1:ncol,ntoplw:pver),dim=2)   npts = 0   do i=1,ncol      if (maxcld(i) < cldmin) then         npts = npts + 1         indx(npts) = i      end if   end do   do ii = 1, npts      i = indx(ii)      do k = ntoplw, pverp         fdl(i,k) = fsdl(i,k)         ful(i,k) = fsul(i,k)      end do   end do!! Select only those locations where there are clouds!   npts = 0   do i=1,ncol      if (maxcld(i) >= cldmin) then         npts = npts + 1         indx(npts) = i      end if   end do!! Initialize all-sky fluxes. fdl(i,1) & ful(i,pverp) are boundary conditions!   do ii = 1, npts      i = indx(ii)      fdl(i,ntoplw) = fsdl(i,ntoplw)      fdl(i,pverp)  = 0.0      ful(i,ntoplw) = 0.0      ful(i,pverp)  = fsul(i,pverp)      do k = ntoplw+1, pver         fdl(i,k) = 0.0         ful(i,k) = 0.0      end do!! Initialize Planck emission from layer boundaries!      do k = ntoplw, pver         fclt4(i,k-1) = stebol*tint4(i,k)         fclb4(i,k-1) = stebol*tint4(i,k+1)      enddo      fclb4(i,ntoplw-2) =  stebol*tint4(i,ntoplw)      fclt4(i,pver)     = stebol*tint4(i,pverp)!! Initialize indices for layers to be max-overlapped!      do irgn = 0, nmxrgn(i)         kx2(i,irgn) = ntoplw-1      end do      nrgn(i) = 0   end do!----------------------------------------------------------------------! INDEX CALCULATIONS FOR MAX OVERLAP   do ii = 1, npts      ilon = indx(ii)!! Outermost loop over regions (sets of adjacent layers) to be max overlapped!      do irgn = 1, nmxrgn(ilon)!! Calculate min/max layer indices inside region.!         n = 0         if (kx2(ilon,irgn-1) < pver) then            nrgn(ilon) = irgn            k1 = kx2(ilon,irgn-1)+1            kx1(ilon,irgn) = k1            kx2(ilon,irgn) = 0            do k2 = pver, k1, -1               if (pmid(ilon,k2) <= pmxrgn(ilon,irgn)) then                  kx2(ilon,irgn) = k2                  exit               end if            end do!! Identify columns with clouds in the given region.!            do k = k1, k2               if (cldp(ilon,k) >= cldmin) then                  n = n+1                  indxmx(n,irgn) = ilon                  exit               endif            end do         endif         ncolmx(irgn) = n!! Dummy value for handling clear-sky regions!!!$         indxmx(ncolmx(irgn)+1,irgn) = ncol+1!! Outer loop over columns with clouds in the max-overlap region!         do iimx = 1, ncolmx(irgn)            i = indxmx(iimx,irgn)!! Sort cloud areas and corresponding level indices.!            n = 0            do k = kx1(i,irgn),kx2(i,irgn)               if (cldp(i,k) >= cldmin) then                  n = n+1                  ksort(n) = k!! We need indices for clouds in order of largest to smallest, so!    sort 1-cld in ascending order!                  asort(n) = 1.0-cldp(i,k)               end if            end do            nxs(i,irgn) = n!! If nxs(i,irgn) eq 1, no need to sort.! If nxs(i,irgn) eq 2, sort by swapping if necessary! If nxs(i,irgn) ge 3, sort using local sort routine!            if (nxs(i,irgn) == 2) then               if (asort(2) < asort(1)) then                  ktmp = ksort(1)                  ksort(1) = ksort(2)                  ksort(2) = ktmp                  atmp = asort(1)                  asort(1) = asort(2)                  asort(2) = atmp               endif            else if (nxs(i,irgn) >= 3) then               call sortarray(nxs(i,irgn),asort,ksort(1:))            endif            do l = 1, nxs(i,irgn)               kxs(l,i,irgn) = ksort(l)            end do!! End loop over longitude i for fluxes!         end do!! End loop over regions irgn for max-overlap!      end do!!----------------------------------------------------------------------! DOWNWARD FLUXES:! Outermost loop over regions (sets of adjacent layers) to be max overlapped!      do irgn = 1, nmxrgn(ilon)!! Compute clear-sky fluxes for regions without clouds!         iimx = 1         if (ilon < indxmx(iimx,irgn) .and. irgn <= nrgn(ilon)) then!! Calculate emissivity so that downward flux at upper boundary of region!    can be cast in form of solution for downward flux from cloud above!    that boundary.  Then solutions for fluxes at other levels take form of!    random overlap expressions.  Try to locate "cloud" as close as possible!    to TOA such that the "cloud" pseudo-emissivity is between 0 and 1.!            k1 = kx1(ilon,irgn)            do km1 = ntoplw-2, k1-2               km4 = km1+3               k2 = k1               k3 = k2+1               tmp(ilon) = s(ilon,k2,min(k3,pverp))*min(1,pverp2-k3)               emx0 = (fdl(ilon,k1)-fsdl(ilon,k1))/ &                      ((fclb4(ilon,km1)-s(ilon,k2,km4)+tmp(ilon))- fsdl(ilon,k1))               if (emx0 >= 0.0 .and. emx0 <= 1.0) exit            end do            km1 = min(km1,k1-2)            do k2 = kx1(ilon,irgn)+1, kx2(ilon,irgn)+1               k3 = k2+1               tmp(ilon) = s(ilon,k2,min(k3,pverp))*min(1,pverp2-k3)               fdl(ilon,k2) = (1.0-emx0)*fsdl(ilon,k2) + &                               emx0*(fclb4(ilon,km1)-s(ilon,k2,km4)+tmp(ilon))            end do         else if (ilon==indxmx(iimx,irgn) .and. iimx<=ncolmx(irgn)) then            iimx = iimx+1         end if!! Outer loop over columns with clouds in the max-overlap region!         do iimx = 1, ncolmx(irgn)            i = indxmx(iimx,irgn)!! Calculate emissivity so that downward flux at upper boundary of region!    can be cast in form of solution for downward flux from cloud above that!    boundary.  Then solutions for fluxes at other levels take form of!    random overlap expressions.  Try to locate "cloud" as close as possible!    to TOA such that the "cloud" pseudo-emissivity is between 0 and 1.!            k1 = kx1(i,irgn)            do km1 = ntoplw-2,k1-2               km4 = km1+3               k2 = k1               k3 = k2 + 1               tmp(i) = s(i,k2,min(k3,pverp))*min(1,pverp2-k3)               tmp2(i) = s(i,k2,min(km4,pverp))*min(1,pverp2-km4)               emx0 = (fdl(i,k1)-fsdl(i,k1))/((fclb4(i,km1)-tmp2(i)+tmp(i))-fsdl(i,k1))               if (emx0 >= 0.0 .and. emx0 <= 1.0) exit            end do            km1 = min(km1,k1-2)            ksort(0) = km1 + 1!! Loop to calculate fluxes at level k!            nxsk = 0            do k = kx1(i,irgn), kx2(i,irgn)!! Identify clouds (largest to smallest area) between kx1 and k!    Since nxsk will increase with increasing k up to nxs(i,irgn), once!    nxsk == nxs(i,irgn) then use the list constructed for previous k!               if (nxsk < nxs(i,irgn)) then                  nxsk = 0                  do l = 1, nxs(i,irgn)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -