30 #include "macro_thermodyn.h" 72 saturation_pres2qsat_liq => atmos_saturation_pres2qsat_liq, &
73 saturation_pres2qsat_ice => atmos_saturation_pres2qsat_ice, &
79 thermodyn_temp_pres => atmos_thermodyn_temp_pres, &
80 thermodyn_pott => atmos_thermodyn_pott
101 # include "kernels.h" 111 integer,
parameter :: il = 1
112 integer,
parameter :: ic = 2
113 integer,
parameter :: ip = 3
114 integer,
parameter :: id = 4
115 integer,
parameter :: iss= 5
116 integer,
parameter :: ig = 6
117 integer,
parameter :: ih = 7
121 real(RP),
allocatable :: xctr( : )
122 real(RP),
allocatable :: xbnd( : )
123 real(RP),
allocatable :: radc( : )
124 real(RP),
allocatable :: cctr( :,: )
125 real(RP),
allocatable :: cbnd( :,: )
126 real(RP),
allocatable :: ck( :,:,:,: )
127 real(RP),
allocatable :: vt( :,: )
128 real(RP),
allocatable :: br( :,: )
129 integer,
allocatable :: ifrsl( :,:,: )
131 real(RP),
allocatable :: xactr( : )
132 real(RP),
allocatable :: xabnd( : )
133 real(RP),
allocatable :: rada( : )
135 real(RP),
allocatable :: expxctr( : )
136 real(RP),
allocatable :: expxbnd( : )
137 real(RP),
allocatable :: expxactr( : )
138 real(RP),
allocatable :: expxabnd( : )
139 real(RP),
allocatable :: rexpxctr( : )
140 real(RP),
allocatable :: rexpxbnd( : )
141 real(RP),
allocatable :: rexpxactr( : )
142 real(RP),
allocatable :: rexpxabnd( : )
147 real(RP),
allocatable,
save :: vterm( :,:,:,: )
148 integer,
private,
save :: mp_nstep_sedimentation
149 real(RP),
private,
save :: mp_rnstep_sedimentation
150 real(DP),
private,
save :: mp_dtsec_sedimentation
151 integer,
private,
save :: mp_ntmax_sedimentation= 1
152 real(RP),
private :: flg_thermodyn
153 real(RP),
private :: rtem00
156 real(RP),
parameter :: cldmin = 1.0e-10_rp
157 real(RP),
parameter :: oneovthird = 1.0_rp/3.0_rp
158 real(RP),
parameter :: thirdovforth = 3.0_rp/4.0_rp
159 real(RP),
parameter :: twoovthird = 2.0_rp/3.0_rp
161 real(RP) :: rbnd = 40.e-06_rp
164 real(RP) :: rhoa = 2.25e+03_rp
165 real(RP) :: emaer = 58.0_rp
166 real(RP) :: emwtr = 18.0_rp
167 real(RP) :: rasta = 1.e-08_rp
168 real(RP) :: raend = 1.e-06_rp
169 real(RP) :: r0a = 1.e-07_rp
170 logical :: flg_regeneration=.false.
171 logical :: flg_nucl=.false.
172 logical :: flg_icenucl=.false.
173 logical :: flg_sf_aero =.false.
174 integer,
private,
save :: rndm_flgp = 0
175 logical,
private,
save :: mp_doautoconversion = .true.
176 logical,
private,
save :: mp_doprecipitation = .true.
177 logical,
private,
save :: mp_donegative_fixer = .true.
178 logical,
private,
save :: mp_couple_aerosol = .false.
180 real(RP),
allocatable :: marate( : )
181 integer,
allocatable,
save :: ncld( : )
187 character(11),
parameter :: fname_micpara=
"micpara.dat" 188 integer(4) :: fid_micpara
191 integer,
allocatable :: blrg( :,: ), bsml( :,: )
193 integer :: mspc, mbin
194 real(RP),
private :: rndm(1,1,1)
197 real(RP),
private :: c_ccn = 100.e+6_rp
198 real(RP),
private :: kappa = 0.462_rp
200 real(RP),
private :: sigma = 7.5e-02_rp
201 real(RP),
private :: vhfct = 2.0_rp
203 real(RP),
parameter :: tcrit = 271.15_rp
204 integer,
private,
allocatable :: kindx( :,: )
207 integer,
parameter :: ndat = 33, icemax = 3
208 integer,
parameter :: kdeg = 4, ldeg = 4, nspc_mk = 7
210 real(DP),
allocatable :: radc_mk( : ), xctr_mk( : ), xbnd_mk( : )
211 real(DP),
allocatable :: cctr_mk( :,: ), cbnd_mk( :,: )
212 real(DP),
allocatable :: ck_mk( :,:,:,: )
213 real(DP),
allocatable :: vt_mk( :,: )
214 real(DP),
allocatable :: br_mk( :,: )
215 real(DP) :: xmss( nspc_mk,ndat ), zcap( nspc_mk,ndat ), vtrm( nspc_mk,ndat )
216 real(DP) :: blkr( nspc_mk,ndat ), blkd( nspc_mk,ndat ), ykrn( nspc_mk,nspc_mk,ndat,ndat )
218 real(DP) :: ywll( ndat,ndat ), ywli( ndat,ndat,icemax ), ywls( ndat,ndat )
219 real(DP) :: ywlg( ndat,ndat ), ywlh( ndat,ndat )
221 real(DP) :: ywil( ndat,ndat,icemax ), ywii( ndat,ndat,icemax,icemax )
222 real(DP) :: ywis( ndat,ndat,icemax ), ywig( ndat,ndat,icemax )
223 real(DP) :: ywih( ndat,ndat,icemax )
225 real(DP) :: ywsl( ndat,ndat ), ywsi( ndat,ndat,icemax ), ywss( ndat,ndat )
226 real(DP) :: ywsg( ndat,ndat ), ywsh( ndat,ndat )
228 real(DP) :: ywgl( ndat,ndat ), ywgi( ndat,ndat,icemax ), ywgs( ndat,ndat )
229 real(DP) :: ywgg( ndat,ndat ), ywgh( ndat,ndat )
231 real(DP) :: ywhl( ndat,ndat ), ywhi( ndat,ndat,icemax ), ywhs( ndat,ndat )
232 real(DP) :: ywhg( ndat,ndat ), ywhh( ndat,ndat )
258 character(len=*),
intent(in) :: MP_TYPE
264 real(RP) :: S10_EMAER
265 logical :: S10_FLAG_REGENE
266 logical :: S10_FLAG_NUCLEAT
267 logical :: S10_FLAG_ICENUCLEAT
268 logical :: S10_FLAG_SFAERO
269 integer :: S10_RNDM_FLGP
270 integer :: S10_RNDM_MSPC
271 integer :: S10_RNDM_MBIN
273 namelist / param_atmos_phy_mp / &
274 mp_ntmax_sedimentation, &
275 mp_doautoconversion, &
276 mp_doprecipitation, &
277 mp_donegative_fixer, &
280 namelist / param_atmos_phy_mp_suzuki10 / &
288 s10_flag_icenucleat, &
296 real(RP),
parameter :: max_term_vel = 10.0_rp
298 integer :: nnspc, nnbin
299 integer :: nn, mm, mmyu, nnyu
300 integer :: myu, nyu, i, j, k, n, ierr
304 allocate( xctr( nbin ) )
305 allocate( xbnd( nbin+1 ) )
306 allocate( radc( nbin ) )
307 allocate( cctr( nbin,nspc_mk ) )
308 allocate( cbnd( nbin+1,nspc_mk ) )
309 allocate( ck( nspc_mk,nspc_mk,nbin,nbin ) )
310 allocate( vt( nspc_mk,nbin ) )
311 allocate( br( nspc_mk,nbin ) )
312 allocate( ifrsl( 2,nspc_mk,nspc_mk ) )
313 allocate( expxctr( nbin ) )
314 allocate( expxbnd( nbin+1 ) )
315 allocate( rexpxctr( nbin ) )
316 allocate( rexpxbnd( nbin+1 ) )
317 if ( nccn /= 0 )
then 318 allocate( xactr( nccn ) )
319 allocate( xabnd( nccn+1 ) )
320 allocate( rada( nccn ) )
321 allocate( expxactr( nccn ) )
322 allocate( expxabnd( nccn+1 ) )
323 allocate( rexpxactr( nccn ) )
324 allocate( rexpxabnd( nccn+1 ) )
328 mspc = nspc_mk*nspc_mk
331 if(
io_l )
write(
io_fid_log,*)
'+++ Module[Cloud Microphisics]/Categ[ATMOS]' 334 if ( mp_type /=
'SUZUKI10' )
then 335 write(*,*)
'xxx ATMOS_PHY_MP_TYPE is not SUZUKI10. Check!' 344 s10_flag_regene = flg_regeneration
345 s10_flag_nucleat = flg_nucl
346 s10_flag_icenucleat = flg_icenucl
347 s10_flag_sfaero = flg_sf_aero
348 s10_rndm_flgp = rndm_flgp
353 read(
io_fid_conf,nml=param_atmos_phy_mp,iostat=ierr)
356 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 357 elseif( ierr > 0 )
then 358 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_MP, Check!' 364 read(
io_fid_conf,nml=param_atmos_phy_mp_suzuki10,iostat=ierr)
367 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 368 elseif( ierr > 0 )
then 369 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_MP_SUZUKI10, Check!' 374 if ( nspc /= 1 .AND. nspc /= 7 )
then 375 write(*,*)
'xxx nspc should be set as 1(warm rain) or 7(mixed phase) check!' 384 flg_regeneration = s10_flag_regene
385 flg_nucl = s10_flag_nucleat
386 flg_icenucl = s10_flag_icenucleat
387 flg_sf_aero = s10_flag_sfaero
388 rndm_flgp = s10_rndm_flgp
397 open ( fid_micpara, file = fname_micpara, form =
'formatted', status =
'old', iostat=ierr )
400 if ( ierr == 0 )
then 402 read( fid_micpara,* ) nnspc, nnbin
404 if ( nnbin /= nbin )
then 405 write(*,*)
'xxx nbin in inc_tracer and nbin in micpara.dat is different check!' 412 read( fid_micpara,* ) nn, xctr( n ), radc( n )
414 "Radius of ", n,
"th cloud bin (bin center)= ", radc( n ) ,
"[m]" 417 read( fid_micpara,* ) nn, xbnd( n )
419 read( fid_micpara,* ) dxmic
426 read( fid_micpara,* ) mmyu, nn, cctr( n,myu )
430 read( fid_micpara,* ) mmyu, nn, cbnd( n,myu )
439 read( fid_micpara,* ) mmyu, nnyu, mm, nn, ck( myu,nyu,i,j )
448 read( fid_micpara,* ) mmyu, nn, vt( myu,n )
455 read( fid_micpara,* ) mmyu, nn, br( myu,n )
459 close ( fid_micpara )
469 open ( fid_micpara, file = fname_micpara, form =
'formatted', status =
'old', iostat=ierr )
471 read( fid_micpara,* ) nnspc, nnbin
473 if ( nnbin /= nbin )
then 474 write(*,*)
'xxx nbin in inc_tracer and nbin in micpara.dat is different check!' 481 read( fid_micpara,* ) nn, xctr( n ), radc( n )
483 "Radius of ", n,
"th cloud bin (bin center)= ", radc( n ) ,
"[m]" 486 read( fid_micpara,* ) nn, xbnd( n )
488 read( fid_micpara,* ) dxmic
495 read( fid_micpara,* ) mmyu, nn, cctr( n,myu )
499 read( fid_micpara,* ) mmyu, nn, cbnd( n,myu )
508 read( fid_micpara,* ) mmyu, nnyu, mm, nn, ck( myu,nyu,i,j )
517 read( fid_micpara,* ) mmyu, nn, vt( myu,n )
524 read( fid_micpara,* ) mmyu, nn, br( myu,n )
528 close ( fid_micpara )
545 if ( nccn /= 0 )
then 547 allocate ( ncld( 1:nccn ) )
548 xasta =
log( rhoa*4.0_rp/3.0_rp*pi * ( rasta )**3 )
549 xaend =
log( rhoa*4.0_rp/3.0_rp*pi * ( raend )**3 )
551 dxaer = ( xaend-xasta )/nccn
554 xabnd( n ) = xasta + dxaer*( n-1 )
557 xactr( n ) = ( xabnd( n )+xabnd( n+1 ) )*0.50_rp
558 rada( n ) = ( exp( xactr( n ) )*thirdovforth/pi/rhoa )**( oneovthird )
560 "Radius of ", n,
"th aerosol bin (bin center)= ", rada( n ) ,
"[m]" 563 if ( flg_sf_aero )
then 564 write( *,* )
"flg_sf_aero=true is not supported stop!! " 603 if( radc( n ) > rbnd )
then 608 if(
io_l )
write(
io_fid_log,
'(A,ES15.7,A)')
'*** Radius between cloud and rain is ', radc(nbnd),
'[m]' 611 if ( rndm_flgp > 0 )
then 612 call random_setup(
ia*
ja*
ka )
615 if ( mp_couple_aerosol .AND. nccn /=0 )
then 616 write(*,*)
'xxx nccn should be 0 when MP_couple_aerosol = .true. !! stop' 620 if ( nccn /= 0 )
then 622 expxactr( n ) = exp( xactr( n ) )
623 rexpxactr( n ) = 1.0_rp / exp( xactr( n ) )
626 expxabnd( n ) = exp( xabnd( n ) )
627 rexpxabnd( n ) = 1.0_rp / exp( xabnd( n ) )
631 allocate( vterm(
ka,
ia,
ja,qad) )
632 vterm(:,:,:,:) = 0.0_rp
635 vterm(:,:,:,i_qv+(myu-1)*nbin+n) = -vt( myu,n )
639 expxctr( n ) = exp( xctr( n ) )
640 rexpxctr( n ) = 1.0_rp / exp( xctr( n ) )
643 expxbnd( n ) = exp( xbnd( n ) )
644 rexpxbnd( n ) = 1.0_rp / exp( xbnd( n ) )
647 allocate( kindx(nbin,nbin) )
648 call getrule( ifrsl,kindx )
650 if ( const_thermodyn_type ==
'EXACT' )
then 651 flg_thermodyn = 1.0_rp
652 elseif( const_thermodyn_type ==
'SIMPLE' )
then 653 flg_thermodyn = 0.0_rp
655 rtem00 = 1.0_rp / const_tem00
658 mp_ntmax_sedimentation = max( mp_ntmax_sedimentation, nstep_max )
660 mp_nstep_sedimentation = mp_ntmax_sedimentation
661 mp_rnstep_sedimentation = 1.0_rp /
real(mp_ntmax_sedimentation,kind=
rp)
665 if (
io_l )
write(
io_fid_log,*)
'*** Timestep of sedimentation is divided into : ', mp_ntmax_sedimentation,
' step' 666 if (
io_l )
write(
io_fid_log,*)
'*** DT of sedimentation is : ', mp_dtsec_sedimentation,
'[s]' 691 thermodyn_rhoe => atmos_thermodyn_rhoe, &
692 thermodyn_rhot => atmos_thermodyn_rhot, &
693 thermodyn_temp_pres_e => atmos_thermodyn_temp_pres_e
701 real(RP),
intent(inout) :: dens(
ka,
ia,
ja)
702 real(RP),
intent(inout) :: MOMZ(
ka,
ia,
ja)
703 real(RP),
intent(inout) :: MOMX(
ka,
ia,
ja)
704 real(RP),
intent(inout) :: MOMY(
ka,
ia,
ja)
705 real(RP),
intent(inout) :: RHOT(
ka,
ia,
ja)
706 real(RP),
intent(inout) :: QTRC(
ka,
ia,
ja,qad)
707 real(RP),
intent(in) :: CCN (
ka,
ia,
ja)
708 real(RP),
intent(out) :: EVAPORATE(
ka,
ia,
ja)
709 real(RP),
intent(out) :: SFLX_rain(
ia,
ja)
710 real(RP),
intent(out) :: SFLX_snow(
ia,
ja)
712 real(RP) :: RHOE (
ka,
ia,
ja)
713 real(RP) :: POTT (
ka,
ia,
ja)
714 real(RP) :: TEMP (
ka,
ia,
ja)
715 real(RP) :: PRES (
ka,
ia,
ja)
716 real(RP) :: qsat (
ka,
ia,
ja)
717 real(RP) :: ssliq(
ka,
ia,
ja)
718 real(RP) :: ssice(
ka,
ia,
ja)
720 integer :: ijk_index (
kijmax,3)
721 integer :: index_cld (
kijmax)
722 integer :: index_cold(
kijmax)
723 integer :: index_warm(
kijmax)
724 integer :: ijkcount, ijkcount_cold, ijkcount_warm
725 integer :: ijk, indirect
727 real(RP) :: DENS_ijk(
kijmax)
728 real(RP) :: PRES_ijk(
kijmax)
729 real(RP) :: TEMP_ijk(
kijmax)
730 real(RP) :: Qvap_ijk(
kijmax)
731 real(RP) :: CCN_ijk(
kijmax)
732 real(RP) :: Evaporate_ijk(
kijmax)
733 real(RP) :: Ghyd_ijk(nbin,nspc,
kijmax)
734 real(RP) :: Gaer_ijk(nccn1 ,
kijmax)
745 real(RP) :: FLX_rain (
ka,
ia,
ja)
746 real(RP) :: FLX_snow (
ka,
ia,
ja)
747 real(RP) :: wflux_rain(
ka,
ia,
ja)
748 real(RP) :: wflux_snow(
ka,
ia,
ja)
749 real(RP) :: QHYD_out(
ka,
ia,
ja,6)
751 integer :: k, i, j, m, n, iq
754 if ( nspc == 1 )
then 755 if(
io_l )
write(
io_fid_log,*)
'*** Physics step: Cloud microphysics(SBM Liquid water only)' 756 elseif( nspc > 1 )
then 757 if(
io_l )
write(
io_fid_log,*)
'*** Physics step: Cloud microphysics(SBM Mixed phase)' 760 if ( mp_donegative_fixer )
then 761 call mp_negative_fixer( dens(:,:,:), &
772 evaporate(k,i,j) = 0.0_rp
789 call thermodyn_temp_pres( temp(:,:,:), &
795 call saturation_pres2qsat_liq( qsat(:,:,:), &
802 ssliq(k,i,j) = qtrc(k,i,j,i_qv) / qsat(k,i,j) - 1.0_rp
807 if ( nspc == 1 )
then 808 ssice(:,:,:) = 0.0_rp
810 call saturation_pres2qsat_ice( qsat(:,:,:), &
817 ssice(k,i,j) = qtrc(k,i,j,i_qv) / qsat(k,i,j) - 1.0_rp
859 countbin = countbin + 1
860 cldsum = cldsum + qtrc(k,i,j,countbin) * dens(k,i,j) / dxmic
864 if ( cldsum > cldmin &
865 .OR. ssliq(k,i,j) > 0.0_rp &
866 .OR. ssice(k,i,j) > 0.0_rp )
then 868 ijkcount = ijkcount + 1
870 index_cld(ijkcount) = ijk
872 dens_ijk(ijkcount) = dens(k,i,j)
873 pres_ijk(ijkcount) = pres(k,i,j)
874 temp_ijk(ijkcount) = temp(k,i,j)
875 ccn_ijk(ijkcount) = ccn(k,i,j)
876 qvap_ijk(ijkcount) = qtrc(k,i,j,i_qv)
881 countbin = countbin + 1
882 ghyd_ijk(n,m,ijkcount) = qtrc(k,i,j,countbin) * dens(k,i,j) / dxmic
887 countbin = countbin + 1
888 gaer_ijk(n,ijkcount) = qtrc(k,i,j,countbin) * dens(k,i,j) / dxaer
891 if ( temp(k,i,j) <
const_tem00 .AND. nspc > 1 )
then 892 ijkcount_cold = ijkcount_cold + 1
893 index_cold(ijkcount_cold) = ijkcount
895 ijkcount_warm = ijkcount_warm + 1
896 index_warm(ijkcount_warm) = ijkcount
938 if ( ijkcount > 0 )
then 945 index_cold( 1:ijkcount), &
946 index_warm( 1:ijkcount), &
947 dens_ijk( 1:ijkcount), &
948 pres_ijk( 1:ijkcount), &
949 ccn_ijk( 1:ijkcount), &
950 temp_ijk( 1:ijkcount), &
951 qvap_ijk( 1:ijkcount), &
952 ghyd_ijk(:,:,1:ijkcount), &
953 gaer_ijk(:, 1:ijkcount), &
954 evaporate_ijk( 1:ijkcount), &
1004 do ijk = 1, ijkcount
1005 indirect = index_cld(ijk)
1006 i = ijk_index(indirect,1)
1007 j = ijk_index(indirect,2)
1008 k = ijk_index(indirect,3)
1010 temp(k,i,j) = temp_ijk(ijk)
1011 qtrc(k,i,j,i_qv) = qvap_ijk(ijk)
1012 evaporate(k,i,j) = evaporate_ijk(ijk) / dt
1017 countbin = countbin + 1
1018 qtrc(k,i,j,countbin) = ghyd_ijk(n,m,ijk) / dens(k,i,j) * dxmic
1023 countbin = countbin + 1
1024 qtrc(k,i,j,countbin) = gaer_ijk(n,ijk) / dens(k,i,j) * dxaer
1034 countbin = countbin + 1
1035 if ( qtrc(k,i,j,countbin) < eps )
then 1036 qtrc(k,i,j,countbin) = 0.0_rp
1044 call thermodyn_pott( pott(:,:,:), &
1052 rhot(k,i,j) = pott(k,i,j) * dens(k,i,j)
1074 flx_rain(:,:,:) = 0.0_rp
1075 flx_snow(:,:,:) = 0.0_rp
1077 if ( mp_doprecipitation )
then 1079 call thermodyn_rhoe( rhoe(:,:,:), &
1083 do step = 1, mp_nstep_sedimentation
1085 call thermodyn_temp_pres_e( temp(:,:,:), &
1091 call mp_precipitation( wflux_rain(:,:,:), &
1092 wflux_snow(:,:,:), &
1101 mp_dtsec_sedimentation )
1106 flx_rain(k,i,j) = flx_rain(k,i,j) + wflux_rain(k,i,j) * mp_rnstep_sedimentation
1107 flx_snow(k,i,j) = flx_snow(k,i,j) + wflux_snow(k,i,j) * mp_rnstep_sedimentation
1114 call thermodyn_rhot( rhot(:,:,:), &
1121 if ( mp_donegative_fixer )
then 1122 call mp_negative_fixer( dens(:,:,:), &
1127 qhyd_out(:,:,:,:) = 0.0_rp
1132 qhyd_out(k,i,j,1) = qhyd_out(k,i,j,1) + qtrc(k,i,j,qqs+(il-1)*nbin+n)
1135 qhyd_out(k,i,j,2) = qhyd_out(k,i,j,2) + qtrc(k,i,j,qqs+(il-1)*nbin+n)
1146 qhyd_out(k,i,j,3) = qhyd_out(k,i,j,3) + ghyd_ijk(n,m,ijk) / dens(k,i,j) * dxmic
1150 qhyd_out(k,i,j,4) = qhyd_out(k,i,j,4) + ghyd_ijk(n,iss,ijk) / dens(k,i,j) * dxmic
1153 qhyd_out(k,i,j,5) = qhyd_out(k,i,j,5) + ghyd_ijk(n,ig,ijk) / dens(k,i,j) * dxmic
1156 qhyd_out(k,i,j,6) = qhyd_out(k,i,j,6) + ghyd_ijk(n,ih,ijk) / dens(k,i,j) * dxmic
1170 qhyd_out(k,i,j,3) = qhyd_out(k,i,j,3) + qtrc(k,i,j,qqs+(m-1)*nbin+n)
1174 qhyd_out(k,i,j,4) = qhyd_out(k,i,j,4) + qtrc(k,i,j,qqs+(iss-1)*nbin+n)
1177 qhyd_out(k,i,j,5) = qhyd_out(k,i,j,5) + qtrc(k,i,j,qqs+(ig-1)*nbin+n)
1180 qhyd_out(k,i,j,6) = qhyd_out(k,i,j,6) + qtrc(k,i,j,qqs+(ih-1)*nbin+n)
1188 call hist_in( qhyd_out(:,:,:,1),
'QC',
'Mixing ratio of QC',
'kg/kg' )
1189 call hist_in( qhyd_out(:,:,:,2),
'QR',
'Mixing ratio of QR',
'kg/kg' )
1191 call hist_in( qhyd_out(:,:,:,3),
'QI',
'Mixing ratio of QI',
'kg/kg' )
1192 call hist_in( qhyd_out(:,:,:,4),
'QS',
'Mixing ratio of QS',
'kg/kg' )
1193 call hist_in( qhyd_out(:,:,:,5),
'QG',
'Mixing ratio of QG',
'kg/kg' )
1194 call hist_in( qhyd_out(:,:,:,6),
'QH',
'Mixing ratio of QH',
'kg/kg' )
1197 sflx_rain(:,:) = flx_rain(
ks-1,:,:)
1198 sflx_snow(:,:) = flx_snow(
ks-1,:,:)
1221 integer,
intent(in) :: ijkmax
1222 integer,
intent(in) :: ijkmax_cold
1223 integer,
intent(in) :: ijkmax_warm
1224 integer ,
intent(in) :: index_cold(ijkmax)
1225 integer ,
intent(in) :: index_warm(ijkmax)
1226 real(RP),
intent(in) :: dens (ijkmax)
1227 real(RP),
intent(in) :: pres (ijkmax)
1228 real(RP),
intent(in) :: ccn (ijkmax)
1229 real(RP),
intent(inout) :: temp (ijkmax)
1230 real(RP),
intent(inout) :: qvap (ijkmax)
1231 real(RP),
intent(inout) :: ghyd (nbin,nspc,ijkmax)
1232 real(RP),
intent(inout) :: gaer (nccn1, ijkmax)
1233 real(RP),
intent(out) :: evaporate (ijkmax)
1234 real(DP),
intent(in) :: dt
1237 if ( nccn /= 0 )
then 1238 if ( nspc == 1 )
then 1242 call nucleata( ijkmax, &
1252 call cndevpsbla( ijkmax, &
1262 if ( mp_doautoconversion )
then 1264 call collmain( ijkmax, &
1270 elseif( nspc > 1 )
then 1274 call nucleata( ijkmax, &
1284 call freezing( ijkmax, &
1302 call melting( ijkmax, &
1311 call cndevpsbla( ijkmax, &
1321 if ( mp_doautoconversion )
then 1323 call collmainf( ijkmax, &
1331 elseif( nccn == 0 )
then 1333 if ( nspc == 1 )
then 1337 call nucleat( ijkmax, &
1347 call cndevpsbl( ijkmax, &
1356 if ( mp_doautoconversion )
then 1358 call collmain( ijkmax, &
1364 elseif( nspc > 1 )
then 1368 call nucleat( ijkmax, &
1378 call freezing( ijkmax, &
1386 call ice_nucleat( ijkmax, &
1396 call melting( ijkmax, &
1405 call cndevpsbl( ijkmax, &
1414 if ( mp_doautoconversion )
then 1416 call collmainf( ijkmax, &
1430 subroutine nucleat( &
1441 integer,
intent(in) :: ijkmax
1442 real(RP),
intent(in) :: dens(ijkmax)
1443 real(RP),
intent(in) :: pres(ijkmax)
1444 real(RP),
intent(in) :: ccn(ijkmax)
1445 real(RP),
intent(inout) :: temp(ijkmax)
1446 real(RP),
intent(inout) :: qvap(ijkmax)
1447 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1448 real(DP),
intent(in) :: dtime
1450 real(RP) :: ssliq(ijkmax)
1451 real(RP) :: qlevp(ijkmax)
1456 real(RP) :: sumnum(ijkmax)
1457 real(RP) :: gcn( nbin,ijkmax )
1463 if( mp_couple_aerosol )
then 1466 dmp = ccn(ijk) * expxctr( 1 )
1467 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1468 gc( 1,il,ijk ) = gc( 1,il,ijk ) + dmp/dxmic
1469 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1470 qvap(ijk) = max( qvap(ijk),0.0_rp )
1471 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp(ijk)/cp
1479 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1482 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1483 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1484 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
1491 if ( ssliq(ijk) > 0.0_rp )
then 1496 gcn( n,ijk ) = gc( n,il,ijk )*rexpxctr( n )
1500 sumnum(ijk) = sumnum(ijk) + gcn( n,ijk )*dxmic
1502 n_c = c_ccn * ( ssliq(ijk) * 1.e+2_rp )**( kappa )
1503 if ( n_c > sumnum(ijk) )
then 1504 dmp = ( n_c - sumnum(ijk) ) * expxctr( 1 )
1505 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1506 gc( 1,il,ijk ) = gc( 1,il,ijk ) + dmp/dxmic
1507 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1508 qvap(ijk) = max( qvap(ijk),0.0_rp )
1509 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp(ijk)/cp
1520 end subroutine nucleat
1523 subroutine nucleata( &
1534 integer,
intent(in) :: ijkmax
1535 real(RP),
intent(in) :: dens(ijkmax)
1536 real(RP),
intent(in) :: pres(ijkmax)
1537 real(RP),
intent(inout) :: temp(ijkmax)
1538 real(RP),
intent(inout) :: qvap(ijkmax)
1539 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1540 real(RP),
intent(inout) :: ga (nccn ,ijkmax)
1541 real(DP),
intent(in) :: dtime
1543 real(RP) :: gan( nccn )
1544 real(RP) :: ssliq, ssice, qlevp
1545 real(RP) :: acoef, bcoef
1548 real(RP) :: ractr, rcld, xcld, part, dmp
1549 integer :: n, nc, ncrit
1562 qlevp = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1565 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1566 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1568 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1569 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1570 ssliq = qvap(ijk)/ssliq-1.0_rp
1571 ssice = qvap(ijk)/ssice-1.0_rp
1573 if ( ssliq <= 0.0_rp ) cycle
1577 gan( n ) = ga( n,ijk )*rexpxactr( n )
1580 acoef = 2.0_rp*sigma/rvap/rhow/temp(ijk)
1581 bcoef = vhfct* rhoa/rhow * emwtr/emaer
1585 ractr = ( expxactr( n )*thirdovforth/pi/rhoa )**( oneovthird )
1586 rcld = sqrt( 3.0_rp*bcoef*ractr*ractr*ractr / acoef )
1587 xcld =
log( rhow * 4.0_rp*pi*oneovthird*rcld*rcld*rcld )
1588 if ( flg_nucl )
then 1591 ncld( n ) = int( ( xcld-xctr( 1 ) )/dxmic ) + 1
1592 ncld( n ) = min( max( ncld( n ),1 ),nbin )
1600 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1601 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1603 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1604 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1605 ssliq = qvap(ijk)/ssliq-1.0_rp
1606 ssice = qvap(ijk)/ssice-1.0_rp
1608 if ( ssliq <= 0.0_rp )
exit 1610 acoef = 2.0_rp*sigma/rvap/rhow/temp(ijk)
1611 rcrit = acoef*oneovthird * ( 4.0_rp/bcoef )**( oneovthird ) / ssliq**( twoovthird )
1612 xcrit =
log( rhoa * 4.0_rp*pi*oneovthird * rcrit*rcrit*rcrit )
1613 ncrit = int( ( xcrit-xabnd( 1 ) )/dxaer ) + 1
1615 if ( n == ncrit )
then 1616 part = ( xabnd( ncrit+1 )-xcrit )/dxaer
1617 elseif ( n > ncrit )
then 1625 dmp = part*gan( n )*dxaer*expxctr( nc )
1626 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1627 gc( nc,il,ijk ) = gc( nc,il,ijk ) + dmp/dxmic
1628 gan( n ) = gan( n ) - dmp/dxaer*rexpxctr( nc )
1629 gan( n ) = max( gan( n ), 0.0_rp )
1630 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1631 qvap(ijk) = max( qvap(ijk),0.0_rp )
1632 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp/cp
1637 ga( n,ijk ) = gan( n )*expxactr( n )
1645 end subroutine nucleata
1648 subroutine cndevpsbl( &
1655 evaporate, & ! [OUT]
1659 integer,
intent(in) :: ijkmax
1660 real(RP),
intent(in) :: dens(ijkmax)
1661 real(RP),
intent(in) :: pres(ijkmax)
1662 real(RP),
intent(inout) :: temp(ijkmax)
1663 real(RP),
intent(inout) :: qvap(ijkmax)
1664 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1665 real(RP),
intent(out) :: evaporate(ijkmax)
1666 real(DP),
intent(in) :: dtime
1669 call liqphase( ijkmax, &
1679 call icephase( ijkmax, &
1687 call mixphase( ijkmax, &
1697 end subroutine cndevpsbl
1700 subroutine cndevpsbla( &
1712 integer,
intent(in) :: ijkmax
1713 real(RP),
intent(in) :: dens(ijkmax)
1714 real(RP),
intent(in) :: pres(ijkmax)
1715 real(RP),
intent(inout) :: temp(ijkmax)
1716 real(RP),
intent(inout) :: qvap(ijkmax)
1717 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1718 real(RP),
intent(inout) :: ga (nccn ,ijkmax)
1719 real(RP),
intent(out) :: evaporate(ijkmax)
1720 real(DP),
intent(in) :: dtime
1723 call liqphase( ijkmax, &
1733 if ( flg_regeneration )
then 1734 call faero( ijkmax, &
1741 call icephase( ijkmax, &
1749 call mixphase( ijkmax, &
1759 end subroutine cndevpsbla
1762 subroutine liqphase( &
1773 integer,
intent(in) :: ijkmax
1774 real(RP),
intent(in) :: dens(ijkmax)
1775 real(RP),
intent(in) :: pres(ijkmax)
1776 real(RP),
intent(inout) :: temp(ijkmax)
1777 real(RP),
intent(inout) :: qvap(ijkmax)
1778 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1779 real(RP),
intent(out) :: regene_gcn(ijkmax)
1780 real(DP),
intent(in) :: dtime
1782 integer :: n, myu, ncount
1783 integer :: nloop(ijkmax)
1784 real(RP) :: gclold(ijkmax)
1785 real(RP) :: gclnew(ijkmax)
1786 real(RP) :: cndmss(ijkmax)
1787 real(RP) :: dtcnd(ijkmax)
1788 real(RP) :: gtliq(ijkmax)
1789 real(RP) :: qlevp(ijkmax)
1790 real(RP) :: cefliq, a, sliqtnd
1791 real(RP) :: sumliq(ijkmax), umax(ijkmax)
1792 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
1793 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
1795 real(RP),
parameter :: cflfct = 0.50_rp
1797 integer :: iflg( nspc,ijkmax )
1798 real(RP) :: csum( nspc,ijkmax )
1799 real(RP) :: f1, f2, emu, cefd, cefk, festl, psat
1800 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
1801 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
1802 real(RP) :: zerosw, qvtmp
1803 integer :: ijk, nn, mm, loopflg(ijkmax)
1806 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
1807 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
1808 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
1809 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
1810 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
1811 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
1812 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
1813 real(RP) :: cmins, cplus
1824 csum( il,ijk ) = csum( il,ijk ) + gc( n,il,ijk )*dxmic
1827 if( csum( il,ijk ) > cldmin ) iflg( il,ijk ) = 1
1836 gclold(ijk) = gclold(ijk) + gc( n,il,ijk ) * dxmic
1841 gcn( n,il,ijk ) = gc( n,il,ijk ) * rexpxctr( n )
1843 gcn( -1,il,ijk ) = 0.0_rp
1844 gcn( 0,il,ijk ) = 0.0_rp
1845 gcn( nbin+1,il,ijk ) = 0.0_rp
1846 gcn( nbin+2,il,ijk ) = 0.0_rp
1849 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1852 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1853 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1855 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1856 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1857 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
1858 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
1860 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
1861 cefd = emu/dens(ijk)
1864 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
1865 f1 = rvap*temp(ijk)/festl/cefd
1866 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
1867 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
1869 umax(ijk) = cbnd( 1,il )*rexpxbnd( 1 )*gtliq(ijk)*abs( ssliq(ijk) )
1870 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
1871 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
1872 dtcnd(ijk) = dtime / nloop(ijk)
1874 nloop(ijk) = nloop(ijk) * iflg( il,ijk )
1876 nloopmax = maxval(nloop,1)
1879 regene_gcn(:) = 0.0_rp
1882 do ncount = 1, nloopmax
1885 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
1890 do nn = 1, loopflg(ijk)
1893 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1896 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1897 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1899 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1900 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1901 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
1902 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
1904 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
1905 cefd = emu/dens(ijk)
1907 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
1908 f1 = rvap*temp(ijk)/festl/cefd
1909 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
1910 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
1912 sumliq(ijk) = 0.0_rp
1915 sumliq(ijk) = sumliq(ijk) + gcn( n,il,ijk )*cctr( n,il )*dxmic
1923 do nn = 1, loopflg(ijk)
1926 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
1927 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
1928 cefliq = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)*qlevp(ijk)/cp/rvap/temp(ijk)/temp(ijk) )
1929 a = - cefliq*sumliq(ijk)*gtliq(ijk)/dens(ijk)
1930 a = a + eps * ( 1.0_rp - zerosw )
1932 sliqtnd = zerosw * &
1933 ( ssliq(ijk) * ( exp( a*dtcnd(ijk) )-1.0_rp )/( a*dtcnd(ijk) ) &
1934 * ( 0.5_rp + sign( 0.5_rp,abs(a*dtcnd(ijk)-0.1_rp) ) ) &
1936 * ( 0.5_rp - sign( 0.5_rp,abs(a*dtcnd(ijk)-0.1_rp) ) ) &
1938 + ssliq(ijk) * ( 1.0_rp - zerosw )
1941 do mm = 1, iflg( il,ijk )
1944 uadv( n,il,ijk ) = cbnd( n,il )*rexpxbnd( n )*gtliq(ijk)*sliqtnd
1946 uadv( 0 ,il,ijk ) = 0.0_rp
1947 uadv( nbin+2,il,ijk ) = 0.0_rp
1960 do nn = 1, loopflg(ijk)
1962 do mm = 1, iflg( myu,ijk )
1964 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
1972 do nn = 1, loopflg(ijk)
1974 do mm = 1, iflg( myu,ijk )
1976 acoef(0,n,myu,ijk) = - ( gcn( n+1,myu,ijk )-26.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
1977 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
1978 acoef(2,n,myu,ijk) = ( gcn( n+1,myu,ijk )- 2.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
1986 do nn = 1, loopflg(ijk)
1988 do mm = 1, iflg( myu,ijk )
1990 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
1992 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
1993 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
1994 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
1996 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
2004 do nn = 1, loopflg(ijk)
2006 do mm = 1, iflg( myu,ijk )
2008 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
2010 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
2011 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
2012 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
2014 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
2022 do nn = 1, loopflg(ijk)
2024 do mm = 1, iflg( myu,ijk )
2026 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
2027 + acoef(2,n,myu,ijk) * 2.0_rp
2029 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
2037 do nn = 1, loopflg(ijk)
2039 do mm = 1, iflg( myu,ijk )
2041 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
2042 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
2050 do nn = 1, loopflg(ijk)
2052 do mm = 1, iflg( myu,ijk )
2053 regene_gcn(ijk) = regene_gcn(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
2054 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk) + eps )
2061 do nn = 1, loopflg(ijk)
2063 do mm = 1, iflg( myu,ijk )
2065 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
2076 do nn = 1, loopflg(ijk)
2079 gclnew(ijk) = 0.0_rp
2082 gclnew(ijk) = gclnew(ijk) + gcn( n,il,ijk )*expxctr( n )
2087 gclnew(ijk) = gclnew(ijk)*dxmic
2090 cndmss(ijk) = gclnew(ijk) - gclold(ijk)
2091 qvap(ijk) = qvap(ijk) - cndmss(ijk)/dens(ijk)
2092 temp(ijk) = temp(ijk) + cndmss(ijk)/dens(ijk)*qlevp(ijk)/cp
2094 gclold(ijk) = gclnew(ijk)
2106 gc( n,il,ijk ) = gcn( n,il,ijk )*expxctr( n )
2113 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2115 if ( gc( n,il,ijk ) < 0.0_rp )
then 2116 cndmss(ijk) = -gc( n,il,ijk )
2117 gc( n,il,ijk ) = 0.0_rp
2118 qvap(ijk) = qvap(ijk) + cndmss(ijk)/dens(ijk)
2119 temp(ijk) = temp(ijk) - cndmss(ijk)/dens(ijk)*qlevp(ijk)/cp
2127 end subroutine liqphase
2130 subroutine icephase( &
2140 integer,
intent(in) :: ijkmax
2141 real(RP),
intent(in) :: dens(ijkmax)
2142 real(RP),
intent(in) :: pres(ijkmax)
2143 real(RP),
intent(inout) :: temp(ijkmax)
2144 real(RP),
intent(inout) :: qvap(ijkmax)
2145 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2146 real(DP),
intent(in) :: dtime
2148 integer :: myu, n, ncount
2149 integer :: nloop(ijkmax)
2150 real(RP) :: gciold(ijkmax), gcinew(ijkmax)
2151 real(RP) :: dtcnd(ijkmax)
2152 real(RP) :: sblmss(ijkmax)
2153 real(RP) :: gtice(ijkmax), umax(ijkmax)
2154 real(RP) :: qlsbl(ijkmax)
2155 real(RP) :: cefice, d, uval, sicetnd
2156 real(RP) :: sumice(ijkmax)
2157 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
2158 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
2159 real(RP),
parameter :: cflfct = 0.50_rp
2160 real(RP) :: dumm_regene(ijkmax)
2161 integer :: iflg( nspc,ijkmax )
2162 integer :: csum( nspc,ijkmax )
2163 real(RP) :: f1, f2, emu, cefd, cefk, festi, psat
2164 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
2165 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
2166 integer :: ijk, mm, nn, loopflg(ijkmax)
2167 real(RP) :: zerosw, qvtmp
2171 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
2172 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
2173 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
2174 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
2175 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
2176 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
2177 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
2178 real(RP) :: cmins, cplus
2185 csum( :,: ) = 0.0_rp
2190 csum( myu,ijk ) = csum( myu,ijk ) + gc( n,myu,ijk )*dxmic
2195 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
2207 gciold(ijk) = gciold(ijk) + gc( n,myu,ijk )*dxmic
2214 gcn( n,myu,ijk ) = gc( n,myu,ijk ) * rexpxctr( n )
2216 gcn( -1,myu,ijk ) = 0.0_rp
2217 gcn( 0,myu,ijk ) = 0.0_rp
2218 gcn( nbin+1,myu,ijk ) = 0.0_rp
2219 gcn( nbin+2,myu,ijk ) = 0.0_rp
2223 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2226 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2227 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2229 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2230 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2231 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2232 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2234 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2235 cefd = emu/dens(ijk)
2237 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2238 f1 = rvap*temp(ijk)/festi/cefd
2239 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2240 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2244 uval = cbnd( 1,myu )*rexpxbnd( 1 )*gtice(ijk)*abs( ssice(ijk) )
2245 umax(ijk) = max( umax(ijk),uval )
2248 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
2249 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
2250 dtcnd(ijk) = dtime/nloop(ijk)
2252 nloop(ijk) = nloop(ijk) * maxval( iflg( 2:nspc,ijk ) )
2255 nloopmax = maxval(nloop,1)
2259 do ncount = 1, nloopmax
2262 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
2267 do nn = 1, loopflg(ijk)
2269 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2272 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2273 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2275 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2276 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2277 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2278 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2280 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2281 cefd = emu/dens(ijk)
2283 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2284 f1 = rvap*temp(ijk)/festi/cefd
2285 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2286 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2288 sumice(ijk) = 0.0_rp
2291 sumice(ijk) = sumice(ijk) + gcn( n,myu,ijk )*cctr( n,myu )*dxmic
2300 do nn = 1, loopflg(ijk)
2303 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
2304 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
2306 cefice = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)*qlsbl(ijk)/cp/rvap/temp(ijk)/temp(ijk) )
2307 d = - cefice*sumice(ijk)*gtice(ijk)/dens(ijk)
2308 d = d + eps * ( 1.0_rp - zerosw )
2310 sicetnd = zerosw * &
2311 ( ssice(ijk) * ( exp( d*dtcnd(ijk) )-1.0_rp )/( d*dtcnd(ijk) ) &
2312 * ( 0.5_rp + sign( 0.5_rp,abs(d*dtcnd(ijk)-0.1_rp) ) ) &
2314 * ( 0.5_rp - sign( 0.5_rp,abs(d*dtcnd(ijk)-0.1_rp) ) ) &
2316 + ssice(ijk) * ( 1.0_rp - zerosw )
2320 do mm = 1, iflg( myu,ijk )
2323 uadv( n,myu,ijk ) = cbnd( n,myu )*rexpxbnd( n )*gtice(ijk)*sicetnd
2325 uadv( 0, myu,ijk ) = 0.0_rp
2326 uadv( nbin+2,myu,ijk ) = 0.0_rp
2336 do nn = 1, loopflg(ijk)
2338 do mm = 1, iflg( myu,ijk )
2340 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
2348 do nn = 1, loopflg(ijk)
2350 do mm = 1, iflg( myu,ijk )
2352 acoef(0,n,myu,ijk) = - ( gcn( n+1,myu,ijk )-26.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
2353 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
2354 acoef(2,n,myu,ijk) = ( gcn( n+1,myu,ijk )- 2.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
2362 do nn = 1, loopflg(ijk)
2364 do mm = 1, iflg( myu,ijk )
2366 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
2368 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
2369 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
2370 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
2372 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
2380 do nn = 1, loopflg(ijk)
2382 do mm = 1, iflg( myu,ijk )
2384 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
2386 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
2387 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
2388 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
2390 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
2398 do nn = 1, loopflg(ijk)
2400 do mm = 1, iflg( myu,ijk )
2402 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
2403 + acoef(2,n,myu,ijk) * 2.0_rp
2405 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
2413 do nn = 1, loopflg(ijk)
2415 do mm = 1, iflg( myu,ijk )
2417 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
2418 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
2426 do nn = 1, loopflg(ijk)
2428 do mm = 1, iflg( myu,ijk )
2429 dumm_regene(ijk) = dumm_regene(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
2430 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk) + eps )
2437 do nn = 1, loopflg(ijk)
2439 do mm = 1, iflg( myu,ijk )
2441 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
2452 do nn = 1, loopflg(ijk)
2455 gcinew(ijk) = 0.0_rp
2458 gcinew(ijk) = gcinew(ijk) + gcn( n,myu,ijk )*expxctr( n )*dxmic
2463 sblmss(ijk) = gcinew(ijk) - gciold(ijk)
2464 qvap(ijk) = qvap(ijk) - sblmss(ijk)/dens(ijk)
2465 temp(ijk) = temp(ijk) + sblmss(ijk)/dens(ijk)*qlsbl(ijk)/cp
2467 gciold(ijk) = gcinew(ijk)
2480 gc( n,myu,ijk ) = gcn( n,myu,ijk )*expxctr( n )
2488 end subroutine icephase
2491 subroutine mixphase( &
2501 integer,
intent(in) :: ijkmax
2502 real(RP),
intent(in) :: dens(ijkmax)
2503 real(RP),
intent(in) :: pres(ijkmax)
2504 real(RP),
intent(inout) :: temp(ijkmax)
2505 real(RP),
intent(inout) :: qvap(ijkmax)
2506 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2507 real(DP),
intent(in) :: dtime
2509 integer :: n, myu, mm, ncount
2510 integer :: nloop(ijkmax)
2511 real(RP) :: gclold(ijkmax), gclnew(ijkmax)
2512 real(RP) :: gciold(ijkmax), gcinew(ijkmax)
2513 real(RP) :: cndmss(ijkmax), sblmss(ijkmax)
2514 real(RP) :: gtliq(ijkmax), gtice(ijkmax)
2515 real(RP) :: umax(ijkmax), uval, dtcnd(ijkmax)
2516 real(RP) :: qlevp(ijkmax), qlsbl(ijkmax)
2517 real(RP) :: cef1, cef2, cef3, cef4, a, b, c, d
2518 real(RP) :: rmdplus, rmdmins, ssplus, ssmins, tplus, tmins
2519 real(RP) :: sliqtnd, sicetnd
2520 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
2521 real(RP) :: sumliq(ijkmax), sumice(ijkmax)
2522 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
2523 real(RP),
parameter :: cflfct = 0.50_rp
2524 real(RP) :: dumm_regene(ijkmax)
2525 real(RP) :: csum( nspc,ijkmax )
2526 integer :: iflg( nspc,ijkmax )
2527 real(RP) :: f1, f2, emu, cefd, cefk, festl, festi, psat
2528 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
2529 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
2530 real(RP) :: qvtmp, zerosw
2531 integer :: ijk, nn, loopflg(ijkmax)
2535 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
2536 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
2537 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
2538 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
2539 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
2540 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
2541 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
2542 real(RP) :: cmins, cplus
2547 dumm_regene( : ) = 0.0_rp
2549 csum( :,: ) = 0.0_rp
2554 csum( myu,ijk ) = csum( myu,ijk )+gc( n,myu,ijk )*dxmic
2559 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
2569 gclold(ijk) = gclold(ijk) + gc( n,il,ijk )*dxmic
2574 gciold(ijk) = gciold(ijk) + gc( n,myu,ijk )*dxmic
2581 gcn( n,myu,ijk ) = gc( n,myu,ijk ) * rexpxctr( n )
2583 gcn( -1,myu,ijk ) = 0.0_rp
2584 gcn( 0,myu,ijk ) = 0.0_rp
2585 gcn( nbin+1,myu,ijk ) = 0.0_rp
2586 gcn( nbin+2,myu,ijk ) = 0.0_rp
2590 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2591 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2594 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2595 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2597 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2598 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2599 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2600 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2602 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2603 cefd = emu/dens(ijk)
2606 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2607 f1 = rvap*temp(ijk)/festl/cefd
2608 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2609 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2611 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2612 f1 = rvap*temp(ijk)/festi/cefd
2613 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2614 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2617 umax(ijk) = cbnd( 1,il )*rexpxbnd( 1 )*gtliq(ijk)*abs( ssliq(ijk) )
2619 uval = cbnd( 1,myu )*rexpxbnd( 1 )*gtice(ijk)*abs( ssice(ijk) )
2620 umax(ijk) = max( umax(ijk),uval )
2623 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
2624 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
2625 dtcnd(ijk) = dtime/nloop(ijk)
2627 nloop(ijk) = nloop(ijk) * iflg( il,ijk )
2628 nloop(ijk) = nloop(ijk) * maxval( iflg( 2:nspc,ijk ) )
2631 nloopmax = maxval(nloop,1)
2636 do ncount = 1, nloopmax
2640 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
2645 do nn = 1, loopflg(ijk)
2647 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2648 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2651 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2652 ssliq(ijk) = qvap(ijk) / ( const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat ) )-1.0_rp
2654 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2655 ssice(ijk) = qvap(ijk) / ( const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat ) )-1.0_rp
2657 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2658 cefd = emu/dens(ijk)
2660 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2661 f1 = rvap*temp(ijk)/festl/cefd
2662 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2663 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2664 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2665 f1 = rvap*temp(ijk)/festi/cefd
2666 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2667 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2669 sumliq(ijk) = 0.0_rp
2671 sumliq(ijk) = sumliq(ijk) + gcn( n,il,ijk )*cctr( n,il )*dxmic
2674 sumice(ijk) = 0.0_rp
2677 sumice(ijk) = sumice(ijk) + gcn( n,myu,ijk )*cctr( n,myu )*dxmic
2686 do nn = 1, loopflg(ijk)
2687 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
2688 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
2689 cef1 = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)/rvap/temp(ijk)/temp(ijk)*qlevp(ijk)/cp )
2690 cef2 = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)/rvap/temp(ijk)/temp(ijk)*qlsbl(ijk)/cp )
2691 cef3 = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)/rvap/temp(ijk)/temp(ijk)*qlevp(ijk)/cp )
2692 cef4 = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)/rvap/temp(ijk)/temp(ijk)*qlsbl(ijk)/cp )
2694 a = - cef1*sumliq(ijk)*gtliq(ijk)/dens(ijk)
2695 b = - cef2*sumice(ijk)*gtice(ijk)/dens(ijk)
2696 c = - cef3*sumliq(ijk)*gtliq(ijk)/dens(ijk)
2697 d = - cef4*sumice(ijk)*gtice(ijk)/dens(ijk)
2699 b = b + eps * ( 1.0_rp - zerosw )
2701 rmdplus = ( ( a+d ) + sqrt( ( a-d )**2 + 4.0_rp*b*c ) ) * 0.50_rp
2702 rmdmins = ( ( a+d ) - sqrt( ( a-d )**2 + 4.0_rp*b*c ) ) * 0.50_rp
2704 rmdplus = rmdplus + eps * ( 1.0_rp - zerosw )
2705 rmdmins = rmdmins + eps * ( 1.0_rp - zerosw )
2708 ssplus = ( ( rmdmins-a )*ssliq(ijk) - b*ssice(ijk) )/b/( rmdmins-rmdplus + eps * ( 1.0_rp - zerosw ) )
2709 ssmins = ( ( a-rmdplus )*ssliq(ijk) + b*ssice(ijk) )/b/( rmdmins-rmdplus + eps * ( 1.0_rp - zerosw ) )
2711 tplus = ( exp( rmdplus*dtcnd(ijk) )-1.0_rp )/( rmdplus*dtcnd(ijk) ) &
2712 * ( 0.5_rp + sign( 0.5_rp,abs(rmdplus*dtcnd(ijk)-0.1_rp) ) ) &
2714 * ( 0.5_rp - sign( 0.5_rp,abs(rmdplus*dtcnd(ijk)-0.1_rp) ) )
2715 tmins = ( exp( rmdmins*dtcnd(ijk) )-1.0_rp )/( rmdmins*dtcnd(ijk) ) &
2716 * ( 0.5_rp + sign( 0.5_rp,abs(rmdmins*dtcnd(ijk)-0.1_rp) ) ) &
2718 * ( 0.5_rp - sign( 0.5_rp,abs(rmdmins*dtcnd(ijk)-0.1_rp) ) )
2720 sliqtnd = ssliq(ijk) * ( 1.0_rp - zerosw ) &
2722 ( b*tplus*ssplus + b*tmins*ssmins )
2723 sicetnd = ssice(ijk) * ( 1.0_rp - zerosw ) &
2725 ( ( rmdplus-a )*tplus*ssplus &
2726 + ( rmdmins-a )*tmins*ssmins )
2730 do mm = 1, iflg( myu,ijk )
2734 uadv( n,myu,ijk ) = cbnd( n,myu )*rexpxbnd( n )*gtliq(ijk)*sliqtnd &
2735 * ( 0.5_rp - sign( 0.5_rp,
real(myu)-1.5_RP) ) &
2736 + cbnd( n,myu )*rexpxbnd( n )*gtice(ijk)*sicetnd &
2737 * ( 0.5_rp + sign( 0.5_rp,
real(myu)-1.5_rp) )
2739 uadv( 0, myu,ijk ) = 0.0_rp
2740 uadv( nbin+2,myu,ijk ) = 0.0_rp
2749 do nn = 1, loopflg(ijk)
2751 do mm = 1, iflg( myu,ijk )
2753 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
2761 do nn = 1, loopflg(ijk)
2763 do mm = 1, iflg( myu,ijk )
2765 acoef(0,n,myu,ijk) = - ( gcn( n+1,myu,ijk )-26.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
2766 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
2767 acoef(2,n,myu,ijk) = ( gcn( n+1,myu,ijk )- 2.0_rp*gcn( n,myu,ijk )+gcn( n-1,myu,ijk ) ) / 48.0_rp
2775 do nn = 1, loopflg(ijk)
2777 do mm = 1, iflg( myu,ijk )
2779 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
2781 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
2782 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
2783 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
2785 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
2793 do nn = 1, loopflg(ijk)
2795 do mm = 1, iflg( myu,ijk )
2797 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
2799 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
2800 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
2801 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
2803 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
2811 do nn = 1, loopflg(ijk)
2813 do mm = 1, iflg( myu,ijk )
2815 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
2816 + acoef(2,n,myu,ijk) * 2.0_rp
2818 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
2826 do nn = 1, loopflg(ijk)
2828 do mm = 1, iflg( myu,ijk )
2830 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
2831 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
2839 do nn = 1, loopflg(ijk)
2841 do mm = 1, iflg( myu,ijk )
2842 dumm_regene(ijk) = dumm_regene(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
2843 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk)+eps )
2850 do nn = 1, loopflg(ijk)
2852 do mm = 1, iflg( myu,ijk )
2854 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
2865 do nn = 1, loopflg(ijk)
2867 gclnew(ijk) = 0.0_rp
2869 gclnew(ijk) = gclnew(ijk) + gcn( n,il,ijk )*expxctr( n )*dxmic
2872 gcinew(ijk) = 0.0_rp
2875 gcinew(ijk) = gcinew(ijk) + gcn( n,myu,ijk )*expxctr( n )*dxmic
2880 cndmss(ijk) = gclnew(ijk) - gclold(ijk)
2881 sblmss(ijk) = gcinew(ijk) - gciold(ijk)
2883 qvap(ijk) = qvap(ijk) - ( cndmss(ijk)+sblmss(ijk) )/dens(ijk)
2884 temp(ijk) = temp(ijk) + ( cndmss(ijk)*qlevp(ijk)+sblmss(ijk)*qlsbl(ijk) )/dens(ijk)/cp
2886 gclold(ijk) = gclnew(ijk)
2887 gciold(ijk) = gcinew(ijk)
2898 gc( n,myu,ijk ) = gcn( n,myu,ijk )*expxctr( n )
2903 if ( .NOT. flg_regeneration )
then 2904 dumm_regene(:) = 0.0_rp
2910 end subroutine mixphase
2913 subroutine ice_nucleat( &
2925 integer,
intent(in) :: ijkmax
2926 integer,
intent(in) :: num_cold
2927 integer,
intent(in) :: index_cold(ijkmax)
2928 real(RP),
intent(in) :: dens(ijkmax)
2929 real(RP),
intent(in) :: pres(ijkmax)
2930 real(RP),
intent(inout) :: temp(ijkmax)
2931 real(RP),
intent(inout) :: qvap(ijkmax)
2932 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2933 real(DP),
intent(in) :: dtime
2935 real(RP) :: ssliq, ssice
2936 real(RP) :: numin, tdel, qdel
2938 real(RP),
parameter :: acoef = -0.639_rp, bcoef = 12.96_rp
2940 real(RP),
parameter :: tcolmu = 269.0_rp, tcolml = 265.0_rp
2941 real(RP),
parameter :: tdendu = 257.0_rp, tdendl = 255.0_rp
2942 real(RP),
parameter :: tplatu = 250.6_rp
2945 integer :: ijk, indirect
2950 do indirect = 1, num_cold
2951 ijk = index_cold(indirect)
2955 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2956 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2958 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2959 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2960 ssliq = qvap(ijk)/ssliq-1.0_rp
2961 ssice = qvap(ijk)/ssice-1.0_rp
2963 if( ssice <= 0.0_rp ) cycle
2965 numin = bcoef * exp( acoef + bcoef * ssice )
2966 numin = numin * expxctr( 1 )/dxmic
2967 numin = min( numin,qvap(ijk)*dens(ijk) )
2969 if ( temp(ijk) <= tplatu .OR. ( temp(ijk) >= tcolml .AND. temp(ijk) < tcolmu ) )
then 2970 gc( 1,ic,ijk ) = gc( 1,ic,ijk ) + numin
2972 elseif( temp(ijk) <= tdendu .AND. temp(ijk) >= tdendl )
then 2973 gc( 1,id,ijk ) = gc( 1,id,ijk ) + numin
2976 gc( 1,ip,ijk ) = gc( 1,ip,ijk ) + numin
2979 tdel = numin/dens(ijk)*qlmlt/cp
2980 temp(ijk) = temp(ijk) + tdel
2981 qdel = numin/dens(ijk)
2982 qvap(ijk) = qvap(ijk) - qdel
2990 end subroutine ice_nucleat
2993 subroutine freezing( &
3003 integer,
intent(in) :: ijkmax
3004 integer,
intent(in) :: num_cold
3005 integer,
intent(in) :: index_cold(ijkmax)
3006 real(RP),
intent(in) :: dens(ijkmax)
3007 real(RP),
intent(inout) :: temp(ijkmax)
3008 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3009 real(DP),
intent(in) :: dtime
3011 integer :: nbound, n
3012 real(RP) :: xbound, tc, rate, dmp, frz, sumfrz, tdel
3013 real(RP),
parameter :: coefa = 1.0e-01_rp
3014 real(RP),
parameter :: coefb = 0.66_rp
3015 real(RP),
parameter :: rbound = 2.0e-04_rp
3019 integer :: ijk, indirect
3023 do indirect = 1, num_cold
3024 ijk = index_cold(indirect)
3027 xbound =
log( rhow * 4.0_rp*pi/3.0_rp * rbound**3 )
3028 nbound = int( ( xbound-xbnd( 1 ) )/dxmic ) + 1
3031 rate = coefa*exp( -coefb*tc )
3035 dmp = rate*expxctr( n )
3036 frz = gc( n,il,ijk )*( 1.0_rp-exp( -dmp*dtime ) )
3038 gc( n,il,ijk ) = gc( n,il,ijk ) - frz
3039 gc( n,il,ijk ) = max( gc( n,il,ijk ),0.0_rp )
3041 gc( n,ip,ijk ) = gc( n,ip,ijk ) + frz
3043 sumfrz = sumfrz + frz
3046 dmp = rate*expxctr( n )
3047 frz = gc( n,il,ijk )*( 1.0_rp-exp( -dmp*dtime ) )
3049 gc( n,il,ijk ) = gc( n,il,ijk ) - frz
3050 gc( n,il,ijk ) = max( gc( n,il,ijk ),0.0_rp )
3052 gc( n,ih,ijk ) = gc( n,ih,ijk ) + frz
3054 sumfrz = sumfrz + frz
3074 sumfrz = sumfrz*dxmic
3076 tdel = sumfrz/dens(ijk)*qlmlt/cp
3077 temp(ijk) = temp(ijk) + tdel
3083 end subroutine freezing
3086 subroutine melting( &
3096 integer,
intent(in) :: ijkmax
3097 integer,
intent(in) :: num_warm
3098 integer,
intent(in) :: index_warm(ijkmax)
3099 real(RP),
intent(in) :: dens(ijkmax)
3100 real(RP),
intent(inout) :: temp(ijkmax)
3101 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3102 real(DP),
intent(in) :: dtime
3105 real(RP) :: summlt, sumice, tdel
3106 integer :: ijk, indirect
3110 do indirect = 1, num_warm
3111 ijk = index_warm(indirect)
3117 sumice = sumice + gc( n,m,ijk )
3118 gc( n,m,ijk ) = 0.0_rp
3120 gc( n,il,ijk ) = gc( n,il,ijk ) + sumice
3121 summlt = summlt + sumice
3123 summlt = summlt*dxmic
3125 tdel = - summlt/dens(ijk)*qlmlt/cp
3126 temp(ijk) = temp(ijk) + tdel
3133 end subroutine melting
3136 subroutine collmain( &
3143 integer,
intent(in) :: ijkmax
3144 real(RP),
intent(in) :: temp(ijkmax)
3145 real(RP),
intent(inout) :: ghyd(nbin,nspc,ijkmax)
3146 real(DP),
intent(in) :: dt
3149 if ( rndm_flgp == 1 )
then 3156 call collcoag( ijkmax, &
3163 end subroutine collmain
3166 subroutine collmainf( &
3173 integer,
intent(in) :: ijkmax
3174 real(RP),
intent(in) :: temp(ijkmax)
3175 real(RP),
intent(inout) :: ghyd(nbin,nspc,ijkmax)
3176 real(DP),
intent(in) :: dt
3179 if ( rndm_flgp == 1 )
then 3186 call collcoag( ijkmax, &
3193 end subroutine collmainf
3198 subroutine collcoag( &
3205 integer,
intent(in) :: ijkmax
3206 real(RP),
intent(in) :: temp(ijkmax)
3207 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3208 real(DP),
intent(in) :: dtime
3210 integer :: i, j, k, l
3211 real(RP) :: xi, xj, xnew, dmpi, dmpj, frci, frcj
3212 real(RP) :: gprime, gprimk, wgt, crn, sum, flux
3213 integer,
parameter :: ldeg = 2
3214 real(RP) :: acoef( 0:ldeg )
3215 real(RP),
parameter :: dmpmin = 1.e-01_rp
3216 real(RP) :: suri, surj
3218 integer :: myu, n, irsl, ilrg, isml
3219 integer :: ibnd( ijkmax )
3220 integer :: iflg( nspc,ijkmax )
3221 integer :: iexst( nbin,nspc,ijkmax )
3222 real(RP) :: csum( nspc,ijkmax )
3223 integer :: ijk, nn, mm, pp, qq
3230 csum( :,: ) = 0.0_rp
3235 csum( myu,ijk ) = csum( myu,ijk ) + gc( n,myu,ijk )*dxmic
3239 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
3242 if ( temp(ijk) < tcrit )
then 3250 if ( gc( n,myu,ijk ) > cldmin )
then 3251 iexst( n,myu,ijk ) = 1
3261 do nn = 1, iflg( isml,ijk )
3264 do mm = 1, iflg( ilrg,ijk )
3266 irsl = ifrsl( ibnd(ijk),isml,ilrg )
3269 do pp = 1, iexst( i,isml,ijk )
3272 do qq = 1, iexst( j,ilrg,ijk )
3279 dmpi = ck( isml,ilrg,i,j )*gc( j,ilrg,ijk )/xj*dxmic*dtime
3280 dmpj = ck( ilrg,isml,i,j )*gc( i,isml,ijk )/xi*dxmic*dtime
3282 if ( dmpi <= dmpmin )
then 3283 frci = gc( i,isml,ijk )*dmpi
3285 frci = gc( i,isml,ijk )*( 1.0_rp-exp( -dmpi ) )
3288 if ( dmpj <= dmpmin )
then 3289 frcj = gc( j,ilrg,ijk )*dmpj
3291 frcj = gc( j,ilrg,ijk )*( 1.0_rp-exp( -dmpj ) )
3296 if ( gprime > 0.0_rp .AND. k < nbin )
then 3298 suri = gc( i,isml,ijk )
3299 surj = gc( j,ilrg,ijk )
3300 gc( i,isml,ijk ) = gc( i,isml,ijk )-frci
3301 gc( j,ilrg,ijk ) = gc( j,ilrg,ijk )-frcj
3302 gc( i,isml,ijk ) = max( gc( i,isml,ijk )-frci, 0.0_rp )
3303 gc( j,ilrg,ijk ) = max( gc( j,ilrg,ijk )-frcj, 0.0_rp )
3304 frci = suri - gc( i,isml,ijk )
3305 frcj = surj - gc( j,ilrg,ijk )
3308 gprimk = gc( k,irsl,ijk ) + gprime
3309 wgt = gprime / gprimk
3310 crn = ( xnew-xctr( k ) )/( xctr( k+1 )-xctr( k ) )
3312 acoef( 0 ) = -( gc( k+1,irsl,ijk )-26.0_rp*gprimk+gc( k-1,irsl,ijk ) )/24.0_rp
3313 acoef( 1 ) = ( gc( k+1,irsl,ijk )-gc( k-1,irsl,ijk ) ) *0.50_rp
3314 acoef( 2 ) = ( gc( k+1,irsl,ijk )-2.0_rp*gprimk+gc( k-1,irsl,ijk ) ) *0.50_rp
3318 sum = sum + acoef( l )/( l+1 )/2.0_rp**( l+1 ) &
3319 *( 1.0_rp-( 1.0_rp-2.0_rp*crn )**( l+1 ) )
3323 flux = min( max( flux,0.0_rp ),gprime )
3325 gc( k,irsl,ijk ) = gprimk - flux
3326 gc( k+1,irsl,ijk ) = gc( k+1,irsl,ijk ) + flux
3346 end subroutine collcoag
3349 subroutine getrule &
3352 integer,
intent(out) :: indx( nbin,nbin )
3353 integer,
intent(out) :: ifrsl( 2,nspc_mk,nspc_mk )
3359 xnew =
log( expxctr( i )+expxctr( j ) )
3360 k = int( ( xnew-xctr( 1 ) )/dxmic ) + 1
3361 k = max( max( k,j ),i )
3368 ifrsl( 1:2,il,il ) = il
3371 ifrsl( 1:2,il,ic ) = ic
3372 ifrsl( 1,ic,il ) = ig
3373 ifrsl( 2,ic,il ) = ih
3376 ifrsl( 1:2,il,ip ) = ip
3377 ifrsl( 1,ip,il ) = ig
3378 ifrsl( 2,ip,il ) = ih
3381 ifrsl( 1:2,il,id ) = id
3382 ifrsl( 1,id,il ) = ig
3383 ifrsl( 2,id,il ) = ih
3386 ifrsl( 1:2,il,iss ) = iss
3387 ifrsl( 1,iss,il ) = ig
3388 ifrsl( 2,iss,il ) = ih
3391 ifrsl( 1:2,il,ig ) = ig
3392 ifrsl( 1,ig,il ) = ig
3393 ifrsl( 2,ig,il ) = ih
3396 ifrsl( 1:2,il,ih ) = ih
3397 ifrsl( 1,ih,il ) = ig
3398 ifrsl( 2,ih,il ) = ih
3402 ifrsl( 1:2,ic,ic ) = iss
3405 ifrsl( 1:2,ic,ip ) = iss
3406 ifrsl( 1:2,ip,ic ) = iss
3409 ifrsl( 1:2,ic,id ) = iss
3410 ifrsl( 1:2,id,ic ) = iss
3413 ifrsl( 1:2,ic,iss ) = iss
3414 ifrsl( 1:2,iss,ic ) = iss
3417 ifrsl( 1:2,ic,ig ) = ig
3418 ifrsl( 1:2,ig,ic ) = ic
3421 ifrsl( 1:2,ih,ic ) = ic
3422 ifrsl( 1,ic,ih ) = ig
3423 ifrsl( 2,ic,ih ) = ih
3427 ifrsl( 1:2,ip,ip ) = iss
3430 ifrsl( 1:2,ip,id ) = iss
3431 ifrsl( 1:2,id,ip ) = iss
3434 ifrsl( 1:2,ip,iss ) = iss
3435 ifrsl( 1:2,iss,ip ) = iss
3438 ifrsl( 1:2,ip,ig ) = ig
3439 ifrsl( 1:2,ig,ip ) = ip
3442 ifrsl( 1:2,ih,ip ) = ip
3443 ifrsl( 1,ip,ih ) = ig
3444 ifrsl( 2,ip,ih ) = ih
3448 ifrsl( 1:2,id,id ) = iss
3451 ifrsl( 1:2,id,iss ) = iss
3452 ifrsl( 1:2,iss,id ) = iss
3455 ifrsl( 1:2,id,ig ) = ig
3456 ifrsl( 1:2,ig,id ) = id
3459 ifrsl( 1:2,ih,id ) = id
3460 ifrsl( 1,id,ih ) = ig
3461 ifrsl( 2,id,ih ) = ih
3465 ifrsl( 1:2,iss,iss ) = iss
3468 ifrsl( 1:2,iss,ig ) = ig
3469 ifrsl( 1:2,ig,iss ) = iss
3472 ifrsl( 1:2,ih,iss ) = iss
3473 ifrsl( 1,iss,ih ) = ig
3474 ifrsl( 2,iss,ih ) = ih
3478 ifrsl( 1:2,ig,ig ) = ig
3481 ifrsl( 1,ig,ih ) = ig
3482 ifrsl( 1,ih,ig ) = ig
3483 ifrsl( 2,ig,ih ) = ih
3484 ifrsl( 2,ih,ig ) = ih
3487 ifrsl( 1:2,ih,ih ) = ih
3492 end subroutine getrule
3501 integer ,
intent(in) :: ijkmax
3502 real(RP),
intent(in) :: f0(ijkmax)
3503 real(RP),
intent(inout) :: ga(nccn,ijkmax)
3514 ga(n,ijk) = ga(n,ijk) + f0(ijk) * marate(n) * expxactr(n) / dxaer
3521 end subroutine faero
3526 subroutine random_setup( mset )
3533 integer,
intent(in) :: mset
3537 real(RP) :: nbinr, tmp1
3538 real(RP) :: rans( mbin ), ranl( mbin )
3540 real(RP),
allocatable :: ranstmp( : )
3541 real(RP),
allocatable :: ranltmp( : )
3544 integer,
allocatable :: orderb( : )
3547 real(RP),
allocatable :: randnum(:,:,:)
3549 pq = nbin*(nbin-1)/2
3550 allocate( blrg( mset, mbin ) )
3551 allocate( bsml( mset, mbin ) )
3552 allocate( ranstmp( pq ) )
3553 allocate( ranltmp( pq ) )
3554 allocate( orderb( pq ) )
3555 allocate( randnum(1,1,pq) )
3557 a =
real( nbin )*
real( nbin-1 )*0.50_RP
3558 if ( a < mbin )
then 3559 write(*,*)
"mbin should be smaller than {nbin}_C_{2}" 3563 wgtbin = a/
real( mbin )
3564 nbinr =
real( nbin )
3571 ranstmp( (p-1)*nbin-(p*(p-1))/2+1 : p*nbin-(p*(p+1))/2 ) = p
3573 ranltmp( (p-1)*nbin-(p*(p-1))/2+q ) = p+q
3580 abq1 = randnum( 1,1,p )
3581 k = int( abq1*( pq-p-1 ) ) + p
3583 orderb( p ) = orderb( k )
3589 rans( p ) = ranstmp( orderb( p ) )
3590 ranl( p ) = ranltmp( orderb( p ) )
3592 rans( p ) = ranstmp( orderb( p-pq ) )
3593 ranl( p ) = ranltmp( orderb( p-pq ) )
3595 if ( rans( p ) >= ranl( p ) )
then 3597 rans( p ) = ranl( p )
3601 blrg( n,1:mbin ) = int( ranl( 1:mbin ) )
3602 bsml( n,1:mbin ) = int( rans( 1:mbin ) )
3605 deallocate( ranstmp )
3606 deallocate( ranltmp )
3607 deallocate( orderb )
3608 deallocate( randnum )
3610 end subroutine random_setup
3626 integer,
intent(in) :: ijkmax
3627 real(RP),
intent(in) :: swgt
3628 real(RP),
intent(in) :: temp(ijkmax)
3629 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3630 real(DP),
intent(in) :: dtime
3632 integer :: i, j, k, l
3633 real(RP) :: xi, xj, xnew, dmpi, dmpj, frci, frcj
3634 real(RP) :: gprime, gprimk, wgt, crn, sum, flux
3635 integer,
parameter :: ldeg = 2
3636 real(RP),
parameter :: dmpmin = 1.e-01_rp, cmin = 1.e-10_rp
3637 real(RP) :: acoef( 0:ldeg )
3640 integer :: nums( mbin ), numl( mbin )
3641 real(RP),
parameter :: gt = 1.0_rp
3643 real(RP) :: nbinr, mbinr
3645 real(RP) :: tmpi, tmpj
3647 integer :: ibnd( ijkmax )
3648 integer :: iflg( nspc,ijkmax )
3649 integer :: iexst( nbin,nspc,ijkmax )
3650 real(RP) :: csum( nspc,ijkmax )
3651 integer :: ijk, nn, mm, pp, qq, myu, n, isml, ilrg, irsl
3658 csum( :,: ) = 0.0_rp
3662 csum( il,ijk ) = csum( il,ijk ) + gc( n,il,ijk )*dxmic
3663 csum( ic,ijk ) = csum( ic,ijk ) + gc( n,ic,ijk )*dxmic
3664 csum( ip,ijk ) = csum( ip,ijk ) + gc( n,ip,ijk )*dxmic
3665 csum( id,ijk ) = csum( id,ijk ) + gc( n,id,ijk )*dxmic
3666 csum( iss,ijk ) = csum( iss,ijk ) + gc( n,iss,ijk )*dxmic
3667 csum( ig,ijk ) = csum( ig,ijk ) + gc( n,ig,ijk )*dxmic
3668 csum( ih,ijk ) = csum( ih,ijk ) + gc( n,ih,ijk )*dxmic
3670 if ( csum( il,ijk ) > cldmin ) iflg( il,ijk ) = 1
3671 if ( csum( ic,ijk ) > cldmin ) iflg( ic,ijk ) = 1
3672 if ( csum( ip,ijk ) > cldmin ) iflg( ip,ijk ) = 1
3673 if ( csum( id,ijk ) > cldmin ) iflg( id,ijk ) = 1
3674 if ( csum( iss,ijk ) > cldmin ) iflg( iss,ijk ) = 1
3675 if ( csum( ig,ijk ) > cldmin ) iflg( ig,ijk ) = 1
3676 if ( csum( ih,ijk ) > cldmin ) iflg( ih,ijk ) = 1
3678 if ( temp(ijk) < tcrit )
then 3686 if ( gc( n,myu,ijk ) > cldmin )
then 3687 iexst( n,myu,ijk ) = 1
3697 do nn = 1, iflg( isml,ijk )
3700 do mm = 1, iflg( ilrg,ijk )
3702 irsl = ifrsl( ibnd(ijk),isml,ilrg )
3705 det = int( rndm(1,1,1)*
ia*
ja*
ka )
3706 nbinr =
real( nbin )
3707 mbinr =
real( mbin )
3708 nums( 1:mbin ) = bsml( det,1:mbin )
3709 numl( 1:mbin ) = blrg( det,1:mbin )
3715 do pp = 1, iexst( i,isml,ijk )
3716 do qq = 1, iexst( j,ilrg,ijk )
3723 dmpi = ck( isml,ilrg,i,j )*gc( j,ilrg,ijk )/xj*dxmic*dtime
3724 dmpj = ck( ilrg,isml,i,j )*gc( i,isml,ijk )/xi*dxmic*dtime
3726 if ( dmpi <= dmpmin )
then 3727 frci = gc( i,isml,ijk )*dmpi
3729 frci = gc( i,isml,ijk )*( 1.0_rp-exp( -dmpi ) )
3732 if ( dmpj <= dmpmin )
then 3733 frcj = gc( j,ilrg,ijk )*dmpj
3735 frcj = gc( j,ilrg,ijk )*( 1.0_rp-exp( -dmpj ) )
3737 tmpi = gc( i,isml,ijk )
3738 tmpj = gc( j,ilrg,ijk )
3740 gc( i,isml,ijk ) = gc( i,isml,ijk )-frci*swgt
3741 gc( j,ilrg,ijk ) = gc( j,ilrg,ijk )-frcj*swgt
3744 gc( j,ilrg,ijk ) = max( gc( j,ilrg,ijk ), 0.0_rp )
3746 gc( i,isml,ijk ) = max( gc( i,isml,ijk ), 0.0_rp )
3748 frci = tmpi - gc( i,isml,ijk )
3749 frcj = tmpj - gc( j,ilrg,ijk )
3774 if ( gprime > 0.0_rp .AND. k < nbin )
then 3776 gprimk = gc( k,irsl,ijk ) + gprime
3777 wgt = gprime / gprimk
3778 crn = ( xnew-xctr( k ) )/( xctr( k+1 )-xctr( k ) )
3780 acoef( 0 ) = -( gc( k+1,irsl,ijk )-26.0_rp*gprimk+gc( k-1,irsl,ijk ) )/24.0_rp
3781 acoef( 1 ) = ( gc( k+1,irsl,ijk )-gc( k-1,irsl,ijk ) ) *0.5_rp
3782 acoef( 2 ) = ( gc( k+1,irsl,ijk )-2.0_rp*gprimk+gc( k-1,irsl,ijk ) ) *0.50_rp
3786 sum = sum + acoef( l )/( l+1 )/2.0_rp**( l+1 ) &
3787 *( 1.0_rp-( 1.0_rp-2.0_rp*crn )**( l+1 ) )
3791 flux = min( max( flux,0.0_rp ),gprime )
3793 gc( k,irsl,ijk ) = gprimk - flux
3794 gc( k+1,irsl,ijk ) = gc( k+1,irsl,ijk ) + flux
3830 real(RP),
intent(out) :: cldfrac(
ka,
ia,
ja)
3831 real(RP),
intent(in) :: QTRC (
ka,
ia,
ja,qad)
3834 integer :: k, i, j, iq, ihydro
3842 do ihydro = 1,
mp_qa 3843 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
3844 qhydro = qhydro + qtrc(k,i,j,iq)
3847 cldfrac(k,i,j) = 0.5_rp + sign(0.5_rp,qhydro-eps)
3851 elseif( nspc == 1 )
then 3856 do ihydro = 1, i_mp_qc
3857 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
3858 qhydro = qhydro + qtrc(k,i,j,iq)
3861 cldfrac(k,i,j) = 0.5_rp + sign(0.5_rp,qhydro-eps)
3887 real(RP),
intent(out) :: Re (
ka,
ia,
ja,mp_qad)
3888 real(RP),
intent(in) :: QTRC0(
ka,
ia,
ja,qad)
3889 real(RP),
intent(in) :: DENS0(
ka,
ia,
ja)
3890 real(RP),
intent(in) :: TEMP0(
ka,
ia,
ja)
3892 real(RP),
parameter :: um2cm = 100.0_rp
3895 integer :: i, j, k, iq, ihydro
3898 sum2(:,:,:,:) = 0.0_rp
3899 sum3(:,:,:,:) = 0.0_rp
3902 do ihydro = 1,
mp_qa 3906 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
3907 sum3(k,i,j,ihydro) = sum3(k,i,j,ihydro) + &
3908 ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
3909 * rexpxctr( iq-(i_qv+nbin*(ihydro-1)) ) &
3910 * radc( iq-(i_qv+nbin*(ihydro-1)) )**3.0_rp )
3911 sum2(k,i,j,ihydro) = sum2(k,i,j,ihydro) + &
3912 ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
3913 * rexpxctr( iq-(i_qv+nbin*(ihydro-1)) ) &
3914 * radc( iq-(i_qv+nbin*(ihydro-1)) )**2.0_rp )
3916 sum2(k,i,j,ihydro) = 0.5_rp + sign(0.5_rp,sum2(k,i,j,ihydro)-eps)
3917 sum3(k,i,j,ihydro) = 0.5_rp + sign(0.5_rp,sum3(k,i,j,ihydro)-eps)
3919 if ( sum2(k,i,j,ihydro) /= 0.0_rp )
then 3920 re(k,i,j,ihydro) = sum3(k,i,j,ihydro) / sum2(k,i,j,ihydro) * um2cm
3922 re(k,i,j,ihydro) = 0.0_rp
3928 elseif( nspc == 1 )
then 3929 re(:,:,:,:) = 0.0_rp
3930 do ihydro = 1, i_mp_qc
3934 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
3935 sum3(k,i,j,ihydro) = sum3(k,i,j,ihydro) + &
3936 ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
3937 * rexpxctr( iq-(i_qv+nbin*(ihydro-1)) ) &
3938 * radc( iq-(i_qv+nbin*(ihydro-1)) )**3.0_rp )
3939 sum2(k,i,j,ihydro) = sum2(k,i,j,ihydro) + &
3940 ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
3941 * rexpxctr( iq-(i_qv+nbin*(ihydro-1)) ) &
3942 * radc( iq-(i_qv+nbin*(ihydro-1)) )**2.0_rp )
3944 sum2(k,i,j,ihydro) = 0.5_rp + sign(0.5_rp,sum2(k,i,j,ihydro)-eps)
3945 sum3(k,i,j,ihydro) = 0.5_rp + sign(0.5_rp,sum3(k,i,j,ihydro)-eps)
3947 if ( sum2(k,i,j,ihydro) /= 0.0_rp )
then 3948 re(k,i,j,ihydro) = sum3(k,i,j,ihydro) / sum2(k,i,j,ihydro) * um2cm
3950 re(k,i,j,ihydro) = 0.0_rp
3976 real(RP),
intent(out) :: Qe (
ka,
ia,
ja,mp_qad)
3977 real(RP),
intent(in) :: QTRC0(
ka,
ia,
ja,qad)
3980 integer :: i, j, k, iq, ihydro
3983 qe(:,:,:,:) = 0.0_rp
3988 do ihydro = 1,
mp_qa 3990 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
3991 sum2 = sum2 + qtrc0(k,i,j,iq)
3993 qe(k,i,j,ihydro) = sum2
3998 elseif( nspc == 1 )
then 4002 do ihydro = 1, i_mp_qc
4004 do iq = i_qv+nbin*(ihydro-1)+1, i_qv+nbin*ihydro
4005 sum2 = sum2 + qtrc0(k,i,j,iq)
4007 qe(k,i,j,ihydro) = sum2
4028 allocate( radc_mk( nbin ) )
4029 allocate( xctr_mk( nbin ) )
4030 allocate( xbnd_mk( nbin+1 ) )
4031 allocate( cctr_mk( nspc_mk,nbin ) )
4032 allocate( cbnd_mk( nspc_mk,nbin+1 ) )
4033 allocate( ck_mk( nspc_mk,nspc_mk,nbin,nbin ) )
4034 allocate( vt_mk( nspc_mk,nbin ) )
4035 allocate( br_mk( nspc_mk,nbin ) )
4058 deallocate( radc_mk )
4059 deallocate( xctr_mk )
4060 deallocate( xbnd_mk )
4061 deallocate( cctr_mk )
4062 deallocate( cbnd_mk )
4073 integer,
parameter :: il = 1, ic = 2, ip = 3, id = 4
4074 integer,
parameter :: is = 5, ig = 6, ih = 7
4075 integer,
parameter :: icemax = 3
4077 integer :: k, kk, i, j
4078 real(DP) :: xl( ndat ), rlec( ndat ), vrl( ndat )
4079 real(DP) :: blkradl( ndat ), blkdnsl( ndat )
4081 real(DP) :: xi( ndat,icemax ), riec( ndat,icemax ), vri( ndat,icemax )
4082 real(DP) :: blkradi( ndat,icemax ), blkdnsi( ndat,icemax )
4084 real(DP) :: xs( ndat ), rsec( ndat ), vrs( ndat )
4085 real(DP) :: blkrads( ndat ), blkdnss( ndat )
4087 real(DP) :: xg( ndat ), rgec( ndat ), vrg( ndat )
4088 real(DP) :: blkradg( ndat ), blkdnsg( ndat )
4090 real(DP) :: xh( ndat ), rhec( ndat ), vrh( ndat )
4091 real(DP) :: blkradh( ndat ), blkdnsh( ndat )
4094 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4095 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4096 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4097 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4098 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4099 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4100 data xi(1:ndat,1) / &
4101 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4102 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4103 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4104 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4105 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4106 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4107 data xi(1:ndat,2) / &
4108 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4109 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4110 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4111 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4112 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4113 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00 /
4114 data xi(1:ndat,3) / &
4115 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4116 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4117 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4118 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4119 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4120 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4122 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4123 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4124 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4125 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4126 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4127 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4129 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4130 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4131 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4132 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4133 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4134 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4136 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4137 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4138 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4139 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4140 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4141 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4142 data rlec(1:ndat) / &
4143 0.20000e-03_dp,0.25198e-03_dp,0.31748e-03_dp,0.40000e-03_dp,0.50397e-03_dp,0.63496e-03_dp, &
4144 0.80000e-03_dp,0.10079e-02_dp,0.12699e-02_dp,0.16000e-02_dp,0.20159e-02_dp,0.25398e-02_dp, &
4145 0.32000e-02_dp,0.40317e-02_dp,0.50797e-02_dp,0.64000e-02_dp,0.80635e-02_dp,0.10159e-01_dp, &
4146 0.12800e-01_dp,0.16127e-01_dp,0.20319e-01_dp,0.25600e-01_dp,0.32254e-01_dp,0.40637e-01_dp, &
4147 0.51200e-01_dp,0.64508e-01_dp,0.81275e-01_dp,0.10240e+00_dp,0.12902e+00_dp,0.16255e+00_dp, &
4148 0.20480e+00_dp,0.25803e+00_dp,0.32510e+00_dp /
4149 data riec(1:ndat,1) / &
4150 0.31936e-03_dp,0.40397e-03_dp,0.51099e-03_dp,0.64638e-03_dp,0.81764e-03_dp,0.10343e-02_dp, &
4151 0.13084e-02_dp,0.16551e-02_dp,0.20937e-02_dp,0.26486e-02_dp,0.33506e-02_dp,0.42387e-02_dp, &
4152 0.64360e-02_dp,0.81426e-02_dp,0.10302e-01_dp,0.13035e-01_dp,0.16494e-01_dp,0.20872e-01_dp, &
4153 0.26412e-01_dp,0.33426e-01_dp,0.42304e-01_dp,0.53543e-01_dp,0.67770e-01_dp,0.85783e-01_dp, &
4154 0.10859e+00_dp,0.13746e+00_dp,0.17403e+00_dp,0.22032e+00_dp,0.27895e+00_dp,0.35319e+00_dp, &
4155 0.44722e+00_dp,0.56630e+00_dp,0.71712e+00_dp /
4156 data riec(1:ndat,2) / &
4157 0.13188e-03_dp,0.16615e-03_dp,0.20953e-03_dp,0.27728e-03_dp,0.36694e-03_dp,0.48559e-03_dp, &
4158 0.64261e-03_dp,0.85040e-03_dp,0.11254e-02_dp,0.14893e-02_dp,0.19709e-02_dp,0.26082e-02_dp, &
4159 0.34515e-02_dp,0.45676e-02_dp,0.60446e-02_dp,0.79991e-02_dp,0.10586e-01_dp,0.14009e-01_dp, &
4160 0.18539e-01_dp,0.24533e-01_dp,0.32466e-01_dp,0.42964e-01_dp,0.56857e-01_dp,0.75242e-01_dp, &
4161 0.99573e-01_dp,0.13177e+00_dp,0.17438e+00_dp,0.23077e+00_dp,0.30539e+00_dp,0.40414e+00_dp, &
4162 0.53482e+00_dp,0.70775e+00_dp,0.93661e+00_dp /
4163 data riec(1:ndat,3) / 0.14998e-03_dp,0.18896e-03_dp,0.23808e-03_dp, &
4164 0.29996e-03_dp,0.37793e-03_dp,0.47616e-03_dp,0.61048e-03_dp,0.81343e-03_dp,0.10839e-02_dp, &
4165 0.14442e-02_dp,0.19243e-02_dp,0.25640e-02_dp,0.34164e-02_dp,0.45522e-02_dp,0.60656e-02_dp, &
4166 0.80820e-02_dp,0.10769e-01_dp,0.14349e-01_dp,0.19119e-01_dp,0.25475e-01_dp,0.44576e-01_dp, &
4167 0.62633e-01_dp,0.88006e-01_dp,0.12366e+00_dp,0.17375e+00_dp,0.24414e+00_dp,0.34304e+00_dp, &
4168 0.48201e+00_dp,0.67728e+00_dp,0.95164e+00_dp,0.13372e+01_dp,0.18788e+01_dp,0.26400e+01_dp /
4169 data rsec(1:ndat) / &
4170 0.92832e-03_dp,0.11696e-02_dp,0.14736e-02_dp,0.18566e-02_dp,0.23392e-02_dp,0.29472e-02_dp, &
4171 0.37133e-02_dp,0.46784e-02_dp,0.58944e-02_dp,0.74265e-02_dp,0.93569e-02_dp,0.11789e-01_dp, &
4172 0.14853e-01_dp,0.18714e-01_dp,0.23578e-01_dp,0.29706e-01_dp,0.37427e-01_dp,0.47156e-01_dp, &
4173 0.59412e-01_dp,0.74855e-01_dp,0.94311e-01_dp,0.11882e+00_dp,0.14971e+00_dp,0.18862e+00_dp, &
4174 0.23765e+00_dp,0.29942e+00_dp,0.37724e+00_dp,0.47530e+00_dp,0.59884e+00_dp,0.75449e+00_dp, &
4175 0.95060e+00_dp,0.11977e+01_dp,0.15090e+01_dp /
4176 data rgec(1:ndat) / 0.27144e-03_dp,0.34200e-03_dp,0.43089e-03_dp, &
4177 0.54288e-03_dp,0.68399e-03_dp,0.86177e-03_dp,0.10858e-02_dp,0.13680e-02_dp,0.17235e-02_dp, &
4178 0.21715e-02_dp,0.27360e-02_dp,0.34471e-02_dp,0.43431e-02_dp,0.54719e-02_dp,0.68942e-02_dp, &
4179 0.86861e-02_dp,0.10944e-01_dp,0.13788e-01_dp,0.17372e-01_dp,0.21888e-01_dp,0.27577e-01_dp, &
4180 0.34745e-01_dp,0.43775e-01_dp,0.55154e-01_dp,0.69489e-01_dp,0.87551e-01_dp,0.11031e+00_dp, &
4181 0.13898e+00_dp,0.17510e+00_dp,0.22061e+00_dp,0.27796e+00_dp,0.35020e+00_dp,0.44123e+00_dp /
4182 data rhec(1:ndat) / &
4183 0.20715e-03_dp,0.26099e-03_dp,0.32883e-03_dp,0.41430e-03_dp,0.52198e-03_dp,0.65766e-03_dp, &
4184 0.82860e-03_dp,0.10440e-02_dp,0.13153e-02_dp,0.16572e-02_dp,0.20879e-02_dp,0.26306e-02_dp, &
4185 0.33144e-02_dp,0.41759e-02_dp,0.52613e-02_dp,0.66288e-02_dp,0.83517e-02_dp,0.10523e-01_dp, &
4186 0.13258e-01_dp,0.16703e-01_dp,0.21045e-01_dp,0.26515e-01_dp,0.33407e-01_dp,0.42090e-01_dp, &
4187 0.53030e-01_dp,0.66814e-01_dp,0.84180e-01_dp,0.10606e+00_dp,0.13363e+00_dp,0.16836e+00_dp, &
4188 0.21212e+00_dp,0.26725e+00_dp,0.33672e+00_dp /
4189 data vrl(1:ndat) / &
4190 0.50000e-01_dp,0.78000e-01_dp,0.12000e+00_dp,0.19000e+00_dp,0.31000e+00_dp,0.49000e+00_dp, &
4191 0.77000e+00_dp,0.12000e+01_dp,0.19000e+01_dp,0.30000e+01_dp,0.48000e+01_dp,0.74000e+01_dp, &
4192 0.11000e+02_dp,0.17000e+02_dp,0.26000e+02_dp,0.37000e+02_dp,0.52000e+02_dp,0.71000e+02_dp, &
4193 0.94000e+02_dp,0.12000e+03_dp,0.16000e+03_dp,0.21000e+03_dp,0.26000e+03_dp,0.33000e+03_dp, &
4194 0.41000e+03_dp,0.48000e+03_dp,0.57000e+03_dp,0.66000e+03_dp,0.75000e+03_dp,0.82000e+03_dp, &
4195 0.88000e+03_dp,0.90000e+03_dp,0.90000e+03_dp /
4196 data vri(1:ndat,1) / 0.30000e-01_dp,0.40000e-01_dp,0.60000e-01_dp, &
4197 0.80000e-01_dp,0.11000e+00_dp,0.15000e+00_dp,0.17000e+00_dp,0.18000e+00_dp,0.20000e+00_dp, &
4198 0.25000e+00_dp,0.40000e+00_dp,0.60000e+01_dp,0.10000e+02_dp,0.15000e+02_dp,0.20000e+02_dp, &
4199 0.25000e+02_dp,0.31000e+02_dp,0.37000e+02_dp,0.41000e+02_dp,0.46000e+02_dp,0.51000e+02_dp, &
4200 0.55000e+02_dp,0.59000e+02_dp,0.62000e+02_dp,0.64000e+02_dp,0.67000e+02_dp,0.68000e+02_dp, &
4201 0.69000e+02_dp,0.70000e+02_dp,0.71000e+02_dp,0.71500e+02_dp,0.71750e+02_dp,0.72000e+02_dp /
4202 data vri(1:ndat,2) / &
4203 0.30000e-01_dp,0.40000e-01_dp,0.50000e-01_dp,0.70000e-01_dp,0.90000e-01_dp,0.12000e+00_dp, &
4204 0.50000e+00_dp,0.80000e+00_dp,0.16000e+01_dp,0.18000e+01_dp,0.20000e+01_dp,0.30000e+01_dp, &
4205 0.40000e+01_dp,0.50000e+01_dp,0.80000e+01_dp,0.13000e+02_dp,0.19000e+02_dp,0.26000e+02_dp, &
4206 0.32000e+02_dp,0.38000e+02_dp,0.47000e+02_dp,0.55000e+02_dp,0.65000e+02_dp,0.73000e+02_dp, &
4207 0.77000e+02_dp,0.79000e+02_dp,0.80000e+02_dp,0.81000e+02_dp,0.81000e+02_dp,0.82000e+02_dp, &
4208 0.82000e+02_dp,0.82000e+02_dp,0.82000e+02_dp /
4209 data vri(1:ndat,3) / 0.35000e-01_dp,0.45000e-01_dp,0.55000e-01_dp, &
4210 0.75000e-01_dp,0.95000e-01_dp,0.13000e+00_dp,0.60000e+00_dp,0.90000e+00_dp,0.17000e+01_dp, &
4211 0.20000e+01_dp,0.25000e+01_dp,0.38000e+01_dp,0.50000e+01_dp,0.70000e+01_dp,0.90000e+01_dp, &
4212 0.11000e+02_dp,0.14000e+02_dp,0.17000e+02_dp,0.21000e+02_dp,0.25000e+02_dp,0.32000e+02_dp, &
4213 0.38000e+02_dp,0.44000e+02_dp,0.49000e+02_dp,0.53000e+02_dp,0.55000e+02_dp,0.58000e+02_dp, &
4214 0.59000e+02_dp,0.61000e+02_dp,0.62000e+02_dp,0.63000e+02_dp,0.64000e+02_dp,0.65000e+02_dp /
4215 data vrs(1:ndat) / &
4216 0.20000e-01_dp,0.31000e-01_dp,0.49000e-01_dp,0.77000e-01_dp,0.12000e+00_dp,0.19000e+00_dp, &
4217 0.30000e+00_dp,0.48000e+00_dp,0.76000e+00_dp,0.12000e+01_dp,0.19000e+01_dp,0.30000e+01_dp, &
4218 0.48000e+01_dp,0.75000e+01_dp,0.11000e+02_dp,0.16000e+02_dp,0.21000e+02_dp,0.26000e+02_dp, &
4219 0.34000e+02_dp,0.41000e+02_dp,0.49000e+02_dp,0.57000e+02_dp,0.65000e+02_dp,0.73000e+02_dp, &
4220 0.81000e+02_dp,0.87000e+02_dp,0.93000e+02_dp,0.99000e+02_dp,0.10750e+03_dp,0.11500e+03_dp, &
4221 0.12500e+03_dp,0.13500e+03_dp,0.14500e+03_dp /
4222 data vrg(1:ndat) / 0.39000e-01_dp,0.62000e-01_dp,0.97000e-01_dp, &
4223 0.15000e+00_dp,0.24000e+00_dp,0.38000e+00_dp,0.61000e+00_dp,0.96000e+00_dp,0.15000e+01_dp, &
4224 0.24000e+01_dp,0.38000e+01_dp,0.61000e+01_dp,0.96000e+01_dp,0.15000e+02_dp,0.23000e+02_dp, &
4225 0.31000e+02_dp,0.39000e+02_dp,0.49000e+02_dp,0.59000e+02_dp,0.68000e+02_dp,0.79000e+02_dp, &
4226 0.88000e+02_dp,0.10000e+03_dp,0.11000e+03_dp,0.13000e+03_dp,0.15000e+03_dp,0.17000e+03_dp, &
4227 0.20000e+03_dp,0.23000e+03_dp,0.26000e+03_dp,0.30000e+03_dp,0.35000e+03_dp,0.40000e+03_dp /
4228 data vrh(1:ndat) / &
4229 0.53000e-01_dp,0.84000e-01_dp,0.13000e+00_dp,0.21000e+00_dp,0.33000e+00_dp,0.52000e+00_dp, &
4230 0.82000e+00_dp,0.13000e+01_dp,0.21000e+01_dp,0.33000e+01_dp,0.52000e+01_dp,0.82000e+01_dp, &
4231 0.13000e+02_dp,0.20000e+02_dp,0.28000e+02_dp,0.36000e+02_dp,0.46000e+02_dp,0.56000e+02_dp, &
4232 0.67000e+02_dp,0.80000e+02_dp,0.97000e+02_dp,0.12000e+03_dp,0.14000e+03_dp,0.17000e+03_dp, &
4233 0.20000e+03_dp,0.24000e+03_dp,0.29000e+03_dp,0.35000e+03_dp,0.42000e+03_dp,0.51000e+03_dp, &
4234 0.61000e+03_dp,0.74000e+03_dp,0.89000e+03_dp /
4235 data blkradl(1:ndat) / &
4236 0.20000e-03_dp,0.25198e-03_dp,0.31748e-03_dp,0.40000e-03_dp,0.50397e-03_dp,0.63496e-03_dp, &
4237 0.80000e-03_dp,0.10079e-02_dp,0.12699e-02_dp,0.16000e-02_dp,0.20159e-02_dp,0.25398e-02_dp, &
4238 0.32000e-02_dp,0.40317e-02_dp,0.50797e-02_dp,0.64000e-02_dp,0.80635e-02_dp,0.10159e-01_dp, &
4239 0.12800e-01_dp,0.16127e-01_dp,0.20319e-01_dp,0.25600e-01_dp,0.32254e-01_dp,0.40637e-01_dp, &
4240 0.51200e-01_dp,0.64508e-01_dp,0.81275e-01_dp,0.10240e+00_dp,0.12902e+00_dp,0.16255e+00_dp, &
4241 0.20480e+00_dp,0.25803e+00_dp,0.32510e+00_dp /
4242 data blkradi(1:ndat,1) / 0.57452e-03_dp,0.72384e-03_dp,0.91199e-03_dp, &
4243 0.11490e-02_dp,0.14477e-02_dp,0.18240e-02_dp,0.22981e-02_dp,0.28954e-02_dp,0.36479e-02_dp, &
4244 0.45961e-02_dp,0.57908e-02_dp,0.72959e-02_dp,0.11572e-01_dp,0.14770e-01_dp,0.18851e-01_dp, &
4245 0.24060e-01_dp,0.30709e-01_dp,0.39194e-01_dp,0.50025e-01_dp,0.63848e-01_dp,0.81491e-01_dp, &
4246 0.10401e+00_dp,0.13275e+00_dp,0.16943e+00_dp,0.21625e+00_dp,0.27601e+00_dp,0.35228e+00_dp, &
4247 0.44962e+00_dp,0.57387e+00_dp,0.73244e+00_dp,0.93484e+00_dp,0.11932e+01_dp,0.15229e+01_dp /
4248 data blkradi(1:ndat,2) / &
4249 0.20715e-03_dp,0.26099e-03_dp,0.32912e-03_dp,0.43555e-03_dp,0.57638e-03_dp,0.76276e-03_dp, &
4250 0.10094e-02_dp,0.13358e-02_dp,0.17677e-02_dp,0.23394e-02_dp,0.30958e-02_dp,0.40969e-02_dp, &
4251 0.54216e-02_dp,0.71748e-02_dp,0.94948e-02_dp,0.12565e-01_dp,0.16628e-01_dp,0.22005e-01_dp, &
4252 0.29120e-01_dp,0.38537e-01_dp,0.50998e-01_dp,0.67488e-01_dp,0.89311e-01_dp,0.11819e+00_dp, &
4253 0.15641e+00_dp,0.20698e+00_dp,0.27391e+00_dp,0.36249e+00_dp,0.47970e+00_dp,0.63481e+00_dp, &
4254 0.84009e+00_dp,0.11117e+01_dp,0.14712e+01_dp /
4255 data blkradi(1:ndat,3) / 0.23559e-03_dp,0.29682e-03_dp,0.37397e-03_dp, &
4256 0.47118e-03_dp,0.59365e-03_dp,0.74795e-03_dp,0.95894e-03_dp,0.12777e-02_dp,0.17025e-02_dp, &
4257 0.22685e-02_dp,0.30227e-02_dp,0.40275e-02_dp,0.53665e-02_dp,0.71506e-02_dp,0.95278e-02_dp, &
4258 0.12695e-01_dp,0.16916e-01_dp,0.22539e-01_dp,0.30032e-01_dp,0.40017e-01_dp,0.70019e-01_dp, &
4259 0.98384e-01_dp,0.13824e+00_dp,0.19424e+00_dp,0.27293e+00_dp,0.38350e+00_dp,0.53885e+00_dp, &
4260 0.75714e+00_dp,0.10639e+01_dp,0.14948e+01_dp,0.21004e+01_dp,0.29513e+01_dp,0.41469e+01_dp /
4261 data blkrads(1:ndat) / &
4262 0.20715e-03_dp,0.26148e-03_dp,0.33067e-03_dp,0.41710e-03_dp,0.52691e-03_dp,0.66640e-03_dp, &
4263 0.84289e-03_dp,0.10674e-02_dp,0.13513e-02_dp,0.17129e-02_dp,0.21670e-02_dp,0.27521e-02_dp, &
4264 0.34989e-02_dp,0.44777e-02_dp,0.57347e-02_dp,0.75389e-02_dp,0.99020e-02_dp,0.13161e-01_dp, &
4265 0.17372e-01_dp,0.23337e-01_dp,0.31058e-01_dp,0.41194e-01_dp,0.55153e-01_dp,0.74854e-01_dp, &
4266 0.99806e-01_dp,0.13463e+00_dp,0.18136e+00_dp,0.24282e+00_dp,0.32955e+00_dp,0.44123e+00_dp, &
4267 0.59884e+00_dp,0.77090e+00_dp,0.99387e+00_dp /
4268 data blkradg(1:ndat) / 0.27144e-03_dp,0.34200e-03_dp,0.43089e-03_dp, &
4269 0.54288e-03_dp,0.68399e-03_dp,0.86177e-03_dp,0.10858e-02_dp,0.13680e-02_dp,0.17235e-02_dp, &
4270 0.21715e-02_dp,0.27360e-02_dp,0.34471e-02_dp,0.43431e-02_dp,0.54719e-02_dp,0.68942e-02_dp, &
4271 0.86861e-02_dp,0.10944e-01_dp,0.13788e-01_dp,0.17372e-01_dp,0.21888e-01_dp,0.27577e-01_dp, &
4272 0.34745e-01_dp,0.43775e-01_dp,0.55154e-01_dp,0.69489e-01_dp,0.87551e-01_dp,0.11031e+00_dp, &
4273 0.13898e+00_dp,0.17510e+00_dp,0.22061e+00_dp,0.27796e+00_dp,0.35020e+00_dp,0.44123e+00_dp /
4274 data blkradh(1:ndat) / &
4275 0.20715e-03_dp,0.26099e-03_dp,0.32883e-03_dp,0.41430e-03_dp,0.52198e-03_dp,0.65766e-03_dp, &
4276 0.82860e-03_dp,0.10440e-02_dp,0.13153e-02_dp,0.16572e-02_dp,0.20879e-02_dp,0.26306e-02_dp, &
4277 0.33144e-02_dp,0.41759e-02_dp,0.52613e-02_dp,0.66288e-02_dp,0.83517e-02_dp,0.10523e-01_dp, &
4278 0.13258e-01_dp,0.16703e-01_dp,0.21045e-01_dp,0.26515e-01_dp,0.33407e-01_dp,0.42090e-01_dp, &
4279 0.53030e-01_dp,0.66814e-01_dp,0.84180e-01_dp,0.10606e+00_dp,0.13363e+00_dp,0.16836e+00_dp, &
4280 0.21212e+00_dp,0.26725e+00_dp,0.33672e+00_dp /
4281 data blkdnsl(1:ndat) / &
4282 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4283 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4284 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4285 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4286 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4287 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp /
4288 data blkdnsi(1:ndat,1) / 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4289 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4290 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.87368e+00_dp,0.87072e+00_dp,0.86777e+00_dp, &
4291 0.86483e+00_dp,0.86189e+00_dp,0.85897e+00_dp,0.85606e+00_dp,0.85316e+00_dp,0.85026e+00_dp, &
4292 0.84738e+00_dp,0.84451e+00_dp,0.84164e+00_dp,0.83879e+00_dp,0.83595e+00_dp,0.83311e+00_dp, &
4293 0.83029e+00_dp,0.82747e+00_dp,0.82467e+00_dp,0.82187e+00_dp,0.81908e+00_dp,0.81631e+00_dp /
4294 data blkdnsi(1:ndat,2) / &
4295 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4296 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4297 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4298 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4299 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4300 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp /
4301 data blkdnsi(1:ndat,3) / 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4302 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4303 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4304 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.51790e+00_dp, &
4305 0.45557e+00_dp,0.40075e+00_dp,0.35252e+00_dp,0.31010e+00_dp,0.27278e+00_dp,0.23995e+00_dp, &
4306 0.21108e+00_dp,0.18567e+00_dp,0.16333e+00_dp,0.14367e+00_dp,0.12638e+00_dp,0.11118e+00_dp /
4307 data blkdnss(1:ndat) / &
4308 0.90000e+00_dp,0.89500e+00_dp,0.88500e+00_dp,0.88200e+00_dp,0.87500e+00_dp,0.86500e+00_dp, &
4309 0.85500e+00_dp,0.84200e+00_dp,0.83000e+00_dp,0.81500e+00_dp,0.80500e+00_dp,0.78600e+00_dp, &
4310 0.76500e+00_dp,0.73000e+00_dp,0.69500e+00_dp,0.61183e+00_dp,0.54000e+00_dp,0.46000e+00_dp, &
4311 0.40000e+00_dp,0.33000e+00_dp,0.28000e+00_dp,0.24000e+00_dp,0.20000e+00_dp,0.16000e+00_dp, &
4312 0.13500e+00_dp,0.11000e+00_dp,0.90000e-01_dp,0.75000e-01_dp,0.60000e-01_dp,0.50000e-01_dp, &
4313 0.40000e-01_dp,0.37500e-01_dp,0.35000e-01_dp /
4314 data blkdnsg(1:ndat) / &
4315 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4316 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4317 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4318 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4319 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4320 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp /
4321 data blkdnsh(1:ndat) / &
4322 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4323 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4324 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4325 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4326 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4327 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp /
4331 xmss( il,k ) =
log( dble( xl( k ) )*1.e-03_dp )
4332 xmss( ic,k ) =
log( dble( xi( k,1 ) )*1.e-03_dp )
4333 xmss( ip,k ) =
log( dble( xi( k,2 ) )*1.e-03_dp )
4334 xmss( id,k ) =
log( dble( xi( k,3 ) )*1.e-03_dp )
4335 xmss( is,k ) =
log( dble( xs( k ) )*1.e-03_dp )
4336 xmss( ig,k ) =
log( dble( xg( k ) )*1.e-03_dp )
4337 xmss( ih,k ) =
log( dble( xh( k ) )*1.e-03_dp )
4342 zcap( il,k ) = dble(rlec( k ))*1.e-02_dp
4343 zcap( ic,k ) = dble(riec( k,1 ))*1.e-02_dp
4344 zcap( ip,k ) = dble(riec( k,2 ))*1.e-02_dp
4345 zcap( id,k ) = dble(riec( k,3 ))*1.e-02_dp
4346 zcap( is,k ) = dble(rsec( k ))*1.e-02_dp
4347 zcap( ig,k ) = dble(rgec( k ))*1.e-02_dp
4348 zcap( ih,k ) = dble(rhec( k ))*1.e-02_dp
4353 vtrm( il,k ) = dble(vrl( k ))*1.e-02_dp
4354 vtrm( ic,k ) = dble(vri( k,1 ))*1.e-02_dp
4355 vtrm( ip,k ) = dble(vri( k,2 ))*1.e-02_dp
4356 vtrm( id,k ) = dble(vri( k,3 ))*1.e-02_dp
4357 vtrm( is,k ) = dble(vrs( k ))*1.e-02_dp
4358 vtrm( ig,k ) = dble(vrg( k ))*1.e-02_dp
4359 vtrm( ih,k ) = dble(vrh( k ))*1.e-02_dp
4364 blkr( il,k ) = dble(blkradl( k ))*10.0_dp
4365 blkr( ic,k ) = dble(blkradi( k,1 ))*10.0_dp
4366 blkr( ip,k ) = dble(blkradi( k,2 ))*10.0_dp
4367 blkr( id,k ) = dble(blkradi( k,3 ))*10.0_dp
4368 blkr( is,k ) = dble(blkrads( k ))*10.0_dp
4369 blkr( ig,k ) = dble(blkradg( k ))*10.0_dp
4370 blkr( ih,k ) = dble(blkradh( k ))*10.0_dp
4375 blkd( il,k ) = dble(blkdnsl( k ))*1000._dp
4376 blkd( ic,k ) = dble(blkdnsi( k,1 ))*1000._dp
4377 blkd( ip,k ) = dble(blkdnsi( k,2 ))*1000._dp
4378 blkd( id,k ) = dble(blkdnsi( k,3 ))*1000._dp
4379 blkd( is,k ) = dble(blkdnss( k ))*1000._dp
4380 blkd( ig,k ) = dble(blkdnsg( k ))*1000._dp
4381 blkd( ih,k ) = dble(blkdnsh( k ))*1000._dp
4390 ykrn( k,kk,i,j ) = kernels( k,kk,i,j )*1.e-06_dp
4397 end subroutine rdkdat
4401 real(DP) :: xsta, xend
4403 real(DP):: pi_dp = 3.1415920_dp
4404 real(DP):: rhow_dp = 1.0e+03_dp
4406 xsta =
log( rhow_dp * 4.0_dp*pi_dp/3.0_dp * ( 3.e-06_dp )**3.0_dp )
4407 xend =
log( rhow_dp * 4.0_dp*pi_dp/3.0_dp * ( 3.e-03_dp )**3.0_dp )
4409 dxmic_mk = ( xend-xsta )/nbin
4412 xbnd_mk( n ) = xsta + dxmic_mk*( n-1 )
4415 xctr_mk( n ) = ( xbnd_mk( n )+xbnd_mk( n+1 ) )*0.50_dp
4416 radc_mk( n ) = ( exp( xctr_mk( n ) )*3.0_dp/4.0_dp/pi_dp/rhow_dp )**( 1.0_dp/3.0_dp )
4419 end subroutine sdfgrid
4427 cctr_mk( myu,n ) = fcpc( myu,xctr_mk( n ) )
4430 cbnd_mk( myu,n ) = fcpc( myu,xbnd_mk( n ) )
4434 end subroutine getcp
4436 function fcpc( myu,x )
4438 integer,
intent(in) :: myu
4439 real(DP),
intent(in) :: x
4442 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4445 ( ndat, kdeg, xmss( myu,: ), &
4449 ( ndat, kdeg, qknt, xmss( myu,: ), &
4453 ( ndat, kdeg, elm, zcap( myu,: ), &
4456 fcpc = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4462 integer :: myu, nyu, i, j
4465 if( kphase == 0 )
then 4467 else if( kphase == 1 )
then 4469 else if( kphase == 2 )
then 4478 ck_mk( myu,nyu,i,j ) = fckrn( myu,nyu,xctr_mk( i ),xctr_mk( j ) )
4486 end subroutine getck
4488 function fckrn( myu,nyu,x,y )
4490 integer,
intent(in) :: myu, nyu
4491 real(DP),
intent(in) :: x, y
4494 real(DP) :: qknt( ndat+kdeg ), rknt( ndat+kdeg )
4495 real(DP) :: coef( ndat,ndat )
4497 real(DP) :: xlrg, xsml, vlrg, vsml, rlrg
4498 real(DP):: pi_dp = 3.1415920_dp
4499 real(DP):: rhow_dp = 1.0e+03_dp
4501 if( kphase == 0 )
then 4503 ( ndat, kdeg, xmss( myu,: ), &
4506 rknt( : ) = qknt( : )
4509 ( ndat, ndat, kdeg, kdeg, &
4510 xmss( myu,: ), xmss( nyu,: ), &
4512 ykrn( myu,nyu,:,: ), &
4516 ( ndat, ndat, kdeg, kdeg, &
4518 xmss( myu,: ), xmss( nyu,: ), &
4520 else if( kphase == 1 )
then 4524 vlrg = (exp( xlrg ) / rhow_dp )*1.e+06_dp
4525 vsml = (exp( xsml ) / rhow_dp )*1.e+06_dp
4527 rlrg = ( exp( xlrg )/( 4.0_dp*pi_dp*rhow_dp )*3.0_dp )**(1.0_dp/3.0_dp )*1.e+06_dp
4529 if( rlrg <=50.0_dp )
then 4530 fckrn = 9.44e+03_dp*( vlrg*vlrg + vsml*vsml )
4532 fckrn = 5.78e-03_dp*( vlrg+vsml )
4534 else if( kphase == 2 )
then 4535 fckrn = 1.5_dp*( exp(x) +exp(y) )
4548 vt_mk( myu,n ) = max( fvterm( myu,xctr_mk( n ) ), 0.0_dp )
4552 end subroutine getvt
4554 function fvterm( myu,x )
4556 integer,
intent(in) :: myu
4557 real(DP),
intent(in) :: x
4560 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4563 ( ndat, kdeg, xmss( myu,: ), &
4567 ( ndat, kdeg, qknt, xmss( myu,: ), &
4571 ( ndat, kdeg, elm, vtrm( myu,: ), &
4574 fvterm = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4584 br_mk( myu,n ) = fbulkrad( myu, xctr_mk( n ) )
4588 end subroutine getbr
4590 function fbulkrad( myu,x )
4592 integer,
intent(in) :: myu
4593 real(DP),
intent(in) :: x
4594 real(DP) :: fbulkrad
4596 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4599 ( ndat, kdeg, xmss( myu,: ), &
4603 ( ndat, kdeg, qknt, xmss( myu,: ), &
4607 ( ndat, kdeg, elm, blkr( myu,: ), &
4610 fbulkrad = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4612 end function fbulkrad
4616 integer :: myu, nyu, i, j, n
4618 open ( fid_micpara, file = fname_micpara, form =
'formatted', status=
'new' )
4620 write( fid_micpara,* ) nspc_mk, nbin
4624 xctr( n ) = xctr_mk( n )
4625 radc( n ) = radc_mk( n )
4626 write( fid_micpara,* ) n, xctr( n ), radc( n )
4629 xbnd( n ) = xbnd_mk( n )
4630 write( fid_micpara,* ) n, xbnd( n )
4632 write( fid_micpara,* ) dxmic_mk
4637 cctr( n,myu ) = cctr_mk( myu,n )
4638 write( fid_micpara,* ) myu, n, cctr( n,myu )
4641 cbnd( n,myu ) = cbnd_mk( myu,n )
4642 write( fid_micpara,* ) myu, n, cbnd( n,myu )
4651 ck( myu,nyu,i,j ) = ck_mk( myu,nyu,i,j )
4652 write( fid_micpara,* ) myu, nyu, i, j, ck( myu,nyu,i,j )
4661 vt( myu,n ) = vt_mk( myu,n )
4662 write( fid_micpara,* ) myu, n, vt( myu,n )
4669 br( myu,n ) = br_mk( myu,n )
4670 write( fid_micpara,* ) myu, n, br( myu,n )
4674 close ( fid_micpara )
4676 end subroutine paraout
4680 subroutine tinvss(n,a,dt,e,nn,iw,inder)
4684 integer,
intent(in) :: n, nn
4685 integer,
intent(inout) :: inder
4686 real(DP),
intent(inout) :: a(nn,n)
4687 real(DP),
intent(inout) :: dt
4688 real(DP),
intent(in) :: e
4689 integer,
intent(inout) :: iw( 2*n )
4690 integer :: i, j, k, kk, ij, nnn
4691 real(DP) :: work, aa, az, eps
4692 integer :: ipiv, jpiv
4699 elseif( n == 1 )
then 4701 elseif( n > 1 )
then 4708 write(6,690)
"n= ", n,
"nn= ", nn, &
4709 "n should be less than or equal to nn in TINVSS" 4710 690
format(a8,i5,5x,a4,i5,a55)
4720 if( abs(a(i,j)) <= abs(piv) )
goto 110
4728 if( abs(piv) <= eps )
goto 920
4729 if( k == 1 ) eps = abs(piv)*e
4730 if( ipiv == k )
goto 130
4738 if( jpiv == k )
goto 150
4753 if( i == k )
goto 220
4755 if( az == 0.0_dp )
goto 220
4757 a(i,j) = a(i,j)-a(k,j)*az
4767 if( ij == k )
goto 420
4775 if( ij == k )
goto 400
4788 write(*,691)
"n= ", n,
"should be positive in TINVSS" 4789 691
format(a8,i5,5x,a30)
4797 write(*,692)
'given matrix A to TINVSS is ill conditioned, or sigular withrank =', nnn, &
4798 'return with no further calculation' 4799 692
format(a,1x,i4,1x,a)
4805 if( dt == 0.0_dp )
goto 920
4806 a(1,1) = 1.0_dp/a(1,1)
4809 end subroutine tinvss
4811 subroutine getknot &
4812 ( ndat, kdeg, xdat, &
4815 integer,
intent(in) :: ndat
4816 integer,
intent(in) :: kdeg
4817 real(DP),
intent(in) :: xdat( ndat )
4819 real(DP),
intent(out) :: qknt( ndat+kdeg )
4825 qknt( i ) = xdat( 1 )
4829 qknt( i+kdeg ) = ( xdat( i )+xdat( i+kdeg ) )*0.50_dp
4833 qknt( ndat+i ) = xdat( ndat )
4838 end subroutine getknot
4840 recursive function fbspl ( ndat, inum, kdeg, qknt, xdat, x ) &
4845 integer,
intent(in) :: ndat
4846 integer,
intent(in) :: inum
4847 integer,
intent(in) :: kdeg
4848 real(DP),
intent(in) :: qknt( ndat+kdeg )
4849 real(DP),
intent(in) :: xdat( ndat )
4850 real(DP),
intent(in) :: x
4853 real(DP) :: bsp1, bsp2
4855 if ( ( inum == 1 .AND. x == xdat( 1 ) ) .OR. &
4856 ( inum == ndat .AND. x == xdat( ndat ) ) )
then 4861 if ( kdeg == 1 )
then 4862 if ( x >= qknt( inum ) .AND. x < qknt( inum+1 ) )
then 4868 if ( qknt( inum+kdeg-1 ) /= qknt( inum ) )
then 4869 bsp1 = ( x-qknt( inum ) ) &
4870 /( qknt( inum+kdeg-1 )-qknt( inum ) ) &
4871 * fbspl( ndat, inum, kdeg-1, qknt, xdat, x )
4875 if ( qknt( inum+kdeg ) /= qknt( inum+1 ) )
then 4876 bsp2 = ( qknt( inum+kdeg )-x ) &
4877 /( qknt( inum+kdeg )-qknt( inum+1 ) ) &
4878 * fbspl( ndat, inum+1, kdeg-1, qknt, xdat, x )
4887 function fpb( ndat, i, kdeg, qknt, xdat, elm, x )
4890 integer :: ndat, i, kdeg
4891 real(DP) :: qknt( ndat+kdeg ), xdat( ndat ), elm( ndat,ndat )
4899 sum = sum + elm( l,i )*fbspl( ndat, l, kdeg, qknt, xdat, x )
4906 subroutine getmatrx &
4907 ( ndat, kdeg, qknt, xdat, &
4912 integer,
intent(in) :: ndat
4913 integer,
intent(in) :: kdeg
4914 real(DP),
intent(in) :: qknt( ndat+kdeg )
4915 real(DP),
intent(in) :: xdat( ndat )
4917 real(DP),
intent(out) :: elm( ndat,ndat )
4921 integer :: iw( 2*ndat ), i, j, inder
4922 real(DP),
parameter :: eps = 0.
4926 elm( i,j ) = fbspl( ndat, j, kdeg, qknt, xdat, xdat( i ) )
4930 call tinvss( ndat, elm, dt, eps, ndat, iw, inder )
4934 end subroutine getmatrx
4936 subroutine getcoef &
4937 ( ndat, kdeg, elm, ydat, &
4940 integer,
intent(in) :: ndat
4941 integer,
intent(in) :: kdeg
4942 real(DP),
intent(in) :: elm( ndat,ndat )
4943 real(DP),
intent(in) :: ydat( ndat )
4945 real(DP),
intent(out) :: coef( ndat )
4954 sum = sum + elm( i,j )*ydat( j )
4961 end subroutine getcoef
4963 function fspline ( ndat, kdeg, coef, qknt, xdat, x )
4965 integer,
intent(in) :: ndat
4966 integer,
intent(in) :: kdeg
4967 real(DP),
intent(in) :: coef( ndat )
4968 real(DP),
intent(in) :: qknt( ndat+kdeg )
4969 real(DP),
intent(in) :: xdat( ndat )
4970 real(DP),
intent(in) :: x
4980 sum = sum + coef( i )*fbspl( ndat, i, kdeg, qknt, xdat, x )
4987 end function fspline
4989 subroutine getcoef2 &
4990 ( mdat, ndat, kdeg, ldeg, &
4991 xdat, ydat, qknt, rknt, zdat, &
4996 integer,
intent(in) :: mdat
4997 integer,
intent(in) :: ndat
4998 integer,
intent(in) :: kdeg
4999 integer,
intent(in) :: ldeg
5000 real(DP),
intent(in) :: xdat( mdat )
5001 real(DP),
intent(in) :: ydat( ndat )
5002 real(DP),
intent(in) :: qknt( mdat+kdeg )
5003 real(DP),
intent(in) :: rknt( ndat+ldeg )
5004 real(DP),
intent(in) :: zdat( mdat,ndat )
5006 real(DP),
intent(out) :: coef( mdat,ndat )
5009 real(DP) :: elmx( mdat,mdat ), elmy( ndat,ndat )
5010 integer :: iw1( 2*mdat ), iw2( 2*ndat )
5011 real(DP) :: beta( mdat,ndat ), sum, dt
5012 real(DP),
parameter :: eps = 0.0_dp
5013 integer :: i, j, k, l, inder
5017 elmx( i,j ) = fbspl( mdat, j, kdeg, qknt, xdat, xdat( i ) )
5020 call tinvss( mdat, elmx, dt, eps, mdat, iw1, inder )
5026 sum = sum + elmx( i,j )*zdat( j,l )
5034 elmy( i,j ) = fbspl( ndat, j, ldeg, rknt, ydat, ydat( i ) )
5037 call tinvss( ndat, elmy, dt, eps, ndat, iw2, inder )
5043 sum = sum + elmy( i,j )*beta( k,j )
5051 end subroutine getcoef2
5054 ( mdat, ndat, kdeg, ldeg, &
5055 coef, qknt, rknt, xdat, ydat, &
5058 integer,
intent(in) :: mdat
5059 integer,
intent(in) :: ndat
5060 integer,
intent(in) :: kdeg
5061 integer,
intent(in) :: ldeg
5062 real(DP),
intent(in) :: coef( mdat,ndat )
5063 real(DP),
intent(in) :: qknt( mdat+kdeg )
5064 real(DP),
intent(in) :: rknt( ndat+ldeg )
5065 real(DP),
intent(in) :: xdat( mdat ), ydat( ndat )
5066 real(DP),
intent(in) :: x, y
5068 real(DP) :: fspline2
5071 real(DP) :: sum, add
5077 add = coef( i,j )*fbspl( mdat, i, kdeg, qknt, xdat, x ) &
5078 *fbspl( ndat, j, ldeg, rknt, ydat, y )
5087 end function fspline2
integer, public is
start point of inner domain: x, local
integer, public comm_datatype
datatype of variable
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K]
real(rp), parameter, public const_psat0
saturate pressure of water vapor at 0C [Pa]
integer, public je
end point of inner domain: y, local
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
logical, public prc_ismaster
master process in local communicator?
module ATMOSPHERE / Saturation adjustment
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(mp_qa), target, public atmos_phy_mp_dens
subroutine mp_suzuki10(ijkmax, ijkmax_cold, ijkmax_warm, index_cold, index_warm, dens, pres, ccn, temp, qvap, ghyd, gaer, evaporate, dt)
subroutine, public atmos_phy_mp_precipitation(flux_rain, flux_snow, DENS, MOMZ, MOMX, MOMY, RHOE, QTRC, vterm, temp, dt)
precipitation transport
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
real(rp), parameter, public const_dwatr
density of water [kg/m3]
real(dp), public time_dtsec_atmos_phy_mp
time interval of physics(microphysics) [sec]
logical, public io_l
output log or not? (this process)
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
real(rp), public cpovr_liq
subroutine, public atmos_phy_mp_suzuki10_setup(MP_TYPE)
Setup.
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
integer, public ke
end point of inner domain: z, local
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
real(rp), parameter, public const_tmelt
real(rp), parameter, public const_dice
density of ice [kg/m3]
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg]
module ATMOSPHERE / Physics Cloud Microphysics - Common
subroutine, public atmos_phy_mp_suzuki10_mixingratio(Qe, QTRC0)
Calculate mixing ratio of each category.
integer, public ia
of x whole cells (local, with HALO)
integer function, public io_get_available_fid()
search & get available file ID
subroutine, public atmos_phy_mp_suzuki10_effectiveradius(Re, QTRC0, DENS0, TEMP0)
Calculate Effective Radius.
integer, public ka
of z whole cells (local, with HALO)
subroutine, public atmos_phy_mp_suzuki10_cloudfraction(cldfrac, QTRC)
Calculate Cloud Fraction.
real(rp), parameter, public const_lhv0
latent heat of vaporizaion at 0C [J/kg]
real(rp), public const_pre00
pressure reference [Pa]
integer, public comm_world
communication world ID
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
real(rp), public const_epsvap
Rdry / Rvap.
real(rp), public lovr_ice
subroutine, public log(type, message)
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
integer, parameter, public prc_masterrank
master process in each communicator
integer, public ks
start point of inner domain: z, local
subroutine, public atmos_phy_mp_suzuki10(DENS, MOMZ, MOMX, MOMY, RHOT, QTRC, CCN, EVAPORATE, SFLX_rain, SFLX_snow)
Cloud Microphysics.
real(rp), parameter, public const_emelt
subroutine, public atmos_phy_mp_negative_fixer(DENS, RHOT, QTRC)
Negative fixer.
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine, public random_get(var)
Get random number.
integer, public kijmax
of computational cells: z*x*y
integer, public ie
end point of inner domain: x, local
real(rp), public const_eps
small number
real(rp), public lovr_liq
module ATMOSPHERE / Thermodynamics
real(rp), dimension(:), allocatable, public grid_cdz
z-length of control volume [m]
subroutine r_collcoag(ijkmax, swgt, temp, gc, dtime)
real(rp), public const_pi
pi
integer, public io_fid_conf
Config file ID.
integer, public io_fid_log
Log file ID.
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K]
character(len=h_short), public const_thermodyn_type
internal energy type
Module Spectran Bin Microphysics.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, parameter, public rp
real(rp), public cpovr_ice
integer, public ja
of y whole cells (local, with HALO)