10 ( ncol , nlm , mbs , ib , &
11 slr , amu0 , wc_clr , asym_clr , &
12 tau_clr , wc_cld , asym_cld , tau_cld , &
13 asdir , asdif , fddir_clr , fddif_clr , &
14 fudif_clr , fddir_all , fddif_all , fudif_all , &
15 cldamt , c_maximal , cf_max, cf_random )
32 integer (kind=int_kind),
intent(in):: &
38 real (kind=dbl_kind),
intent(in),
dimension(ncol):: &
43 real (kind=dbl_kind),
intent(in),
dimension(ncol,mbs):: &
47 real (kind=dbl_kind),
intent(in),
dimension(ncol,nlm):: &
59 real(kind=dbl_kind),
intent(out),
dimension(ncol, nlm+1):: &
69 integer (kind=int_kind) :: &
73 real (kind=dbl_kind),
parameter :: &
76 real (kind=dbl_kind) :: &
96 real (kind=dbl_kind),
dimension(nlm) :: &
118 real (kind=dbl_kind),
dimension(nlm+1) :: &
124 real (kind=dbl_kind),
dimension(nlm+1):: &
155 fact = asym_clr(i,l)*asym_clr(i,l)
156 asy = asym_clr(i,l)/(1. + asym_clr(i,l))
161 oms = ((1. - fact)*wc_clr(i,l))/(1. - fact*wc_clr(i,l))
162 taus = (1. - fact*wc_clr(i,l))*tau_clr(i,l)
165 exptau_s_clr(l) =
exp(-taus/amu0(i))
166 direct_s(l+1) = exptau_s_clr(l)*direct_s(l)
167 exptau_us_clr(l) =
exp(-tau_clr(i,l))
168 direct_us(l+1) = exptau_us_clr(l)*direct_us(l)
170 t = 0.25*(7. - oms*(4. + 3.*asy))
171 r = -0.25*(1. - oms*(4. - 3.*asy))
172 kappa = sqrt(t*t - r*r)
176 denom = (1. - rinf*rinf*eggtau*eggtau)
177 tr_clr(l) = (1. - rinf*rinf)*eggtau/denom
178 rr_clr(l) = rinf*(1. - eggtau*eggtau)/denom
180 fact = kappa*kappa - 1./(amu0(i)*amu0(i))
181 if (abs(fact) .lt. eps)
then
188 g3 = 0.5 - 0.75*asy*amu0(i)
190 aa = g3*(t - 1./amu0(i)) + g4*r
191 bb = g4*(t + 1./amu0(i)) + g3*r
192 sigu_clr_fract(l) = cc*((aa - rr_clr(l)*bb) - aa*tr_clr(l)*exptau_s_clr(l))
193 sigd_clr_fract(l) = cc*(-bb*tr_clr(l) + (bb-rr_clr(l)*aa)*exptau_s_clr(l))
200 prop = 1./(1. - re(l)*rr_clr(l))
201 re(l+1) = rr_clr(l) + tr_clr(l)*tr_clr(l)*re(l)*prop
202 vd(l+1) = sigd_clr_fract(l)*direct_s(l) + (tr_clr(l)*vd(l) + tr_clr(l)*re(l)*sigu_clr_fract(l)*direct_s(l))*prop
203 vu(l) = (rr_clr(l)*vd(l) + sigu_clr_fract(l)*direct_s(l))*prop
209 fudif_clr(i,nlm+1) = (asdif(i,ib)*vd(nlm+1) + &
210 asdir(i,ib)*slr(i)*amu0(i)*direct_s(nlm+1))/ &
211 (1. - asdif(i,ib)*re(nlm+1))
213 fddif_clr(i,l) = re(l)*fudif_clr(i,l) + vd(l)
214 fudif_clr(i,l-1) = tr_clr(l-1)*fudif_clr(i,l)*td(l-1) + vu(l-1)
218 fddir_clr(i,1) = amu0(i)*slr(i)
220 fd_total = fddif_clr(i,1)+amu0(i)*slr(i)*direct_s(l+1)
221 fddir_clr(i,l+1) = amu0(i)*slr(i)*direct_us(l+1)
222 fddif_clr(i,l+1) = fd_total - fddir_clr(i,l+1)
230 fact = asym_cld(i,l)*asym_cld(i,l)
231 asy = asym_cld(i,l)/(1. + asym_cld(i,l))
236 oms = ((1. - fact)*wc_cld(i,l))/(1. - fact*wc_cld(i,l))
237 taus = (1. - fact*wc_cld(i,l))*tau_cld(i,l)
241 exptau_s_cld(l) =
exp(-taus/amu0(i))
242 direct_s(l+1) = exptau_s_cld(l)*direct_s(l)
243 exptau_us_cld(l) =
exp(-tau_cld(i,l)/amu0(i))
246 t = 0.25*(7. - oms*(4. + 3.*asy))
247 r = -0.25*(1. - oms*(4. - 3.*asy))
248 kappa = sqrt(t*t - r*r)
252 denom = (1. - rinf*rinf*eggtau*eggtau)
253 tr_cld(l) = (1. - rinf*rinf)*eggtau/denom
254 rr_cld(l) = rinf*(1. - eggtau*eggtau)/denom
256 fact = kappa*kappa - 1./(amu0(i)*amu0(i))
257 if (abs(fact) .lt. eps)
then
264 g3 = 0.5 - 0.75*asy*amu0(i)
266 aa = g3*(t - 1./amu0(i)) + g4*r
267 bb = g4*(t + 1./amu0(i)) + g3*r
268 sigu_cld_fract(l) = cc*((aa - rr_cld(l)*bb) - aa*tr_cld(l)*exptau_s_cld(l))
269 sigu(l) = sigu_cld_fract(l)*direct_s(l)
270 sigd_cld_fract(l) = cc*(-bb*tr_cld(l) + (bb-rr_cld(l)*aa)*exptau_s_cld(l))
271 sigd(l) = sigd_cld_fract(l)*direct_s(l)
279 rr_tmp(l) = cf_max(i,l)*rr_cld(l) + (1. - cf_max(i,l))*rr_clr(l)
280 tr_tmp(l) = cf_max(i,l)*tr_cld(l) + (1. - cf_max(i,l))*tr_clr(l)
281 sigu_tmp_fract(l) = cf_max(i,l)*sigu_cld_fract(l) + (1. - cf_max(i,l))*sigu_clr_fract(l)
282 sigd_tmp_fract(l) = cf_max(i,l)*sigd_cld_fract(l) + (1. - cf_max(i,l))*sigd_clr_fract(l)
283 direct_s(l+1) = (cf_max(i,l)*exptau_s_cld(l) + (1. - cf_max(i,l))*exptau_s_clr(l))*direct_s(l)
284 direct_us(l+1) = (cf_max(i,l)*exptau_us_cld(l) + (1. - cf_max(i,l))*exptau_us_clr(l))*direct_us(l)
290 prop = 1./(1. - re(l)*rr_tmp(l))
291 re(l+1) = rr_tmp(l) + tr_tmp(l)*tr_tmp(l)*re(l)*prop
292 vd(l+1) = sigd_tmp_fract(l)*direct_s(l) + (tr_tmp(l)*vd(l) + tr_tmp(l)*re(l)*sigu_tmp_fract(l)*direct_s(l))*prop
293 vu(l) = (rr_tmp(l)*vd(l) + sigu_tmp_fract(l)*direct_s(l))*prop
299 fudif_max(nlm+1) = (asdif(i,ib)*vd(nlm+1) + &
300 asdir(i,ib)*slr(i)*amu0(i)*direct_s(nlm+1))/ &
301 (1. - asdif(i,ib)*re(nlm+1))
303 fddif_max(l) = re(l)*fudif_max(l) + vd(l)
304 fudif_max(l-1) = tr_tmp(l-1)*fudif_max(l)*td(l-1) + vu(l-1)
308 fddir_max(1) = amu0(i)*slr(i)
310 fd_total = amu0(i)*slr(i)*direct_s(l+1) + fddif_max(l+1)
311 fddir_max(l+1) = amu0(i)*slr(i)*direct_us(l+1)
312 fddif_max(l+1) = fd_total - fddir_max(l+1)
320 rr_tmp(l) = cf_random(i,l)*rr_cld(l) + (1. - cf_random(i,l))*rr_clr(l)
321 tr_tmp(l) = cf_random(i,l)*tr_cld(l) + (1. - cf_random(i,l))*tr_clr(l)
322 sigu_tmp_fract(l) = cf_random(i,l)*sigu_cld_fract(l) + (1. - cf_random(i,l))*sigu_clr_fract(l)
323 sigd_tmp_fract(l) = cf_random(i,l)*sigd_cld_fract(l) + (1. - cf_random(i,l))*sigd_clr_fract(l)
324 direct_s(l+1) = (cf_random(i,l)*exptau_s_cld(l) + (1. - cf_random(i,l))*exptau_s_clr(l))*direct_s(l)
325 direct_us(l+1) = (cf_random(i,l)*exptau_us_cld(l) + (1. - cf_random(i,l))*exptau_us_clr(l))*direct_us(l)
331 prop = 1./(1. - re(l)*rr_tmp(l))
332 re(l+1) = rr_tmp(l) + tr_tmp(l)*tr_tmp(l)*re(l)*prop
333 vd(l+1) = sigd_tmp_fract(l)*direct_s(l) + (tr_tmp(l)*vd(l) + tr_tmp(l)*re(l)*sigu_tmp_fract(l)*direct_s(l))*prop
334 vu(l) = (rr_tmp(l)*vd(l) + sigu_tmp_fract(l)*direct_s(l))*prop
340 fudif_rndm(nlm+1)= (asdif(i,ib)*vd(nlm+1) + &
341 asdir(i,ib)*slr(i)*amu0(i)*direct_s(nlm+1))/ &
342 (1. - asdif(i,ib)*re(nlm+1))
344 fddif_rndm(l) = re(l)*fudif_rndm(l) + vd(l)
345 fudif_rndm(l-1) = tr_tmp(l-1)*fudif_rndm(l)*td(l-1) + vu(l-1)
349 fddir_rndm(1) = amu0(i)*slr(i)
351 fd_total = amu0(i)*slr(i)*direct_s(l+1) + fddif_rndm(l+1)
352 fddir_rndm(l+1) = amu0(i)*slr(i)*direct_us(l+1)
353 fddif_rndm(l+1) = fd_total - fddir_rndm(l+1)
359 fddir_all(i,1) = amu0(i)*slr(i)
360 fudif_all(i,nlm+1) = (1. - c_maximal(i))*fudif_rndm(nlm+1) + c_maximal(i)*fudif_max(nlm+1)
362 fddif_all(i,l+1) = (1. - c_maximal(i))*fddif_rndm(l+1) + c_maximal(i)*fddif_max(l+1)
363 fddir_all(i,l+1) = (1. - c_maximal(i))*fddir_rndm(l+1) + c_maximal(i)*fddir_max(l+1)
364 fudif_all(i,l) = (1. - c_maximal(i))*fudif_rndm(l) + c_maximal(i)*fudif_max(l)