2 nhclass,hp,nprof,ngate,nsizes,d,hgt_matrix,hm_matrix,re_matrix,p_matrix,t_matrix, &
3 rh_matrix,ze_non,ze_ray,h_atten_to_vol,g_atten_to_vol,dbze, &
4 g_to_vol_in,g_to_vol_out)
68 type(mie),
intent(in) :: mt
70 real*8,
intent(in) :: freq,k2
71 integer,
intent(in) :: do_ray,use_gas_abs,use_mie_table, &
72 nhclass,nprof,ngate,nsizes
73 real*8,
dimension(nsizes),
intent(in) :: d
74 real*8,
dimension(nprof,ngate),
intent(in) :: hgt_matrix, p_matrix, &
76 real*8,
dimension(nhclass,nprof,ngate),
intent(in) :: hm_matrix
77 real*8,
dimension(nhclass,nprof,ngate),
intent(inout) :: re_matrix
80 real*8,
dimension(nprof,ngate),
intent(out) :: ze_non,ze_ray, &
81 g_atten_to_vol,dbze,h_atten_to_vol
84 real*8,
optional,
dimension(ngate,nprof) :: &
85 g_to_vol_in,g_to_vol_out
96 integer*4,
dimension(ngate) :: &
102 real*8,
dimension(:),
allocatable :: &
107 real*8,
dimension(ngate) :: &
116 integer,
parameter :: kr8 = selected_real_kind(15,300)
117 real*8,
parameter :: xx = -1.0_kr8
118 real*8,
dimension(:),
allocatable :: xxa
119 real*8 :: kr, ze, zr,
pi, scale_factor, tc, re, ld, tmp1, ze2, kr2,apm,bpm
120 integer*4 :: tp,
i,
j,
k, pr, itt, iff
122 real*8 bin_length,
step,base,step_list(25),base_list(25)
123 integer*4 ire_type,
n,max_bin
125 logical :: g_to_vol_in_present, g_to_vol_out_present
128 g_to_vol_in_present = present(g_to_vol_in)
129 g_to_vol_out_present = present(g_to_vol_out)
138 step_list(
j)=3*(
j-1);
139 if(step_list(
j)>bin_length)
then
140 step_list(
j)=bin_length;
142 base_list(
j)=base_list(
j-1)+floor(bin_length/step_list(
j-1));
147 if (use_mie_table == 1) iff =
infind(mt%freq,freq,
sort=1)
165 if ((hm_matrix(
j,pr,
k) > 1e-12) .and. (hp%dtype(
j) > 0))
then
171 if (hydro(
k) == 1)
then
174 rho_a = (p_matrix(pr,
k)*100.)/(287*(t_matrix(pr,
k)+273.15))
179 if (hm_matrix(tp,pr,
k) <= 1e-12) cycle
183 itt =
infind(mt_ttl,t_matrix(pr,
k))
185 itt =
infind(mt_tti,t_matrix(pr,
k))
189 if( hp%dtype(tp)==2 .and. abs(hp%p2(tp)+1) < 1e-8)
then
194 if ((hp%rho(tp) > 0) .and. (apm < 0))
then
195 apm = (
pi/6)*hp%rho(tp)
200 ld = ((apm*
gamma(1.+bpm)*hp%p1(tp))/(rho_a*hm_matrix(tp,pr,
k)*1e-3))**tmp1
204 re_matrix(tp,pr,
k) = re;
208 if(re_matrix(tp,pr,
k).eq.0)
then
214 re=re_matrix(tp,pr,
k)
216 n=floor(re/bin_length)
234 ire_type=floor(re/
step)
236 if(ire_type.lt.1)
then
240 re=
step*(ire_type+0.5)
241 ire_type=ire_type+base-floor(
n*bin_length/
step)
244 if(ire_type.ge.nre_types)
then
249 re=re_matrix(tp,pr,
k)
252 hp%z_flag(tp,itt,ire_type)=.
false.
253 hp%scaled(tp,ire_type)=.
false.
259 if( .not. hp%z_flag(tp,itt,ire_type) )
then
262 select case(hp%dtype(tp))
265 allocate(di(ns),ni(ns),rhoi(ns),xxa(ns),deq(ns))
266 if (use_mie_table == 1)
allocate(mt_qext(ns),mt_qbsca(ns),ntemp(ns))
271 allocate(di(ns),ni(ns),rhoi(ns),xxa(ns),deq(ns))
272 if (use_mie_table == 1)
allocate(mt_qext(ns),mt_qbsca(ns),ntemp(ns))
280 call
dsd(hm_matrix(tp,pr,
k),re,di,ni,ns,hp%dtype(tp),rho_a, &
281 t_matrix(pr,
k),hp%dmin(tp),hp%dmax(tp),hp%apm(tp),hp%bpm(tp), &
282 hp%rho(tp),hp%p1(tp),hp%p2(tp),hp%p3(tp),hp%fc(tp,1:ns,ire_type), &
283 hp%scaled(tp,ire_type))
288 if (hp%rho(tp) < 0)
then
304 hp%rho_eff(tp,1:ns,ire_type) = 917
305 deq = ( ( 6/
pi*hp%apm(tp)/917 ) ** (1.0/3.0) ) * &
306 ( (di*1e-6) ** (hp%bpm(tp)/3.0) ) * 1e6
313 hp%rho_eff(tp,1:ns,ire_type) = 917
314 deq=di * ((hp%rho(tp)/917)**(1.0/3.0))
319 if (use_mie_table == 1)
then
334 rhoi = hp%rho_eff(tp,1:ns,ire_type)
337 if (use_mie_table == 1)
then
339 if ((hp%dtype(tp) == 4) .and. (hp%idd(tp) < 0))
then
340 hp%idd(tp) =
infind(mt%D,di(1))
346 select case(hp%dtype(tp))
348 mt_qext(1) = mt%qext(hp%idd(tp),itt,1,iff)
349 mt_qbsca(1) = mt%qbsca(hp%idd(tp),itt,1,iff)
351 mt_qext = mt%qext(:,itt,1,iff)
352 mt_qbsca = mt%qbsca(:,itt,1,iff)
355 call
zeff(freq,di,ni,ns,k2,mt_ttl(itt),0,do_ray, &
356 ze,zr,kr,mt_qext,mt_qbsca,xx)
361 select case(hp%dtype(tp))
363 if (hp%ifc(tp,1,ire_type) < 0)
then
364 hp%ifc(tp,1,ire_type) =
infind(mt%f,rhoi(1)/917.)
367 mt%qext(hp%idd(tp),itt+cnt_liq,hp%ifc(tp,1,ire_type),iff)
369 mt%qbsca(hp%idd(tp),itt+cnt_liq,hp%ifc(tp,1,ire_type),iff)
372 if (hp%ifc(tp,
i,ire_type) < 0)
then
373 hp%ifc(tp,
i,ire_type) =
infind(mt%f,rhoi(
i)/917.)
375 mt_qext(
i) = mt%qext(
i,itt+cnt_liq,hp%ifc(tp,
i,ire_type),iff)
376 mt_qbsca(
i) = mt%qbsca(
i,itt+cnt_liq,hp%ifc(tp,
i,ire_type),iff)
380 call
zeff(freq,di,ni,ns,k2,mt_tti(itt),1,do_ray, &
381 ze,zr,kr,mt_qext,mt_qbsca,xx)
388 call
zeff(freq,di,ni,ns,k2,t_matrix(pr,
k),phase,do_ray, &
389 ze,zr,kr,xxa,xxa,rhoi)
407 deallocate(di,ni,rhoi,xxa,deq)
408 if (use_mie_table == 1)
deallocate(mt_qext,mt_qbsca,ntemp)
412 if( hp%dtype(tp)==2 .and. abs(hp%p2(tp)+1) < 1e-8 )
then
414 ze = hp%Ze_scaled(tp,itt,ire_type)
415 zr = hp%Zr_scaled(tp,itt,ire_type)
416 kr = hp%kr_scaled(tp,itt,ire_type)
419 scale_factor=rho_a*hm_matrix(tp,pr,
k)
421 zr = hp%Zr_scaled(tp,itt,ire_type) * scale_factor
422 ze = hp%Ze_scaled(tp,itt,ire_type) * scale_factor
423 kr = hp%kr_scaled(tp,itt,ire_type) * scale_factor
430 kr_vol(
k) = kr_vol(
k) + kr
431 z_vol(
k) = z_vol(
k) + ze
432 z_ray(
k) = z_ray(
k) + zr
435 if( .not. hp%z_flag(tp,itt,ire_type) .and. 1.eq.1 )
then
437 if( ( (hp%dtype(tp)==1 .or. hp%dtype(tp)==5 .or. hp%dtype(tp)==2) .and. abs(hp%p1(tp)+1) < 1e-8 ) .or. &
438 ( hp%dtype(tp)==3 .or. hp%dtype(tp)==4 ) &
441 scale_factor=rho_a*hm_matrix(tp,pr,
k)
443 hp%Ze_scaled(tp,itt,ire_type) = ze/ scale_factor
444 hp%Zr_scaled(tp,itt,ire_type) = zr/ scale_factor
445 hp%kr_scaled(tp,itt,ire_type) = kr/ scale_factor
447 hp%z_flag(tp,itt,ire_type)=.true.
449 elseif( hp%dtype(tp)==2 .and. abs(hp%p2(tp)+1) < 1e-8 )
then
451 hp%Ze_scaled(tp,itt,ire_type) = ze
452 hp%Zr_scaled(tp,itt,ire_type) = zr
453 hp%kr_scaled(tp,itt,ire_type) = kr
455 hp%z_flag(tp,itt,ire_type)=.true.
475 if (g_to_vol_in_present)
then
476 g_to_vol(
k) = g_to_vol_in(
k,pr)
478 if ( (use_gas_abs == 1) .or. ((use_gas_abs == 2) .and. (pr == 1)) )
then
479 g_vol(
k) =
gases(p_matrix(pr,
k),t_matrix(pr,
k)+273.15, &
480 rh_matrix(pr,
k),freq)
482 elseif (use_gas_abs == 0)
then
490 h_atten_to_vol(pr,
k)=a_to_vol(
k)
491 g_atten_to_vol(pr,
k)=g_to_vol(
k)
492 if ((do_ray == 1) .and. (z_ray(
k) > 0))
then
493 ze_ray(pr,
k) = 10*log10(z_ray(
k))
497 if (z_vol(
k) > 0)
then
498 dbze(pr,
k) = 10*log10(z_vol(
k))-a_to_vol(
k)-g_to_vol(
k)
499 ze_non(pr,
k) = 10*log10(z_vol(
k))
507 if (g_to_vol_out_present) g_to_vol_out(:,pr) = g_to_vol