270 use mersenne_twister
, only : random_setseed, random_number, &
280 character(40),
parameter :: &
281 & VTAGSW=
'NCEP SW v5.1 Nov 2012 -RRTMG-SW v3.8 ' 292 real (kind=kind_phys),
parameter ::
eps = 1.0e-6
294 real (kind=kind_phys),
parameter ::
bpade = 1.0/0.278
295 real (kind=kind_phys),
parameter ::
stpfac = 296.0/1013.0
296 real (kind=kind_phys),
parameter ::
ftiny = 1.0e-12
297 real (kind=kind_phys),
parameter ::
s0 = 1368.22
299 real (kind=kind_phys),
parameter ::
f_zero = 0.0
300 real (kind=kind_phys),
parameter ::
f_one = 1.0
309 data nspa(:) / 9, 9, 9, 9, 1, 9, 9, 1, 9, 1, 0, 1, 9, 1 /
310 data nspb(:) / 1, 5, 1, 1, 1, 5, 1, 0, 1, 0, 0, 1, 5, 1 /
313 data idxsfc(:) / 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 2, 1 /
314 data idxebc(:) / 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 1, 5 /
329 integer,
parameter ::
nuvb = 27
442 & ( plyr,plvl,tlyr,tlvl,qlyr,olyr,gasvmr, &
443 & clouds,icseed,aerosols,sfcalb, &
444 & cosz,solcon,nday,idxday, &
445 & npts, nlay, nlp1, lprnt, &
447 & hswc,topflx,sfcflx &
449 &, hsw0,hswb,flxprf,fdncmp &
628 integer,
intent(in) :: npts, nlay, nlp1, NDAY
630 integer,
dimension(:),
intent(in) :: idxday, icseed
632 logical,
intent(in) :: lprnt
634 real (kind=kind_phys),
dimension(npts,nlp1),
intent(in) :: &
636 real (kind=kind_phys),
dimension(npts,nlay),
intent(in) :: &
637 & plyr, tlyr, qlyr, olyr
638 real (kind=kind_phys),
dimension(npts,4),
intent(in) :: sfcalb
640 real (kind=kind_phys),
dimension(npts,nlay,9),
intent(in):: gasvmr
641 real (kind=kind_phys),
dimension(npts,nlay,9),
intent(in):: clouds
642 real (kind=kind_phys),
dimension(npts,nlay,nbdsw,3),
intent(in):: &
645 real (kind=kind_phys),
intent(in) :: cosz(npts), solcon
648 real (kind=kind_phys),
dimension(npts,nlay),
intent(out) :: hswc
650 type(
topfsw_type),
dimension(npts),
intent(out) :: topflx
651 type(
sfcfsw_type),
dimension(npts),
intent(out) :: sfcflx
654 real (kind=kind_phys),
dimension(npts,nlay,nbdsw),
optional, &
655 & intent(out) :: hswb
657 real (kind=kind_phys),
dimension(npts,nlay),
optional, &
658 & intent(out) :: hsw0
659 type (
profsw_type),
dimension(npts,nlp1),
optional, &
660 & intent(out) :: flxprf
662 & intent(out) :: fdncmp
665 real (kind=kind_phys),
dimension(nlay,ngptsw) :: cldfmc, &
667 real (kind=kind_phys),
dimension(nlp1,nbdsw):: fxupc, fxdnc, &
670 real (kind=kind_phys),
dimension(nlay,nbdsw) :: &
671 & tauae, ssaae, asyae, taucw, ssacw, asycw
673 real (kind=kind_phys),
dimension(ngptsw) :: sfluxzen
675 real (kind=kind_phys),
dimension(nlay) :: cldfrc, delp, &
676 & pavel, tavel, coldry, colmol, h2ovmr, o3vmr, temcol, &
677 & cliqp, reliq, cicep, reice, cdat1, cdat2, cdat3, cdat4, &
678 & cfrac, fac00, fac01, fac10, fac11, forfac, forfrac, &
679 & selffac, selffrac, rfdelp
681 real (kind=kind_phys),
dimension(nlp1) :: fnet, flxdc, flxuc, &
684 real (kind=kind_phys),
dimension(2) :: albbm, albdf, sfbmc, &
685 & sfbm0, sfdfc, sfdf0
687 real (kind=kind_phys) :: cosz1, sntz1, tem0, tem1, tem2, s0fac, &
688 & ssolar, zcf0, zcf1, ftoau0, ftoauc, ftoadc, &
689 & fsfcu0, fsfcuc, fsfcd0, fsfcdc, suvbfc, suvbf0
693 real (kind=kind_phys) :: colamt(nlay,
maxgas)
695 integer,
dimension(npts) :: ipseed
696 integer,
dimension(nlay) :: indfor, indself, jp, jt, jt1
698 integer :: i, ib, ipt, j1, k, kk, laytrop, mb
703 lhswb =
present ( hswb )
704 lhsw0 =
present ( hsw0 )
751 ipseed(i) = icseed(i)
756 write(0,*)
' In radsw, isubcsw, ipsdsw0,ipseed =', &
762 lab_do_ipt :
do ipt = 1, nday
767 sntz1 =
f_one / cosz(j1)
768 ssolar = s0fac * cosz(j1)
772 albbm(1) = sfcalb(j1,1)
773 albdf(1) = sfcalb(j1,2)
774 albbm(2) = sfcalb(j1,3)
775 albdf(2) = sfcalb(j1,4)
794 pavel(k) = plyr(j1,kk)
795 tavel(k) = tlyr(j1,kk)
796 delp(k) = plvl(j1,kk+1) - plvl(j1,kk)
808 coldry(k) = tem2 * delp(k) / (tem1*tem0*(
f_one + h2ovmr(k)))
809 temcol(k) = 1.0e-12 * coldry(k)
811 colamt(k,1) = max(
f_zero, coldry(k)*h2ovmr(k))
812 colamt(k,2) = max(temcol(k), coldry(k)*gasvmr(j1,kk,1))
813 colamt(k,3) = max(
f_zero, coldry(k)*o3vmr(k))
814 colmol(k) = coldry(k) + colamt(k,1)
823 colamt(k,4) = max(temcol(k), coldry(k)*gasvmr(j1,kk,2))
824 colamt(k,5) = max(temcol(k), coldry(k)*gasvmr(j1,kk,3))
825 colamt(k,6) = max(temcol(k), coldry(k)*gasvmr(j1,kk,4))
830 colamt(k,4) = temcol(k)
831 colamt(k,5) = temcol(k)
832 colamt(k,6) = temcol(k)
843 tauae(k,ib) = aerosols(j1,kk,ib,1)
844 ssaae(k,ib) = aerosols(j1,kk,ib,2)
845 asyae(k,ib) = aerosols(j1,kk,ib,3)
853 cfrac(k) = clouds(j1,kk,1)
854 cliqp(k) = clouds(j1,kk,2)
855 reliq(k) = clouds(j1,kk,3)
856 cicep(k) = clouds(j1,kk,4)
857 reice(k) = clouds(j1,kk,5)
858 cdat1(k) = clouds(j1,kk,6)
859 cdat2(k) = clouds(j1,kk,7)
860 cdat3(k) = clouds(j1,kk,8)
861 cdat4(k) = clouds(j1,kk,9)
866 cfrac(k) = clouds(j1,kk,1)
867 cdat1(k) = clouds(j1,kk,2)
868 cdat2(k) = clouds(j1,kk,3)
869 cdat3(k) = clouds(j1,kk,4)
879 pavel(k) = plyr(j1,k)
880 tavel(k) = tlyr(j1,k)
881 delp(k) = plvl(j1,k) - plvl(j1,k+1)
893 coldry(k) = tem2 * delp(k) / (tem1*tem0*(
f_one + h2ovmr(k)))
894 temcol(k) = 1.0e-12 * coldry(k)
896 colamt(k,1) = max(
f_zero, coldry(k)*h2ovmr(k))
897 colamt(k,2) = max(temcol(k), coldry(k)*gasvmr(j1,k,1))
898 colamt(k,3) = max(
f_zero, coldry(k)*o3vmr(k))
899 colmol(k) = coldry(k) + colamt(k,1)
905 write(0,*)
' pavel=',pavel
906 write(0,*)
' tavel=',tavel
907 write(0,*)
' delp=',delp
908 write(0,*)
' h2ovmr=',h2ovmr*1000
909 write(0,*)
' o3vmr=',o3vmr*1000000
918 colamt(k,4) = max(temcol(k), coldry(k)*gasvmr(j1,k,2))
919 colamt(k,5) = max(temcol(k), coldry(k)*gasvmr(j1,k,3))
920 colamt(k,6) = max(temcol(k), coldry(k)*gasvmr(j1,k,4))
925 colamt(k,4) = temcol(k)
926 colamt(k,5) = temcol(k)
927 colamt(k,6) = temcol(k)
936 tauae(k,ib) = aerosols(j1,k,ib,1)
937 ssaae(k,ib) = aerosols(j1,k,ib,2)
938 asyae(k,ib) = aerosols(j1,k,ib,3)
944 cfrac(k) = clouds(j1,k,1)
945 cliqp(k) = clouds(j1,k,2)
946 reliq(k) = clouds(j1,k,3)
947 cicep(k) = clouds(j1,k,4)
948 reice(k) = clouds(j1,k,5)
949 cdat1(k) = clouds(j1,k,6)
950 cdat2(k) = clouds(j1,k,7)
951 cdat3(k) = clouds(j1,k,8)
952 cdat4(k) = clouds(j1,k,9)
956 cfrac(k) = clouds(j1,k,1)
957 cdat1(k) = clouds(j1,k,2)
958 cdat2(k) = clouds(j1,k,3)
959 cdat3(k) = clouds(j1,k,4)
975 zcf0 = zcf0 * (
f_one - cfrac(k))
977 else if (
iovrsw == 1)
then 979 if (cfrac(k) >
ftiny)
then 980 zcf1 = min( zcf1,
f_one-cfrac(k) )
981 elseif (zcf1 <
f_one)
then 987 else if (
iovrsw == 2)
then 989 zcf0 = min( zcf0,
f_one-cfrac(k) )
1005 & ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4, &
1006 & zcf1, nlay, ipseed(j1), &
1008 & taucw, ssacw, asycw, cldfrc, cldfmc &
1026 & ( pavel,tavel,h2ovmr, nlay,nlp1, &
1028 & laytrop,jp,jt,jt1,fac00,fac01,fac10,fac11, &
1029 & selffac,selffrac,indself,forfac,forfrac,indfor &
1041 & ( colamt,colmol,fac00,fac01,fac10,fac11,jp,jt,jt1,laytrop, &
1042 & forfac,forfrac,indfor,selffac,selffrac,indself, nlay, &
1044 & sfluxzen, taug, taur &
1056 & ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfrc, &
1057 & zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
1060 & fxupc,fxdnc,fxup0,fxdn0, &
1061 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
1062 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
1069 & ( ssolar,cosz1,sntz1,albbm,albdf,sfluxzen,cldfmc, &
1070 & zcf1,zcf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
1073 & fxupc,fxdnc,fxup0,fxdn0, &
1074 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
1075 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
1087 flxuc(k) = flxuc(k) + fxupc(k,ib)
1088 flxdc(k) = flxdc(k) + fxdnc(k,ib)
1100 flxu0(k) = flxu0(k) + fxup0(k,ib)
1101 flxd0(k) = flxd0(k) + fxdn0(k,ib)
1114 fdncmp(j1)%uvbf0 = suvbf0
1115 fdncmp(j1)%uvbfc = suvbfc
1118 fdncmp(j1)%nirbm = sfbmc(1)
1119 fdncmp(j1)%nirdf = sfdfc(1)
1120 fdncmp(j1)%visbm = sfbmc(2)
1121 fdncmp(j1)%visdf = sfdfc(2)
1126 topflx(j1)%upfxc = ftoauc
1127 topflx(j1)%dnfxc = ftoadc
1128 topflx(j1)%upfx0 = ftoau0
1130 sfcflx(j1)%upfxc = fsfcuc
1131 sfcflx(j1)%dnfxc = fsfcdc
1132 sfcflx(j1)%upfx0 = fsfcu0
1133 sfcflx(j1)%dnfx0 = fsfcd0
1139 fnet(1) = flxdc(1) - flxuc(1)
1143 fnet(k) = flxdc(k) - flxuc(k)
1144 hswc(j1,kk) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1152 flxprf(j1,kk)%upfxc = flxuc(k)
1153 flxprf(j1,kk)%dnfxc = flxdc(k)
1154 flxprf(j1,kk)%upfx0 = flxu0(k)
1155 flxprf(j1,kk)%dnfx0 = flxd0(k)
1162 fnet(1) = flxd0(1) - flxu0(1)
1166 fnet(k) = flxd0(k) - flxu0(k)
1167 hsw0(j1,kk) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1175 fnet(1) = fxdnc(1,mb) - fxupc(1,mb)
1179 fnet(k) = fxdnc(k,mb) - fxupc(k,mb)
1180 hswb(j1,kk,mb) = (fnet(k) - fnet(k-1)) * rfdelp(k-1)
1189 fnet(1) = flxdc(1) - flxuc(1)
1192 fnet(k) = flxdc(k) - flxuc(k)
1193 hswc(j1,k-1) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1200 flxprf(j1,k)%upfxc = flxuc(k)
1201 flxprf(j1,k)%dnfxc = flxdc(k)
1202 flxprf(j1,k)%upfx0 = flxu0(k)
1203 flxprf(j1,k)%dnfx0 = flxd0(k)
1210 fnet(1) = flxd0(1) - flxu0(1)
1213 fnet(k) = flxd0(k) - flxu0(k)
1214 hsw0(j1,k-1) = (fnet(k)-fnet(k-1)) * rfdelp(k-1)
1222 fnet(1) = fxdnc(1,mb) - fxupc(1,mb)
1225 fnet(k+1) = fxdnc(k+1,mb) - fxupc(k+1,mb)
1226 hswb(j1,k,mb) = (fnet(k+1) - fnet(k)) * rfdelp(k)
1237 end subroutine swrad 1329 integer,
intent(in) :: me
1334 real (kind=kind_phys),
parameter :: expeps = 1.e-20
1338 real (kind=kind_phys) :: tfn, tau
1344 print *,
' *** Error in specification of cloud overlap flag', &
1345 &
' IOVRSW=',
iovrsw,
' in RSWINIT !!' 1350 print *,
' - Using AER Shortwave Radiation, Version: ',
vtagsw 1353 print *,
' --- Delta-eddington 2-stream transfer scheme' 1355 print *,
' --- PIFM 2-stream transfer scheme' 1357 print *,
' --- Discrete ordinates 2-stream transfer scheme' 1361 print *,
' --- Rare gases absorption is NOT included in SW' 1363 print *,
' --- Include rare gases N2O, CH4, O2, absorptions',&
1368 print *,
' --- Using standard grid average clouds, no ', &
1369 &
'sub-column clouds approximation applied' 1371 print *,
' --- Using MCICA sub-colum clouds approximation ', &
1372 &
'with a prescribed sequence of permutation seeds' 1374 print *,
' --- Using MCICA sub-colum clouds approximation ', &
1375 &
'with provided input array of permutation seeds' 1377 print *,
' *** Error in specification of sub-column cloud ', &
1378 &
' control flag isubcsw =',
isubcsw,
' !!' 1387 print *,
' *** Model cloud scheme inconsistent with SW', &
1388 &
' radiation cloud radiative property setup !!' 1414 tfn = float(i) / float(
ntbmx-i)
1430 & ( cfrac,cliqp,reliq,cicep,reice,cdat1,cdat2,cdat3,cdat4, &
1431 & cf1, nlay, ipseed, &
1433 & taucw, ssacw, asycw, cldfrc, cldfmc &
1514 integer,
intent(in) :: nlay, ipseed
1515 real (kind=kind_phys),
intent(in) :: cf1
1517 real (kind=kind_phys),
dimension(nlay),
intent(in) :: cliqp, &
1518 & reliq, cicep, reice, cdat1, cdat2, cdat3, cdat4, cfrac
1521 real (kind=kind_phys),
dimension(nlay,ngptsw),
intent(out) :: &
1523 real (kind=kind_phys),
dimension(nlay,nbdsw),
intent(out) :: &
1524 & taucw, ssacw, asycw
1525 real (kind=kind_phys),
dimension(nlay),
intent(out) :: cldfrc
1528 real (kind=kind_phys),
dimension(nblow:nbhgh) :: tauliq, tauice, &
1529 & ssaliq, ssaice, ssaran, ssasnw, asyliq, asyice, &
1531 real (kind=kind_phys),
dimension(nlay) :: cldf
1533 real (kind=kind_phys) :: dgeice, factor, fint, tauran, tausnw, &
1534 & cldliq, refliq, cldice, refice, cldran, cldsnw, refsnw, &
1535 & extcoliq, ssacoliq, asycoliq, extcoice, ssacoice, asycoice,&
1538 logical :: lcloudy(nlay,
ngptsw)
1539 integer :: ia, ib, ig, jb, k, index
1554 lab_if_iswcliq :
if (
iswcliq > 0)
then 1556 lab_do_k :
do k = 1, nlay
1557 lab_if_cld :
if (cfrac(k) >
ftiny)
then 1564 dgesnw = 1.0315 * refsnw
1566 tauran = cldran *
a0r 1575 if (cldsnw>
f_zero .and. refsnw>10.0_kind_phys)
then 1577 tausnw = cldsnw*1.09087*(
a0s +
a1s/dgesnw)
1583 ssaran(ib) = tauran * (
f_one -
b0r(ib))
1584 ssasnw(ib) = tausnw * (
f_one - (
b0s(ib)+
b1s(ib)*dgesnw))
1585 asyran(ib) = ssaran(ib) *
c0r(ib)
1586 asysnw(ib) = ssasnw(ib) *
c0s(ib)
1596 if ( cldliq <=
f_zero )
then 1604 factor = refliq - 1.5
1605 index = max( 1, min( 57, int( factor ) ))
1606 fint = factor - float(index)
1618 tauliq(ib) = cldliq * extcoliq
1619 ssaliq(ib) = tauliq(ib) * ssacoliq
1620 asyliq(ib) = ssaliq(ib) * asycoliq
1627 if ( cldice <=
f_zero )
then 1639 refice = min(130.0_kind_phys,max(13.0_kind_phys,refice))
1651 tauice(ib) = cldice * extcoice
1652 ssaice(ib) = tauice(ib) * ssacoice
1653 asyice(ib) = ssaice(ib) * asycoice
1659 refice = min(131.0_kind_phys,max(5.0_kind_phys,refice))
1661 factor = (refice - 2.0) / 3.0
1662 index = max( 1, min( 42, int( factor ) ))
1663 fint = factor - float(index)
1674 tauice(ib) = cldice * extcoice
1675 ssaice(ib) = tauice(ib) * ssacoice
1676 asyice(ib) = ssaice(ib) * asycoice
1683 dgeice = max( 5.0, min( 140.0, 1.0315*refice ))
1685 factor = (dgeice - 2.0) / 3.0
1686 index = max( 1, min( 45, int( factor ) ))
1687 fint = factor - float(index)
1700 tauice(ib) = cldice * extcoice
1701 ssaice(ib) = tauice(ib) * ssacoice
1702 asyice(ib) = ssaice(ib) * asycoice
1710 taucw(k,ib) = tauliq(jb)+tauice(jb)+tauran+tausnw
1711 ssacw(k,ib) = ssaliq(jb)+ssaice(jb)+ssaran(jb)+ssasnw(jb)
1712 asycw(k,ib) = asyliq(jb)+asyice(jb)+asyran(jb)+asysnw(jb)
1721 if (cfrac(k) >
ftiny)
then 1723 taucw(k,ib) = cdat1(k)
1724 ssacw(k,ib) = cdat1(k) * cdat2(k)
1725 asycw(k,ib) = ssacw(k,ib) * cdat3(k)
1730 endif lab_if_iswcliq
1737 where (cldf(:) <
ftiny)
1745 & ( cldf, nlay, ipseed, &
1752 if ( lcloudy(k,ig) )
then 1753 cldfmc(k,ig) =
f_one 1763 cldfrc(k) = cfrac(k) / cf1
1784 & ( cldf, nlay, ipseed, &
1812 integer,
intent(in) :: nlay, ipseed
1814 real (kind=kind_phys),
dimension(nlay),
intent(in) :: cldf
1817 logical,
dimension(nlay,ngptsw),
intent(out):: lcloudy
1820 real (kind=kind_phys) :: cdfunc(nlay,
ngptsw), tem1, &
1821 & rand2d(nlay*ngptsw), rand1d(ngptsw)
1823 type(random_stat) :: stat
1831 call random_setseed &
1844 call random_number &
1853 cdfunc(k,n) = rand2d(k1)
1859 call random_number &
1868 cdfunc(k,n) = rand2d(k1)
1880 tem1 =
f_one - cldf(k1)
1883 if ( cdfunc(k1,n) > tem1 )
then 1884 cdfunc(k,n) = cdfunc(k1,n)
1886 cdfunc(k,n) = cdfunc(k,n) * tem1
1911 call random_number &
1929 tem1 =
f_one - cldf(k)
1932 lcloudy(k,n) = cdfunc(k,n) >= tem1
1946 & ( pavel,tavel,h2ovmr, nlay,nlp1, &
1948 & laytrop,jp,jt,jt1,fac00,fac01,fac10,fac11, &
1949 & selffac,selffrac,indself,forfac,forfrac,indfor &
1989 integer,
intent(in) :: nlay, nlp1
1991 real (kind=kind_phys),
dimension(:),
intent(in) :: pavel, tavel, &
1995 integer,
dimension(nlay),
intent(out) :: indself, indfor, &
1997 integer,
intent(out) :: laytrop
1999 real (kind=kind_phys),
dimension(nlay),
intent(out) :: fac00, &
2000 & fac01, fac10, fac11, selffac, selffrac, forfac, forfrac
2003 real (kind=kind_phys) :: plog, fp, fp1, ft, ft1, tem1, tem2
2005 integer :: i, k, jp1
2013 forfac(k) = pavel(k)*
stpfac / (tavel(k)*(
f_one + h2ovmr(k)))
2020 plog = log(pavel(k))
2021 jp(k) = max(1, min(58, int(36.0 - 5.0*(plog+0.04)) ))
2023 fp = 5.0 * (
preflog(jp(k)) - plog)
2032 tem1 = (tavel(k) -
tref(jp(k))) / 15.0
2033 tem2 = (tavel(k) -
tref(jp1 )) / 15.0
2034 jt(k) = max(1, min(4, int(3.0 + tem1) ))
2035 jt1(k) = max(1, min(4, int(3.0 + tem2) ))
2036 ft = tem1 - float(jt(k) - 3)
2037 ft1 = tem2 - float(jt1(k) - 3)
2048 fac00(k) = fp1 * (
f_one - ft)
2050 fac01(k) = fp * (
f_one - ft1)
2055 if ( plog > 4.56 )
then 2062 tem1 = (332.0 - tavel(k)) / 36.0
2063 indfor(k) = min(2, max(1, int(tem1)))
2064 forfrac(k) = tem1 - float(indfor(k))
2069 tem2 = (tavel(k) - 188.0) / 7.2
2070 indself(k) = min(9, max(1, int(tem2)-7))
2071 selffrac(k) = tem2 - float(indself(k) + 7)
2072 selffac(k) = h2ovmr(k) * forfac(k)
2079 tem1 = (tavel(k) - 188.0) / 36.0
2081 forfrac(k) = tem1 -
f_one 2101 & ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfrc, &
2102 & cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
2105 & fxupc,fxdnc,fxup0,fxdn0, &
2106 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
2107 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
2201 real (kind=kind_phys),
parameter :: zcrit = 0.9999995
2202 real (kind=kind_phys),
parameter :: zsr3 = sqrt(3.0)
2203 real (kind=kind_phys),
parameter :: od_lo = 0.06
2204 real (kind=kind_phys),
parameter :: eps1 = 1.0e-8
2207 integer,
intent(in) :: nlay, nlp1
2209 real (kind=kind_phys),
dimension(nlay,ngptsw),
intent(in) :: &
2211 real (kind=kind_phys),
dimension(nlay,nbdsw),
intent(in) :: &
2212 & taucw, ssacw, asycw, tauae, ssaae, asyae
2214 real (kind=kind_phys),
dimension(ngptsw),
intent(in) :: sfluxzen
2215 real (kind=kind_phys),
dimension(nlay),
intent(in) :: cldfrc
2217 real (kind=kind_phys),
dimension(2),
intent(in) :: albbm, albdf
2219 real (kind=kind_phys),
intent(in) :: cosz, sntz, cf1, cf0, ssolar
2222 real (kind=kind_phys),
dimension(nlp1,nbdsw),
intent(out) :: &
2223 & fxupc, fxdnc, fxup0, fxdn0
2225 real (kind=kind_phys),
dimension(2),
intent(out) :: sfbmc, sfdfc, &
2228 real (kind=kind_phys),
intent(out) :: suvbfc, suvbf0, ftoadc, &
2229 & ftoauc, ftoau0, fsfcuc, fsfcu0, fsfcdc, fsfcd0
2232 real (kind=kind_phys),
dimension(nlay) :: ztaus, zssas, zasys, &
2235 real (kind=kind_phys),
dimension(nlp1) :: zrefb, zrefd, ztrab, &
2236 & ztrad, ztdbt, zldbt, zfu, zfd
2238 real (kind=kind_phys) :: ztau1, zssa1, zasy1, ztau0, zssa0, &
2239 & zasy0, zasy3, zssaw, zasyw, zgam1, zgam2, zgam3, zgam4, &
2240 & zc0, zc1, za1, za2, zb1, zb2, zrk, zrk2, zrp, zrp1, zrm1, &
2241 & zrpp, zrkg1, zrkg3, zrkg4, zexp1, zexm1, zexp2, zexm2, &
2242 & zexp3, zexp4, zden1, ze1r45, ftind, zsolar, zrefb1, &
2243 & zrefd1, ztrab1, ztrad1, ztdbt0, zr1, zr2, zr3, zr4, zr5, &
2244 & zt1, zt2, zt3, zf1, zf2
2246 integer :: ib, ibd, jb, jg, k, kp, itind
2285 lab_do_jg :
do jg = 1,
ngptsw 2291 zsolar = ssolar * sfluxzen(jg)
2300 zrefb(1) = albbm(ibd)
2301 zrefd(1) = albdf(ibd)
2303 zrefb(1) = 0.5 * (albbm(1) + albbm(2))
2304 zrefd(1) = 0.5 * (albdf(1) + albdf(2))
2314 ztau0 = max(
ftiny, taur(k,jg)+taug(k,jg)+tauae(k,ib) )
2315 zssa0 = taur(k,jg) + tauae(k,ib)*ssaae(k,ib)
2316 zasy0 = asyae(k,ib)*ssaae(k,ib)*tauae(k,ib)
2317 zssaw = min(
oneminus, zssa0 / ztau0 )
2318 zasyw = zasy0 / max(
ftiny, zssa0 )
2329 ztau1 = (
f_one - za2) * ztau0
2330 zssa1 = (zssaw - za2) / (
f_one - za2)
2332 zasy1 = zasyw / (
f_one + zasyw)
2333 zasy3 = 0.75 * zasy1
2337 zgam1 = 1.75 - zssa1 * (
f_one + zasy3)
2338 zgam2 =-0.25 - zssa1 * (
f_one - zasy3)
2339 zgam3 = 0.5 - zasy3 * cosz
2341 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
2342 zgam2 = 0.75* zssa1 * (
f_one- zasy1)
2343 zgam3 = 0.5 - zasy3 * cosz
2345 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
2346 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
2347 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
2349 zgam4 =
f_one - zgam3
2353 if ( zssaw >= zcrit )
then 2354 za1 = zgam1 * cosz - zgam3
2360 zb1 = min( ztau1*sntz , 500.0 )
2361 if ( zb1 <= od_lo )
then 2362 zb2 =
f_one - zb1 + 0.5*zb1*zb1
2364 ftind = zb1 / (
bpade + zb1)
2365 itind = ftind*
ntbmx + 0.5
2379 za1 = zgam1*zgam4 + zgam2*zgam3
2380 za2 = zgam1*zgam3 + zgam2*zgam4
2381 zrk = sqrt( (zgam1 - zgam2) * (zgam1 + zgam2) )
2387 zrpp =
f_one - zrp*zrp
2392 zr1 = zrm1 * (za2 + zrkg3)
2393 zr2 = zrp1 * (za2 - zrkg3)
2394 zr3 = zrk2 * (zgam3 - za2*cosz)
2396 zr5 = zrpp * (zrk - zgam1)
2398 zt1 = zrp1 * (za1 + zrkg4)
2399 zt2 = zrm1 * (za1 - zrkg4)
2400 zt3 = zrk2 * (zgam4 + za1*cosz)
2405 zb1 = min( zrk*ztau1, 500.0 )
2406 if ( zb1 <= od_lo )
then 2407 zexm1 =
f_one - zb1 + 0.5*zb1*zb1
2409 ftind = zb1 / (
bpade + zb1)
2410 itind = ftind*
ntbmx + 0.5
2413 zexp1 =
f_one / zexm1
2415 zb2 = min( sntz*ztau1, 500.0 )
2416 if ( zb2 <= od_lo )
then 2417 zexm2 =
f_one - zb2 + 0.5*zb2*zb2
2419 ftind = zb2 / (
bpade + zb2)
2420 itind = ftind*
ntbmx + 0.5
2423 zexp2 =
f_one / zexm2
2424 ze1r45 = zr4*zexp1 + zr5*zexm1
2427 if (ze1r45>=-eps1 .and. ze1r45<=eps1)
then 2431 zden1 = zssa1 / ze1r45
2433 & (zr1*zexp1 - zr2*zexm1 - zr3*zexm2)*zden1 ))
2435 & - (zt1*zexp1 - zt2*zexm1 - zt3*zexp2)*zden1) ))
2439 zden1 = zr4 / (ze1r45 * zrkg1)
2441 & zgam2*(zexp1 - zexm1)*zden1 ))
2450 if ( zr1 <= od_lo )
then 2451 zexp3 =
f_one - zr1 + 0.5*zr1*zr1
2453 ftind = zr1 / (
bpade + zr1)
2454 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
2458 ztdbt(k) = zexp3 * ztdbt(kp)
2465 if ( zr1 <= od_lo )
then 2466 zexp4 =
f_one - zr1 + 0.5*zr1*zr1
2468 ftind = zr1 / (
bpade + zr1)
2469 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
2474 ztdbt0 = zexp4 * ztdbt0
2479 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
2487 fxup0(k,ib) = fxup0(k,ib) + zsolar*zfu(k)
2488 fxdn0(k,ib) = fxdn0(k,ib) + zsolar*zfd(k)
2493 zb2 = zsolar*(zfd(1) - ztdbt0)
2496 sfbm0(ibd) = sfbm0(ibd) + zb1
2497 sfdf0(ibd) = sfdf0(ibd) + zb2
2501 sfbm0(1) = sfbm0(1) + zf1
2502 sfdf0(1) = sfdf0(1) + zf2
2503 sfbm0(2) = sfbm0(2) + zf1
2504 sfdf0(2) = sfdf0(2) + zf2
2511 if ( cf1 >
eps )
then 2519 zc0 =
f_one - cldfrc(k)
2521 if ( zc1 >
ftiny )
then 2523 ztau0 = ztaus(k) + taucw(k,ib)
2524 zssa0 = zssas(k) + ssacw(k,ib)
2525 zasy0 = zasys(k) + asycw(k,ib)
2526 zssaw = min(
oneminus, zssa0 / ztau0)
2527 zasyw = zasy0 / max(
ftiny, zssa0)
2533 ztau1 = (
f_one - za2) * ztau0
2534 zssa1 = (zssaw - za2) / (
f_one - za2)
2536 zasy1 = zasyw / (
f_one + zasyw)
2537 zasy3 = 0.75 * zasy1
2541 zgam1 = 1.75 - zssa1 * (
f_one + zasy3)
2542 zgam2 =-0.25 - zssa1 * (
f_one - zasy3)
2543 zgam3 = 0.5 - zasy3 * cosz
2545 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
2546 zgam2 = 0.75* zssa1 * (
f_one- zasy1)
2547 zgam3 = 0.5 - zasy3 * cosz
2549 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
2550 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
2551 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
2553 zgam4 =
f_one - zgam3
2562 if ( zssaw >= zcrit )
then 2563 za1 = zgam1 * cosz - zgam3
2569 zb1 = min( ztau1*sntz , 500.0 )
2570 if ( zb1 <= od_lo )
then 2571 zb2 =
f_one - zb1 + 0.5*zb1*zb1
2573 ftind = zb1 / (
bpade + zb1)
2574 itind = ftind*
ntbmx + 0.5
2588 za1 = zgam1*zgam4 + zgam2*zgam3
2589 za2 = zgam1*zgam3 + zgam2*zgam4
2590 zrk = sqrt( (zgam1 - zgam2) * (zgam1 + zgam2) )
2596 zrpp =
f_one - zrp*zrp
2601 zr1 = zrm1 * (za2 + zrkg3)
2602 zr2 = zrp1 * (za2 - zrkg3)
2603 zr3 = zrk2 * (zgam3 - za2*cosz)
2605 zr5 = zrpp * (zrk - zgam1)
2607 zt1 = zrp1 * (za1 + zrkg4)
2608 zt2 = zrm1 * (za1 - zrkg4)
2609 zt3 = zrk2 * (zgam4 + za1*cosz)
2614 zb1 = min( zrk*ztau1, 500.0 )
2615 if ( zb1 <= od_lo )
then 2616 zexm1 =
f_one - zb1 + 0.5*zb1*zb1
2618 ftind = zb1 / (
bpade + zb1)
2619 itind = ftind*
ntbmx + 0.5
2622 zexp1 =
f_one / zexm1
2624 zb2 = min( ztau1*sntz, 500.0 )
2625 if ( zb2 <= od_lo )
then 2626 zexm2 =
f_one - zb2 + 0.5*zb2*zb2
2628 ftind = zb2 / (
bpade + zb2)
2629 itind = ftind*
ntbmx + 0.5
2632 zexp2 =
f_one / zexm2
2633 ze1r45 = zr4*zexp1 + zr5*zexm1
2636 if ( ze1r45>=-eps1 .and. ze1r45<=eps1 )
then 2640 zden1 = zssa1 / ze1r45
2642 & (zr1*zexp1-zr2*zexm1-zr3*zexm2)*zden1 ))
2644 & (zt1*zexp1-zt2*zexm1-zt3*zexp2)*zden1) ))
2648 zden1 = zr4 / (ze1r45 * zrkg1)
2650 & zgam2*(zexp1 - zexm1)*zden1 ))
2657 zrefb(kp) = zc0*zrefb1 + zc1*zrefb(kp)
2658 zrefd(kp) = zc0*zrefd1 + zc1*zrefd(kp)
2659 ztrab(kp) = zc0*ztrab1 + zc1*ztrab(kp)
2660 ztrad(kp) = zc0*ztrad1 + zc1*ztrad(kp)
2667 if ( zr1 <= od_lo )
then 2668 zexp3 =
f_one - zr1 + 0.5*zr1*zr1
2670 ftind = zr1 / (
bpade + zr1)
2671 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
2675 zldbt(kp) = zc0*zldbt(kp) + zc1*zexp3
2676 ztdbt(k) = zldbt(kp) * ztdbt(kp)
2682 if ( zr1 <= od_lo )
then 2683 zexp4 =
f_one - zr1 + 0.5*zr1*zr1
2685 ftind = zr1 / (
bpade + zr1)
2686 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
2690 ztdbt0 = (zc0*zldbt0(k) + zc1*zexp4) * ztdbt0
2695 ztdbt(k) = zldbt(kp) * ztdbt(kp)
2698 ztdbt0 = zldbt0(k) * ztdbt0
2707 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
2715 fxupc(k,ib) = fxupc(k,ib) + zsolar*zfu(k)
2716 fxdnc(k,ib) = fxdnc(k,ib) + zsolar*zfd(k)
2721 zb2 = zsolar*(zfd(1) - ztdbt0)
2724 sfbmc(ibd) = sfbmc(ibd) + zb1
2725 sfdfc(ibd) = sfdfc(ibd) + zb2
2729 sfbmc(1) = sfbmc(1) + zf1
2730 sfdfc(1) = sfdfc(1) + zf2
2731 sfbmc(2) = sfbmc(2) + zf1
2732 sfdfc(2) = sfdfc(2) + zf2
2744 ftoadc = ftoadc + fxdn0(nlp1,ib)
2745 ftoau0 = ftoau0 + fxup0(nlp1,ib)
2746 fsfcu0 = fsfcu0 + fxup0(1,ib)
2747 fsfcd0 = fsfcd0 + fxdn0(1,ib)
2752 suvbf0 = fxdn0(1,ibd)
2754 if ( cf1 <=
eps )
then 2757 fxupc(k,ib) = fxup0(k,ib)
2758 fxdnc(k,ib) = fxdn0(k,ib)
2777 fxupc(k,ib) = cf1*fxupc(k,ib) + cf0*fxup0(k,ib)
2778 fxdnc(k,ib) = cf1*fxdnc(k,ib) + cf0*fxdn0(k,ib)
2783 ftoauc = ftoauc + fxupc(nlp1,ib)
2784 fsfcuc = fsfcuc + fxupc(1,ib)
2785 fsfcdc = fsfcdc + fxdnc(1,ib)
2789 suvbfc = fxdnc(1,ibd)
2792 sfbmc(1) = cf1*sfbmc(1) + cf0*sfbm0(1)
2793 sfbmc(2) = cf1*sfbmc(2) + cf0*sfbm0(2)
2794 sfdfc(1) = cf1*sfdfc(1) + cf0*sfdf0(1)
2795 sfdfc(2) = cf1*sfdfc(2) + cf0*sfdf0(2)
2810 & ( ssolar,cosz,sntz,albbm,albdf,sfluxzen,cldfmc, &
2811 & cf1,cf0,taug,taur,tauae,ssaae,asyae,taucw,ssacw,asycw, &
2814 & fxupc,fxdnc,fxup0,fxdn0, &
2815 & ftoauc,ftoau0,ftoadc,fsfcuc,fsfcu0,fsfcdc,fsfcd0, &
2816 & sfbmc,sfdfc,sfbm0,sfdf0,suvbfc,suvbf0 &
2912 real (kind=kind_phys),
parameter :: zcrit = 0.9999995
2913 real (kind=kind_phys),
parameter :: zsr3 = sqrt(3.0)
2914 real (kind=kind_phys),
parameter :: od_lo = 0.06
2915 real (kind=kind_phys),
parameter :: eps1 = 1.0e-8
2918 integer,
intent(in) :: nlay, nlp1
2920 real (kind=kind_phys),
dimension(nlay,ngptsw),
intent(in) :: &
2921 & taug, taur, cldfmc
2922 real (kind=kind_phys),
dimension(nlay,nbdsw),
intent(in) :: &
2923 & taucw, ssacw, asycw, tauae, ssaae, asyae
2925 real (kind=kind_phys),
dimension(ngptsw),
intent(in) :: sfluxzen
2927 real (kind=kind_phys),
dimension(2),
intent(in) :: albbm, albdf
2929 real (kind=kind_phys),
intent(in) :: cosz, sntz, cf1, cf0, ssolar
2932 real (kind=kind_phys),
dimension(nlp1,nbdsw),
intent(out) :: &
2933 & fxupc, fxdnc, fxup0, fxdn0
2935 real (kind=kind_phys),
dimension(2),
intent(out) :: sfbmc, sfdfc, &
2938 real (kind=kind_phys),
intent(out) :: suvbfc, suvbf0, ftoadc, &
2939 & ftoauc, ftoau0, fsfcuc, fsfcu0, fsfcdc, fsfcd0
2942 real (kind=kind_phys),
dimension(nlay) :: ztaus, zssas, zasys, &
2945 real (kind=kind_phys),
dimension(nlp1) :: zrefb, zrefd, ztrab, &
2946 & ztrad, ztdbt, zldbt, zfu, zfd
2948 real (kind=kind_phys) :: ztau1, zssa1, zasy1, ztau0, zssa0, &
2949 & zasy0, zasy3, zssaw, zasyw, zgam1, zgam2, zgam3, zgam4, &
2950 & za1, za2, zb1, zb2, zrk, zrk2, zrp, zrp1, zrm1, zrpp, &
2951 & zrkg1, zrkg3, zrkg4, zexp1, zexm1, zexp2, zexm2, zden1, &
2952 & zexp3, zexp4, ze1r45, ftind, zsolar, ztdbt0, zr1, zr2, &
2953 & zr3, zr4, zr5, zt1, zt2, zt3, zf1, zf2
2955 integer :: ib, ibd, jb, jg, k, kp, itind
2994 lab_do_jg :
do jg = 1,
ngptsw 3000 zsolar = ssolar * sfluxzen(jg)
3009 zrefb(1) = albbm(ibd)
3010 zrefd(1) = albdf(ibd)
3012 zrefb(1) = 0.5 * (albbm(1) + albbm(2))
3013 zrefd(1) = 0.5 * (albdf(1) + albdf(2))
3023 ztau0 = max(
ftiny, taur(k,jg)+taug(k,jg)+tauae(k,ib) )
3024 zssa0 = taur(k,jg) + tauae(k,ib)*ssaae(k,ib)
3025 zasy0 = asyae(k,ib)*ssaae(k,ib)*tauae(k,ib)
3026 zssaw = min(
oneminus, zssa0 / ztau0 )
3027 zasyw = zasy0 / max(
ftiny, zssa0 )
3038 ztau1 = (
f_one - za2) * ztau0
3039 zssa1 = (zssaw - za2) / (
f_one - za2)
3041 zasy1 = zasyw / (
f_one + zasyw)
3042 zasy3 = 0.75 * zasy1
3046 zgam1 = 1.75 - zssa1 * (
f_one + zasy3)
3047 zgam2 =-0.25 - zssa1 * (
f_one - zasy3)
3048 zgam3 = 0.5 - zasy3 * cosz
3050 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
3051 zgam2 = 0.75* zssa1 * (
f_one- zasy1)
3052 zgam3 = 0.5 - zasy3 * cosz
3054 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
3055 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
3056 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
3058 zgam4 =
f_one - zgam3
3062 if ( zssaw >= zcrit )
then 3063 za1 = zgam1 * cosz - zgam3
3069 zb1 = min( ztau1*sntz , 500.0 )
3070 if ( zb1 <= od_lo )
then 3071 zb2 =
f_one - zb1 + 0.5*zb1*zb1
3073 ftind = zb1 / (
bpade + zb1)
3074 itind = ftind*
ntbmx + 0.5
3088 za1 = zgam1*zgam4 + zgam2*zgam3
3089 za2 = zgam1*zgam3 + zgam2*zgam4
3090 zrk = sqrt( (zgam1 - zgam2) * (zgam1 + zgam2) )
3096 zrpp =
f_one - zrp*zrp
3101 zr1 = zrm1 * (za2 + zrkg3)
3102 zr2 = zrp1 * (za2 - zrkg3)
3103 zr3 = zrk2 * (zgam3 - za2*cosz)
3105 zr5 = zrpp * (zrk - zgam1)
3107 zt1 = zrp1 * (za1 + zrkg4)
3108 zt2 = zrm1 * (za1 - zrkg4)
3109 zt3 = zrk2 * (zgam4 + za1*cosz)
3114 zb1 = min( zrk*ztau1, 500.0 )
3115 if ( zb1 <= od_lo )
then 3116 zexm1 =
f_one - zb1 + 0.5*zb1*zb1
3118 ftind = zb1 / (
bpade + zb1)
3119 itind = ftind*
ntbmx + 0.5
3122 zexp1 =
f_one / zexm1
3124 zb2 = min( sntz*ztau1, 500.0 )
3125 if ( zb2 <= od_lo )
then 3126 zexm2 =
f_one - zb2 + 0.5*zb2*zb2
3128 ftind = zb2 / (
bpade + zb2)
3129 itind = ftind*
ntbmx + 0.5
3132 zexp2 =
f_one / zexm2
3133 ze1r45 = zr4*zexp1 + zr5*zexm1
3136 if (ze1r45>=-eps1 .and. ze1r45<=eps1)
then 3140 zden1 = zssa1 / ze1r45
3142 & (zr1*zexp1 - zr2*zexm1 - zr3*zexm2)*zden1 ))
3144 & - (zt1*zexp1 - zt2*zexm1 - zt3*zexp2)*zden1) ))
3148 zden1 = zr4 / (ze1r45 * zrkg1)
3150 & zgam2*(zexp1 - zexm1)*zden1 ))
3159 if ( zr1 <= od_lo )
then 3160 zexp3 =
f_one - zr1 + 0.5*zr1*zr1
3162 ftind = zr1 / (
bpade + zr1)
3163 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
3167 ztdbt(k) = zexp3 * ztdbt(kp)
3174 if ( zr1 <= od_lo )
then 3175 zexp4 =
f_one - zr1 + 0.5*zr1*zr1
3177 ftind = zr1 / (
bpade + zr1)
3178 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
3183 ztdbt0 = zexp4 * ztdbt0
3188 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3196 fxup0(k,ib) = fxup0(k,ib) + zsolar*zfu(k)
3197 fxdn0(k,ib) = fxdn0(k,ib) + zsolar*zfd(k)
3202 zb2 = zsolar*(zfd(1) - ztdbt0)
3205 sfbm0(ibd) = sfbm0(ibd) + zb1
3206 sfdf0(ibd) = sfdf0(ibd) + zb2
3210 sfbm0(1) = sfbm0(1) + zf1
3211 sfdf0(1) = sfdf0(1) + zf2
3212 sfbm0(2) = sfbm0(2) + zf1
3213 sfdf0(2) = sfdf0(2) + zf2
3220 if ( cf1 >
eps )
then 3228 if ( cldfmc(k,jg) >
ftiny )
then 3230 ztau0 = ztaus(k) + taucw(k,ib)
3231 zssa0 = zssas(k) + ssacw(k,ib)
3232 zasy0 = zasys(k) + asycw(k,ib)
3233 zssaw = min(
oneminus, zssa0 / ztau0)
3234 zasyw = zasy0 / max(
ftiny, zssa0)
3240 ztau1 = (
f_one - za2) * ztau0
3241 zssa1 = (zssaw - za2) / (
f_one - za2)
3243 zasy1 = zasyw / (
f_one + zasyw)
3244 zasy3 = 0.75 * zasy1
3248 zgam1 = 1.75 - zssa1 * (
f_one + zasy3)
3249 zgam2 =-0.25 - zssa1 * (
f_one - zasy3)
3250 zgam3 = 0.5 - zasy3 * cosz
3252 zgam1 = 2.0 - zssa1 * (1.25 + zasy3)
3253 zgam2 = 0.75* zssa1 * (
f_one- zasy1)
3254 zgam3 = 0.5 - zasy3 * cosz
3256 zgam1 = zsr3 * (2.0 - zssa1 * (1.0 + zasy1)) * 0.5
3257 zgam2 = zsr3 * zssa1 * (1.0 - zasy1) * 0.5
3258 zgam3 = (1.0 - zsr3 * zasy1 * cosz) * 0.5
3260 zgam4 =
f_one - zgam3
3264 if ( zssaw >= zcrit )
then 3265 za1 = zgam1 * cosz - zgam3
3271 zb1 = min( ztau1*sntz , 500.0 )
3272 if ( zb1 <= od_lo )
then 3273 zb2 =
f_one - zb1 + 0.5*zb1*zb1
3275 ftind = zb1 / (
bpade + zb1)
3276 itind = ftind*
ntbmx + 0.5
3290 za1 = zgam1*zgam4 + zgam2*zgam3
3291 za2 = zgam1*zgam3 + zgam2*zgam4
3292 zrk = sqrt( (zgam1 - zgam2) * (zgam1 + zgam2) )
3298 zrpp =
f_one - zrp*zrp
3303 zr1 = zrm1 * (za2 + zrkg3)
3304 zr2 = zrp1 * (za2 - zrkg3)
3305 zr3 = zrk2 * (zgam3 - za2*cosz)
3307 zr5 = zrpp * (zrk - zgam1)
3309 zt1 = zrp1 * (za1 + zrkg4)
3310 zt2 = zrm1 * (za1 - zrkg4)
3311 zt3 = zrk2 * (zgam4 + za1*cosz)
3316 zb1 = min( zrk*ztau1, 500.0 )
3317 if ( zb1 <= od_lo )
then 3318 zexm1 =
f_one - zb1 + 0.5*zb1*zb1
3320 ftind = zb1 / (
bpade + zb1)
3321 itind = ftind*
ntbmx + 0.5
3324 zexp1 =
f_one / zexm1
3326 zb2 = min( ztau1*sntz, 500.0 )
3327 if ( zb2 <= od_lo )
then 3328 zexm2 =
f_one - zb2 + 0.5*zb2*zb2
3330 ftind = zb2 / (
bpade + zb2)
3331 itind = ftind*
ntbmx + 0.5
3334 zexp2 =
f_one / zexm2
3335 ze1r45 = zr4*zexp1 + zr5*zexm1
3338 if ( ze1r45>=-eps1 .and. ze1r45<=eps1 )
then 3342 zden1 = zssa1 / ze1r45
3344 & (zr1*zexp1-zr2*zexm1-zr3*zexm2)*zden1 ))
3346 & (zt1*zexp1-zt2*zexm1-zt3*zexp2)*zden1) ))
3350 zden1 = zr4 / (ze1r45 * zrkg1)
3352 & zgam2*(zexp1 - zexm1)*zden1 ))
3361 if ( zr1 <= od_lo )
then 3362 zexp3 =
f_one - zr1 + 0.5*zr1*zr1
3364 ftind = zr1 / (
bpade + zr1)
3365 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
3370 ztdbt(k) = zexp3 * ztdbt(kp)
3376 if ( zr1 <= od_lo )
then 3377 zexp4 =
f_one - zr1 + 0.5*zr1*zr1
3379 ftind = zr1 / (
bpade + zr1)
3380 itind = max(0, min(
ntbmx, int(0.5+
ntbmx*ftind) ))
3384 ztdbt0 = zexp4 * ztdbt0
3389 ztdbt(k) = zldbt(kp) * ztdbt(kp)
3392 ztdbt0 = zldbt0(k) * ztdbt0
3401 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3409 fxupc(k,ib) = fxupc(k,ib) + zsolar*zfu(k)
3410 fxdnc(k,ib) = fxdnc(k,ib) + zsolar*zfd(k)
3415 zb2 = zsolar*(zfd(1) - ztdbt0)
3418 sfbmc(ibd) = sfbmc(ibd) + zb1
3419 sfdfc(ibd) = sfdfc(ibd) + zb2
3423 sfbmc(1) = sfbmc(1) + zf1
3424 sfdfc(1) = sfdfc(1) + zf2
3425 sfbmc(2) = sfbmc(2) + zf1
3426 sfdfc(2) = sfdfc(2) + zf2
3438 ftoadc = ftoadc + fxdn0(nlp1,ib)
3439 ftoau0 = ftoau0 + fxup0(nlp1,ib)
3440 fsfcu0 = fsfcu0 + fxup0(1,ib)
3441 fsfcd0 = fsfcd0 + fxdn0(1,ib)
3446 suvbf0 = fxdn0(1,ibd)
3448 if ( cf1 <=
eps )
then 3451 fxupc(k,ib) = fxup0(k,ib)
3452 fxdnc(k,ib) = fxdn0(k,ib)
3470 ftoauc = ftoauc + fxupc(nlp1,ib)
3471 fsfcuc = fsfcuc + fxupc(1,ib)
3472 fsfcdc = fsfcdc + fxdnc(1,ib)
3476 suvbfc = fxdnc(1,ibd)
3489 & ( zrefb,zrefd,ztrab,ztrad,zldbt,ztdbt, &
3522 integer,
intent(in) :: nlay, nlp1
3524 real (kind=kind_phys),
dimension(nlp1),
intent(in) :: zrefb, &
3525 & zrefd, ztrab, ztrad, ztdbt, zldbt
3528 real (kind=kind_phys),
dimension(nlp1),
intent(out) :: zfu, zfd
3531 real (kind=kind_phys),
dimension(nlp1) :: zrupb,zrupd,zrdnd,ztdn
3533 real (kind=kind_phys) :: zden1
3550 zden1 =
f_one / (
f_one - zrupd(k)*zrefd(kp) )
3551 zrupb(kp) = zrefb(kp) + ( ztrad(kp) * &
3552 & ( (ztrab(kp) - zldbt(kp))*zrupd(k) + &
3553 & zldbt(kp)*zrupb(k)) ) * zden1
3554 zrupd(kp) = zrefd(kp) + ztrad(kp)*ztrad(kp)*zrupd(k)*zden1
3561 ztdn(nlay) = ztrab(nlp1)
3562 zrdnd(nlay) = zrefd(nlp1)
3568 ztdn(k-1) = ztdbt(k)*ztrab(k) + ( ztrad(k) * &
3569 & ( (ztdn(k) - ztdbt(k)) + ztdbt(k) * &
3570 & zrefb(k)*zrdnd(k) )) * zden1
3571 zrdnd(k-1) = zrefd(k) + ztrad(k)*ztrad(k)*zrdnd(k)*zden1
3578 zfu(k) = ( ztdbt(k)*zrupb(k) + &
3579 & (ztdn(k) - ztdbt(k))*zrupd(k) ) * zden1
3580 zfd(k) = ztdbt(k) + ( ztdn(k) - ztdbt(k) + &
3581 & ztdbt(k)*zrupb(k)*zrdnd(k) ) * zden1
3594 & ( colamt,colmol,fac00,fac01,fac10,fac11,jp,jt,jt1,laytrop, &
3595 & forfac,forfrac,indfor,selffac,selffrac,indself, nlay, &
3597 & sfluxzen, taug, taur &
3697 integer,
intent(in) :: nlay, laytrop
3699 integer,
dimension(nlay),
intent(in) :: indfor, indself, &
3702 real (kind=kind_phys),
dimension(nlay),
intent(in) :: colmol, &
3703 & fac00, fac01, fac10, fac11, forfac, forfrac, selffac, &
3706 real (kind=kind_phys),
dimension(nlay,maxgas),
intent(in) :: colamt
3709 real (kind=kind_phys),
dimension(ngptsw),
intent(out) :: sfluxzen
3711 real (kind=kind_phys),
dimension(nlay,ngptsw),
intent(out) :: &
3715 real (kind=kind_phys) :: fs, speccomb, specmult, colm1, colm2
3717 integer,
dimension(nlay,nblow:nbhgh) :: id0, id1
3719 integer :: ibd, j, jb, js, k, klow, khgh, klim, ks, njb, ns
3730 id0(k,jb) = ((jp(k)-1)*5 + (jt(k)-1)) *
nspa(jb)
3731 id1(k,jb) = ( jp(k) *5 + (jt1(k)-1)) *
nspa(jb)
3734 do k = laytrop+1, nlay
3735 id0(k,jb) = ((jp(k)-13)*5 + (jt(k)-1)) *
nspb(jb)
3736 id1(k,jb) = ((jp(k)-12)*5 + (jt1(k)-1)) *
nspb(jb)
3747 case (16, 20, 23, 25, 26, 29)
3761 if (jb==17 .or. jb==28)
then 3764 lab_do_k1 :
do k = laytrop, nlay-1
3771 colm1 = colamt(ks,
ix1(jb))
3772 colm2 = colamt(ks,
ix2(jb))
3773 speccomb = colm1 +
strrat(jb)*colm2
3775 js = 1 + int( specmult )
3776 fs = mod(specmult,
f_one)
3786 lab_do_k2 :
do k = 1, laytrop-1
3793 colm1 = colamt(ks,
ix1(jb))
3794 colm2 = colamt(ks,
ix2(jb))
3795 speccomb = colm1 +
strrat(jb)*colm2
3797 js = 1 + int( specmult )
3798 fs = mod(specmult,
f_one)
3846 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
3847 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
3849 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
3850 integer :: inds, indf, indsp, indfp, j, js, k
3861 tauray = colmol(k) *
rayl 3864 taur(k,
ns16+j) = tauray
3869 speccomb = colamt(k,1) +
strrat(16)*colamt(k,5)
3870 specmult = 8.0 * min(
oneminus, colamt(k,1)/speccomb )
3872 js = 1 + int( specmult )
3873 fs = mod( specmult,
f_one )
3875 fac000 = fs1 * fac00(k)
3876 fac010 = fs1 * fac10(k)
3877 fac100 = fs * fac00(k)
3878 fac110 = fs * fac10(k)
3879 fac001 = fs1 * fac01(k)
3880 fac011 = fs1 * fac11(k)
3881 fac101 = fs * fac01(k)
3882 fac111 = fs * fac11(k)
3884 ind01 = id0(k,16) + js
3888 ind11 = id1(k,16) + js
3898 taug(k,
ns16+j) = speccomb &
3899 & *( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
3900 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
3901 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
3902 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
3903 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
3905 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
3910 do k = laytrop+1, nlay
3911 ind01 = id0(k,16) + 1
3913 ind11 = id1(k,16) + 1
3917 taug(k,
ns16+j) = colamt(k,5) &
3918 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
3919 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) )
3940 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
3941 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
3943 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
3944 integer :: inds, indf, indsp, indfp, j, js, k
3955 tauray = colmol(k) *
rayl 3958 taur(k,
ns17+j) = tauray
3963 speccomb = colamt(k,1) +
strrat(17)*colamt(k,2)
3964 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
3966 js = 1 + int(specmult)
3967 fs = mod(specmult,
f_one)
3969 fac000 = fs1 * fac00(k)
3970 fac010 = fs1 * fac10(k)
3971 fac100 = fs * fac00(k)
3972 fac110 = fs * fac10(k)
3973 fac001 = fs1 * fac01(k)
3974 fac011 = fs1 * fac11(k)
3975 fac101 = fs * fac01(k)
3976 fac111 = fs * fac11(k)
3978 ind01 = id0(k,17) + js
3982 ind11 = id1(k,17) + js
3993 taug(k,
ns17+j) = speccomb &
3994 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
3995 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
3996 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
3997 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
3998 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
4000 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4005 do k = laytrop+1, nlay
4006 speccomb = colamt(k,1) +
strrat(17)*colamt(k,2)
4007 specmult = 4.0 * min(
oneminus, colamt(k,1) / speccomb)
4009 js = 1 + int(specmult)
4010 fs = mod(specmult,
f_one)
4012 fac000 = fs1 * fac00(k)
4013 fac010 = fs1 * fac10(k)
4014 fac100 = fs * fac00(k)
4015 fac110 = fs * fac10(k)
4016 fac001 = fs1 * fac01(k)
4017 fac011 = fs1 * fac11(k)
4018 fac101 = fs * fac01(k)
4019 fac111 = fs * fac11(k)
4021 ind01 = id0(k,17) + js
4025 ind11 = id1(k,17) + js
4034 taug(k,
ns17+j) = speccomb &
4035 & * ( fac000 *
absb(ind01,j) + fac100 *
absb(ind02,j) &
4036 & + fac010 *
absb(ind03,j) + fac110 *
absb(ind04,j) &
4037 & + fac001 *
absb(ind11,j) + fac101 *
absb(ind12,j) &
4038 & + fac011 *
absb(ind13,j) + fac111 *
absb(ind14,j) ) &
4039 & + colamt(k,1) * forfac(k) * (
forref(indf,j) &
4061 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4062 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4064 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4065 integer :: inds, indf, indsp, indfp, j, js, k
4076 tauray = colmol(k) *
rayl 4079 taur(k,
ns18+j) = tauray
4084 speccomb = colamt(k,1) +
strrat(18)*colamt(k,5)
4085 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
4087 js = 1 + int(specmult)
4088 fs = mod(specmult,
f_one)
4090 fac000 = fs1 * fac00(k)
4091 fac010 = fs1 * fac10(k)
4092 fac100 = fs * fac00(k)
4093 fac110 = fs * fac10(k)
4094 fac001 = fs1 * fac01(k)
4095 fac011 = fs1 * fac11(k)
4096 fac101 = fs * fac01(k)
4097 fac111 = fs * fac11(k)
4099 ind01 = id0(k,18) + js
4103 ind11 = id1(k,18) + js
4114 taug(k,
ns18+j) = speccomb &
4115 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4116 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4117 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4118 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
4119 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
4121 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4126 do k = laytrop+1, nlay
4127 ind01 = id0(k,18) + 1
4129 ind11 = id1(k,18) + 1
4133 taug(k,
ns18+j) = colamt(k,5) &
4134 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4135 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) )
4156 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4157 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4159 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4160 integer :: inds, indf, indsp, indfp, j, js, k
4171 tauray = colmol(k) *
rayl 4174 taur(k,
ns19+j) = tauray
4179 speccomb = colamt(k,1) +
strrat(19)*colamt(k,2)
4180 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
4182 js = 1 + int(specmult)
4183 fs = mod(specmult,
f_one)
4185 fac000 = fs1 * fac00(k)
4186 fac010 = fs1 * fac10(k)
4187 fac100 = fs * fac00(k)
4188 fac110 = fs * fac10(k)
4189 fac001 = fs1 * fac01(k)
4190 fac011 = fs1 * fac11(k)
4191 fac101 = fs * fac01(k)
4192 fac111 = fs * fac11(k)
4194 ind01 = id0(k,19) + js
4198 ind11 = id1(k,19) + js
4209 taug(k,
ns19+j) = speccomb &
4210 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4211 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4212 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4213 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
4214 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
4216 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4221 do k = laytrop+1, nlay
4222 ind01 = id0(k,19) + 1
4224 ind11 = id1(k,19) + 1
4228 taug(k,
ns19+j) = colamt(k,2) &
4229 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4230 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) )
4250 real (kind=kind_phys) :: tauray
4252 integer :: ind01, ind02, ind11, ind12
4253 integer :: inds, indf, indsp, indfp, j, k
4264 tauray = colmol(k) *
rayl 4267 taur(k,
ns20+j) = tauray
4272 ind01 = id0(k,20) + 1
4274 ind11 = id1(k,20) + 1
4283 taug(k,
ns20+j) = colamt(k,1) &
4284 & * ( (fac00(k)*
absa(ind01,j) + fac10(k)*
absa(ind02,j) &
4285 & + fac01(k)*
absa(ind11,j) + fac11(k)*
absa(ind12,j)) &
4286 & + selffac(k) * (
selfref(inds,j) + selffrac(k) &
4288 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4290 & + colamt(k,5) *
absch4(j)
4294 do k = laytrop+1, nlay
4295 ind01 = id0(k,20) + 1
4297 ind11 = id1(k,20) + 1
4304 taug(k,
ns20+j) = colamt(k,1) &
4305 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4306 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) &
4307 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4309 & + colamt(k,5) *
absch4(j)
4330 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4331 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4333 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4334 integer :: inds, indf, indsp, indfp, j, js, k
4345 tauray = colmol(k) *
rayl 4348 taur(k,
ns21+j) = tauray
4353 speccomb = colamt(k,1) +
strrat(21)*colamt(k,2)
4354 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
4356 js = 1 + int(specmult)
4357 fs = mod(specmult,
f_one)
4359 fac000 = fs1 * fac00(k)
4360 fac010 = fs1 * fac10(k)
4361 fac100 = fs * fac00(k)
4362 fac110 = fs * fac10(k)
4363 fac001 = fs1 * fac01(k)
4364 fac011 = fs1 * fac11(k)
4365 fac101 = fs * fac01(k)
4366 fac111 = fs * fac11(k)
4368 ind01 = id0(k,21) + js
4372 ind11 = id1(k,21) + js
4383 taug(k,
ns21+j) = speccomb &
4384 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4385 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4386 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4387 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
4388 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
4390 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4395 do k = laytrop+1, nlay
4396 speccomb = colamt(k,1) +
strrat(21)*colamt(k,2)
4397 specmult = 4.0 * min(
oneminus, colamt(k,1) / speccomb)
4399 js = 1 + int(specmult)
4400 fs = mod(specmult,
f_one)
4402 fac000 = fs1 * fac00(k)
4403 fac010 = fs1 * fac10(k)
4404 fac100 = fs * fac00(k)
4405 fac110 = fs * fac10(k)
4406 fac001 = fs1 * fac01(k)
4407 fac011 = fs1 * fac11(k)
4408 fac101 = fs * fac01(k)
4409 fac111 = fs * fac11(k)
4411 ind01 = id0(k,21) + js
4415 ind11 = id1(k,21) + js
4424 taug(k,
ns21+j) = speccomb &
4425 & * ( fac000 *
absb(ind01,j) + fac100 *
absb(ind02,j) &
4426 & + fac010 *
absb(ind03,j) + fac110 *
absb(ind04,j) &
4427 & + fac001 *
absb(ind11,j) + fac101 *
absb(ind12,j) &
4428 & + fac011 *
absb(ind13,j) + fac111 *
absb(ind14,j) ) &
4429 & + colamt(k,1) * forfac(k) * (
forref(indf,j) &
4450 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4451 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111, &
4452 & o2adj, o2cont, o2tem
4454 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4455 integer :: inds, indf, indsp, indfp, j, js, k
4465 o2tem = 4.35e-4 / (350.0*2.0)
4472 tauray = colmol(k) *
rayl 4475 taur(k,
ns22+j) = tauray
4480 o2cont = o2tem * colamt(k,6)
4481 speccomb = colamt(k,1) +
strrat(22)*colamt(k,6)
4482 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
4484 js = 1 + int(specmult)
4485 fs = mod(specmult,
f_one)
4487 fac000 = fs1 * fac00(k)
4488 fac010 = fs1 * fac10(k)
4489 fac100 = fs * fac00(k)
4490 fac110 = fs * fac10(k)
4491 fac001 = fs1 * fac01(k)
4492 fac011 = fs1 * fac11(k)
4493 fac101 = fs * fac01(k)
4494 fac111 = fs * fac11(k)
4496 ind01 = id0(k,22) + js
4500 ind11 = id1(k,22) + js
4511 taug(k,
ns22+j) = speccomb &
4512 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4513 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4514 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4515 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
4516 & + colamt(k,1) * (selffac(k) * (
selfref(inds,j) &
4518 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4523 do k = laytrop+1, nlay
4524 o2cont = o2tem * colamt(k,6)
4526 ind01 = id0(k,22) + 1
4528 ind11 = id1(k,22) + 1
4532 taug(k,
ns22+j) = colamt(k,6) * o2adj &
4533 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4534 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) ) &
4556 integer :: ind01, ind02, ind11, ind12
4557 integer :: inds, indf, indsp, indfp, j, k
4569 taur(k,
ns23+j) = colmol(k) *
rayl(j)
4574 ind01 = id0(k,23) + 1
4576 ind11 = id1(k,23) + 1
4586 & * ( fac00(k)*
absa(ind01,j) + fac10(k)*
absa(ind02,j) &
4587 & + fac01(k)*
absa(ind11,j) + fac11(k)*
absa(ind12,j) ) &
4588 & + selffac(k) * (
selfref(inds,j) + selffrac(k) &
4590 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4595 do k = laytrop+1, nlay
4617 real (kind=kind_phys) :: speccomb, specmult, fs, fs1, &
4618 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4620 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4621 integer :: inds, indf, indsp, indfp, j, js, k
4632 speccomb = colamt(k,1) +
strrat(24)*colamt(k,6)
4633 specmult = 8.0 * min(
oneminus, colamt(k,1) / speccomb)
4635 js = 1 + int(specmult)
4636 fs = mod(specmult,
f_one)
4638 fac000 = fs1 * fac00(k)
4639 fac010 = fs1 * fac10(k)
4640 fac100 = fs * fac00(k)
4641 fac110 = fs * fac10(k)
4642 fac001 = fs1 * fac01(k)
4643 fac011 = fs1 * fac11(k)
4644 fac101 = fs * fac01(k)
4645 fac111 = fs * fac11(k)
4647 ind01 = id0(k,24) + js
4651 ind11 = id1(k,24) + js
4662 taug(k,
ns24+j) = speccomb &
4663 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4664 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4665 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4666 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) ) &
4667 & + colamt(k,3) *
abso3a(j) + colamt(k,1) &
4668 & * (selffac(k) * (
selfref(inds,j) + selffrac(k) &
4670 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
4673 taur(k,
ns24+j) = colmol(k) &
4678 do k = laytrop+1, nlay
4679 ind01 = id0(k,24) + 1
4681 ind11 = id1(k,24) + 1
4685 taug(k,
ns24+j) = colamt(k,6) &
4686 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4687 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) ) &
4688 & + colamt(k,3) *
abso3b(j)
4711 integer :: ind01, ind02, ind11, ind12
4724 taur(k,
ns25+j) = colmol(k) *
rayl(j)
4729 ind01 = id0(k,25) + 1
4731 ind11 = id1(k,25) + 1
4735 taug(k,
ns25+j) = colamt(k,1) &
4736 & * ( fac00(k)*
absa(ind01,j) + fac10(k)*
absa(ind02,j) &
4737 & + fac01(k)*
absa(ind11,j) + fac11(k)*
absa(ind12,j) ) &
4738 & + colamt(k,3) *
abso3a(j)
4742 do k = laytrop+1, nlay
4778 taur(k,
ns26+j) = colmol(k) *
rayl(j)
4799 integer :: ind01, ind02, ind11, ind12
4812 taur(k,
ns27+j) = colmol(k) *
rayl(j)
4817 ind01 = id0(k,27) + 1
4819 ind11 = id1(k,27) + 1
4823 taug(k,
ns27+j) = colamt(k,3) &
4824 & * ( fac00(k)*
absa(ind01,j) + fac10(k)*
absa(ind02,j) &
4825 & + fac01(k)*
absa(ind11,j) + fac11(k)*
absa(ind12,j) )
4829 do k = laytrop+1, nlay
4830 ind01 = id0(k,27) + 1
4832 ind11 = id1(k,27) + 1
4836 taug(k,
ns27+j) = colamt(k,3) &
4837 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
4838 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) )
4859 real (kind=kind_phys) :: speccomb, specmult, tauray, fs, fs1, &
4860 & fac000,fac001,fac010,fac011, fac100,fac101,fac110,fac111
4862 integer :: ind01, ind02, ind03, ind04, ind11, ind12, ind13, ind14
4874 tauray = colmol(k) *
rayl 4877 taur(k,
ns28+j) = tauray
4882 speccomb = colamt(k,3) +
strrat(28)*colamt(k,6)
4883 specmult = 8.0 * min(
oneminus, colamt(k,3) / speccomb)
4885 js = 1 + int(specmult)
4886 fs = mod(specmult,
f_one)
4888 fac000 = fs1 * fac00(k)
4889 fac010 = fs1 * fac10(k)
4890 fac100 = fs * fac00(k)
4891 fac110 = fs * fac10(k)
4892 fac001 = fs1 * fac01(k)
4893 fac011 = fs1 * fac11(k)
4894 fac101 = fs * fac01(k)
4895 fac111 = fs * fac11(k)
4897 ind01 = id0(k,28) + js
4901 ind11 = id1(k,28) + js
4907 taug(k,
ns28+j) = speccomb &
4908 & * ( fac000 *
absa(ind01,j) + fac100 *
absa(ind02,j) &
4909 & + fac010 *
absa(ind03,j) + fac110 *
absa(ind04,j) &
4910 & + fac001 *
absa(ind11,j) + fac101 *
absa(ind12,j) &
4911 & + fac011 *
absa(ind13,j) + fac111 *
absa(ind14,j) )
4915 do k = laytrop+1, nlay
4916 speccomb = colamt(k,3) +
strrat(28)*colamt(k,6)
4917 specmult = 4.0 * min(
oneminus, colamt(k,3) / speccomb)
4919 js = 1 + int(specmult)
4920 fs = mod(specmult,
f_one)
4922 fac000 = fs1 * fac00(k)
4923 fac010 = fs1 * fac10(k)
4924 fac100 = fs * fac00(k)
4925 fac110 = fs * fac10(k)
4926 fac001 = fs1 * fac01(k)
4927 fac011 = fs1 * fac11(k)
4928 fac101 = fs * fac01(k)
4929 fac111 = fs * fac11(k)
4931 ind01 = id0(k,28) + js
4935 ind11 = id1(k,28) + js
4941 taug(k,
ns28+j) = speccomb &
4942 & * ( fac000 *
absb(ind01,j) + fac100 *
absb(ind02,j) &
4943 & + fac010 *
absb(ind03,j) + fac110 *
absb(ind04,j) &
4944 & + fac001 *
absb(ind11,j) + fac101 *
absb(ind12,j) &
4945 & + fac011 *
absb(ind13,j) + fac111 *
absb(ind14,j) )
4966 real (kind=kind_phys) :: tauray
4968 integer :: ind01, ind02, ind11, ind12
4969 integer :: inds, indf, indsp, indfp, j, k
4980 tauray = colmol(k) *
rayl 4983 taur(k,
ns29+j) = tauray
4988 ind01 = id0(k,29) + 1
4990 ind11 = id1(k,29) + 1
4999 taug(k,
ns29+j) = colamt(k,1) &
5000 & * ( (fac00(k)*
absa(ind01,j) + fac10(k)*
absa(ind02,j) &
5001 & + fac01(k)*
absa(ind11,j) + fac11(k)*
absa(ind12,j) ) &
5002 & + selffac(k) * (
selfref(inds,j) + selffrac(k) &
5004 & + forfac(k) * (
forref(indf,j) + forfrac(k) &
5006 & + colamt(k,2) *
absco2(j)
5010 do k = laytrop+1, nlay
5011 ind01 = id0(k,29) + 1
5013 ind11 = id1(k,29) + 1
5017 taug(k,
ns29+j) = colamt(k,2) &
5018 & * ( fac00(k)*
absb(ind01,j) + fac10(k)*
absb(ind02,j) &
5019 & + fac01(k)*
absb(ind11,j) + fac11(k)*
absb(ind12,j) ) &
5020 & + colamt(k,1) *
absh2o(j)
real(kind=kind_phys), parameter con_amo3
molecular wght of o3 (g/mol)
real(kind=kind_phys), parameter, public rayl
real(kind=kind_phys), parameter, public rayl
subroutine mcica_subcol
This subroutine computes the sub-colum cloud profile flag array.
This module sets up absorption coeffients for band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2) ...
real(kind=kind_phys), dimension(ng23), public rayl
real(kind=kind_phys), public a1s
real(kind=kind_phys), dimension(msa16, ng16), public absa
real(kind=kind_phys), dimension(msf29, ng29), public selfref
real(kind=kind_phys), parameter amdw
real(kind=kind_phys), parameter eps
real(kind=kind_phys), dimension(5), public ebari
This module sets up absorption coeffients for band 24: 12850-16000 cm-1 (low - h2o, o2; high - o2)
subroutine taumol17
The subroutine computes the optical depth in band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o...
real(kind=kind_phys), dimension(msf19, ng19), public selfref
character(40), parameter vtagsw
real(kind=kind_phys), dimension(mfr29, ng29), public forref
integer, dimension(nblow:nbhgh), public ix2
integer, dimension(nblow:nbhgh), public ix1
real(kind=kind_phys), dimension(mfr22, ng22), public forref
real(kind=kind_phys), dimension(msb21, ng21), public absb
subroutine, public swrad
This subroutine is the main sw radiation routine.
real(kind=kind_phys), dimension(ng24), public abso3a
real(kind=kind_phys), dimension(msb18, ng18), public absb
real(kind=kind_phys), dimension(nblow:nbhgh), public c0r
real(kind=kind_phys), dimension(msa28, ng28), public absa
This module sets up absorption coeffients for band 27: 29000-38000 cm-1 (low - o3; high - o3) ...
real(kind=kind_phys), dimension(msa18, ng18), public absa
real(kind=kind_phys), dimension(mfr20, ng20), public forref
real(kind=kind_phys), dimension(43, nblow:nbhgh), public asyice2
subroutine cldprop
This subroutine computes the cloud optical properties for each cloudy layer and g-point interval...
define type construct for optional component downward fluxes at surface
real(kind=kind_phys), dimension(43, nblow:nbhgh), public extice2
real(kind=kind_phys), dimension(msf24, ng24), public selfref
real(kind=kind_phys), dimension(ng24, mfx24), public rayla
real(kind=kind_phys), dimension(msb28, ng28), public absb
real(kind=kind_phys), dimension(msb24, ng24), public absb
integer, parameter nbhgh
band range upper limit
This module sets up absorption coeffients for band 20: 5150-6150 cm-1 (low - h2o; high - h2o) ...
integer, parameter ntbmx
index upper limit of trans table
real(kind=kind_phys), public a0s
real(kind=kind_phys), dimension(ngmax, mfs01, mfb01), target, public sfluxref01
real(kind=kind_phys), dimension(ng26), public rayl
integer, parameter ngptsw
total number of g-point in all bands
real(kind=kind_phys), dimension(ng24), public abso3b
integer, save isubcsw
sub-column cloud approx flag in sw radiation
real(kind=kind_phys), dimension(msf22, ng22), public selfref
real(kind=kind_phys), dimension(58, nblow:nbhgh), public extliq1
This module contains coefficients of cloud optical properties for each of the spectral bands...
real(kind=kind_phys), dimension(nblow:nbhgh), public c0s
real(kind=kind_phys), dimension(msa23, ng23), public absa
This module sets up absorption coeffients for band 23: 8050-12850 cm-1 (low - h2o; high - nothing) ...
real(kind=kind_phys), dimension(msa22, ng22), public absa
real(kind=kind_phys), dimension(ng29), public absco2
define type construct for radiation fluxes at toa
real(kind=kind_phys), dimension(msb27, ng27), public absb
real(kind=kind_phys), dimension(ng25), public abso3a
integer, save iovrsw
cloud overlapping control flag for sw
real(kind=kind_phys), parameter stpfac
real(kind=kind_phys), dimension(msb29, ng29), public absb
This module contains some the most frequently used math and physics constants for gcm models...
real(kind=kind_phys), dimension(ngmax, mfs02, mfb02), target, public sfluxref02
integer, parameter iswrgas
sw rare gases effect control flag (ch4,n2o,o2,...) =0:no; =1:yes.
define type construct for radiation fluxes at surface
This module sets up absorption coeffients for band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4) ...
real(kind=kind_phys), dimension(msb16, ng16), public absb
subroutine taumol22
The subroutine computes the optical depth in band 22: 7700-8050 cm-1 (low - h2o,o2; high - o2) ...
real(kind=kind_phys), dimension(nblow:nbhgh), public b0s
real(kind=kind_phys), dimension(msb20, ng20), public absb
real(kind=kind_phys), dimension(msf23, ng23), public selfref
real(kind=kind_phys), parameter, public rayl
subroutine spcvrtm
This subroutine computes the shortwave radiative fluxes using two-stream method of h...
integer, dimension(nblow:nbhgh) nspb
real(kind=kind_phys), dimension(43, nblow:nbhgh), public ssaice2
subroutine setcoef
This subroutine computes various coefficients needed in radiative transfer calculation.
real(kind=kind_phys), dimension(msb22, ng22), public absb
real(kind=kind_phys), dimension(ng25), public abso3b
subroutine taumol23
The subroutine computes the optical depth in band 23: 8050-12850 cm-1 (low - h2o; high - nothing) ...
integer, save iswcliq
sw optical property for liquid clouds =0:input cld opt depth, ignoring iswcice setting =1:input c...
real(kind=kind_phys), dimension(59) preflog
real(kind=kind_phys), dimension(msa21, ng21), public absa
integer, parameter ipsdsw0
This module defines commonly used control variables/parameters in physics related programs...
subroutine taumol26
The subroutine computes the optical depth in band 26: 22650-29000 cm-1 (low - nothing; high - nothing...
real(kind=kind_phys), dimension(ng24), public raylb
integer, dimension(nblow:nbhgh) idxsfc
This module contains reference temperature and pressure.
real(kind=kind_phys), parameter, public rayl
integer, parameter iswrate
sw heating rate unit control flag =1:k/day; =2:k/second.
This module contains SW band parameters set up.
real(kind=kind_phys), parameter ftiny
integer, parameter nblow
band range lower limit
subroutine taumol19
The subroutine computes the optical depth in band 19: 4650-5150 cm-1 (low - h2o,co2; high - co2) ...
real(kind=kind_phys), parameter amdo3
This module sets up absorption coeffients for band 26: 22650-29000 cm-1 (low - nothing; high - nothin...
subroutine taumol28
The subroutine computes the optical depth in band 28: 38000-50000 cm-1 (low - o3,o2; high - o3...
real(kind=kind_phys), dimension(msb19, ng19), public absb
subroutine taumol18
The subroutine computes the optical depth in band 18: 4000-4650 cm-1 (low - h2o,ch4; high - ch4) ...
real(kind=kind_phys), dimension(nblow:nbhgh), public strrat
real(kind=kind_phys), dimension(46, nblow:nbhgh), public extice3
real(kind=kind_phys), dimension(mfr16, ng16), public forref
real(kind=kind_phys), dimension(msf20, ng20), public selfref
real(kind=kind_phys), parameter, public rayl
real(kind=kind_phys), dimension(5), public fbari
real(kind=kind_phys), parameter, public rayl
real(kind=kind_phys), dimension(5), public dbari
real(kind=kind_phys), dimension(ng20), public absch4
real(kind=kind_phys), dimension(msf17, ng17), public selfref
integer, save ivflip
vertical profile indexing flag
This module sets up absorption coeffients for band 29: 820-2600 cm-1 (low - h2o; high - co2) ...
define type construct for optional radiation flux profiles
This module sets up absorption coeffients for band 17: 3250-4000 cm-1 (low - h2o,co2; high - h2o...
real(kind=kind_phys), dimension(mfr23, ng23), public forref
subroutine taumol29
The subroutine computes the optical depth in band 29: 820-2600 cm-1 (low - h2o; high - co2) ...
integer, dimension(nblow:nbhgh) idxebc
real(kind=kind_phys), dimension(58, nblow:nbhgh), public asyliq1
real(kind=kind_phys), dimension(46, nblow:nbhgh), public asyice3
real(kind=kind_phys), dimension(msa27, ng27), public absa
subroutine, public rswinit
This subroutine initializes non-varying module variables, conversion factors, and look-up tables...
real(kind=kind_phys), dimension(mfr21, ng21), public forref
subroutine taumol27
The subroutine computes the optical depth in band 27: 29000-38000 cm-1 (low - o3; high - o3) ...
This module sets up absorption coeffients for band 22: 7700-8050 cm-1 (low - h2o, o2; high - o2) ...
real(kind=kind_phys), dimension(ngmax, mfs03, mfb03), target, public sfluxref03
real(kind=kind_phys), dimension(ng29), public absh2o
real(kind=kind_phys), parameter bpade
real(kind=kind_phys), parameter con_amw
molecular wght of water vapor (g/mol)
real(kind=kind_phys), dimension(mfr18, ng18), public forref
real(kind=kind_phys), parameter s0
This module contains spectral distribution of solar radiation flux used to obtain the incoming solar ...
real(kind=kind_phys), dimension(msf16, ng16), public selfref
real(kind=kind_phys), dimension(msb17, ng17), public absb
subroutine taumol20
The subroutine computes the optical depth in band 20: 5150-6150 cm-1 (low - h2o; high - h2o) ...
subroutine taumol21
The subroutine computes the optical depth in band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o...
real(kind=kind_phys), dimension(ng27), public rayl
real(kind=kind_phys), parameter con_amd
molecular wght of dry air (g/mol)
real(kind=kind_phys), dimension(mfr19, ng19), public forref
This module sets up absorption coeffients for band 25: 16000-22650 cm-1 (low - h2o; high - nothing) ...
This module includes ncep's modifications of the rrtm-sw radiation code from aer inc.
real(kind=kind_phys), parameter, public rayl
real(kind=kind_phys), dimension(msa20, ng20), public absa
real(kind=kind_phys), dimension(58, nblow:nbhgh), public ssaliq1
real(kind=kind_phys), dimension(msa17, ng17), public absa
real(kind=kind_phys), parameter con_g
gravity (m/s2)
real(kind=kind_phys), dimension(mfr24, ng24), public forref
real(kind=kind_phys), parameter f_zero
real(kind=kind_phys), dimension(ng25), public rayl
integer, dimension(nblow:nbhgh) ngs
integer, dimension(nblow:nbhgh), public ibx
subroutine taumol25
The subroutine computes the optical depth in band 25: 16000-22650 cm-1 (low - h2o; high - nothing) ...
integer, dimension(nblow:nbhgh) nspa
real(kind=kind_phys), dimension(46, nblow:nbhgh), public ssaice3
real(kind=kind_phys), dimension(msa25, ng25), public absa
real(kind=kind_phys), parameter, public scalekur
real(kind=kind_phys), parameter, public rayl
subroutine spcvrtc
This subroutine computes the shortwave radiative fluxes using two-stream method.
real(kind=kind_phys), parameter, public givfac
real(kind=kind_phys), dimension(0:ntbmx) exp_tbl
integer, dimension(nblow:nbhgh) ng
real(kind=kind_phys) heatfac
real(kind=kind_phys), dimension(mfr17, ng17), public forref
real(kind=kind_phys), public a0r
This module sets up absorption coeffients for band 21: 6150-7700 cm-1 (low - h2o,co2; high - h2o...
real(kind=kind_phys), dimension(5), public cbari
integer, parameter iswmode
sw control flag for 2-stream transfer scheme =1:delta-eddington (joseph et al., 1976) =2:pifm (zd...
real(kind=kind_phys), dimension(msf18, ng18), public selfref
real(kind=kind_phys), parameter, public rayl
real(kind=kind_phys), parameter con_cp
spec heat air at p (J/kg/K)
integer, dimension(ngptsw) ngb
real(kind=kind_phys), parameter f_one
real(kind=kind_phys), parameter oneminus
integer, parameter maxgas
max num of absorbing gases
real(kind=kind_phys), dimension(nblow:nbhgh), public b1s
integer, dimension(nblow:nbhgh), public layreffr
real(kind=kind_phys), parameter con_avgd
avogadro constant (1/mol)
real(kind=kind_phys), dimension(nblow:nbhgh), public b0r
This module sets up absorption coeffients for band 28: 38000-50000 cm-1 (low - o3,o2; high - o3,o2)
real(kind=kind_phys), dimension(msa29, ng29), public absa
real(kind=kind_phys), dimension(msa19, ng19), public absa
real(kind=kind_phys), dimension(5), public abari
This module sets up absorption coefficients for band 16: 2600-3250 cm-1 (low - h2o, ch4; high - ch4)
integer, save iswcice
sw optical property for ice clouds (only iswcliq>0) =0:not defined yet =1:input cip...
real(kind=kind_phys), dimension(msf21, ng21), public selfref
real(kind=kind_phys), dimension(59) tref
real(kind=kind_phys), dimension(5), public bbari
real(kind=kind_phys), dimension(nblow:nbhgh), public specwt
subroutine taumol24
The subroutine computes the optical depth in band 24: 12850-16000 cm-1 (low - h2o,o2; high - o2)
subroutine taumol16
The subroutine computes the optical depth in band 16: 2600-3250 cm-1 (low - h2o,ch4; high - ch4) ...
integer, save icldflg
cloud optical property scheme control flag
subroutine swflux
This subroutine computes the upward and downward radiation fluxes.
real(kind=kind_phys), dimension(msa24, ng24), public absa