30 #include "macro_thermodyn.h" 71 saturation_pres2qsat_liq => atmos_saturation_pres2qsat_liq, &
72 saturation_pres2qsat_ice => atmos_saturation_pres2qsat_ice, &
78 thermodyn_temp_pres => atmos_thermodyn_temp_pres, &
79 thermodyn_pott => atmos_thermodyn_pott
101 integer,
private :: QA_MP
116 character(len=3) :: namspc(8) =(/
'Qcl',
'Qic',
'Qip',
'Qid',
'Qis',
'Qig',
'Qih',
'Qae'/)
117 character(len=27) :: lnamspc(8) = &
118 (/
'Mixing ratio of cloud bin', &
119 'Mixing ratio of colum bin', &
120 'Mixing ratio of plate bin', &
121 'Mixing ratio of dendrit bin', &
122 'Mixing ratio of snow bin', &
123 'Mixing ratio of graupel bin', &
124 'Mixing ratio of hail bin', &
125 'Mixing ratio of aerosol bin' /)
127 # include "kernels.h" 136 integer,
private,
parameter :: i_mp_qc = 1
137 integer,
private,
parameter :: i_mp_qp = 2
138 integer,
private,
parameter :: i_mp_qcl = 3
139 integer,
private,
parameter :: i_mp_qd = 4
140 integer,
private,
parameter :: i_mp_qs = 5
141 integer,
private,
parameter :: i_mp_qg = 6
142 integer,
private,
parameter :: i_mp_qh = 7
143 integer,
private :: qs_mp
144 integer,
private :: qe_mp
145 integer,
private :: i_qv
147 logical,
private :: mp_doautoconversion = .true.
148 logical,
private :: mp_doprecipitation = .true.
149 logical,
private :: mp_donegative_fixer = .true.
150 logical,
private :: mp_couple_aerosol = .false.
151 real(RP),
private :: mp_limit_negative = 1.0_rp
155 integer,
parameter :: il = 1
156 integer,
parameter :: ic = 2
157 integer,
parameter :: ip = 3
158 integer,
parameter :: id = 4
159 integer,
parameter :: iss= 5
160 integer,
parameter :: ig = 6
161 integer,
parameter :: ih = 7
165 real(RP),
allocatable :: xctr( : )
166 real(RP),
allocatable :: xbnd( : )
167 real(RP),
allocatable :: radc( : )
168 real(RP),
allocatable :: cctr( :,: )
169 real(RP),
allocatable :: cbnd( :,: )
170 real(RP),
allocatable :: ck( :,:,:,: )
171 real(RP),
allocatable :: vt( :,: )
172 real(RP),
allocatable :: br( :,: )
173 integer,
allocatable :: ifrsl( :,:,: )
175 real(RP),
allocatable :: xactr( : )
176 real(RP),
allocatable :: xabnd( : )
177 real(RP),
allocatable :: rada( : )
179 real(RP),
allocatable :: expxctr( : )
180 real(RP),
allocatable :: expxbnd( : )
181 real(RP),
allocatable :: expxactr( : )
182 real(RP),
allocatable :: expxabnd( : )
183 real(RP),
allocatable :: rexpxctr( : )
184 real(RP),
allocatable :: rexpxbnd( : )
185 real(RP),
allocatable :: rexpxactr( : )
186 real(RP),
allocatable :: rexpxabnd( : )
191 real(RP),
allocatable,
save :: vterm( :,:,:,: )
192 integer,
private,
save :: mp_nstep_sedimentation
193 real(RP),
private,
save :: mp_rnstep_sedimentation
194 real(DP),
private,
save :: mp_dtsec_sedimentation
195 integer,
private,
save :: mp_ntmax_sedimentation= 1
196 real(RP),
private :: flg_thermodyn
197 real(RP),
private :: rtem00
200 real(RP),
parameter :: cldmin = 1.0e-10_rp
201 real(RP),
parameter :: oneovthird = 1.0_rp/3.0_rp
202 real(RP),
parameter :: thirdovforth = 3.0_rp/4.0_rp
203 real(RP),
parameter :: twoovthird = 2.0_rp/3.0_rp
205 real(RP) :: rbnd = 40.e-06_rp
208 real(RP) :: rhoa = 2.25e+03_rp
209 real(RP) :: emaer = 58.0_rp
210 real(RP) :: emwtr = 18.0_rp
211 real(RP) :: rasta = 1.e-08_rp
212 real(RP) :: raend = 1.e-06_rp
213 real(RP) :: r0a = 1.e-07_rp
214 logical :: flg_regeneration=.false.
215 logical :: flg_nucl=.false.
216 logical :: flg_icenucl=.false.
217 logical :: flg_sf_aero =.false.
218 integer,
private,
save :: rndm_flgp = 0
220 real(RP),
allocatable :: marate( : )
221 integer,
allocatable,
save :: ncld( : )
227 character(len=11),
parameter :: fname_micpara=
"micpara.dat" 228 integer(4) :: fid_micpara
231 integer,
allocatable :: blrg( :,: ), bsml( :,: )
233 integer :: mspc, mbin
234 real(RP),
private :: rndm(1,1,1)
237 real(RP),
private :: c_ccn = 100.e+6_rp
238 real(RP),
private :: kappa = 0.462_rp
240 real(RP),
private :: sigma = 7.5e-02_rp
241 real(RP),
private :: vhfct = 2.0_rp
243 real(RP),
parameter :: tcrit = 271.15_rp
244 integer,
private,
allocatable :: kindx( :,: )
247 integer,
parameter :: ndat = 33, icemax = 3
248 integer,
parameter :: kdeg = 4, ldeg = 4, nspc_mk = 7
250 real(DP),
allocatable :: radc_mk( : ), xctr_mk( : ), xbnd_mk( : )
251 real(DP),
allocatable :: cctr_mk( :,: ), cbnd_mk( :,: )
252 real(DP),
allocatable :: ck_mk( :,:,:,: )
253 real(DP),
allocatable :: vt_mk( :,: )
254 real(DP),
allocatable :: br_mk( :,: )
255 real(DP) :: xmss( nspc_mk,ndat ), zcap( nspc_mk,ndat ), vtrm( nspc_mk,ndat )
256 real(DP) :: blkr( nspc_mk,ndat ), blkd( nspc_mk,ndat ), ykrn( nspc_mk,nspc_mk,ndat,ndat )
258 real(DP) :: ywll( ndat,ndat ), ywli( ndat,ndat,icemax ), ywls( ndat,ndat )
259 real(DP) :: ywlg( ndat,ndat ), ywlh( ndat,ndat )
261 real(DP) :: ywil( ndat,ndat,icemax ), ywii( ndat,ndat,icemax,icemax )
262 real(DP) :: ywis( ndat,ndat,icemax ), ywig( ndat,ndat,icemax )
263 real(DP) :: ywih( ndat,ndat,icemax )
265 real(DP) :: ywsl( ndat,ndat ), ywsi( ndat,ndat,icemax ), ywss( ndat,ndat )
266 real(DP) :: ywsg( ndat,ndat ), ywsh( ndat,ndat )
268 real(DP) :: ywgl( ndat,ndat ), ywgi( ndat,ndat,icemax ), ywgs( ndat,ndat )
269 real(DP) :: ywgg( ndat,ndat ), ywgh( ndat,ndat )
271 real(DP) :: ywhl( ndat,ndat ), ywhi( ndat,ndat,icemax ), ywhs( ndat,ndat )
272 real(DP) :: ywhg( ndat,ndat ), ywhh( ndat,ndat )
289 character(len=*),
intent(in) :: mp_type
290 integer,
intent(out) :: qa
291 integer,
intent(out) :: qs
293 namelist / param_bin / &
301 integer :: m, n, ierr
305 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[Cloud Microphysics Tracer] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 306 if(
io_l )
write(
io_fid_log,*)
'*** Tracers for Suzuki (2010) Spectral BIN model' 308 if ( mp_type /=
'SUZUKI10' )
then 309 write(*,*)
'xxx ATMOS_PHY_MP_TYPE is not SUZUKI10. Check!' 321 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 322 elseif( ierr > 0 )
then 323 write(*,*)
'xxx Not appropriate names in namelist PARAM_BIN, Check!' 331 elseif(
iceflg == 1 )
then 334 write(*,*)
"ICEFLG should be 0(warm rain) or 1(mixed rain) check!!" 400 qe_mp = qs + qa_mp - 1
438 real(RP) :: s10_emaer
439 logical :: s10_flag_regene
440 logical :: s10_flag_nucleat
441 logical :: s10_flag_icenucleat
442 logical :: s10_flag_sfaero
443 integer :: s10_rndm_flgp
444 integer :: s10_rndm_mspc
445 integer :: s10_rndm_mbin
447 namelist / param_atmos_phy_mp / &
448 mp_doprecipitation, &
449 mp_donegative_fixer, &
451 mp_ntmax_sedimentation, &
452 mp_doautoconversion, &
455 namelist / param_atmos_phy_mp_suzuki10 / &
463 s10_flag_icenucleat, &
471 real(RP),
parameter :: max_term_vel = 10.0_rp
473 integer :: nnspc, nnbin
474 integer :: nn, mm, mmyu, nnyu
475 integer :: myu, nyu, i, j, k, n, ierr
479 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[Cloud Microphysics] / Categ[ATMOS PHYSICS] / Origin[SCALElib]' 480 if(
io_l )
write(
io_fid_log,*)
'*** Suzuki (2010) Spectral BIN model' 483 allocate( xctr(
nbin ) )
484 allocate( xbnd(
nbin+1 ) )
485 allocate( radc(
nbin ) )
486 allocate( cctr(
nbin,nspc_mk ) )
487 allocate( cbnd(
nbin+1,nspc_mk ) )
488 allocate( ck( nspc_mk,nspc_mk,
nbin,
nbin ) )
489 allocate( vt( nspc_mk,
nbin ) )
490 allocate( br( nspc_mk,
nbin ) )
491 allocate( ifrsl( 2,nspc_mk,nspc_mk ) )
492 allocate( expxctr(
nbin ) )
493 allocate( expxbnd(
nbin+1 ) )
494 allocate( rexpxctr(
nbin ) )
495 allocate( rexpxbnd(
nbin+1 ) )
496 if (
nccn /= 0 )
then 497 allocate( xactr(
nccn ) )
498 allocate( xabnd(
nccn+1 ) )
499 allocate( rada(
nccn ) )
500 allocate( expxactr(
nccn ) )
501 allocate( expxabnd(
nccn+1 ) )
502 allocate( rexpxactr(
nccn ) )
503 allocate( rexpxabnd(
nccn+1 ) )
507 mspc = nspc_mk*nspc_mk
514 s10_flag_regene = flg_regeneration
515 s10_flag_nucleat = flg_nucl
516 s10_flag_icenucleat = flg_icenucl
517 s10_flag_sfaero = flg_sf_aero
518 s10_rndm_flgp = rndm_flgp
523 read(
io_fid_conf,nml=param_atmos_phy_mp,iostat=ierr)
526 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 527 elseif( ierr > 0 )
then 528 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_MP, Check!' 534 read(
io_fid_conf,nml=param_atmos_phy_mp_suzuki10,iostat=ierr)
537 if(
io_l )
write(
io_fid_log,*)
'*** Not found namelist. Default used.' 538 elseif( ierr > 0 )
then 539 write(*,*)
'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_MP_SUZUKI10, Check!' 544 if (
nspc /= 1 .AND.
nspc /= 7 )
then 545 write(*,*)
'xxx nspc should be set as 1(warm rain) or 7(mixed phase) check!' 554 flg_regeneration = s10_flag_regene
555 flg_nucl = s10_flag_nucleat
556 flg_icenucl = s10_flag_icenucleat
557 flg_sf_aero = s10_flag_sfaero
558 rndm_flgp = s10_rndm_flgp
567 open ( fid_micpara, file = fname_micpara, form =
'formatted', status =
'old', iostat=ierr )
570 if ( ierr == 0 )
then 572 read( fid_micpara,* ) nnspc, nnbin
574 if ( nnbin /=
nbin )
then 575 write(*,*)
'xxx nbin in inc_tracer and nbin in micpara.dat is different check!' 582 read( fid_micpara,* ) nn, xctr( n ), radc( n )
584 "Radius of ", n,
"th cloud bin (bin center)= ", radc( n ) ,
"[m]" 587 read( fid_micpara,* ) nn, xbnd( n )
589 read( fid_micpara,* ) dxmic
596 read( fid_micpara,* ) mmyu, nn, cctr( n,myu )
600 read( fid_micpara,* ) mmyu, nn, cbnd( n,myu )
609 read( fid_micpara,* ) mmyu, nnyu, mm, nn, ck( myu,nyu,i,j )
618 read( fid_micpara,* ) mmyu, nn, vt( myu,n )
625 read( fid_micpara,* ) mmyu, nn, br( myu,n )
629 close ( fid_micpara )
639 open ( fid_micpara, file = fname_micpara, form =
'formatted', status =
'old', iostat=ierr )
641 read( fid_micpara,* ) nnspc, nnbin
643 if ( nnbin /=
nbin )
then 644 write(*,*)
'xxx nbin in inc_tracer and nbin in micpara.dat is different check!' 651 read( fid_micpara,* ) nn, xctr( n ), radc( n )
653 "Radius of ", n,
"th cloud bin (bin center)= ", radc( n ) ,
"[m]" 656 read( fid_micpara,* ) nn, xbnd( n )
658 read( fid_micpara,* ) dxmic
665 read( fid_micpara,* ) mmyu, nn, cctr( n,myu )
669 read( fid_micpara,* ) mmyu, nn, cbnd( n,myu )
678 read( fid_micpara,* ) mmyu, nnyu, mm, nn, ck( myu,nyu,i,j )
687 read( fid_micpara,* ) mmyu, nn, vt( myu,n )
694 read( fid_micpara,* ) mmyu, nn, br( myu,n )
698 close ( fid_micpara )
715 if (
nccn /= 0 )
then 717 allocate ( ncld( 1:
nccn ) )
718 xasta = log( rhoa*4.0_rp/3.0_rp*pi * ( rasta )**3 )
719 xaend = log( rhoa*4.0_rp/3.0_rp*pi * ( raend )**3 )
721 dxaer = ( xaend-xasta )/
nccn 724 xabnd( n ) = xasta + dxaer*( n-1 )
727 xactr( n ) = ( xabnd( n )+xabnd( n+1 ) )*0.50_rp
728 rada( n ) = ( exp( xactr( n ) )*thirdovforth/pi/rhoa )**( oneovthird )
730 "Radius of ", n,
"th aerosol bin (bin center)= ", rada( n ) ,
"[m]" 733 if ( flg_sf_aero )
then 734 write(*,*)
"flg_sf_aero=true is not supported stop!! " 772 if( radc( n ) > rbnd )
then 777 if(
io_l )
write(
io_fid_log,
'(A,ES15.7,A)')
'*** Radius between cloud and rain is ', radc(nbnd),
'[m]' 780 if ( rndm_flgp > 0 )
then 781 call random_setup(
ia*
ja*
ka )
784 if ( mp_couple_aerosol .AND.
nccn /=0 )
then 785 write(*,*)
'xxx nccn should be 0 when MP_couple_aerosol = .true. !! stop' 789 if (
nccn /= 0 )
then 791 expxactr( n ) = exp( xactr( n ) )
792 rexpxactr( n ) = 1.0_rp / exp( xactr( n ) )
795 expxabnd( n ) = exp( xabnd( n ) )
796 rexpxabnd( n ) = 1.0_rp / exp( xabnd( n ) )
800 allocate( vterm(
ka,
ia,
ja,qa_mp-1) )
801 vterm(:,:,:,:) = 0.0_rp
804 vterm(:,:,:,(myu-1)*
nbin+n) = -vt( myu,n )
808 expxctr( n ) = exp( xctr( n ) )
809 rexpxctr( n ) = 1.0_rp / exp( xctr( n ) )
812 expxbnd( n ) = exp( xbnd( n ) )
813 rexpxbnd( n ) = 1.0_rp / exp( xbnd( n ) )
817 call getrule( ifrsl,kindx )
819 if ( const_thermodyn_type ==
'EXACT' )
then 820 flg_thermodyn = 1.0_rp
821 elseif( const_thermodyn_type ==
'SIMPLE' )
then 822 flg_thermodyn = 0.0_rp
824 rtem00 = 1.0_rp / const_tem00
827 mp_ntmax_sedimentation = max( mp_ntmax_sedimentation, nstep_max )
829 mp_nstep_sedimentation = mp_ntmax_sedimentation
830 mp_rnstep_sedimentation = 1.0_rp /
real(mp_ntmax_sedimentation,kind=
rp)
834 if(
io_l )
write(
io_fid_log,*)
'*** Timestep of sedimentation is divided into : ', mp_ntmax_sedimentation,
' step' 835 if(
io_l )
write(
io_fid_log,*)
'*** DT of sedimentation is : ', mp_dtsec_sedimentation,
'[s]' 863 thermodyn_rhoe => atmos_thermodyn_rhoe, &
864 thermodyn_rhot => atmos_thermodyn_rhot, &
865 thermodyn_temp_pres_e => atmos_thermodyn_temp_pres_e
873 real(RP),
intent(inout) :: dens (
ka,
ia,
ja)
874 real(RP),
intent(inout) :: momz (
ka,
ia,
ja)
875 real(RP),
intent(inout) :: momx (
ka,
ia,
ja)
876 real(RP),
intent(inout) :: momy (
ka,
ia,
ja)
877 real(RP),
intent(inout) :: rhot (
ka,
ia,
ja)
878 real(RP),
intent(inout) :: qtrc (
ka,
ia,
ja,
qa)
879 real(RP),
intent(in) :: ccn (
ka,
ia,
ja)
880 real(RP),
intent(out) :: evaporate(
ka,
ia,
ja)
881 real(RP),
intent(out) :: sflx_rain(
ia,
ja)
882 real(RP),
intent(out) :: sflx_snow(
ia,
ja)
884 real(RP) :: rhoe (
ka,
ia,
ja)
885 real(RP) :: pott (
ka,
ia,
ja)
886 real(RP) :: temp (
ka,
ia,
ja)
887 real(RP) :: pres (
ka,
ia,
ja)
888 real(RP) :: qsat (
ka,
ia,
ja)
889 real(RP) :: ssliq(
ka,
ia,
ja)
890 real(RP) :: ssice(
ka,
ia,
ja)
892 integer :: ijk_index (
kijmax,3)
893 integer :: index_cld (
kijmax)
894 integer :: index_cold(
kijmax)
895 integer :: index_warm(
kijmax)
896 integer :: ijkcount, ijkcount_cold, ijkcount_warm
897 integer :: ijk, indirect
899 real(RP) :: dens_ijk(
kijmax)
900 real(RP) :: pres_ijk(
kijmax)
901 real(RP) :: temp_ijk(
kijmax)
902 real(RP) :: qvap_ijk(
kijmax)
903 real(RP) :: ccn_ijk(
kijmax)
904 real(RP) :: evaporate_ijk(
kijmax)
917 real(RP) :: pflux (
ka,
ia,
ja,qa_mp-1)
918 real(RP) :: flx_hydro(
ka,
ia,
ja,qa_mp-1)
919 real(RP) :: qhyd_out (
ka,
ia,
ja,6)
922 integer :: k, i, j, m, n, iq
925 if (
nspc == 1 )
then 926 if(
io_l )
write(
io_fid_log,*)
'*** Atmos physics step: Cloud microphysics(SBM Liquid water only)' 927 elseif(
nspc > 1 )
then 928 if(
io_l )
write(
io_fid_log,*)
'*** Atmos physics step: Cloud microphysics(SBM Mixed phase)' 931 if ( mp_donegative_fixer )
then 932 call mp_negative_fixer( dens(:,:,:), &
945 evaporate(k,i,j) = 0.0_rp
962 call thermodyn_temp_pres( temp(:,:,:), &
971 call saturation_pres2qsat_liq( qsat(:,:,:), &
978 ssliq(k,i,j) = qtrc(k,i,j,i_qv) / qsat(k,i,j) - 1.0_rp
983 if (
nspc == 1 )
then 984 ssice(:,:,:) = 0.0_rp
986 call saturation_pres2qsat_ice( qsat(:,:,:), &
993 ssice(k,i,j) = qtrc(k,i,j,i_qv) / qsat(k,i,j) - 1.0_rp
1032 countbin = qs_mp + 1
1035 cldsum = cldsum + qtrc(k,i,j,countbin) * dens(k,i,j) / dxmic
1036 countbin = countbin + 1
1040 if ( cldsum > cldmin &
1041 .OR. ssliq(k,i,j) > 0.0_rp &
1042 .OR. ssice(k,i,j) > 0.0_rp )
then 1044 ijkcount = ijkcount + 1
1046 index_cld(ijkcount) = ijk
1048 dens_ijk(ijkcount) = dens(k,i,j)
1049 pres_ijk(ijkcount) = pres(k,i,j)
1050 temp_ijk(ijkcount) = temp(k,i,j)
1051 ccn_ijk(ijkcount) = ccn(k,i,j)
1052 qvap_ijk(ijkcount) = qtrc(k,i,j,i_qv)
1054 countbin = qs_mp + 1
1057 ghyd_ijk(n,m,ijkcount) = qtrc(k,i,j,countbin) * dens(k,i,j) / dxmic
1058 countbin = countbin + 1
1063 gaer_ijk(n,ijkcount) = qtrc(k,i,j,countbin) * dens(k,i,j) / dxaer
1064 countbin = countbin + 1
1068 ijkcount_cold = ijkcount_cold + 1
1069 index_cold(ijkcount_cold) = ijkcount
1071 ijkcount_warm = ijkcount_warm + 1
1072 index_warm(ijkcount_warm) = ijkcount
1114 if ( ijkcount > 0 )
then 1121 index_cold( 1:ijkcount), &
1122 index_warm( 1:ijkcount), &
1123 dens_ijk( 1:ijkcount), &
1124 pres_ijk( 1:ijkcount), &
1125 ccn_ijk( 1:ijkcount), &
1126 temp_ijk( 1:ijkcount), &
1127 qvap_ijk( 1:ijkcount), &
1128 ghyd_ijk(:,:,1:ijkcount), &
1129 gaer_ijk(:, 1:ijkcount), &
1130 evaporate_ijk( 1:ijkcount), &
1180 do ijk = 1, ijkcount
1181 indirect = index_cld(ijk)
1182 i = ijk_index(indirect,1)
1183 j = ijk_index(indirect,2)
1184 k = ijk_index(indirect,3)
1186 temp(k,i,j) = temp_ijk(ijk)
1187 qtrc(k,i,j,i_qv) = qvap_ijk(ijk)
1188 evaporate(k,i,j) = evaporate_ijk(ijk) / dt
1190 countbin = qs_mp + 1
1193 qtrc(k,i,j,countbin) = ghyd_ijk(n,m,ijk) / dens(k,i,j) * dxmic
1194 countbin = countbin + 1
1199 qtrc(k,i,j,countbin) = gaer_ijk(n,ijk) / dens(k,i,j) * dxaer
1200 countbin = countbin + 1
1207 countbin = qs_mp + 1
1210 if ( qtrc(k,i,j,countbin) < eps )
then 1211 qtrc(k,i,j,countbin) = 0.0_rp
1213 countbin = countbin + 1
1220 call thermodyn_pott( pott(:,:,:), &
1231 rhot(k,i,j) = pott(k,i,j) * dens(k,i,j)
1253 flx_hydro(:,:,:,:) = 0.0_rp
1255 if ( mp_doprecipitation )
then 1257 call thermodyn_rhoe( rhoe(:,:,:), &
1264 do step = 1, mp_nstep_sedimentation
1266 call thermodyn_temp_pres_e( temp(:,:,:), &
1275 call mp_precipitation( qa_mp, &
1287 mp_dtsec_sedimentation )
1293 flx_hydro(k,i,j,iq) = flx_hydro(k,i,j,iq) + pflux(k,i,j,iq) * mp_rnstep_sedimentation
1301 call thermodyn_rhot( rhot(:,:,:), &
1309 sflx_rain(:,:) = 0.0_rp
1310 sflx_snow(:,:) = 0.0_rp
1318 sflx_rain(i,j) = sflx_rain(i,j) - flx_hydro(
ks-1,i,j,iq)
1323 if (
nspc > 1 )
then 1330 sflx_snow(i,j) = sflx_snow(i,j) - flx_hydro(
ks-1,i,j,iq)
1339 if ( mp_donegative_fixer )
then 1340 call mp_negative_fixer( dens(:,:,:), &
1347 qhyd_out(:,:,:,:) = 0.0_rp
1355 qhyd_out(k,i,j,1) = qhyd_out(k,i,j,1) + qtrc(k,i,j,iq)
1367 qhyd_out(k,i,j,2) = qhyd_out(k,i,j,2) + qtrc(k,i,j,iq)
1373 call hist_in( qhyd_out(:,:,:,1),
'QC',
'Mixing ratio of QC',
'kg/kg' )
1374 call hist_in( qhyd_out(:,:,:,2),
'QR',
'Mixing ratio of QR',
'kg/kg' )
1376 if (
nspc > 1 )
then 1379 iq = qs_mp + (m-1)*
nbin + n
1384 qhyd_out(k,i,j,3) = qhyd_out(k,i,j,3) + qtrc(k,i,j,iq)
1392 iq = qs_mp + (iss-1)*
nbin + n
1397 qhyd_out(k,i,j,4) = qhyd_out(k,i,j,4) + qtrc(k,i,j,iq)
1404 iq = qs_mp + (ig-1)*
nbin + n
1409 qhyd_out(k,i,j,5) = qhyd_out(k,i,j,5) + qtrc(k,i,j,iq)
1416 iq = qs_mp + (ih-1)*
nbin + n
1421 qhyd_out(k,i,j,6) = qhyd_out(k,i,j,6) + qtrc(k,i,j,iq)
1427 call hist_in( qhyd_out(:,:,:,3),
'QI',
'Mixing ratio of QI',
'kg/kg' )
1428 call hist_in( qhyd_out(:,:,:,4),
'QS',
'Mixing ratio of QS',
'kg/kg' )
1429 call hist_in( qhyd_out(:,:,:,5),
'QG',
'Mixing ratio of QG',
'kg/kg' )
1430 call hist_in( qhyd_out(:,:,:,6),
'QH',
'Mixing ratio of QH',
'kg/kg' )
1454 integer,
intent(in) :: ijkmax
1455 integer,
intent(in) :: ijkmax_cold
1456 integer,
intent(in) :: ijkmax_warm
1457 integer ,
intent(in) :: index_cold(ijkmax)
1458 integer ,
intent(in) :: index_warm(ijkmax)
1459 real(RP),
intent(in) :: dens (ijkmax)
1460 real(RP),
intent(in) :: pres (ijkmax)
1461 real(RP),
intent(in) :: ccn (ijkmax)
1462 real(RP),
intent(inout) :: temp (ijkmax)
1463 real(RP),
intent(inout) :: qvap (ijkmax)
1464 real(RP),
intent(inout) :: ghyd (nbin,nspc,ijkmax)
1465 real(RP),
intent(inout) :: gaer (nccn1, ijkmax)
1466 real(RP),
intent(out) :: evaporate (ijkmax)
1467 real(DP),
intent(in) :: dt
1470 if (
nccn /= 0 )
then 1471 if ( nspc == 1 )
then 1475 call nucleata( ijkmax, &
1485 call cndevpsbla( ijkmax, &
1495 if ( mp_doautoconversion )
then 1497 call collmain( ijkmax, &
1503 elseif( nspc > 1 )
then 1507 call nucleata( ijkmax, &
1517 call freezing( ijkmax, &
1535 call melting( ijkmax, &
1544 call cndevpsbla( ijkmax, &
1554 if ( mp_doautoconversion )
then 1556 call collmainf( ijkmax, &
1564 elseif(
nccn == 0 )
then 1566 if ( nspc == 1 )
then 1570 call nucleat( ijkmax, &
1580 call cndevpsbl( ijkmax, &
1589 if ( mp_doautoconversion )
then 1591 call collmain( ijkmax, &
1597 elseif( nspc > 1 )
then 1601 call nucleat( ijkmax, &
1611 call freezing( ijkmax, &
1619 call ice_nucleat( ijkmax, &
1629 call melting( ijkmax, &
1638 call cndevpsbl( ijkmax, &
1647 if ( mp_doautoconversion )
then 1649 call collmainf( ijkmax, &
1663 subroutine nucleat( &
1674 integer,
intent(in) :: ijkmax
1675 real(RP),
intent(in) :: dens(ijkmax)
1676 real(RP),
intent(in) :: pres(ijkmax)
1677 real(RP),
intent(in) :: ccn(ijkmax)
1678 real(RP),
intent(inout) :: temp(ijkmax)
1679 real(RP),
intent(inout) :: qvap(ijkmax)
1680 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1681 real(DP),
intent(in) :: dtime
1683 real(RP) :: ssliq(ijkmax)
1684 real(RP) :: qlevp(ijkmax)
1689 real(RP) :: sumnum(ijkmax)
1690 real(RP) :: gcn( nbin,ijkmax )
1696 if( mp_couple_aerosol )
then 1699 dmp = ccn(ijk) * expxctr( 1 )
1700 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1701 gc( 1,il,ijk ) = gc( 1,il,ijk ) + dmp/dxmic
1702 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1703 qvap(ijk) = max( qvap(ijk),0.0_rp )
1704 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp(ijk)/cp
1712 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1715 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1716 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1717 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
1724 if ( ssliq(ijk) > 0.0_rp )
then 1729 gcn( n,ijk ) = gc( n,il,ijk )*rexpxctr( n )
1733 sumnum(ijk) = sumnum(ijk) + gcn( n,ijk )*dxmic
1735 n_c = c_ccn * ( ssliq(ijk) * 1.e+2_rp )**( kappa )
1736 if ( n_c > sumnum(ijk) )
then 1737 dmp = ( n_c - sumnum(ijk) ) * expxctr( 1 )
1738 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1739 gc( 1,il,ijk ) = gc( 1,il,ijk ) + dmp/dxmic
1740 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1741 qvap(ijk) = max( qvap(ijk),0.0_rp )
1742 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp(ijk)/cp
1753 end subroutine nucleat
1756 subroutine nucleata( &
1767 integer,
intent(in) :: ijkmax
1768 real(RP),
intent(in) :: dens(ijkmax)
1769 real(RP),
intent(in) :: pres(ijkmax)
1770 real(RP),
intent(inout) :: temp(ijkmax)
1771 real(RP),
intent(inout) :: qvap(ijkmax)
1772 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1773 real(RP),
intent(inout) :: ga (nccn ,ijkmax)
1774 real(DP),
intent(in) :: dtime
1776 real(RP) :: gan( nccn )
1777 real(RP) :: ssliq, ssice, qlevp
1778 real(RP) :: acoef, bcoef
1781 real(RP) :: ractr, rcld, xcld, part, dmp
1782 integer :: n, nc, ncrit
1795 qlevp = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
1798 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1799 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1801 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1802 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1803 ssliq = qvap(ijk)/ssliq-1.0_rp
1804 ssice = qvap(ijk)/ssice-1.0_rp
1806 if ( ssliq <= 0.0_rp ) cycle
1810 gan( n ) = ga( n,ijk )*rexpxactr( n )
1813 acoef = 2.0_rp*sigma/rvap/rhow/temp(ijk)
1814 bcoef = vhfct* rhoa/rhow * emwtr/emaer
1818 ractr = ( expxactr( n )*thirdovforth/pi/rhoa )**( oneovthird )
1819 rcld = sqrt( 3.0_rp*bcoef*ractr*ractr*ractr / acoef )
1820 xcld = log( rhow * 4.0_rp*pi*oneovthird*rcld*rcld*rcld )
1821 if ( flg_nucl )
then 1824 ncld( n ) = int( ( xcld-xctr( 1 ) )/dxmic ) + 1
1825 ncld( n ) = min( max( ncld( n ),1 ),nbin )
1833 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
1834 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1836 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
1837 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
1838 ssliq = qvap(ijk)/ssliq-1.0_rp
1839 ssice = qvap(ijk)/ssice-1.0_rp
1841 if ( ssliq <= 0.0_rp )
exit 1843 acoef = 2.0_rp*sigma/rvap/rhow/temp(ijk)
1844 rcrit = acoef*oneovthird * ( 4.0_rp/bcoef )**( oneovthird ) / ssliq**( twoovthird )
1845 xcrit = log( rhoa * 4.0_rp*pi*oneovthird * rcrit*rcrit*rcrit )
1846 ncrit = int( ( xcrit-xabnd( 1 ) )/dxaer ) + 1
1848 if ( n == ncrit )
then 1849 part = ( xabnd( ncrit+1 )-xcrit )/dxaer
1850 elseif ( n > ncrit )
then 1858 dmp = part*gan( n )*dxaer*expxctr( nc )
1859 dmp = min( dmp,qvap(ijk)*dens(ijk) )
1860 gc( nc,il,ijk ) = gc( nc,il,ijk ) + dmp/dxmic
1861 gan( n ) = gan( n ) - dmp/dxaer*rexpxctr( nc )
1862 gan( n ) = max( gan( n ), 0.0_rp )
1863 qvap(ijk) = qvap(ijk) - dmp/dens(ijk)
1864 qvap(ijk) = max( qvap(ijk),0.0_rp )
1865 temp(ijk) = temp(ijk) + dmp/dens(ijk)*qlevp/cp
1870 ga( n,ijk ) = gan( n )*expxactr( n )
1878 end subroutine nucleata
1881 subroutine cndevpsbl( &
1888 evaporate, & ! [OUT]
1892 integer,
intent(in) :: ijkmax
1893 real(RP),
intent(in) :: dens(ijkmax)
1894 real(RP),
intent(in) :: pres(ijkmax)
1895 real(RP),
intent(inout) :: temp(ijkmax)
1896 real(RP),
intent(inout) :: qvap(ijkmax)
1897 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1898 real(RP),
intent(out) :: evaporate(ijkmax)
1899 real(DP),
intent(in) :: dtime
1902 call liqphase( ijkmax, &
1912 call icephase( ijkmax, &
1920 call mixphase( ijkmax, &
1930 end subroutine cndevpsbl
1933 subroutine cndevpsbla( &
1945 integer,
intent(in) :: ijkmax
1946 real(RP),
intent(in) :: dens(ijkmax)
1947 real(RP),
intent(in) :: pres(ijkmax)
1948 real(RP),
intent(inout) :: temp(ijkmax)
1949 real(RP),
intent(inout) :: qvap(ijkmax)
1950 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
1951 real(RP),
intent(inout) :: ga (nccn ,ijkmax)
1952 real(RP),
intent(out) :: evaporate(ijkmax)
1953 real(DP),
intent(in) :: dtime
1956 call liqphase( ijkmax, &
1966 if ( flg_regeneration )
then 1967 call faero( ijkmax, &
1974 call icephase( ijkmax, &
1982 call mixphase( ijkmax, &
1992 end subroutine cndevpsbla
1995 subroutine liqphase( &
2006 integer,
intent(in) :: ijkmax
2007 real(RP),
intent(in) :: dens(ijkmax)
2008 real(RP),
intent(in) :: pres(ijkmax)
2009 real(RP),
intent(inout) :: temp(ijkmax)
2010 real(RP),
intent(inout) :: qvap(ijkmax)
2011 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2012 real(RP),
intent(out) :: regene_gcn(ijkmax)
2013 real(DP),
intent(in) :: dtime
2015 integer :: n, myu, ncount
2016 integer :: nloop(ijkmax)
2017 real(RP) :: gclold(ijkmax)
2018 real(RP) :: gclnew(ijkmax)
2019 real(RP) :: cndmss(ijkmax)
2020 real(RP) :: dtcnd(ijkmax)
2021 real(RP) :: gtliq(ijkmax)
2022 real(RP) :: qlevp(ijkmax)
2023 real(RP) :: cefliq, a, sliqtnd
2024 real(RP) :: sumliq(ijkmax), umax(ijkmax)
2025 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
2026 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
2028 real(RP),
parameter :: cflfct = 0.50_rp
2030 integer :: iflg( nspc,ijkmax )
2031 real(RP) :: csum( nspc,ijkmax )
2032 real(RP) :: f1, f2, emu, cefd, cefk, festl, psat
2033 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
2034 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
2035 real(RP) :: zerosw, qvtmp
2036 integer :: ijk, nn, mm, loopflg(ijkmax)
2039 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
2040 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
2041 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
2042 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
2043 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
2044 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
2045 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
2046 real(RP) :: cmins, cplus
2057 csum( il,ijk ) = csum( il,ijk ) + gc( n,il,ijk )*dxmic
2060 if( csum( il,ijk ) > cldmin ) iflg( il,ijk ) = 1
2069 gclold(ijk) = gclold(ijk) + gc( n,il,ijk ) * dxmic
2074 gcn( n,il,ijk ) = gc( n,il,ijk ) * rexpxctr( n )
2076 gcn( -1,il,ijk ) = 0.0_rp
2077 gcn( 0,il,ijk ) = 0.0_rp
2078 gcn( nbin+1,il,ijk ) = 0.0_rp
2079 gcn( nbin+2,il,ijk ) = 0.0_rp
2082 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2085 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2086 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2088 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2089 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2090 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2091 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2093 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2094 cefd = emu/dens(ijk)
2097 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2098 f1 = rvap*temp(ijk)/festl/cefd
2099 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2100 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2102 umax(ijk) = cbnd( 1,il )*rexpxbnd( 1 )*gtliq(ijk)*abs( ssliq(ijk) )
2103 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
2104 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
2105 dtcnd(ijk) = dtime / nloop(ijk)
2107 nloop(ijk) = nloop(ijk) * iflg( il,ijk )
2109 nloopmax = maxval(nloop,1)
2112 regene_gcn(:) = 0.0_rp
2115 do ncount = 1, nloopmax
2118 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
2123 do nn = 1, loopflg(ijk)
2126 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2129 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2130 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2132 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2133 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2134 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2135 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2137 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2138 cefd = emu/dens(ijk)
2140 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2141 f1 = rvap*temp(ijk)/festl/cefd
2142 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2143 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2145 sumliq(ijk) = 0.0_rp
2148 sumliq(ijk) = sumliq(ijk) + gcn( n,il,ijk )*cctr( n,il )*dxmic
2156 do nn = 1, loopflg(ijk)
2159 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
2160 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
2161 cefliq = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)*qlevp(ijk)/cp/rvap/temp(ijk)/temp(ijk) )
2162 a = - cefliq*sumliq(ijk)*gtliq(ijk)/dens(ijk)
2163 a = a + eps * ( 1.0_rp - zerosw )
2165 sliqtnd = zerosw * &
2166 ( ssliq(ijk) * ( exp( a*dtcnd(ijk) )-1.0_rp )/( a*dtcnd(ijk) ) &
2167 * ( 0.5_rp + sign( 0.5_rp,abs(a*dtcnd(ijk)-0.1_rp) ) ) &
2169 * ( 0.5_rp - sign( 0.5_rp,abs(a*dtcnd(ijk)-0.1_rp) ) ) &
2171 + ssliq(ijk) * ( 1.0_rp - zerosw )
2174 do mm = 1, iflg( il,ijk )
2177 uadv( n,il,ijk ) = cbnd( n,il )*rexpxbnd( n )*gtliq(ijk)*sliqtnd
2179 uadv( 0 ,il,ijk ) = 0.0_rp
2180 uadv( nbin+2,il,ijk ) = 0.0_rp
2193 do nn = 1, loopflg(ijk)
2195 do mm = 1, iflg( myu,ijk )
2197 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
2205 do nn = 1, loopflg(ijk)
2207 do mm = 1, iflg( myu,ijk )
2209 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
2210 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
2211 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
2219 do nn = 1, loopflg(ijk)
2221 do mm = 1, iflg( myu,ijk )
2223 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
2225 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
2226 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
2227 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
2229 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
2237 do nn = 1, loopflg(ijk)
2239 do mm = 1, iflg( myu,ijk )
2241 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
2243 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
2244 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
2245 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
2247 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
2255 do nn = 1, loopflg(ijk)
2257 do mm = 1, iflg( myu,ijk )
2259 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
2260 + acoef(2,n,myu,ijk) * 2.0_rp
2262 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
2270 do nn = 1, loopflg(ijk)
2272 do mm = 1, iflg( myu,ijk )
2274 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
2275 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
2283 do nn = 1, loopflg(ijk)
2285 do mm = 1, iflg( myu,ijk )
2286 regene_gcn(ijk) = regene_gcn(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
2287 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk) + eps )
2294 do nn = 1, loopflg(ijk)
2296 do mm = 1, iflg( myu,ijk )
2298 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
2309 do nn = 1, loopflg(ijk)
2312 gclnew(ijk) = 0.0_rp
2315 gclnew(ijk) = gclnew(ijk) + gcn( n,il,ijk )*expxctr( n )
2320 gclnew(ijk) = gclnew(ijk)*dxmic
2323 cndmss(ijk) = gclnew(ijk) - gclold(ijk)
2324 qvap(ijk) = qvap(ijk) - cndmss(ijk)/dens(ijk)
2325 temp(ijk) = temp(ijk) + cndmss(ijk)/dens(ijk)*qlevp(ijk)/cp
2327 gclold(ijk) = gclnew(ijk)
2339 gc( n,il,ijk ) = gcn( n,il,ijk )*expxctr( n )
2346 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2348 if ( gc( n,il,ijk ) < 0.0_rp )
then 2349 cndmss(ijk) = -gc( n,il,ijk )
2350 gc( n,il,ijk ) = 0.0_rp
2351 qvap(ijk) = qvap(ijk) + cndmss(ijk)/dens(ijk)
2352 temp(ijk) = temp(ijk) - cndmss(ijk)/dens(ijk)*qlevp(ijk)/cp
2360 end subroutine liqphase
2363 subroutine icephase( &
2373 integer,
intent(in) :: ijkmax
2374 real(RP),
intent(in) :: dens(ijkmax)
2375 real(RP),
intent(in) :: pres(ijkmax)
2376 real(RP),
intent(inout) :: temp(ijkmax)
2377 real(RP),
intent(inout) :: qvap(ijkmax)
2378 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2379 real(DP),
intent(in) :: dtime
2381 integer :: myu, n, ncount
2382 integer :: nloop(ijkmax)
2383 real(RP) :: gciold(ijkmax), gcinew(ijkmax)
2384 real(RP) :: dtcnd(ijkmax)
2385 real(RP) :: sblmss(ijkmax)
2386 real(RP) :: gtice(ijkmax), umax(ijkmax)
2387 real(RP) :: qlsbl(ijkmax)
2388 real(RP) :: cefice, d, uval, sicetnd
2389 real(RP) :: sumice(ijkmax)
2390 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
2391 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
2392 real(RP),
parameter :: cflfct = 0.50_rp
2393 real(RP) :: dumm_regene(ijkmax)
2394 integer :: iflg( nspc,ijkmax )
2395 real(RP) :: csum( nspc,ijkmax )
2396 real(RP) :: f1, f2, emu, cefd, cefk, festi, psat
2397 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
2398 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
2399 integer :: ijk, mm, nn, loopflg(ijkmax)
2400 real(RP) :: zerosw, qvtmp
2404 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
2405 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
2406 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
2407 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
2408 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
2409 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
2410 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
2411 real(RP) :: cmins, cplus
2418 csum( :,: ) = 0.0_rp
2423 csum( myu,ijk ) = csum( myu,ijk ) + gc( n,myu,ijk )*dxmic
2428 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
2440 gciold(ijk) = gciold(ijk) + gc( n,myu,ijk )*dxmic
2447 gcn( n,myu,ijk ) = gc( n,myu,ijk ) * rexpxctr( n )
2449 gcn( -1,myu,ijk ) = 0.0_rp
2450 gcn( 0,myu,ijk ) = 0.0_rp
2451 gcn( nbin+1,myu,ijk ) = 0.0_rp
2452 gcn( nbin+2,myu,ijk ) = 0.0_rp
2456 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2459 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2460 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2462 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2463 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2464 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2465 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2467 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2468 cefd = emu/dens(ijk)
2470 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2471 f1 = rvap*temp(ijk)/festi/cefd
2472 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2473 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2477 uval = cbnd( 1,myu )*rexpxbnd( 1 )*gtice(ijk)*abs( ssice(ijk) )
2478 umax(ijk) = max( umax(ijk),uval )
2481 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
2482 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
2483 dtcnd(ijk) = dtime/nloop(ijk)
2485 nloop(ijk) = nloop(ijk) * maxval( iflg( 2:nspc,ijk ) )
2488 nloopmax = maxval(nloop,1)
2492 do ncount = 1, nloopmax
2495 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
2500 do nn = 1, loopflg(ijk)
2502 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2505 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2506 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2508 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2509 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2510 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2511 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2513 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2514 cefd = emu/dens(ijk)
2516 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2517 f1 = rvap*temp(ijk)/festi/cefd
2518 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2519 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2521 sumice(ijk) = 0.0_rp
2524 sumice(ijk) = sumice(ijk) + gcn( n,myu,ijk )*cctr( n,myu )*dxmic
2533 do nn = 1, loopflg(ijk)
2536 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
2537 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
2539 cefice = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)*qlsbl(ijk)/cp/rvap/temp(ijk)/temp(ijk) )
2540 d = - cefice*sumice(ijk)*gtice(ijk)/dens(ijk)
2541 d = d + eps * ( 1.0_rp - zerosw )
2543 sicetnd = zerosw * &
2544 ( ssice(ijk) * ( exp( d*dtcnd(ijk) )-1.0_rp )/( d*dtcnd(ijk) ) &
2545 * ( 0.5_rp + sign( 0.5_rp,abs(d*dtcnd(ijk)-0.1_rp) ) ) &
2547 * ( 0.5_rp - sign( 0.5_rp,abs(d*dtcnd(ijk)-0.1_rp) ) ) &
2549 + ssice(ijk) * ( 1.0_rp - zerosw )
2553 do mm = 1, iflg( myu,ijk )
2556 uadv( n,myu,ijk ) = cbnd( n,myu )*rexpxbnd( n )*gtice(ijk)*sicetnd
2558 uadv( 0, myu,ijk ) = 0.0_rp
2559 uadv( nbin+2,myu,ijk ) = 0.0_rp
2569 do nn = 1, loopflg(ijk)
2571 do mm = 1, iflg( myu,ijk )
2573 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
2581 do nn = 1, loopflg(ijk)
2583 do mm = 1, iflg( myu,ijk )
2585 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
2586 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
2587 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
2595 do nn = 1, loopflg(ijk)
2597 do mm = 1, iflg( myu,ijk )
2599 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
2601 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
2602 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
2603 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
2605 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
2613 do nn = 1, loopflg(ijk)
2615 do mm = 1, iflg( myu,ijk )
2617 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
2619 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
2620 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
2621 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
2623 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
2631 do nn = 1, loopflg(ijk)
2633 do mm = 1, iflg( myu,ijk )
2635 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
2636 + acoef(2,n,myu,ijk) * 2.0_rp
2638 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
2646 do nn = 1, loopflg(ijk)
2648 do mm = 1, iflg( myu,ijk )
2650 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
2651 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
2659 do nn = 1, loopflg(ijk)
2661 do mm = 1, iflg( myu,ijk )
2662 dumm_regene(ijk) = dumm_regene(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
2663 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk) + eps )
2670 do nn = 1, loopflg(ijk)
2672 do mm = 1, iflg( myu,ijk )
2674 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
2685 do nn = 1, loopflg(ijk)
2688 gcinew(ijk) = 0.0_rp
2691 gcinew(ijk) = gcinew(ijk) + gcn( n,myu,ijk )*expxctr( n )*dxmic
2696 sblmss(ijk) = gcinew(ijk) - gciold(ijk)
2697 qvap(ijk) = qvap(ijk) - sblmss(ijk)/dens(ijk)
2698 temp(ijk) = temp(ijk) + sblmss(ijk)/dens(ijk)*qlsbl(ijk)/cp
2700 gciold(ijk) = gcinew(ijk)
2713 gc( n,myu,ijk ) = gcn( n,myu,ijk )*expxctr( n )
2721 end subroutine icephase
2724 subroutine mixphase( &
2734 integer,
intent(in) :: ijkmax
2735 real(RP),
intent(in) :: dens(ijkmax)
2736 real(RP),
intent(in) :: pres(ijkmax)
2737 real(RP),
intent(inout) :: temp(ijkmax)
2738 real(RP),
intent(inout) :: qvap(ijkmax)
2739 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
2740 real(DP),
intent(in) :: dtime
2742 integer :: n, myu, mm, ncount
2743 integer :: nloop(ijkmax)
2744 real(RP) :: gclold(ijkmax), gclnew(ijkmax)
2745 real(RP) :: gciold(ijkmax), gcinew(ijkmax)
2746 real(RP) :: cndmss(ijkmax), sblmss(ijkmax)
2747 real(RP) :: gtliq(ijkmax), gtice(ijkmax)
2748 real(RP) :: umax(ijkmax), uval, dtcnd(ijkmax)
2749 real(RP) :: qlevp(ijkmax), qlsbl(ijkmax)
2750 real(RP) :: cef1, cef2, cef3, cef4, a, b, c, d
2751 real(RP) :: rmdplus, rmdmins, ssplus, ssmins, tplus, tmins
2752 real(RP) :: sliqtnd, sicetnd
2753 real(RP) :: ssliq(ijkmax), ssice(ijkmax)
2754 real(RP) :: sumliq(ijkmax), sumice(ijkmax)
2755 real(RP) :: gcn( -1:nbin+2,nspc,ijkmax )
2756 real(RP),
parameter :: cflfct = 0.50_rp
2757 real(RP) :: dumm_regene(ijkmax)
2758 real(RP) :: csum( nspc,ijkmax )
2759 integer :: iflg( nspc,ijkmax )
2760 real(RP) :: f1, f2, emu, cefd, cefk, festl, festi, psat
2761 real(RP),
parameter :: afmyu = 1.72e-05_rp, bfmyu = 3.93e+2_rp
2762 real(RP),
parameter :: cfmyu = 1.2e+02_rp, fct = 1.4e+3_rp
2763 real(RP) :: qvtmp, zerosw
2764 integer :: ijk, nn, loopflg(ijkmax)
2768 real(RP) :: uadv ( 0:nbin+2,nspc,ijkmax )
2769 real(RP) :: flq ( 1:nbin+1,nspc,ijkmax )
2770 real(RP) :: acoef( 0:2,0:nbin+1,nspc,ijkmax )
2771 real(RP) :: crn ( 0:nbin+2,nspc,ijkmax )
2772 real(RP) :: aip ( 0:nbin+1,nspc,ijkmax )
2773 real(RP) :: aim ( 0:nbin+1,nspc,ijkmax )
2774 real(RP) :: ai ( 0:nbin+1,nspc,ijkmax )
2775 real(RP) :: cmins, cplus
2780 dumm_regene( : ) = 0.0_rp
2782 csum( :,: ) = 0.0_rp
2787 csum( myu,ijk ) = csum( myu,ijk )+gc( n,myu,ijk )*dxmic
2792 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
2802 gclold(ijk) = gclold(ijk) + gc( n,il,ijk )*dxmic
2807 gciold(ijk) = gciold(ijk) + gc( n,myu,ijk )*dxmic
2814 gcn( n,myu,ijk ) = gc( n,myu,ijk ) * rexpxctr( n )
2816 gcn( -1,myu,ijk ) = 0.0_rp
2817 gcn( 0,myu,ijk ) = 0.0_rp
2818 gcn( nbin+1,myu,ijk ) = 0.0_rp
2819 gcn( nbin+2,myu,ijk ) = 0.0_rp
2823 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2824 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2827 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2828 ssliq(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2830 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2831 ssice(ijk) = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
2832 ssliq(ijk) = qvap(ijk)/ssliq(ijk)-1.0_rp
2833 ssice(ijk) = qvap(ijk)/ssice(ijk)-1.0_rp
2835 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2836 cefd = emu/dens(ijk)
2839 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2840 f1 = rvap*temp(ijk)/festl/cefd
2841 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2842 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2844 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2845 f1 = rvap*temp(ijk)/festi/cefd
2846 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2847 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2850 umax(ijk) = cbnd( 1,il )*rexpxbnd( 1 )*gtliq(ijk)*abs( ssliq(ijk) )
2852 uval = cbnd( 1,myu )*rexpxbnd( 1 )*gtice(ijk)*abs( ssice(ijk) )
2853 umax(ijk) = max( umax(ijk),uval )
2856 dtcnd(ijk) = cflfct*dxmic/umax(ijk)
2857 nloop(ijk) = int( dtime/dtcnd(ijk) ) + 1
2858 dtcnd(ijk) = dtime/nloop(ijk)
2860 nloop(ijk) = nloop(ijk) * iflg( il,ijk )
2861 nloop(ijk) = nloop(ijk) * maxval( iflg( 2:nspc,ijk ) )
2864 nloopmax = maxval(nloop,1)
2869 do ncount = 1, nloopmax
2873 loopflg(ijk) = min( 1, int(nloop(ijk)/ncount) )
2878 do nn = 1, loopflg(ijk)
2880 qlevp(ijk) = const_lhv0 + ( const_cpvap - const_cl ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2881 qlsbl(ijk) = const_lhs0 + ( const_cpvap - const_ci ) * ( temp(ijk) -
const_tem00 ) * flg_thermodyn
2884 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
2885 ssliq(ijk) = qvap(ijk) / ( const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat ) )-1.0_rp
2887 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
2888 ssice(ijk) = qvap(ijk) / ( const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat ) )-1.0_rp
2890 emu = afmyu*( bfmyu/( temp(ijk)+cfmyu ) )*( temp(ijk)/tmlt )**1.50_rp
2891 cefd = emu/dens(ijk)
2893 festl = esat0*exp( qlevp(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2894 f1 = rvap*temp(ijk)/festl/cefd
2895 f2 = qlevp(ijk)/cefk/temp(ijk)*( qlevp(ijk)/rvap/temp(ijk) - 1.0_rp )
2896 gtliq(ijk) = 4.0_rp*pi/( f1+f2 )
2897 festi = esat0*exp( qlsbl(ijk)/rvap*( 1.0_rp/temp0 - 1.0_rp/temp(ijk) ) )
2898 f1 = rvap*temp(ijk)/festi/cefd
2899 f2 = qlsbl(ijk)/cefk/temp(ijk)*( qlsbl(ijk)/rvap/temp(ijk) - 1.0_rp )
2900 gtice(ijk) = 4.0_rp*pi/( f1+f2 )
2902 sumliq(ijk) = 0.0_rp
2904 sumliq(ijk) = sumliq(ijk) + gcn( n,il,ijk )*cctr( n,il )*dxmic
2907 sumice(ijk) = 0.0_rp
2910 sumice(ijk) = sumice(ijk) + gcn( n,myu,ijk )*cctr( n,myu )*dxmic
2919 do nn = 1, loopflg(ijk)
2920 zerosw = 0.5_rp + sign( 0.5_rp,qvap(ijk)-eps )
2921 qvtmp = qvap(ijk) * zerosw + ( qvap(ijk)+eps ) * ( 1.0_rp-zerosw )
2922 cef1 = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)/rvap/temp(ijk)/temp(ijk)*qlevp(ijk)/cp )
2923 cef2 = ( ssliq(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlevp(ijk)/rvap/temp(ijk)/temp(ijk)*qlsbl(ijk)/cp )
2924 cef3 = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)/rvap/temp(ijk)/temp(ijk)*qlevp(ijk)/cp )
2925 cef4 = ( ssice(ijk)+1.0_rp )*( 1.0_rp/qvtmp + qlsbl(ijk)/rvap/temp(ijk)/temp(ijk)*qlsbl(ijk)/cp )
2927 a = - cef1*sumliq(ijk)*gtliq(ijk)/dens(ijk)
2928 b = - cef2*sumice(ijk)*gtice(ijk)/dens(ijk)
2929 c = - cef3*sumliq(ijk)*gtliq(ijk)/dens(ijk)
2930 d = - cef4*sumice(ijk)*gtice(ijk)/dens(ijk)
2932 b = b + eps * ( 1.0_rp - zerosw )
2934 rmdplus = ( ( a+d ) + sqrt( ( a-d )**2 + 4.0_rp*b*c ) ) * 0.50_rp
2935 rmdmins = ( ( a+d ) - sqrt( ( a-d )**2 + 4.0_rp*b*c ) ) * 0.50_rp
2937 rmdplus = rmdplus + eps * ( 1.0_rp - zerosw )
2938 rmdmins = rmdmins + eps * ( 1.0_rp - zerosw )
2941 ssplus = ( ( rmdmins-a )*ssliq(ijk) - b*ssice(ijk) )/b/( rmdmins-rmdplus + eps * ( 1.0_rp - zerosw ) )
2942 ssmins = ( ( a-rmdplus )*ssliq(ijk) + b*ssice(ijk) )/b/( rmdmins-rmdplus + eps * ( 1.0_rp - zerosw ) )
2944 tplus = ( exp( rmdplus*dtcnd(ijk) )-1.0_rp )/( rmdplus*dtcnd(ijk) ) &
2945 * ( 0.5_rp + sign( 0.5_rp,abs(rmdplus*dtcnd(ijk)-0.1_rp) ) ) &
2947 * ( 0.5_rp - sign( 0.5_rp,abs(rmdplus*dtcnd(ijk)-0.1_rp) ) )
2948 tmins = ( exp( rmdmins*dtcnd(ijk) )-1.0_rp )/( rmdmins*dtcnd(ijk) ) &
2949 * ( 0.5_rp + sign( 0.5_rp,abs(rmdmins*dtcnd(ijk)-0.1_rp) ) ) &
2951 * ( 0.5_rp - sign( 0.5_rp,abs(rmdmins*dtcnd(ijk)-0.1_rp) ) )
2953 sliqtnd = ssliq(ijk) * ( 1.0_rp - zerosw ) &
2955 ( b*tplus*ssplus + b*tmins*ssmins )
2956 sicetnd = ssice(ijk) * ( 1.0_rp - zerosw ) &
2958 ( ( rmdplus-a )*tplus*ssplus &
2959 + ( rmdmins-a )*tmins*ssmins )
2963 do mm = 1, iflg( myu,ijk )
2967 uadv( n,myu,ijk ) = cbnd( n,myu )*rexpxbnd( n )*gtliq(ijk)*sliqtnd &
2968 * ( 0.5_rp - sign( 0.5_rp,
real(myu)-1.5_RP) ) &
2969 + cbnd( n,myu )*rexpxbnd( n )*gtice(ijk)*sicetnd &
2970 * ( 0.5_RP + sign( 0.5_RP,
real(myu)-1.5_RP) )
2972 uadv( 0, myu,ijk ) = 0.0_rp
2973 uadv( nbin+2,myu,ijk ) = 0.0_rp
2982 do nn = 1, loopflg(ijk)
2984 do mm = 1, iflg( myu,ijk )
2986 crn( n,myu,ijk ) = uadv( n,myu,ijk )*dtcnd(ijk)/dxmic
2994 do nn = 1, loopflg(ijk)
2996 do mm = 1, iflg( myu,ijk )
2998 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
2999 acoef(1,n,myu,ijk) = ( gcn( n+1,myu,ijk ) -gcn( n-1,myu,ijk ) ) / 16.0_rp
3000 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
3008 do nn = 1, loopflg(ijk)
3010 do mm = 1, iflg( myu,ijk )
3012 cplus = 1.0_rp - ( crn(n+1,myu,ijk) + abs(crn(n+1,myu,ijk)) )
3014 aip(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cplus**1 ) &
3015 + acoef(1,n,myu,ijk) * ( 1.0_rp-cplus**2 ) &
3016 + acoef(2,n,myu,ijk) * ( 1.0_rp-cplus**3 )
3018 aip(n,myu,ijk) = max( aip(n,myu,ijk), 0.0_rp )
3026 do nn = 1, loopflg(ijk)
3028 do mm = 1, iflg( myu,ijk )
3030 cmins = 1.0_rp - ( abs(crn(n,myu,ijk)) - crn(n,myu,ijk) )
3032 aim(n,myu,ijk) = acoef(0,n,myu,ijk) * ( 1.0_rp-cmins**1 ) &
3033 - acoef(1,n,myu,ijk) * ( 1.0_rp-cmins**2 ) &
3034 + acoef(2,n,myu,ijk) * ( 1.0_rp-cmins**3 )
3036 aim(n,myu,ijk) = max( aim(n,myu,ijk), 0.0_rp )
3044 do nn = 1, loopflg(ijk)
3046 do mm = 1, iflg( myu,ijk )
3048 ai(n,myu,ijk) = acoef(0,n,myu,ijk) * 2.0_rp &
3049 + acoef(2,n,myu,ijk) * 2.0_rp
3051 ai(n,myu,ijk) = max( ai(n,myu,ijk), aip(n,myu,ijk)+aim(n,myu,ijk)+cldmin )
3059 do nn = 1, loopflg(ijk)
3061 do mm = 1, iflg( myu,ijk )
3063 flq(n,myu,ijk) = ( aip(n-1,myu,ijk)/ai(n-1,myu,ijk)*gcn( n-1,myu,ijk ) &
3064 - aim(n ,myu,ijk)/ai(n ,myu,ijk)*gcn( n ,myu,ijk ) )*dxmic/dtcnd(ijk)
3072 do nn = 1, loopflg(ijk)
3074 do mm = 1, iflg( myu,ijk )
3075 dumm_regene(ijk) = dumm_regene(ijk)+( -flq(1,myu,ijk)*dtcnd(ijk)/dxmic ) &
3076 * min( uadv(1,myu,ijk),0.0_rp )/( uadv(1,myu,ijk)+eps )
3083 do nn = 1, loopflg(ijk)
3085 do mm = 1, iflg( myu,ijk )
3087 gcn( n,myu,ijk ) = gcn( n,myu,ijk ) - ( flq(n+1,myu,ijk)-flq(n,myu,ijk) )*dtcnd(ijk)/dxmic
3098 do nn = 1, loopflg(ijk)
3100 gclnew(ijk) = 0.0_rp
3102 gclnew(ijk) = gclnew(ijk) + gcn( n,il,ijk )*expxctr( n )*dxmic
3105 gcinew(ijk) = 0.0_rp
3108 gcinew(ijk) = gcinew(ijk) + gcn( n,myu,ijk )*expxctr( n )*dxmic
3113 cndmss(ijk) = gclnew(ijk) - gclold(ijk)
3114 sblmss(ijk) = gcinew(ijk) - gciold(ijk)
3116 qvap(ijk) = qvap(ijk) - ( cndmss(ijk)+sblmss(ijk) )/dens(ijk)
3117 temp(ijk) = temp(ijk) + ( cndmss(ijk)*qlevp(ijk)+sblmss(ijk)*qlsbl(ijk) )/dens(ijk)/cp
3119 gclold(ijk) = gclnew(ijk)
3120 gciold(ijk) = gcinew(ijk)
3131 gc( n,myu,ijk ) = gcn( n,myu,ijk )*expxctr( n )
3136 if ( .NOT. flg_regeneration )
then 3137 dumm_regene(:) = 0.0_rp
3143 end subroutine mixphase
3146 subroutine ice_nucleat( &
3158 integer,
intent(in) :: ijkmax
3159 integer,
intent(in) :: num_cold
3160 integer,
intent(in) :: index_cold(ijkmax)
3161 real(RP),
intent(in) :: dens(ijkmax)
3162 real(RP),
intent(in) :: pres(ijkmax)
3163 real(RP),
intent(inout) :: temp(ijkmax)
3164 real(RP),
intent(inout) :: qvap(ijkmax)
3165 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3166 real(DP),
intent(in) :: dtime
3168 real(RP) :: ssliq, ssice
3169 real(RP) :: numin, tdel, qdel
3171 real(RP),
parameter :: acoef = -0.639_rp, bcoef = 12.96_rp
3173 real(RP),
parameter :: tcolmu = 269.0_rp, tcolml = 265.0_rp
3174 real(RP),
parameter :: tdendu = 257.0_rp, tdendl = 255.0_rp
3175 real(RP),
parameter :: tplatu = 250.6_rp
3178 integer :: ijk, indirect
3183 do indirect = 1, num_cold
3184 ijk = index_cold(indirect)
3188 * exp(
lovr_liq * ( rtem00 - 1.0_rp/temp(ijk) ) )
3189 ssliq = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
3191 * exp(
lovr_ice * ( rtem00 - 1.0_rp/temp(ijk) ) )
3192 ssice = const_epsvap * psat / ( pres(ijk) - ( 1.0_rp-const_epsvap ) * psat )
3193 ssliq = qvap(ijk)/ssliq-1.0_rp
3194 ssice = qvap(ijk)/ssice-1.0_rp
3196 if( ssice <= 0.0_rp ) cycle
3198 numin = bcoef * exp( acoef + bcoef * ssice )
3199 numin = numin * expxctr( 1 )/dxmic
3200 numin = min( numin,qvap(ijk)*dens(ijk) )
3202 if ( temp(ijk) <= tplatu .OR. ( temp(ijk) >= tcolml .AND. temp(ijk) < tcolmu ) )
then 3203 gc( 1,ic,ijk ) = gc( 1,ic,ijk ) + numin
3205 elseif( temp(ijk) <= tdendu .AND. temp(ijk) >= tdendl )
then 3206 gc( 1,id,ijk ) = gc( 1,id,ijk ) + numin
3209 gc( 1,ip,ijk ) = gc( 1,ip,ijk ) + numin
3212 tdel = numin/dens(ijk)*qlmlt/cp
3213 temp(ijk) = temp(ijk) + tdel
3214 qdel = numin/dens(ijk)
3215 qvap(ijk) = qvap(ijk) - qdel
3223 end subroutine ice_nucleat
3226 subroutine freezing( &
3236 integer,
intent(in) :: ijkmax
3237 integer,
intent(in) :: num_cold
3238 integer,
intent(in) :: index_cold(ijkmax)
3239 real(RP),
intent(in) :: dens(ijkmax)
3240 real(RP),
intent(inout) :: temp(ijkmax)
3241 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3242 real(DP),
intent(in) :: dtime
3244 integer :: nbound, n
3245 real(RP) :: xbound, tc, rate, dmp, frz, sumfrz, tdel
3246 real(RP),
parameter :: coefa = 1.0e-01_rp
3247 real(RP),
parameter :: coefb = 0.66_rp
3248 real(RP),
parameter :: rbound = 2.0e-04_rp
3252 integer :: ijk, indirect
3256 do indirect = 1, num_cold
3257 ijk = index_cold(indirect)
3260 xbound = log( rhow * 4.0_rp*pi/3.0_rp * rbound**3 )
3261 nbound = int( ( xbound-xbnd( 1 ) )/dxmic ) + 1
3264 rate = coefa*exp( -coefb*tc )
3268 dmp = rate*expxctr( n )
3269 frz = gc( n,il,ijk )*( 1.0_rp-exp( -dmp*dtime ) )
3271 gc( n,il,ijk ) = gc( n,il,ijk ) - frz
3272 gc( n,il,ijk ) = max( gc( n,il,ijk ),0.0_rp )
3274 gc( n,ip,ijk ) = gc( n,ip,ijk ) + frz
3276 sumfrz = sumfrz + frz
3279 dmp = rate*expxctr( n )
3280 frz = gc( n,il,ijk )*( 1.0_rp-exp( -dmp*dtime ) )
3282 gc( n,il,ijk ) = gc( n,il,ijk ) - frz
3283 gc( n,il,ijk ) = max( gc( n,il,ijk ),0.0_rp )
3285 gc( n,ih,ijk ) = gc( n,ih,ijk ) + frz
3287 sumfrz = sumfrz + frz
3307 sumfrz = sumfrz*dxmic
3309 tdel = sumfrz/dens(ijk)*qlmlt/cp
3310 temp(ijk) = temp(ijk) + tdel
3316 end subroutine freezing
3319 subroutine melting( &
3329 integer,
intent(in) :: ijkmax
3330 integer,
intent(in) :: num_warm
3331 integer,
intent(in) :: index_warm(ijkmax)
3332 real(RP),
intent(in) :: dens(ijkmax)
3333 real(RP),
intent(inout) :: temp(ijkmax)
3334 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3335 real(DP),
intent(in) :: dtime
3338 real(RP) :: summlt, sumice, tdel
3339 integer :: ijk, indirect
3343 do indirect = 1, num_warm
3344 ijk = index_warm(indirect)
3350 sumice = sumice + gc( n,m,ijk )
3351 gc( n,m,ijk ) = 0.0_rp
3353 gc( n,il,ijk ) = gc( n,il,ijk ) + sumice
3354 summlt = summlt + sumice
3356 summlt = summlt*dxmic
3358 tdel = - summlt/dens(ijk)*qlmlt/cp
3359 temp(ijk) = temp(ijk) + tdel
3366 end subroutine melting
3369 subroutine collmain( &
3376 integer,
intent(in) :: ijkmax
3377 real(RP),
intent(in) :: temp(ijkmax)
3378 real(RP),
intent(inout) :: ghyd(nbin,nspc,ijkmax)
3379 real(DP),
intent(in) :: dt
3382 if ( rndm_flgp == 1 )
then 3389 call collcoag( ijkmax, &
3396 end subroutine collmain
3399 subroutine collmainf( &
3406 integer,
intent(in) :: ijkmax
3407 real(RP),
intent(in) :: temp(ijkmax)
3408 real(RP),
intent(inout) :: ghyd(nbin,nspc,ijkmax)
3409 real(DP),
intent(in) :: dt
3412 if ( rndm_flgp == 1 )
then 3419 call collcoag( ijkmax, &
3426 end subroutine collmainf
3431 subroutine collcoag( &
3438 integer,
intent(in) :: ijkmax
3439 real(RP),
intent(in) :: temp(ijkmax)
3440 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3441 real(DP),
intent(in) :: dtime
3443 integer :: i, j, k, l
3444 real(RP) :: xi, xj, xnew, dmpi, dmpj, frci, frcj
3445 real(RP) :: gprime, gprimk, wgt, crn, sum, flux
3446 integer,
parameter :: ldeg = 2
3447 real(RP) :: acoef( 0:ldeg )
3448 real(RP),
parameter :: dmpmin = 1.e-01_rp
3449 real(RP) :: suri, surj
3451 integer :: myu, n, irsl, ilrg, isml
3452 integer :: ibnd( ijkmax )
3453 integer :: iflg( nspc,ijkmax )
3454 integer :: iexst( nbin,nspc,ijkmax )
3455 real(RP) :: csum( nspc,ijkmax )
3456 integer :: ijk, nn, mm, pp, qq
3463 csum( :,: ) = 0.0_rp
3468 csum( myu,ijk ) = csum( myu,ijk ) + gc( n,myu,ijk )*dxmic
3472 if ( csum( myu,ijk ) > cldmin ) iflg( myu,ijk ) = 1
3475 if ( temp(ijk) < tcrit )
then 3483 if ( gc( n,myu,ijk ) > cldmin )
then 3484 iexst( n,myu,ijk ) = 1
3494 do nn = 1, iflg( isml,ijk )
3497 do mm = 1, iflg( ilrg,ijk )
3499 irsl = ifrsl( ibnd(ijk),isml,ilrg )
3502 do pp = 1, iexst( i,isml,ijk )
3505 do qq = 1, iexst( j,ilrg,ijk )
3512 dmpi = ck( isml,ilrg,i,j )*gc( j,ilrg,ijk )/xj*dxmic*dtime
3513 dmpj = ck( ilrg,isml,i,j )*gc( i,isml,ijk )/xi*dxmic*dtime
3515 if ( dmpi <= dmpmin )
then 3516 frci = gc( i,isml,ijk )*dmpi
3518 frci = gc( i,isml,ijk )*( 1.0_rp-exp( -dmpi ) )
3521 if ( dmpj <= dmpmin )
then 3522 frcj = gc( j,ilrg,ijk )*dmpj
3524 frcj = gc( j,ilrg,ijk )*( 1.0_rp-exp( -dmpj ) )
3529 if ( gprime > 0.0_rp .AND. k < nbin )
then 3531 suri = gc( i,isml,ijk )
3532 surj = gc( j,ilrg,ijk )
3533 gc( i,isml,ijk ) = gc( i,isml,ijk )-frci
3534 gc( j,ilrg,ijk ) = gc( j,ilrg,ijk )-frcj
3535 gc( i,isml,ijk ) = max( gc( i,isml,ijk )-frci, 0.0_rp )
3536 gc( j,ilrg,ijk ) = max( gc( j,ilrg,ijk )-frcj, 0.0_rp )
3537 frci = suri - gc( i,isml,ijk )
3538 frcj = surj - gc( j,ilrg,ijk )
3541 gprimk = gc( k,irsl,ijk ) + gprime
3542 wgt = gprime / gprimk
3543 crn = ( xnew-xctr( k ) )/( xctr( k+1 )-xctr( k ) )
3545 acoef( 0 ) = -( gc( k+1,irsl,ijk )-26.0_rp*gprimk+gc( k-1,irsl,ijk ) )/24.0_rp
3546 acoef( 1 ) = ( gc( k+1,irsl,ijk )-gc( k-1,irsl,ijk ) ) *0.50_rp
3547 acoef( 2 ) = ( gc( k+1,irsl,ijk )-2.0_rp*gprimk+gc( k-1,irsl,ijk ) ) *0.50_rp
3551 sum = sum + acoef( l )/( l+1 )/2.0_rp**( l+1 ) &
3552 *( 1.0_rp-( 1.0_rp-2.0_rp*crn )**( l+1 ) )
3556 flux = min( max( flux,0.0_rp ),gprime )
3558 gc( k,irsl,ijk ) = gprimk - flux
3559 gc( k+1,irsl,ijk ) = gc( k+1,irsl,ijk ) + flux
3579 end subroutine collcoag
3582 subroutine getrule &
3585 integer,
intent(out) :: indx( nbin,nbin )
3586 integer,
intent(out) :: ifrsl( 2,nspc_mk,nspc_mk )
3592 xnew = log( expxctr( i )+expxctr( j ) )
3593 k = int( ( xnew-xctr( 1 ) )/dxmic ) + 1
3594 k = max( max( k,j ),i )
3601 ifrsl( 1:2,il,il ) = il
3604 ifrsl( 1:2,il,ic ) = ic
3605 ifrsl( 1,ic,il ) = ig
3606 ifrsl( 2,ic,il ) = ih
3609 ifrsl( 1:2,il,ip ) = ip
3610 ifrsl( 1,ip,il ) = ig
3611 ifrsl( 2,ip,il ) = ih
3614 ifrsl( 1:2,il,id ) = id
3615 ifrsl( 1,id,il ) = ig
3616 ifrsl( 2,id,il ) = ih
3619 ifrsl( 1:2,il,iss ) = iss
3620 ifrsl( 1,iss,il ) = ig
3621 ifrsl( 2,iss,il ) = ih
3624 ifrsl( 1:2,il,ig ) = ig
3625 ifrsl( 1,ig,il ) = ig
3626 ifrsl( 2,ig,il ) = ih
3629 ifrsl( 1:2,il,ih ) = ih
3630 ifrsl( 1,ih,il ) = ig
3631 ifrsl( 2,ih,il ) = ih
3635 ifrsl( 1:2,ic,ic ) = iss
3638 ifrsl( 1:2,ic,ip ) = iss
3639 ifrsl( 1:2,ip,ic ) = iss
3642 ifrsl( 1:2,ic,id ) = iss
3643 ifrsl( 1:2,id,ic ) = iss
3646 ifrsl( 1:2,ic,iss ) = iss
3647 ifrsl( 1:2,iss,ic ) = iss
3650 ifrsl( 1:2,ic,ig ) = ig
3651 ifrsl( 1:2,ig,ic ) = ic
3654 ifrsl( 1:2,ih,ic ) = ic
3655 ifrsl( 1,ic,ih ) = ig
3656 ifrsl( 2,ic,ih ) = ih
3660 ifrsl( 1:2,ip,ip ) = iss
3663 ifrsl( 1:2,ip,id ) = iss
3664 ifrsl( 1:2,id,ip ) = iss
3667 ifrsl( 1:2,ip,iss ) = iss
3668 ifrsl( 1:2,iss,ip ) = iss
3671 ifrsl( 1:2,ip,ig ) = ig
3672 ifrsl( 1:2,ig,ip ) = ip
3675 ifrsl( 1:2,ih,ip ) = ip
3676 ifrsl( 1,ip,ih ) = ig
3677 ifrsl( 2,ip,ih ) = ih
3681 ifrsl( 1:2,id,id ) = iss
3684 ifrsl( 1:2,id,iss ) = iss
3685 ifrsl( 1:2,iss,id ) = iss
3688 ifrsl( 1:2,id,ig ) = ig
3689 ifrsl( 1:2,ig,id ) = id
3692 ifrsl( 1:2,ih,id ) = id
3693 ifrsl( 1,id,ih ) = ig
3694 ifrsl( 2,id,ih ) = ih
3698 ifrsl( 1:2,iss,iss ) = iss
3701 ifrsl( 1:2,iss,ig ) = ig
3702 ifrsl( 1:2,ig,iss ) = iss
3705 ifrsl( 1:2,ih,iss ) = iss
3706 ifrsl( 1,iss,ih ) = ig
3707 ifrsl( 2,iss,ih ) = ih
3711 ifrsl( 1:2,ig,ig ) = ig
3714 ifrsl( 1,ig,ih ) = ig
3715 ifrsl( 1,ih,ig ) = ig
3716 ifrsl( 2,ig,ih ) = ih
3717 ifrsl( 2,ih,ig ) = ih
3720 ifrsl( 1:2,ih,ih ) = ih
3725 end subroutine getrule
3734 integer ,
intent(in) :: ijkmax
3735 real(RP),
intent(in) :: f0(ijkmax)
3736 real(RP),
intent(inout) :: ga(nccn,ijkmax)
3747 ga(n,ijk) = ga(n,ijk) + f0(ijk) * marate(n) * expxactr(n) / dxaer
3754 end subroutine faero
3759 subroutine random_setup( mset )
3766 integer,
intent(in) :: mset
3770 real(RP) :: nbinr, tmp1
3771 real(RP) :: rans( mbin ), ranl( mbin )
3773 real(RP),
allocatable :: ranstmp( : )
3774 real(RP),
allocatable :: ranltmp( : )
3777 integer,
allocatable :: orderb( : )
3780 real(RP),
allocatable :: randnum(:,:,:)
3783 allocate( blrg( mset, mbin ) )
3784 allocate( bsml( mset, mbin ) )
3785 allocate( ranstmp( pq ) )
3786 allocate( ranltmp( pq ) )
3787 allocate( orderb( pq ) )
3788 allocate( randnum(1,1,pq) )
3790 a =
real( nbin )*
real( nbin-1 )*0.50_RP
3791 if ( a < mbin )
then 3792 write(*,*)
"mbin should be smaller than {nbin}_C_{2}" 3796 wgtbin = a/
real( mbin )
3797 nbinr =
real( nbin )
3804 ranstmp( (p-1)*nbin-(p*(p-1))/2+1 : p*nbin-(p*(p+1))/2 ) = p
3806 ranltmp( (p-1)*nbin-(p*(p-1))/2+q ) = p+q
3813 abq1 = randnum( 1,1,p )
3814 k = int( abq1*( pq-p-1 ) ) + p
3816 orderb( p ) = orderb( k )
3822 rans( p ) = ranstmp( orderb( p ) )
3823 ranl( p ) = ranltmp( orderb( p ) )
3825 rans( p ) = ranstmp( orderb( p-pq ) )
3826 ranl( p ) = ranltmp( orderb( p-pq ) )
3828 if ( rans( p ) >= ranl( p ) )
then 3830 rans( p ) = ranl( p )
3834 blrg( n,1:mbin ) = int( ranl( 1:mbin ) )
3835 bsml( n,1:mbin ) = int( rans( 1:mbin ) )
3838 deallocate( ranstmp )
3839 deallocate( ranltmp )
3840 deallocate( orderb )
3841 deallocate( randnum )
3843 end subroutine random_setup
3859 integer,
intent(in) :: ijkmax
3860 real(RP),
intent(in) :: swgt
3861 real(RP),
intent(in) :: temp(ijkmax)
3862 real(RP),
intent(inout) :: gc (nbin,nspc,ijkmax)
3863 real(DP),
intent(in) :: dtime
3865 integer :: i, j, k, l
3866 real(RP) :: xi, xj, xnew, dmpi, dmpj, frci, frcj
3867 real(RP) :: gprime, gprimk, wgt, crn, sum, flux
3868 integer,
parameter :: ldeg = 2
3869 real(RP),
parameter :: dmpmin = 1.e-01_rp, cmin = 1.e-10_rp
3870 real(RP) :: acoef( 0:ldeg )
3873 integer :: nums( mbin ), numl( mbin )
3874 real(RP),
parameter :: gt = 1.0_rp
3876 real(RP) :: nbinr, mbinr
3878 real(RP) :: tmpi, tmpj
3880 integer :: ibnd( ijkmax )
3881 integer :: iflg( nspc,ijkmax )
3882 integer :: iexst( nbin,nspc,ijkmax )
3883 real(RP) :: csum( nspc,ijkmax )
3884 integer :: ijk, nn, mm, pp, qq, myu, n, isml, ilrg, irsl
3891 csum( :,: ) = 0.0_rp
3895 csum( il,ijk ) = csum( il,ijk ) + gc( n,il,ijk )*dxmic
3896 csum( ic,ijk ) = csum( ic,ijk ) + gc( n,ic,ijk )*dxmic
3897 csum( ip,ijk ) = csum( ip,ijk ) + gc( n,ip,ijk )*dxmic
3898 csum( id,ijk ) = csum( id,ijk ) + gc( n,id,ijk )*dxmic
3899 csum( iss,ijk ) = csum( iss,ijk ) + gc( n,iss,ijk )*dxmic
3900 csum( ig,ijk ) = csum( ig,ijk ) + gc( n,ig,ijk )*dxmic
3901 csum( ih,ijk ) = csum( ih,ijk ) + gc( n,ih,ijk )*dxmic
3903 if ( csum( il,ijk ) > cldmin ) iflg( il,ijk ) = 1
3904 if ( csum( ic,ijk ) > cldmin ) iflg( ic,ijk ) = 1
3905 if ( csum( ip,ijk ) > cldmin ) iflg( ip,ijk ) = 1
3906 if ( csum( id,ijk ) > cldmin ) iflg( id,ijk ) = 1
3907 if ( csum( iss,ijk ) > cldmin ) iflg( iss,ijk ) = 1
3908 if ( csum( ig,ijk ) > cldmin ) iflg( ig,ijk ) = 1
3909 if ( csum( ih,ijk ) > cldmin ) iflg( ih,ijk ) = 1
3911 if ( temp(ijk) < tcrit )
then 3919 if ( gc( n,myu,ijk ) > cldmin )
then 3920 iexst( n,myu,ijk ) = 1
3930 do nn = 1, iflg( isml,ijk )
3933 do mm = 1, iflg( ilrg,ijk )
3935 irsl = ifrsl( ibnd(ijk),isml,ilrg )
3938 det = int( rndm(1,1,1)*
ia*
ja*
ka )
3939 nbinr =
real( nbin )
3940 mbinr =
real( mbin )
3941 nums( 1:mbin ) = bsml( det,1:mbin )
3942 numl( 1:mbin ) = blrg( det,1:mbin )
3948 do pp = 1, iexst( i,isml,ijk )
3949 do qq = 1, iexst( j,ilrg,ijk )
3956 dmpi = ck( isml,ilrg,i,j )*gc( j,ilrg,ijk )/xj*dxmic*dtime
3957 dmpj = ck( ilrg,isml,i,j )*gc( i,isml,ijk )/xi*dxmic*dtime
3959 if ( dmpi <= dmpmin )
then 3960 frci = gc( i,isml,ijk )*dmpi
3962 frci = gc( i,isml,ijk )*( 1.0_rp-exp( -dmpi ) )
3965 if ( dmpj <= dmpmin )
then 3966 frcj = gc( j,ilrg,ijk )*dmpj
3968 frcj = gc( j,ilrg,ijk )*( 1.0_rp-exp( -dmpj ) )
3970 tmpi = gc( i,isml,ijk )
3971 tmpj = gc( j,ilrg,ijk )
3973 gc( i,isml,ijk ) = gc( i,isml,ijk )-frci*swgt
3974 gc( j,ilrg,ijk ) = gc( j,ilrg,ijk )-frcj*swgt
3977 gc( j,ilrg,ijk ) = max( gc( j,ilrg,ijk ), 0.0_rp )
3979 gc( i,isml,ijk ) = max( gc( i,isml,ijk ), 0.0_rp )
3981 frci = tmpi - gc( i,isml,ijk )
3982 frcj = tmpj - gc( j,ilrg,ijk )
4007 if ( gprime > 0.0_rp .AND. k < nbin )
then 4009 gprimk = gc( k,irsl,ijk ) + gprime
4010 wgt = gprime / gprimk
4011 crn = ( xnew-xctr( k ) )/( xctr( k+1 )-xctr( k ) )
4013 acoef( 0 ) = -( gc( k+1,irsl,ijk )-26.0_rp*gprimk+gc( k-1,irsl,ijk ) )/24.0_rp
4014 acoef( 1 ) = ( gc( k+1,irsl,ijk )-gc( k-1,irsl,ijk ) ) *0.5_rp
4015 acoef( 2 ) = ( gc( k+1,irsl,ijk )-2.0_rp*gprimk+gc( k-1,irsl,ijk ) ) *0.50_rp
4019 sum = sum + acoef( l )/( l+1 )/2.0_rp**( l+1 ) &
4020 *( 1.0_rp-( 1.0_rp-2.0_rp*crn )**( l+1 ) )
4024 flux = min( max( flux,0.0_rp ),gprime )
4026 gc( k,irsl,ijk ) = gprimk - flux
4027 gc( k+1,irsl,ijk ) = gc( k+1,irsl,ijk ) + flux
4059 real(RP),
intent(out) :: cldfrac(
ka,
ia,
ja)
4060 real(RP),
intent(in) :: qtrc (
ka,
ia,
ja,
qa)
4061 real(RP),
intent(in) :: mask_criterion
4064 integer :: k, i, j, iq, ihydro
4073 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4074 qhydro = qhydro + qtrc(k,i,j,iq)
4077 cldfrac(k,i,j) = 0.5_rp + sign(0.5_rp,qhydro-mask_criterion)
4081 elseif(
nspc == 1 )
then 4086 do ihydro = 1, i_mp_qc
4087 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4088 qhydro = qhydro + qtrc(k,i,j,iq)
4091 cldfrac(k,i,j) = 0.5_rp + sign(0.5_rp,qhydro-mask_criterion)
4123 real(RP),
intent(in) :: qtrc0(
ka,
ia,
ja,
qa)
4124 real(RP),
intent(in) :: dens0(
ka,
ia,
ja)
4125 real(RP),
intent(in) :: temp0(
ka,
ia,
ja)
4127 real(RP),
parameter :: um2cm = 100.0_rp
4129 real(RP) :: sum0(
nspc), sum2, sum3, re_tmp(
nspc)
4130 integer :: i, j, k, iq, ihydro
4136 re(k,i,j,:) = 0.0_rp
4142 do iq = qs_mp+1, qs_mp+nbnd
4144 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4145 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4146 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**3.0_rp )
4148 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4149 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4150 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**2.0_rp )
4152 sum3 = max( sum3, 0.0_rp )
4153 sum2 = max( sum2, 0.0_rp )
4154 if ( sum2 /= 0.0_rp )
then 4155 re(k,i,j,
i_hc) = sum3 / sum2 * um2cm
4157 re(k,i,j,
i_hc) = 0.0_rp
4164 do iq = qs_mp+nbnd+1, qs_mp+
nbin 4166 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4167 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4168 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**3.0_rp )
4170 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4171 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4172 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**2.0_rp )
4174 sum3 = max( sum3, 0.0_rp )
4175 sum2 = max( sum2, 0.0_rp )
4176 if ( sum2 /= 0.0_rp )
then 4177 re(k,i,j,
i_hr) = sum3 / sum2 * um2cm
4179 re(k,i,j,
i_hr) = 0.0_rp
4187 if (
nspc > 1 )
then 4192 sum0(ihydro) = 0.0_rp
4195 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4196 sum0(ihydro) = sum0(ihydro) &
4197 + ( qtrc0(k,i,j,iq) * dens0(k,i,j) )
4199 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4200 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4201 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**3.0_rp )
4203 + ( ( qtrc0(k,i,j,iq) * dens0(k,i,j) ) &
4204 * rexpxctr( iq-(i_qv+
nbin*(ihydro-1)) ) &
4205 * radc( iq-(i_qv+
nbin*(ihydro-1)) )**2.0_rp )
4207 sum3 = max( sum3, 0.0_rp )
4208 sum2 = max( sum2, 0.0_rp )
4209 if ( sum2 == 0.0_rp )
then 4210 re_tmp(ihydro) = 0.0_rp
4212 re_tmp(ihydro) = sum3 / sum2 * um2cm
4216 re(k,i,j,
i_hi) = ( re_tmp(i_mp_qp ) * sum0(i_mp_qp ) &
4217 + re_tmp(i_mp_qcl) * sum0(i_mp_qcl) &
4218 + re_tmp(i_mp_qd ) * sum0(i_mp_qd ) ) &
4219 / ( sum0(i_mp_qp) + sum0(i_mp_qcl) + sum0(i_mp_qd) + eps )
4220 re(k,i,j,
i_hs) = re_tmp(i_mp_qs)
4221 re(k,i,j,
i_hg) = re_tmp(i_mp_qg)
4222 re(k,i,j,
i_hh) = re_tmp(i_mp_qh)
4254 real(RP),
intent(in) :: qtrc0(
ka,
ia,
ja,
qa)
4257 integer :: i, j, k, iq, ihydro
4265 qe(k,i,j,:) = 0.0_rp
4269 do iq = qs_mp+1, qs_mp+nbnd
4270 sum2 = sum2 + qtrc0(k,i,j,iq)
4272 qe(k,i,j,
i_hc) = sum2
4276 do iq = qs_mp+nbnd+1, qs_mp+
nbin 4277 sum2 = sum2 + qtrc0(k,i,j,iq)
4279 qe(k,i,j,
i_hr) = sum2
4286 if (
nspc > 1 )
then 4293 do ihydro = i_mp_qp, i_mp_qd
4294 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4295 sum2 = sum2 + qtrc0(k,i,j,iq)
4298 qe(k,i,j,
i_hi) = sum2
4303 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4304 sum2 = sum2 + qtrc0(k,i,j,iq)
4306 qe(k,i,j,
i_hs) = sum2
4311 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4312 sum2 = sum2 + qtrc0(k,i,j,iq)
4314 qe(k,i,j,
i_hg) = sum2
4319 do iq = qs_mp+
nbin*(ihydro-1)+1, qs_mp+
nbin*ihydro
4320 sum2 = sum2 + qtrc0(k,i,j,iq)
4322 qe(k,i,j,
i_hh) = sum2
4343 allocate( radc_mk(
nbin ) )
4344 allocate( xctr_mk(
nbin ) )
4345 allocate( xbnd_mk(
nbin+1 ) )
4346 allocate( cctr_mk( nspc_mk,
nbin ) )
4347 allocate( cbnd_mk( nspc_mk,
nbin+1 ) )
4348 allocate( ck_mk( nspc_mk,nspc_mk,
nbin,
nbin ) )
4349 allocate( vt_mk( nspc_mk,
nbin ) )
4350 allocate( br_mk( nspc_mk,
nbin ) )
4373 deallocate( radc_mk )
4374 deallocate( xctr_mk )
4375 deallocate( xbnd_mk )
4376 deallocate( cctr_mk )
4377 deallocate( cbnd_mk )
4388 integer,
parameter :: il = 1, ic = 2, ip = 3, id = 4
4389 integer,
parameter :: is = 5, ig = 6, ih = 7
4390 integer,
parameter :: icemax = 3
4392 integer :: k, kk, i, j
4393 real(DP) :: xl( ndat ), rlec( ndat ), vrl( ndat )
4394 real(DP) :: blkradl( ndat ), blkdnsl( ndat )
4396 real(DP) :: xi( ndat,icemax ), riec( ndat,icemax ), vri( ndat,icemax )
4397 real(DP) :: blkradi( ndat,icemax ), blkdnsi( ndat,icemax )
4399 real(DP) :: xs( ndat ), rsec( ndat ), vrs( ndat )
4400 real(DP) :: blkrads( ndat ), blkdnss( ndat )
4402 real(DP) :: xg( ndat ), rgec( ndat ), vrg( ndat )
4403 real(DP) :: blkradg( ndat ), blkdnsg( ndat )
4405 real(DP) :: xh( ndat ), rhec( ndat ), vrh( ndat )
4406 real(DP) :: blkradh( ndat ), blkdnsh( ndat )
4409 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4410 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4411 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4412 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4413 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4414 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4415 data xi(1:ndat,1) / &
4416 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4417 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4418 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4419 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4420 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4421 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4422 data xi(1:ndat,2) / &
4423 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4424 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4425 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4426 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4427 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4428 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00 /
4429 data xi(1:ndat,3) / &
4430 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4431 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4432 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4433 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4434 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4435 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4437 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4438 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4439 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4440 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4441 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4442 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4444 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4445 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4446 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4447 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4448 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4449 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4451 0.33510e-10_dp,0.67021e-10_dp,0.13404e-09_dp,0.26808e-09_dp,0.53617e-09_dp,0.10723e-08_dp, &
4452 0.21447e-08_dp,0.42893e-08_dp,0.85786e-08_dp,0.17157e-07_dp,0.34315e-07_dp,0.68629e-07_dp, &
4453 0.13726e-06_dp,0.27452e-06_dp,0.54903e-06_dp,0.10981e-05_dp,0.21961e-05_dp,0.43923e-05_dp, &
4454 0.87845e-05_dp,0.17569e-04_dp,0.35138e-04_dp,0.70276e-04_dp,0.14055e-03_dp,0.28110e-03_dp, &
4455 0.56221e-03_dp,0.11244e-02_dp,0.22488e-02_dp,0.44977e-02_dp,0.89954e-02_dp,0.17991e-01_dp, &
4456 0.35981e-01_dp,0.71963e-01_dp,0.14393e+00_dp /
4457 data rlec(1:ndat) / &
4458 0.20000e-03_dp,0.25198e-03_dp,0.31748e-03_dp,0.40000e-03_dp,0.50397e-03_dp,0.63496e-03_dp, &
4459 0.80000e-03_dp,0.10079e-02_dp,0.12699e-02_dp,0.16000e-02_dp,0.20159e-02_dp,0.25398e-02_dp, &
4460 0.32000e-02_dp,0.40317e-02_dp,0.50797e-02_dp,0.64000e-02_dp,0.80635e-02_dp,0.10159e-01_dp, &
4461 0.12800e-01_dp,0.16127e-01_dp,0.20319e-01_dp,0.25600e-01_dp,0.32254e-01_dp,0.40637e-01_dp, &
4462 0.51200e-01_dp,0.64508e-01_dp,0.81275e-01_dp,0.10240e+00_dp,0.12902e+00_dp,0.16255e+00_dp, &
4463 0.20480e+00_dp,0.25803e+00_dp,0.32510e+00_dp /
4464 data riec(1:ndat,1) / &
4465 0.31936e-03_dp,0.40397e-03_dp,0.51099e-03_dp,0.64638e-03_dp,0.81764e-03_dp,0.10343e-02_dp, &
4466 0.13084e-02_dp,0.16551e-02_dp,0.20937e-02_dp,0.26486e-02_dp,0.33506e-02_dp,0.42387e-02_dp, &
4467 0.64360e-02_dp,0.81426e-02_dp,0.10302e-01_dp,0.13035e-01_dp,0.16494e-01_dp,0.20872e-01_dp, &
4468 0.26412e-01_dp,0.33426e-01_dp,0.42304e-01_dp,0.53543e-01_dp,0.67770e-01_dp,0.85783e-01_dp, &
4469 0.10859e+00_dp,0.13746e+00_dp,0.17403e+00_dp,0.22032e+00_dp,0.27895e+00_dp,0.35319e+00_dp, &
4470 0.44722e+00_dp,0.56630e+00_dp,0.71712e+00_dp /
4471 data riec(1:ndat,2) / &
4472 0.13188e-03_dp,0.16615e-03_dp,0.20953e-03_dp,0.27728e-03_dp,0.36694e-03_dp,0.48559e-03_dp, &
4473 0.64261e-03_dp,0.85040e-03_dp,0.11254e-02_dp,0.14893e-02_dp,0.19709e-02_dp,0.26082e-02_dp, &
4474 0.34515e-02_dp,0.45676e-02_dp,0.60446e-02_dp,0.79991e-02_dp,0.10586e-01_dp,0.14009e-01_dp, &
4475 0.18539e-01_dp,0.24533e-01_dp,0.32466e-01_dp,0.42964e-01_dp,0.56857e-01_dp,0.75242e-01_dp, &
4476 0.99573e-01_dp,0.13177e+00_dp,0.17438e+00_dp,0.23077e+00_dp,0.30539e+00_dp,0.40414e+00_dp, &
4477 0.53482e+00_dp,0.70775e+00_dp,0.93661e+00_dp /
4478 data riec(1:ndat,3) / 0.14998e-03_dp,0.18896e-03_dp,0.23808e-03_dp, &
4479 0.29996e-03_dp,0.37793e-03_dp,0.47616e-03_dp,0.61048e-03_dp,0.81343e-03_dp,0.10839e-02_dp, &
4480 0.14442e-02_dp,0.19243e-02_dp,0.25640e-02_dp,0.34164e-02_dp,0.45522e-02_dp,0.60656e-02_dp, &
4481 0.80820e-02_dp,0.10769e-01_dp,0.14349e-01_dp,0.19119e-01_dp,0.25475e-01_dp,0.44576e-01_dp, &
4482 0.62633e-01_dp,0.88006e-01_dp,0.12366e+00_dp,0.17375e+00_dp,0.24414e+00_dp,0.34304e+00_dp, &
4483 0.48201e+00_dp,0.67728e+00_dp,0.95164e+00_dp,0.13372e+01_dp,0.18788e+01_dp,0.26400e+01_dp /
4484 data rsec(1:ndat) / &
4485 0.92832e-03_dp,0.11696e-02_dp,0.14736e-02_dp,0.18566e-02_dp,0.23392e-02_dp,0.29472e-02_dp, &
4486 0.37133e-02_dp,0.46784e-02_dp,0.58944e-02_dp,0.74265e-02_dp,0.93569e-02_dp,0.11789e-01_dp, &
4487 0.14853e-01_dp,0.18714e-01_dp,0.23578e-01_dp,0.29706e-01_dp,0.37427e-01_dp,0.47156e-01_dp, &
4488 0.59412e-01_dp,0.74855e-01_dp,0.94311e-01_dp,0.11882e+00_dp,0.14971e+00_dp,0.18862e+00_dp, &
4489 0.23765e+00_dp,0.29942e+00_dp,0.37724e+00_dp,0.47530e+00_dp,0.59884e+00_dp,0.75449e+00_dp, &
4490 0.95060e+00_dp,0.11977e+01_dp,0.15090e+01_dp /
4491 data rgec(1:ndat) / 0.27144e-03_dp,0.34200e-03_dp,0.43089e-03_dp, &
4492 0.54288e-03_dp,0.68399e-03_dp,0.86177e-03_dp,0.10858e-02_dp,0.13680e-02_dp,0.17235e-02_dp, &
4493 0.21715e-02_dp,0.27360e-02_dp,0.34471e-02_dp,0.43431e-02_dp,0.54719e-02_dp,0.68942e-02_dp, &
4494 0.86861e-02_dp,0.10944e-01_dp,0.13788e-01_dp,0.17372e-01_dp,0.21888e-01_dp,0.27577e-01_dp, &
4495 0.34745e-01_dp,0.43775e-01_dp,0.55154e-01_dp,0.69489e-01_dp,0.87551e-01_dp,0.11031e+00_dp, &
4496 0.13898e+00_dp,0.17510e+00_dp,0.22061e+00_dp,0.27796e+00_dp,0.35020e+00_dp,0.44123e+00_dp /
4497 data rhec(1:ndat) / &
4498 0.20715e-03_dp,0.26099e-03_dp,0.32883e-03_dp,0.41430e-03_dp,0.52198e-03_dp,0.65766e-03_dp, &
4499 0.82860e-03_dp,0.10440e-02_dp,0.13153e-02_dp,0.16572e-02_dp,0.20879e-02_dp,0.26306e-02_dp, &
4500 0.33144e-02_dp,0.41759e-02_dp,0.52613e-02_dp,0.66288e-02_dp,0.83517e-02_dp,0.10523e-01_dp, &
4501 0.13258e-01_dp,0.16703e-01_dp,0.21045e-01_dp,0.26515e-01_dp,0.33407e-01_dp,0.42090e-01_dp, &
4502 0.53030e-01_dp,0.66814e-01_dp,0.84180e-01_dp,0.10606e+00_dp,0.13363e+00_dp,0.16836e+00_dp, &
4503 0.21212e+00_dp,0.26725e+00_dp,0.33672e+00_dp /
4504 data vrl(1:ndat) / &
4505 0.50000e-01_dp,0.78000e-01_dp,0.12000e+00_dp,0.19000e+00_dp,0.31000e+00_dp,0.49000e+00_dp, &
4506 0.77000e+00_dp,0.12000e+01_dp,0.19000e+01_dp,0.30000e+01_dp,0.48000e+01_dp,0.74000e+01_dp, &
4507 0.11000e+02_dp,0.17000e+02_dp,0.26000e+02_dp,0.37000e+02_dp,0.52000e+02_dp,0.71000e+02_dp, &
4508 0.94000e+02_dp,0.12000e+03_dp,0.16000e+03_dp,0.21000e+03_dp,0.26000e+03_dp,0.33000e+03_dp, &
4509 0.41000e+03_dp,0.48000e+03_dp,0.57000e+03_dp,0.66000e+03_dp,0.75000e+03_dp,0.82000e+03_dp, &
4510 0.88000e+03_dp,0.90000e+03_dp,0.90000e+03_dp /
4511 data vri(1:ndat,1) / 0.30000e-01_dp,0.40000e-01_dp,0.60000e-01_dp, &
4512 0.80000e-01_dp,0.11000e+00_dp,0.15000e+00_dp,0.17000e+00_dp,0.18000e+00_dp,0.20000e+00_dp, &
4513 0.25000e+00_dp,0.40000e+00_dp,0.60000e+01_dp,0.10000e+02_dp,0.15000e+02_dp,0.20000e+02_dp, &
4514 0.25000e+02_dp,0.31000e+02_dp,0.37000e+02_dp,0.41000e+02_dp,0.46000e+02_dp,0.51000e+02_dp, &
4515 0.55000e+02_dp,0.59000e+02_dp,0.62000e+02_dp,0.64000e+02_dp,0.67000e+02_dp,0.68000e+02_dp, &
4516 0.69000e+02_dp,0.70000e+02_dp,0.71000e+02_dp,0.71500e+02_dp,0.71750e+02_dp,0.72000e+02_dp /
4517 data vri(1:ndat,2) / &
4518 0.30000e-01_dp,0.40000e-01_dp,0.50000e-01_dp,0.70000e-01_dp,0.90000e-01_dp,0.12000e+00_dp, &
4519 0.50000e+00_dp,0.80000e+00_dp,0.16000e+01_dp,0.18000e+01_dp,0.20000e+01_dp,0.30000e+01_dp, &
4520 0.40000e+01_dp,0.50000e+01_dp,0.80000e+01_dp,0.13000e+02_dp,0.19000e+02_dp,0.26000e+02_dp, &
4521 0.32000e+02_dp,0.38000e+02_dp,0.47000e+02_dp,0.55000e+02_dp,0.65000e+02_dp,0.73000e+02_dp, &
4522 0.77000e+02_dp,0.79000e+02_dp,0.80000e+02_dp,0.81000e+02_dp,0.81000e+02_dp,0.82000e+02_dp, &
4523 0.82000e+02_dp,0.82000e+02_dp,0.82000e+02_dp /
4524 data vri(1:ndat,3) / 0.35000e-01_dp,0.45000e-01_dp,0.55000e-01_dp, &
4525 0.75000e-01_dp,0.95000e-01_dp,0.13000e+00_dp,0.60000e+00_dp,0.90000e+00_dp,0.17000e+01_dp, &
4526 0.20000e+01_dp,0.25000e+01_dp,0.38000e+01_dp,0.50000e+01_dp,0.70000e+01_dp,0.90000e+01_dp, &
4527 0.11000e+02_dp,0.14000e+02_dp,0.17000e+02_dp,0.21000e+02_dp,0.25000e+02_dp,0.32000e+02_dp, &
4528 0.38000e+02_dp,0.44000e+02_dp,0.49000e+02_dp,0.53000e+02_dp,0.55000e+02_dp,0.58000e+02_dp, &
4529 0.59000e+02_dp,0.61000e+02_dp,0.62000e+02_dp,0.63000e+02_dp,0.64000e+02_dp,0.65000e+02_dp /
4530 data vrs(1:ndat) / &
4531 0.20000e-01_dp,0.31000e-01_dp,0.49000e-01_dp,0.77000e-01_dp,0.12000e+00_dp,0.19000e+00_dp, &
4532 0.30000e+00_dp,0.48000e+00_dp,0.76000e+00_dp,0.12000e+01_dp,0.19000e+01_dp,0.30000e+01_dp, &
4533 0.48000e+01_dp,0.75000e+01_dp,0.11000e+02_dp,0.16000e+02_dp,0.21000e+02_dp,0.26000e+02_dp, &
4534 0.34000e+02_dp,0.41000e+02_dp,0.49000e+02_dp,0.57000e+02_dp,0.65000e+02_dp,0.73000e+02_dp, &
4535 0.81000e+02_dp,0.87000e+02_dp,0.93000e+02_dp,0.99000e+02_dp,0.10750e+03_dp,0.11500e+03_dp, &
4536 0.12500e+03_dp,0.13500e+03_dp,0.14500e+03_dp /
4537 data vrg(1:ndat) / 0.39000e-01_dp,0.62000e-01_dp,0.97000e-01_dp, &
4538 0.15000e+00_dp,0.24000e+00_dp,0.38000e+00_dp,0.61000e+00_dp,0.96000e+00_dp,0.15000e+01_dp, &
4539 0.24000e+01_dp,0.38000e+01_dp,0.61000e+01_dp,0.96000e+01_dp,0.15000e+02_dp,0.23000e+02_dp, &
4540 0.31000e+02_dp,0.39000e+02_dp,0.49000e+02_dp,0.59000e+02_dp,0.68000e+02_dp,0.79000e+02_dp, &
4541 0.88000e+02_dp,0.10000e+03_dp,0.11000e+03_dp,0.13000e+03_dp,0.15000e+03_dp,0.17000e+03_dp, &
4542 0.20000e+03_dp,0.23000e+03_dp,0.26000e+03_dp,0.30000e+03_dp,0.35000e+03_dp,0.40000e+03_dp /
4543 data vrh(1:ndat) / &
4544 0.53000e-01_dp,0.84000e-01_dp,0.13000e+00_dp,0.21000e+00_dp,0.33000e+00_dp,0.52000e+00_dp, &
4545 0.82000e+00_dp,0.13000e+01_dp,0.21000e+01_dp,0.33000e+01_dp,0.52000e+01_dp,0.82000e+01_dp, &
4546 0.13000e+02_dp,0.20000e+02_dp,0.28000e+02_dp,0.36000e+02_dp,0.46000e+02_dp,0.56000e+02_dp, &
4547 0.67000e+02_dp,0.80000e+02_dp,0.97000e+02_dp,0.12000e+03_dp,0.14000e+03_dp,0.17000e+03_dp, &
4548 0.20000e+03_dp,0.24000e+03_dp,0.29000e+03_dp,0.35000e+03_dp,0.42000e+03_dp,0.51000e+03_dp, &
4549 0.61000e+03_dp,0.74000e+03_dp,0.89000e+03_dp /
4550 data blkradl(1:ndat) / &
4551 0.20000e-03_dp,0.25198e-03_dp,0.31748e-03_dp,0.40000e-03_dp,0.50397e-03_dp,0.63496e-03_dp, &
4552 0.80000e-03_dp,0.10079e-02_dp,0.12699e-02_dp,0.16000e-02_dp,0.20159e-02_dp,0.25398e-02_dp, &
4553 0.32000e-02_dp,0.40317e-02_dp,0.50797e-02_dp,0.64000e-02_dp,0.80635e-02_dp,0.10159e-01_dp, &
4554 0.12800e-01_dp,0.16127e-01_dp,0.20319e-01_dp,0.25600e-01_dp,0.32254e-01_dp,0.40637e-01_dp, &
4555 0.51200e-01_dp,0.64508e-01_dp,0.81275e-01_dp,0.10240e+00_dp,0.12902e+00_dp,0.16255e+00_dp, &
4556 0.20480e+00_dp,0.25803e+00_dp,0.32510e+00_dp /
4557 data blkradi(1:ndat,1) / 0.57452e-03_dp,0.72384e-03_dp,0.91199e-03_dp, &
4558 0.11490e-02_dp,0.14477e-02_dp,0.18240e-02_dp,0.22981e-02_dp,0.28954e-02_dp,0.36479e-02_dp, &
4559 0.45961e-02_dp,0.57908e-02_dp,0.72959e-02_dp,0.11572e-01_dp,0.14770e-01_dp,0.18851e-01_dp, &
4560 0.24060e-01_dp,0.30709e-01_dp,0.39194e-01_dp,0.50025e-01_dp,0.63848e-01_dp,0.81491e-01_dp, &
4561 0.10401e+00_dp,0.13275e+00_dp,0.16943e+00_dp,0.21625e+00_dp,0.27601e+00_dp,0.35228e+00_dp, &
4562 0.44962e+00_dp,0.57387e+00_dp,0.73244e+00_dp,0.93484e+00_dp,0.11932e+01_dp,0.15229e+01_dp /
4563 data blkradi(1:ndat,2) / &
4564 0.20715e-03_dp,0.26099e-03_dp,0.32912e-03_dp,0.43555e-03_dp,0.57638e-03_dp,0.76276e-03_dp, &
4565 0.10094e-02_dp,0.13358e-02_dp,0.17677e-02_dp,0.23394e-02_dp,0.30958e-02_dp,0.40969e-02_dp, &
4566 0.54216e-02_dp,0.71748e-02_dp,0.94948e-02_dp,0.12565e-01_dp,0.16628e-01_dp,0.22005e-01_dp, &
4567 0.29120e-01_dp,0.38537e-01_dp,0.50998e-01_dp,0.67488e-01_dp,0.89311e-01_dp,0.11819e+00_dp, &
4568 0.15641e+00_dp,0.20698e+00_dp,0.27391e+00_dp,0.36249e+00_dp,0.47970e+00_dp,0.63481e+00_dp, &
4569 0.84009e+00_dp,0.11117e+01_dp,0.14712e+01_dp /
4570 data blkradi(1:ndat,3) / 0.23559e-03_dp,0.29682e-03_dp,0.37397e-03_dp, &
4571 0.47118e-03_dp,0.59365e-03_dp,0.74795e-03_dp,0.95894e-03_dp,0.12777e-02_dp,0.17025e-02_dp, &
4572 0.22685e-02_dp,0.30227e-02_dp,0.40275e-02_dp,0.53665e-02_dp,0.71506e-02_dp,0.95278e-02_dp, &
4573 0.12695e-01_dp,0.16916e-01_dp,0.22539e-01_dp,0.30032e-01_dp,0.40017e-01_dp,0.70019e-01_dp, &
4574 0.98384e-01_dp,0.13824e+00_dp,0.19424e+00_dp,0.27293e+00_dp,0.38350e+00_dp,0.53885e+00_dp, &
4575 0.75714e+00_dp,0.10639e+01_dp,0.14948e+01_dp,0.21004e+01_dp,0.29513e+01_dp,0.41469e+01_dp /
4576 data blkrads(1:ndat) / &
4577 0.20715e-03_dp,0.26148e-03_dp,0.33067e-03_dp,0.41710e-03_dp,0.52691e-03_dp,0.66640e-03_dp, &
4578 0.84289e-03_dp,0.10674e-02_dp,0.13513e-02_dp,0.17129e-02_dp,0.21670e-02_dp,0.27521e-02_dp, &
4579 0.34989e-02_dp,0.44777e-02_dp,0.57347e-02_dp,0.75389e-02_dp,0.99020e-02_dp,0.13161e-01_dp, &
4580 0.17372e-01_dp,0.23337e-01_dp,0.31058e-01_dp,0.41194e-01_dp,0.55153e-01_dp,0.74854e-01_dp, &
4581 0.99806e-01_dp,0.13463e+00_dp,0.18136e+00_dp,0.24282e+00_dp,0.32955e+00_dp,0.44123e+00_dp, &
4582 0.59884e+00_dp,0.77090e+00_dp,0.99387e+00_dp /
4583 data blkradg(1:ndat) / 0.27144e-03_dp,0.34200e-03_dp,0.43089e-03_dp, &
4584 0.54288e-03_dp,0.68399e-03_dp,0.86177e-03_dp,0.10858e-02_dp,0.13680e-02_dp,0.17235e-02_dp, &
4585 0.21715e-02_dp,0.27360e-02_dp,0.34471e-02_dp,0.43431e-02_dp,0.54719e-02_dp,0.68942e-02_dp, &
4586 0.86861e-02_dp,0.10944e-01_dp,0.13788e-01_dp,0.17372e-01_dp,0.21888e-01_dp,0.27577e-01_dp, &
4587 0.34745e-01_dp,0.43775e-01_dp,0.55154e-01_dp,0.69489e-01_dp,0.87551e-01_dp,0.11031e+00_dp, &
4588 0.13898e+00_dp,0.17510e+00_dp,0.22061e+00_dp,0.27796e+00_dp,0.35020e+00_dp,0.44123e+00_dp /
4589 data blkradh(1:ndat) / &
4590 0.20715e-03_dp,0.26099e-03_dp,0.32883e-03_dp,0.41430e-03_dp,0.52198e-03_dp,0.65766e-03_dp, &
4591 0.82860e-03_dp,0.10440e-02_dp,0.13153e-02_dp,0.16572e-02_dp,0.20879e-02_dp,0.26306e-02_dp, &
4592 0.33144e-02_dp,0.41759e-02_dp,0.52613e-02_dp,0.66288e-02_dp,0.83517e-02_dp,0.10523e-01_dp, &
4593 0.13258e-01_dp,0.16703e-01_dp,0.21045e-01_dp,0.26515e-01_dp,0.33407e-01_dp,0.42090e-01_dp, &
4594 0.53030e-01_dp,0.66814e-01_dp,0.84180e-01_dp,0.10606e+00_dp,0.13363e+00_dp,0.16836e+00_dp, &
4595 0.21212e+00_dp,0.26725e+00_dp,0.33672e+00_dp /
4596 data blkdnsl(1:ndat) / &
4597 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4598 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4599 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4600 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4601 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp, &
4602 0.10000e+01_dp,0.10000e+01_dp,0.10000e+01_dp /
4603 data blkdnsi(1:ndat,1) / 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4604 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4605 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.87368e+00_dp,0.87072e+00_dp,0.86777e+00_dp, &
4606 0.86483e+00_dp,0.86189e+00_dp,0.85897e+00_dp,0.85606e+00_dp,0.85316e+00_dp,0.85026e+00_dp, &
4607 0.84738e+00_dp,0.84451e+00_dp,0.84164e+00_dp,0.83879e+00_dp,0.83595e+00_dp,0.83311e+00_dp, &
4608 0.83029e+00_dp,0.82747e+00_dp,0.82467e+00_dp,0.82187e+00_dp,0.81908e+00_dp,0.81631e+00_dp /
4609 data blkdnsi(1:ndat,2) / &
4610 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4611 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4612 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4613 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4614 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4615 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp /
4616 data blkdnsi(1:ndat,3) / 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4617 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4618 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp, &
4619 0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.61183e+00_dp,0.51790e+00_dp, &
4620 0.45557e+00_dp,0.40075e+00_dp,0.35252e+00_dp,0.31010e+00_dp,0.27278e+00_dp,0.23995e+00_dp, &
4621 0.21108e+00_dp,0.18567e+00_dp,0.16333e+00_dp,0.14367e+00_dp,0.12638e+00_dp,0.11118e+00_dp /
4622 data blkdnss(1:ndat) / &
4623 0.90000e+00_dp,0.89500e+00_dp,0.88500e+00_dp,0.88200e+00_dp,0.87500e+00_dp,0.86500e+00_dp, &
4624 0.85500e+00_dp,0.84200e+00_dp,0.83000e+00_dp,0.81500e+00_dp,0.80500e+00_dp,0.78600e+00_dp, &
4625 0.76500e+00_dp,0.73000e+00_dp,0.69500e+00_dp,0.61183e+00_dp,0.54000e+00_dp,0.46000e+00_dp, &
4626 0.40000e+00_dp,0.33000e+00_dp,0.28000e+00_dp,0.24000e+00_dp,0.20000e+00_dp,0.16000e+00_dp, &
4627 0.13500e+00_dp,0.11000e+00_dp,0.90000e-01_dp,0.75000e-01_dp,0.60000e-01_dp,0.50000e-01_dp, &
4628 0.40000e-01_dp,0.37500e-01_dp,0.35000e-01_dp /
4629 data blkdnsg(1:ndat) / &
4630 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4631 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4632 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4633 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4634 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp, &
4635 0.40000e+00_dp,0.40000e+00_dp,0.40000e+00_dp /
4636 data blkdnsh(1:ndat) / &
4637 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4638 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4639 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4640 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4641 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp, &
4642 0.90000e+00_dp,0.90000e+00_dp,0.90000e+00_dp /
4646 xmss( il,k ) = log( dble( xl( k ) )*1.e-03_dp )
4647 xmss( ic,k ) = log( dble( xi( k,1 ) )*1.e-03_dp )
4648 xmss( ip,k ) = log( dble( xi( k,2 ) )*1.e-03_dp )
4649 xmss( id,k ) = log( dble( xi( k,3 ) )*1.e-03_dp )
4650 xmss( is,k ) = log( dble( xs( k ) )*1.e-03_dp )
4651 xmss( ig,k ) = log( dble( xg( k ) )*1.e-03_dp )
4652 xmss( ih,k ) = log( dble( xh( k ) )*1.e-03_dp )
4657 zcap( il,k ) = dble(rlec( k ))*1.e-02_dp
4658 zcap( ic,k ) = dble(riec( k,1 ))*1.e-02_dp
4659 zcap( ip,k ) = dble(riec( k,2 ))*1.e-02_dp
4660 zcap( id,k ) = dble(riec( k,3 ))*1.e-02_dp
4661 zcap( is,k ) = dble(rsec( k ))*1.e-02_dp
4662 zcap( ig,k ) = dble(rgec( k ))*1.e-02_dp
4663 zcap( ih,k ) = dble(rhec( k ))*1.e-02_dp
4668 vtrm( il,k ) = dble(vrl( k ))*1.e-02_dp
4669 vtrm( ic,k ) = dble(vri( k,1 ))*1.e-02_dp
4670 vtrm( ip,k ) = dble(vri( k,2 ))*1.e-02_dp
4671 vtrm( id,k ) = dble(vri( k,3 ))*1.e-02_dp
4672 vtrm( is,k ) = dble(vrs( k ))*1.e-02_dp
4673 vtrm( ig,k ) = dble(vrg( k ))*1.e-02_dp
4674 vtrm( ih,k ) = dble(vrh( k ))*1.e-02_dp
4679 blkr( il,k ) = dble(blkradl( k ))*10.0_dp
4680 blkr( ic,k ) = dble(blkradi( k,1 ))*10.0_dp
4681 blkr( ip,k ) = dble(blkradi( k,2 ))*10.0_dp
4682 blkr( id,k ) = dble(blkradi( k,3 ))*10.0_dp
4683 blkr( is,k ) = dble(blkrads( k ))*10.0_dp
4684 blkr( ig,k ) = dble(blkradg( k ))*10.0_dp
4685 blkr( ih,k ) = dble(blkradh( k ))*10.0_dp
4690 blkd( il,k ) = dble(blkdnsl( k ))*1000._dp
4691 blkd( ic,k ) = dble(blkdnsi( k,1 ))*1000._dp
4692 blkd( ip,k ) = dble(blkdnsi( k,2 ))*1000._dp
4693 blkd( id,k ) = dble(blkdnsi( k,3 ))*1000._dp
4694 blkd( is,k ) = dble(blkdnss( k ))*1000._dp
4695 blkd( ig,k ) = dble(blkdnsg( k ))*1000._dp
4696 blkd( ih,k ) = dble(blkdnsh( k ))*1000._dp
4705 ykrn( k,kk,i,j ) = kernels( k,kk,i,j )*1.e-06_dp
4712 end subroutine rdkdat
4716 real(DP) :: xsta, xend
4718 real(DP):: pi_dp = 3.1415920_dp
4719 real(DP):: rhow_dp = 1.0e+03_dp
4721 xsta = log( rhow_dp * 4.0_dp*pi_dp/3.0_dp * ( 3.e-06_dp )**3.0_dp )
4722 xend = log( rhow_dp * 4.0_dp*pi_dp/3.0_dp * ( 3.e-03_dp )**3.0_dp )
4724 dxmic_mk = ( xend-xsta )/
nbin 4727 xbnd_mk( n ) = xsta + dxmic_mk*( n-1 )
4730 xctr_mk( n ) = ( xbnd_mk( n )+xbnd_mk( n+1 ) )*0.50_dp
4731 radc_mk( n ) = ( exp( xctr_mk( n ) )*3.0_dp/4.0_dp/pi_dp/rhow_dp )**( 1.0_dp/3.0_dp )
4734 end subroutine sdfgrid
4742 cctr_mk( myu,n ) = fcpc( myu,xctr_mk( n ) )
4745 cbnd_mk( myu,n ) = fcpc( myu,xbnd_mk( n ) )
4749 end subroutine getcp
4751 function fcpc( myu,x )
4753 integer,
intent(in) :: myu
4754 real(DP),
intent(in) :: x
4757 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4760 ( ndat, kdeg, xmss( myu,: ), &
4764 ( ndat, kdeg, qknt, xmss( myu,: ), &
4768 ( ndat, kdeg, elm, zcap( myu,: ), &
4771 fcpc = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4777 integer :: myu, nyu, i, j
4782 else if(
kphase == 1 )
then 4784 else if(
kphase == 2 )
then 4793 ck_mk( myu,nyu,i,j ) = fckrn( myu,nyu,xctr_mk( i ),xctr_mk( j ) )
4801 end subroutine getck
4803 function fckrn( myu,nyu,x,y )
4805 integer,
intent(in) :: myu, nyu
4806 real(DP),
intent(in) :: x, y
4809 real(DP) :: qknt( ndat+kdeg ), rknt( ndat+kdeg )
4810 real(DP) :: coef( ndat,ndat )
4812 real(DP) :: xlrg, xsml, vlrg, vsml, rlrg
4813 real(DP):: pi_dp = 3.1415920_dp
4814 real(DP):: rhow_dp = 1.0e+03_dp
4818 ( ndat, kdeg, xmss( myu,: ), &
4821 rknt( : ) = qknt( : )
4824 ( ndat, ndat, kdeg, kdeg, &
4825 xmss( myu,: ), xmss( nyu,: ), &
4827 ykrn( myu,nyu,:,: ), &
4831 ( ndat, ndat, kdeg, kdeg, &
4833 xmss( myu,: ), xmss( nyu,: ), &
4835 else if(
kphase == 1 )
then 4839 vlrg = (exp( xlrg ) / rhow_dp )*1.e+06_dp
4840 vsml = (exp( xsml ) / rhow_dp )*1.e+06_dp
4842 rlrg = ( exp( xlrg )/( 4.0_dp*pi_dp*rhow_dp )*3.0_dp )**(1.0_dp/3.0_dp )*1.e+06_dp
4844 if( rlrg <=50.0_dp )
then 4845 fckrn = 9.44e+03_dp*( vlrg*vlrg + vsml*vsml )
4847 fckrn = 5.78e-03_dp*( vlrg+vsml )
4849 else if(
kphase == 2 )
then 4850 fckrn = 1.5_dp*( exp(x) +exp(y) )
4863 vt_mk( myu,n ) = max( fvterm( myu,xctr_mk( n ) ), 0.0_dp )
4867 end subroutine getvt
4869 function fvterm( myu,x )
4871 integer,
intent(in) :: myu
4872 real(DP),
intent(in) :: x
4875 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4878 ( ndat, kdeg, xmss( myu,: ), &
4882 ( ndat, kdeg, qknt, xmss( myu,: ), &
4886 ( ndat, kdeg, elm, vtrm( myu,: ), &
4889 fvterm = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4899 br_mk( myu,n ) = fbulkrad( myu, xctr_mk( n ) )
4903 end subroutine getbr
4905 function fbulkrad( myu,x )
4907 integer,
intent(in) :: myu
4908 real(DP),
intent(in) :: x
4909 real(DP) :: fbulkrad
4911 real(DP) :: qknt( ndat+kdeg ), elm( ndat,ndat ), coef( ndat )
4914 ( ndat, kdeg, xmss( myu,: ), &
4918 ( ndat, kdeg, qknt, xmss( myu,: ), &
4922 ( ndat, kdeg, elm, blkr( myu,: ), &
4925 fbulkrad = fspline( ndat, kdeg, coef, qknt, xmss( myu,: ), x )
4927 end function fbulkrad
4931 integer :: myu, nyu, i, j, n
4933 open ( fid_micpara, file = fname_micpara, form =
'formatted', status=
'new' )
4935 write( fid_micpara,* ) nspc_mk,
nbin 4939 xctr( n ) = xctr_mk( n )
4940 radc( n ) = radc_mk( n )
4941 write( fid_micpara,* ) n, xctr( n ), radc( n )
4944 xbnd( n ) = xbnd_mk( n )
4945 write( fid_micpara,* ) n, xbnd( n )
4947 write( fid_micpara,* ) dxmic_mk
4952 cctr( n,myu ) = cctr_mk( myu,n )
4953 write( fid_micpara,* ) myu, n, cctr( n,myu )
4956 cbnd( n,myu ) = cbnd_mk( myu,n )
4957 write( fid_micpara,* ) myu, n, cbnd( n,myu )
4966 ck( myu,nyu,i,j ) = ck_mk( myu,nyu,i,j )
4967 write( fid_micpara,* ) myu, nyu, i, j, ck( myu,nyu,i,j )
4976 vt( myu,n ) = vt_mk( myu,n )
4977 write( fid_micpara,* ) myu, n, vt( myu,n )
4984 br( myu,n ) = br_mk( myu,n )
4985 write( fid_micpara,* ) myu, n, br( myu,n )
4989 close ( fid_micpara )
4991 end subroutine paraout
4995 subroutine tinvss(n,a,dt,e,nn,iw,inder)
4999 integer,
intent(in) :: n, nn
5000 integer,
intent(inout) :: inder
5001 real(DP),
intent(inout) :: a(nn,n)
5002 real(DP),
intent(inout) :: dt
5003 real(DP),
intent(in) :: e
5004 integer,
intent(inout) :: iw( 2*n )
5005 integer :: i, j, k, kk, ij, nnn
5006 real(DP) :: work, aa, az, eps
5007 integer :: ipiv, jpiv
5014 elseif( n == 1 )
then 5016 elseif( n > 1 )
then 5023 write(6,690)
"n= ", n,
"nn= ", nn, &
5024 "n should be less than or equal to nn in TINVSS" 5025 690
format(a8,i5,5x,a4,i5,a55)
5035 if( abs(a(i,j)) <= abs(piv) )
goto 110
5043 if( abs(piv) <= eps )
goto 920
5044 if( k == 1 ) eps = abs(piv)*e
5045 if( ipiv == k )
goto 130
5053 if( jpiv == k )
goto 150
5068 if( i == k )
goto 220
5070 if( az == 0.0_dp )
goto 220
5072 a(i,j) = a(i,j)-a(k,j)*az
5082 if( ij == k )
goto 420
5090 if( ij == k )
goto 400
5103 write(*,691)
"n= ", n,
"should be positive in TINVSS" 5104 691
format(a8,i5,5x,a30)
5112 write(*,692)
'given matrix A to TINVSS is ill conditioned, or sigular withrank =', nnn, &
5113 'return with no further calculation' 5114 692
format(a,1x,i4,1x,a)
5120 if( dt == 0.0_dp )
goto 920
5121 a(1,1) = 1.0_dp/a(1,1)
5124 end subroutine tinvss
5126 subroutine getknot &
5127 ( ndat, kdeg, xdat, &
5130 integer,
intent(in) :: ndat
5131 integer,
intent(in) :: kdeg
5132 real(DP),
intent(in) :: xdat( ndat )
5134 real(DP),
intent(out) :: qknt( ndat+kdeg )
5140 qknt( i ) = xdat( 1 )
5144 qknt( i+kdeg ) = ( xdat( i )+xdat( i+kdeg ) )*0.50_dp
5148 qknt( ndat+i ) = xdat( ndat )
5153 end subroutine getknot
5155 recursive function fbspl ( ndat, inum, kdeg, qknt, xdat, x ) &
5160 integer,
intent(in) :: ndat
5161 integer,
intent(in) :: inum
5162 integer,
intent(in) :: kdeg
5163 real(DP),
intent(in) :: qknt( ndat+kdeg )
5164 real(DP),
intent(in) :: xdat( ndat )
5165 real(DP),
intent(in) :: x
5168 real(DP) :: bsp1, bsp2
5170 if ( ( inum == 1 .AND. x == xdat( 1 ) ) .OR. &
5171 ( inum == ndat .AND. x == xdat( ndat ) ) )
then 5176 if ( kdeg == 1 )
then 5177 if ( x >= qknt( inum ) .AND. x < qknt( inum+1 ) )
then 5183 if ( qknt( inum+kdeg-1 ) /= qknt( inum ) )
then 5184 bsp1 = ( x-qknt( inum ) ) &
5185 /( qknt( inum+kdeg-1 )-qknt( inum ) ) &
5186 * fbspl( ndat, inum, kdeg-1, qknt, xdat, x )
5190 if ( qknt( inum+kdeg ) /= qknt( inum+1 ) )
then 5191 bsp2 = ( qknt( inum+kdeg )-x ) &
5192 /( qknt( inum+kdeg )-qknt( inum+1 ) ) &
5193 * fbspl( ndat, inum+1, kdeg-1, qknt, xdat, x )
5202 function fpb( ndat, i, kdeg, qknt, xdat, elm, x )
5205 integer :: ndat, i, kdeg
5206 real(DP) :: qknt( ndat+kdeg ), xdat( ndat ), elm( ndat,ndat )
5214 sum = sum + elm( l,i )*fbspl( ndat, l, kdeg, qknt, xdat, x )
5221 subroutine getmatrx &
5222 ( ndat, kdeg, qknt, xdat, &
5227 integer,
intent(in) :: ndat
5228 integer,
intent(in) :: kdeg
5229 real(DP),
intent(in) :: qknt( ndat+kdeg )
5230 real(DP),
intent(in) :: xdat( ndat )
5232 real(DP),
intent(out) :: elm( ndat,ndat )
5236 integer :: iw( 2*ndat ), i, j, inder
5237 real(DP),
parameter :: eps = 0.
5241 elm( i,j ) = fbspl( ndat, j, kdeg, qknt, xdat, xdat( i ) )
5245 call tinvss( ndat, elm, dt, eps, ndat, iw, inder )
5249 end subroutine getmatrx
5251 subroutine getcoef &
5252 ( ndat, kdeg, elm, ydat, &
5255 integer,
intent(in) :: ndat
5256 integer,
intent(in) :: kdeg
5257 real(DP),
intent(in) :: elm( ndat,ndat )
5258 real(DP),
intent(in) :: ydat( ndat )
5260 real(DP),
intent(out) :: coef( ndat )
5269 sum = sum + elm( i,j )*ydat( j )
5276 end subroutine getcoef
5278 function fspline ( ndat, kdeg, coef, qknt, xdat, x )
5280 integer,
intent(in) :: ndat
5281 integer,
intent(in) :: kdeg
5282 real(DP),
intent(in) :: coef( ndat )
5283 real(DP),
intent(in) :: qknt( ndat+kdeg )
5284 real(DP),
intent(in) :: xdat( ndat )
5285 real(DP),
intent(in) :: x
5295 sum = sum + coef( i )*fbspl( ndat, i, kdeg, qknt, xdat, x )
5302 end function fspline
5304 subroutine getcoef2 &
5305 ( mdat, ndat, kdeg, ldeg, &
5306 xdat, ydat, qknt, rknt, zdat, &
5311 integer,
intent(in) :: mdat
5312 integer,
intent(in) :: ndat
5313 integer,
intent(in) :: kdeg
5314 integer,
intent(in) :: ldeg
5315 real(DP),
intent(in) :: xdat( mdat )
5316 real(DP),
intent(in) :: ydat( ndat )
5317 real(DP),
intent(in) :: qknt( mdat+kdeg )
5318 real(DP),
intent(in) :: rknt( ndat+ldeg )
5319 real(DP),
intent(in) :: zdat( mdat,ndat )
5321 real(DP),
intent(out) :: coef( mdat,ndat )
5324 real(DP) :: elmx( mdat,mdat ), elmy( ndat,ndat )
5325 integer :: iw1( 2*mdat ), iw2( 2*ndat )
5326 real(DP) :: beta( mdat,ndat ), sum, dt
5327 real(DP),
parameter :: eps = 0.0_dp
5328 integer :: i, j, k, l, inder
5332 elmx( i,j ) = fbspl( mdat, j, kdeg, qknt, xdat, xdat( i ) )
5335 call tinvss( mdat, elmx, dt, eps, mdat, iw1, inder )
5341 sum = sum + elmx( i,j )*zdat( j,l )
5349 elmy( i,j ) = fbspl( ndat, j, ldeg, rknt, ydat, ydat( i ) )
5352 call tinvss( ndat, elmy, dt, eps, ndat, iw2, inder )
5358 sum = sum + elmy( i,j )*beta( k,j )
5366 end subroutine getcoef2
5369 ( mdat, ndat, kdeg, ldeg, &
5370 coef, qknt, rknt, xdat, ydat, &
5373 integer,
intent(in) :: mdat
5374 integer,
intent(in) :: ndat
5375 integer,
intent(in) :: kdeg
5376 integer,
intent(in) :: ldeg
5377 real(DP),
intent(in) :: coef( mdat,ndat )
5378 real(DP),
intent(in) :: qknt( mdat+kdeg )
5379 real(DP),
intent(in) :: rknt( ndat+ldeg )
5380 real(DP),
intent(in) :: xdat( mdat ), ydat( ndat )
5381 real(DP),
intent(in) :: x, y
5383 real(DP) :: fspline2
5386 real(DP) :: sum, add
5392 add = coef( i,j )*fbspl( mdat, i, kdeg, qknt, xdat, x ) &
5393 *fbspl( ndat, j, ldeg, rknt, ydat, y )
5402 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 atmos_phy_mp_suzuki10_config(MP_TYPE, QA, QS)
Config.
subroutine, public prc_mpistop
Abort MPI.
subroutine mp_suzuki10(ijkmax, ijkmax_cold, ijkmax_warm, index_cold, index_warm, dens, pres, ccn, temp, qvap, ghyd, gaer, evaporate, dt)
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K]
real(rp), parameter, public const_dwatr
density of water [kg/m3]
subroutine, public atmos_phy_mp_negative_fixer(DENS, RHOT, QTRC, I_QV, limit_negative)
Negative fixer.
real(rp), dimension(qa_max), public tracer_r
real(dp), public time_dtsec_atmos_phy_mp
time interval of physics(microphysics) [sec]
integer, parameter, public i_hs
snow
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
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K]
integer, parameter, public i_hr
liquid water rain
integer, parameter, public i_hi
ice water cloud
integer, public ke
end point of inner domain: z, local
character(len=h_short), dimension(:), allocatable, target, public atmos_phy_mp_suzuki10_unit
real(rp), parameter, public const_tem00
temperature reference (0C) [K]
subroutine, public atmos_phy_mp_suzuki10_setup
Setup.
integer, parameter, public i_hh
hail
real(rp), parameter, public const_tmelt
real(rp), parameter, public const_dice
density of ice [kg/m3]
real(rp), dimension(qa_max), public tracer_cv
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.
logical, public io_nml
output log or not? (for namelist, this process)
integer, public ia
of whole cells: x, 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 whole cells: z, local, with HALO
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
character(len=h_short), dimension(:), allocatable, target, public atmos_phy_mp_suzuki10_name
subroutine, public atmos_phy_mp_suzuki10_cloudfraction(cldfrac, QTRC, mask_criterion)
Calculate Cloud Fraction.
real(rp), public const_grav
standard acceleration of gravity [m/s2]
integer, public js
start point of inner domain: y, local
real(rp), dimension(n_hyd), target, public atmos_phy_mp_suzuki10_dens
real(rp), public const_epsvap
Rdry / Rvap.
real(rp), public lovr_ice
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K]
integer, parameter, public i_hc
liquid water cloud
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 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, public atmos_hydrometeor_regist(Q0, NV, NL, NI, NAME, DESC, UNIT, ADVC)
Regist tracer.
subroutine r_collcoag(ijkmax, swgt, temp, gc, dtime)
real(rp), public const_pi
pi
subroutine, public atmos_phy_mp_precipitation(QA_MP, QS_MP, qflx, vterm, DENS, MOMZ, MOMX, MOMY, RHOE, QTRC, temp, CVq, dt, vt_fixed)
precipitation transport
character(len=h_mid), dimension(:), allocatable, target, public atmos_phy_mp_suzuki10_desc
integer, public io_fid_conf
Config file ID.
subroutine, public tracer_regist(QS, NQ, NAME, DESC, UNIT, CV, CP, R, ADVC, MASS)
Regist tracer.
integer, public io_fid_log
Log file ID.
integer, parameter, public n_hyd
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
integer, parameter, public i_hg
graupel
integer, public io_fid_nml
Log file ID (only for output namelist)
real(rp), dimension(qa_max), public tracer_mass
real(rp), public cpovr_ice
integer, public ja
of whole cells: y, local, with HALO