12 SUBROUTINE sorad_d(m, np, nb, cosz_dev, pl_dev, ta_dev, ta_devd, wa_dev&
13 & , wa_devd, oa_dev, oa_devd, co2, cwc_dev, cwc_devd, fcld_dev, &
14 & fcld_devd, ict, icb, reff_dev, reff_devd, hk_uv, hk_ir, taua_dev, &
15 & taua_devd, ssaa_dev, ssaa_devd, asya_dev, asya_devd, rsuvbm_dev, &
16 & rsuvdf_dev, rsirbm_dev, rsirdf_dev, flx_dev, flx_devd, cons_grav, &
17 & wk_uv, zk_uv, ry_uv, xk_ir, ry_ir, cah, coa, aig_uv, awg_uv, arg_uv, &
18 & aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, &
19 & ara_nir, aig_nir, awg_nir, arg_nir, caib, caif)
24 INTEGER,
PARAMETER :: nu=43
25 INTEGER,
PARAMETER :: nw=37
26 INTEGER,
PARAMETER :: nx=62
27 INTEGER,
PARAMETER :: ny=101
28 INTEGER,
PARAMETER :: nband_uv=5
29 INTEGER,
PARAMETER :: nk_ir=10
30 INTEGER,
PARAMETER :: nband_ir=3
31 INTEGER,
PARAMETER :: nband=nband_uv+nband_ir
32 REAL*8,
PARAMETER :: dsm=0.602
35 INTEGER :: m, np, ict, icb, nb
36 REAL*8 :: cosz_dev(m), pl_dev(m, np+1), ta_dev(m, np), wa_dev(m, np), &
38 REAL*8 :: ta_devd(m, np), wa_devd(m, np), oa_devd(m, np)
39 REAL*8 :: cwc_dev(m, np, 4), fcld_dev(m, np), reff_dev(m, np, 4), &
40 & hk_uv(5), hk_ir(3, 10)
41 REAL*8 :: cwc_devd(m, np, 4), fcld_devd(m, np), reff_devd(m, np, 4)
42 REAL*8 :: rsuvbm_dev, rsuvdf_dev, rsirbm_dev, rsirdf_dev
43 REAL*8 :: taua_dev(m, np, nb)
44 REAL*8 :: taua_devd(m, np, nb)
45 REAL*8 :: ssaa_dev(m, np, nb)
46 REAL*8 :: ssaa_devd(m, np, nb)
47 REAL*8 :: asya_dev(m, np, nb)
48 REAL*8 :: asya_devd(m, np, nb)
51 REAL*8,
INTENT(IN) :: wk_uv(5), zk_uv(5), ry_uv(5)
52 REAL*8,
INTENT(IN) :: xk_ir(10), ry_ir(3)
53 REAL*8,
INTENT(IN) :: cah(43, 37), coa(62, 101)
54 REAL*8,
INTENT(IN) :: aig_uv(3), awg_uv(3), arg_uv(3)
55 REAL*8,
INTENT(IN) :: aib_uv, awb_uv(2), arb_uv(2)
56 REAL*8,
INTENT(IN) :: aib_nir, awb_nir(3, 2), arb_nir(3, 2)
57 REAL*8,
INTENT(IN) :: aia_nir(3, 3), awa_nir(3, 3), ara_nir(3, 3)
58 REAL*8,
INTENT(IN) :: aig_nir(3, 3), awg_nir(3, 3), arg_nir(3, 3)
59 REAL*8,
INTENT(IN) :: caib(11, 9, 11), caif(9, 11)
60 REAL*8,
INTENT(IN) :: cons_grav
62 REAL*8 :: flx_dev(m, np+1), flc_dev(m, np+1)
63 REAL*8 :: flx_devd(m, np+1)
64 REAL*8 :: flxu_dev(m, np+1), flcu_dev(m, np+1)
65 REAL*8 :: fdiruv_dev(m), fdifuv_dev(m)
66 REAL*8 :: fdirpar_dev(m), fdifpar_dev(m)
67 REAL*8 :: fdirir_dev(m), fdifir_dev(m)
68 REAL*8 :: flx_sfc_band_dev(m, nband)
70 INTEGER :: i, j, k, l, in, ntop
71 REAL*8 :: dp(np), wh(np), oh(np)
72 REAL*8 :: dpd(np), whd(np), ohd(np)
75 REAL*8 :: swh(np+1), so2(np+1), df(0:np+1)
76 REAL*8 :: swhd(np+1), so2d(np+1), dfd(0:np+1)
77 REAL*8 :: scal0, wvtoa, o3toa, pa
78 REAL*8 :: wvtoad, o3toad
79 REAL*8 :: snt, cnt, x, xx4, xtoa
84 REAL*8 :: w1, dw,
u1, du
86 REAL*8 :: tauclb(np), tauclf(np), asycl(np)
87 REAL*8 :: tauclbd(np), tauclfd(np), asycld(np)
88 REAL*8 :: taubeam(np, 4), taudiff(np, 4)
89 REAL*8 :: taubeamd(np, 4), taudiffd(np, 4)
90 REAL*8 :: fcld_col(np)
91 REAL*8 :: fcld_cold(np)
92 REAL*8 :: cwc_col(np, 4)
93 REAL*8 :: cwc_cold(np, 4)
94 REAL*8 :: reff_col(np, 4)
95 REAL*8 :: reff_cold(np, 4)
96 REAL*8 :: taurs, tauoz, tauwv
97 REAL*8 :: tauozd, tauwvd
98 REAL*8 :: tausto, ssatau, asysto
99 REAL*8 :: taustod, ssataud, asystod
100 REAL*8 :: tautob, ssatob, asytob
101 REAL*8 :: tautobd, ssatobd, asytobd
102 REAL*8 :: tautof, ssatof, asytof
103 REAL*8 :: tautofd, ssatofd, asytofd
104 REAL*8 :: rr(0:np+1, 2), tt(0:np+1, 2), td(0:np+1, 2)
105 REAL*8 :: rrd(0:np+1, 2), ttd(0:np+1, 2), tdd(0:np+1, 2)
106 REAL*8 :: rs(0:np+1, 2), ts(0:np+1, 2)
107 REAL*8 :: rsd(0:np+1, 2), tsd(0:np+1, 2)
108 REAL*8 :: fall(np+1), fclr(np+1), fsdir, fsdif
109 REAL*8 :: falld(np+1)
110 REAL*8 :: fupa(np+1), fupc(np+1)
111 REAL*8 :: cc1, cc2, cc3
112 REAL*8 :: cc1d, cc2d, cc3d
113 REAL*8 :: rrt, ttt, tdt, rst, tst
114 REAL*8 :: rrtd, tttd, tdtd, rstd, tstd
120 REAL*8 :: ulog, wlog, dc, dd, x0, x1, x2, y0, y1, y2, du2, dw2
121 REAL*8 :: wlogd, ddd, x2d, y2d
128 REAL*8 :: rra(0:np+1, 2, 2), tta(0:np, 2, 2)
129 REAL*8 :: rrad(0:np+1, 2, 2), ttad(0:np, 2, 2)
130 REAL*8 :: tda(0:np, 2, 2)
131 REAL*8 :: tdad(0:np, 2, 2)
132 REAL*8 :: rsa(0:np, 2, 2), rxa(0:np+1, 2, 2)
133 REAL*8 :: rsad(0:np, 2, 2), rxad(0:np+1, 2, 2)
137 REAL*8 :: fdndir, fdndif, fupdif
138 REAL*8 :: fdndird, fdndifd, fupdifd
143 REAL*8 :: chd, cmd, ctd
148 INTEGER :: ii, jj, irhp1, an
179 snt = 1.0/cosz_dev(i)
180 IF (pl_dev(i, 1) .LT. 1.e-3)
THEN 185 scal0 = xtoa*(0.5*xtoa/300.)**.8
186 o3toad = 1.02*xtoa*466.7*oa_devd(i, 1)
187 o3toa = 1.02*oa_dev(i, 1)*xtoa*466.7 + 1.0e-8
188 wvtoad = 1.02*scal0*(wa_devd(i, 1)*(1.0+0.00135*(ta_dev(i, 1)-240.))+&
189 & wa_dev(i, 1)*0.00135*ta_devd(i, 1))
190 wvtoa = 1.02*wa_dev(i, 1)*scal0*(1.0+0.00135*(ta_dev(i, 1)-240.)) + &
204 dp(k) = pl_dev(i, k+1) - pl_dev(i, k)
207 dp_pa(k) = dp(k)*100.
211 pa = 0.5*(pl_dev(i, k)+pl_dev(i, k+1))
213 scal(k) = dp(k)*(pa/300.)**.8
214 whd(k) = 1.02*scal(k)*(wa_devd(i, k)*(1.+0.00135*(ta_dev(i, k)-240.)&
215 & )+wa_dev(i, k)*0.00135*ta_devd(i, k))
216 wh(k) = 1.02*wa_dev(i, k)*scal(k)*(1.+0.00135*(ta_dev(i, k)-240.)) +&
218 swhd(k+1) = swhd(k) + whd(k)
219 swh(k+1) = swh(k) + wh(k)
223 ohd(k) = 1.02*dp(k)*466.7*oa_devd(i, k)
224 oh(k) = 1.02*oa_dev(i, k)*dp(k)*466.7 + 1.e-8
226 fcld_cold(k) = fcld_devd(i, k)
227 fcld_col(k) = fcld_dev(i, k)
229 reff_cold(k, l) = reff_devd(i, k, l)
230 reff_col(k, l) = reff_dev(i, k, l)
231 cwc_cold(k, l) = cwc_devd(i, k, l)
232 cwc_col(k, l) = cwc_dev(i, k, l)
252 flx_devd(i, k) = 0.0_8
260 flx_sfc_band_dev(i, ib) = 0.
273 rr(np+1, 1) = rsuvbm_dev
275 rr(np+1, 2) = rsuvbm_dev
277 rs(np+1, 1) = rsuvdf_dev
279 rs(np+1, 2) = rsuvdf_dev
343 CALL getvistau1_d(np, cosz_dev(i), dp_pa, fcld_col, fcld_cold, &
344 & reff_col, reff_cold, cwc_col, cwc_cold, ict, icb, taubeam&
345 & , taubeamd, taudiff, taudiffd, asycl, asycld, aig_uv, &
346 & awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, &
347 & arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, &
348 & arg_nir, caib, caif, cons_grav)
361 IF (cc1 .LT. fcld_dev(i, k))
THEN 362 cc1d = fcld_devd(i, k)
367 ELSE IF (k .LT. icb)
THEN 368 IF (cc2 .LT. fcld_dev(i, k))
THEN 369 cc2d = fcld_devd(i, k)
374 ELSE IF (cc3 .LT. fcld_dev(i, k))
THEN 375 cc3d = fcld_devd(i, k)
386 tauclbd(k) = taubeamd(k, 1) + taubeamd(k, 2) + taubeamd(k, 3) + &
388 tauclb(k) = taubeam(k, 1) + taubeam(k, 2) + taubeam(k, 3) + taubeam(&
390 tauclfd(k) = taudiffd(k, 1) + taudiffd(k, 2) + taudiffd(k, 3) + &
392 tauclf(k) = taudiff(k, 1) + taudiff(k, 2) + taudiff(k, 3) + taudiff(&
411 arg1d = -((wk_uv(ib)*wvtoad+zk_uv(ib)*o3toad)/cosz_dev(i))
412 arg1 = -((wvtoa*wk_uv(ib)+o3toa*zk_uv(ib))/cosz_dev(i))
413 tdd(0, 1) = arg1d*exp(arg1)
415 tdd(0, 2) = tdd(0, 1)
420 taurs = ry_uv(ib)*dp(k)
421 tauozd = zk_uv(ib)*ohd(k)
422 tauoz = zk_uv(ib)*oh(k)
423 tauwvd = wk_uv(ib)*whd(k)
424 tauwv = wk_uv(ib)*wh(k)
425 taustod = tauozd + tauwvd + taua_devd(i, k, ib)
426 tausto = taurs + tauoz + tauwv + taua_dev(i, k, ib) + 1.0e-7
427 ssataud = ssaa_devd(i, k, ib)
428 ssatau = ssaa_dev(i, k, ib) + taurs
429 asystod = asya_devd(i, k, ib)
430 asysto = asya_dev(i, k, ib)
433 asytobd = (asystod*ssatau-asysto*ssataud)/ssatau**2
434 asytob = asysto/ssatau
435 ssatobd = (ssataud*tautob-ssatau*tautobd)/tautob**2
436 ssatob = ssatau/tautob + 1.0e-8
437 IF (ssatob .GT. 0.999999)
THEN 444 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd, &
445 & cosz_dev(i), rrt, rrtd, ttt, tttd, tdt, tdtd)
448 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd, &
449 & dsm, rst, rstd, tst, tstd, dum, dumd)
464 tautobd = taustod + tauclbd(k)
465 tautob = tausto + tauclb(k)
466 ssatobd = ((ssataud+tauclbd(k))*tautob-(ssatau+tauclb(k))*tautobd)&
468 ssatob = (ssatau+tauclb(k))/tautob + 1.0e-8
469 IF (ssatob .GT. 0.999999)
THEN 475 asytobd = ((asystod+asycld(k)*tauclb(k)+asycl(k)*tauclbd(k))*&
476 & ssatob*tautob-(asysto+asycl(k)*tauclb(k))*(ssatobd*tautob+ssatob&
477 & *tautobd))/(ssatob*tautob)**2
478 asytob = (asysto+asycl(k)*tauclb(k))/(ssatob*tautob)
480 tautofd = taustod + tauclfd(k)
481 tautof = tausto + tauclf(k)
482 ssatofd = ((ssataud+tauclfd(k))*tautof-(ssatau+tauclf(k))*tautofd)&
484 ssatof = (ssatau+tauclf(k))/tautof + 1.0e-8
485 IF (ssatof .GT. 0.999999)
THEN 491 asytofd = ((asystod+asycld(k)*tauclf(k)+asycl(k)*tauclfd(k))*&
492 & ssatof*tautof-(asysto+asycl(k)*tauclf(k))*(ssatofd*tautof+ssatof&
493 & *tautofd))/(ssatof*tautof)**2
494 asytof = (asysto+asycl(k)*tauclf(k))/(ssatof*tautof)
498 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd, &
499 & cosz_dev(i), rrt, rrtd, ttt, tttd, tdt, tdtd)
502 CALL deledd_d(tautof, tautofd, ssatof, ssatofd, asytof, asytofd, &
503 & dsm, rst, rstd, tst, tstd, dum, dumd)
671 tdad(0, ih, 1) = tdd(0, ih)
672 tda(0, ih, 1) = td(0, ih)
673 ttad(0, ih, 1) = ttd(0, ih)
674 tta(0, ih, 1) = tt(0, ih)
675 rsad(0, ih, 1) = rsd(0, ih)
676 rsa(0, ih, 1) = rs(0, ih)
677 tdad(0, ih, 2) = tdd(0, ih)
678 tda(0, ih, 2) = td(0, ih)
679 ttad(0, ih, 2) = ttd(0, ih)
680 tta(0, ih, 2) = tt(0, ih)
681 rsad(0, ih, 2) = rsd(0, ih)
682 rsa(0, ih, 2) = rs(0, ih)
684 denmd = (tsd(k, ih)*(1.-rsa(k-1, ih, 1)*rs(k, ih))-ts(k, ih)*(-(&
685 & rsad(k-1, ih, 1)*rs(k, ih))-rsa(k-1, ih, 1)*rsd(k, ih)))/(1.-&
686 & rsa(k-1, ih, 1)*rs(k, ih))**2
687 denm = ts(k, ih)/(1.-rsa(k-1, ih, 1)*rs(k, ih))
688 tdad(k, ih, 1) = tdad(k-1, ih, 1)*td(k, ih) + tda(k-1, ih, 1)*&
690 tda(k, ih, 1) = tda(k-1, ih, 1)*td(k, ih)
691 ttad(k, ih, 1) = tdad(k-1, ih, 1)*tt(k, ih) + tda(k-1, ih, 1)*&
692 & ttd(k, ih) + ((tdad(k-1, ih, 1)*rr(k, ih)+tda(k-1, ih, 1)*rrd(&
693 & k, ih))*rsa(k-1, ih, 1)+tda(k-1, ih, 1)*rr(k, ih)*rsad(k-1, ih&
694 & , 1)+ttad(k-1, ih, 1)-tdad(k-1, ih, 1))*denm + (tda(k-1, ih, 1&
695 & )*rsa(k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1, ih, 1))*&
697 tta(k, ih, 1) = tda(k-1, ih, 1)*tt(k, ih) + (tda(k-1, ih, 1)*rsa&
698 & (k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1, ih, 1))*denm
699 rsad(k, ih, 1) = rsd(k, ih) + (tsd(k, ih)*denm+ts(k, ih)*denmd)*&
700 & rsa(k-1, ih, 1) + ts(k, ih)*denm*rsad(k-1, ih, 1)
701 rsa(k, ih, 1) = rs(k, ih) + ts(k, ih)*rsa(k-1, ih, 1)*denm
702 tdad(k, ih, 2) = tdad(k, ih, 1)
703 tda(k, ih, 2) = tda(k, ih, 1)
704 ttad(k, ih, 2) = ttad(k, ih, 1)
705 tta(k, ih, 2) = tta(k, ih, 1)
706 rsad(k, ih, 2) = rsad(k, ih, 1)
707 rsa(k, ih, 2) = rsa(k, ih, 1)
714 denmd = (tsd(k, im)*(1.-rsa(k-1, ih, im)*rs(k, im))-ts(k, im)*&
715 & (-(rsad(k-1, ih, im)*rs(k, im))-rsa(k-1, ih, im)*rsd(k, im))&
716 & )/(1.-rsa(k-1, ih, im)*rs(k, im))**2
717 denm = ts(k, im)/(1.-rsa(k-1, ih, im)*rs(k, im))
718 tdad(k, ih, im) = tdad(k-1, ih, im)*td(k, im) + tda(k-1, ih, &
720 tda(k, ih, im) = tda(k-1, ih, im)*td(k, im)
721 ttad(k, ih, im) = tdad(k-1, ih, im)*tt(k, im) + tda(k-1, ih, &
722 & im)*ttd(k, im) + ((tdad(k-1, ih, im)*rr(k, im)+tda(k-1, ih, &
723 & im)*rrd(k, im))*rsa(k-1, ih, im)+tda(k-1, ih, im)*rr(k, im)*&
724 & rsad(k-1, ih, im)+ttad(k-1, ih, im)-tdad(k-1, ih, im))*denm &
725 & + (tda(k-1, ih, im)*rsa(k-1, ih, im)*rr(k, im)+tta(k-1, ih, &
726 & im)-tda(k-1, ih, im))*denmd
727 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, im) + (tda(k-1, ih, im&
728 & )*rsa(k-1, ih, im)*rr(k, im)+tta(k-1, ih, im)-tda(k-1, ih, &
730 rsad(k, ih, im) = rsd(k, im) + (tsd(k, im)*denm+ts(k, im)*&
731 & denmd)*rsa(k-1, ih, im) + ts(k, im)*denm*rsad(k-1, ih, im)
732 rsa(k, ih, im) = rs(k, im) + ts(k, im)*rsa(k-1, ih, im)*denm
750 rrad(np+1, 1, is) = rrd(np+1, is)
751 rra(np+1, 1, is) = rr(np+1, is)
752 rxad(np+1, 1, is) = rsd(np+1, is)
753 rxa(np+1, 1, is) = rs(np+1, is)
754 rrad(np+1, 2, is) = rrd(np+1, is)
755 rra(np+1, 2, is) = rr(np+1, is)
756 rxad(np+1, 2, is) = rsd(np+1, is)
757 rxa(np+1, 2, is) = rs(np+1, is)
759 denmd = (tsd(k, is)*(1.-rs(k, is)*rxa(k+1, 1, is))-ts(k, is)*(-(&
760 & rsd(k, is)*rxa(k+1, 1, is))-rs(k, is)*rxad(k+1, 1, is)))/(1.-&
761 & rs(k, is)*rxa(k+1, 1, is))**2
762 denm = ts(k, is)/(1.-rs(k, is)*rxa(k+1, 1, is))
763 rrad(k, 1, is) = rrd(k, is) + (tdd(k, is)*rra(k+1, 1, is)+td(k, &
764 & is)*rrad(k+1, 1, is)+(ttd(k, is)-tdd(k, is))*rxa(k+1, 1, is)+(&
765 & tt(k, is)-td(k, is))*rxad(k+1, 1, is))*denm + (td(k, is)*rra(k&
766 & +1, 1, is)+(tt(k, is)-td(k, is))*rxa(k+1, 1, is))*denmd
767 rra(k, 1, is) = rr(k, is) + (td(k, is)*rra(k+1, 1, is)+(tt(k, is&
768 & )-td(k, is))*rxa(k+1, 1, is))*denm
769 rxad(k, 1, is) = rsd(k, is) + (tsd(k, is)*denm+ts(k, is)*denmd)*&
770 & rxa(k+1, 1, is) + ts(k, is)*denm*rxad(k+1, 1, is)
771 rxa(k, 1, is) = rs(k, is) + ts(k, is)*rxa(k+1, 1, is)*denm
772 rrad(k, 2, is) = rrad(k, 1, is)
773 rra(k, 2, is) = rra(k, 1, is)
774 rxad(k, 2, is) = rxad(k, 1, is)
775 rxa(k, 2, is) = rxa(k, 1, is)
781 denmd = (tsd(k, im)*(1.-rs(k, im)*rxa(k+1, im, is))-ts(k, im)*&
782 & (-(rsd(k, im)*rxa(k+1, im, is))-rs(k, im)*rxad(k+1, im, is))&
783 & )/(1.-rs(k, im)*rxa(k+1, im, is))**2
784 denm = ts(k, im)/(1.-rs(k, im)*rxa(k+1, im, is))
785 rrad(k, im, is) = rrd(k, im) + (tdd(k, im)*rra(k+1, im, is)+td&
786 & (k, im)*rrad(k+1, im, is)+(ttd(k, im)-tdd(k, im))*rxa(k+1, &
787 & im, is)+(tt(k, im)-td(k, im))*rxad(k+1, im, is))*denm + (td(&
788 & k, im)*rra(k+1, im, is)+(tt(k, im)-td(k, im))*rxa(k+1, im, &
790 rra(k, im, is) = rr(k, im) + (td(k, im)*rra(k+1, im, is)+(tt(k&
791 & , im)-td(k, im))*rxa(k+1, im, is))*denm
792 rxad(k, im, is) = rsd(k, im) + (tsd(k, im)*denm+ts(k, im)*&
793 & denmd)*rxa(k+1, im, is) + ts(k, im)*denm*rxad(k+1, im, is)
794 rxa(k, im, is) = rs(k, im) + ts(k, im)*rxa(k+1, im, is)*denm
816 cmd = chd*(1.0-cc2) - ch*cc2d
820 cmd = chd*cc2 + ch*cc2d
826 ctd = cmd*(1.0-cc3) - cm*cc3d
830 ctd = cmd*cc3 + cm*cc3d
835 denmd = (tsd(k, is)*(1.-rsa(k-1, ih, im)*rs(k, is))-ts(k, is&
836 & )*(-(rsad(k-1, ih, im)*rs(k, is))-rsa(k-1, ih, im)*rsd(k, &
837 & is)))/(1.-rsa(k-1, ih, im)*rs(k, is))**2
838 denm = ts(k, is)/(1.-rsa(k-1, ih, im)*rs(k, is))
839 tdad(k, ih, im) = tdad(k-1, ih, im)*td(k, is) + tda(k-1, ih&
841 tda(k, ih, im) = tda(k-1, ih, im)*td(k, is)
842 ttad(k, ih, im) = tdad(k-1, ih, im)*tt(k, is) + tda(k-1, ih&
843 & , im)*ttd(k, is) + ((tdad(k-1, ih, im)*rr(k, is)+tda(k-1, &
844 & ih, im)*rrd(k, is))*rsa(k-1, ih, im)+tda(k-1, ih, im)*rr(k&
845 & , is)*rsad(k-1, ih, im)+ttad(k-1, ih, im)-tdad(k-1, ih, im&
846 & ))*denm + (tda(k-1, ih, im)*rr(k, is)*rsa(k-1, ih, im)+tta&
847 & (k-1, ih, im)-tda(k-1, ih, im))*denmd
848 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, is) + (tda(k-1, ih, &
849 & im)*rr(k, is)*rsa(k-1, ih, im)+tta(k-1, ih, im)-tda(k-1, &
851 rsad(k, ih, im) = rsd(k, is) + (tsd(k, is)*denm+ts(k, is)*&
852 & denmd)*rsa(k-1, ih, im) + ts(k, is)*denm*rsad(k-1, ih, im)
853 rsa(k, ih, im) = rs(k, is) + ts(k, is)*rsa(k-1, ih, im)*denm
858 denmd = (tsd(k, ih)*(1.-rs(k, ih)*rxa(k+1, im, is))-ts(k, ih&
859 & )*(-(rsd(k, ih)*rxa(k+1, im, is))-rs(k, ih)*rxad(k+1, im, &
860 & is)))/(1.-rs(k, ih)*rxa(k+1, im, is))**2
861 denm = ts(k, ih)/(1.-rs(k, ih)*rxa(k+1, im, is))
862 rrad(k, im, is) = rrd(k, ih) + (tdd(k, ih)*rra(k+1, im, is)+&
863 & td(k, ih)*rrad(k+1, im, is)+(ttd(k, ih)-tdd(k, ih))*rxa(k+&
864 & 1, im, is)+(tt(k, ih)-td(k, ih))*rxad(k+1, im, is))*denm +&
865 & (td(k, ih)*rra(k+1, im, is)+(tt(k, ih)-td(k, ih))*rxa(k+1&
867 rra(k, im, is) = rr(k, ih) + (td(k, ih)*rra(k+1, im, is)+(tt&
868 & (k, ih)-td(k, ih))*rxa(k+1, im, is))*denm
869 rxad(k, im, is) = rsd(k, ih) + (tsd(k, ih)*denm+ts(k, ih)*&
870 & denmd)*rxa(k+1, im, is) + ts(k, ih)*denm*rxad(k+1, im, is)
871 rxa(k, im, is) = rs(k, ih) + ts(k, ih)*rxa(k+1, im, is)*denm
880 denmd = -((-(rsad(k-1, ih, im)*rxa(k, im, is))-rsa(k-1, ih, &
881 & im)*rxad(k, im, is))/(1.-rsa(k-1, ih, im)*rxa(k, im, is))&
883 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
884 fdndird = tdad(k-1, ih, im)
885 fdndir = tda(k-1, ih, im)
886 xx4d = tdad(k-1, ih, im)*rra(k, im, is) + tda(k-1, ih, im)*&
888 xx4 = tda(k-1, ih, im)*rra(k, im, is)
889 yyd = ttad(k-1, ih, im) - tdad(k-1, ih, im)
890 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
891 fdndifd = (xx4d*rsa(k-1, ih, im)+xx4*rsad(k-1, ih, im)+yyd)*&
892 & denm + (xx4*rsa(k-1, ih, im)+yy)*denmd
893 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
894 fupdifd = (xx4d+yyd*rxa(k, im, is)+yy*rxad(k, im, is))*denm &
895 & + (xx4+yy*rxa(k, im, is))*denmd
896 fupdif = (xx4+yy*rxa(k, im, is))*denm
897 flxdnd = fdndird + fdndifd - fupdifd
898 flxdn = fdndir + fdndif - fupdif
901 IF (ih .EQ. 1 .AND. im .EQ. 1 .AND. is .EQ. 1)
THEN 905 fupa(k) = fupa(k) + fupdif*ct
906 falld(k) = falld(k) + flxdnd*ct + flxdn*ctd
907 fall(k) = fall(k) + flxdn*ct
910 fsdir = fsdir + fdndir*ct
911 fsdif = fsdif + fdndif*ct
922 flx_devd(i, k) = flx_devd(i, k) + hk_uv(ib)*falld(k)
923 flx_dev(i, k) = flx_dev(i, k) + fall(k)*hk_uv(ib)
924 flc_dev(i, k) = flc_dev(i, k) + fclr(k)*hk_uv(ib)
925 flxu_dev(i, k) = flxu_dev(i, k) + fupa(k)*hk_uv(ib)
926 flcu_dev(i, k) = flcu_dev(i, k) + fupc(k)*hk_uv(ib)
929 flx_sfc_band_dev(i, ib) = flx_sfc_band_dev(i, ib) + fall(np+1)*hk_uv&
934 fdiruv_dev(i) = fdiruv_dev(i) + fsdir*hk_uv(ib)
935 fdifuv_dev(i) = fdifuv_dev(i) + fsdif*hk_uv(ib)
937 fdirpar_dev(i) = fsdir*hk_uv(ib)
938 fdifpar_dev(i) = fsdif*hk_uv(ib)
946 rr(np+1, 1) = rsirbm_dev
948 rr(np+1, 2) = rsirbm_dev
950 rs(np+1, 1) = rsirdf_dev
952 rs(np+1, 2) = rsirdf_dev
1022 CALL getnirtau1_d(ib, np, cosz_dev(i), dp_pa, fcld_col, fcld_cold, &
1023 & reff_col, reff_cold, cwc_col, cwc_cold, ict, icb, &
1024 & taubeam, taubeamd, taudiff, taudiffd, asycl, asycld, &
1025 & ssacl, ssacld, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, &
1026 & arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, &
1027 & ara_nir, aig_nir, awg_nir, arg_nir, caib, caif, &
1036 IF (k .LT. ict)
THEN 1037 IF (cc1 .LT. fcld_dev(i, k))
THEN 1038 cc1d = fcld_devd(i, k)
1039 cc1 = fcld_dev(i, k)
1043 ELSE IF (k .LT. icb)
THEN 1044 IF (cc2 .LT. fcld_dev(i, k))
THEN 1045 cc2d = fcld_devd(i, k)
1046 cc2 = fcld_dev(i, k)
1050 ELSE IF (cc3 .LT. fcld_dev(i, k))
THEN 1051 cc3d = fcld_devd(i, k)
1052 cc3 = fcld_dev(i, k)
1060 tauclbd(k) = taubeamd(k, 1) + taubeamd(k, 2) + taubeamd(k, 3) + &
1062 tauclb(k) = taubeam(k, 1) + taubeam(k, 2) + taubeam(k, 3) + &
1064 tauclfd(k) = taudiffd(k, 1) + taudiffd(k, 2) + taudiffd(k, 3) + &
1066 tauclf(k) = taudiff(k, 1) + taudiff(k, 2) + taudiff(k, 3) + &
1072 tdd(0, 1) = -(xk_ir(ik)*wvtoad*exp(-(wvtoa*xk_ir(ik)/cosz_dev(i)))&
1074 td(0, 1) = exp(-(wvtoa*xk_ir(ik)/cosz_dev(i)))
1075 tdd(0, 2) = tdd(0, 1)
1078 taurs = ry_ir(ib)*dp(k)
1079 tauwvd = xk_ir(ik)*whd(k)
1080 tauwv = xk_ir(ik)*wh(k)
1083 taustod = tauwvd + taua_devd(i, k, iv)
1084 tausto = taurs + tauwv + taua_dev(i, k, iv) + 1.0e-7
1085 ssataud = ssaa_devd(i, k, iv)
1086 ssatau = ssaa_dev(i, k, iv) + taurs + 1.0e-8
1087 asystod = asya_devd(i, k, iv)
1088 asysto = asya_dev(i, k, iv)
1091 asytobd = (asystod*ssatau-asysto*ssataud)/ssatau**2
1092 asytob = asysto/ssatau
1093 ssatobd = (ssataud*tautob-ssatau*tautobd)/tautob**2
1094 ssatob = ssatau/tautob + 1.0e-8
1095 IF (ssatob .GT. 0.999999)
THEN 1104 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd&
1105 & , cosz_dev(i), rrt, rrtd, ttt, tttd, tdt, tdtd)
1108 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd&
1109 & , dsm, rst, rstd, tst, tstd, dum, dumd)
1123 tautobd = taustod + tauclbd(k)
1124 tautob = tausto + tauclb(k)
1125 ssatobd = ((ssataud+ssacld(k)*tauclb(k)+ssacl(k)*tauclbd(k))*&
1126 & tautob-(ssatau+ssacl(k)*tauclb(k))*tautobd)/tautob**2
1127 ssatob = (ssatau+ssacl(k)*tauclb(k))/tautob + 1.0e-8
1128 IF (ssatob .GT. 0.999999)
THEN 1134 asytobd = ((asystod+(asycld(k)*ssacl(k)+asycl(k)*ssacld(k))*&
1135 & tauclb(k)+asycl(k)*ssacl(k)*tauclbd(k))*ssatob*tautob-(asysto+&
1136 & asycl(k)*ssacl(k)*tauclb(k))*(ssatobd*tautob+ssatob*tautobd))/&
1137 & (ssatob*tautob)**2
1138 asytob = (asysto+asycl(k)*ssacl(k)*tauclb(k))/(ssatob*tautob)
1140 tautofd = taustod + tauclfd(k)
1141 tautof = tausto + tauclf(k)
1142 ssatofd = ((ssataud+ssacld(k)*tauclf(k)+ssacl(k)*tauclfd(k))*&
1143 & tautof-(ssatau+ssacl(k)*tauclf(k))*tautofd)/tautof**2
1144 ssatof = (ssatau+ssacl(k)*tauclf(k))/tautof + 1.0e-8
1145 IF (ssatof .GT. 0.999999)
THEN 1151 asytofd = ((asystod+(asycld(k)*ssacl(k)+asycl(k)*ssacld(k))*&
1152 & tauclf(k)+asycl(k)*ssacl(k)*tauclfd(k))*ssatof*tautof-(asysto+&
1153 & asycl(k)*ssacl(k)*tauclf(k))*(ssatofd*tautof+ssatof*tautofd))/&
1154 & (ssatof*tautof)**2
1155 asytof = (asysto+asycl(k)*ssacl(k)*tauclf(k))/(ssatof*tautof)
1157 CALL deledd_d(tautob, tautobd, ssatob, ssatobd, asytob, asytobd&
1158 & , cosz_dev(i), rrt, rrtd, ttt, tttd, tdt, tdtd)
1161 CALL deledd_d(tautof, tautofd, ssatof, ssatofd, asytof, asytofd&
1162 & , dsm, rst, rstd, tst, tstd, dum, dumd)
1332 tdad(0, ih, 1) = tdd(0, ih)
1333 tda(0, ih, 1) = td(0, ih)
1334 ttad(0, ih, 1) = ttd(0, ih)
1335 tta(0, ih, 1) = tt(0, ih)
1336 rsad(0, ih, 1) = rsd(0, ih)
1337 rsa(0, ih, 1) = rs(0, ih)
1338 tdad(0, ih, 2) = tdd(0, ih)
1339 tda(0, ih, 2) = td(0, ih)
1340 ttad(0, ih, 2) = ttd(0, ih)
1341 tta(0, ih, 2) = tt(0, ih)
1342 rsad(0, ih, 2) = rsd(0, ih)
1343 rsa(0, ih, 2) = rs(0, ih)
1345 denmd = (tsd(k, ih)*(1.-rsa(k-1, ih, 1)*rs(k, ih))-ts(k, ih)*(&
1346 & -(rsad(k-1, ih, 1)*rs(k, ih))-rsa(k-1, ih, 1)*rsd(k, ih)))/(&
1347 & 1.-rsa(k-1, ih, 1)*rs(k, ih))**2
1348 denm = ts(k, ih)/(1.-rsa(k-1, ih, 1)*rs(k, ih))
1349 tdad(k, ih, 1) = tdad(k-1, ih, 1)*td(k, ih) + tda(k-1, ih, 1)*&
1351 tda(k, ih, 1) = tda(k-1, ih, 1)*td(k, ih)
1352 ttad(k, ih, 1) = tdad(k-1, ih, 1)*tt(k, ih) + tda(k-1, ih, 1)*&
1353 & ttd(k, ih) + ((tdad(k-1, ih, 1)*rr(k, ih)+tda(k-1, ih, 1)*&
1354 & rrd(k, ih))*rsa(k-1, ih, 1)+tda(k-1, ih, 1)*rr(k, ih)*rsad(k&
1355 & -1, ih, 1)+ttad(k-1, ih, 1)-tdad(k-1, ih, 1))*denm + (tda(k-&
1356 & 1, ih, 1)*rsa(k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1&
1358 tta(k, ih, 1) = tda(k-1, ih, 1)*tt(k, ih) + (tda(k-1, ih, 1)*&
1359 & rsa(k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1, ih, 1))*&
1361 rsad(k, ih, 1) = rsd(k, ih) + (tsd(k, ih)*denm+ts(k, ih)*denmd&
1362 & )*rsa(k-1, ih, 1) + ts(k, ih)*denm*rsad(k-1, ih, 1)
1363 rsa(k, ih, 1) = rs(k, ih) + ts(k, ih)*rsa(k-1, ih, 1)*denm
1364 tdad(k, ih, 2) = tdad(k, ih, 1)
1365 tda(k, ih, 2) = tda(k, ih, 1)
1366 ttad(k, ih, 2) = ttad(k, ih, 1)
1367 tta(k, ih, 2) = tta(k, ih, 1)
1368 rsad(k, ih, 2) = rsad(k, ih, 1)
1369 rsa(k, ih, 2) = rsa(k, ih, 1)
1376 denmd = (tsd(k, im)*(1.-rsa(k-1, ih, im)*rs(k, im))-ts(k, im&
1377 & )*(-(rsad(k-1, ih, im)*rs(k, im))-rsa(k-1, ih, im)*rsd(k, &
1378 & im)))/(1.-rsa(k-1, ih, im)*rs(k, im))**2
1379 denm = ts(k, im)/(1.-rsa(k-1, ih, im)*rs(k, im))
1380 tdad(k, ih, im) = tdad(k-1, ih, im)*td(k, im) + tda(k-1, ih&
1382 tda(k, ih, im) = tda(k-1, ih, im)*td(k, im)
1383 ttad(k, ih, im) = tdad(k-1, ih, im)*tt(k, im) + tda(k-1, ih&
1384 & , im)*ttd(k, im) + ((tdad(k-1, ih, im)*rr(k, im)+tda(k-1, &
1385 & ih, im)*rrd(k, im))*rsa(k-1, ih, im)+tda(k-1, ih, im)*rr(k&
1386 & , im)*rsad(k-1, ih, im)+ttad(k-1, ih, im)-tdad(k-1, ih, im&
1387 & ))*denm + (tda(k-1, ih, im)*rsa(k-1, ih, im)*rr(k, im)+tta&
1388 & (k-1, ih, im)-tda(k-1, ih, im))*denmd
1389 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, im) + (tda(k-1, ih, &
1390 & im)*rsa(k-1, ih, im)*rr(k, im)+tta(k-1, ih, im)-tda(k-1, &
1392 rsad(k, ih, im) = rsd(k, im) + (tsd(k, im)*denm+ts(k, im)*&
1393 & denmd)*rsa(k-1, ih, im) + ts(k, im)*denm*rsad(k-1, ih, im)
1394 rsa(k, ih, im) = rs(k, im) + ts(k, im)*rsa(k-1, ih, im)*denm
1412 rrad(np+1, 1, is) = rrd(np+1, is)
1413 rra(np+1, 1, is) = rr(np+1, is)
1414 rxad(np+1, 1, is) = rsd(np+1, is)
1415 rxa(np+1, 1, is) = rs(np+1, is)
1416 rrad(np+1, 2, is) = rrd(np+1, is)
1417 rra(np+1, 2, is) = rr(np+1, is)
1418 rxad(np+1, 2, is) = rsd(np+1, is)
1419 rxa(np+1, 2, is) = rs(np+1, is)
1421 denmd = (tsd(k, is)*(1.-rs(k, is)*rxa(k+1, 1, is))-ts(k, is)*(&
1422 & -(rsd(k, is)*rxa(k+1, 1, is))-rs(k, is)*rxad(k+1, 1, is)))/(&
1423 & 1.-rs(k, is)*rxa(k+1, 1, is))**2
1424 denm = ts(k, is)/(1.-rs(k, is)*rxa(k+1, 1, is))
1425 rrad(k, 1, is) = rrd(k, is) + (tdd(k, is)*rra(k+1, 1, is)+td(k&
1426 & , is)*rrad(k+1, 1, is)+(ttd(k, is)-tdd(k, is))*rxa(k+1, 1, &
1427 & is)+(tt(k, is)-td(k, is))*rxad(k+1, 1, is))*denm + (td(k, is&
1428 & )*rra(k+1, 1, is)+(tt(k, is)-td(k, is))*rxa(k+1, 1, is))*&
1430 rra(k, 1, is) = rr(k, is) + (td(k, is)*rra(k+1, 1, is)+(tt(k, &
1431 & is)-td(k, is))*rxa(k+1, 1, is))*denm
1432 rxad(k, 1, is) = rsd(k, is) + (tsd(k, is)*denm+ts(k, is)*denmd&
1433 & )*rxa(k+1, 1, is) + ts(k, is)*denm*rxad(k+1, 1, is)
1434 rxa(k, 1, is) = rs(k, is) + ts(k, is)*rxa(k+1, 1, is)*denm
1435 rrad(k, 2, is) = rrad(k, 1, is)
1436 rra(k, 2, is) = rra(k, 1, is)
1437 rxad(k, 2, is) = rxad(k, 1, is)
1438 rxa(k, 2, is) = rxa(k, 1, is)
1444 denmd = (tsd(k, im)*(1.-rs(k, im)*rxa(k+1, im, is))-ts(k, im&
1445 & )*(-(rsd(k, im)*rxa(k+1, im, is))-rs(k, im)*rxad(k+1, im, &
1446 & is)))/(1.-rs(k, im)*rxa(k+1, im, is))**2
1447 denm = ts(k, im)/(1.-rs(k, im)*rxa(k+1, im, is))
1448 rrad(k, im, is) = rrd(k, im) + (tdd(k, im)*rra(k+1, im, is)+&
1449 & td(k, im)*rrad(k+1, im, is)+(ttd(k, im)-tdd(k, im))*rxa(k+&
1450 & 1, im, is)+(tt(k, im)-td(k, im))*rxad(k+1, im, is))*denm +&
1451 & (td(k, im)*rra(k+1, im, is)+(tt(k, im)-td(k, im))*rxa(k+1&
1453 rra(k, im, is) = rr(k, im) + (td(k, im)*rra(k+1, im, is)+(tt&
1454 & (k, im)-td(k, im))*rxa(k+1, im, is))*denm
1455 rxad(k, im, is) = rsd(k, im) + (tsd(k, im)*denm+ts(k, im)*&
1456 & denmd)*rxa(k+1, im, is) + ts(k, im)*denm*rxad(k+1, im, is)
1457 rxa(k, im, is) = rs(k, im) + ts(k, im)*rxa(k+1, im, is)*denm
1479 cmd = chd*(1.0-cc2) - ch*cc2d
1483 cmd = chd*cc2 + ch*cc2d
1489 ctd = cmd*(1.0-cc3) - cm*cc3d
1493 ctd = cmd*cc3 + cm*cc3d
1498 denmd = (tsd(k, is)*(1.-rsa(k-1, ih, im)*rs(k, is))-ts(k, &
1499 & is)*(-(rsad(k-1, ih, im)*rs(k, is))-rsa(k-1, ih, im)*rsd&
1500 & (k, is)))/(1.-rsa(k-1, ih, im)*rs(k, is))**2
1501 denm = ts(k, is)/(1.-rsa(k-1, ih, im)*rs(k, is))
1502 tdad(k, ih, im) = tdad(k-1, ih, im)*td(k, is) + tda(k-1, &
1503 & ih, im)*tdd(k, is)
1504 tda(k, ih, im) = tda(k-1, ih, im)*td(k, is)
1505 ttad(k, ih, im) = tdad(k-1, ih, im)*tt(k, is) + tda(k-1, &
1506 & ih, im)*ttd(k, is) + ((tdad(k-1, ih, im)*rr(k, is)+tda(k&
1507 & -1, ih, im)*rrd(k, is))*rsa(k-1, ih, im)+tda(k-1, ih, im&
1508 & )*rr(k, is)*rsad(k-1, ih, im)+ttad(k-1, ih, im)-tdad(k-1&
1509 & , ih, im))*denm + (tda(k-1, ih, im)*rr(k, is)*rsa(k-1, &
1510 & ih, im)+tta(k-1, ih, im)-tda(k-1, ih, im))*denmd
1511 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, is) + (tda(k-1, ih&
1512 & , im)*rr(k, is)*rsa(k-1, ih, im)+tta(k-1, ih, im)-tda(k-&
1514 rsad(k, ih, im) = rsd(k, is) + (tsd(k, is)*denm+ts(k, is)*&
1515 & denmd)*rsa(k-1, ih, im) + ts(k, is)*denm*rsad(k-1, ih, &
1517 rsa(k, ih, im) = rs(k, is) + ts(k, is)*rsa(k-1, ih, im)*&
1523 denmd = (tsd(k, ih)*(1.-rs(k, ih)*rxa(k+1, im, is))-ts(k, &
1524 & ih)*(-(rsd(k, ih)*rxa(k+1, im, is))-rs(k, ih)*rxad(k+1, &
1525 & im, is)))/(1.-rs(k, ih)*rxa(k+1, im, is))**2
1526 denm = ts(k, ih)/(1.-rs(k, ih)*rxa(k+1, im, is))
1527 rrad(k, im, is) = rrd(k, ih) + (tdd(k, ih)*rra(k+1, im, is&
1528 & )+td(k, ih)*rrad(k+1, im, is)+(ttd(k, ih)-tdd(k, ih))*&
1529 & rxa(k+1, im, is)+(tt(k, ih)-td(k, ih))*rxad(k+1, im, is)&
1530 & )*denm + (td(k, ih)*rra(k+1, im, is)+(tt(k, ih)-td(k, ih&
1531 & ))*rxa(k+1, im, is))*denmd
1532 rra(k, im, is) = rr(k, ih) + (td(k, ih)*rra(k+1, im, is)+(&
1533 & tt(k, ih)-td(k, ih))*rxa(k+1, im, is))*denm
1534 rxad(k, im, is) = rsd(k, ih) + (tsd(k, ih)*denm+ts(k, ih)*&
1535 & denmd)*rxa(k+1, im, is) + ts(k, ih)*denm*rxad(k+1, im, &
1537 rxa(k, im, is) = rs(k, ih) + ts(k, ih)*rxa(k+1, im, is)*&
1547 denmd = -((-(rsad(k-1, ih, im)*rxa(k, im, is))-rsa(k-1, ih&
1548 & , im)*rxad(k, im, is))/(1.-rsa(k-1, ih, im)*rxa(k, im, &
1550 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
1551 fdndird = tdad(k-1, ih, im)
1552 fdndir = tda(k-1, ih, im)
1553 xx4d = tdad(k-1, ih, im)*rra(k, im, is) + tda(k-1, ih, im)&
1555 xx4 = tda(k-1, ih, im)*rra(k, im, is)
1556 yyd = ttad(k-1, ih, im) - tdad(k-1, ih, im)
1557 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
1558 fdndifd = (xx4d*rsa(k-1, ih, im)+xx4*rsad(k-1, ih, im)+yyd&
1559 & )*denm + (xx4*rsa(k-1, ih, im)+yy)*denmd
1560 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
1561 fupdifd = (xx4d+yyd*rxa(k, im, is)+yy*rxad(k, im, is))*&
1562 & denm + (xx4+yy*rxa(k, im, is))*denmd
1563 fupdif = (xx4+yy*rxa(k, im, is))*denm
1564 flxdnd = fdndird + fdndifd - fupdifd
1565 flxdn = fdndir + fdndif - fupdif
1568 IF (ih .EQ. 1 .AND. im .EQ. 1 .AND. is .EQ. 1)
THEN 1572 fupa(k) = fupa(k) + fupdif*ct
1573 falld(k) = falld(k) + flxdnd*ct + flxdn*ctd
1574 fall(k) = fall(k) + flxdn*ct
1577 fsdir = fsdir + fdndir*ct
1578 fsdif = fsdif + fdndif*ct
1589 flx_devd(i, k) = flx_devd(i, k) + hk_ir(ib, ik)*falld(k)
1590 flx_dev(i, k) = flx_dev(i, k) + fall(k)*hk_ir(ib, ik)
1591 flc_dev(i, k) = flc_dev(i, k) + fclr(k)*hk_ir(ib, ik)
1592 flxu_dev(i, k) = flxu_dev(i, k) + fupa(k)*hk_ir(ib, ik)
1593 flcu_dev(i, k) = flcu_dev(i, k) + fupc(k)*hk_ir(ib, ik)
1596 fdirir_dev(i) = fdirir_dev(i) + fsdir*hk_ir(ib, ik)
1597 fdifir_dev(i) = fdifir_dev(i) + fsdif*hk_ir(ib, ik)
1599 flx_sfc_band_dev(i, iv) = flx_sfc_band_dev(i, iv) + fall(np+1)*&
1614 result1 = sqrt(so2(1))
1616 df(1) = 0.0633*(1.-exp(-(0.000155*result1)))
1619 so2(k+1) = so2(k) + scal(k)*cnt
1621 result1 = sqrt(so2(k+1))
1623 df(k+1) = 0.0633*(1.0-exp(-(0.000155*result1)))
1628 so2(1) = 789.*co2*scal0
1631 so2(k+1) = so2(k) + 789.*co2*scal(k)
1644 x0 =
u1 +
REAL(nu)*du
1645 y0 = w1 +
REAL(nw)*dw
1650 x3 = log10(so2(k)*snt)
1651 IF (x3 .GT. x0)
THEN 1656 x4d = swhd(k)/(swh(k)*log(10.0))
1657 x4 = log10(swh(k)*snt)
1658 IF (x4 .GT. y0)
THEN 1665 ic = int((ulog-x1)/du + 1.)
1666 iw = int((wlog-y1)/dw + 1.)
1667 IF (ic .LT. 2) ic = 2
1668 IF (iw .LT. 2) iw = 2
1669 IF (ic .GT. nu) ic = nu
1670 IF (iw .GT. nw) iw = nw
1671 dc = ulog -
REAL(ic-2)*du -
u1 1673 dd = wlog -
REAL(iw-2)*dw - w1
1674 x2d = (cah(ic-1, iw)-cah(ic-1, iw-1))*ddd/dw
1675 x2 = cah(ic-1, iw-1) + (cah(ic-1, iw)-cah(ic-1, iw-1))/dw*dd
1677 y2 = x2 + (cah(ic, iw-1)-cah(ic-1, iw-1))/du*dc
1678 IF (y2 .LT. 0.0)
THEN 1685 dfd(k) = dfd(k) + 1.5*y2d
1686 df(k) = df(k) + 1.5*y2
1699 x0 =
u1 +
REAL(nx)*du
1700 y0 = w1 +
REAL(ny)*dw
1704 IF (co2*snt .GT. x0)
THEN 1709 x5 = log10(pl_dev(i, k))
1710 IF (x5 .GT. y0)
THEN 1715 ic = int((ulog-x1)/du + 1.)
1716 iw = int((wlog-y1)/dw + 1.)
1717 IF (ic .LT. 2) ic = 2
1718 IF (iw .LT. 2) iw = 2
1719 IF (ic .GT. nx) ic = nx
1720 IF (iw .GT. ny) iw = ny
1721 dc = ulog -
REAL(ic-2)*du -
u1 1722 dd = wlog -
REAL(iw-2)*dw - w1
1723 x2 = coa(ic-1, iw-1) + (coa(ic-1, iw)-coa(ic-1, iw-1))/dw*dd
1724 y2 = x2 + (coa(ic, iw-1)-coa(ic-1, iw-1))/du*dc
1725 IF (y2 .LT. 0.0)
THEN 1731 df(k) = df(k) + 1.5*y2
1736 IF (fcld_dev(i, k) .GT. 0.02 .AND. foundtop .EQ. 0)
THEN 1741 IF (foundtop .EQ. 0) ntop = np + 1
1745 IF (k .GT. ntop)
THEN 1746 xx4d = (flx_devd(i, k)*flx_dev(i, ntop)-flx_dev(i, k)*flx_devd(i, &
1747 & ntop))/flx_dev(i, ntop)**2
1748 xx4 = flx_dev(i, k)/flx_dev(i, ntop)
1749 dfd(k) = dftopd + xx4d*(df(k)-dftop) + xx4*(dfd(k)-dftopd)
1750 df(k) = dftop + xx4*(df(k)-dftop)
1755 IF (df(k) .GT. flx_dev(i, k) - 1.0e-8)
THEN 1756 dfd(k) = flx_devd(i, k)
1757 df(k) = flx_dev(i, k) - 1.0e-8
1762 flx_devd(i, k) = flx_devd(i, k) - dfd(k)
1763 flx_dev(i, k) = flx_dev(i, k) - df(k)
1764 flc_dev(i, k) = flc_dev(i, k) - df(k)
1770 xx4 = flx_dev(i, np+1) + df(np+1)
1771 IF (xx4 .GE. 0.)
THEN 1776 result10 = epsilon(1.0)
1777 IF (abs0 .GT. result10)
THEN 1778 IF (1.0 - df(np+1)/xx4 .GT. 1.)
THEN 1781 x6 = 1.0 - df(np+1)/xx4
1783 IF (x6 .LT. 0.)
THEN 1791 fdirir_dev(i) = xx4*fdirir_dev(i)
1792 fdifir_dev(i) = xx4*fdifir_dev(i)
1793 fdiruv_dev(i) = xx4*fdiruv_dev(i)
1794 fdifuv_dev(i) = xx4*fdifuv_dev(i)
1795 fdirpar_dev(i) = xx4*fdirpar_dev(i)
1796 fdifpar_dev(i) = xx4*fdifpar_dev(i)
1798 flx_sfc_band_dev(i, ib) = xx4*flx_sfc_band_dev(i, ib)
1806 SUBROUTINE deledd_d(tau1, tau1d, ssc1, ssc1d, g01, g01d, cza1, rr1, rr1d&
1807 & , tt1, tt1d, td1, td1d)
1810 INTEGER,
PARAMETER :: real_de=8
1813 REAL*8,
INTENT(IN) :: tau1, ssc1, g01, cza1
1814 REAL*8,
INTENT(IN) :: tau1d, ssc1d, g01d
1816 REAL*8,
INTENT(OUT) :: rr1, tt1, td1
1817 REAL*8,
INTENT(OUT) :: rr1d, tt1d, td1d
1819 REAL*8,
PARAMETER :: zero=0.0_real_de
1820 REAL*8,
PARAMETER :: one=1.0_real_de
1821 REAL*8,
PARAMETER :: two=2.0_real_de
1822 REAL*8,
PARAMETER :: three=3.0_real_de
1823 REAL*8,
PARAMETER :: four=4.0_real_de
1824 REAL*8,
PARAMETER :: fourth=0.25_real_de
1825 REAL*8,
PARAMETER :: seven=7.0_real_de
1826 REAL*8,
PARAMETER :: thresh=1.e-8_real_de
1827 REAL*8 :: tau, ssc, g0, rr, tt, td
1828 REAL*8 :: taud, sscd, g0d, rrd, ttd, tdd
1829 REAL*8 :: zth, ff, xx, taup, sscp, gp, gm1, gm2, gm3, akk, alf1, alf2
1830 REAL*8 :: ffd, xxd, taupd, sscpd, gpd, gm1d, gm2d, gm3d, akkd, alf1d, &
1832 REAL*8 :: all, bll, st7, st8, cll, dll, fll, ell, st1, st2, st3, st4
1833 REAL*8 :: alld, blld, st7d, st8d, clld, dlld, flld, elld, st1d, st2d, &
1858 ffd = g0d*g0 + g0*g0d
1860 xxd = -(ffd*ssc) - ff*sscd
1862 taupd = taud*xx + tau*xxd
1864 sscpd = ((sscd*(one-ff)-ssc*ffd)*xx-ssc*(one-ff)*xxd)/xx**2
1865 sscp = ssc*(one-ff)/xx
1866 gpd = (g0d*(one+g0)-g0*g0d)/(one+g0)**2
1870 gm1d = fourth*(-(sscpd*(four+xx))-sscp*xxd)
1871 gm1 = (seven-sscp*(four+xx))*fourth
1872 gm2d = -(fourth*(sscp*xxd-sscpd*(four-xx)))
1873 gm2 = -((one-sscp*(four-xx))*fourth)
1874 arg1d = (gm1d+gm2d)*(gm1-gm2) + (gm1+gm2)*(gm1d-gm2d)
1875 arg1 = (gm1+gm2)*(gm1-gm2)
1876 IF (arg1 .EQ. 0.0)
THEN 1879 akkd = arg1d/(2.0*sqrt(arg1))
1888 st3d = st7d*st8 + st7*st8d
1890 IF (st3 .GE. 0.)
THEN 1895 IF (abs0 .LT. thresh)
THEN 1897 IF (zth .GT. 1.0) zth = zth - 0.0020
1904 st3d = st7d*st8 + st7*st8d
1907 tdd = -(taupd*exp(-(taup/zth))/zth)
1908 td = exp(-(taup/zth))
1909 gm3d = -(fourth*zth*three*gpd)
1910 gm3 = (two-zth*three*gp)*fourth
1913 alf1d = gm1d - gm3d*xx - gm3*xxd
1915 alf2d = gm2d + gm3d*xx + gm3*xxd
1919 alld = (gm3d-zth*alf2d)*xx*td + (gm3-alf2*zth)*(xxd*td+xx*tdd)
1920 all = (gm3-alf2*zth)*xx*td
1921 blld = (zth*alf1d-gm3d)*xx + (one-gm3+alf1*zth)*xxd
1922 bll = (one-gm3+alf1*zth)*xx
1923 xxd = akkd*gm3 + akk*gm3d
1925 clld = (alf2d+xxd)*st7 + (alf2+xx)*st7d
1927 dlld = (alf2d-xxd)*st8 + (alf2-xx)*st8d
1929 xxd = akkd*(one-gm3) - akk*gm3d
1931 flld = (alf1d+xxd)*st8 + (alf1+xx)*st8d
1933 elld = (alf1d-xxd)*st7 + (alf1-xx)*st7d
1935 st2d = -((akkd*taup+akk*taupd)*exp(-(akk*taup)))
1936 st2 = exp(-(akk*taup))
1937 st4d = st2d*st2 + st2*st2d
1939 st1d = (sscpd*(akk+gm1+(akk-gm1)*st4)*st3-sscp*((akkd+gm1d+(akkd-gm1d)&
1940 & *st4+(akk-gm1)*st4d)*st3+(akk+gm1+(akk-gm1)*st4)*st3d))/((akk+gm1+(&
1941 & akk-gm1)*st4)*st3)**2
1942 st1 = sscp/((akk+gm1+(akk-gm1)*st4)*st3)
1943 rrd = (clld-dlld*st4-dll*st4d-alld*st2-all*st2d)*st1 + (cll-dll*st4-&
1945 rr = (cll-dll*st4-all*st2)*st1
1946 ttd = -(((flld-elld*st4-ell*st4d)*td+(fll-ell*st4)*tdd-blld*st2-bll*&
1947 & st2d)*st1+((fll-ell*st4)*td-bll*st2)*st1d)
1948 tt = -(((fll-ell*st4)*td-bll*st2)*st1)
1949 IF (rr .LT. zero)
THEN 1955 IF (tt .LT. zero)
THEN 1977 SUBROUTINE getvistau1_d(nlevs, cosz, dp, fcld, fcldd, reff, reffd, &
1978 & hydromets, hydrometsd, ict, icb, taubeam, taubeamd, taudiff, taudiffd&
1979 & , asycl, asycld, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, &
1980 & aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir&
1981 & , arg_nir, caib, caif, cons_grav)
1986 INTEGER,
INTENT(IN) :: nlevs
1988 REAL*8,
INTENT(IN) :: cosz
1990 REAL*8,
INTENT(IN) :: dp(nlevs)
1992 REAL*8,
INTENT(IN) :: fcld(nlevs)
1993 REAL*8,
INTENT(IN) :: fcldd(nlevs)
1995 REAL*8,
INTENT(IN) :: reff(nlevs, 4)
1996 REAL*8,
INTENT(IN) :: reffd(nlevs, 4)
1998 REAL*8,
INTENT(IN) :: hydromets(nlevs, 4)
1999 REAL*8,
INTENT(IN) :: hydrometsd(nlevs, 4)
2001 INTEGER,
INTENT(IN) :: ict, icb
2010 REAL*8,
INTENT(OUT) :: taubeam(nlevs, 4)
2011 REAL*8,
INTENT(OUT) :: taubeamd(nlevs, 4)
2013 REAL*8,
INTENT(OUT) :: taudiff(nlevs, 4)
2014 REAL*8,
INTENT(OUT) :: taudiffd(nlevs, 4)
2016 REAL*8,
INTENT(OUT) :: asycl(nlevs)
2017 REAL*8,
INTENT(OUT) :: asycld(nlevs)
2039 INTEGER :: k, in, im, it, ia, kk
2040 REAL*8 :: fm, ft, fa, xai, tauc, asyclt
2041 REAL*8 :: ftd, fad, xaid, taucd, asycltd
2044 REAL*8 :: taucld1, taucld2, taucld3, taucld4
2045 REAL*8 :: taucld1d, taucld2d, taucld3d, taucld4d
2046 REAL*8 :: g1, g2, g3, g4
2047 REAL*8 :: g1d, g2d, g3d, g4d
2049 REAL*8 :: reff_snowd
2050 INTEGER,
PARAMETER :: nm=11, nt=9, na=11
2051 REAL*8,
PARAMETER :: dm=0.1, dt=0.30103, da=0.1, t1=-0.9031
2052 REAL*8,
INTENT(IN) :: aig_uv(3), awg_uv(3), arg_uv(3)
2053 REAL*8,
INTENT(IN) :: aib_uv, awb_uv(2), arb_uv(2)
2054 REAL*8,
INTENT(IN) :: aib_nir, awb_nir(3, 2), arb_nir(3, 2)
2055 REAL*8,
INTENT(IN) :: aia_nir(3, 3), awa_nir(3, 3), ara_nir(3, 3)
2056 REAL*8,
INTENT(IN) :: aig_nir(3, 3), awg_nir(3, 3), arg_nir(3, 3)
2057 REAL*8,
INTENT(IN) :: caib(11, 9, 11), caif(9, 11)
2058 REAL*8,
INTENT(IN) :: cons_grav
2066 IF (ict .NE. 0)
THEN 2078 IF (cc(1) .LT. fcld(k))
THEN 2086 IF (cc(2) .LT. fcld(k))
THEN 2094 IF (cc(3) .LT. fcld(k))
THEN 2118 IF (reff(k, 1) .LE. 0.)
THEN 2122 taucld1d = (dp(k)*1.0e3*aib_uv*hydrometsd(k, 1)*reff(k, 1)/&
2123 & cons_grav-dp(k)*1.0e3*hydromets(k, 1)*aib_uv*reffd(k, 1)/&
2124 & cons_grav)/reff(k, 1)**2
2125 taucld1 = dp(k)*1.0e3/cons_grav*hydromets(k, 1)*aib_uv/reff(k, 1)
2127 IF (reff(k, 2) .LE. 0.)
THEN 2131 taucld2d = dp(k)*1.0e3*(hydrometsd(k, 2)*(awb_uv(1)+awb_uv(2)/reff&
2132 & (k, 2))-hydromets(k, 2)*awb_uv(2)*reffd(k, 2)/reff(k, 2)**2)/&
2134 taucld2 = dp(k)*1.0e3/cons_grav*hydromets(k, 2)*(awb_uv(1)+awb_uv(&
2137 taucld3d = dp(k)*1.0e3*arb_uv(1)*hydrometsd(k, 3)/cons_grav
2138 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_uv(1)
2139 IF (reff(k, 4) .GT. 112.0)
THEN 2143 reff_snowd = reffd(k, 4)
2144 reff_snow = reff(k, 4)
2146 IF (reff_snow .LE. 0.)
THEN 2150 taucld4d = (dp(k)*1.0e3*aib_uv*hydrometsd(k, 4)*reff_snow/&
2151 & cons_grav-dp(k)*1.0e3*hydromets(k, 4)*aib_uv*reff_snowd/&
2152 & cons_grav)/reff_snow**2
2153 taucld4 = dp(k)*1.0e3/cons_grav*hydromets(k, 4)*aib_uv/reff_snow
2155 IF (ict .NE. 0)
THEN 2164 IF (k .LT. ict)
THEN 2166 ELSE IF (k .GE. ict .AND. k .LT. icb)
THEN 2171 taucd = taucld1d + taucld2d + taucld3d + taucld4d
2172 tauc = taucld1 + taucld2 + taucld3 + taucld4
2173 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 2175 fad = (fcldd(k)*cc(kk)-fcld(k)*ccd(kk))/cc(kk)**2
2177 IF (tauc .GT. 32.)
THEN 2184 ftd = taucd/(tauc*log(10.0))/dt
2185 ft = (log10(tauc)-t1)/dt
2206 IF (im .GT. nm - 1)
THEN 2211 IF (it .GT. nt - 1)
THEN 2216 IF (ia .GT. na - 1)
THEN 2221 fm = fm -
REAL(im - 1)
2222 ft = ft -
REAL(it - 1)
2223 fa = fa -
REAL(ia - 1)
2228 xai = (-(caib(im-1, it, ia)*(1.-fm))+caib(im+1, it, ia)*(1.+fm))&
2229 & *fm*.5 + caib(im, it, ia)*(1.-fm*fm)
2230 xaid = .5*((caib(im, it-1, ia)*ftd+caib(im, it+1, ia)*ftd)*ft+(-&
2231 & (caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(1.+ft))*ftd) &
2232 & + caib(im, it, ia)*(-(ftd*ft)-ft*ftd)
2233 xai = xai + (-(caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(&
2234 & 1.+ft))*ft*.5 + caib(im, it, ia)*(1.-ft*ft)
2235 xaid = xaid + .5*((caib(im, it, ia-1)*fad+caib(im, it, ia+1)*fad&
2236 & )*fa+(-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(1.+fa)&
2237 & )*fad) + caib(im, it, ia)*(-(fad*fa)-fa*fad)
2238 xai = xai + (-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(&
2239 & 1.+fa))*fa*.5 + caib(im, it, ia)*(1.-fa*fa)
2240 xai = xai - 2.*caib(im, it, ia)
2241 IF (xai .LT. 0.0)
THEN 2247 IF (xai .GT. 1.0)
THEN 2253 taubeamd(k, 1) = taucld1d*xai + taucld1*xaid
2254 taubeam(k, 1) = taucld1*xai
2255 taubeamd(k, 2) = taucld2d*xai + taucld2*xaid
2256 taubeam(k, 2) = taucld2*xai
2257 taubeamd(k, 3) = taucld3d*xai + taucld3*xaid
2258 taubeam(k, 3) = taucld3*xai
2259 taubeamd(k, 4) = taucld4d*xai + taucld4*xaid
2260 taubeam(k, 4) = taucld4*xai
2265 xaid = .5*((caif(it-1, ia)*ftd+caif(it+1, ia)*ftd)*ft+(-(caif(it&
2266 & -1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ftd) + caif(it, ia)*(&
2268 xai = (-(caif(it-1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ft*.5 +&
2269 & caif(it, ia)*(1.-ft*ft)
2270 xaid = xaid + .5*((caif(it, ia-1)*fad+caif(it, ia+1)*fad)*fa+(-(&
2271 & caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*fad) + caif(it&
2272 & , ia)*(-(fad*fa)-fa*fad)
2273 xai = xai + (-(caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*&
2274 & fa*.5 + caif(it, ia)*(1.-fa*fa)
2275 xai = xai - caif(it, ia)
2276 IF (xai .LT. 0.0)
THEN 2282 IF (xai .GT. 1.0)
THEN 2288 taudiffd(k, 1) = taucld1d*xai + taucld1*xaid
2289 taudiff(k, 1) = taucld1*xai
2290 taudiffd(k, 2) = taucld2d*xai + taucld2*xaid
2291 taudiff(k, 2) = taucld2*xai
2292 taudiffd(k, 3) = taucld3d*xai + taucld3*xaid
2293 taudiff(k, 3) = taucld3*xai
2294 taudiffd(k, 4) = taucld4d*xai + taucld4*xaid
2295 taudiff(k, 4) = taucld4*xai
2299 taubeamd(k, 1) = taucld1d
2300 taubeam(k, 1) = taucld1
2301 taubeamd(k, 2) = taucld2d
2302 taubeam(k, 2) = taucld2
2303 taubeamd(k, 3) = taucld3d
2304 taubeam(k, 3) = taucld3
2305 taubeamd(k, 4) = taucld4d
2306 taubeam(k, 4) = taucld4
2307 taudiffd(k, 1) = taucld1d
2308 taudiff(k, 1) = taucld1
2309 taudiffd(k, 2) = taucld2d
2310 taudiff(k, 2) = taucld2
2311 taudiffd(k, 3) = taucld3d
2312 taudiff(k, 3) = taucld3
2313 taudiffd(k, 4) = taucld4d
2314 taudiff(k, 4) = taucld4
2319 taucd = taucld1d + taucld2d + taucld3d + taucld4d
2320 tauc = taucld1 + taucld2 + taucld3 + taucld4
2321 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 2322 g1d = (aig_uv(3)*reffd(k, 1)*reff(k, 1)+(aig_uv(2)+aig_uv(3)*reff(&
2323 & k, 1))*reffd(k, 1))*taucld1 + (aig_uv(1)+(aig_uv(2)+aig_uv(3)*&
2324 & reff(k, 1))*reff(k, 1))*taucld1d
2325 g1 = (aig_uv(1)+(aig_uv(2)+aig_uv(3)*reff(k, 1))*reff(k, 1))*&
2327 g2d = (awg_uv(3)*reffd(k, 2)*reff(k, 2)+(awg_uv(2)+awg_uv(3)*reff(&
2328 & k, 2))*reffd(k, 2))*taucld2 + (awg_uv(1)+(awg_uv(2)+awg_uv(3)*&
2329 & reff(k, 2))*reff(k, 2))*taucld2d
2330 g2 = (awg_uv(1)+(awg_uv(2)+awg_uv(3)*reff(k, 2))*reff(k, 2))*&
2332 g3d = arg_uv(1)*taucld3d
2333 g3 = arg_uv(1)*taucld3
2334 g4d = (aig_uv(3)*reff_snowd*reff_snow+(aig_uv(2)+aig_uv(3)*&
2335 & reff_snow)*reff_snowd)*taucld4 + (aig_uv(1)+(aig_uv(2)+aig_uv(3)&
2336 & *reff_snow)*reff_snow)*taucld4d
2337 g4 = (aig_uv(1)+(aig_uv(2)+aig_uv(3)*reff_snow)*reff_snow)*taucld4
2338 asycltd = ((g1d+g2d+g3d+g4d)*tauc-(g1+g2+g3+g4)*taucd)/tauc**2
2339 asyclt = (g1+g2+g3+g4)/tauc
2353 SUBROUTINE getnirtau1_d(ib, nlevs, cosz, dp, fcld, fcldd, reff, reffd, &
2354 & hydromets, hydrometsd, ict, icb, taubeam, taubeamd, taudiff, taudiffd&
2355 & , asycl, asycld, ssacl, ssacld, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv&
2356 & , arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, &
2357 & aig_nir, awg_nir, arg_nir, caib, caif, cons_grav)
2361 INTEGER,
INTENT(IN) :: ib
2363 INTEGER,
INTENT(IN) :: nlevs
2365 REAL*8,
INTENT(IN) :: cosz
2367 REAL*8,
INTENT(IN) :: dp(nlevs)
2369 REAL*8,
INTENT(IN) :: fcld(nlevs)
2370 REAL*8,
INTENT(IN) :: fcldd(nlevs)
2372 REAL*8,
INTENT(IN) :: reff(nlevs, 4)
2373 REAL*8,
INTENT(IN) :: reffd(nlevs, 4)
2375 REAL*8,
INTENT(IN) :: hydromets(nlevs, 4)
2376 REAL*8,
INTENT(IN) :: hydrometsd(nlevs, 4)
2378 INTEGER,
INTENT(IN) :: ict, icb
2379 REAL*8,
INTENT(IN) :: aig_uv(3), awg_uv(3), arg_uv(3)
2380 REAL*8,
INTENT(IN) :: aib_uv, awb_uv(2), arb_uv(2)
2381 REAL*8,
INTENT(IN) :: aib_nir, awb_nir(3, 2), arb_nir(3, 2)
2382 REAL*8,
INTENT(IN) :: aia_nir(3, 3), awa_nir(3, 3), ara_nir(3, 3)
2383 REAL*8,
INTENT(IN) :: aig_nir(3, 3), awg_nir(3, 3), arg_nir(3, 3)
2384 REAL*8,
INTENT(IN) :: caib(11, 9, 11), caif(9, 11)
2385 REAL*8,
INTENT(IN) :: cons_grav
2388 REAL*8,
INTENT(OUT) :: taubeam(nlevs, 4)
2389 REAL*8,
INTENT(OUT) :: taubeamd(nlevs, 4)
2391 REAL*8,
INTENT(OUT) :: taudiff(nlevs, 4)
2392 REAL*8,
INTENT(OUT) :: taudiffd(nlevs, 4)
2394 REAL*8,
INTENT(OUT) :: ssacl(nlevs)
2395 REAL*8,
INTENT(OUT) :: ssacld(nlevs)
2397 REAL*8,
INTENT(OUT) :: asycl(nlevs)
2398 REAL*8,
INTENT(OUT) :: asycld(nlevs)
2399 INTEGER :: k, in, im, it, ia, kk
2400 REAL*8 :: fm, ft, fa, xai, tauc, asyclt, ssaclt
2401 REAL*8 :: ftd, fad, xaid, taucd, asycltd, ssacltd
2404 REAL*8 :: taucld1, taucld2, taucld3, taucld4
2405 REAL*8 :: taucld1d, taucld2d, taucld3d, taucld4d
2406 REAL*8 :: g1, g2, g3, g4
2407 REAL*8 :: g1d, g2d, g3d, g4d
2408 REAL*8 :: w1, w2, w3, w4
2409 REAL*8 :: w1d, w2d, w3d, w4d
2411 REAL*8 :: reff_snowd
2412 INTEGER,
PARAMETER :: nm=11, nt=9, na=11
2413 REAL*8,
PARAMETER :: dm=0.1, dt=0.30103, da=0.1, t1=-0.9031
2421 IF (ict .NE. 0)
THEN 2433 IF (cc(1) .LT. fcld(k))
THEN 2441 IF (cc(2) .LT. fcld(k))
THEN 2449 IF (cc(3) .LT. fcld(k))
THEN 2469 IF (reff(k, 1) .LE. 0.)
THEN 2473 taucld1d = (dp(k)*1.0e3*aib_nir*hydrometsd(k, 1)*reff(k, 1)/&
2474 & cons_grav-dp(k)*1.0e3*hydromets(k, 1)*aib_nir*reffd(k, 1)/&
2475 & cons_grav)/reff(k, 1)**2
2476 taucld1 = dp(k)*1.0e3/cons_grav*hydromets(k, 1)*aib_nir/reff(k, 1)
2478 IF (reff(k, 2) .LE. 0.)
THEN 2482 taucld2d = dp(k)*1.0e3*(hydrometsd(k, 2)*(awb_nir(ib, 1)+awb_nir(&
2483 & ib, 2)/reff(k, 2))-hydromets(k, 2)*awb_nir(ib, 2)*reffd(k, 2)/&
2484 & reff(k, 2)**2)/cons_grav
2485 taucld2 = dp(k)*1.0e3/cons_grav*hydromets(k, 2)*(awb_nir(ib, 1)+&
2486 & awb_nir(ib, 2)/reff(k, 2))
2488 taucld3d = dp(k)*1.0e3*arb_nir(ib, 1)*hydrometsd(k, 3)/cons_grav
2489 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_nir(ib, 1)
2490 IF (reff(k, 4) .GT. 112.0)
THEN 2494 reff_snowd = reffd(k, 4)
2495 reff_snow = reff(k, 4)
2497 IF (reff_snow .LE. 0.)
THEN 2501 taucld4d = (dp(k)*1.0e3*aib_nir*hydrometsd(k, 4)*reff_snow/&
2502 & cons_grav-dp(k)*1.0e3*hydromets(k, 4)*aib_nir*reff_snowd/&
2503 & cons_grav)/reff_snow**2
2504 taucld4 = dp(k)*1.0e3/cons_grav*hydromets(k, 4)*aib_nir/reff_snow
2506 IF (ict .NE. 0)
THEN 2515 IF (k .LT. ict)
THEN 2517 ELSE IF (k .GE. ict .AND. k .LT. icb)
THEN 2522 taucd = taucld1d + taucld2d + taucld3d + taucld4d
2523 tauc = taucld1 + taucld2 + taucld3 + taucld4
2524 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 2526 IF (cc(kk) .NE. 0.0)
THEN 2527 fad = (fcldd(k)*cc(kk)-fcld(k)*ccd(kk))/cc(kk)**2
2533 IF (tauc .GT. 32.)
THEN 2540 ftd = taucd/(tauc*log(10.0))/dt
2541 ft = (log10(tauc)-t1)/dt
2562 IF (im .GT. nm - 1)
THEN 2567 IF (it .GT. nt - 1)
THEN 2572 IF (ia .GT. na - 1)
THEN 2577 fm = fm -
REAL(im - 1)
2578 ft = ft -
REAL(it - 1)
2579 fa = fa -
REAL(ia - 1)
2584 xai = (-(caib(im-1, it, ia)*(1.-fm))+caib(im+1, it, ia)*(1.+fm))&
2585 & *fm*.5 + caib(im, it, ia)*(1.-fm*fm)
2586 xaid = .5*((caib(im, it-1, ia)*ftd+caib(im, it+1, ia)*ftd)*ft+(-&
2587 & (caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(1.+ft))*ftd) &
2588 & + caib(im, it, ia)*(-(ftd*ft)-ft*ftd)
2589 xai = xai + (-(caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(&
2590 & 1.+ft))*ft*.5 + caib(im, it, ia)*(1.-ft*ft)
2591 xaid = xaid + .5*((caib(im, it, ia-1)*fad+caib(im, it, ia+1)*fad&
2592 & )*fa+(-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(1.+fa)&
2593 & )*fad) + caib(im, it, ia)*(-(fad*fa)-fa*fad)
2594 xai = xai + (-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(&
2595 & 1.+fa))*fa*.5 + caib(im, it, ia)*(1.-fa*fa)
2596 xai = xai - 2.*caib(im, it, ia)
2597 IF (xai .LT. 0.0)
THEN 2603 IF (xai .GT. 1.0)
THEN 2609 taubeamd(k, 1) = taucld1d*xai + taucld1*xaid
2610 taubeam(k, 1) = taucld1*xai
2611 taubeamd(k, 2) = taucld2d*xai + taucld2*xaid
2612 taubeam(k, 2) = taucld2*xai
2613 taubeamd(k, 3) = taucld3d*xai + taucld3*xaid
2614 taubeam(k, 3) = taucld3*xai
2615 taubeamd(k, 4) = taucld4d*xai + taucld4*xaid
2616 taubeam(k, 4) = taucld4*xai
2621 xaid = .5*((caif(it-1, ia)*ftd+caif(it+1, ia)*ftd)*ft+(-(caif(it&
2622 & -1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ftd) + caif(it, ia)*(&
2624 xai = (-(caif(it-1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ft*.5 +&
2625 & caif(it, ia)*(1.-ft*ft)
2626 xaid = xaid + .5*((caif(it, ia-1)*fad+caif(it, ia+1)*fad)*fa+(-(&
2627 & caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*fad) + caif(it&
2628 & , ia)*(-(fad*fa)-fa*fad)
2629 xai = xai + (-(caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*&
2630 & fa*.5 + caif(it, ia)*(1.-fa*fa)
2631 xai = xai - caif(it, ia)
2632 IF (xai .LT. 0.0)
THEN 2638 IF (xai .GT. 1.0)
THEN 2644 taudiffd(k, 1) = taucld1d*xai + taucld1*xaid
2645 taudiff(k, 1) = taucld1*xai
2646 taudiffd(k, 2) = taucld2d*xai + taucld2*xaid
2647 taudiff(k, 2) = taucld2*xai
2648 taudiffd(k, 3) = taucld3d*xai + taucld3*xaid
2649 taudiff(k, 3) = taucld3*xai
2650 taudiffd(k, 4) = taucld4d*xai + taucld4*xaid
2651 taudiff(k, 4) = taucld4*xai
2655 taubeamd(k, 1) = taucld1d
2656 taubeam(k, 1) = taucld1
2657 taubeamd(k, 2) = taucld2d
2658 taubeam(k, 2) = taucld2
2659 taubeamd(k, 3) = taucld3d
2660 taubeam(k, 3) = taucld3
2661 taubeamd(k, 4) = taucld4d
2662 taubeam(k, 4) = taucld4
2663 taudiffd(k, 1) = taucld1d
2664 taudiff(k, 1) = taucld1
2665 taudiffd(k, 2) = taucld2d
2666 taudiff(k, 2) = taucld2
2667 taudiffd(k, 3) = taucld3d
2668 taudiff(k, 3) = taucld3
2669 taudiffd(k, 4) = taucld4d
2670 taudiff(k, 4) = taucld4
2677 taucd = taucld1d + taucld2d + taucld3d + taucld4d
2678 tauc = taucld1 + taucld2 + taucld3 + taucld4
2679 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 2680 w1d = (-(aia_nir(ib, 3)*reffd(k, 1)*reff(k, 1))-(aia_nir(ib, 2)+&
2681 & aia_nir(ib, 3)*reff(k, 1))*reffd(k, 1))*taucld1 + (1.-(aia_nir(&
2682 & ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff(k, 1))*reff(k, 1)))*&
2684 w1 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff(k, 1)&
2685 & )*reff(k, 1)))*taucld1
2686 w2d = (-(awa_nir(ib, 3)*reffd(k, 2)*reff(k, 2))-(awa_nir(ib, 2)+&
2687 & awa_nir(ib, 3)*reff(k, 2))*reffd(k, 2))*taucld2 + (1.-(awa_nir(&
2688 & ib, 1)+(awa_nir(ib, 2)+awa_nir(ib, 3)*reff(k, 2))*reff(k, 2)))*&
2690 w2 = (1.-(awa_nir(ib, 1)+(awa_nir(ib, 2)+awa_nir(ib, 3)*reff(k, 2)&
2691 & )*reff(k, 2)))*taucld2
2692 w3d = (1.-ara_nir(ib, 1))*taucld3d
2693 w3 = (1.-ara_nir(ib, 1))*taucld3
2694 w4d = (-(aia_nir(ib, 3)*reff_snowd*reff_snow)-(aia_nir(ib, 2)+&
2695 & aia_nir(ib, 3)*reff_snow)*reff_snowd)*taucld4 + (1.-(aia_nir(ib&
2696 & , 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff_snow)*reff_snow))*&
2698 w4 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff_snow)&
2699 & *reff_snow))*taucld4
2700 ssacltd = ((w1d+w2d+w3d+w4d)*tauc-(w1+w2+w3+w4)*taucd)/tauc**2
2701 ssaclt = (w1+w2+w3+w4)/tauc
2702 g1d = (aig_nir(ib, 3)*reffd(k, 1)*reff(k, 1)+(aig_nir(ib, 2)+&
2703 & aig_nir(ib, 3)*reff(k, 1))*reffd(k, 1))*w1 + (aig_nir(ib, 1)+(&
2704 & aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 1))*reff(k, 1))*w1d
2705 g1 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 1))*&
2707 g2d = (awg_nir(ib, 3)*reffd(k, 2)*reff(k, 2)+(awg_nir(ib, 2)+&
2708 & awg_nir(ib, 3)*reff(k, 2))*reffd(k, 2))*w2 + (awg_nir(ib, 1)+(&
2709 & awg_nir(ib, 2)+awg_nir(ib, 3)*reff(k, 2))*reff(k, 2))*w2d
2710 g2 = (awg_nir(ib, 1)+(awg_nir(ib, 2)+awg_nir(ib, 3)*reff(k, 2))*&
2712 g3d = arg_nir(ib, 1)*w3d
2713 g3 = arg_nir(ib, 1)*w3
2714 g4d = (aig_nir(ib, 3)*reffd(k, 4)*reff(k, 4)+(aig_nir(ib, 2)+&
2715 & aig_nir(ib, 3)*reff(k, 4))*reffd(k, 4))*w4 + (aig_nir(ib, 1)+(&
2716 & aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 4))*reff(k, 4))*w4d
2717 g4 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 4))*&
2719 IF (w1 + w2 + w3 + w4 .NE. 0.0)
THEN 2720 asycltd = ((g1d+g2d+g3d+g4d)*(w1+w2+w3+w4)-(g1+g2+g3+g4)*(w1d+&
2721 & w2d+w3d+w4d))/(w1+w2+w3+w4)**2
2722 asyclt = (g1+g2+g3+g4)/(w1+w2+w3+w4)
subroutine, public sorad_d(m, np, nb, cosz_dev, pl_dev, ta_dev, ta_devd, wa_dev, wa_devd, oa_dev, oa_devd, co2, cwc_dev, cwc_devd, fcld_dev, fcld_devd, ict, icb, reff_dev, reff_devd, hk_uv, hk_ir, taua_dev, taua_devd, ssaa_dev, ssaa_devd, asya_dev, asya_devd, rsuvbm_dev, rsuvdf_dev, rsirbm_dev, rsirdf_dev, flx_dev, flx_devd, cons_grav, wk_uv, zk_uv, ry_uv, xk_ir, ry_ir, cah, coa, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, arg_nir, caib, caif)
real(kind=kind_real), parameter u1
subroutine getnirtau1_d(ib, nlevs, cosz, dp, fcld, fcldd, reff, reffd, hydromets, hydrometsd, ict, icb, taubeam, taubeamd, taudiff, taudiffd, asycl, asycld, ssacl, ssacld, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, arg_nir, caib, caif, cons_grav)
subroutine deledd_d(tau1, tau1d, ssc1, ssc1d, g01, g01d, cza1, rr1, rr1d, tt1, tt1d, td1, td1d)
subroutine getvistau1_d(nlevs, cosz, dp, fcld, fcldd, reff, reffd, hydromets, hydrometsd, ict, icb, taubeam, taubeamd, taudiff, taudiffd, asycl, asycld, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, arg_nir, caib, caif, cons_grav)