12 SUBROUTINE sorad_b(m, np, nb, cosz_dev, pl_dev, ta_dev, ta_devb, wa_dev&
13 & , wa_devb, oa_dev, oa_devb, co2, cwc_dev, cwc_devb, fcld_dev, &
14 & fcld_devb, ict, icb, reff_dev, reff_devb, hk_uv, hk_ir, taua_dev, &
15 & taua_devb, ssaa_dev, ssaa_devb, asya_dev, asya_devb, rsuvbm_dev, &
16 & rsuvdf_dev, rsirbm_dev, rsirdf_dev, flx_dev, flx_devb, 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_devb(m, np), wa_devb(m, np), oa_devb(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_devb(m, np, 4), fcld_devb(m, np), reff_devb(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_devb(m, np, nb)
45 REAL*8 :: ssaa_dev(m, np, nb)
46 REAL*8 :: ssaa_devb(m, np, nb)
47 REAL*8 :: asya_dev(m, np, nb)
48 REAL*8 :: asya_devb(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_devb(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 :: whb(np), ohb(np)
74 REAL*8 :: swh(np+1), so2(np+1), df(0:np+1)
75 REAL*8 :: swhb(np+1), dfb(0:np+1)
76 REAL*8 :: scal0, wvtoa, o3toa, pa
77 REAL*8 :: wvtoab, o3toab
78 REAL*8 :: snt, cnt, x, xx4, xtoa
82 REAL*8 :: w1, dw,
u1, du
84 REAL*8 :: tauclb(np), tauclf(np), asycl(np)
85 REAL*8 :: tauclbb(np), tauclfb(np), asyclb(np)
86 REAL*8 :: taubeam(np, 4), taudiff(np, 4)
87 REAL*8 :: taubeamb(np, 4), taudiffb(np, 4)
88 REAL*8 :: fcld_col(np)
89 REAL*8 :: fcld_colb(np)
90 REAL*8 :: cwc_col(np, 4)
91 REAL*8 :: cwc_colb(np, 4)
92 REAL*8 :: reff_col(np, 4)
93 REAL*8 :: reff_colb(np, 4)
94 REAL*8 :: taurs, tauoz, tauwv
95 REAL*8 :: tauozb, tauwvb
96 REAL*8 :: tausto, ssatau, asysto
97 REAL*8 :: taustob, ssataub, asystob
98 REAL*8 :: tautob, ssatob, asytob
99 REAL*8 :: tautobb, ssatobb, asytobb
100 REAL*8 :: tautof, ssatof, asytof
101 REAL*8 :: tautofb, ssatofb, asytofb
102 REAL*8 :: rr(0:np+1, 2), tt(0:np+1, 2), td(0:np+1, 2)
103 REAL*8 :: rrb(0:np+1, 2), ttb(0:np+1, 2), tdb(0:np+1, 2)
104 REAL*8 :: rs(0:np+1, 2), ts(0:np+1, 2)
105 REAL*8 :: rsb(0:np+1, 2), tsb(0:np+1, 2)
106 REAL*8 :: fall(np+1), fclr(np+1), fsdir, fsdif
107 REAL*8 :: fallb(np+1)
108 REAL*8 :: fupa(np+1), fupc(np+1)
109 REAL*8 :: cc1, cc2, cc3
110 REAL*8 :: cc1b, cc2b, cc3b
111 REAL*8 :: rrt, ttt, tdt, rst, tst
112 REAL*8 :: rrtb, tttb, tdtb, rstb, tstb
118 REAL*8 :: ulog, wlog, dc, dd, x0, x1, x2, y0, y1, y2, du2, dw2
119 REAL*8 :: wlogb, ddb, x2b, y2b
126 REAL*8 :: rra(0:np+1, 2, 2), tta(0:np, 2, 2)
127 REAL*8 :: rrab(0:np+1, 2, 2), ttab(0:np, 2, 2)
128 REAL*8 :: tda(0:np, 2, 2)
129 REAL*8 :: tdab(0:np, 2, 2)
130 REAL*8 :: rsa(0:np, 2, 2), rxa(0:np+1, 2, 2)
131 REAL*8 :: rsab(0:np, 2, 2), rxab(0:np+1, 2, 2)
135 REAL*8 :: fdndir, fdndif, fupdif
136 REAL*8 :: fdndirb, fdndifb, fupdifb
141 REAL*8 :: chb, cmb, ctb
146 INTEGER :: ii, jj, irhp1, an
271 snt = 1.0/cosz_dev(i)
272 IF (pl_dev(i, 1) .LT. 1.e-3)
THEN 277 scal0 = xtoa*(0.5*xtoa/300.)**.8
278 o3toa = 1.02*oa_dev(i, 1)*xtoa*466.7 + 1.0e-8
279 wvtoa = 1.02*wa_dev(i, 1)*scal0*(1.0+0.00135*(ta_dev(i, 1)-240.)) + &
285 dp(k) = pl_dev(i, k+1) - pl_dev(i, k)
287 dp_pa(k) = dp(k)*100.
291 pa = 0.5*(pl_dev(i, k)+pl_dev(i, k+1))
292 scal(k) = dp(k)*(pa/300.)**.8
293 wh(k) = 1.02*wa_dev(i, k)*scal(k)*(1.+0.00135*(ta_dev(i, k)-240.)) +&
295 swh(k+1) = swh(k) + wh(k)
299 oh(k) = 1.02*oa_dev(i, k)*dp(k)*466.7 + 1.e-8
301 fcld_col(k) = fcld_dev(i, k)
303 reff_col(k, l) = reff_dev(i, k, l)
304 cwc_col(k, l) = cwc_dev(i, k, l)
334 rr(np+1, 1) = rsuvbm_dev
335 rr(np+1, 2) = rsuvbm_dev
336 rs(np+1, 1) = rsuvdf_dev
337 rs(np+1, 2) = rsuvdf_dev
387 CALL getvistau1(np, cosz_dev(i), dp_pa, fcld_col, reff_col, cwc_col, &
388 & ict, icb, taubeam, taudiff, asycl, aig_uv, awg_uv, arg_uv, &
389 & aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, &
390 & awa_nir, ara_nir, aig_nir, awg_nir, arg_nir, caib, caif, &
401 IF (cc1 .LT. fcld_dev(i, k))
THEN 408 ELSE IF (k .LT. icb)
THEN 409 IF (cc2 .LT. fcld_dev(i, k))
THEN 416 ELSE IF (cc3 .LT. fcld_dev(i, k))
THEN 427 tauclb(k) = taubeam(k, 1) + taubeam(k, 2) + taubeam(k, 3) + taubeam(&
429 tauclf(k) = taudiff(k, 1) + taudiff(k, 2) + taudiff(k, 3) + taudiff(&
438 td(0, 1) = exp(-((wvtoa*wk_uv(ib)+o3toa*zk_uv(ib))/cosz_dev(i)))
444 taurs = ry_uv(ib)*dp(k)
445 tauoz = zk_uv(ib)*oh(k)
446 tauwv = wk_uv(ib)*wh(k)
447 tausto = taurs + tauoz + tauwv + taua_dev(i, k, ib) + 1.0e-7
448 ssatau = ssaa_dev(i, k, ib) + taurs
449 asysto = asya_dev(i, k, ib)
452 asytob = asysto/ssatau
454 ssatob = ssatau/tautob + 1.0e-8
455 IF (ssatob .GT. 0.999999)
THEN 463 CALL deledd(tautob, ssatob, asytob, cosz_dev(i), rrt, ttt, tdt)
466 CALL deledd(tautob, ssatob, asytob, dsm, rst, tst, dum)
481 tautob = tausto + tauclb(k)
483 ssatob = (ssatau+tauclb(k))/tautob + 1.0e-8
484 IF (ssatob .GT. 0.999999)
THEN 491 asytob = (asysto+asycl(k)*tauclb(k))/(ssatob*tautob)
494 tautof = tausto + tauclf(k)
496 ssatof = (ssatau+tauclf(k))/tautof + 1.0e-8
497 IF (ssatof .GT. 0.999999)
THEN 504 asytof = (asysto+asycl(k)*tauclf(k))/(ssatof*tautof)
508 CALL deledd(tautob, ssatob, asytob, cosz_dev(i), rrt, ttt, tdt)
511 CALL deledd(tautof, ssatof, asytof, dsm, rst, tst, dum)
674 tda(0, ih, 1) = td(0, ih)
676 tta(0, ih, 1) = tt(0, ih)
678 rsa(0, ih, 1) = rs(0, ih)
680 tda(0, ih, 2) = td(0, ih)
682 tta(0, ih, 2) = tt(0, ih)
684 rsa(0, ih, 2) = rs(0, ih)
687 denm = ts(k, ih)/(1.-rsa(k-1, ih, 1)*rs(k, ih))
689 tda(k, ih, 1) = tda(k-1, ih, 1)*td(k, ih)
691 tta(k, ih, 1) = tda(k-1, ih, 1)*tt(k, ih) + (tda(k-1, ih, 1)*rsa&
692 & (k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1, ih, 1))*denm
694 rsa(k, ih, 1) = rs(k, ih) + ts(k, ih)*rsa(k-1, ih, 1)*denm
696 tda(k, ih, 2) = tda(k, ih, 1)
698 tta(k, ih, 2) = tta(k, ih, 1)
700 rsa(k, ih, 2) = rsa(k, ih, 1)
708 denm = ts(k, im)/(1.-rsa(k-1, ih, im)*rs(k, im))
710 tda(k, ih, im) = tda(k-1, ih, im)*td(k, im)
712 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, im) + (tda(k-1, ih, im&
713 & )*rsa(k-1, ih, im)*rr(k, im)+tta(k-1, ih, im)-tda(k-1, ih, &
716 rsa(k, ih, im) = rs(k, im) + ts(k, im)*rsa(k-1, ih, im)*denm
735 rra(np+1, 1, is) = rr(np+1, is)
737 rxa(np+1, 1, is) = rs(np+1, is)
739 rra(np+1, 2, is) = rr(np+1, is)
741 rxa(np+1, 2, is) = rs(np+1, is)
744 denm = ts(k, is)/(1.-rs(k, is)*rxa(k+1, 1, is))
746 rra(k, 1, is) = rr(k, is) + (td(k, is)*rra(k+1, 1, is)+(tt(k, is&
747 & )-td(k, is))*rxa(k+1, 1, is))*denm
749 rxa(k, 1, is) = rs(k, is) + ts(k, is)*rxa(k+1, 1, is)*denm
751 rra(k, 2, is) = rra(k, 1, is)
753 rxa(k, 2, is) = rxa(k, 1, is)
760 denm = ts(k, im)/(1.-rs(k, im)*rxa(k+1, im, is))
762 rra(k, im, is) = rr(k, im) + (td(k, im)*rra(k+1, im, is)+(tt(k&
763 & , im)-td(k, im))*rxa(k+1, im, is))*denm
765 rxa(k, im, is) = rs(k, im) + ts(k, im)*rxa(k+1, im, is)*denm
813 denm = ts(k, is)/(1.-rsa(k-1, ih, im)*rs(k, is))
815 tda(k, ih, im) = tda(k-1, ih, im)*td(k, is)
817 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, is) + (tda(k-1, ih, &
818 & im)*rr(k, is)*rsa(k-1, ih, im)+tta(k-1, ih, im)-tda(k-1, &
821 rsa(k, ih, im) = rs(k, is) + ts(k, is)*rsa(k-1, ih, im)*denm
827 denm = ts(k, ih)/(1.-rs(k, ih)*rxa(k+1, im, is))
829 rra(k, im, is) = rr(k, ih) + (td(k, ih)*rra(k+1, im, is)+(tt&
830 & (k, ih)-td(k, ih))*rxa(k+1, im, is))*denm
832 rxa(k, im, is) = rs(k, ih) + ts(k, ih)*rxa(k+1, im, is)*denm
842 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
843 fdndir = tda(k-1, ih, im)
844 xx4 = tda(k-1, ih, im)*rra(k, im, is)
845 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
846 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
847 fupdif = (xx4+yy*rxa(k, im, is))*denm
848 flxdn = fdndir + fdndif - fupdif
851 fall(k) = fall(k) + flxdn*ct
863 flx_dev(i, k) = flx_dev(i, k) + fall(k)*hk_uv(ib)
869 rr(np+1, 1) = rsirbm_dev
871 rr(np+1, 2) = rsirbm_dev
873 rs(np+1, 1) = rsirdf_dev
875 rs(np+1, 2) = rsirdf_dev
946 CALL getnirtau1(ib, np, cosz_dev(i), dp_pa, fcld_col, reff_col, &
947 & cwc_col, ict, icb, taubeam, taudiff, asycl, ssacl, aig_uv&
948 & , awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir&
949 & , arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, &
950 & arg_nir, caib, caif, cons_grav)
959 IF (cc1 .LT. fcld_dev(i, k))
THEN 966 ELSE IF (k .LT. icb)
THEN 967 IF (cc2 .LT. fcld_dev(i, k))
THEN 976 ELSE IF (cc3 .LT. fcld_dev(i, k))
THEN 990 tauclb(k) = taubeam(k, 1) + taubeam(k, 2) + taubeam(k, 3) + &
993 tauclf(k) = taudiff(k, 1) + taudiff(k, 2) + taudiff(k, 3) + &
1000 td(0, 1) = exp(-(wvtoa*xk_ir(ik)/cosz_dev(i)))
1004 taurs = ry_ir(ib)*dp(k)
1005 tauwv = xk_ir(ik)*wh(k)
1008 tausto = taurs + tauwv + taua_dev(i, k, iv) + 1.0e-7
1009 ssatau = ssaa_dev(i, k, iv) + taurs + 1.0e-8
1010 asysto = asya_dev(i, k, iv)
1013 asytob = asysto/ssatau
1015 ssatob = ssatau/tautob + 1.0e-8
1016 IF (ssatob .GT. 0.999999)
THEN 1026 CALL deledd(tautob, ssatob, asytob, cosz_dev(i), rrt, ttt, tdt)
1029 CALL deledd(tautob, ssatob, asytob, dsm, rst, tst, dum)
1043 tautob = tausto + tauclb(k)
1045 ssatob = (ssatau+ssacl(k)*tauclb(k))/tautob + 1.0e-8
1046 IF (ssatob .GT. 0.999999)
THEN 1053 asytob = (asysto+asycl(k)*ssacl(k)*tauclb(k))/(ssatob*tautob)
1056 tautof = tausto + tauclf(k)
1058 ssatof = (ssatau+ssacl(k)*tauclf(k))/tautof + 1.0e-8
1059 IF (ssatof .GT. 0.999999)
THEN 1066 asytof = (asysto+asycl(k)*ssacl(k)*tauclf(k))/(ssatof*tautof)
1068 CALL deledd(tautob, ssatob, asytob, cosz_dev(i), rrt, ttt, tdt)
1071 CALL deledd(tautof, ssatof, asytof, dsm, rst, tst, dum)
1236 tda(0, ih, 1) = td(0, ih)
1238 tta(0, ih, 1) = tt(0, ih)
1240 rsa(0, ih, 1) = rs(0, ih)
1242 tda(0, ih, 2) = td(0, ih)
1244 tta(0, ih, 2) = tt(0, ih)
1246 rsa(0, ih, 2) = rs(0, ih)
1249 denm = ts(k, ih)/(1.-rsa(k-1, ih, 1)*rs(k, ih))
1251 tda(k, ih, 1) = tda(k-1, ih, 1)*td(k, ih)
1253 tta(k, ih, 1) = tda(k-1, ih, 1)*tt(k, ih) + (tda(k-1, ih, 1)*&
1254 & rsa(k-1, ih, 1)*rr(k, ih)+tta(k-1, ih, 1)-tda(k-1, ih, 1))*&
1257 rsa(k, ih, 1) = rs(k, ih) + ts(k, ih)*rsa(k-1, ih, 1)*denm
1259 tda(k, ih, 2) = tda(k, ih, 1)
1261 tta(k, ih, 2) = tta(k, ih, 1)
1263 rsa(k, ih, 2) = rsa(k, ih, 1)
1271 denm = ts(k, im)/(1.-rsa(k-1, ih, im)*rs(k, im))
1273 tda(k, ih, im) = tda(k-1, ih, im)*td(k, im)
1275 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, im) + (tda(k-1, ih, &
1276 & im)*rsa(k-1, ih, im)*rr(k, im)+tta(k-1, ih, im)-tda(k-1, &
1279 rsa(k, ih, im) = rs(k, im) + ts(k, im)*rsa(k-1, ih, im)*denm
1298 rra(np+1, 1, is) = rr(np+1, is)
1300 rxa(np+1, 1, is) = rs(np+1, is)
1302 rra(np+1, 2, is) = rr(np+1, is)
1304 rxa(np+1, 2, is) = rs(np+1, is)
1307 denm = ts(k, is)/(1.-rs(k, is)*rxa(k+1, 1, is))
1309 rra(k, 1, is) = rr(k, is) + (td(k, is)*rra(k+1, 1, is)+(tt(k, &
1310 & is)-td(k, is))*rxa(k+1, 1, is))*denm
1312 rxa(k, 1, is) = rs(k, is) + ts(k, is)*rxa(k+1, 1, is)*denm
1314 rra(k, 2, is) = rra(k, 1, is)
1316 rxa(k, 2, is) = rxa(k, 1, is)
1323 denm = ts(k, im)/(1.-rs(k, im)*rxa(k+1, im, is))
1325 rra(k, im, is) = rr(k, im) + (td(k, im)*rra(k+1, im, is)+(tt&
1326 & (k, im)-td(k, im))*rxa(k+1, im, is))*denm
1328 rxa(k, im, is) = rs(k, im) + ts(k, im)*rxa(k+1, im, is)*denm
1376 denm = ts(k, is)/(1.-rsa(k-1, ih, im)*rs(k, is))
1378 tda(k, ih, im) = tda(k-1, ih, im)*td(k, is)
1380 tta(k, ih, im) = tda(k-1, ih, im)*tt(k, is) + (tda(k-1, ih&
1381 & , im)*rr(k, is)*rsa(k-1, ih, im)+tta(k-1, ih, im)-tda(k-&
1384 rsa(k, ih, im) = rs(k, is) + ts(k, is)*rsa(k-1, ih, im)*&
1391 denm = ts(k, ih)/(1.-rs(k, ih)*rxa(k+1, im, is))
1393 rra(k, im, is) = rr(k, ih) + (td(k, ih)*rra(k+1, im, is)+(&
1394 & tt(k, ih)-td(k, ih))*rxa(k+1, im, is))*denm
1396 rxa(k, im, is) = rs(k, ih) + ts(k, ih)*rxa(k+1, im, is)*&
1407 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
1408 fdndir = tda(k-1, ih, im)
1409 xx4 = tda(k-1, ih, im)*rra(k, im, is)
1410 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
1411 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
1412 fupdif = (xx4+yy*rxa(k, im, is))*denm
1413 flxdn = fdndir + fdndif - fupdif
1416 fall(k) = fall(k) + flxdn*ct
1428 flx_dev(i, k) = flx_dev(i, k) + fall(k)*hk_ir(ib, ik)
1441 df(1) = 0.0633*(1.-exp(-(0.000155*sqrt(so2(1)))))
1443 so2(k+1) = so2(k) + scal(k)*cnt
1445 df(k+1) = 0.0633*(1.0-exp(-(0.000155*sqrt(so2(k+1)))))
1449 so2(1) = 789.*co2*scal0
1451 so2(k+1) = so2(k) + 789.*co2*scal(k)
1462 x0 =
u1 +
REAL(nu)*du
1463 y0 = w1 +
REAL(nw)*dw
1467 x3 = log10(so2(k)*snt)
1468 IF (x3 .GT. x0)
THEN 1473 x4 = log10(swh(k)*snt)
1474 IF (x4 .GT. y0)
THEN 1482 ic = int((ulog-x1)/du + 1.)
1484 iw = int((wlog-y1)/dw + 1.)
1485 IF (ic .LT. 2) ic = 2
1486 IF (iw .LT. 2) iw = 2
1487 IF (ic .GT. nu) ic = nu
1488 IF (iw .GT. nw) iw = nw
1489 dc = ulog -
REAL(ic-2)*du -
u1 1490 dd = wlog -
REAL(iw-2)*dw - w1
1491 x2 = cah(ic-1, iw-1) + (cah(ic-1, iw)-cah(ic-1, iw-1))/dw*dd
1492 y2 = x2 + (cah(ic, iw-1)-cah(ic-1, iw-1))/du*dc
1493 IF (y2 .LT. 0.0)
THEN 1501 df(k) = df(k) + 1.5*y2
1512 x0 =
u1 +
REAL(nx)*du
1513 y0 = w1 +
REAL(ny)*dw
1517 IF (co2*snt .GT. x0)
THEN 1522 x5 = log10(pl_dev(i, k))
1523 IF (x5 .GT. y0)
THEN 1529 ic = int((ulog-x1)/du + 1.)
1531 iw = int((wlog-y1)/dw + 1.)
1532 IF (ic .LT. 2) ic = 2
1533 IF (iw .LT. 2) iw = 2
1534 IF (ic .GT. nx) ic = nx
1535 IF (iw .GT. ny) iw = ny
1536 dc = ulog -
REAL(ic-2)*du -
u1 1537 dd = wlog -
REAL(iw-2)*dw - w1
1538 x2 = coa(ic-1, iw-1) + (coa(ic-1, iw)-coa(ic-1, iw-1))/dw*dd
1539 y2 = x2 + (coa(ic, iw-1)-coa(ic-1, iw-1))/du*dc
1540 IF (y2 .LT. 0.0)
THEN 1546 df(k) = df(k) + 1.5*y2
1551 IF (fcld_dev(i, k) .GT. 0.02 .AND. foundtop .EQ. 0)
THEN 1556 IF (foundtop .EQ. 0) ntop = np + 1
1559 IF (k .GT. ntop)
THEN 1560 xx4 = flx_dev(i, k)/flx_dev(i, ntop)
1562 df(k) = dftop + xx4*(df(k)-dftop)
1570 IF (df(k) .GT. flx_dev(i, k) - 1.0e-8)
THEN 1578 dfb(k) = dfb(k) - flx_devb(i, k)
1580 IF (branch .EQ. 0)
THEN 1581 flx_devb(i, k) = flx_devb(i, k) + dfb(k)
1588 IF (branch .NE. 0)
THEN 1589 xx4 = flx_dev(i, k)/flx_dev(i, ntop)
1591 dftopb = dftopb + (1.0_8-xx4)*dfb(k)
1592 xx4b = (df(k)-dftop)*dfb(k)
1594 tempb56 = xx4b/flx_dev(i, ntop)
1595 flx_devb(i, k) = flx_devb(i, k) + tempb56
1596 flx_devb(i, ntop) = flx_devb(i, ntop) - flx_dev(i, k)*tempb56/&
1600 dfb(ntop) = dfb(ntop) + dftopb
1610 IF (branch .EQ. 0) y2b = 0.0_8
1612 ddb = (cah(ic-1, iw)-cah(ic-1, iw-1))*x2b/dw
1617 IF (branch .EQ. 0)
THEN 1622 swhb(k) = swhb(k) + x4b/(swh(k)*log(10.0))
1650 fallb(k) = fallb(k) + hk_ir(ib, ik)*flx_devb(i, k)
1659 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
1660 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
1661 xx4 = tda(k-1, ih, im)*rra(k, im, is)
1662 fupdif = (xx4+yy*rxa(k, im, is))*denm
1663 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
1664 fdndir = tda(k-1, ih, im)
1665 flxdn = fdndir + fdndif - fupdif
1666 flxdnb = ct*fallb(k)
1667 ctb = ctb + flxdn*fallb(k)
1671 tempb53 = denm*fupdifb
1672 denmb = (xx4*rsa(k-1, ih, im)+yy)*fdndifb + (xx4+yy*rxa(k&
1673 & , im, is))*fupdifb
1674 tempb54 = denm*fdndifb
1675 xx4b = rsa(k-1, ih, im)*tempb54 + tempb53
1676 yyb = tempb54 + rxa(k, im, is)*tempb53
1677 ttab(k-1, ih, im) = ttab(k-1, ih, im) + yyb
1678 tdab(k-1, ih, im) = tdab(k-1, ih, im) + rra(k, im, is)*&
1679 & xx4b + fdndirb - yyb
1680 rrab(k, im, is) = rrab(k, im, is) + tda(k-1, ih, im)*xx4b
1682 temp38 = -(rsa(k-1, ih, im)*rxa(k, im, is)) + 1.
1683 tempb55 = -(denmb/temp38**2)
1684 rxab(k, im, is) = rxab(k, im, is) + yy*tempb53 - rsa(k-1, &
1686 rsab(k-1, ih, im) = rsab(k-1, ih, im) + xx4*tempb54 - rxa(&
1687 & k, im, is)*tempb55
1691 tempb50 = rxa(k+1, im, is)*rxab(k, im, is)
1693 tempb52 = denm*rrab(k, im, is)
1694 temp37 = rxa(k+1, im, is)
1695 temp36 = tt(k, ih) - td(k, ih)
1696 rrb(k, ih) = rrb(k, ih) + rrab(k, im, is)
1697 tdb(k, ih) = tdb(k, ih) + (rra(k+1, im, is)-temp37)*&
1699 rrab(k+1, im, is) = rrab(k+1, im, is) + td(k, ih)*tempb52
1700 denmb = (td(k, ih)*rra(k+1, im, is)+temp36*temp37)*rrab(k&
1701 & , im, is) + ts(k, ih)*tempb50
1702 ttb(k, ih) = ttb(k, ih) + temp37*tempb52
1703 rrab(k, im, is) = 0.0_8
1704 temp35 = -(rs(k, ih)*rxa(k+1, im, is)) + 1.
1705 tsb(k, ih) = tsb(k, ih) + denmb/temp35 + denm*tempb50
1706 tempb51 = -(ts(k, ih)*denmb/temp35**2)
1707 rsb(k, ih) = rsb(k, ih) + rxab(k, im, is) - rxa(k+1, im, &
1709 rxab(k+1, im, is) = rxab(k+1, im, is) + ts(k, ih)*denm*&
1711 rxab(k, im, is) = 0.0_8
1712 rxab(k+1, im, is) = rxab(k+1, im, is) + temp36*tempb52 - &
1718 tempb47 = rsa(k-1, ih, im)*rsab(k, ih, im)
1720 tempb49 = denm*ttab(k, ih, im)
1721 temp34 = rsa(k-1, ih, im)
1722 temp33 = tda(k-1, ih, im)*rr(k, is)
1723 tdab(k-1, ih, im) = tdab(k-1, ih, im) + td(k, is)*tdab(k, &
1724 & ih, im) + (temp34*rr(k, is)-1.0)*tempb49 + tt(k, is)*&
1726 ttb(k, is) = ttb(k, is) + tda(k-1, ih, im)*ttab(k, ih, im)
1727 rrb(k, is) = rrb(k, is) + temp34*tda(k-1, ih, im)*tempb49
1728 ttab(k-1, ih, im) = ttab(k-1, ih, im) + tempb49
1729 denmb = (temp33*temp34+tta(k-1, ih, im)-tda(k-1, ih, im))*&
1730 & ttab(k, ih, im) + ts(k, is)*tempb47
1731 ttab(k, ih, im) = 0.0_8
1733 tdb(k, is) = tdb(k, is) + tda(k-1, ih, im)*tdab(k, ih, im)
1734 tdab(k, ih, im) = 0.0_8
1735 temp32 = -(rsa(k-1, ih, im)*rs(k, is)) + 1.
1736 tsb(k, is) = tsb(k, is) + denmb/temp32 + denm*tempb47
1737 tempb48 = -(ts(k, is)*denmb/temp32**2)
1738 rsb(k, is) = rsb(k, is) + rsab(k, ih, im) - rsa(k-1, ih, &
1740 rsab(k-1, ih, im) = rsab(k-1, ih, im) + ts(k, is)*denm*&
1742 rsab(k, ih, im) = 0.0_8
1743 rsab(k-1, ih, im) = rsab(k-1, ih, im) + temp33*tempb49 - &
1748 IF (branch .EQ. 0)
THEN 1751 cc3b = cc3b + cm*ctb
1754 cmb = cmb + (1.0-cc3)*ctb
1755 cc3b = cc3b - cm*ctb
1759 IF (branch .EQ. 0)
THEN 1762 cc2b = cc2b + ch*cmb
1765 chb = chb + (1.0-cc2)*cmb
1766 cc2b = cc2b - ch*cmb
1770 IF (branch .EQ. 0)
THEN 1782 tempb44 = rxa(k+1, im, is)*rxab(k, im, is)
1784 tempb46 = denm*rrab(k, im, is)
1785 temp31 = rxa(k+1, im, is)
1786 temp30 = tt(k, im) - td(k, im)
1787 rrb(k, im) = rrb(k, im) + rrab(k, im, is)
1788 tdb(k, im) = tdb(k, im) + (rra(k+1, im, is)-temp31)*tempb46
1789 rrab(k+1, im, is) = rrab(k+1, im, is) + td(k, im)*tempb46
1790 denmb = (td(k, im)*rra(k+1, im, is)+temp30*temp31)*rrab(k, &
1791 & im, is) + ts(k, im)*tempb44
1792 ttb(k, im) = ttb(k, im) + temp31*tempb46
1793 rrab(k, im, is) = 0.0_8
1794 temp29 = -(rs(k, im)*rxa(k+1, im, is)) + 1.
1795 tsb(k, im) = tsb(k, im) + denmb/temp29 + denm*tempb44
1796 tempb45 = -(ts(k, im)*denmb/temp29**2)
1797 rsb(k, im) = rsb(k, im) + rxab(k, im, is) - rxa(k+1, im, is)&
1799 rxab(k+1, im, is) = rxab(k+1, im, is) + ts(k, im)*denm*rxab(&
1801 rxab(k, im, is) = 0.0_8
1802 rxab(k+1, im, is) = rxab(k+1, im, is) + temp30*tempb46 - rs(&
1809 rxab(k, 1, is) = rxab(k, 1, is) + rxab(k, 2, is)
1810 rxab(k, 2, is) = 0.0_8
1812 rrab(k, 1, is) = rrab(k, 1, is) + rrab(k, 2, is)
1813 rrab(k, 2, is) = 0.0_8
1815 tempb41 = rxa(k+1, 1, is)*rxab(k, 1, is)
1817 tempb43 = denm*rrab(k, 1, is)
1818 temp28 = rxa(k+1, 1, is)
1819 temp27 = tt(k, is) - td(k, is)
1820 rrb(k, is) = rrb(k, is) + rrab(k, 1, is)
1821 tdb(k, is) = tdb(k, is) + (rra(k+1, 1, is)-temp28)*tempb43
1822 rrab(k+1, 1, is) = rrab(k+1, 1, is) + td(k, is)*tempb43
1823 denmb = (td(k, is)*rra(k+1, 1, is)+temp27*temp28)*rrab(k, 1, &
1824 & is) + ts(k, is)*tempb41
1825 ttb(k, is) = ttb(k, is) + temp28*tempb43
1826 rrab(k, 1, is) = 0.0_8
1827 temp26 = -(rs(k, is)*rxa(k+1, 1, is)) + 1.
1828 tsb(k, is) = tsb(k, is) + denmb/temp26 + denm*tempb41
1829 tempb42 = -(ts(k, is)*denmb/temp26**2)
1830 rsb(k, is) = rsb(k, is) + rxab(k, 1, is) - rxa(k+1, 1, is)*&
1832 rxab(k+1, 1, is) = rxab(k+1, 1, is) + ts(k, is)*denm*rxab(k, 1&
1834 rxab(k, 1, is) = 0.0_8
1835 rxab(k+1, 1, is) = rxab(k+1, 1, is) + temp27*tempb43 - rs(k, &
1840 rsb(np+1, is) = rsb(np+1, is) + rxab(np+1, 2, is)
1841 rxab(np+1, 2, is) = 0.0_8
1843 rrb(np+1, is) = rrb(np+1, is) + rrab(np+1, 2, is)
1844 rrab(np+1, 2, is) = 0.0_8
1846 rsb(np+1, is) = rsb(np+1, is) + rxab(np+1, 1, is)
1847 rxab(np+1, 1, is) = 0.0_8
1849 rrb(np+1, is) = rrb(np+1, is) + rrab(np+1, 1, is)
1850 rrab(np+1, 1, is) = 0.0_8
1856 tempb38 = rsa(k-1, ih, im)*rsab(k, ih, im)
1858 tempb40 = denm*ttab(k, ih, im)
1859 temp25 = rsa(k-1, ih, im)
1860 temp24 = tda(k-1, ih, im)*rr(k, im)
1861 tdab(k-1, ih, im) = tdab(k-1, ih, im) + td(k, im)*tdab(k, ih&
1862 & , im) + (temp25*rr(k, im)-1.0)*tempb40 + tt(k, im)*ttab(k&
1864 ttb(k, im) = ttb(k, im) + tda(k-1, ih, im)*ttab(k, ih, im)
1865 rrb(k, im) = rrb(k, im) + temp25*tda(k-1, ih, im)*tempb40
1866 ttab(k-1, ih, im) = ttab(k-1, ih, im) + tempb40
1867 denmb = (temp24*temp25+tta(k-1, ih, im)-tda(k-1, ih, im))*&
1868 & ttab(k, ih, im) + ts(k, im)*tempb38
1869 ttab(k, ih, im) = 0.0_8
1871 tdb(k, im) = tdb(k, im) + tda(k-1, ih, im)*tdab(k, ih, im)
1872 tdab(k, ih, im) = 0.0_8
1873 temp23 = -(rsa(k-1, ih, im)*rs(k, im)) + 1.
1874 tsb(k, im) = tsb(k, im) + denmb/temp23 + denm*tempb38
1875 tempb39 = -(ts(k, im)*denmb/temp23**2)
1876 rsb(k, im) = rsb(k, im) + rsab(k, ih, im) - rsa(k-1, ih, im)&
1878 rsab(k-1, ih, im) = rsab(k-1, ih, im) + ts(k, im)*denm*rsab(&
1880 rsab(k, ih, im) = 0.0_8
1881 rsab(k-1, ih, im) = rsab(k-1, ih, im) + temp24*tempb40 - rs(&
1888 rsab(k, ih, 1) = rsab(k, ih, 1) + rsab(k, ih, 2)
1889 rsab(k, ih, 2) = 0.0_8
1891 ttab(k, ih, 1) = ttab(k, ih, 1) + ttab(k, ih, 2)
1892 ttab(k, ih, 2) = 0.0_8
1894 tdab(k, ih, 1) = tdab(k, ih, 1) + tdab(k, ih, 2)
1895 tdab(k, ih, 2) = 0.0_8
1897 tempb35 = rsa(k-1, ih, 1)*rsab(k, ih, 1)
1899 tempb37 = denm*ttab(k, ih, 1)
1900 temp22 = rsa(k-1, ih, 1)
1901 temp21 = tda(k-1, ih, 1)*rr(k, ih)
1902 tdab(k-1, ih, 1) = tdab(k-1, ih, 1) + td(k, ih)*tdab(k, ih, 1)&
1903 & + (temp22*rr(k, ih)-1.0)*tempb37 + tt(k, ih)*ttab(k, ih, 1)
1904 ttb(k, ih) = ttb(k, ih) + tda(k-1, ih, 1)*ttab(k, ih, 1)
1905 rrb(k, ih) = rrb(k, ih) + temp22*tda(k-1, ih, 1)*tempb37
1906 ttab(k-1, ih, 1) = ttab(k-1, ih, 1) + tempb37
1907 denmb = (temp21*temp22+tta(k-1, ih, 1)-tda(k-1, ih, 1))*ttab(k&
1908 & , ih, 1) + ts(k, ih)*tempb35
1909 ttab(k, ih, 1) = 0.0_8
1911 tdb(k, ih) = tdb(k, ih) + tda(k-1, ih, 1)*tdab(k, ih, 1)
1912 tdab(k, ih, 1) = 0.0_8
1913 temp20 = -(rsa(k-1, ih, 1)*rs(k, ih)) + 1.
1914 tsb(k, ih) = tsb(k, ih) + denmb/temp20 + denm*tempb35
1915 tempb36 = -(ts(k, ih)*denmb/temp20**2)
1916 rsb(k, ih) = rsb(k, ih) + rsab(k, ih, 1) - rsa(k-1, ih, 1)*&
1918 rsab(k-1, ih, 1) = rsab(k-1, ih, 1) + ts(k, ih)*denm*rsab(k, &
1920 rsab(k, ih, 1) = 0.0_8
1921 rsab(k-1, ih, 1) = rsab(k-1, ih, 1) + temp21*tempb37 - rs(k, &
1926 rsb(0, ih) = rsb(0, ih) + rsab(0, ih, 2)
1927 rsab(0, ih, 2) = 0.0_8
1929 ttb(0, ih) = ttb(0, ih) + ttab(0, ih, 2)
1930 ttab(0, ih, 2) = 0.0_8
1932 tdb(0, ih) = tdb(0, ih) + tdab(0, ih, 2)
1933 tdab(0, ih, 2) = 0.0_8
1935 rsb(0, ih) = rsb(0, ih) + rsab(0, ih, 1)
1936 rsab(0, ih, 1) = 0.0_8
1938 ttb(0, ih) = ttb(0, ih) + ttab(0, ih, 1)
1939 ttab(0, ih, 1) = 0.0_8
1941 tdb(0, ih) = tdb(0, ih) + tdab(0, ih, 1)
1942 tdab(0, ih, 1) = 0.0_8
1963 tauwv = xk_ir(ik)*wh(k)
1964 taurs = ry_ir(ib)*dp(k)
1965 tausto = taurs + tauwv + taua_dev(i, k, iv) + 1.0e-7
1966 tautof = tausto + tauclf(k)
1967 asysto = asya_dev(i, k, iv)
1968 asytof = (asysto+asycl(k)*ssacl(k)*tauclf(k))/(ssatof*tautof)
1973 CALL deledd_b(tautof, tautofb, ssatof, ssatofb, asytof, asytofb&
1974 & , dsm, rst, rstb, tst, tstb, dum, dumb)
1975 tautob = tausto + tauclb(k)
1976 asytob = (asysto+asycl(k)*ssacl(k)*tauclb(k))/(ssatob*tautob)
1980 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb&
1981 & , cosz_dev(i), rrt, rrtb, ttt, tttb, tdt, tdtb)
1982 tempb33 = asytofb/(ssatof*tautof)
1983 temp19 = asycl(k)*ssacl(k)
1984 tempb34 = -((asysto+temp19*tauclf(k))*tempb33/(ssatof*tautof))
1986 asyclb(k) = asyclb(k) + tauclf(k)*ssacl(k)*tempb33
1987 ssaclb(k) = ssaclb(k) + tauclf(k)*asycl(k)*tempb33
1988 tauclfb(k) = tauclfb(k) + temp19*tempb33
1989 ssatofb = ssatofb + tautof*tempb34
1990 tautofb = tautofb + ssatof*tempb34
1992 IF (branch .EQ. 0)
THEN 1993 ssatau = ssaa_dev(i, k, iv) + taurs + 1.0e-8
1996 ssatau = ssaa_dev(i, k, iv) + taurs + 1.0e-8
1998 tempb31 = asytobb/(ssatob*tautob)
2000 tempb30 = ssatofb/tautof
2002 ssaclb(k) = ssaclb(k) + tauclb(k)*asycl(k)*tempb31 + tauclf(k)*&
2004 tautofb = tautofb - (ssatau+ssacl(k)*tauclf(k))*tempb30/tautof
2005 tauclfb(k) = tauclfb(k) + tautofb + ssacl(k)*tempb30
2008 temp18 = asycl(k)*ssacl(k)
2009 tempb32 = -((asysto+temp18*tauclb(k))*tempb31/(ssatob*tautob))
2010 asystob = asystob + tempb31
2011 asyclb(k) = asyclb(k) + tauclb(k)*ssacl(k)*tempb31
2012 tauclbb(k) = tauclbb(k) + temp18*tempb31
2013 ssatobb = ssatobb + tautob*tempb32
2014 tautobb = tautobb + ssatob*tempb32
2016 IF (branch .EQ. 0) ssatobb = 0.0_8
2018 tempb29 = ssatobb/tautob
2019 ssataub = ssataub + tempb29
2020 ssaclb(k) = ssaclb(k) + tauclb(k)*tempb29
2021 tautobb = tautobb - (ssatau+ssacl(k)*tauclb(k))*tempb29/tautob
2022 tauclbb(k) = tauclbb(k) + tautobb + ssacl(k)*tempb29
2023 taustob = taustob + tautobb
2040 asytob = asysto/ssatau
2045 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb&
2046 & , dsm, rst, rstb, tst, tstb, dum, dumb)
2047 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb&
2048 & , cosz_dev(i), rrt, rrtb, ttt, tttb, tdt, tdtb)
2050 IF (branch .EQ. 0) ssatobb = 0.0_8
2052 ssataub = ssataub + ssatobb/tautob - asysto*asytobb/ssatau**2
2053 tautobb = tautobb - ssatau*ssatobb/tautob**2
2054 asystob = asystob + asytobb/ssatau
2056 taustob = taustob + tautobb
2057 asya_devb(i, k, iv) = asya_devb(i, k, iv) + asystob
2058 ssaa_devb(i, k, iv) = ssaa_devb(i, k, iv) + ssataub
2060 taua_devb(i, k, iv) = taua_devb(i, k, iv) + taustob
2061 whb(k) = whb(k) + xk_ir(ik)*tauwvb
2064 tdb(0, 1) = tdb(0, 1) + tdb(0, 2)
2067 wvtoab = wvtoab - xk_ir(ik)*exp(-(xk_ir(ik)*(wvtoa/cosz_dev(i))))*&
2068 & tdb(0, 1)/cosz_dev(i)
2075 taudiffb(k, 1) = taudiffb(k, 1) + tauclfb(k)
2076 taudiffb(k, 2) = taudiffb(k, 2) + tauclfb(k)
2077 taudiffb(k, 3) = taudiffb(k, 3) + tauclfb(k)
2078 taudiffb(k, 4) = taudiffb(k, 4) + tauclfb(k)
2081 taubeamb(k, 1) = taubeamb(k, 1) + tauclbb(k)
2082 taubeamb(k, 2) = taubeamb(k, 2) + tauclbb(k)
2083 taubeamb(k, 3) = taubeamb(k, 3) + tauclbb(k)
2084 taubeamb(k, 4) = taubeamb(k, 4) + tauclbb(k)
2089 IF (branch .LT. 3)
THEN 2090 IF (branch .EQ. 0)
THEN 2092 fcld_devb(i, k) = fcld_devb(i, k) + cc3b
2094 ELSE IF (branch .EQ. 1)
THEN 2098 fcld_devb(i, k) = fcld_devb(i, k) + cc2b
2101 ELSE IF (branch .EQ. 3)
THEN 2103 ELSE IF (branch .EQ. 4)
THEN 2104 fcld_devb(i, k) = fcld_devb(i, k) + cc1b
2110 CALL getnirtau1_b(ib, np, cosz_dev(i), dp_pa, fcld_col, fcld_colb, &
2111 & reff_col, reff_colb, cwc_col, cwc_colb, ict, icb, &
2112 & taubeam, taubeamb, taudiff, taudiffb, asycl, asyclb, &
2113 & ssacl, ssaclb, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, &
2114 & arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, &
2115 & ara_nir, aig_nir, awg_nir, arg_nir, caib, caif, &
2138 tsb(np+1, 2) = 0.0_8
2140 tsb(np+1, 1) = 0.0_8
2142 ttb(np+1, 2) = 0.0_8
2144 ttb(np+1, 1) = 0.0_8
2146 tdb(np+1, 2) = 0.0_8
2148 tdb(np+1, 1) = 0.0_8
2150 rsb(np+1, 2) = 0.0_8
2152 rsb(np+1, 1) = 0.0_8
2154 rrb(np+1, 2) = 0.0_8
2156 rrb(np+1, 1) = 0.0_8
2164 fallb(k) = fallb(k) + hk_uv(ib)*flx_devb(i, k)
2173 yy = tta(k-1, ih, im) - tda(k-1, ih, im)
2174 denm = 1./(1.-rsa(k-1, ih, im)*rxa(k, im, is))
2175 xx4 = tda(k-1, ih, im)*rra(k, im, is)
2176 fupdif = (xx4+yy*rxa(k, im, is))*denm
2177 fdndif = (xx4*rsa(k-1, ih, im)+yy)*denm
2178 fdndir = tda(k-1, ih, im)
2179 flxdn = fdndir + fdndif - fupdif
2180 flxdnb = ct*fallb(k)
2181 ctb = ctb + flxdn*fallb(k)
2185 tempb26 = denm*fupdifb
2186 denmb = (xx4*rsa(k-1, ih, im)+yy)*fdndifb + (xx4+yy*rxa(k, &
2188 tempb27 = denm*fdndifb
2189 xx4b = rsa(k-1, ih, im)*tempb27 + tempb26
2190 yyb = tempb27 + rxa(k, im, is)*tempb26
2191 ttab(k-1, ih, im) = ttab(k-1, ih, im) + yyb
2192 tdab(k-1, ih, im) = tdab(k-1, ih, im) + rra(k, im, is)*xx4b &
2194 rrab(k, im, is) = rrab(k, im, is) + tda(k-1, ih, im)*xx4b
2196 temp17 = -(rsa(k-1, ih, im)*rxa(k, im, is)) + 1.
2197 tempb28 = -(denmb/temp17**2)
2198 rxab(k, im, is) = rxab(k, im, is) + yy*tempb26 - rsa(k-1, ih&
2200 rsab(k-1, ih, im) = rsab(k-1, ih, im) + xx4*tempb27 - rxa(k&
2205 tempb23 = rxa(k+1, im, is)*rxab(k, im, is)
2207 tempb25 = denm*rrab(k, im, is)
2208 temp16 = rxa(k+1, im, is)
2209 temp15 = tt(k, ih) - td(k, ih)
2210 rrb(k, ih) = rrb(k, ih) + rrab(k, im, is)
2211 tdb(k, ih) = tdb(k, ih) + (rra(k+1, im, is)-temp16)*tempb25
2212 rrab(k+1, im, is) = rrab(k+1, im, is) + td(k, ih)*tempb25
2213 denmb = (td(k, ih)*rra(k+1, im, is)+temp15*temp16)*rrab(k, &
2214 & im, is) + ts(k, ih)*tempb23
2215 ttb(k, ih) = ttb(k, ih) + temp16*tempb25
2216 rrab(k, im, is) = 0.0_8
2217 temp14 = -(rs(k, ih)*rxa(k+1, im, is)) + 1.
2218 tsb(k, ih) = tsb(k, ih) + denmb/temp14 + denm*tempb23
2219 tempb24 = -(ts(k, ih)*denmb/temp14**2)
2220 rsb(k, ih) = rsb(k, ih) + rxab(k, im, is) - rxa(k+1, im, is)&
2222 rxab(k+1, im, is) = rxab(k+1, im, is) + ts(k, ih)*denm*rxab(&
2224 rxab(k, im, is) = 0.0_8
2225 rxab(k+1, im, is) = rxab(k+1, im, is) + temp15*tempb25 - rs(&
2231 tempb20 = rsa(k-1, ih, im)*rsab(k, ih, im)
2233 tempb22 = denm*ttab(k, ih, im)
2234 temp13 = rsa(k-1, ih, im)
2235 temp12 = tda(k-1, ih, im)*rr(k, is)
2236 tdab(k-1, ih, im) = tdab(k-1, ih, im) + td(k, is)*tdab(k, ih&
2237 & , im) + (temp13*rr(k, is)-1.0)*tempb22 + tt(k, is)*ttab(k&
2239 ttb(k, is) = ttb(k, is) + tda(k-1, ih, im)*ttab(k, ih, im)
2240 rrb(k, is) = rrb(k, is) + temp13*tda(k-1, ih, im)*tempb22
2241 ttab(k-1, ih, im) = ttab(k-1, ih, im) + tempb22
2242 denmb = (temp12*temp13+tta(k-1, ih, im)-tda(k-1, ih, im))*&
2243 & ttab(k, ih, im) + ts(k, is)*tempb20
2244 ttab(k, ih, im) = 0.0_8
2246 tdb(k, is) = tdb(k, is) + tda(k-1, ih, im)*tdab(k, ih, im)
2247 tdab(k, ih, im) = 0.0_8
2248 temp11 = -(rsa(k-1, ih, im)*rs(k, is)) + 1.
2249 tsb(k, is) = tsb(k, is) + denmb/temp11 + denm*tempb20
2250 tempb21 = -(ts(k, is)*denmb/temp11**2)
2251 rsb(k, is) = rsb(k, is) + rsab(k, ih, im) - rsa(k-1, ih, im)&
2253 rsab(k-1, ih, im) = rsab(k-1, ih, im) + ts(k, is)*denm*rsab(&
2255 rsab(k, ih, im) = 0.0_8
2256 rsab(k-1, ih, im) = rsab(k-1, ih, im) + temp12*tempb22 - rs(&
2261 IF (branch .EQ. 0)
THEN 2264 cc3b = cc3b + cm*ctb
2267 cmb = cmb + (1.0-cc3)*ctb
2268 cc3b = cc3b - cm*ctb
2272 IF (branch .EQ. 0)
THEN 2275 cc2b = cc2b + ch*cmb
2278 chb = chb + (1.0-cc2)*cmb
2279 cc2b = cc2b - ch*cmb
2283 IF (branch .EQ. 0)
THEN 2295 tempb17 = rxa(k+1, im, is)*rxab(k, im, is)
2297 tempb19 = denm*rrab(k, im, is)
2298 temp10 = rxa(k+1, im, is)
2299 temp9 = tt(k, im) - td(k, im)
2300 rrb(k, im) = rrb(k, im) + rrab(k, im, is)
2301 tdb(k, im) = tdb(k, im) + (rra(k+1, im, is)-temp10)*tempb19
2302 rrab(k+1, im, is) = rrab(k+1, im, is) + td(k, im)*tempb19
2303 denmb = (td(k, im)*rra(k+1, im, is)+temp9*temp10)*rrab(k, im, &
2304 & is) + ts(k, im)*tempb17
2305 ttb(k, im) = ttb(k, im) + temp10*tempb19
2306 rrab(k, im, is) = 0.0_8
2307 temp8 = -(rs(k, im)*rxa(k+1, im, is)) + 1.
2308 tsb(k, im) = tsb(k, im) + denmb/temp8 + denm*tempb17
2309 tempb18 = -(ts(k, im)*denmb/temp8**2)
2310 rsb(k, im) = rsb(k, im) + rxab(k, im, is) - rxa(k+1, im, is)*&
2312 rxab(k+1, im, is) = rxab(k+1, im, is) + ts(k, im)*denm*rxab(k&
2314 rxab(k, im, is) = 0.0_8
2315 rxab(k+1, im, is) = rxab(k+1, im, is) + temp9*tempb19 - rs(k, &
2322 rxab(k, 1, is) = rxab(k, 1, is) + rxab(k, 2, is)
2323 rxab(k, 2, is) = 0.0_8
2325 rrab(k, 1, is) = rrab(k, 1, is) + rrab(k, 2, is)
2326 rrab(k, 2, is) = 0.0_8
2328 tempb14 = rxa(k+1, 1, is)*rxab(k, 1, is)
2330 tempb16 = denm*rrab(k, 1, is)
2331 temp7 = rxa(k+1, 1, is)
2332 temp6 = tt(k, is) - td(k, is)
2333 rrb(k, is) = rrb(k, is) + rrab(k, 1, is)
2334 tdb(k, is) = tdb(k, is) + (rra(k+1, 1, is)-temp7)*tempb16
2335 rrab(k+1, 1, is) = rrab(k+1, 1, is) + td(k, is)*tempb16
2336 denmb = (td(k, is)*rra(k+1, 1, is)+temp6*temp7)*rrab(k, 1, is) +&
2338 ttb(k, is) = ttb(k, is) + temp7*tempb16
2339 rrab(k, 1, is) = 0.0_8
2340 temp5 = -(rs(k, is)*rxa(k+1, 1, is)) + 1.
2341 tsb(k, is) = tsb(k, is) + denmb/temp5 + denm*tempb14
2342 tempb15 = -(ts(k, is)*denmb/temp5**2)
2343 rsb(k, is) = rsb(k, is) + rxab(k, 1, is) - rxa(k+1, 1, is)*&
2345 rxab(k+1, 1, is) = rxab(k+1, 1, is) + ts(k, is)*denm*rxab(k, 1, &
2347 rxab(k, 1, is) = 0.0_8
2348 rxab(k+1, 1, is) = rxab(k+1, 1, is) + temp6*tempb16 - rs(k, is)*&
2353 rsb(np+1, is) = rsb(np+1, is) + rxab(np+1, 2, is)
2354 rxab(np+1, 2, is) = 0.0_8
2356 rrb(np+1, is) = rrb(np+1, is) + rrab(np+1, 2, is)
2357 rrab(np+1, 2, is) = 0.0_8
2359 rsb(np+1, is) = rsb(np+1, is) + rxab(np+1, 1, is)
2360 rxab(np+1, 1, is) = 0.0_8
2362 rrb(np+1, is) = rrb(np+1, is) + rrab(np+1, 1, is)
2363 rrab(np+1, 1, is) = 0.0_8
2369 tempb11 = rsa(k-1, ih, im)*rsab(k, ih, im)
2371 tempb13 = denm*ttab(k, ih, im)
2372 temp4 = rsa(k-1, ih, im)
2373 temp3 = tda(k-1, ih, im)*rr(k, im)
2374 tdab(k-1, ih, im) = tdab(k-1, ih, im) + td(k, im)*tdab(k, ih, &
2375 & im) + (temp4*rr(k, im)-1.0)*tempb13 + tt(k, im)*ttab(k, ih, &
2377 ttb(k, im) = ttb(k, im) + tda(k-1, ih, im)*ttab(k, ih, im)
2378 rrb(k, im) = rrb(k, im) + temp4*tda(k-1, ih, im)*tempb13
2379 ttab(k-1, ih, im) = ttab(k-1, ih, im) + tempb13
2380 denmb = (temp3*temp4+tta(k-1, ih, im)-tda(k-1, ih, im))*ttab(k&
2381 & , ih, im) + ts(k, im)*tempb11
2382 ttab(k, ih, im) = 0.0_8
2384 tdb(k, im) = tdb(k, im) + tda(k-1, ih, im)*tdab(k, ih, im)
2385 tdab(k, ih, im) = 0.0_8
2386 temp2 = -(rsa(k-1, ih, im)*rs(k, im)) + 1.
2387 tsb(k, im) = tsb(k, im) + denmb/temp2 + denm*tempb11
2388 tempb12 = -(ts(k, im)*denmb/temp2**2)
2389 rsb(k, im) = rsb(k, im) + rsab(k, ih, im) - rsa(k-1, ih, im)*&
2391 rsab(k-1, ih, im) = rsab(k-1, ih, im) + ts(k, im)*denm*rsab(k&
2393 rsab(k, ih, im) = 0.0_8
2394 rsab(k-1, ih, im) = rsab(k-1, ih, im) + temp3*tempb13 - rs(k, &
2401 rsab(k, ih, 1) = rsab(k, ih, 1) + rsab(k, ih, 2)
2402 rsab(k, ih, 2) = 0.0_8
2404 ttab(k, ih, 1) = ttab(k, ih, 1) + ttab(k, ih, 2)
2405 ttab(k, ih, 2) = 0.0_8
2407 tdab(k, ih, 1) = tdab(k, ih, 1) + tdab(k, ih, 2)
2408 tdab(k, ih, 2) = 0.0_8
2410 tempb8 = rsa(k-1, ih, 1)*rsab(k, ih, 1)
2412 tempb10 = denm*ttab(k, ih, 1)
2413 temp1 = rsa(k-1, ih, 1)
2414 temp0 = tda(k-1, ih, 1)*rr(k, ih)
2415 tdab(k-1, ih, 1) = tdab(k-1, ih, 1) + td(k, ih)*tdab(k, ih, 1) +&
2416 & (temp1*rr(k, ih)-1.0)*tempb10 + tt(k, ih)*ttab(k, ih, 1)
2417 ttb(k, ih) = ttb(k, ih) + tda(k-1, ih, 1)*ttab(k, ih, 1)
2418 rrb(k, ih) = rrb(k, ih) + temp1*tda(k-1, ih, 1)*tempb10
2419 ttab(k-1, ih, 1) = ttab(k-1, ih, 1) + tempb10
2420 denmb = (temp0*temp1+tta(k-1, ih, 1)-tda(k-1, ih, 1))*ttab(k, ih&
2421 & , 1) + ts(k, ih)*tempb8
2422 ttab(k, ih, 1) = 0.0_8
2424 tdb(k, ih) = tdb(k, ih) + tda(k-1, ih, 1)*tdab(k, ih, 1)
2425 tdab(k, ih, 1) = 0.0_8
2426 temp = -(rsa(k-1, ih, 1)*rs(k, ih)) + 1.
2427 tsb(k, ih) = tsb(k, ih) + denmb/temp + denm*tempb8
2428 tempb9 = -(ts(k, ih)*denmb/temp**2)
2429 rsb(k, ih) = rsb(k, ih) + rsab(k, ih, 1) - rsa(k-1, ih, 1)*&
2431 rsab(k-1, ih, 1) = rsab(k-1, ih, 1) + ts(k, ih)*denm*rsab(k, ih&
2433 rsab(k, ih, 1) = 0.0_8
2434 rsab(k-1, ih, 1) = rsab(k-1, ih, 1) + temp0*tempb10 - rs(k, ih)*&
2439 rsb(0, ih) = rsb(0, ih) + rsab(0, ih, 2)
2440 rsab(0, ih, 2) = 0.0_8
2442 ttb(0, ih) = ttb(0, ih) + ttab(0, ih, 2)
2443 ttab(0, ih, 2) = 0.0_8
2445 tdb(0, ih) = tdb(0, ih) + tdab(0, ih, 2)
2446 tdab(0, ih, 2) = 0.0_8
2448 rsb(0, ih) = rsb(0, ih) + rsab(0, ih, 1)
2449 rsab(0, ih, 1) = 0.0_8
2451 ttb(0, ih) = ttb(0, ih) + ttab(0, ih, 1)
2452 ttab(0, ih, 1) = 0.0_8
2454 tdb(0, ih) = tdb(0, ih) + tdab(0, ih, 1)
2455 tdab(0, ih, 1) = 0.0_8
2476 tauwv = wk_uv(ib)*wh(k)
2477 taurs = ry_uv(ib)*dp(k)
2478 tauoz = zk_uv(ib)*oh(k)
2479 tausto = taurs + tauoz + tauwv + taua_dev(i, k, ib) + 1.0e-7
2480 tautof = tausto + tauclf(k)
2481 asysto = asya_dev(i, k, ib)
2482 asytof = (asysto+asycl(k)*tauclf(k))/(ssatof*tautof)
2487 CALL deledd_b(tautof, tautofb, ssatof, ssatofb, asytof, asytofb, &
2488 & dsm, rst, rstb, tst, tstb, dum, dumb)
2489 tautob = tausto + tauclb(k)
2490 asytob = (asysto+asycl(k)*tauclb(k))/(ssatob*tautob)
2494 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb, &
2495 & cosz_dev(i), rrt, rrtb, ttt, tttb, tdt, tdtb)
2496 tempb6 = asytofb/(ssatof*tautof)
2497 tempb7 = -((asysto+asycl(k)*tauclf(k))*tempb6/(ssatof*tautof))
2499 asyclb(k) = asyclb(k) + tauclf(k)*tempb6
2500 tauclfb(k) = tauclfb(k) + asycl(k)*tempb6
2501 ssatofb = ssatofb + tautof*tempb7
2502 tautofb = tautofb + ssatof*tempb7
2504 IF (branch .EQ. 0)
THEN 2505 ssatau = ssaa_dev(i, k, ib) + taurs
2508 ssatau = ssaa_dev(i, k, ib) + taurs
2511 tempb3 = ssatofb/tautof
2513 tautofb = tautofb - (ssatau+tauclf(k))*tempb3/tautof
2514 tauclfb(k) = tauclfb(k) + tautofb + tempb3
2517 tempb4 = asytobb/(ssatob*tautob)
2518 tempb5 = -((asysto+asycl(k)*tauclb(k))*tempb4/(ssatob*tautob))
2519 asystob = asystob + tempb4
2520 asyclb(k) = asyclb(k) + tauclb(k)*tempb4
2521 tauclbb(k) = tauclbb(k) + asycl(k)*tempb4
2522 ssatobb = ssatobb + tautob*tempb5
2523 tautobb = tautobb + ssatob*tempb5
2525 IF (branch .EQ. 0) ssatobb = 0.0_8
2527 tempb2 = ssatobb/tautob
2528 ssataub = ssataub + tempb2
2529 tautobb = tautobb - (ssatau+tauclb(k))*tempb2/tautob
2530 tauclbb(k) = tauclbb(k) + tautobb + tempb2
2531 taustob = taustob + tautobb
2548 asytob = asysto/ssatau
2553 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb, &
2554 & dsm, rst, rstb, tst, tstb, dum, dumb)
2555 CALL deledd_b(tautob, tautobb, ssatob, ssatobb, asytob, asytobb, &
2556 & cosz_dev(i), rrt, rrtb, ttt, tttb, tdt, tdtb)
2558 IF (branch .EQ. 0) ssatobb = 0.0_8
2560 ssataub = ssataub + ssatobb/tautob - asysto*asytobb/ssatau**2
2561 tautobb = tautobb - ssatau*ssatobb/tautob**2
2562 asystob = asystob + asytobb/ssatau
2564 taustob = taustob + tautobb
2565 asya_devb(i, k, ib) = asya_devb(i, k, ib) + asystob
2566 ssaa_devb(i, k, ib) = ssaa_devb(i, k, ib) + ssataub
2569 taua_devb(i, k, ib) = taua_devb(i, k, ib) + taustob
2570 whb(k) = whb(k) + wk_uv(ib)*tauwvb
2571 ohb(k) = ohb(k) + zk_uv(ib)*tauozb
2574 tdb(0, 1) = tdb(0, 1) + tdb(0, 2)
2577 tempb1 = -(exp(-((wk_uv(ib)*wvtoa+zk_uv(ib)*o3toa)/cosz_dev(i)))*tdb&
2578 & (0, 1)/cosz_dev(i))
2579 wvtoab = wvtoab + wk_uv(ib)*tempb1
2580 o3toab = o3toab + zk_uv(ib)*tempb1
2586 taudiffb(k, 1) = taudiffb(k, 1) + tauclfb(k)
2587 taudiffb(k, 2) = taudiffb(k, 2) + tauclfb(k)
2588 taudiffb(k, 3) = taudiffb(k, 3) + tauclfb(k)
2589 taudiffb(k, 4) = taudiffb(k, 4) + tauclfb(k)
2591 taubeamb(k, 1) = taubeamb(k, 1) + tauclbb(k)
2592 taubeamb(k, 2) = taubeamb(k, 2) + tauclbb(k)
2593 taubeamb(k, 3) = taubeamb(k, 3) + tauclbb(k)
2594 taubeamb(k, 4) = taubeamb(k, 4) + tauclbb(k)
2599 IF (branch .LT. 3)
THEN 2600 IF (branch .EQ. 0)
THEN 2601 fcld_devb(i, k) = fcld_devb(i, k) + cc3b
2603 ELSE IF (branch .NE. 1)
THEN 2604 fcld_devb(i, k) = fcld_devb(i, k) + cc2b
2607 ELSE IF (branch .NE. 3)
THEN 2608 IF (branch .EQ. 4)
THEN 2609 fcld_devb(i, k) = fcld_devb(i, k) + cc1b
2614 CALL getvistau1_b(np, cosz_dev(i), dp_pa, fcld_col, fcld_colb, &
2615 & reff_col, reff_colb, cwc_col, cwc_colb, ict, icb, taubeam&
2616 & , taubeamb, taudiff, taudiffb, asycl, asyclb, aig_uv, &
2617 & awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, aib_nir, awb_nir, &
2618 & arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir, &
2619 & arg_nir, caib, caif, cons_grav)
2621 flx_devb(i, k) = 0.0_8
2625 cwc_devb(i, k, l) = cwc_devb(i, k, l) + cwc_colb(k, l)
2626 cwc_colb(k, l) = 0.0_8
2627 reff_devb(i, k, l) = reff_devb(i, k, l) + reff_colb(k, l)
2628 reff_colb(k, l) = 0.0_8
2630 fcld_devb(i, k) = fcld_devb(i, k) + fcld_colb(k)
2631 fcld_colb(k) = 0.0_8
2632 oa_devb(i, k) = oa_devb(i, k) + dp(k)*466.7*1.02*ohb(k)
2634 swhb(k) = swhb(k) + swhb(k+1)
2635 whb(k) = whb(k) + swhb(k+1)
2637 tempb0 = scal(k)*1.02*whb(k)
2638 wa_devb(i, k) = wa_devb(i, k) + (0.00135*(ta_dev(i, k)-240.)+1.)*&
2640 ta_devb(i, k) = ta_devb(i, k) + wa_dev(i, k)*0.00135*tempb0
2643 wvtoab = wvtoab + swhb(1)
2644 tempb = scal0*1.02*wvtoab
2645 wa_devb(i, 1) = wa_devb(i, 1) + (0.00135*(ta_dev(i, 1)-240.)+1.0)*&
2647 ta_devb(i, 1) = ta_devb(i, 1) + wa_dev(i, 1)*0.00135*tempb
2648 oa_devb(i, 1) = oa_devb(i, 1) + xtoa*466.7*1.02*o3toab
2655 SUBROUTINE deledd_b(tau1, tau1b, ssc1, ssc1b, g01, g01b, cza1, rr1, rr1b&
2656 & , tt1, tt1b, td1, td1b)
2659 INTEGER,
PARAMETER :: real_de=8
2662 REAL*8,
INTENT(IN) :: tau1, ssc1, g01, cza1
2663 REAL*8 :: tau1b, ssc1b, g01b
2665 REAL*8 :: rr1, tt1, td1
2666 REAL*8 :: rr1b, tt1b, td1b
2668 REAL*8,
PARAMETER :: zero=0.0_real_de
2669 REAL*8,
PARAMETER :: one=1.0_real_de
2670 REAL*8,
PARAMETER :: two=2.0_real_de
2671 REAL*8,
PARAMETER :: three=3.0_real_de
2672 REAL*8,
PARAMETER :: four=4.0_real_de
2673 REAL*8,
PARAMETER :: fourth=0.25_real_de
2674 REAL*8,
PARAMETER :: seven=7.0_real_de
2675 REAL*8,
PARAMETER :: thresh=1.e-8_real_de
2676 REAL*8 :: tau, ssc, g0, rr, tt, td
2677 REAL*8 :: taub, sscb, g0b, rrb, ttb, tdb
2678 REAL*8 :: zth, ff, xx, taup, sscp, gp, gm1, gm2, gm3, akk, alf1, alf2
2679 REAL*8 :: ffb, xxb, taupb, sscpb, gpb, gm1b, gm2b, gm3b, akkb, alf1b, &
2681 REAL*8 :: all, bll, st7, st8, cll, dll, fll, ell, st1, st2, st3, st4
2682 REAL*8 :: allb, bllb, st7b, st8b, cllb, dllb, fllb, ellb, st1b, st2b, &
2719 sscp = ssc*(one-ff)/xx
2722 gm1 = (seven-sscp*(four+xx))*fourth
2723 gm2 = -((one-sscp*(four-xx))*fourth)
2724 akk = sqrt((gm1+gm2)*(gm1-gm2))
2729 IF (st3 .GE. 0.)
THEN 2734 IF (abs0 .LT. thresh)
THEN 2737 IF (zth .GT. 1.0) zth = zth - 0.0020
2748 td = exp(-(taup/zth))
2749 gm3 = (two-zth*three*gp)*fourth
2754 all = (gm3-alf2*zth)*xx*td
2755 bll = (one-gm3+alf1*zth)*xx
2762 st2 = exp(-(akk*taup))
2764 st1 = sscp/((akk+gm1+(akk-gm1)*st4)*st3)
2765 rr = (cll-dll*st4-all*st2)*st1
2766 tt = -(((fll-ell*st4)*td-bll*st2)*st1)
2767 IF (rr .LT. zero)
THEN 2774 IF (tt .LT. zero)
THEN 2789 IF (branch .EQ. 0) ttb = 0.0_8
2791 IF (branch .EQ. 0) rrb = 0.0_8
2792 st1b = (cll-dll*st4-all*st2)*rrb - ((fll-ell*st4)*td-bll*st2)*ttb
2794 temp = akk + gm1 + (akk-gm1)*st4
2795 tempb7 = st1b/(temp*st3)
2796 tempb8 = -(sscp*tempb7/(temp*st3))
2801 ellb = -(st4*tempb3)
2802 st4b = (akk-gm1)*tempb5 - dll*tempb4 - ell*tempb3
2803 bllb = -(st2*tempb2)
2804 st2b = 2*st2*st4b - all*tempb4 - bll*tempb2
2806 dllb = -(st4*tempb4)
2807 allb = -(st2*tempb4)
2810 tempb9 = exp(-(akk*taup))*st2b
2811 xxb = st8*fllb - st7*ellb
2812 akkb = (one-gm3)*xxb - taup*tempb9 + (st4+1.0_8)*tempb5
2813 st7b = (alf1-xx)*ellb
2814 st8b = (alf1+xx)*fllb
2817 xxb = st7*cllb - st8*dllb
2818 st8b = st8b + (alf2-xx)*dllb
2819 st7b = st7b + (alf2+xx)*cllb
2820 akkb = akkb + gm3*xxb
2822 alf1b = st8*fllb + xx*zth*bllb + st7*ellb
2823 gm3b = gm3b + akk*xxb - xx*bllb
2824 tempb10 = xx*td*allb
2825 alf2b = st7*cllb - zth*tempb10 + st8*dllb
2826 tempb6 = (gm3-zth*alf2)*allb
2827 tdb = tdb + xx*tempb6 + (fll-ell*st4)*tempb2
2828 taupb = -(exp(-(taup/zth))*tdb/zth) - akk*tempb9
2829 xxb = td*tempb6 + (one+zth*alf1-gm3)*bllb
2830 akkb = akkb + two*xxb
2832 gm3b = gm3b + xx*alf2b - xx*alf1b + tempb10
2833 xxb = gm3*alf2b - gm3*alf1b
2834 gm1b = alf1b + xxb + (1.0_8-st4)*tempb5
2836 gpb = -(fourth*zth*three*gm3b)
2838 IF (branch .NE. 0)
THEN 2839 st7b = st7b + st8*st3b
2840 st8b = st8b + st7*st3b
2844 akkb = akkb + zth*xxb
2850 st7b = st7b + st8*st3b
2851 st8b = st8b + st7*st3b
2853 akkb = akkb + zth*xxb
2855 IF ((gm1+gm2)*(gm1-gm2) .EQ. 0.0)
THEN 2858 tempb = akkb/(2.0*sqrt((gm1+gm2)*(gm1-gm2)))
2860 gm1b = gm1b + 2*gm1*tempb
2861 gm2b = gm2b - 2*gm2*tempb
2862 sscpb = sscpb + fourth*(four-xx)*gm2b - fourth*(four+xx)*gm1b
2863 xxb = -(fourth*sscp*gm1b) - sscp*fourth*gm2b
2864 gpb = gpb + three*xxb
2866 tempb0 = gpb/(one+g0)
2867 tempb1 = (one-ff)*sscpb/xx
2868 xxb = tau*taupb - ssc*tempb1/xx
2869 ffb = -(ssc*xxb) - ssc*sscpb/xx
2870 g0b = 2*g0*ffb + (1.0_8-g0/(one+g0))*tempb0
2871 sscb = tempb1 - ff*xxb
2873 ssc1b = ssc1b + sscb
2874 tau1b = tau1b + taub
2882 SUBROUTINE getvistau1_b(nlevs, cosz, dp, fcld, fcldb, reff, reffb, &
2883 & hydromets, hydrometsb, ict, icb, taubeam, taubeamb, taudiff, taudiffb&
2884 & , asycl, asyclb, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv, arb_uv, &
2885 & aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, aig_nir, awg_nir&
2886 & , arg_nir, caib, caif, cons_grav)
2891 INTEGER,
INTENT(IN) :: nlevs
2893 REAL*8,
INTENT(IN) :: cosz
2895 REAL*8,
INTENT(IN) :: dp(nlevs)
2897 REAL*8,
INTENT(IN) :: fcld(nlevs)
2898 REAL*8 :: fcldb(nlevs)
2900 REAL*8,
INTENT(IN) :: reff(nlevs, 4)
2901 REAL*8 :: reffb(nlevs, 4)
2903 REAL*8,
INTENT(IN) :: hydromets(nlevs, 4)
2904 REAL*8 :: hydrometsb(nlevs, 4)
2906 INTEGER,
INTENT(IN) :: ict, icb
2915 REAL*8 :: taubeam(nlevs, 4)
2916 REAL*8 :: taubeamb(nlevs, 4)
2918 REAL*8 :: taudiff(nlevs, 4)
2919 REAL*8 :: taudiffb(nlevs, 4)
2921 REAL*8 :: asycl(nlevs)
2922 REAL*8 :: asyclb(nlevs)
2944 INTEGER :: k, in, im, it, ia, kk
2945 REAL*8 :: fm, ft, fa, xai, tauc, asyclt
2946 REAL*8 :: ftb, fab, xaib, taucb, asycltb
2949 REAL*8 :: taucld1, taucld2, taucld3, taucld4
2950 REAL*8 :: taucld1b, taucld2b, taucld3b, taucld4b
2951 REAL*8 :: g1, g2, g3, g4
2952 REAL*8 :: g1b, g2b, g3b, g4b
2954 REAL*8 :: reff_snowb
2955 INTEGER,
PARAMETER :: nm=11, nt=9, na=11
2956 REAL*8,
PARAMETER :: dm=0.1, dt=0.30103, da=0.1, t1=-0.9031
2957 REAL*8,
INTENT(IN) :: aig_uv(3), awg_uv(3), arg_uv(3)
2958 REAL*8,
INTENT(IN) :: aib_uv, awb_uv(2), arb_uv(2)
2959 REAL*8,
INTENT(IN) :: aib_nir, awb_nir(3, 2), arb_nir(3, 2)
2960 REAL*8,
INTENT(IN) :: aia_nir(3, 3), awa_nir(3, 3), ara_nir(3, 3)
2961 REAL*8,
INTENT(IN) :: aig_nir(3, 3), awg_nir(3, 3), arg_nir(3, 3)
2962 REAL*8,
INTENT(IN) :: caib(11, 9, 11), caif(9, 11)
2963 REAL*8,
INTENT(IN) :: cons_grav
2984 IF (ict .NE. 0)
THEN 2995 IF (cc(1) .LT. fcld(k))
THEN 3004 IF (cc(2) .LT. fcld(k))
THEN 3013 IF (cc(3) .LT. fcld(k))
THEN 3033 IF (reff(k, 1) .LE. 0.)
THEN 3039 taucld1 = dp(k)*1.0e3/cons_grav*hydromets(k, 1)*aib_uv/reff(k, 1)
3042 IF (reff(k, 2) .LE. 0.)
THEN 3048 taucld2 = dp(k)*1.0e3/cons_grav*hydromets(k, 2)*(awb_uv(1)+awb_uv(&
3053 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_uv(1)
3054 IF (reff(k, 4) .GT. 112.0)
THEN 3060 reff_snow = reff(k, 4)
3063 IF (reff_snow .LE. 0.)
THEN 3069 taucld4 = dp(k)*1.0e3/cons_grav*hydromets(k, 4)*aib_uv/reff_snow
3072 IF (ict .NE. 0)
THEN 3081 IF (k .LT. ict)
THEN 3085 ELSE IF (k .GE. ict .AND. k .LT. icb)
THEN 3094 tauc = taucld1 + taucld2 + taucld3 + taucld4
3095 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 3099 IF (tauc .GT. 32.)
THEN 3108 ft = (log10(tauc)-t1)/dt
3131 IF (im .GT. nm - 1)
THEN 3136 IF (it .GT. nt - 1)
THEN 3141 IF (ia .GT. na - 1)
THEN 3146 fm = fm -
REAL(im - 1)
3147 ft = ft -
REAL(it - 1)
3148 fa = fa -
REAL(ia - 1)
3154 xai = (-(caib(im-1, it, ia)*(1.-fm))+caib(im+1, it, ia)*(1.+fm))&
3155 & *fm*.5 + caib(im, it, ia)*(1.-fm*fm)
3156 xai = xai + (-(caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(&
3157 & 1.+ft))*ft*.5 + caib(im, it, ia)*(1.-ft*ft)
3158 xai = xai + (-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(&
3159 & 1.+fa))*fa*.5 + caib(im, it, ia)*(1.-fa*fa)
3160 xai = xai - 2.*caib(im, it, ia)
3161 IF (xai .LT. 0.0)
THEN 3168 IF (xai .GT. 1.0)
THEN 3180 xai = (-(caif(it-1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ft*.5 +&
3181 & caif(it, ia)*(1.-ft*ft)
3182 xai = xai + (-(caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*&
3183 & fa*.5 + caif(it, ia)*(1.-fa*fa)
3184 xai = xai - caif(it, ia)
3185 IF (xai .LT. 0.0)
THEN 3192 IF (xai .GT. 1.0)
THEN 3209 tauc = taucld1 + taucld2 + taucld3 + taucld4
3210 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 3221 IF (branch .EQ. 0)
THEN 3222 g1 = (aig_uv(1)+(aig_uv(2)+aig_uv(3)*reff(k, 1))*reff(k, 1))*&
3224 g2 = (awg_uv(1)+(awg_uv(2)+awg_uv(3)*reff(k, 2))*reff(k, 2))*&
3226 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_uv(1)
3227 g3 = arg_uv(1)*taucld3
3228 g4 = (aig_uv(1)+(aig_uv(2)+aig_uv(3)*reff_snow)*reff_snow)*taucld4
3229 tauc = taucld1 + taucld2 + taucld3 + taucld4
3230 tempb7 = asycltb/tauc
3235 taucb = -((g1+g2+g3+g4)*tempb7/tauc)
3236 temp3 = aig_uv(2) + aig_uv(3)*reff_snow
3237 reff_snowb = (taucld4*temp3+reff_snow*taucld4*aig_uv(3))*g4b
3238 taucld4b = (aig_uv(1)+temp3*reff_snow)*g4b
3239 taucld3b = arg_uv(1)*g3b
3240 temp2 = awg_uv(2) + awg_uv(3)*reff(k, 2)
3241 reffb(k, 2) = reffb(k, 2) + (taucld2*temp2+reff(k, 2)*taucld2*&
3243 taucld2b = (awg_uv(1)+temp2*reff(k, 2))*g2b
3244 temp1 = aig_uv(2) + aig_uv(3)*reff(k, 1)
3245 reffb(k, 1) = reffb(k, 1) + (taucld1*temp1+reff(k, 1)*taucld1*&
3247 taucld1b = (aig_uv(1)+temp1*reff(k, 1))*g1b
3257 taucld1b = taucld1b + taucb
3258 taucld2b = taucld2b + taucb
3259 taucld3b = taucld3b + taucb
3260 taucld4b = taucld4b + taucb
3262 IF (branch .EQ. 0)
THEN 3263 taucld4b = taucld4b + xai*taudiffb(k, 4)
3264 xaib = taucld4*taudiffb(k, 4)
3265 taudiffb(k, 4) = 0.0_8
3266 taucld3b = taucld3b + xai*taudiffb(k, 3)
3267 xaib = xaib + taucld3*taudiffb(k, 3)
3268 taudiffb(k, 3) = 0.0_8
3269 taucld2b = taucld2b + xai*taudiffb(k, 2)
3270 xaib = xaib + taucld2*taudiffb(k, 2)
3271 taudiffb(k, 2) = 0.0_8
3272 taucld1b = taucld1b + xai*taudiffb(k, 1)
3273 xaib = xaib + taucld1*taudiffb(k, 1)
3274 taudiffb(k, 1) = 0.0_8
3276 IF (branch .EQ. 0) xaib = 0.0_8
3278 IF (branch .EQ. 0) xaib = 0.0_8
3280 fab = (.5*(caif(it, ia+1)*(fa+1.)-caif(it, ia-1)*(1.-fa))-caif(it&
3281 & , ia)*2*fa)*xaib + (caif(it, ia-1)+caif(it, ia+1))*tempb5
3284 ftb = (.5*(caif(it+1, ia)*(ft+1.)-caif(it-1, ia)*(1.-ft))-caif(it&
3285 & , ia)*2*ft)*xaib + (caif(it-1, ia)+caif(it+1, ia))*tempb6
3286 taucld4b = taucld4b + xai*taubeamb(k, 4)
3287 xaib = taucld4*taubeamb(k, 4)
3288 taubeamb(k, 4) = 0.0_8
3289 taucld3b = taucld3b + xai*taubeamb(k, 3)
3290 xaib = xaib + taucld3*taubeamb(k, 3)
3291 taubeamb(k, 3) = 0.0_8
3292 taucld2b = taucld2b + xai*taubeamb(k, 2)
3293 xaib = xaib + taucld2*taubeamb(k, 2)
3294 taubeamb(k, 2) = 0.0_8
3295 taucld1b = taucld1b + xai*taubeamb(k, 1)
3296 xaib = xaib + taucld1*taubeamb(k, 1)
3297 taubeamb(k, 1) = 0.0_8
3299 IF (branch .EQ. 0) xaib = 0.0_8
3301 IF (branch .EQ. 0) xaib = 0.0_8
3303 fab = fab + (.5*(caib(im, it, ia+1)*(fa+1.)-caib(im, it, ia-1)*(1.&
3304 & -fa))-caib(im, it, ia)*2*fa)*xaib + (caib(im, it, ia-1)+caib(im&
3305 & , it, ia+1))*tempb3
3307 ftb = ftb + (.5*(caib(im, it+1, ia)*(ft+1.)-caib(im, it-1, ia)*(1.&
3308 & -ft))-caib(im, it, ia)*2*ft)*xaib + (caib(im, it-1, ia)+caib(im&
3309 & , it+1, ia))*tempb4
3316 taucb = ftb/(dt*tauc*log(10.0))
3318 IF (branch .EQ. 0) taucb = 0.0_8
3321 fcldb(k) = fcldb(k) + tempb2
3322 ccb(kk) = ccb(kk) - fcld(k)*tempb2/cc(kk)
3323 ELSE IF (branch .EQ. 1)
THEN 3326 taucld4b = taucld4b + taubeamb(k, 4) + taudiffb(k, 4)
3327 taudiffb(k, 4) = 0.0_8
3328 taubeamb(k, 4) = 0.0_8
3329 taucld3b = taucld3b + taubeamb(k, 3) + taudiffb(k, 3)
3330 taudiffb(k, 3) = 0.0_8
3331 taubeamb(k, 3) = 0.0_8
3332 taucld2b = taucld2b + taubeamb(k, 2) + taudiffb(k, 2)
3333 taudiffb(k, 2) = 0.0_8
3334 taubeamb(k, 2) = 0.0_8
3335 taucld1b = taucld1b + taubeamb(k, 1) + taudiffb(k, 1)
3336 taudiffb(k, 1) = 0.0_8
3337 taubeamb(k, 1) = 0.0_8
3340 taucld1b = taucld1b + taucb
3341 taucld2b = taucld2b + taucb
3342 taucld3b = taucld3b + taucb
3343 taucld4b = taucld4b + taucb
3345 IF (branch .EQ. 0)
THEN 3347 ELSE IF (branch .EQ. 1)
THEN 3353 IF (branch .EQ. 0)
THEN 3357 tempb1 = dp(k)*aib_uv*1.0e3*taucld4b/(cons_grav*reff_snow)
3358 hydrometsb(k, 4) = hydrometsb(k, 4) + tempb1
3359 reff_snowb = reff_snowb - hydromets(k, 4)*tempb1/reff_snow
3362 IF (branch .EQ. 0)
THEN 3366 reffb(k, 4) = reffb(k, 4) + reff_snowb
3369 hydrometsb(k, 3) = hydrometsb(k, 3) + dp(k)*arb_uv(1)*1.0e3*taucld3b&
3372 IF (branch .EQ. 0)
THEN 3374 temp0 = awb_uv(2)/reff(k, 2)
3375 tempb0 = dp(k)*1.0e3*taucld2b
3376 hydrometsb(k, 2) = hydrometsb(k, 2) + (awb_uv(1)+temp0)*tempb0/&
3378 reffb(k, 2) = reffb(k, 2) - hydromets(k, 2)*temp0*tempb0/(reff(k, &
3384 IF (branch .EQ. 0)
THEN 3388 temp = cons_grav*reff(k, 1)
3389 tempb = dp(k)*aib_uv*1.0e3*taucld1b/temp
3390 hydrometsb(k, 1) = hydrometsb(k, 1) + tempb
3391 reffb(k, 1) = reffb(k, 1) - hydromets(k, 1)*cons_grav*tempb/temp
3395 IF (branch .NE. 0)
THEN 3398 IF (branch .EQ. 0)
THEN 3399 fcldb(k) = fcldb(k) + ccb(3)
3405 IF (branch .EQ. 0)
THEN 3406 fcldb(k) = fcldb(k) + ccb(2)
3412 IF (branch .EQ. 0)
THEN 3413 fcldb(k) = fcldb(k) + ccb(1)
3425 SUBROUTINE getnirtau1_b(ib, nlevs, cosz, dp, fcld, fcldb, reff, reffb, &
3426 & hydromets, hydrometsb, ict, icb, taubeam, taubeamb, taudiff, taudiffb&
3427 & , asycl, asyclb, ssacl, ssaclb, aig_uv, awg_uv, arg_uv, aib_uv, awb_uv&
3428 & , arb_uv, aib_nir, awb_nir, arb_nir, aia_nir, awa_nir, ara_nir, &
3429 & aig_nir, awg_nir, arg_nir, caib, caif, cons_grav)
3433 INTEGER,
INTENT(IN) :: ib
3435 INTEGER,
INTENT(IN) :: nlevs
3437 REAL*8,
INTENT(IN) :: cosz
3439 REAL*8,
INTENT(IN) :: dp(nlevs)
3441 REAL*8,
INTENT(IN) :: fcld(nlevs)
3442 REAL*8 :: fcldb(nlevs)
3444 REAL*8,
INTENT(IN) :: reff(nlevs, 4)
3445 REAL*8 :: reffb(nlevs, 4)
3447 REAL*8,
INTENT(IN) :: hydromets(nlevs, 4)
3448 REAL*8 :: hydrometsb(nlevs, 4)
3450 INTEGER,
INTENT(IN) :: ict, icb
3451 REAL*8,
INTENT(IN) :: aig_uv(3), awg_uv(3), arg_uv(3)
3452 REAL*8,
INTENT(IN) :: aib_uv, awb_uv(2), arb_uv(2)
3453 REAL*8,
INTENT(IN) :: aib_nir, awb_nir(3, 2), arb_nir(3, 2)
3454 REAL*8,
INTENT(IN) :: aia_nir(3, 3), awa_nir(3, 3), ara_nir(3, 3)
3455 REAL*8,
INTENT(IN) :: aig_nir(3, 3), awg_nir(3, 3), arg_nir(3, 3)
3456 REAL*8,
INTENT(IN) :: caib(11, 9, 11), caif(9, 11)
3457 REAL*8,
INTENT(IN) :: cons_grav
3460 REAL*8 :: taubeam(nlevs, 4)
3461 REAL*8 :: taubeamb(nlevs, 4)
3463 REAL*8 :: taudiff(nlevs, 4)
3464 REAL*8 :: taudiffb(nlevs, 4)
3466 REAL*8 :: ssacl(nlevs)
3467 REAL*8 :: ssaclb(nlevs)
3469 REAL*8 :: asycl(nlevs)
3470 REAL*8 :: asyclb(nlevs)
3471 INTEGER :: k, in, im, it, ia, kk
3472 REAL*8 :: fm, ft, fa, xai, tauc, asyclt, ssaclt
3473 REAL*8 :: ftb, fab, xaib, taucb, asycltb, ssacltb
3476 REAL*8 :: taucld1, taucld2, taucld3, taucld4
3477 REAL*8 :: taucld1b, taucld2b, taucld3b, taucld4b
3478 REAL*8 :: g1, g2, g3, g4
3479 REAL*8 :: g1b, g2b, g3b, g4b
3480 REAL*8 :: w1, w2, w3, w4
3481 REAL*8 :: w1b, w2b, w3b, w4b
3483 REAL*8 :: reff_snowb
3484 INTEGER,
PARAMETER :: nm=11, nt=9, na=11
3485 REAL*8,
PARAMETER :: dm=0.1, dt=0.30103, da=0.1, t1=-0.9031
3511 IF (ict .NE. 0)
THEN 3522 IF (cc(1) .LT. fcld(k))
THEN 3531 IF (cc(2) .LT. fcld(k))
THEN 3540 IF (cc(3) .LT. fcld(k))
THEN 3558 IF (reff(k, 1) .LE. 0.)
THEN 3564 taucld1 = dp(k)*1.0e3/cons_grav*hydromets(k, 1)*aib_nir/reff(k, 1)
3567 IF (reff(k, 2) .LE. 0.)
THEN 3573 taucld2 = dp(k)*1.0e3/cons_grav*hydromets(k, 2)*(awb_nir(ib, 1)+&
3574 & awb_nir(ib, 2)/reff(k, 2))
3578 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_nir(ib, 1)
3579 IF (reff(k, 4) .GT. 112.0)
THEN 3585 reff_snow = reff(k, 4)
3588 IF (reff_snow .LE. 0.)
THEN 3594 taucld4 = dp(k)*1.0e3/cons_grav*hydromets(k, 4)*aib_nir/reff_snow
3597 IF (ict .NE. 0)
THEN 3606 IF (k .LT. ict)
THEN 3610 ELSE IF (k .GE. ict .AND. k .LT. icb)
THEN 3619 tauc = taucld1 + taucld2 + taucld3 + taucld4
3620 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 3622 IF (cc(kk) .NE. 0.0)
THEN 3631 IF (tauc .GT. 32.)
THEN 3640 ft = (log10(tauc)-t1)/dt
3663 IF (im .GT. nm - 1)
THEN 3668 IF (it .GT. nt - 1)
THEN 3673 IF (ia .GT. na - 1)
THEN 3678 fm = fm -
REAL(im - 1)
3679 ft = ft -
REAL(it - 1)
3680 fa = fa -
REAL(ia - 1)
3686 xai = (-(caib(im-1, it, ia)*(1.-fm))+caib(im+1, it, ia)*(1.+fm))&
3687 & *fm*.5 + caib(im, it, ia)*(1.-fm*fm)
3688 xai = xai + (-(caib(im, it-1, ia)*(1.-ft))+caib(im, it+1, ia)*(&
3689 & 1.+ft))*ft*.5 + caib(im, it, ia)*(1.-ft*ft)
3690 xai = xai + (-(caib(im, it, ia-1)*(1.-fa))+caib(im, it, ia+1)*(&
3691 & 1.+fa))*fa*.5 + caib(im, it, ia)*(1.-fa*fa)
3692 xai = xai - 2.*caib(im, it, ia)
3693 IF (xai .LT. 0.0)
THEN 3700 IF (xai .GT. 1.0)
THEN 3712 xai = (-(caif(it-1, ia)*(1.-ft))+caif(it+1, ia)*(1.+ft))*ft*.5 +&
3713 & caif(it, ia)*(1.-ft*ft)
3714 xai = xai + (-(caif(it, ia-1)*(1.-fa))+caif(it, ia+1)*(1.+fa))*&
3715 & fa*.5 + caif(it, ia)*(1.-fa*fa)
3716 xai = xai - caif(it, ia)
3717 IF (xai .LT. 0.0)
THEN 3724 IF (xai .GT. 1.0)
THEN 3742 tauc = taucld1 + taucld2 + taucld3 + taucld4
3743 IF (tauc .GT. 0.02 .AND. fcld(k) .GT. 0.01)
THEN 3745 w1 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff(k, 1)&
3746 & )*reff(k, 1)))*taucld1
3748 w2 = (1.-(awa_nir(ib, 1)+(awa_nir(ib, 2)+awa_nir(ib, 3)*reff(k, 2)&
3749 & )*reff(k, 2)))*taucld2
3751 w3 = (1.-ara_nir(ib, 1))*taucld3
3753 w4 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff_snow)&
3754 & *reff_snow))*taucld4
3755 g1 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 1))*&
3757 g2 = (awg_nir(ib, 1)+(awg_nir(ib, 2)+awg_nir(ib, 3)*reff(k, 2))*&
3759 g3 = arg_nir(ib, 1)*w3
3760 g4 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 4))*&
3762 IF (w1 + w2 + w3 + w4 .NE. 0.0)
THEN 3778 IF (branch .EQ. 0)
THEN 3779 w1 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff(k, 1)&
3780 & )*reff(k, 1)))*taucld1
3781 w2 = (1.-(awa_nir(ib, 1)+(awa_nir(ib, 2)+awa_nir(ib, 3)*reff(k, 2)&
3782 & )*reff(k, 2)))*taucld2
3783 taucld3 = dp(k)*1.0e3/cons_grav*hydromets(k, 3)*arb_nir(ib, 1)
3784 w3 = (1.-ara_nir(ib, 1))*taucld3
3785 w4 = (1.-(aia_nir(ib, 1)+(aia_nir(ib, 2)+aia_nir(ib, 3)*reff_snow)&
3786 & *reff_snow))*taucld4
3787 g1 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 1))*&
3789 g2 = (awg_nir(ib, 1)+(awg_nir(ib, 2)+awg_nir(ib, 3)*reff(k, 2))*&
3791 g3 = arg_nir(ib, 1)*w3
3792 g4 = (aig_nir(ib, 1)+(aig_nir(ib, 2)+aig_nir(ib, 3)*reff(k, 4))*&
3794 tempb8 = asycltb/(w1+w2+w3+w4)
3795 tempb9 = -((g1+g2+g3+g4)*tempb8/(w1+w2+w3+w4))
3804 ELSE IF (branch .EQ. 1)
THEN 3822 tauc = taucld1 + taucld2 + taucld3 + taucld4
3823 tempb7 = ssacltb/tauc
3824 temp6 = aig_nir(ib, 2) + aig_nir(ib, 3)*reff(k, 4)
3825 reffb(k, 4) = reffb(k, 4) + (w4*temp6+reff(k, 4)*w4*aig_nir(ib, 3))*&
3827 w4b = w4b + tempb7 + (aig_nir(ib, 1)+temp6*reff(k, 4))*g4b
3828 w3b = w3b + tempb7 + arg_nir(ib, 1)*g3b
3829 temp5 = awg_nir(ib, 2) + awg_nir(ib, 3)*reff(k, 2)
3830 reffb(k, 2) = reffb(k, 2) + (w2*temp5+reff(k, 2)*w2*awg_nir(ib, 3))*&
3832 w2b = w2b + tempb7 + (awg_nir(ib, 1)+temp5*reff(k, 2))*g2b
3833 temp4 = aig_nir(ib, 2) + aig_nir(ib, 3)*reff(k, 1)
3834 reffb(k, 1) = reffb(k, 1) + (w1*temp4+reff(k, 1)*w1*aig_nir(ib, 3))*&
3836 w1b = w1b + tempb7 + (aig_nir(ib, 1)+temp4*reff(k, 1))*g1b
3837 taucb = -((w1+w2+w3+w4)*tempb7/tauc)
3839 temp3 = aia_nir(ib, 2) + aia_nir(ib, 3)*reff_snow
3840 reff_snowb = (-(taucld4*temp3)-reff_snow*taucld4*aia_nir(ib, 3))*w4b
3841 taucld4b = (1.-temp3*reff_snow-aia_nir(ib, 1))*w4b
3843 taucld3b = (1.-ara_nir(ib, 1))*w3b
3845 temp2 = awa_nir(ib, 2) + awa_nir(ib, 3)*reff(k, 2)
3846 reffb(k, 2) = reffb(k, 2) + (-(taucld2*temp2)-reff(k, 2)*taucld2*&
3847 & awa_nir(ib, 3))*w2b
3848 taucld2b = (1.-temp2*reff(k, 2)-awa_nir(ib, 1))*w2b
3850 temp1 = aia_nir(ib, 2) + aia_nir(ib, 3)*reff(k, 1)
3851 reffb(k, 1) = reffb(k, 1) + (-(taucld1*temp1)-reff(k, 1)*taucld1*&
3852 & aia_nir(ib, 3))*w1b
3853 taucld1b = (1.-temp1*reff(k, 1)-aia_nir(ib, 1))*w1b
3855 taucld1b = taucld1b + taucb
3856 taucld2b = taucld2b + taucb
3857 taucld3b = taucld3b + taucb
3858 taucld4b = taucld4b + taucb
3860 IF (branch .EQ. 0)
THEN 3861 taucld4b = taucld4b + xai*taudiffb(k, 4)
3862 xaib = taucld4*taudiffb(k, 4)
3863 taudiffb(k, 4) = 0.0_8
3864 taucld3b = taucld3b + xai*taudiffb(k, 3)
3865 xaib = xaib + taucld3*taudiffb(k, 3)
3866 taudiffb(k, 3) = 0.0_8
3867 taucld2b = taucld2b + xai*taudiffb(k, 2)
3868 xaib = xaib + taucld2*taudiffb(k, 2)
3869 taudiffb(k, 2) = 0.0_8
3870 taucld1b = taucld1b + xai*taudiffb(k, 1)
3871 xaib = xaib + taucld1*taudiffb(k, 1)
3872 taudiffb(k, 1) = 0.0_8
3874 IF (branch .EQ. 0) xaib = 0.0_8
3876 IF (branch .EQ. 0) xaib = 0.0_8
3878 fab = (.5*(caif(it, ia+1)*(fa+1.)-caif(it, ia-1)*(1.-fa))-caif(it&
3879 & , ia)*2*fa)*xaib + (caif(it, ia-1)+caif(it, ia+1))*tempb5
3882 ftb = (.5*(caif(it+1, ia)*(ft+1.)-caif(it-1, ia)*(1.-ft))-caif(it&
3883 & , ia)*2*ft)*xaib + (caif(it-1, ia)+caif(it+1, ia))*tempb6
3884 taucld4b = taucld4b + xai*taubeamb(k, 4)
3885 xaib = taucld4*taubeamb(k, 4)
3886 taubeamb(k, 4) = 0.0_8
3887 taucld3b = taucld3b + xai*taubeamb(k, 3)
3888 xaib = xaib + taucld3*taubeamb(k, 3)
3889 taubeamb(k, 3) = 0.0_8
3890 taucld2b = taucld2b + xai*taubeamb(k, 2)
3891 xaib = xaib + taucld2*taubeamb(k, 2)
3892 taubeamb(k, 2) = 0.0_8
3893 taucld1b = taucld1b + xai*taubeamb(k, 1)
3894 xaib = xaib + taucld1*taubeamb(k, 1)
3895 taubeamb(k, 1) = 0.0_8
3897 IF (branch .EQ. 0) xaib = 0.0_8
3899 IF (branch .EQ. 0) xaib = 0.0_8
3901 fab = fab + (.5*(caib(im, it, ia+1)*(fa+1.)-caib(im, it, ia-1)*(1.&
3902 & -fa))-caib(im, it, ia)*2*fa)*xaib + (caib(im, it, ia-1)+caib(im&
3903 & , it, ia+1))*tempb3
3905 ftb = ftb + (.5*(caib(im, it+1, ia)*(ft+1.)-caib(im, it-1, ia)*(1.&
3906 & -ft))-caib(im, it, ia)*2*ft)*xaib + (caib(im, it-1, ia)+caib(im&
3907 & , it+1, ia))*tempb4
3914 taucb = ftb/(dt*tauc*log(10.0))
3916 IF (branch .EQ. 0) taucb = 0.0_8
3918 IF (branch .EQ. 0)
THEN 3923 fcldb(k) = fcldb(k) + tempb2
3924 ccb(kk) = ccb(kk) - fcld(k)*tempb2/cc(kk)
3926 ELSE IF (branch .EQ. 1)
THEN 3929 taucld4b = taucld4b + taubeamb(k, 4) + taudiffb(k, 4)
3930 taudiffb(k, 4) = 0.0_8
3931 taubeamb(k, 4) = 0.0_8
3932 taucld3b = taucld3b + taubeamb(k, 3) + taudiffb(k, 3)
3933 taudiffb(k, 3) = 0.0_8
3934 taubeamb(k, 3) = 0.0_8
3935 taucld2b = taucld2b + taubeamb(k, 2) + taudiffb(k, 2)
3936 taudiffb(k, 2) = 0.0_8
3937 taubeamb(k, 2) = 0.0_8
3938 taucld1b = taucld1b + taubeamb(k, 1) + taudiffb(k, 1)
3939 taudiffb(k, 1) = 0.0_8
3940 taubeamb(k, 1) = 0.0_8
3943 taucld1b = taucld1b + taucb
3944 taucld2b = taucld2b + taucb
3945 taucld3b = taucld3b + taucb
3946 taucld4b = taucld4b + taucb
3948 IF (branch .EQ. 0)
THEN 3950 ELSE IF (branch .EQ. 1)
THEN 3956 IF (branch .EQ. 0)
THEN 3960 tempb1 = dp(k)*aib_nir*1.0e3*taucld4b/(cons_grav*reff_snow)
3961 hydrometsb(k, 4) = hydrometsb(k, 4) + tempb1
3962 reff_snowb = reff_snowb - hydromets(k, 4)*tempb1/reff_snow
3965 IF (branch .EQ. 0)
THEN 3969 reffb(k, 4) = reffb(k, 4) + reff_snowb
3972 hydrometsb(k, 3) = hydrometsb(k, 3) + dp(k)*1.0e3*arb_nir(ib, 1)*&
3973 & taucld3b/cons_grav
3975 IF (branch .EQ. 0)
THEN 3977 temp0 = awb_nir(ib, 2)/reff(k, 2)
3978 tempb0 = dp(k)*1.0e3*taucld2b
3979 hydrometsb(k, 2) = hydrometsb(k, 2) + (awb_nir(ib, 1)+temp0)*&
3981 reffb(k, 2) = reffb(k, 2) - hydromets(k, 2)*temp0*tempb0/(reff(k, &
3987 IF (branch .EQ. 0)
THEN 3991 temp = cons_grav*reff(k, 1)
3992 tempb = dp(k)*aib_nir*1.0e3*taucld1b/temp
3993 hydrometsb(k, 1) = hydrometsb(k, 1) + tempb
3994 reffb(k, 1) = reffb(k, 1) - hydromets(k, 1)*cons_grav*tempb/temp
3998 IF (branch .NE. 0)
THEN 4001 IF (branch .EQ. 0)
THEN 4002 fcldb(k) = fcldb(k) + ccb(3)
4008 IF (branch .EQ. 0)
THEN 4009 fcldb(k) = fcldb(k) + ccb(2)
4015 IF (branch .EQ. 0)
THEN 4016 fcldb(k) = fcldb(k) + ccb(1)
subroutine, public deledd(tau1, ssc1, g01, cza1, rr1, tt1, td1)
subroutine popinteger4(x)
subroutine getnirtau1_b(ib, nlevs, cosz, dp, fcld, fcldb, reff, reffb, hydromets, hydrometsb, ict, icb, taubeam, taubeamb, taudiff, taudiffb, asycl, asyclb, ssacl, ssaclb, 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 popcontrol2b(cc)
void popreal8array(double *x, int n)
subroutine pushcontrol1b(cc)
subroutine deledd_b(tau1, tau1b, ssc1, ssc1b, g01, g01b, cza1, rr1, rr1b, tt1, tt1b, td1, td1b)
subroutine, public getnirtau1(ib, nlevs, cosz, dp, fcld, reff, hydromets, ict, icb, taubeam, taudiff, asycl, ssacl, 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 pushcontrol2b(cc)
subroutine, public getvistau1(nlevs, cosz, dp, fcld, reff, hydromets, ict, icb, taubeam, taudiff, asycl, 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)
void pushreal8array(double *x, int n)
real(kind=kind_real), parameter u1
subroutine, public sorad_b(m, np, nb, cosz_dev, pl_dev, ta_dev, ta_devb, wa_dev, wa_devb, oa_dev, oa_devb, co2, cwc_dev, cwc_devb, fcld_dev, fcld_devb, ict, icb, reff_dev, reff_devb, hk_uv, hk_ir, taua_dev, taua_devb, ssaa_dev, ssaa_devb, asya_dev, asya_devb, rsuvbm_dev, rsuvdf_dev, rsirbm_dev, rsirdf_dev, flx_dev, flx_devb, 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)
subroutine popcontrol3b(cc)
subroutine getvistau1_b(nlevs, cosz, dp, fcld, fcldb, reff, reffb, hydromets, hydrometsb, ict, icb, taubeam, taubeamb, taudiff, taudiffb, asycl, asyclb, 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 popcontrol1b(cc)
subroutine pushcontrol3b(cc)
subroutine pushinteger4(x)