📄 radcswmx.f90
字号:
! ! Apply adding method to solve for radiative properties! ! First initialize the bulk properties at TOA! rdndif(0,1:nconfig) = 0.0_r8 exptdn(0,1:nconfig) = 1.0_r8 tdntot(0,1:nconfig) = 1.0_r8! ! Solve for properties involving downward propagation of radiation.! The bulk properties are:! ! (1. exptdn Sol. beam dwn. trans from layers above! (2. rdndif Ref to dif rad for layers above! (3. tdntot Total trans for layers above! do k = 1, pverp km1 = k - 1 do l0 = 1, nuniqd(km1) is0 = istrtd(km1,l0) is1 = istrtd(km1,l0+1)-1 j = icond(km1,is0) xexpt = exptdn(km1,j) xrdnd = rdndif(km1,j) tdnmexp = tdntot(km1,j) - xexpt if (ccon(km1,j) == 1) then! ! If cloud in layer, use cloudy layer radiative properties! ytdnd = tdif(ns,i,km1) yrdnd = rdif(ns,i,km1) rdenom = 1._r8/(1._r8-yrdnd*xrdnd) rdirexp = rdir(ns,i,km1)*xexpt zexpt = xexpt * explay(ns,i,km1) zrdnd = yrdnd + xrdnd*(ytdnd**2)*rdenom ztdnt = xexpt*tdir(ns,i,km1) + ytdnd*(tdnmexp + xrdnd*rdirexp)*rdenom else! ! If clear layer, use clear-sky layer radiative properties! ytdnd = tdifc(ns,i,km1) yrdnd = rdifc(ns,i,km1) rdenom = 1._r8/(1._r8-yrdnd*xrdnd) rdirexp = rdirc(ns,i,km1)*xexpt zexpt = xexpt * explayc(ns,i,km1) zrdnd = yrdnd + xrdnd*(ytdnd**2)*rdenom ztdnt = xexpt*tdirc(ns,i,km1) + ytdnd* & (tdnmexp + xrdnd*rdirexp)*rdenom endif! ! If 2 or more configurations share identical properties at a given level k,! the properties (at level k) are computed once and copied to ! all the configurations for efficiency.! do isn = is0, is1 j = icond(km1,isn) exptdn(k,j) = zexpt rdndif(k,j) = zrdnd tdntot(k,j) = ztdnt end do! ! end do l0 = 1, nuniqd(k)! end do! ! end do k = 1, pverp! end do! ! Solve for properties involving upward propagation of radiation.! The bulk properties are:! ! (1. rupdif Ref to dif rad for layers below! (2. rupdir Ref to dir rad for layers below! ! Specify surface boundary conditions (surface albedos)! rupdir(pverp,1:nconfig) = albdir(i,ns) rupdif(pverp,1:nconfig) = albdif(i,ns) do k = pver, 0, -1 do l0 = 1, nuniqu(k) is0 = istrtu(k,l0) is1 = istrtu(k,l0+1)-1 j = iconu(k,is0) xrupd = rupdif(k+1,j) xrups = rupdir(k+1,j) if (ccon(k,j) == 1) then! ! If cloud in layer, use cloudy layer radiative properties! yexpt = explay(ns,i,k) yrupd = rdif(ns,i,k) ytupd = tdif(ns,i,k) rdenom = 1._r8/( 1._r8 - yrupd*xrupd) tdnmexp = (tdir(ns,i,k)-yexpt) rdirexp = xrups*yexpt zrupd = yrupd + xrupd*(ytupd**2)*rdenom zrups = rdir(ns,i,k) + ytupd*(rdirexp + xrupd*tdnmexp)*rdenom else! ! If clear layer, use clear-sky layer radiative properties! yexpt = explayc(ns,i,k) yrupd = rdifc(ns,i,k) ytupd = tdifc(ns,i,k) rdenom = 1._r8/( 1._r8 - yrupd*xrupd) tdnmexp = (tdirc(ns,i,k)-yexpt) rdirexp = xrups*yexpt zrupd = yrupd + xrupd*(ytupd**2)*rdenom zrups = rdirc(ns,i,k) + ytupd*(rdirexp + xrupd*tdnmexp)*rdenom endif! ! If 2 or more configurations share identical properties at a given level k,! the properties (at level k) are computed once and copied to ! all the configurations for efficiency.! do isn = is0, is1 j = iconu(k,isn) rupdif(k,j) = zrupd rupdir(k,j) = zrups end do! ! end do l0 = 1, nuniqu(k)! end do! ! end do k = pver,0,-1! end do! !----------------------------------------------------------------------! ! STEP 3! ! Compute up and down fluxes for each interface k. This requires! adding up the contributions from all possible permutations! of streams in all max-overlap regions, weighted by the! product of the fractional areas of the streams in each region! (the random overlap assumption). The adding principle has been! used in step 2 to combine the bulk radiative properties ! above and below the interface.! do k = 0,pverp! ! Initialize the fluxes! fluxup(k)=0.0_r8 fluxdn(k)=0.0_r8 do iconfig = 1, nconfig xwgt = wgtv(iconfig) xexpt = exptdn(k,iconfig) xtdnt = tdntot(k,iconfig) xrdnd = rdndif(k,iconfig) xrupd = rupdif(k,iconfig) xrups = rupdir(k,iconfig)! ! Flux computation! rdenom = 1._r8/(1._r8 - xrdnd * xrupd) fluxup(k) = fluxup(k) + xwgt * & ((xexpt * xrups + (xtdnt - xexpt) * xrupd) * rdenom) fluxdn(k) = fluxdn(k) + xwgt * & (xexpt + (xtdnt - xexpt + xexpt * xrups * xrdnd) * rdenom)! ! End do iconfig = 1, nconfig! end do! ! Normalize by total area covered by cloud configurations included! in solution! fluxup(k)=fluxup(k) / totwgt fluxdn(k)=fluxdn(k) / totwgt ! ! End do k = 0,pverp! end do! ! Initialize the direct-beam flux at surface! wexptdn = 0.0_r8 do iconfig = 1, nconfig wexptdn = wexptdn + wgtv(iconfig) * exptdn(pverp,iconfig) end do wexptdn = wexptdn / totwgt! ! Monochromatic computation completed; accumulate in totals! solflx = solin(i)*frcsol(ns)*psf(ns) fsnt(i) = fsnt(i) + solflx*(fluxdn(1) - fluxup(1)) fsntoa(i)= fsntoa(i) + solflx*(fluxdn(0) - fluxup(0)) fsns(i) = fsns(i) + solflx*(fluxdn(pverp)-fluxup(pverp)) sfltot = sfltot + solflx fswup(0) = fswup(0) + solflx*fluxup(0) fswdn(0) = fswdn(0) + solflx*fluxdn(0)! ! Down spectral fluxes need to be in mks; thus the .001 conversion factors! if (wavmid(ns) < 0.7_r8) then sols(i) = sols(i) + wexptdn*solflx*0.001_r8 solsd(i) = solsd(i)+(fluxdn(pverp)-wexptdn)*solflx*0.001_r8 else soll(i) = soll(i) + wexptdn*solflx*0.001_r8 solld(i) = solld(i)+(fluxdn(pverp)-wexptdn)*solflx*0.001_r8 fsnrtoaq(i) = fsnrtoaq(i) + solflx*(fluxdn(0) - fluxup(0)) end if fsnirtoa(i) = fsnirtoa(i) + wgtint*solflx*(fluxdn(0) - fluxup(0)) do k=0,pver! ! Compute flux divergence in each layer using the interface up and down! fluxes:! kp1 = k+1 flxdiv = (fluxdn(k ) - fluxdn(kp1)) + (fluxup(kp1) - fluxup(k )) totfld(k) = totfld(k) + solflx*flxdiv fswdn(kp1) = fswdn(kp1) + solflx*fluxdn(kp1) fswup(kp1) = fswup(kp1) + solflx*fluxup(kp1) end do! ! Perform clear-sky calculation! exptdnc(0) = 1.0_r8 rdndifc(0) = 0.0_r8 tdntotc(0) = 1.0_r8 rupdirc(pverp) = albdir(i,ns) rupdifc(pverp) = albdif(i,ns) do k = 1, pverp km1 = k - 1 xexpt = exptdnc(km1) xrdnd = rdndifc(km1) yrdnd = rdifc(ns,i,km1) ytdnd = tdifc(ns,i,km1) exptdnc(k) = xexpt*explayc(ns,i,km1) rdenom = 1._r8/(1._r8 - yrdnd*xrdnd) rdirexp = rdirc(ns,i,km1)*xexpt tdnmexp = tdntotc(km1) - xexpt tdntotc(k) = xexpt*tdirc(ns,i,km1) + ytdnd*(tdnmexp + xrdnd*rdirexp)* & rdenom rdndifc(k) = yrdnd + xrdnd*(ytdnd**2)*rdenom end do do k=pver,0,-1 xrupd = rupdifc(k+1) yexpt = explayc(ns,i,k) yrupd = rdifc(ns,i,k) ytupd = tdifc(ns,i,k) rdenom = 1._r8/( 1._r8 - yrupd*xrupd) rupdirc(k) = rdirc(ns,i,k) + ytupd*(rupdirc(k+1)*yexpt + & xrupd*(tdirc(ns,i,k)-yexpt))*rdenom rupdifc(k) = yrupd + xrupd*ytupd**2*rdenom end do do k=0,1 rdenom = 1._r8/(1._r8 - rdndifc(k)*rupdifc(k)) fluxup(k) = (exptdnc(k)*rupdirc(k) + (tdntotc(k)-exptdnc(k))*rupdifc(k))* & rdenom fluxdn(k) = exptdnc(k) + & (tdntotc(k) - exptdnc(k) + exptdnc(k)*rupdirc(k)*rdndifc(k))* & rdenom end do k = pverp rdenom = 1._r8/(1._r8 - rdndifc(k)*rupdifc(k)) fluxup(k) = (exptdnc(k)*rupdirc(k) + (tdntotc(k)-exptdnc(k))*rupdifc(k))* & rdenom fluxdn(k) = exptdnc(k) + (tdntotc(k) - exptdnc(k) + & exptdnc(k)*rupdirc(k)*rdndifc(k))*rdenom fsntc(i) = fsntc(i)+solflx*(fluxdn(1)-fluxup(1)) fsntoac(i) = fsntoac(i)+solflx*(fluxdn(0)-fluxup(0)) fsnsc(i) = fsnsc(i)+solflx*(fluxdn(pverp)-fluxup(pverp)) fsdsc(i) = fsdsc(i)+solflx*(fluxdn(pverp)) fsnrtoac(i) = fsnrtoac(i)+wgtint*solflx*(fluxdn(0)-fluxup(0))! ! End of clear sky calculation! ! ! End of spectral interval loop! end do! ! Compute solar heating rate (J/kg/s)! do k=1,pver qrs(i,k) = -1.E-4*gravit*totfld(k)/(pint(i,k) - pint(i,k+1)) end do! ! Set the downwelling flux at the surface ! fsds(i) = fswdn(pverp)! ! End do n=1,ndayc! end do returnend subroutine radcswmx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -