Bulk to Bin.
97 integer,
intent(in) :: xs, xe
98 integer,
intent(in) :: ys, ye
99 integer,
intent(in) :: dims(:)
100 integer,
intent(in) :: it
101 integer,
intent(in) :: rank
102 integer,
intent(in) :: handle
103 character(LEN=*),
intent(in) :: basename_org
104 real(RP),
intent(in) :: dens_org(:,:,:)
105 real(RP),
intent(inout) :: qtrc_org(:,:,:,:)
109 real(RP) :: sigma_sdf(4)
110 real(RP) :: r0_sdf(4)
111 real(RP) :: n0_sdf(4)
112 real(RP) :: rho_sdf(4)
113 character(LEN=11),
parameter :: fname_micpara=
"micpara.dat" 114 character(LEN=16) :: mp_type_outer =
"NONE" 115 character(LEN=16) :: mp_type_inner =
"NONE" 116 integer :: comm_world
118 namelist / param_atmos_phy_mp_bin2bulk / &
126 real(RP),
allocatable :: read3di(:,:,:)
127 real(RP),
allocatable :: qtrc_tmp(:,:,:,:)
129 integer :: fid_micpara
130 real(RP) :: coef0, coef1, coef2
131 real(RP) :: tmp_hyd, n_hyd, lambda_hyd
132 real(RP) :: dummy( nbin ), radc( nbin )
133 integer :: k, i, j, iq, ierr
134 integer :: nnbin, nnspc, nn
138 coef0 = 4.0_rp/3.0_rp*pi
139 coef1 = 4.0_rp/3.0_rp*sqrt(pi/2.0_rp)
142 sigma_sdf(1) = 0.2_rp
143 sigma_sdf(2) = 0.35_rp
144 sigma_sdf(3) = 0.35_rp
145 sigma_sdf(4) = 0.35_rp
147 r0_sdf(2) = 2.61e-6_rp
149 r0_sdf(4) = 2.61e-6_rp
150 n0_sdf(1) = 8.0e+6_rp
152 n0_sdf(3) = 3.0e+6_rp
153 n0_sdf(4) = 4.0e+6_rp
156 rho_sdf(3) = 100.0_rp
157 rho_sdf(4) = 400.0_rp
161 allocate( qtrc_tmp(dims(1)+2,dims(2),dims(3),11) )
164 read(io_fid_conf,nml=param_atmos_phy_mp_bin2bulk,iostat=ierr)
166 if( io_l )
write(io_fid_log,*)
'xxx Not found namelist. Check!' 168 elseif( ierr > 0 )
then 169 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_MP_BIN2BULK. Check!' 172 if( io_lnml )
write(io_fid_log,nml=param_atmos_phy_mp_bin2bulk)
174 if( trim(mp_type_inner) /=
"SUZUKI10" )
then 175 write(*,*)
'xxx MP_TYPE_INNER should be SUZUKI10 Check!' 176 write(*,*)
'Now MP_TYPE_INNER set as ', mp_type_inner
181 fid_micpara = io_get_available_fid()
183 open ( fid_micpara, file = fname_micpara, form =
'formatted', status =
'old', iostat=ierr )
188 read( fid_micpara,* ) nnspc, nnbin
190 if( nnbin /= nbin )
then 191 write(*,*)
'xxx nbin in inc_tracer and nbin in micpara.dat is different check!' 196 if( io_l )
write(io_fid_log,*)
'*** Radius of cloud ****' 198 read( fid_micpara,* ) nn, dummy( iq ), radc( iq )
199 if( io_l )
write(io_fid_log,
'(a,1x,i3,1x,a,1x,e15.7,1x,a)') &
200 "Radius of ", iq,
"th cloud bin (bin center)= ", radc( iq ) ,
"[m]" 203 close ( fid_micpara )
207 write(*,*)
'xxx micpara.dat does not exist. check!' 212 call fileread( read3di(:,:,:), basename_org,
"QV", it, rank )
214 qtrc_org(k+2,xs:xe,ys:ye,
i_qv) = read3di(:,:,k)
217 if( trim(mp_type_outer) ==
"KESSLER" )
then 219 if( io_l )
write(io_fid_log,*)
220 if( io_l )
write(io_fid_log,*)
'+++ SDF of Bin model is created from' 221 if( io_l )
write(io_fid_log,*)
'+++ Kessler type Bulk microphysical model' 223 call fileread( read3di(:,:,:), basename_org,
"QC", it, rank )
225 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qc) = read3di(:,:,k)
235 call fileread( read3di(:,:,:), basename_org,
"QR", it, rank )
237 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qr) = read3di(:,:,k)
252 dummy(iq) = coef1 / sigma_sdf(1) * dwatr * radc( iq )**3 &
254 - (
log( radc(iq) )-
log( r0_sdf(1) ) )**2*0.5_rp &
255 / sigma_sdf(1) / sigma_sdf(1) &
261 tmp_hyd = tmp_hyd + dummy(iq)
264 coef2 = ( qtrc_tmp(k+2,i,j,
i_qc)+qtrc_tmp(k+2,i,j,
i_qr) ) &
265 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
267 qtrc_org(k+2,i,j,
i_qv+iq) = coef2 * dummy(iq)
274 elseif( trim(mp_type_outer) ==
"TOMITA08" )
then 276 if( io_l )
write(io_fid_log,*)
277 if( io_l )
write(io_fid_log,*)
'+++ SDF of Bin model is created from' 278 if( io_l )
write(io_fid_log,*)
'+++ TOMITA08 Bulk microphysical model' 280 call fileread( read3di(:,:,:), basename_org,
"QC", it, rank )
282 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qc) = read3di(:,:,k)
292 call fileread( read3di(:,:,:), basename_org,
"QR", it, rank )
294 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qr) = read3di(:,:,k)
304 call fileread( read3di(:,:,:), basename_org,
"QI", it, rank )
306 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qi) = read3di(:,:,k)
316 call fileread( read3di(:,:,:), basename_org,
"QS", it, rank )
318 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qs) = read3di(:,:,k)
328 call fileread( read3di(:,:,:), basename_org,
"QG", it, rank )
330 qtrc_tmp(k+2,xs:xe,ys:ye,
i_qg) = read3di(:,:,k)
347 dummy(iq) = coef1 / sigma_sdf(1) * rho_sdf(1) * radc( iq )**3 &
349 - (
log( radc(iq) )-
log( r0_sdf(1) ) )**2*0.5_rp &
350 / sigma_sdf(1) / sigma_sdf(1) &
356 tmp_hyd = tmp_hyd + dummy(iq)
360 qtrc_tmp(k+2,i,j,
i_qc)+qtrc_tmp(k+2,i,j,
i_qr) &
361 + qtrc_tmp(k+2,i,j,
i_qs)+qtrc_tmp(k+2,i,j,
i_qi) &
362 + qtrc_tmp(k+2,i,j,
i_qg) &
364 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
366 qtrc_org(k+2,i,j,
i_qv+(il-1)*nbin+iq) = coef2 * dummy(iq)
373 elseif( nspc == 7 )
then 381 dummy(iq) = coef1 / sigma_sdf(1) * rho_sdf(1) * radc( iq )**3 &
383 - (
log( radc(iq) )-
log( r0_sdf(1) ) )**2*0.5_rp &
384 / sigma_sdf(1) / sigma_sdf(1) &
390 tmp_hyd = tmp_hyd + dummy(iq)
393 coef2 = ( qtrc_tmp(k+2,i,j,
i_qc)+qtrc_tmp(k+2,i,j,
i_qr) ) &
394 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
396 qtrc_org(k+2,i,j,
i_qv+(il-1)*nbin+iq) = coef2 * dummy(iq)
401 dummy(iq) = coef1 / sigma_sdf(2) * rho_sdf(2) * radc( iq )**3 &
403 - (
log( radc(iq) )-
log( r0_sdf(2) ) )**2*0.5_rp &
404 / sigma_sdf(2) / sigma_sdf(2) &
410 tmp_hyd = tmp_hyd + dummy(iq)
413 coef2 = qtrc_tmp(k+2,i,j,
i_qi) &
414 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
416 qtrc_org(k+2,i,j,
i_qv+(ip-1)*nbin+iq) = coef2 * dummy(iq)
420 n_hyd = coef0 * n0_sdf(3) * rho_sdf(3)
421 lambda_hyd = ( pi * rho_sdf(3) / 6.0_rp *n0_sdf(3) *
sf_gamma(4.0_rp) &
422 / ( qtrc_tmp(k+2,i,j,
i_qs) &
423 + (0.50_rp-sign(0.50_rp,qtrc_tmp(k+2,i,j,
i_qs)-eps)) &
426 dummy(iq) = n_hyd * radc( iq )**3 &
427 * exp( -lambda_hyd * 0.5_rp * radc( iq ) )
431 tmp_hyd = tmp_hyd + dummy(iq)
434 coef2 = qtrc_tmp(k+2,i,j,
i_qs) &
435 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
437 qtrc_org(k+2,i,j,
i_qv+(iss-1)*nbin+iq) = coef2 * dummy(iq)
441 n_hyd = coef0 * n0_sdf(4) * rho_sdf(4)
442 lambda_hyd = ( pi * rho_sdf(4) / 6.0_rp *n0_sdf(4) *
sf_gamma(4.0_rp) &
443 / ( qtrc_tmp(k+2,i,j,
i_qg) &
444 + (0.50_rp-sign(0.50_rp,qtrc_tmp(k+2,i,j,
i_qg)-eps)) &
447 dummy(iq) = n_hyd * radc( iq )**3 &
448 * exp( -lambda_hyd * 0.5_rp * radc( iq ) )
452 tmp_hyd = tmp_hyd + dummy(iq)
455 coef2 = qtrc_tmp(k+2,i,j,
i_qg) &
456 / ( tmp_hyd + ( 0.50_rp - sign(0.50_rp,tmp_hyd-eps) ) )
458 qtrc_org(k+2,i,j,
i_qv+(ig-1)*nbin+iq) = coef2 * dummy(iq)
467 elseif( trim(mp_type_outer) ==
"SN14" )
then 469 write(*,*)
'SN14 is not supported for MP_TYPE_OUTER now' 470 write(*,*)
'Please wait' 473 elseif( trim(mp_type_outer) ==
"SUZUKI10" )
then 475 if( io_l )
write(io_fid_log,*)
476 if( io_l )
write(io_fid_log,*)
'+++ SDF of Bin model is created directory' 477 if( io_l )
write(io_fid_log,*)
'+++ from Bin microphysical model' 479 call fileread( read3di(:,:,:), basename_org,
aq_name(iq), it, rank )
481 qtrc_org(k+2,xs:xe,ys:ye,iq) = read3di(:,:,k)
487 write(*,*)
'MP_TYPE_OUTER should be KESSLER, TOMITA08, or SUZUKI10' 488 write(*,*)
'Please check! Now MP_TYPE_OUTER set as ', mp_type_outer
493 deallocate( read3di )
494 deallocate( qtrc_tmp )
subroutine, public prc_mpistop
Abort MPI.
integer, dimension(2), public parent_jmax
parent max number in y-direction
module GRID (nesting system)
real(rp) function, public sf_gamma(x)
Gamma function.
character(len=h_short), dimension(:), allocatable, public aq_name
subroutine, public log(type, message)
integer, dimension(2), public parent_imax
parent max number in x-direction