9512 & (nx,ny,nz,na,jyslab &
9513 & ,nor,norz,dtp,nxi &
9520 & ,ssfilt,t00,t77,flag_qndrop &
9527 integer :: nx,ny,nz,na,nxi
9528 integer :: nor,norz, jyslab
9530 logical :: flag_qndrop
9532 integer,
parameter :: ng1 = 1
9538 real t00(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9539 real t77(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9541 real t0(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9550 real t9(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9553 real p2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9554 real pn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9555 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
9556 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9558 real w(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9561 real ssfilt(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9564 real pb(-norz+ng1:nz+norz)
9565 real pinit(-norz+ng1:nz+norz)
9567 real dz3d(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9573 real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
9577 real :: ccnefactwo, sstmp, cn1, cnuctmp
9582 real,
parameter :: cwmas30 = 1000.*0.523599*(2.*30.e-6)**3
9583 real,
parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3
9584 integer nxmpb,nzmpb,nxz
9585 integer mgs,ngs,numgs,inumgs
9586 integer ngscnt,igs(ngs),kgs(ngs)
9587 integer kgsp(ngs),kgsm(ngs)
9590 integer ix,kz,i,n, kp1, km1
9592 integer ixb,ixe,jyb,jye,kzb,kze
9594 integer itile,jtile,ktile
9595 integer ixend,jyend,kzend,kzbeg
9596 integer nxend,nyend,nzend,nzbeg
9603 real ccnc(ngs), ccna(ngs), cnuc(ngs), cwnccn(ngs)
9604 real :: ccnc_nu(ngs), ccnc_ac(ngs), ccnc_co(ngs)
9607 parameter( sscb = 2.0 )
9609 parameter( idecss = 1 )
9615 parameter( ifilt = 0 )
9625 real,
parameter :: aa1 = 9.44e15, aa2 = 5.78e3
9627 real ec0, ex1, ft, rhoinv(ngs)
9631 real ac1,bc, taus, c1,d1,e1,f1,p380,tmp,tmp2
9632 real tmpmx, fw, qctmp
9634 double precision :: vent1,vent2
9638 real d1r, d1i, d1s, e1i
9640 real dtcon,dtcon1,dtcon2
9642 integer ltemq1,ltemq1m
9643 real dqv,qv1,ss1,ss2,qvs1,dqvs,dtemp,dt1
9645 real ssi1, ssi2, dqvi, dqvis, dqvii,qis1
9646 real dqvr, dqc, dqr, dqi, dqs
9647 real qv1m,qvs1m,ss1m,ssi1m,qis1m
9651 real cn(ngs), cnuf(ngs)
9660 real ssf(ngs),ssfkp1(ngs),ssfkm1(ngs),ssat0(ngs)
9661 real,
parameter :: ssfcut = 4.0
9662 real ssfjp1(ngs),ssfjm1(ngs)
9663 real ssfip1(ngs),ssfim1(ngs)
9666 parameter(supcb=0.5,supmx=238.0)
9667 real r2dxm, r2dym, r2dzm
9668 real dssdz, dssdy, dssdx
9671 parameter(epsi = 0.622, d = 0.266)
9674 real vr,nrx,qr,z1,z2,rdi,alp,xnutmp,xnuc
9681 real dqvcnd(ngs),dqwv(ngs),dqcw(ngs),dqci(ngs)
9682 real temp(ngs),tempc(ngs)
9683 real temg(ngs),temcg(ngs),theta(ngs),qvap(ngs)
9684 real temgx(ngs),temcgx(ngs)
9685 real qvs(ngs),qis(ngs),qss(ngs),pqs(ngs)
9686 real felv(ngs),felf(ngs),fels(ngs)
9687 real felvcp(ngs),felvpi(ngs)
9688 real gamw(ngs),gams(ngs)
9689 real tsqr(ngs),ssi(ngs),ssw(ngs)
9690 real cc3(ngs),cqv1(ngs),cqv2(ngs)
9691 real qcwtmp(ngs),qtmp
9694 real fwvdf(ngs),ftka(ngs),fthdf(ngs)
9695 real fadvisc(ngs),fakvisc(ngs)
9696 real fci(ngs),fcw(ngs)
9697 real fschm(ngs),fpndl(ngs)
9699 real pres(ngs),pipert(ngs)
9701 real rho0(ngs),pi0(ngs)
9703 real thetap(ngs),theta0(ngs),qwvp(ngs),qv0(ngs)
9707 real wvel(ngs),wvelkm1(ngs)
9709 real wvdf(ngs),tka(ngs)
9715 real :: qx(ngs,lv:lhab)
9716 real :: cx(ngs,lc:lhab)
9717 real :: xv(ngs,lc:lhab)
9718 real :: xmas(ngs,lc:lhab)
9719 real :: xdn(ngs,lc:lhab)
9720 real :: xdia(ngs,lc:lhab,3)
9721 real :: alpha(ngs,lc:lhab)
9722 real :: zx(ngs,lr:lhab)
9725 logical zerocx(lc:lqmx)
9729 integer,
parameter :: iunit = 0
9731 real :: frac, hwdn, tmpg
9735 real,
parameter :: cpv = 1885.0
9754 IF ( ac_opt > 0 ) ccnefactwo = (1.63e-3/(cck * beta(3./2., cck/2.)))**(1.0/(cck + 2.0))
9755 f5 = 237.3 * 17.27 * 2.5e6 / cp
9762 IF ( ipconc <= 1 .or. isedonly == 2 )
GOTO 2200
9775 temp1 = an(ix,jy,kz,lt)*t77(ix,jy,kz)
9776 t0(ix,jy,kz) = temp1
9777 ltemq = int( (temp1-163.15)/fqsat+1.5 )
9778 ltemq = min( nqsat, max(1,ltemq) )
9780 c1 = t00(ix,jy,kz)*tabqvs(ltemq)
9783 ssfilt(ix,jy,kz) = 100.*(an(ix,jy,kz,lv)/c1 - 1.0)
9799 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Gather stage'
9807 do 2000 inumgs = 1,numgs
9822 pqs(1) = 380.0/(pn(ix,jy,kz) + pb(kz))
9823 theta(1) = an(ix,jy,kz,lt)
9824 temg(1) = t0(ix,jy,kz)
9826 temcg(1) = temg(1) - tfr
9827 ltemq = (temg(1)-163.15)/fqsat+1.5
9828 ltemq = min( nqsat, max(1,ltemq) )
9829 qvs(1) = pqs(1)*tabqvs(ltemq)
9830 qis(1) = pqs(1)*tabqis(ltemq)
9835 if ( temg(1) .lt. tfr )
then
9838 if ( (temg(1) .gt. tfrh .or. an(ix,jy,kz,lv)/qvs(1) > maxlowtempss ) .and. &
9839 & ( an(ix,jy,kz,lv) .gt. qss(1) .or. &
9840 & an(ix,jy,kz,lc) .gt. qxmin(lc) .or. &
9841 & ( an(ix,jy,kz,lr) .gt. qxmin(lr) .and. rcond == 2 ) &
9846 if ( ngscnt .eq. ngs )
goto 2100
9856 if ( ngscnt .eq. 0 )
go to 29998
9858 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: dbg = 8'
9870 IF ( imurain == 1 )
THEN
9871 alpha(:,lr) = alphar
9872 ELSEIF ( imurain == 3 )
THEN
9873 alpha(:,lr) = xnu(lr)
9880 qx(mgs,lv) = an(igs(mgs),jy,kgs(mgs),lv)
9882 qx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),il), 0.0)
9885 qcwtmp(mgs) = qx(mgs,lc)
9888 theta0(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
9890 theta(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
9891 qv0(mgs) = qx(mgs,lv)
9892 qwvp(mgs) = qx(mgs,lv) - qv0(mgs)
9894 pres(mgs) = pn(igs(mgs),jy,kgs(mgs)) + pb(kgs(mgs))
9895 pipert(mgs) = p2(igs(mgs),jy,kgs(mgs))
9896 rho0(mgs) = dn(igs(mgs),jy,kgs(mgs))
9897 rhoinv(mgs) = 1.0/rho0(mgs)
9898 rhovt(mgs) = sqrt(rho00/rho0(mgs))
9899 pi0(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
9900 temg(mgs) = t0(igs(mgs),jy,kgs(mgs))
9902 pk(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
9903 temcg(mgs) = temg(mgs) - tfr
9904 qss0(mgs) = (380.0)/(pres(mgs))
9905 pqs(mgs) = (380.0)/(pres(mgs))
9906 ltemq = (temg(mgs)-163.15)/fqsat+1.5
9907 ltemq = min( nqsat, max(1,ltemq) )
9908 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
9909 qis(mgs) = pqs(mgs)*tabqis(ltemq)
9911 qvap(mgs) = max( (qwvp(mgs) + qv0(mgs)), 0.0 )
9912 es(mgs) = 6.1078e2*tabqvs(ltemq)
9916 temgx(mgs) = min(temg(mgs),313.15)
9917 temgx(mgs) = max(temgx(mgs),233.15)
9918 felv(mgs) = 2500837.367 * (273.15/temgx(mgs))**((0.167)+(3.67e-4)*temgx(mgs))
9920 IF ( eqtset <= 1 )
THEN
9921 felvcp(mgs) = felv(mgs)*cpi
9923 tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
9924 IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
9925 IF ( lf > 1 ) tmp = tmp + qx(mgs,lf)
9926 cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
9928 cpm = cp+cpv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
9930 rmm=rd+rw*qx(mgs,lv)
9932 IF ( eqtset == 2 )
THEN
9934 felvcp(mgs) = (felv(mgs)-rw*temg(mgs))/cvm
9937 felvcp(mgs) = (felv(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
9938 felvpi(mgs) = pi0(mgs)*rovcp*(felv(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
9943 temcgx(mgs) = min(temg(mgs),273.15)
9944 temcgx(mgs) = max(temcgx(mgs),223.15)
9945 temcgx(mgs) = temcgx(mgs)-273.15
9946 felf(mgs) = 333690.6098 + (2030.61425)*temcgx(mgs) - (10.46708312)*temcgx(mgs)**2
9948 fels(mgs) = felv(mgs) + felf(mgs)
9949 fcqv1(mgs) = 4098.0258*felv(mgs)*cpi
9951 wvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)* &
9952 & (101325.0/(pb(kgs(mgs)) + pn(igs(mgs),jgs,kgs(mgs))))
9953 advisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))* &
9954 & (temg(mgs)/296.0)**(1.5)
9955 tka(mgs) = tka0*advisc(mgs)/advisc1
9965 if ( ipconc .ge. 1 )
then
9967 cx(mgs,li) = max(an(igs(mgs),jy,kgs(mgs),lni), 0.0)
9970 if ( ipconc .ge. 2 )
then
9972 cx(mgs,lc) = max(an(igs(mgs),jy,kgs(mgs),lnc), 0.0)
9973 cwnccn(mgs) = cwccn*rho0(mgs)/rho00
9976 ssmax(mgs) = an(igs(mgs),jy,kgs(mgs),lss)
9980 IF ( lccn .gt. 1 .and. ac_opt == 0 )
THEN
9981 IF ( lccnuf .gt. 1 .and. i_uf_or_ccn > 0 )
THEN
9982 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn) + an(igs(mgs),jy,kgs(mgs),lccnuf)
9984 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
9987 ccnc(mgs) = cwnccn(mgs)
9989 IF ( lccnuf .gt. 1 .and. i_uf_or_ccn == 0 )
THEN
9990 ccncuf(mgs) = an(igs(mgs),jy,kgs(mgs),lccnuf)
9995 IF ( lccna > 1 )
THEN
9996 ccna(mgs) = an(igs(mgs),jy,kgs(mgs),lccna)
9998 IF ( lccn > 1 )
THEN
9999 ccna(mgs) = cwnccn(mgs) - ccnc(mgs)
10001 ccna(mgs) = cx(mgs,lc)
10006 if ( ipconc .ge. 3 )
then
10008 cx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lnr), 0.0)
10015 IF ( irenuc /= 6 )
THEN
10016 cnuc(mgs) = max(ccnc(mgs),cwnccn(mgs))*(1. - renucfrac) + ccnc(mgs)*renucfrac
10018 cnuc(mgs) = max(ccnc(mgs),cwnccn(mgs))*(1. - renucfrac) + max(0.0,ccnc(mgs) - ccna(mgs))*renucfrac
10020 IF ( renucfrac >= 0.999 )
THEN
10021 IF ( temg(mgs) < 265. )
THEN
10022 IF ( qx(mgs,lc) > 10.*qxmin(lc) .and. w(igs(mgs),jgs,kgs(mgs)) > 2.0 )
THEN
10025 cnuc(mgs) = 0.1*cnuc(mgs)
10033 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Set density'
10036 xdn(mgs,lc) = xdn0(lc)
10037 xdn(mgs,lr) = xdn0(lr)
10041 ventrxn(:) = ventrn
10046 IF ( lzr > 1 .and. rcond == 2 )
THEN
10048 zx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lzr), 0.0)
10055 IF ( zx(mgs,il) <= zxmin )
THEN
10056 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
10059 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
10060 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
10061 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10062 ELSEIF ( cx(mgs,il) <= 0.0 )
THEN
10063 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
10066 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
10067 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
10068 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
10071 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
10073 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
10074 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
10075 xv(mgs,lr) = xvmx(lr)
10076 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
10077 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
10078 xv(mgs,lr) = xvmn(lr)
10079 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
10082 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
10084 IF ( imurain == 3 )
THEN
10085 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10088 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10090 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10091 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10094 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10098 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
10100 IF ( imurain == 3 )
THEN
10101 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10104 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
10106 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10107 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10110 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
10114 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
10118 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
10119 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
10121 IF ( imurain == 3 )
THEN
10122 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10125 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10126 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10127 ELSEIF ( imurain == 1 )
THEN
10128 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10129 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
10132 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z1*(pi*xdn(mgs,il))**2)
10133 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10138 IF ( zx(mgs,lr) > 0.0 )
THEN
10139 vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
10150 IF ( z1 .gt. 0.0 )
THEN
10152 IF ( imurain == 3 )
THEN
10153 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
10156 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
10157 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
10158 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
10160 alp = max( rnumin, min( rnumax, alp ) )
10164 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10165 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10167 rd1 = z1*(pi/6.*xdn(mgs,il))**2*nrx/(rho0(mgs)*qr)**2
10169 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
10170 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
10173 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
10174 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
10176 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
10177 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
10179 alp = max( alphamin, min( alphamax, alp ) )
10190 IF ( imurain == 3 )
THEN
10191 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
10193 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
10194 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10195 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z1*(1./(xdn(mgs,il)))**2
10196 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
10198 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
10200 z1 = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
10205 ELSEIF ( imurain == 1 )
THEN
10207 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10208 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
10210 IF ( (rescale_low_alpha .or. rescale_high_alpha ) .and. &
10211 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
10215 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
10216 cx(mgs,il) = g1*rho0(mgs)**2*(qr)*qr/zx(mgs,lr)*(6./(pi*xdn(mgs,il)))**2
10217 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
10219 ELSEIF ( rescale_low_alpha .and. alp <= alphamin )
THEN
10220 z1 = g1*rho0(mgs)**2*(qr)*qr/nrx
10221 z2 = z1*(6./(pi*xdn(mgs,il)))**2
10223 an(igs(mgs),jy,kgs(mgs),lz(il)) = z2
10229 tmp = alpha(mgs,lr) + 4./3.
10230 i = int(dgami*(tmp))
10232 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10234 tmp = alpha(mgs,lr) + 1.
10235 i = int(dgami*(tmp))
10237 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10240 ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
10242 IF ( imurain == 3 .and. izwisventr == 2 )
THEN
10244 tmp = alpha(mgs,lr) + 1.5 + br/6.
10245 i = int(dgami*(tmp))
10247 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10250 ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
10252 ELSEIF ( imurain == 1 .and. iferwisventr == 2 )
THEN
10254 tmp = alpha(mgs,lr) + 2.5 + br/2.
10255 i = int(dgami*(tmp))
10257 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10280 kp1 = min(nz, kgs(mgs)+1 )
10281 wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1) &
10282 & +w(igs(mgs),jgs,kgs(mgs)))
10283 wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs)) &
10284 & +w(igs(mgs),jgs,max(1,kgs(mgs)-1)))
10286 ssat0(mgs) = ssfilt(igs(mgs),jgs,kgs(mgs))
10287 ssf(mgs) = ssfilt(igs(mgs),jgs,kgs(mgs))
10291 ssfkp1(mgs) = ssfilt(igs(mgs),jgs,min(nz-1,kgs(mgs)+1))
10292 ssfkm1(mgs) = ssfilt(igs(mgs),jgs,max(1,kgs(mgs)-1))
10305 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Set cloud water variables'
10309 IF ( ipconc .ge. 2 .and. cx(mgs,lc) .gt. 1.0e6 )
THEN
10311 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
10312 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
10314 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. cxmin )
THEN
10316 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),xdn(mgs,lc)*xvmn(lc)), &
10317 & xdn(mgs,lc)*xvmx(lc) )
10319 cx(mgs,lc) = qx(mgs,lc)*rho0(mgs)/xmas(mgs,lc)
10321 ELSEIF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .le. cxmin )
THEN
10324 cx(mgs,lc) = max( cxmin, rho0(mgs)*qx(mgs,lc)/cwmasx )
10326 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
10327 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
10330 xmas(mgs,lc) = cwmasn
10333 xdia(mgs,lc,1) = (xmas(mgs,lc)*cwc1)**c1f3
10341 if ( qx(mgs,lr) .gt. qxmin(lr) )
then
10343 if ( ipconc .ge. 3 )
then
10344 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-9,cx(mgs,lr)))
10346 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
10347 xv(mgs,lr) = xvmx(lr)
10348 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
10349 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
10350 xv(mgs,lr) = xvmn(lr)
10351 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
10354 xmas(mgs,lr) = xv(mgs,lr)*xdn(mgs,lr)
10355 xdia(mgs,lr,3) = (xmas(mgs,lr)*cwc1)**(1./3.)
10356 IF ( imurain == 3 )
THEN
10358 xdia(mgs,lr,1) = xdia(mgs,lr,3)
10360 xdia(mgs,lr,1) = (6.*piinv*xv(mgs,lr)/((alpha(mgs,lr)+3.)*(alpha(mgs,lr)+2.)*(alpha(mgs,lr)+1.)))**(1./3.)
10370 & (qx(mgs,lr)*rho0(mgs)/(pi*xdn(mgs,lr)*cno(lr)))**(0.25)
10373 xdia(mgs,lr,1) = 1.e-9
10386 fadvisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))* &
10387 & (temg(mgs)/296.0)**(1.5)
10389 fakvisc(mgs) = fadvisc(mgs)*rhoinv(mgs)
10391 fwvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)* &
10392 & (101325.0/(pres(mgs)))
10394 fschm(mgs) = (fakvisc(mgs)/fwvdf(mgs))
10396 fvent(mgs) = (fschm(mgs)**(1./3.)) * (fakvisc(mgs)**(-0.5))
10411 IF ( temg(mgs) .le. tfrh .and. qx(mgs,lv)/qvs(mgs) < maxlowtempss )
THEN
10415 IF( ssat0(mgs) .GT. 0. .OR. ssf(mgs) .GT. 0. )
GO TO 620
10421 IF ( qx(mgs,lc) .LE. 0. )
GO TO 631
10424 r1=1./(1. + caw*(273.15 - cbw)*qss(mgs)*felv(mgs)/ &
10425 & (cp*(temg(mgs) - cbw)**2))
10426 qevap= min( qx(mgs,lc), r1*(qss(mgs)-qvap(mgs)) )
10429 IF ( qx(mgs,lc) <= qevap )
THEN
10430 qwvp(mgs) = qwvp(mgs) + qx(mgs,lc)
10431 thetap(mgs) = thetap(mgs) - felvcp(mgs)*qx(mgs,lc)/(pi0(mgs))
10432 IF ( io_flag .and. nxtra > 1 )
THEN
10433 axtra(igs(mgs),jy,kgs(mgs),1) = -qx(mgs,lc)/dtp
10436 IF ( restoreccn )
THEN
10437 IF ( lccna > 1 )
THEN
10438 ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
10439 ELSEIF ( irenuc <= 2 )
THEN
10440 IF ( .not. invertccn )
THEN
10441 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
10443 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
10450 qwvp(mgs) = qwvp(mgs) + qevap
10451 qx(mgs,lc) = qx(mgs,lc) - qevap
10452 IF ( qx(mgs,lc) .le. 0. )
THEN
10453 IF ( restoreccn )
THEN
10454 IF ( lccna > 1 )
THEN
10455 ccna(mgs) = ccna(mgs) - restoreccnfrac*cx(mgs,lc)
10456 ELSEIF ( irenuc <= 2 )
THEN
10459 IF ( .not. invertccn )
THEN
10460 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
10462 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
10468 tmp = 0.9*qevap*cx(mgs,lc)/qctmp
10469 IF ( restoreccn )
THEN
10470 IF ( lccna > 1 )
THEN
10471 ccna(mgs) = ccna(mgs) - restoreccnfrac*tmp
10472 ELSEIF ( irenuc <= 2 )
THEN
10475 IF ( .not. invertccn )
THEN
10476 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*tmp ) )
10478 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*tmp
10482 cx(mgs,lc) = cx(mgs,lc) - tmp
10484 thetap(mgs) = thetap(mgs) - felvcp(mgs)*qevap/(pi0(mgs))
10485 IF ( io_flag .and. nxtra > 1 )
THEN
10486 axtra(igs(mgs),jy,kgs(mgs),1) = -qevap/dtp
10498 IF ( qx(mgs,lc) .GT. qxmin(lc) .and. cx(mgs,lc) .ge. 1. )
THEN
10505 ac1 = felv(mgs)**2/(tka(mgs)*rw*temg(mgs)**2)
10511 bc = rw*temg(mgs)/(wvdf(mgs)*es(mgs))
10520 IF ( ssf(mgs) .gt. 0.0 .or. ssat0(mgs) .gt. 0.0 )
THEN
10521 IF ( ny .le. 2 )
THEN
10528 IF ( qx(mgs,lc) .gt. qxmin(lc) )
THEN
10530 IF ( xdia(mgs,lc,1) .le. 0.0 )
THEN
10531 xmas(mgs,lc) = cwmasn
10532 xdia(mgs,lc,1) = (xmas(mgs,lc)*cwc1)**c1f3
10534 d1 = (1./(ac1 + bc))*4.0*pi*ventc &
10535 & *0.5*xdia(mgs,lc,1)*cx(mgs,lc)*rhoinv(mgs)
10541 IF ( rcond .eq. 2 .and. qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > 1.e-9 )
THEN
10542 IF ( imurain == 3 )
THEN
10543 IF ( izwisventr == 1 )
THEN
10544 rwvent(mgs) = ventrx(mgs)*(1.6 + 124.9*(1.e-3*rho0(mgs)*qx(mgs,lr))**.2046)
10548 & (0.78*ventrx(mgs) + 0.308*ventrxn(mgs)*fvent(mgs) &
10549 & *sqrt((ar*rhovt(mgs))) &
10550 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
10555 IF ( iferwisventr == 1 )
THEN
10556 alpr = min(alpharmax,alpha(mgs,lr) )
10561 i = int(dgami*(tmp))
10563 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10565 tmp = 2.5 + alpr + 0.5*bx(lr)
10566 i = int(dgami*(tmp))
10568 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
10572 vent1 = dble(xdia(mgs,lr,1))**(0.5 + 0.5*bx(lr))
10573 vent2 = dble(1. + 0.5*fx(lr)*xdia(mgs,lr,1))**dble(2.5+alpr+0.5*bx(lr))
10578 & 0.308*fvent(mgs)*y* &
10579 & sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
10581 ELSEIF ( iferwisventr == 2 )
THEN
10584 x = 1. + alpha(mgs,lr)
10587 & (0.78*x + 0.308*ventrxn(mgs)*fvent(mgs) &
10588 & *sqrt((ar*rhovt(mgs))) &
10589 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
10596 d1r = (1./(ac1 + bc))*4.0*pi*rwvent(mgs) &
10597 & *0.5*xdia(mgs,lr,1)*cx(mgs,lr)*rhoinv(mgs)
10603 e1 = felvcp(mgs)/(pi0(mgs))
10609 ltemq = (temg(mgs)-163.15)/fqsat+1.5
10610 ltemq = min( nqsat, max(1,ltemq) )
10613 p380 = 380.0/pres(mgs)
10618 ss1 = qx(mgs,lv)/qvs(mgs)
10635 IF ( abs(ss1 - 1.0) .gt. 1.e-5 )
THEN
10636 delta = 0.5*(qv1-qvs1)/(d1*(ss1 - 1.0))
10643 dtcon1 = min(0.05,0.2*delta)
10644 nc = max(5,2*nint( (dtp-4.0*dtcon1)/delta))
10645 dtcon2 = (dtp-4.0*dtcon1)/nc
10657 rk2c:
DO WHILE ( dt1 .lt. dtp )
10659 IF ( n .le. 4 )
THEN
10664 609 dqv = -(ss1 - 1.)*d1*dtcon
10665 dqvr = -(ss1 - 1.)*d1r*dtcon
10666 dtemp = -0.5*e1*f1*(dqv + dqvr)
10672 ltemq1m = (temp1+dtemp-163.15)*fqsati+1.5
10673 ltemq1m = min( nqsat, max(1,ltemq1m) )
10675 IF ( ltemq1m .lt. 1 .or. ltemq1m .gt. nqsat )
THEN
10676 write(0,*)
'STOP in nucond line 1192 '
10677 write(0,*)
' ltemq1m,icond = ',ltemq1m,icond
10678 write(0,*)
' dtemp,e1,f1,dqv,dqvr = ', dtemp,e1,f1,dqv,dqvr
10679 write(0,*)
' d1,d1r,dtcon,ss1 = ',d1,d1r,dtcon,ss1
10680 write(0,*)
' dqc, dqr = ',dqc,dqr
10681 write(0,*)
' qv,qc,qr = ',qx(mgs,lv)*1000.,qx(mgs,lc)*1000.,qx(mgs,lr)*1000.
10682 write(0,*)
' i, j, k = ',igs(mgs),jy,kgs(mgs)
10683 write(0,*)
' dtcon1,dtcon2,delta = ',dtcon1,dtcon2,delta
10684 write(0,*)
' nc,dtp = ',nc,dtp
10685 write(0,*)
' rwvent,xdia,crw,ccw = ', rwvent(mgs),xdia(mgs,lr,1),cx(mgs,lr),cx(mgs,lc)
10686 write(0,*)
' fvent,alphar = ',fvent(mgs),alpha(mgs,lr)
10687 write(0,*)
' xvr,xmasr,xdnr,cwc1 = ',xv(mgs,lr),xmas(mgs,lr),xdn(mgs,lr),cwc1
10689 dqvs = dtemp*p380*dtabqvs(ltemq1m)
10690 qv1m = qv1 + dqv + dqvr
10693 qvs1m = qvs1 + dqvs
10697 IF ( ss1m .lt. 1. .and. (dqvii + dqvis) .eq. 0.0 )
THEN
10698 dtcon = (0.5*dtcon)
10699 IF ( dtcon .ge. dtcon1 )
THEN
10706 dqv = -(ss1m - 1.)*d1*dtcon
10707 dqvr = -(ss1m - 1.)*d1r*dtcon
10711 dtemp = -e1*f1*(dqv + dqvr)
10716 ltemq1 = (temp1+dtemp-163.15)*fqsati+1.5
10717 ltemq1 = min( nqsat, max(1,ltemq1) )
10719 IF ( ltemq1 .lt. 1 .or. ltemq1 .gt. nqsat )
THEN
10720 write(0,*)
'STOP in nucond line 1230 '
10721 write(0,*)
' ltemq1m,icond = ',ltemq1m,icond
10722 write(0,*)
' dtemp,e1,dqv,dqvr = ', dtemp,e1,dqv,dqvr
10724 dqvs = dtemp*p380*dtabqvs(ltemq1)
10726 qv1 = qv1 + dqv + dqvr
10733 temp1 = temp1 + dtemp
10734 IF ( temp2 .eq. temp1 .or. ss2 .eq. ss1 .or. &
10735 & ss1 .eq. 1.00 .or. &
10736 & ( n .gt. 10 .and. ss1 .lt. 1.0005 ) )
THEN
10749 thetap(mgs) = thetap(mgs) + e1*(dcloud + dqr)
10752 IF ( eqtset > 2 )
THEN
10753 pipert(mgs) = pipert(mgs) + felvpi(mgs)*(dcloud + dqr)
10755 IF ( io_flag .and. nxtra > 1 )
THEN
10756 axtra(igs(mgs),jy,kgs(mgs),1) = dcloud/dtp
10757 axtra(igs(mgs),jy,kgs(mgs),2) = axtra(igs(mgs),jy,kgs(mgs),2) + dqr/dtp
10759 qwvp(mgs) = qwvp(mgs) - (dcloud + dqr)
10760 qx(mgs,lc) = qx(mgs,lc) + dcloud
10761 qx(mgs,lr) = qx(mgs,lr) + dqr
10766 IF ( lzr > 1 .and. rcond == 2 .and. qx(mgs,lr) .gt. qxmin(lr) &
10767 & .and. cx(mgs,lr) .gt. 1.e-9 )
THEN
10768 tmp = qx(mgs,lr)/cx(mgs,lr)
10769 IF ( imurain == 3 )
THEN
10770 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10772 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10773 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10776 zx(mgs,lr) = zx(mgs,lr) + g1*(rho0(mgs)/(xdn(mgs,lr)))**2*( 2.*( tmp ) * dqr )
10779 theta(mgs) = thetap(mgs) + theta0(mgs)
10780 temg(mgs) = theta(mgs)*f1
10781 ltemq = (temg(mgs)-163.15)/fqsat+1.5
10782 ltemq = min( nqsat, max(1,ltemq) )
10783 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
10794 IF ( ssf(mgs) .gt. 0.0 )
THEN
10796 IF ( iqcinit == 1 )
THEN
10798 qvs0 = 380.*exp(17.27*(temg(mgs)-273.)/(temg(mgs)- 36.))/pk(mgs)
10800 dcloud = max(0.0, (qx(mgs,lv)-qvs0) / (1.+qvs0*f5/(temg(mgs)-36.)**2) )
10802 ELSEIF ( iqcinit == 3 )
THEN
10803 r1=1./(1. + caw*(273.15 - cbw)*qss(mgs)*felvcp(mgs)/ &
10804 & ((temg(mgs) - cbw)**2))
10805 dcloud=r1*(qvap(mgs) - qvs(mgs))
10808 ELSEIF ( iqcinit == 2 )
THEN
10820 IF ( ssf(mgs) > ssmx .and. ssf(mgs) < 20.0 .and. &
10821 ( ccnc(mgs) > 0.05*cwnccn(mgs) .or. ( ac_opt > 0 .and. ccnc_ac(mgs) - cx(mgs,lc) > 0.0 ) ) )
THEN
10823 CALL qvexcess(ngs,mgs,qwvp,qv0,qx(1,lc),pres,thetap,theta0,dcloud, &
10824 & pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ssmx,pk,ngscnt)
10833 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
10834 qwvp(mgs) = qwvp(mgs) - dcloud
10835 qx(mgs,lc) = qx(mgs,lc) + dcloud
10836 IF ( io_flag .and. nxtra > 1 )
THEN
10837 axtra(igs(mgs),jy,kgs(mgs),1) = dcloud/dtp
10839 theta(mgs) = thetap(mgs) + theta0(mgs)
10840 temg(mgs) = theta(mgs)*pk(mgs)
10842 ltemq = (temg(mgs)-163.15)/fqsat+1.5
10843 ltemq = min( nqsat, max(1,ltemq) )
10844 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
10851 IF ( ncdebug .ge. 1 )
THEN
10852 write(iunit,*)
'at 613: ',qx(mgs,lc),cx(mgs,lc),wvel(mgs),ssmax(mgs),kgs(mgs)
10855 IF ( .not. flag_qndrop )
THEN
10857 IF ( ac_opt == 0 )
THEN
10858 cnuctmp = cnuc(mgs)
10860 cnuctmp = ccnc_ac(mgs)
10864 IF ( dcloud .gt. qxmin(lc) .and. wvel(mgs) > 0.0)
THEN
10866 cn(mgs) = ccne0*cnuctmp**(2./(2.+cck))*wvel(mgs)**cnexp
10867 IF ( ny .le. 2 .and. cn(mgs) .gt. 0.0 &
10868 & .and. ncdebug .ge. 1 )
THEN
10869 write(iunit,*)
'CN: ',cn(mgs)*1.e-6, cx(mgs,lc)*1.e-6, qx(mgs,lc)*1.e3, &
10870 & wvel(mgs), dcloud*1.e3
10871 IF ( cn(mgs) .gt. 1.0 )
write(iunit,*)
'cwrad = ', &
10872 & 1.e6*(rho0(mgs)*qx(mgs,lc)/cn(mgs)*cwc1)**c1f3, &
10873 & igs(mgs),kgs(mgs),temcg(mgs), &
10874 & 1.e3*an(igs(mgs),jgs,kgs(mgs)-1,lc)
10876 IF ( iccwflg .eq. 1 )
THEN
10877 cn(mgs) = min(cwccn*rho0(mgs)/rho00, max(cn(mgs), &
10878 & rho0(mgs)*qx(mgs,lc)/(xdn(mgs,lc)*(4.*pi/3.)*(4.e-6)**3)))
10887 IF ( cn(mgs) .gt. 0.0 )
THEN
10888 IF ( ac_opt == 0 )
THEN
10889 IF ( cn(mgs) .gt. ccnc(mgs) )
THEN
10890 cn(mgs) = ccnc(mgs)
10894 cn(mgs) = min( cn(mgs), ccnc_ac(mgs) )
10897 IF ( irenuc <= 2 .and. lccna < 1 ) ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
10898 ccna(mgs) = ccna(mgs) + cn(mgs)
10903 IF( cn(mgs) .GT. cx(mgs,lc) ) cx(mgs,lc) = cn(mgs)
10904 IF( cx(mgs,lc) .GT. 0. .AND. qx(mgs,lc) .le. qxmin(lc) )
THEN
10907 cx(mgs,lc) = min(cx(mgs,lc),rho0(mgs)*max(0.0,qx(mgs,lc))/cwmasn)
10923 IF ( wvel(mgs) .le. 0. )
GO TO 616
10924 IF ( cx(mgs,lc) .le. 0. )
GO TO 613
10925 IF ( kzbeg-1+kgs(mgs) .GT. 1 .and. qx(mgs,lc) .le. qxmin(lc))
GO TO 613
10926 IF ( kzbeg-1+kgs(mgs) .eq. 1 .and. wvel(mgs) .gt. 0. )
GO TO 613
10928 616
IF ( ssf(mgs) .LE. supcb .AND. wvel(mgs) .GT. 0. )
GO TO 631
10929 IF ( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 .AND. &
10930 & (ssfkp1(mgs) .GE. supmx .OR. &
10931 & ssf(mgs) .GE. supmx .OR. &
10932 & ssfkm1(mgs) .GE. supmx))
GO TO 631
10933 IF (ssf(mgs) .LT. 1.e-10 .OR. ssf(mgs) .GE. supmx)
GO TO 631
10939 if (ndebug .gt. 0)
write(0,*)
"ICEZVD_DR: Entered Ziegler Cloud Nucleation"
10942 r2dzm=0.50/dz3d(igs(mgs),jy,kgs(mgs))
10944 IF ( irenuc >= 0 .and. ac_opt == 0 .and. .not. flag_qndrop )
THEN
10946 IF ( irenuc < 2 )
THEN
10948 IF ( kzend == nzend )
THEN
10949 t0p3 = t0(igs(mgs),jgs,min(kze,kgs(mgs)+3))
10950 t0p1 = t0(igs(mgs),jgs,min(kze,kgs(mgs)+1))
10952 t0p3 = t0(igs(mgs),jgs,kgs(mgs)+3)
10953 t0p1 = t0(igs(mgs),jgs,kgs(mgs)+1)
10956 IF ( ( ssf(mgs) .gt. ssmax(mgs) .or. irenuc .eq. 1 ) &
10957 & .and. ( ( lccn .lt. 1 .and. &
10958 & cx(mgs,lc) .lt. cwccn*(min(1.0,rho0(mgs)))) .or. &
10959 & ( lccn .gt. 1 .and. ccnc(mgs) .gt. 0. ) ) &
10961 IF( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 &
10962 & .and. ssf(mgs) .gt. 0.0 &
10963 & .and. ssfkp1(mgs) .LT. supmx .and. ssfkp1(mgs) .ge. 0.0 &
10964 & .AND. ssfkm1(mgs) .LT. supmx .AND. ssfkm1(mgs) .ge. 0.0 &
10965 & .AND. ssfkp1(mgs) .gt. ssfkm1(mgs) &
10966 & .and. t0p3 .gt. 233.2)
THEN
10967 dssdz = (ssfkp1(mgs) - ssfkm1(mgs))*r2dzm
10971 ELSEIF( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 &
10973 & .and. ssf(mgs) .gt. 0.0 .and. wvel(mgs) .gt. 0.0 &
10974 & .and. ssfkp1(mgs) .gt. 0.0 &
10975 & .AND. ssfkm1(mgs) .le. 0.0 .and. wvelkm1(mgs) .gt. 0.0 &
10976 & .AND. ssf(mgs) .gt. ssfkm1(mgs) &
10977 & .and. t0p1 .gt. 233.2)
THEN
10978 dssdz = 2.*(ssf(mgs) - ssfkm1(mgs))*r2dzm
10985 c1 = max(0.0, rho0(mgs)*(qx(mgs,lv) - qss(mgs))/ &
10986 & (xdn(mgs,lc)*(4.*pi/3.)*(4.e-6)**3))
10987 IF ( lccn .lt. 1 )
THEN
10988 cn(mgs) = cwccn*rho0(mgs)/rho00*cck*ssf(mgs)**cckm*dtp* &
10990 & (wvel(mgs)*dssdz) )
10993 & min(ccnc(mgs), cnuc(mgs)*cck*ssf(mgs)**cckm*dtp* &
10995 & ( wvel(mgs)*dssdz) ) )
10999 IF ( cn(mgs) .gt. 0.0 )
THEN
11000 IF ( ccnc(mgs) .lt. 5.e7 .and. cn(mgs) .ge. 5.e7 )
THEN
11003 ELSEIF ( cn(mgs) .gt. ccnc(mgs) )
THEN
11004 cn(mgs) = ccnc(mgs)
11007 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11008 ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11011 ELSEIF ( irenuc == 2 )
THEN
11014 cn(mgs) = ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp
11019 cn(mgs) = min(cn(mgs), ccnc(mgs))
11020 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11021 cn(mgs) = min( cn(mgs), max(0.0, (cnuc(mgs) - ccna(mgs) )) )
11023 IF ( .false. .and. ny <= 2 )
THEN
11024 write(0,*)
'i,k, cwmasn = ',igs(mgs),kgs(mgs),cwmasn
11025 write(0,*)
'wvel, cnuc, cn = ',wvel(mgs),cnuc(mgs),cn(mgs)
11026 write(0,*)
'ccne0,cnexp,cck = ',ccne0,cnexp,cck
11027 write(0,*)
'part1, part2 = ',ccne0*cnuc(mgs)**(2./(2.+cck)), max(0.0,wvel(mgs))**cnexp
11028 write(0,*)
'ccnc, dqc, dqc/cwmasn = ',ccnc(mgs), dqc, 0.5*dqc/cwmasn
11031 IF ( icnuclimit > 0 )
THEN
11032 tmp = ccnc(mgs) + cx(mgs,lc)
11033 IF ( tmp < 330.34e6 )
THEN
11034 ccwmax = 1.1173e6 * (1.e-6*tmp)**0.9504
11036 ccwmax = 21.57e6 * (1.e-6*tmp)**0.44
11043 cn(mgs) = max( 0.0, min( cn(mgs), ccwmax - cx(mgs,lc) ) )
11047 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11049 IF ( lccna < 1 ) ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11051 ELSEIF ( irenuc == 3 )
THEN
11057 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11058 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11059 ltemq = min( nqsat, max(1,ltemq) )
11061 c1= pqs(mgs)*tabqvs(ltemq)
11064 IF ( c1 > 0. )
THEN
11065 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11067 cn(mgs) = cnuc(mgs)*min(1.0, (ssf(mgs))**cck )
11069 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11072 cn(mgs) = min(cn(mgs), ccnc(mgs))
11073 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11075 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11079 ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11081 ELSEIF ( irenuc == 4 )
THEN
11087 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11088 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11089 ltemq = min( nqsat, max(1,ltemq) )
11091 c1= pqs(mgs)*tabqvs(ltemq)
11092 IF ( c1 > 0. )
THEN
11093 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11097 cn(mgs) = cnuc(mgs)*min(ssf2kmax, ssf(mgs)**cck)
11099 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11103 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11105 IF ( cn(mgs) > 0.0 )
THEN
11106 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11111 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11112 qx(mgs,lc) = qx(mgs,lc) + dcloud
11113 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11114 qwvp(mgs) = qwvp(mgs) - dcloud
11122 ELSEIF ( irenuc == 6 )
THEN
11128 IF ( ccna(mgs) < 0.7*cnuc(mgs) )
THEN
11129 cn(mgs) = min( 0.9*cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11132 cn(mgs) = min( cn(mgs), max(0.0, (0.7*cnuc(mgs) - ccna(mgs) )) )
11138 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11140 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11141 ltemq = min( nqsat, max(1,ltemq) )
11144 c1= pqs(mgs)*tabqvs(ltemq)
11145 IF ( c1 > 0. )
THEN
11146 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11152 cn(mgs) = cnuc(mgs)*min(2.0, max(0.0,ssf(mgs))**cck )
11156 cn(mgs) = min(0.01*cnuc(mgs), max( 0.0, cn(mgs) - ccna(mgs) ) )
11166 IF ( cn(mgs) > 0.0 )
THEN
11167 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11173 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11174 qx(mgs,lc) = qx(mgs,lc) + dcloud
11175 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11176 qwvp(mgs) = qwvp(mgs) - dcloud
11179 ELSEIF ( irenuc == 5 )
THEN
11184 cn(mgs) = min( cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11187 IF ( ccna(mgs) >= cnuc(mgs) )
THEN
11188 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11189 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11190 ltemq = min( nqsat, max(1,ltemq) )
11192 c1= pqs(mgs)*tabqvs(ltemq)
11193 IF ( c1 > 0. )
THEN
11194 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11200 cn(mgs) = max( cn(mgs), cnuc(mgs)*min(ssf2kmax, ssf(mgs)**cck) )
11205 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11208 cn(mgs) = min( cn(mgs), cnuc(mgs) - ccna(mgs) )
11215 dcloud = 1000.*dcrit**3*pi/6.
11219 tmp = max(0.0, rho0(mgs)*qx(mgs,lc)/dcloud - cx(mgs,lc))
11220 cn(mgs) = min(tmp, cn(mgs) )
11223 IF ( cn(mgs) > 0.0 )
THEN
11224 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11228 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11229 qx(mgs,lc) = qx(mgs,lc) + dcloud
11230 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11231 qwvp(mgs) = qwvp(mgs) - dcloud
11236 ELSEIF ( irenuc == 7 .or. irenuc == 17 )
THEN
11241 IF ( irenuc == 7 )
THEN
11247 IF ( ccna(mgs) < frac*cnuc(mgs) )
THEN
11248 cn(mgs) = min( (frac+0.01)*cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11251 cn(mgs) = min( cn(mgs), max(0.0, (frac*cnuc(mgs) - ccna(mgs) )) )
11264 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11266 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11267 ltemq = min( nqsat, max(1,ltemq) )
11270 c1= pqs(mgs)*tabqvs(ltemq)
11273 IF ( c1 > 0. )
THEN
11274 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11278 IF ( ssf(mgs) <= 1.0 )
THEN
11279 cn(mgs) = cnuc(mgs)*min(1.0, max(0.0,ssf(mgs))**cck )
11281 cn(mgs) = cnuc(mgs)*min(2.0, max(0.0,0.03*(ssf(mgs)-1.0)+1.)**cck )
11289 IF ( ccncuf(mgs) > 0.0 .and. ssf(mgs) > ssmxuf .and. ( ssmax(mgs) > ssmxuf .or. lss < 1 ) )
THEN
11290 cnuf(mgs) = min( ccncuf(mgs), ccne0*ccncuf(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11298 cn(mgs) = min(0.01*cnuc(mgs), max( 0.0, cn(mgs) - ccna(mgs) ) )
11309 IF ( icnuclimit > 0 )
THEN
11311 tmp = ccnc(mgs) - ccna(mgs) + cx(mgs,lc)
11312 IF ( tmp < 330.34e6 )
THEN
11313 ccwmax = 1.1173e6 * (1.e-6*tmp)**0.9504
11315 ccwmax = 21.57e6 * (1.e-6*tmp)**0.44
11318 cn(mgs) = max( 0.0, min( cn(mgs), ccwmax - cx(mgs,lc) ) )
11322 IF ( cn(mgs) + cnuf(mgs) > 0.0 )
THEN
11325 dcloud = 1000.*dcrit**3*pi/6.
11329 tmp = max(0.0, rho0(mgs)*qx(mgs,lc)/dcloud - cx(mgs,lc))
11330 cn(mgs) = min(tmp, cn(mgs) )
11332 cx(mgs,lc) = cx(mgs,lc) + cn(mgs) + cnuf(mgs)
11339 dcloud = 1000.*dcrit**3*pi/6.*(cn(mgs) + cnuf(mgs) )
11340 qx(mgs,lc) = qx(mgs,lc) + dcloud
11341 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11342 qwvp(mgs) = qwvp(mgs) - dcloud
11344 ccncuf(mgs) = max(0.0, ccncuf(mgs) - cnuf(mgs))
11347 ELSEIF ( irenuc == 8 )
THEN
11353 IF ( ccnc(mgs) > 0. )
THEN
11354 cn(mgs) = ccne0*ccnc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp
11359 cn(mgs) = min(cn(mgs), ccnc(mgs))
11361 ELSEIF ( cx(mgs,lc) < 0.01e9 )
THEN
11365 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11367 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11368 ltemq = min( nqsat, max(1,ltemq) )
11371 c1= pqs(mgs)*tabqvs(ltemq)
11374 IF ( c1 > 0. )
THEN
11375 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11379 IF ( ssf(mgs) <= 1.0 )
THEN
11383 cn(mgs) = 0.01e9*min(2.0, max(0.0,0.03*(ssf(mgs)-1.0)+1.)**cck ) - cx(mgs,lc)
11388 IF ( cn(mgs) > 0.0 )
THEN
11389 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11397 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11398 qx(mgs,lc) = qx(mgs,lc) + dcloud
11399 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11400 qwvp(mgs) = qwvp(mgs) - dcloud
11408 ccna(mgs) = ccna(mgs) + cn(mgs)
11412 IF( cx(mgs,lc) .GT. 0. .AND. qx(mgs,lc) .LE. qxmin(lc)) cx(mgs,lc)=0.
11424 qv1 = qv0(mgs) + qwvp(mgs)
11429 IF ( qv1 .gt. (ssmx*qvs1) )
THEN
11435 ssmx = 100.*(ssmx - 1.0)
11439 CALL qvexcess(ngs,mgs,qwvp,qv0,qx(1,lc),pres,thetap,theta0,qvex, &
11440 & pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ssmx,pk,ngscnt)
11444 IF ( qvex .gt. 0.0 )
THEN
11445 thetap(mgs) = thetap(mgs) + felvcp(mgs)*qvex/(pi0(mgs))
11446 IF ( io_flag .and. nxtra > 1 )
THEN
11447 axtra(igs(mgs),jy,kgs(mgs),1) = axtra(igs(mgs),jy,kgs(mgs),1) + qvex/dtp
11449 qwvp(mgs) = qwvp(mgs) - qvex
11450 qx(mgs,lc) = qx(mgs,lc) + qvex
11451 IF ( .not. flag_qndrop)
THEN
11452 IF ( imaxsupopt == 1 )
THEN
11453 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, xmas(mgs,lc) ) )
11454 ELSEIF ( imaxsupopt == 2 )
THEN
11455 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmas30,xmas(mgs,lc)) ) )
11456 ELSEIF ( imaxsupopt == 3 )
THEN
11457 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmasx,xmas(mgs,lc)) ) )
11459 ELSEIF ( imaxsupopt == 4 )
THEN
11460 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmas20,xmas(mgs,lc)) ) )
11462 IF ( lccna > 1 )
THEN
11463 ccna(mgs) = ccna(mgs) + cn(mgs)
11465 ccnc(mgs) = max( 0.0, ccnc(mgs) - cn(mgs) )
11467 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11487 IF( cx(mgs,lc) > cxmin .AND. qx(mgs,lc) .GT. qxmin(lc))
THEN
11489 xmas(mgs,lc) = rho0(mgs)*qx(mgs,lc)/(cx(mgs,lc))
11491 IF ( xmas(mgs,lc) < cwmasn .or. xmas(mgs,lc) > cwmasx )
THEN
11493 xmas(mgs,lc) = min( xmas(mgs,lc), cwmasx )
11494 xmas(mgs,lc) = max( xmas(mgs,lc), cwmasn )
11495 cx(mgs,lc) = rho0(mgs)*qx(mgs,lc)/xmas(mgs,lc)
11525 IF ( ipconc .ge. 3 .and. rcond == 2 )
THEN
11528 IF (cx(mgs,lr) .GT. 0. .AND. qx(mgs,lr) .GT. qxmin(lr)) &
11529 & xv(mgs,lr)=rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
11530 IF (xv(mgs,lr) .GT. xvmx(lr)) xv(mgs,lr) = xvmx(lr)
11531 IF (xv(mgs,lr) .LT. xvmn(lr)) xv(mgs,lr) = xvmn(lr)
11542 IF ( lss > 1 .and. ssf(mgs) .gt. ssmax(mgs) &
11543 & .and. ( idecss .eq. 0 .or. qx(mgs,lc) .gt. qxmin(lc)) )
THEN
11544 ssmax(mgs) = ssf(mgs)
11550 an(igs(mgs),jy,kgs(mgs),lt) = theta0(mgs) + thetap(mgs)
11551 an(igs(mgs),jy,kgs(mgs),lv) = qv0(mgs) + qwvp(mgs)
11554 IF ( eqtset > 2 )
THEN
11555 p2(igs(mgs),jy,kgs(mgs)) = pipert(mgs)
11558 if ( ido(lc) .eq. 1 )
then
11559 an(igs(mgs),jy,kgs(mgs),lc) = qx(mgs,lc) + &
11560 & min( an(igs(mgs),jy,kgs(mgs),lc), 0.0 )
11565 if ( ido(lr) .eq. 1 .and. rcond == 2 )
then
11566 an(igs(mgs),jy,kgs(mgs),lr) = qx(mgs,lr) + &
11567 & min( an(igs(mgs),jy,kgs(mgs),lr), 0.0 )
11571 IF ( lzr > 1 .and. rcond == 2 )
THEN
11572 an(igs(mgs),jy,kgs(mgs),lzr) = zx(mgs,lr) + &
11573 & min( an(igs(mgs),jy,kgs(mgs),lzr), 0.0 )
11577 IF ( ipconc .ge. 2 )
THEN
11578 an(igs(mgs),jy,kgs(mgs),lnc) = max(cx(mgs,lc) , 0.0)
11579 IF ( lss > 1 ) an(igs(mgs),jy,kgs(mgs),lss) = max( 0.0, ssmax(mgs) )
11580 IF ( ac_opt == 0 )
THEN
11581 IF ( lccn .gt. 1 .and. lccna .lt. 1 )
THEN
11582 an(igs(mgs),jy,kgs(mgs),lccn) = max(0.0, ccnc(mgs) )
11585 IF ( lccnuf .gt. 1 .and. .not. ( lccna .gt. 1 .and. i_uf_or_ccn > 0 ) )
THEN
11586 an(igs(mgs),jy,kgs(mgs),lccnuf) = max(0.0, ccncuf(mgs) )
11588 IF ( lccna .gt. 1 )
THEN
11589 an(igs(mgs),jy,kgs(mgs),lccna) = max(0.0, ccna(mgs) )
11592 IF ( ipconc .ge. 3 .and. rcond == 2 )
THEN
11593 an(igs(mgs),jy,kgs(mgs),lnr) = max(cx(mgs,lr) , 0.0)
11601 if ( kz .gt. nz-1 .and. ix .ge. nxi)
then
11602 if ( ix .ge. nxi )
then
11611 if ( ix .ge. nxi )
then
11644 t0(ix,jy,kz) = an(ix,jy,kz,lt)*t77(ix,jy,kz)
11646 zerocx(:) = .false.
11648 IF ( iresetmoments == 1 .or. iresetmoments == il )
THEN
11649 IF ( ln(il) > 1 ) zerocx(il) = ( an(ix,jy,kz,ln(il)) < cxmin )
11650 IF ( lz(il) > 1 ) zerocx(il) = ( zerocx(il) .or. an(ix,jy,kz,lz(il)) < zxmin )
11652 IF ( il == lc )
THEN
11653 IF ( ln(il) > 1 ) zerocx(il) = ( an(ix,jy,kz,ln(il)) <= 0 ) .and. .not. flag_qndrop
11655 IF ( ln(il) > 1 ) zerocx(il) = ( an(ix,jy,kz,ln(il)) <= 0 )
11660 IF ( lhl .gt. 1 )
THEN
11662 IF ( lzhl .gt. 1 )
THEN
11664 an(ix,jy,kz,lzhl) = max(0.0, an(ix,jy,kz,lzhl) )
11666 IF ( an(ix,jy,kz,lhl) .ge. frac*qxmin(lhl) .and. rescale_low_alpha )
THEN
11668 IF ( an(ix,jy,kz,lnhl) .gt. 0.0 )
THEN
11670 IF ( lvhl .gt. 1 )
THEN
11671 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
11672 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
11676 hwdn = max( xdnmn(lhl), hwdn )
11681 chw = an(ix,jy,kz,lnhl)
11682 g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/ &
11683 & ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
11684 z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lhl) )*an(ix,jy,kz,lhl)/chw
11685 z1 = z1*(6./(pi*hwdn))**2
11690 an(ix,jy,kz,lzhl) = min( z1, an(ix,jy,kz,lzhl) )
11692 IF ( an(ix,jy,kz,lnhl) .lt. 1.e-5 )
THEN
11699 if ( an(ix,jy,kz,lhl) .lt. frac*qxmin(lhl) .or. zerocx(lhl) )
then
11702 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lhl)
11703 an(ix,jy,kz,lhl) = 0.0
11706 IF ( ipconc .ge. 5 )
THEN
11707 an(ix,jy,kz,lnhl) = 0.0
11710 IF ( lvhl .gt. 1 )
THEN
11711 an(ix,jy,kz,lvhl) = 0.0
11714 IF ( lhlw .gt. 1 )
THEN
11715 an(ix,jy,kz,lhlw) = 0.0
11718 IF ( lnhlf .gt. 1 )
THEN
11719 an(ix,jy,kz,lnhlf) = 0.0
11722 IF ( lzhl .gt. 1 )
THEN
11723 an(ix,jy,kz,lzhl) = 0.0
11727 IF ( lvol(lhl) .gt. 1 )
THEN
11728 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
11729 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
11732 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
11735 IF ( tmp .lt. xdnmn(lhl) )
THEN
11736 tmp = max( xdnmn(lhl), tmp )
11737 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
11740 IF ( tmp .gt. xdnmx(lhl) .and. lhlw .le. 0 )
THEN
11741 tmp = min( xdnmx(lhl), tmp )
11742 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
11743 ELSEIF ( tmp .gt. xdnmx(lhl) .and. lhlw .gt. 1 )
THEN
11744 fw = an(ix,jy,kz,lhlw)/an(ix,jy,kz,lhl)
11749 tmpmx = xdnmx(lhl)/( 1. - fw*(1. - xdnmx(lhl)/xdnmx(lr) ))
11751 IF ( tmp .gt. tmpmx )
THEN
11752 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmpmx
11764 IF ( lhlw .gt. 1 )
THEN
11765 IF ( an(ix,jy,kz,lhlw) .gt. 0.98*an(ix,jy,kz,lhl) )
THEN
11767 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
11775 IF ( ipconc == 5 .and. an(ix,jy,kz,lhl) .gt. qxmin(lhl) .and. alphahl .le. 0.1 .and. lnhl .gt. 1 .and. lzhl == 0 )
THEN
11777 IF ( lvhl .gt. 1 )
THEN
11778 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
11782 tmp = (hwdn*an(ix,jy,kz,lnhl))/(dn(ix,jy,kz)*an(ix,jy,kz,lhl))
11783 tmpg = an(ix,jy,kz,lnhl)*(tmp*(3.14159))**(1./3.)
11784 IF ( tmpg .lt. cnohlmn )
THEN
11785 tmp = ( (hwdn)/(dn(ix,jy,kz)*an(ix,jy,kz,lhl))*(3.14159))**(1./3.)
11786 an(ix,jy,kz,lnhl) = (cnohlmn/tmp)**(3./4.)
11798 IF ( lzh .gt. 1 )
THEN
11800 an(ix,jy,kz,lzh) = max(0.0, an(ix,jy,kz,lzh) )
11802 IF ( .false. .and. an(ix,jy,kz,lh) .ge. frac*qxmin(lh) .and. rescale_low_alpha )
THEN
11804 IF ( an(ix,jy,kz,lnh) .gt. 0.0 )
THEN
11806 IF ( lvh .gt. 1 )
THEN
11807 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
11808 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
11812 hwdn = max( xdnmn(lh), hwdn )
11817 chw = an(ix,jy,kz,lnh)
11818 g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/ &
11819 & ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
11820 z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lh) )*an(ix,jy,kz,lh)/chw
11821 z1 = z1*(6./(pi*hwdn))**2
11826 an(ix,jy,kz,lzh) = min( z1, an(ix,jy,kz,lzh) )
11828 IF ( an(ix,jy,kz,lnh) .lt. 1.e-5 )
THEN
11835 if ( an(ix,jy,kz,lh) .lt. frac*qxmin(lh) .or. zerocx(lh) )
then
11838 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lh)
11839 an(ix,jy,kz,lh) = 0.0
11842 IF ( ipconc .ge. 5 )
THEN
11843 an(ix,jy,kz,lnh) = 0.0
11846 IF ( lvh .gt. 1 )
THEN
11847 an(ix,jy,kz,lvh) = 0.0
11850 IF ( lhw .gt. 1 )
THEN
11851 an(ix,jy,kz,lhw) = 0.0
11854 IF ( lnhf .gt. 1 )
THEN
11855 an(ix,jy,kz,lnhf) = 0.0
11858 IF ( lzh .gt. 1 )
THEN
11859 an(ix,jy,kz,lzh) = 0.0
11863 IF ( lvol(lh) .gt. 1 )
THEN
11864 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
11865 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
11868 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
11871 IF ( tmp .lt. xdnmn(lh) )
THEN
11872 tmp = max( xdnmn(lh), tmp )
11873 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
11876 IF ( tmp .gt. xdnmx(lh) .and. lhw .le. 0 )
THEN
11877 tmp = min( xdnmx(lh), tmp )
11878 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
11879 ELSEIF ( tmp .gt. xdnmx(lh) .and. lhw .gt. 1 )
THEN
11880 fw = an(ix,jy,kz,lhw)/an(ix,jy,kz,lh)
11884 tmpmx = xdnmx(lh)/( 1. - fw*(1. - xdnmx(lh)/xdnmx(lr) ))
11886 IF ( tmp .gt. tmpmx )
THEN
11887 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmpmx
11900 IF ( lhw .gt. 1 )
THEN
11901 IF ( an(ix,jy,kz,lhw) .gt. 0.98*an(ix,jy,kz,lh) )
THEN
11903 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
11910 IF ( ipconc == 5 .and. an(ix,jy,kz,lh) .gt. qxmin(lh) .and. alphah .le. 0.1 .and. lnh .gt. 1 .and. lzh == 0 )
THEN
11912 IF ( lvh .gt. 1 )
THEN
11913 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
11914 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
11918 hwdn = max( xdnmn(lh), hwdn )
11922 tmp = (hwdn*an(ix,jy,kz,lnh))/(dn(ix,jy,kz)*an(ix,jy,kz,lh))
11923 tmpg = an(ix,jy,kz,lnh)*(tmp*(3.14159))**(1./3.)
11924 IF ( tmpg .lt. cnohmn )
THEN
11927 tmp = ( (hwdn)/(dn(ix,jy,kz)*an(ix,jy,kz,lh))*(3.14159))**(1./3.)
11928 an(ix,jy,kz,lnh) = (cnohmn/tmp)**(3./4.)
11936 if ( an(ix,jy,kz,ls) .lt. frac*qxmin(ls) .or. zerocx(ls) &
11938 IF ( t0(ix,jy,kz) .lt. 273.15 )
THEN
11940 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,ls)
11941 an(ix,jy,kz,ls) = 0.0
11944 IF ( ipconc .ge. 4 )
THEN
11946 an(ix,jy,kz,lns) = 0.0
11949 IF ( lvs .gt. 1 )
THEN
11950 an(ix,jy,kz,lvs) = 0.0
11953 IF ( lsw .gt. 1 )
THEN
11954 an(ix,jy,kz,lsw) = 0.0
11959 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,ls)
11960 an(ix,jy,kz,ls) = 0.0
11963 IF ( lvs .gt. 1 )
THEN
11964 an(ix,jy,kz,lvs) = 0.0
11967 IF ( lsw .gt. 1 )
THEN
11968 an(ix,jy,kz,lsw) = 0.0
11971 IF ( ipconc .ge. 4 )
THEN
11973 an(ix,jy,kz,lns) = 0.0
11979 ELSEIF ( lvol(ls) .gt. 1 )
THEN
11980 IF ( an(ix,jy,kz,lvs) .gt. 0.0 )
THEN
11981 tmp = dn(ix,jy,kz)*an(ix,jy,kz,ls)/an(ix,jy,kz,lvs)
11982 IF ( tmp .gt. xdnmx(ls) .or. tmp .lt. xdnmn(ls) )
THEN
11983 tmp = min( xdnmx(ls), max( xdnmn(ls), tmp ) )
11984 an(ix,jy,kz,lvs) = dn(ix,jy,kz)*an(ix,jy,kz,ls)/tmp
11988 an(ix,jy,kz,lvs) = dn(ix,jy,kz)*an(ix,jy,kz,ls)/tmp
11994 IF ( lzr > 1 )
THEN
11995 an(ix,jy,kz,lzr) = max(0.0, an(ix,jy,kz,lzr) )
11998 if ( an(ix,jy,kz,lr) .lt. frac*qxmin(lr) .or. zerocx(lr) &
12000 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lr)
12001 an(ix,jy,kz,lr) = 0.0
12002 IF ( ipconc .ge. 3 )
THEN
12004 an(ix,jy,kz,lnr) = 0.0
12007 IF ( lzr > 1 )
THEN
12008 an(ix,jy,kz,lzr) = 0.0
12016 IF ( an(ix,jy,kz,li) .le. frac*qxmin(li) .or. zerocx(li) &
12018 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,li)
12019 an(ix,jy,kz,li)= 0.0
12020 IF ( ipconc .ge. 1 )
THEN
12021 an(ix,jy,kz,lni) = 0.0
12028 IF ( lis > 1 )
THEN
12029 IF ( an(ix,jy,kz,lis) .le. frac*qxmin(lis) .or. zerocx(lis) &
12031 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lis)
12032 an(ix,jy,kz,lis)= 0.0
12033 IF ( ipconc .ge. 1 )
THEN
12034 an(ix,jy,kz,lnis) = 0.0
12037 ELSEIF ( icespheres >= 2 )
THEN
12039 IF ( 0.5*( w(ix,jy,kz) + w(ix,jy,kz+1)) < -1.0 .or. &
12040 & (icespheres == 3 .and. ( t0(ix,jy,kz) < 232.15 .or. an(ix,jy,kz,lc) < qxmin(lc) ) ) .or. &
12041 & (icespheres == 5 .and. ( t0(ix,jy,kz) < 232.15 .or. &
12042 & ( an(ix,jy,kz,lc) < qxmin(lc) .and. an(ix,jy,km1,lc) < qxmin(lc) )) ) .or. &
12043 & (icespheres == 4 .and. ( t0(ix,jy,kz) < 235.15 )) )
THEN
12044 an(ix,jy,kz,li) = an(ix,jy,kz,li) + an(ix,jy,kz,lis)
12045 an(ix,jy,kz,lni) = an(ix,jy,kz,lni) + an(ix,jy,kz,lnis)
12046 an(ix,jy,kz,lis)= 0.0
12047 an(ix,jy,kz,lnis)= 0.0
12058 IF ( an(ix,jy,kz,lc) .le. frac*qxmin(lc) .or. zerocx(lc) &
12060 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lc)
12061 an(ix,jy,kz,lc)= 0.0
12062 IF ( ipconc .ge. 2 )
THEN
12063 IF ( lccn .gt. 1 .or. ac_opt == 1 )
THEN
12064 IF ( irenuc < 5 .and. lccna <= 1 )
THEN
12065 IF ( ac_opt == 0 )
THEN
12066 an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) + max(0.0,an(ix,jy,kz,lnc))
12068 ELSEIF ( lccna > 1 )
THEN
12069 an(ix,jy,kz,lccna) = max( 0.0, an(ix,jy,kz,lccna) - max(0.0,an(ix,jy,kz,lnc)) )
12072 an(ix,jy,kz,lnc) = 0.0
12073 IF ( lccn > 1 ) an(ix,jy,kz,lccn) = max( 0.0, an(ix,jy,kz,lccn) )
12075 IF ( lccna > 0 .and. ac_opt == 0 )
THEN
12076 IF ( restoreccn )
THEN
12077 tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)
12079 IF ( an(ix,jy,kz,lccna) > 1. .and. tmp < qxmin(li) ) an(ix,jy,kz,lccna) = an(ix,jy,kz,lccna)*exp(-dtp/ccntimeconst)
12081 ELSEIF ( lccn > 1 .and. restoreccn .and. ac_opt == 0 )
THEN
12083 tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)
12088 IF ( an(ix,jy,kz,lccn) > 1. .and. tmp < qxmin(li) .and. ( an(ix,jy,kz,lccn) < dn(ix,jy,kz)*qccn .or. .not. invertccn ) )
THEN
12092 an(ix,jy,kz,lccn) = &
12093 dn(ix,jy,kz)*qccn - max(0.0 , dn(ix,jy,kz)*qccn - an(ix,jy,kz,lccn))*exp(-dtp/ccntimeconst)
12108 IF ( ndebug .ge. 1 )
write(6,*)
'END OF ICEZVD_DR'
12133 & (nx,ny,nz,na,jyslab &
12136 & ,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9 &
12140 & ventr,ventc,c1sw,jgs,ido, &
12144 & xdn0,tmp3d,tkediss &
12145 & ,thproc,numproc,dx1,dy1,ngs &
12146 & ,timevtcalc,axtra,io_flag &
12147 & , has_wetscav,rainprod2d, evapprod2d, alpha2d &
12149 & ,elec,its,ids,ide,jds,jde &
12213 integer,
parameter :: ng1 = 1
12215 integer nx,ny,nz,na,nba,nv
12216 integer nor,norz,istag,jstag,kstag
12220 logical,
intent(in) :: io_flag
12222 integer itile,jtile,ktile
12223 integer ixbeg,jybeg
12224 integer ixend,jyend,kzend,kzbeg
12225 integer nxend,nyend,nzend,nzbeg
12226 integer :: my_rank = 0
12227 integer,
parameter :: myprock = 1, nprock = 1
12228 logical,
intent(in) :: has_wetscav
12229 integer,
intent(in) :: numproc
12230 real,
intent(inout) :: thproc(nz,numproc)
12231 real,
intent(in) :: dx1,dy1
12232 real rainprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
12233 real evapprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
12236 real :: alpha2d(-nor+1:nx+nor,-norz+ng1:nz+norz,3)
12238 real,
parameter :: tfrdry = 243.15
12240 logical lrescalelow(lc:lhab)
12241 real tkediss(-nor+1:nx+nor,-norz+ng1:nz+norz)
12242 real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
12247 integer jyslab,its,ids,ide,jds,jde
12248 integer,
intent(in) :: iunit
12250 integer iraincv, icgxconv
12251 parameter( iraincv = 1, icgxconv = 1)
12253 real :: ffrzh = 1.0
12255 real qcitmp,cirdiatmp
12261 double precision dp1
12263 double precision frac, frach, xvfrz, xvbiggsnow
12265 double precision :: timevtcalc
12266 double precision :: dpt1,dpt2
12268 logical,
parameter :: gammacheck = .false.
12270 double precision :: tmpgam
12271 logical,
parameter :: usegamxinfcnu = .false.
12272 logical,
parameter :: usegamxinf = .false.
12273 logical,
parameter :: usegamxinf2 = .false.
12274 logical,
parameter :: usegamxinf3 = .false.
12278 character(len=*),
intent( out) :: errmsg
12279 integer,
intent( out) :: errflg
12284 double precision chgneg,chgpos,sctot
12288 real pb(-norz+ng1:nz+norz)
12289 real pinit(-norz+ng1:nz+norz)
12291 real gz(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12293 real qimax,xni0,roqi0
12299 integer itest,nidx,id1,jd1,kd1
12302 parameter(id1=1,jd1=1,kd1=1)
12306 integer ix,kz, il, ic, ir, icp1, irp1, ip1,jp1,kp1
12310 real slope1, slope2
12313 parameter(eps=1.e-20,eps2=1.e-5)
12320 logical ldovol, ishail, ltest, wtest
12321 logical ,
parameter :: alp0flag = .false.
12327 parameter(mu=1,mv=2,mw=3)
12331 integer mqcw,mqxw,mtem,mrho,mtim
12332 parameter(mqcw=21,mqxw=21,mtem=21,mrho=5,mtim=6)
12334 real xftim,xftimi,yftim, xftem,yftem, xfqcw,yfqcw, xfqxw,yfqxw
12335 parameter(xftim=0.05,xftimi = 1./xftim,yftim=1.)
12336 parameter(xftem=0.5,yftem=1.)
12337 parameter(xfqcw=2000.,yfqcw=1.)
12338 parameter(xfqxw=2000.,yfqxw=1.)
12340 parameter( dtfac = 1.0 )
12341 integer ido(lc:lqmx)
12354 real delqnxa(lc:lqmx)
12355 real delqxxa(lc:lqmx)
12359 real t00(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12360 real t77(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12362 real t0(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12363 real t1(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12364 real t2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12365 real t3(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12366 real t4(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12367 real t5(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12368 real t6(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12369 real t7(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12370 real t8(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12371 real t9(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12373 real p2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12374 real pn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12375 real an(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,na)
12376 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12377 real w(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12379 real tmp3d(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12384 integer nxmpb,nzmpb,nxz
12385 integer jgs,mgs,ngs,numgs
12386 integer,
parameter :: ngsz = 500
12392 integer ngscnt,igs(ngs),kgs(ngs)
12393 integer kgsp(ngs),kgsm(ngs),kgsm2(ngs)
12396 integer il0(ngs),il5(ngs),il2(ngs),il3(ngs)
12399 real tdtol,temsav,tfrcbw,tfrcbi
12400 real,
parameter :: thnuc = 235.15
12404 real fimt1(ngs),fimta(ngs),fimt2(ngs)
12412 real ccnc(ngs),ccin(ngs),cina(ngs),ccna(ngs)
12415 parameter( sscb = 2.0 )
12417 parameter( idecss = 1 )
12423 parameter( ifilt = 0 )
12425 real :: mwat, mice, dice, mwshed, fwmax, fw, mwcrit, massfactor, tmpdiam
12426 real,
parameter :: shedalp = 3.
12432 real bfnu, bfnu0, bfnu1
12433 parameter( bfnu0 = (rnu + 2.0)/(rnu + 1.0) )
12436 double precision t2s, xdp
12437 double precision xl2p(ngs),rb(ngs)
12438 real,
parameter :: aa1 = 9.44e15, aa2 = 5.78e3
12440 real,
parameter :: cexs = 0.1, cecs = 0.5
12441 real,
parameter :: rvt = 0.104
12442 real,
parameter :: kfrag = 1.0e-6
12443 real,
parameter :: mfrag = 1.0e-10
12444 double precision cautn(ngs), rh(ngs), nh(ngs)
12445 real ex1, ft, rhoinv(ngs)
12446 double precision ec0(ngs)
12448 real ac1,bc, taus, c1,d1,e1,f1,p380,tmp,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,temp3
12451 double precision :: tmpz, tmpzmlt
12452 real ratio, delx, dely
12454 real chgtmp,fac,mixedphasefac
12455 real x,y,y2,del,r,rtmp,alpr
12456 double precision :: vent1,vent2
12457 double precision :: g1palp,g4palp
12458 double precision :: g1palpinf,g4palpinf
12462 real d1r, d1i, d1s, e1i
12464 real,
parameter :: vr1mm = 5.23599e-10
12465 real,
parameter :: vr3mm = 5.23599e-10*(3.0/1.)**3
12466 real,
parameter :: vr4p5mm = 5.23599e-10*(4.5/1.)**3
12467 real vmlt,vshd, vshdgs(ngs,lh:lhab), maxmassfac(lc:lhab)
12469 parameter( rhosm = 500. )
12471 real dtcon,dtcon1,dtcon2
12473 integer ltemq1,ltemq1m
12474 real dqv,qv1,ss1,ss2,qvs1,dqvs,dtemp,dt1
12475 real ssi1, ssi2, dqvi, dqvis, dqvii,qis1
12476 real dqvr, dqc, dqr, dqi, dqs
12477 real qv1m,qvs1m,ss1m,ssi1m,qis1m
12479 real dcloud,dcloud2
12481 double precision xvc, xvr
12489 parameter( vgra = 0.523599*(1.0e-3)**3 )
12493 real :: d, dold, denom,denominv,vth
12494 double precision :: h1, h2, h3, h4,denomdp, denominvdp
12497 real vr,nrx,chw,g1,qr,z,z1,rdi,alp,xnutmp,xnuc,g1r,rd1,rdia,rmas
12498 real :: snowmeltmass = 0
12501 real,
parameter :: rimedens = 500.
12508 parameter( raero = 3.e-7, kaero = 5.39e-3 )
12510 parameter(kb = 1.3807e-23)
12512 real knud(ngs),knuda(ngs)
12515 real fn1(ngs),fn2(ngs),fnft(ngs)
12518 real ctfzbd(ngs),ctfzth(ngs),ctfzdi(ngs)
12523 real dqvcnd(ngs),dqwv(ngs),dqcw(ngs),dqci(ngs),dqcitmp(ngs),dqwvtmp(ngs)
12525 real temg(ngs),temcg(ngs),theta(ngs),qvap(ngs)
12526 real temgkm1(ngs), temgkm2(ngs)
12527 real temgx(ngs),temcgx(ngs)
12528 real qvs(ngs),qis(ngs),qss(ngs),pqs(ngs)
12529 real elv(ngs),elf(ngs),els(ngs)
12530 real tsqr(ngs),ssi(ngs),ssw(ngs),ssi0(ngs)
12531 real qcwtmp(ngs),qtmp,qtot(ngs)
12534 real cimasn,cimasx,ccimx
12536 real cs,ds,gf7,gf6,gf5,gf4,gf3,gf2,gf1
12538 real gf73rds, gf83rds
12539 real gamice73fac, gamsnow73fac
12540 real gf43rds, gf53rds
12541 real aradcw,bradcw,cradcw,dradcw,cwrad,rwrad,rwradmn
12542 parameter( rwradmn = 50.e-6 )
12544 real dg0(ngs),df0(ngs)
12545 real dhwet(ngs),dhlwet(ngs),dfwet(ngs)
12547 real clionpmx,clionnmx
12548 parameter(clionpmx=1.e9,clionnmx=1.e9)
12552 real fwet1(ngs),fwet2(ngs)
12553 real fmlt1(ngs),fmlt2(ngs),fmlt1e(ngs)
12554 real fvds(ngs),fvce(ngs),fiinit(ngs)
12555 real fvent(ngs),fraci(ngs),fracl(ngs)
12557 real fai(ngs),fav(ngs),fbi(ngs),fbv(ngs)
12558 real felv(ngs),fels(ngs),felf(ngs)
12559 real felvcp(ngs),felscp(ngs),felfcp(ngs)
12560 real felvpi(ngs),felspi(ngs),felfpi(ngs)
12561 real felvs(ngs),felss(ngs)
12562 real fwvdf(ngs),ftka(ngs),fthdf(ngs)
12563 real fadvisc(ngs),fakvisc(ngs)
12564 real fci(ngs),fcw(ngs)
12565 real fschm(ngs),fpndl(ngs)
12566 real fgamw(ngs),fgams(ngs)
12567 real fcqv1(ngs),fcqv2(ngs),fcc3(ngs)
12571 real,
parameter :: cpv = 1885.0
12573 real fcci(ngs), fcip(ngs)
12575 real :: sfm1(ngs),sfm2(ngs)
12576 real :: gfm1(ngs),gfm2(ngs)
12577 real :: ffm1(ngs),ffm2(ngs)
12578 real :: hfm1(ngs),hfm2(ngs)
12580 logical :: wetsfc(ngs),wetsfchl(ngs),wetsfcf(ngs)
12581 logical :: wetgrowth(ngs), wetgrowthhl(ngs), wetgrowthf(ngs)
12583 real qitmp(ngs),qistmp(ngs)
12585 real rzxh(ngs), rzxhl(ngs), rzxhlh(ngs), rzxhlf(ngs)
12586 real rzxs(ngs), rzxf(ngs)
12588 real cdh(ngs),cdhl(ngs)
12589 real :: axx(ngs,lh:lhab),bxx(ngs,lh:lhab)
12592 real :: qcwresv(ngs), ccwresv(ngs)
12594 real :: lfsave(ngs,6)
12595 real :: qx(ngs,lv:lhab)
12596 real :: qxw(ngs,ls:lhab)
12597 real :: qxwlg(ngs,lh:lhab)
12598 real :: chxf(ngs,lh:lhab)
12599 real :: cx(ngs,lc:lhab)
12600 real :: cxmxd(ngs,lc:lhab)
12601 real :: qxmxd(ngs,lv:lhab)
12602 real :: scx(ngs,lc:lhab)
12603 real :: xv(ngs,lc:lhab)
12604 real :: vtxbar(ngs,lc:lhab,3)
12605 real :: xmas(ngs,lc:lhab)
12606 real :: xdn(ngs,lc:lhab)
12607 real :: xdntmp(ngs,lc:lhab)
12608 real :: cdxgs(ngs,lc:lhab)
12609 real :: xdia(ngs,lc:lhab,3)
12610 real :: vtwtdia(ngs,lr:lhab)
12611 real :: rarx(ngs,ls:lhab)
12612 real :: vx(ngs,li:lhab)
12613 real :: rimdn(ngs,li:lhab)
12614 real :: raindn(ngs,li:lhab)
12615 real :: alpha(ngs,lc:lhab)
12616 real :: dab0lh(ngs,lc:lhab,lc:lhab)
12617 real :: dab1lh(ngs,lc:lhab,lc:lhab)
12618 real :: zx(ngs,lr:lhab)
12619 real :: zxmxd(ngs,lr:lhab)
12620 real :: g1x(ngs,lr:lhab)
12623 real :: qsimxdep(ngs)
12624 real :: qsimxsub(ngs)
12625 logical,
parameter :: DoSublimationFix = .true.
12626 real :: qrtmp(ngs),qvtmp(ngs),qctmp(ngs)
12627 real :: felvcptmp,felscptmp,qsstmp
12628 real :: thetatmp, thetaptmp, temcgtmp,qvaptmp
12629 real :: qvstmp, qisstmp, qvptmp, qitmp1, qctmp1
12635 real g1shr, alphashr
12636 real g1mlr, alphamlr
12637 real g1smlr, alphasmlr
12638 real massfacshr, massfacmlr
12645 real,
parameter :: fwmhtmptem = -15.
12646 real,
parameter :: d1t = (6.0 * 0.268e-3/(917.* pi))**(1./3.)
12647 real,
parameter :: srasheym = 0.1389
12649 real swvent(ngs),hwvent(ngs),rwvent(ngs),hlvent(ngs),hwventy(ngs),hlventy(ngs),rwventz(ngs)
12651 real hlventinc(ngs),hwventinc(ngs)
12652 integer,
parameter :: ndiam = 10
12654 real hwvent0(ndiam+4),hlvent0
12655 real hwvent1,hlvent1
12656 real hwvent2,hlvent2
12661 real :: mltdiam(ndiam+4)
12662 real mltmass0inv,mltmass1inv,mltmass2inv, mltmass1cgs, mltmass2cgs,mltmass3inv, mltmass3cgs
12663 real qhmlr0, qhmlr05, qhmlr1, qhmlr2,qhmlr3, qhmlr12, qhmlr23
12664 real qhlmlr0, qhlmlr05, qhlmlr1, qhlmlr2,qhlmlr3, qhlmlr12, qhlmlr23
12665 real qxd1, cxd1, zxd1
12668 real :: qxd(ndiam+4), cxd(ndiam+4), qhml(ndiam+4), qhml0(ndiam+4)
12669 real :: dqxd(ndiam+4), dcxd(ndiam+4), dqhml(ndiam+4)
12676 real xdnmx(lc:lhab), xdnmn(lc:lhab)
12678 real :: xdiamxmas(ngs,lc:lhab)
12683 real rwcap(ngs),swcap(ngs)
12690 real qimxd(ngs),qismxd(ngs),qcmxd(ngs),qrmxd(ngs),qsmxd(ngs),qhmxd(ngs),qhlmxd(ngs)
12691 real cimxd(ngs),ccmxd(ngs),crmxd(ngs),csmxd(ngs),chmxd(ngs)
12692 real cionpmxd(ngs),cionnmxd(ngs)
12693 real clionpmxd(ngs),clionnmxd(ngs)
12696 real elec(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12701 real chmul1(ngs),chlmul1(ngs),csmul1(ngs),csmul(ngs)
12702 real qhmul1(ngs),qhlmul1(ngs),qsmul1(ngs),qsmul(ngs)
12705 real csplinter(ngs),qsplinter(ngs)
12706 real csplinter2(ngs),qsplinter2(ngs)
12711 real :: chlcnh(ngs), vhlcnh(ngs), vhlcnhl(ngs)
12712 real :: chlcnhhl(ngs)
12713 real cracif(ngs), ciacrf(ngs)
12717 real ciint(ngs), crfrz(ngs), crfrzf(ngs), crfrzs(ngs)
12720 real ciacw(ngs), cwacii(ngs)
12721 real ciacr(ngs), craci(ngs)
12724 real csaci(ngs), csacs(ngs)
12726 real chacw(ngs), chacr(ngs)
12727 real :: chlacw(ngs)
12728 real chaci(ngs), chacs(ngs)
12730 real :: chlacr(ngs)
12731 real :: chlaci(ngs), chlacs(ngs)
12733 real cidpv(ngs),cisbv(ngs)
12734 real cisdpv(ngs),cissbv(ngs)
12735 real cimlr(ngs),cismlr(ngs)
12737 real chlsbv(ngs), chldpv(ngs)
12738 real chlmlr(ngs), chlmlrr(ngs)
12741 real chlshr(ngs), chlshrr(ngs)
12744 real chdpv(ngs),chsbv(ngs)
12745 real chmlr(ngs),chcev(ngs)
12747 real chshr(ngs), chshrr(ngs)
12749 real csdpv(ngs),cssbv(ngs)
12750 real csmlr(ngs),csmlrr(ngs),cscev(ngs)
12751 real csshr(ngs), csshrr(ngs)
12755 real cwshw(ngs), qwshw(ngs)
12762 real qrcnw(ngs), qwcnr(ngs)
12763 real zrcnw(ngs),zracr(ngs),zracw(ngs),zrcev(ngs)
12770 real :: qhlacw(ngs), qxacwtmp, qxacrtmp, qxacitmp, qxacstmp
12771 real vhacw(ngs), vsacw(ngs), vhlacw(ngs), vhlacr(ngs)
12774 real qfmul1(ngs),cfmul1(ngs)
12781 real qsacr(ngs),qracs(ngs)
12782 real qhacr(ngs),qhacrmlr(ngs),qhacwmlr(ngs)
12783 real vhacr(ngs), zhacr(ngs), zhacrf(ngs), zrach(ngs), zrachl(ngs)
12784 real qiacr(ngs),qraci(ngs)
12788 real qracif(ngs),qiacrf(ngs),qiacrs(ngs),ciacrs(ngs)
12790 real :: qhlacr(ngs),qhlacrmlr(ngs), qhlacwmlr(ngs)
12800 real :: qhacis(ngs)
12801 real :: chacis(ngs)
12802 real :: chacis0(ngs)
12804 real :: csaci0(ngs)
12805 real :: chaci0(ngs)
12806 real :: chacs0(ngs)
12807 real :: chlaci0(ngs)
12808 real :: chlacis(ngs)
12809 real :: chlacis0(ngs)
12810 real :: chlacs0(ngs)
12812 real :: qsaci0(ngs)
12813 real :: qsacis0(ngs)
12814 real :: qhaci0(ngs)
12815 real :: qhacis0(ngs)
12816 real :: qhacs0(ngs)
12817 real :: qhlaci0(ngs)
12818 real :: qhlacis0(ngs)
12819 real :: qhlacs0(ngs)
12821 real :: qhlaci(ngs)
12822 real :: qhlacis(ngs)
12823 real :: qhlacs(ngs)
12828 real zrfrz(ngs), zrfrzf(ngs), zrfrzs(ngs)
12829 real ziacrf(ngs), zhcnsh(ngs), zhcnih(ngs)
12830 real zhacw(ngs), zhacs(ngs), zhaci(ngs)
12831 real zhmlr(ngs), zhdsv(ngs), zhsbv(ngs), zhlcnh(ngs), zhshr(ngs)
12832 real zfacw(ngs), zfacs(ngs), zfaci(ngs)
12833 real zfmlr(ngs), zfdsv(ngs), zfsbv(ngs), zhlcnf(ngs), zfshr(ngs), zfshrr(ngs)
12834 real zhmlrtmp,zhmlr0inf,zhlmlr0inf
12835 real zhmlrr(ngs),zhlmlrr(ngs),zhshrr(ngs),zhlshrr(ngs),zfmlrr(ngs)
12837 real zsmlrr(ngs), zsshr(ngs), zsshrr(ngs)
12838 real zhcns(ngs), zhcni(ngs)
12839 real zhwdn(ngs), zfwdn(ngs)
12842 real zhlacw(ngs), zhlacs(ngs), zhlacr(ngs)
12843 real zhlmlr(ngs), zhldsv(ngs), zhlsbv(ngs), zhlshr(ngs)
12846 real vrfrzf(ngs), viacrf(ngs)
12847 real qrfrzs(ngs), qrfrzf(ngs)
12848 real qwfrz(ngs), qwctfz(ngs)
12849 real cwfrz(ngs), cwctfz(ngs)
12850 real qwfrzis(ngs), qwctfzis(ngs)
12851 real cwfrzis(ngs), cwctfzis(ngs)
12852 real qwfrzc(ngs), qwctfzc(ngs)
12853 real cwfrzc(ngs), cwctfzc(ngs)
12854 real qwfrzp(ngs), qwctfzp(ngs)
12855 real cwfrzp(ngs), cwctfzp(ngs)
12856 real xcolmn(ngs), xplate(ngs)
12857 real ciihr(ngs), qiihr(ngs)
12858 real cicichr(ngs), qicichr(ngs)
12859 real cipiphr(ngs), qipiphr(ngs)
12860 real qscni(ngs), cscni(ngs), cscnis(ngs)
12861 real qscnvi(ngs), cscnvi(ngs), cscnvis(ngs)
12862 real qhcns(ngs), chcns(ngs), chcnsh(ngs), vhcns(ngs)
12863 real qscnh(ngs), cscnh(ngs), vscnh(ngs)
12864 real qhcni(ngs), chcni(ngs), chcnih(ngs), vhcni(ngs)
12865 real qiint(ngs),qipipnt(ngs),qicicnt(ngs)
12866 real cninm(ngs),cnina(ngs),cninp(ngs),wvel(ngs),wvelkm1(ngs)
12868 real uvel(ngs),vvel(ngs)
12870 real qidpv(ngs),qisbv(ngs)
12871 real qimlr(ngs),qidsv(ngs),qisdsv(ngs),qidsvp(ngs)
12876 real :: qhldpv(ngs), qhlsbv(ngs)
12877 real :: qhlmlr(ngs), qhldsv(ngs), qhlmlrsave(ngs)
12878 real :: qhlwet(ngs), qhldry(ngs), qhlshr(ngs), qxwettmp
12880 real :: qrfz(ngs),qsfz(ngs),qhfz(ngs),qhlfz(ngs)
12883 real qhdpv(ngs),qhsbv(ngs)
12884 real qhmlr(ngs),qhdsv(ngs),qhcev(ngs),qhcndv(ngs),qhevv(ngs)
12885 real qhlcev(ngs), chlcev(ngs)
12886 real qhwet(ngs),qhdry(ngs),qhshr(ngs)
12894 real qhmlrlg(ngs),qhlmlrlg(ngs)
12896 real qhlfzhllg(ngs)
12897 real qhlcevlg(ngs), chlcevlg(ngs)
12898 real qhcevlg(ngs), chcevlg(ngs)
12900 real vhfzh(ngs), vffzf(ngs)
12911 real qsdpv(ngs),qssbv(ngs)
12912 real qsmlr(ngs),qsdsv(ngs),qscev(ngs),qscndv(ngs),qsevv(ngs)
12913 real qswet(ngs),qsdry(ngs),qsshr(ngs)
12918 real qipdpv(ngs),qipsbv(ngs)
12919 real qipmlr(ngs),qipdsv(ngs)
12921 real qirdpv(ngs),qirsbv(ngs)
12922 real qirmlr(ngs),qirdsv(ngs),qirmlw(ngs)
12924 real qgldpv(ngs),qglsbv(ngs)
12925 real qglmlr(ngs),qgldsv(ngs)
12926 real qglwet(ngs),qgldry(ngs),qglshr(ngs)
12929 real qgmdpv(ngs),qgmsbv(ngs)
12930 real qgmmlr(ngs),qgmdsv(ngs)
12931 real qgmwet(ngs),qgmdry(ngs),qgmshr(ngs)
12933 real qghdpv(ngs),qghsbv(ngs)
12934 real qghmlr(ngs),qghdsv(ngs)
12935 real qghwet(ngs),qghdry(ngs),qghshr(ngs)
12938 real qrztot(ngs),qrzmax(ngs),qrzfac(ngs)
12941 real fsw(ngs),fhw(ngs),fhlw(ngs),ffw(ngs)
12942 real fswmax(ngs),fhwmax(ngs),fhlwmax(ngs)
12945 real :: qhlcnh(ngs)
12946 real qhcngh(ngs),qhcngm(ngs),qhcngl(ngs)
12948 real :: qhcnhl(ngs), chcnhl(ngs), zhcnhl(ngs), vhcnhl(ngs)
12950 real eiw(ngs),eii(ngs),eiri(ngs),eipir(ngs),eisw(ngs)
12951 real erw(ngs),esw(ngs),eglw(ngs),eghw(ngs),efw(ngs)
12952 real ehxw(ngs),ehlw(ngs),egmw(ngs),ehw(ngs)
12953 real err(ngs),esr(ngs),eglr(ngs),eghr(ngs),efr(ngs)
12954 real ehxr(ngs),ehlr(ngs),egmr(ngs)
12955 real eri(ngs),esi(ngs),egli(ngs),eghi(ngs),efi(ngs),efis(ngs)
12956 real ehxi(ngs),ehli(ngs),egmi(ngs),ehi(ngs),ehis(ngs),ehlis(ngs)
12957 real ers(ngs),ess(ngs),egls(ngs),eghs(ngs),efs(ngs),ehs(ngs),ehsfac(ngs)
12959 real ehxs(ngs),ehls(ngs),egms(ngs),egmip(ngs)
12961 real ehsclsn(ngs),ehiclsn(ngs),ehisclsn(ngs)
12962 real efsclsn(ngs),eficlsn(ngs),efisclsn(ngs)
12963 real ehlsclsn(ngs),ehliclsn(ngs),ehlisclsn(ngs)
12966 real :: ehs_collsn = 0.5, ehi_collsn = 1.0
12967 real :: efs_collsn = 0.5, efi_collsn = 1.0
12968 real :: ehls_collsn = 1.0, ehli_collsn = 1.0
12969 real :: esi_collsn = 1.0
12973 data cwr / 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0 , &
12974 & 1.0, 1.0, 0.5, 0.5, 0.5, 0.2, 0.2, 1. /
12975 integer icwr(ngs), igwr(ngs), irwr(ngs), ihlr(ngs), ifwr(ngs)
12977 data grad / 100., 200., 300., 400., 600., 1000., &
12978 & 1.e-2,1.e-2,1.e-2,5.e-3,2.5e-3, 1. /
12980 data ew /0.03, 0.07, 0.17, 0.41, 0.58, 0.69, 0.82, 0.88, &
12982 & 0.10, 0.20, 0.34, 0.58, 0.70, 0.78, 0.88, 0.92, &
12983 & 0.15, 0.31, 0.44, 0.65, 0.75, 0.83, 0.96, 0.91, &
12984 & 0.17, 0.37, 0.50, 0.70, 0.81, 0.87, 0.93, 0.96, &
12985 & 0.17, 0.40, 0.54, 0.71, 0.83, 0.88, 0.94, 0.98, &
12986 & 0.15, 0.37, 0.52, 0.74, 0.82, 0.88, 0.94, 0.98 /
12990 real da0lr(ngs),da1lr(ngs)
12991 real da0lc(ngs),da1lc(ngs)
12995 real :: da0lx(ngs,lr:lhab)
12998 real vab0(lc:lqmx,lc:lqmx)
12999 real vab1(lc:lqmx,lc:lqmx)
13001 real ehip(ngs),ehlip(ngs),ehlir(ngs)
13002 real erir(ngs),esir(ngs),eglir(ngs),egmir(ngs),eghir(ngs)
13003 real efir(ngs),ehir(ngs),eirw(ngs),eirir(ngs),ehr(ngs)
13004 real erip(ngs),esip(ngs),eglip(ngs),eghip(ngs)
13005 real efip(ngs),eipi(ngs),eipw(ngs),eipip(ngs)
13011 real pqcwi(ngs),pqcii(ngs),pqrwi(ngs),pqisi(ngs)
13012 real pqswi(ngs),pqhwi(ngs),pqwvi(ngs)
13013 real pqgli(ngs),pqghi(ngs),pqfwi(ngs)
13014 real pqgmi(ngs),pqhli(ngs)
13015 real pqiri(ngs),pqipi(ngs)
13016 real pqlwsi(ngs),pqlwhi(ngs),pqlwhli(ngs),pqlwfi(ngs)
13018 real pqlwlghi(ngs),pqlwlghli(ngs)
13019 real pqlwlghd(ngs),pqlwlghld(ngs)
13024 real pvhwi(ngs), pvhwd(ngs)
13025 real pvfwi(ngs), pvfwd(ngs)
13026 real pvhli(ngs), pvhld(ngs)
13027 real pvswi(ngs), pvswd(ngs)
13029 real pqcwd(ngs),pqcid(ngs),pqrwd(ngs),pqisd(ngs), pqcwdacc(ngs)
13030 real pqswd(ngs),pqhwd(ngs),pqwvd(ngs)
13031 real pqgld(ngs),pqghd(ngs),pqfwd(ngs)
13032 real pqgmd(ngs),pqhld(ngs)
13033 real pqird(ngs),pqipd(ngs)
13034 real pqlwsd(ngs),pqlwhd(ngs),pqlwhld(ngs),pqlwfd(ngs)
13039 real pcipi(ngs), pcipd(ngs)
13040 real pciri(ngs), pcird(ngs)
13041 real pccwi(ngs), pccwd(ngs), pccwdacc(ngs)
13042 real pccii(ngs), pccid(ngs)
13043 real pcisi(ngs), pcisd(ngs)
13045 real pcrwi(ngs), pcrwd(ngs)
13046 real pcswi(ngs), pcswd(ngs)
13047 real pchwi(ngs), pchwd(ngs)
13048 real pchli(ngs), pchld(ngs)
13049 real pcfwi(ngs), pcfwd(ngs)
13050 real pcgli(ngs), pcgld(ngs)
13051 real pcgmi(ngs), pcgmd(ngs)
13052 real pcghi(ngs), pcghd(ngs)
13054 real pzrwi(ngs), pzrwd(ngs)
13055 real pzhwi(ngs), pzhwd(ngs)
13056 real pzfwi(ngs), pzfwd(ngs)
13057 real pzhli(ngs), pzhld(ngs)
13058 real pzswi(ngs), pzswd(ngs)
13068 real pres(ngs),pipert(ngs)
13070 real rho0(ngs),pi0(ngs)
13071 real rhovt(ngs),sqrtrhovt
13072 real thetap(ngs),theta0(ngs),qwvp(ngs),qv0(ngs)
13074 real ptwfzi(ngs),ptimlw(ngs)
13075 real psub(ngs),pvap(ngs),pfrz(ngs),ptem(ngs),pmlt(ngs),pevap(ngs),pdep(ngs),ptem2(ngs)
13089 parameter(iholef = 1)
13090 parameter(iholen = 1)
13091 real cqtotn,cqtotn1
13101 real cqtotp,cqtotp1
13126 real ssifac, qvapor
13130 real,
parameter :: cwmas30 = 1000.*0.523599*(2.*30.e-6)**3
13131 real,
parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3
13132 integer ireadqf,lrho,lqsw,lqgl,lqgm ,lqgh
13136 real erbnd1, fdgt1, costhe1
13138 real dyi2,dzi2,bta1,cnit,dragh,dnz00,pii
13139 real qccrit,gf4br,gf4ds,gf4p5, gf3ds, gf1ds
13144 real xdn_new,drhodt
13146 integer l ,ltemq,inumgs, idelq
13153 real cval,aval,eval,fval,gval ,qsign,ftelwc,qconkq,elecfac,altelecfac
13154 real qconm,qconn,cfce15,gf8,gf4i,gf3p5,gf1a,gf1p5,qdiff,argrcnw
13155 real c4,bradp,bl2,bt2,dthr,hrifac, hdia0,hdia1,civenta,civentb
13156 real civentc,civentd,civente,civentf,civentg,cireyn,xcivent
13157 real cipventa,cipventb,cipventc,cipventd,cipreyn,cirventa
13159 integer igmrwa,igmrwb,igmswa, igmswb,igmfwa,igmfwb,igmhwa,igmhwb
13160 real rwventa ,rwventb,swventa,swventb,fwventa,fwventb,fwventc
13161 real hwventa,hwventb
13162 real hwventc, hlventa, hlventb, hlventc
13163 real glventa, glventb, glventc
13164 real gmventa, gmventb, gmventc, ghventa, ghventb, ghventc
13165 real dzfacp, dzfacm, cmassin, cwdiar
13166 real rimmas, rhobar
13167 real argtim, argqcw, argqxw, argtem
13168 real frcswsw, frcswgl, frcswgm, frcswgh, frcswfw, frcswsw1
13169 real frcglgl, frcglgm, frcglgh, frcglfw, frcglgl1
13170 real frcgmgl, frcgmgm, frcgmgh, frcgmfw, frcgmgm1
13171 real frcghgl, frcghgm, frcghgh, frcghfw, frcghgh1
13172 real frcfwgl, frcfwgm, frcfwgh, frcfwfw, frcfwfw1
13173 real frcswrsw, frcswrgl, frcswrgm, frcswrgh, frcswrfw
13175 real frcrswsw, frcrswgl, frcrswgm, frcrswgh, frcrswfw
13177 real frcglrgl, frcglrgm, frcglrgh, frcglrfw, frcglrgl1
13179 real frcrglgm, frcrglgh, frcrglfw, frcrglgl1
13180 real frcgmrgl, frcgmrgm, frcgmrgh, frcgmrfw, frcgmrgm1
13181 real frcrgmgl, frcrgmgm, frcrgmgh, frcrgmfw, frcrgmgm1
13182 real total, qweps, gf2a, gf4a, dqldt, dqidt, dqdt
13183 real frcghrgl, frcghrgm, frcghrgh, frcghrfw, frcghrgh1, frcrghgl
13184 real frcrghgm, frcrghgh, frcrghfw, frcrghgh1
13185 real a1,a2,a3,a4,a5,a6
13187 real cdw, cdi, denom1, denom2, delqci1, delqip1
13188 real cirtotn, ciptotn, cgmtotn, chltotn, cirtotp
13189 real cgmfac, chlfac, cirfac
13190 integer igmhla, igmhlb, igmgla, igmglb, igmgma, igmgmb
13191 integer igmgha, igmghb
13192 integer idqis, item, itim0
13193 integer iqgl, iqgm, iqgh, iqrw, iqsw
13200 integer cntnic_noliq
13201 real q_noliqmn, q_noliqmx
13202 real scsacimn, scsacimx
13208 real :: xden,xmlt,cmlt,cmlttot,fventm,fventh,am,ah,felfinv,dmwdt
13210 real :: qhmlrtmp,qhmlrtmp2, chmlrtmp, chmlrtmpd1inf, chlmlrtmp, zhlmlrtmp, zhlmlrrtmp, qvs0,tmpcmlt
13212 real :: term1,term2,term3,term4
13216 real,
parameter :: c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0
13217 real,
parameter :: c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5
13218 real,
parameter :: c1hl=3.7, c2hl=0.3, c3hl=9.0, c4hl=6.5, c5hl=1.0, c6hl=6.5
13222 real :: galpha, dgalpha
13224 logical,
parameter :: newton = .false.
13227 galpha(a_in) = ((4. + a_in)*(5. + a_in)*(6. + a_in))/((1. + a_in)*(2. + a_in)*(3. + a_in))
13228 dgalpha(a_in) = (876. + 1260.*a_in + 621.*a_in**2 + 126.*a_in**3 + 9.*a_in**4)/ &
13229 & (36. + 132.*a_in + 193.*a_in**2 + 144.*a_in**3 + 58.*a_in**4 + 12.*a_in**5 + a_in**6)
13259 lrescalelow(:) = rescale_low_alpha
13260 lrescalelow(lr) = rescale_low_alphar .and. rescale_low_alpha
13261 lrescalelow(lh) = rescale_low_alphah .and. rescale_low_alpha
13262 IF ( lf > 1 ) lrescalelow(lf) = rescale_low_alphah .and. rescale_low_alpha
13263 IF ( lhl > 1 ) lrescalelow(lhl) = rescale_low_alphahl .and. rescale_low_alpha
13270 IF ( ngs .lt. nz )
THEN
13284 ldovol = ldovol .or. ( lvol(il) .gt. 1 )
13322 bradcw = 0.26249e+06
13323 cradcw = -1.8896e+10
13324 dradcw = 4.4626e+14
13338 gf1p5 = 0.8862269255
13346 gf4br = 17.837861981813607
13347 gf4ds = 10.41688578110938
13348 gf4p5 = 11.63172839656745
13349 gf3ds = 3.0458730354120997
13350 gf1ds = 0.8863557896089221
13352 gf43rds = 0.8929795116
13353 gf53rds = 0.9027452930
13354 gf73rds = 1.190639349
13355 gf83rds = 1.504575488
13357 gamice73fac = (
gamma_sp(7./3. + cinu))**3/ (
gamma_sp(1. + cinu)**3 * (1. + cinu)**4)
13358 gamsnow73fac = (
gamma_sp(7./3. + snu))**3/ (
gamma_sp(1. + snu)**3 * (1. + snu)**4)
13371 bfnu1 = (4. + alphar)*(5. + alphar)*(6. + alphar)/ &
13372 & ((1. + alphar)*(2. + alphar)*(3. + alphar))
13374 galpharaut = (6.+alpharaut)*(5.+alpharaut)*(4.+alpharaut)/ &
13375 & ((3.+alpharaut)*(2.+alpharaut)*(1.+alpharaut))
13377 vfrz = 0.523599*(dfrz)**3
13378 vmlt = min(xvmx(lr), 0.523599*(dmlt)**3 )
13379 vshd = min(xvmx(lr), 0.523599*(dshd)**3 )
13381 IF ( snowmeltdia > 0.0 )
THEN
13382 snowmeltmass = pi/6.0 * 1000. * snowmeltdia**3
13389 IF ( mixedphase )
THEN
13408 mltmass0inv = 1.0/( 1000.0* xvmx(lr) )
13409 mltmass1inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize1)**3) )
13410 mltmass2inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize2)**3) )
13411 mltmass3inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize3)**3) )
13412 mltmass1cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize1)**3)
13413 mltmass2cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize2)**3)
13414 mltmass3cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize3)**3)
13418 IF ( ibinnum == 1 )
THEN
13420 mltdiam(1) = 4.5e-3
13421 ELSEIF ( ibinnum == 2 )
THEN
13423 mltdiam(1) = mltdiam1/6.
13424 mltdiam(2) = mltdiam1/2.
13425 ELSEIF ( ibinnum > 2 )
THEN
13426 numdiam = min(ibinnum, ndiam)
13428 mltdiam(k) = (k - 0.5)*mltdiam1/float(numdiam)
13433 mltdiam(1) = 0.5e-3
13434 mltdiam(2) = 1.0e-3
13435 mltdiam(3) = 2.0e-3
13436 mltdiam(4) = 4.0e-3
13437 mltdiam(5) = 6.0e-3
13441 IF ( numshedregimes == 2 )
THEN
13442 mltdiam(ndiam+1) = mltdiam1
13443 mltdiam(ndiam+2) = mltdiam3
13444 mltdiam(ndiam+3) = mltdiam4
13445 ELSEIF ( numshedregimes == 3 )
THEN
13446 mltdiam(ndiam+1) = mltdiam1
13447 mltdiam(ndiam+2) = mltdiam2
13448 mltdiam(ndiam+3) = mltdiam3
13449 mltdiam(ndiam+4) = mltdiam4
13460 mwfac = 6.0**(1./3.)
13461 IF ( ipconc .ge. 2 )
THEN
13466 rwmasn = xvmn(lr)*1000.
13467 rwmasx = xvmx(lr)*1000.
13469 IF ( biggsnowdiam > 0.0 )
THEN
13470 xvbiggsnow = (pi/6.0)*biggsnowdiam**3
13472 xvbiggsnow = xvmn(lh)
13478 cimasn = min(cimas0, cimas1)
13516 IF ( ipconc < 2 )
THEN
13519 t9(ix,jy,kz) = an(ix,jy,kz,lc)
13527 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: ENTER GATHER STAGE'
13534 numgs = nxz/ngs + 1
13537 do 1000 inumgs = 1,numgs
13541 do ix = nxmpb,itile
13543 pqs(1) = t00(ix,jy,kz)
13545 theta(1) = an(ix,jy,kz,lt)
13546 temg(1) = t0(ix,jy,kz)
13547 temcg(1) = temg(1) - tfr
13548 tqvcon = temg(1)-cbw
13549 ltemq = (temg(1)-163.15)/fqsat + 1.5
13550 ltemq = min( nqsat, max(1,ltemq) )
13551 qvs(1) = pqs(1)*tabqvs(ltemq)
13552 IF ( iqis0 == 1 .or. temg(1) <= tfr+0.5 )
THEN
13553 qis(1) = pqs(1)*tabqis(ltemq)
13555 ltemq = (tfr - 163.15)/fqsat + 1.5
13556 qis(1) = pqs(1)*tabqis(ltemq)
13561 if ( temg(1) .lt. tfr )
then
13566 IF ( lhl > 1 )
THEN
13567 IF ( an(ix,jy,kz,lhl) .gt. qxmin(lhl) ) ishail = .true.
13572 if ( an(ix,jy,kz,lv) .gt. qss(1) .or. &
13573 & an(ix,jy,kz,lc) .gt. qxmin(lc) .or. &
13574 & an(ix,jy,kz,li) .gt. qxmin(li) .or. &
13575 & an(ix,jy,kz,lr) .gt. qxmin(lr) .or. &
13576 & an(ix,jy,kz,ls) .gt. qxmin(ls) .or. &
13577 & an(ix,jy,kz,lh) .gt. qxmin(lh) .or. ishail )
then
13578 ngscnt = ngscnt + 1
13581 if ( ngscnt .eq. ngs )
goto 1100
13588 if ( ngscnt .eq. 0 )
go to 9998
13590 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: dbg = 5, ngscnt = ',ngscnt
13597 vtxbar(:,:,:) = 0.0
13601 IF ( lnhf > 1 .or. lnhlf > 1 ) chxf(:,:) = 0.0
13605 rimdn(mgs,il) = rimedens
13611 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: dbg = def temps'
13613 kgsm(mgs) = max(kgs(mgs)-1,1)
13614 kgsp(mgs) = min(kgs(mgs)+1,nz-1)
13615 kgsm2(mgs) = max(kgs(mgs)-2,1)
13616 theta0(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
13617 thetap(mgs) = an(igs(mgs),jy,kgs(mgs),lt) - theta0(mgs)
13618 theta(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
13619 qv0(mgs) = an(igs(mgs),jy,kgs(mgs),lv)
13620 qwvp(mgs) = an(igs(mgs),jy,kgs(mgs),lv) - qv0(mgs)
13622 pres(mgs) = pn(igs(mgs),jy,kgs(mgs)) + pb(kgs(mgs))
13623 pipert(mgs) = p2(igs(mgs),jy,kgs(mgs))
13624 rho0(mgs) = dn(igs(mgs),jy,kgs(mgs))
13625 rhoinv(mgs) = 1.0/rho0(mgs)
13626 rhovt(mgs) = sqrt(rho00/max(0.05,rho0(mgs)))
13627 pi0(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
13628 temg(mgs) = t0(igs(mgs),jy,kgs(mgs))
13629 temgkm1(mgs) = t0(igs(mgs),jy,kgsm(mgs))
13630 temgkm2(mgs) = t0(igs(mgs),jy,kgsm2(mgs))
13631 pk(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
13632 temcg(mgs) = temg(mgs) - tfr
13633 qss0(mgs) = (380.0)/(pres(mgs))
13634 pqs(mgs) = (380.0)/(pres(mgs))
13635 ltemq = (temg(mgs)-163.15)/fqsat+1.5
13636 ltemq = min( nqsat, max(1,ltemq) )
13637 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
13638 IF ( iqis0 == 1 .or. temg(mgs) <= tfr+0.5 )
THEN
13639 qis(mgs) = pqs(mgs)*tabqis(ltemq)
13641 ltemq = (tfr - 163.15)/fqsat + 1.5
13642 qis(mgs) = pqs(mgs)*tabqis(ltemq)
13644 qss(mgs) = qvs(mgs)
13647 cnostmp(mgs) = cno(ls)
13651 if ( temg(mgs) .lt. tfr )
then
13656 IF ( ipconc < 1 .and. lwsm6 )
THEN
13658 tmp = min( 0.0, temcg(mgs) )
13659 cnostmp(mgs) = min( 2.e8, 2.e6*exp(0.12*tmp) )
13675 qx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),il), 0.0)
13691 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*)
'ICEZVD_GS: dbg = 5b'
13693 if ( ipconc .ge. 1 )
then
13695 cx(mgs,li) = max(an(igs(mgs),jy,kgs(mgs),lni), 0.0)
13696 IF ( qx(mgs,li) .le. qxmin(li) )
THEN
13700 IF ( lcina .gt. 1 )
THEN
13701 cina(mgs) = an(igs(mgs),jy,kgs(mgs),lcina)
13703 cina(mgs) = cx(mgs,li)
13705 IF ( lcin > 1 )
THEN
13706 ccin(mgs) = an(igs(mgs),jy,kgs(mgs),lcin)
13710 if ( ipconc .ge. 2 )
then
13712 cx(mgs,lc) = max(an(igs(mgs),jy,kgs(mgs),lnc), 0.0)
13714 IF ( qx(mgs,lc) .le. qxmin(lc) )
THEN
13717 IF ( lss > 1 )
THEN
13718 ssmax(mgs) = an(igs(mgs),jy,kgs(mgs),lss)
13720 IF ( lccn .gt. 1 )
THEN
13721 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
13725 IF ( lccna .gt. 1 )
THEN
13726 ccna(mgs) = an(igs(mgs),jy,kgs(mgs),lccna)
13728 ccna(mgs) = cx(mgs,lc)
13734 if ( ipconc .ge. 3 )
then
13736 cx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lnr), 0.0)
13737 IF ( qx(mgs,lr) .le. qxmin(lr) )
THEN
13739 ELSEIF ( cx(mgs,lr) .eq. 0.0 .and. qx(mgs,lr) .lt. 3.0*qxmin(lr) )
THEN
13740 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lr)
13743 cx(mgs,lr) = max( 1.e-9, cx(mgs,lr) )
13747 if ( ipconc .ge. 4 )
then
13749 cx(mgs,ls) = max(an(igs(mgs),jy,kgs(mgs),lns), 0.0)
13750 IF ( qx(mgs,ls) .le. qxmin(ls) )
THEN
13752 ELSEIF ( cx(mgs,ls) .eq. 0.0 .and. qx(mgs,ls) .lt. 3.0*qxmin(ls) )
THEN
13753 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,ls)
13756 cx(mgs,ls) = max( 1.e-9, cx(mgs,ls) )
13758 IF ( ilimit .ge. ipc(ls) )
THEN
13759 tmp = (xdn0(ls)*cx(mgs,ls))/(rho0(mgs)*qx(mgs,ls))
13760 tmp2 = (tmp*(3.14159))**(1./3.)
13761 cnox = cx(mgs,ls)*(tmp2)
13762 IF ( cnox .gt. 3.0*cno(ls) )
THEN
13763 cx(mgs,ls) = 3.0*cno(ls)/tmp2
13769 if ( ipconc .ge. 5 )
then
13772 cx(mgs,lh) = max(an(igs(mgs),jy,kgs(mgs),lnh), 0.0)
13773 IF ( qx(mgs,lh) .le. qxmin(lh) )
THEN
13775 ELSEIF ( cx(mgs,lh) .eq. 0.0 .and. qx(mgs,lh) .lt. 3.0*qxmin(lh) )
THEN
13776 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lh)
13779 cx(mgs,lh) = max( 1.e-9, cx(mgs,lh) )
13780 IF ( ilimit .ge. ipc(lh) )
THEN
13781 tmp = (xdn0(lh)*cx(mgs,lh))/(rho0(mgs)*qx(mgs,lh))
13782 tmp2 = (tmp*(3.14159))**(1./3.)
13783 cnox = cx(mgs,lh)*(tmp2)
13784 IF ( cnox .gt. 3.0*cno(lh) )
THEN
13785 cx(mgs,lh) = 3.0*cno(lh)/tmp2
13796 if ( lhl .gt. 1 .and. ipconc .ge. 5 )
then
13799 cx(mgs,lhl) = max(an(igs(mgs),jy,kgs(mgs),lnhl), 0.0)
13800 IF ( qx(mgs,lhl) .le. qxmin(lhl) )
THEN
13802 ELSEIF ( cx(mgs,lhl) .eq. 0.0 .and. qx(mgs,lhl) .lt. 3.0*qxmin(lhl) )
THEN
13803 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lhl)
13806 cx(mgs,lhl) = max( 1.e-9, cx(mgs,lhl) )
13807 IF ( ilimit .ge. ipc(lhl) )
THEN
13808 tmp = (xdn0(lhl)*cx(mgs,lhl))/(rho0(mgs)*qx(mgs,lhl))
13809 tmp2 = (tmp*(3.14159))**(1./3.)
13810 cnox = cx(mgs,lhl)*(tmp2)
13811 IF ( cnox .gt. 3.0*cno(lhl) )
THEN
13812 cx(mgs,lhl) = 3.0*cno(lhl)/tmp2
13830 IF ( lvol(il) .ge. 1 )
THEN
13833 vx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),lvol(il)), 0.0)
13856 IF ( ipconc .ge. 6 )
THEN
13859 IF ( lz(il) .gt. 1 )
THEN
13861 zx(mgs,il) = max( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
13868 IF ( ipconc .ge. 6 )
THEN
13870 IF ( lz(lr) .lt. 1 )
THEN
13871 g1x(:,lr) = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
13872 & ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
13876 IF ( cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr) )
THEN
13878 vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
13879 IF ( lzr < 1 )
THEN
13880 IF ( imurain == 3 )
THEN
13881 zx(mgs,lr) = 3.6476*(rnu+2.0)*cx(mgs,lr)*vr**2/(rnu+1.0)
13883 zx(mgs,lr) = 3.6476*g1x(mgs,lr)*cx(mgs,lr)*vr**2
13898 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set alpha'
13899 IF ( imurain == 1 )
THEN
13900 alpha(:,lr) = alphar
13901 ELSEIF ( imurain == 3 )
THEN
13902 alpha(:,lr) = xnu(lr)
13905 alpha(:,li) = xnu(li)
13906 alpha(:,lc) = xnu(lc)
13908 IF ( imusnow == 1 )
THEN
13909 alpha(:,ls) = alphas
13910 ELSEIF ( imusnow == 3 )
THEN
13911 alpha(:,ls) = xnu(ls)
13914 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set dab'
13918 IF ( il .ge. lg ) alpha(mgs,il) = dnu(il)
13922 dab0lh(mgs,il,ic) = dab0(il,ic)
13923 dab1lh(mgs,il,ic) = dab1(il,ic)
13931 da0lx(:,il) = da0(il)
13939 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set rz'
13941 IF ( lzh < 1 .or. lzhl < 1 )
THEN
13942 rzxhlh(:) = rzhl/rz
13943 ELSEIF ( lzh > 1 .and. lzhl > 1 )
THEN
13946 IF ( lzr > 1 )
THEN
13954 IF ( imurain == 1 .and. imusnow == 3 .and. lzr < 1 )
THEN
13956 ELSEIF ( imurain == imusnow .or. lzr > 1 )
THEN
13961 IF ( lhl .gt. 1 )
THEN
13963 da0lhl(mgs) = da0(lhl)
13968 ventrxn(:) = ventrn
13969 gf1palp(:) =
gamma_sp(1.0 + alphar)
13976 ssi(mgs) = qx(mgs,lv)/qis(mgs)
13977 ssw(mgs) = qx(mgs,lv)/qvs(mgs)
13979 tsqr(mgs) = temg(mgs)**2
13981 temgx(mgs) = min(temg(mgs),313.15)
13982 temgx(mgs) = max(temgx(mgs),233.15)
13983 felv(mgs) = 2500837.367 * (273.15/temgx(mgs))**((0.167)+(3.67e-4)*temgx(mgs))
13985 temcgx(mgs) = min(temg(mgs),273.15)
13986 temcgx(mgs) = max(temcgx(mgs),223.15)
13987 temcgx(mgs) = temcgx(mgs)-273.15
13990 felf(mgs) = 333690.6098 + (2030.61425)*temcgx(mgs) - (10.46708312)*temcgx(mgs)**2
13992 fels(mgs) = felv(mgs) + felf(mgs)
13994 felvs(mgs) = felv(mgs)*felv(mgs)
13995 felss(mgs) = fels(mgs)*fels(mgs)
13997 IF ( eqtset <= 1 )
THEN
13998 felvcp(mgs) = felv(mgs)*cpi
13999 felscp(mgs) = fels(mgs)*cpi
14000 felfcp(mgs) = felf(mgs)*cpi
14006 tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
14007 IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
14008 IF ( lf > 1 ) tmp = tmp + qx(mgs,lf)
14009 cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
14012 IF ( eqtset == 2 )
THEN
14013 felvcp(mgs) = (felv(mgs)-rw*temg(mgs))/cvm
14014 felscp(mgs) = (fels(mgs)-rw*temg(mgs))/cvm
14015 felfcp(mgs) = felf(mgs)/cvm
14020 cpm = cp+cpv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
14022 rmm=rd+rw*qx(mgs,lv)
14024 felvcp(mgs) = (felv(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
14025 felscp(mgs) = (fels(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
14026 felfcp(mgs) = felf(mgs)*cv/(cp*cvm)
14028 felvpi(mgs) = pi0(mgs)*rovcp*(felv(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
14029 felspi(mgs) = pi0(mgs)*rovcp*(fels(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
14030 felfpi(mgs) = pi0(mgs)*rovcp*(felf(mgs)/(cvm*temg(mgs)))
14036 fgamw(mgs) = felvcp(mgs)/pi0(mgs)
14037 fgams(mgs) = felscp(mgs)/pi0(mgs)
14039 fcqv1(mgs) = 4098.0258*pi0(mgs)*fgamw(mgs)
14040 fcqv2(mgs) = 5807.6953*pi0(mgs)*fgams(mgs)
14041 fcc3(mgs) = felfcp(mgs)/pi0(mgs)
14044 fwvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)*(101325.0/(pres(mgs)))
14048 fadvisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))*(temg(mgs)/296.0)**(1.5)
14050 fakvisc(mgs) = fadvisc(mgs)*rhoinv(mgs)
14052 temcgx(mgs) = min(temg(mgs),273.15)
14053 temcgx(mgs) = max(temcgx(mgs),233.15)
14054 temcgx(mgs) = temcgx(mgs)-273.15
14055 fci(mgs) = (2.118636 + 0.007371*(temcgx(mgs)))*(1.0e+03)
14057 if ( temg(mgs) .lt. 273.15 )
then
14058 temcgx(mgs) = min(temg(mgs),273.15)
14059 temcgx(mgs) = max(temcgx(mgs),233.15)
14060 temcgx(mgs) = temcgx(mgs)-273.15
14061 fcw(mgs) = 4203.1548 + (1.30572e-2)*((temcgx(mgs)-35.)**2) &
14062 & + (1.60056e-5)*((temcgx(mgs)-35.)**4)
14064 if ( temg(mgs) .ge. 273.15 )
then
14065 temcgx(mgs) = min(temg(mgs),308.15)
14066 temcgx(mgs) = max(temcgx(mgs),273.15)
14067 temcgx(mgs) = temcgx(mgs)-273.15
14068 fcw(mgs) = 4243.1688 + (3.47104e-1)*(temcgx(mgs)**2)
14071 ftka(mgs) = tka0*fadvisc(mgs)/advisc1
14072 fthdf(mgs) = ftka(mgs)*cpi*rhoinv(mgs)
14074 fschm(mgs) = (fakvisc(mgs)/fwvdf(mgs))
14075 fpndl(mgs) = (fakvisc(mgs)/fthdf(mgs))
14077 fai(mgs) = (fels(mgs)**2)/(ftka(mgs)*rw*temg(mgs)**2)
14078 fbi(mgs) = (1.0/(rho0(mgs)*fwvdf(mgs)*qis(mgs)))
14079 fav(mgs) = (felv(mgs)**2)/(ftka(mgs)*rw*temg(mgs)**2)
14080 fbv(mgs) = (1.0/(rho0(mgs)*fwvdf(mgs)*qvs(mgs)))
14082 kp1 = min(nz, kgs(mgs)+1 )
14083 wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1) &
14084 & +w(igs(mgs),jgs,kgs(mgs)))
14096 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set density'
14100 xdn(mgs,li) = xdn0(li)
14101 xdn(mgs,lc) = xdn0(lc)
14102 xdn(mgs,lr) = xdn0(lr)
14103 xdn(mgs,ls) = xdn0(ls)
14104 xdn(mgs,lh) = xdn0(lh)
14105 IF ( lvol(ls) .gt. 1 )
THEN
14106 IF ( vx(mgs,ls) .gt. 0.0 .and. qx(mgs,ls) .gt. qxmin(ls) )
THEN
14107 xdn(mgs,ls) = min( xdnmx(ls), max( xdnmn(ls), rho0(mgs)*qx(mgs,ls)/vx(mgs,ls) ) )
14111 IF ( lvol(lh) .gt. 1 )
THEN
14112 IF ( vx(mgs,lh) .gt. 0.0 .and. qx(mgs,lh) .gt. qxmin(lh) )
THEN
14113 IF ( mixedphase )
THEN
14117 xdn(mgs,lh) = min( dnmx, max( xdnmn(lh), rho0(mgs)*qx(mgs,lh)/vx(mgs,lh) ) )
14118 vx(mgs,lh) = rho0(mgs)*qx(mgs,lh)/xdn(mgs,lh)
14120 ELSEIF ( vx(mgs,lh) == 0.0 .and. qx(mgs,lh) .gt. qxmin(lh) )
THEN
14122 vx(mgs,lh) = rho0(mgs)*qx(mgs,lh)/xdn(mgs,lh)
14128 IF ( lhl .gt. 1 )
THEN
14130 xdn(mgs,lhl) = xdn0(lhl)
14131 xdntmp(mgs,lhl) = xdn0(lhl)
14133 IF ( lvol(lhl) .gt. 1 )
THEN
14134 IF ( vx(mgs,lhl) .gt. 0.0 .and. qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
14136 IF ( mixedphase .and. lhlw > 1 )
THEN
14141 xdn(mgs,lhl) = min( dnmx, max( xdnmn(lhl), rho0(mgs)*qx(mgs,lhl)/vx(mgs,lhl) ) )
14142 vx(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/xdn(mgs,lhl)
14143 xdntmp(mgs,lhl) = xdn(mgs,lhl)
14145 ELSEIF ( vx(mgs,lhl) == 0.0 .and. qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
14147 vx(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/xdn(mgs,lhl)
14157 IF ( ipconc == 5 .and. imydiagalpha == 2 )
THEN
14159 cwchtmp = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
14163 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin )
THEN
14164 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
14165 xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.)
14171 i = int(dgami*(tmp))
14173 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14176 i = int(dgami*(tmp))
14178 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14180 tmp = (x/y)**(1./3.)*xdia(mgs,lr,3)*cwchtmp
14182 alpha(mgs,lr) = min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
14184 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin )
THEN
14186 xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))
14187 xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.)
14192 i = int(dgami*(tmp))
14194 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14197 i = int(dgami*(tmp))
14199 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14201 tmp = (x/y)**(1./3.)*xdia(mgs,lh,3)*cwchtmp
14203 alpha(mgs,lh) = min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
14209 i = nint( alpha(mgs,il)*dqiacralphainv )
14210 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
14211 alp = (3.*alpha(mgs,ic) + 2.)
14212 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
14214 alp = alpha(mgs,ic)
14215 j = nint( alpha(mgs,ic)*dqiacralphainv )
14218 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
14219 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
14220 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
14221 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
14226 IF ( lhl > 0 )
THEN
14227 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) > cxmin )
THEN
14228 xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl))
14229 xdia(mgs,lhl,3) = (xv(mgs,lhl)*6.*piinv)**(1./3.)
14230 IF ( xdia(mgs,lhl,3) < 0.008 )
THEN
14231 alpha(mgs,lhl) = min(alphamax, c1hl*tanh(c2hl*(xdia(mgs,lhl,3)*1000. - c3hl)) + c4hl)
14233 alpha(mgs,lhl) = min(alphamax, c5hl*xdia(mgs,lhl,3)*1000. + c6hl)
14238 i = nint( alpha(mgs,il)*dqiacralphainv )
14239 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
14240 alp = (3.*alpha(mgs,ic) + 2.)
14241 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
14243 alp = alpha(mgs,ic)
14244 j = nint( alpha(mgs,ic)*dqiacralphainv )
14247 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
14248 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
14249 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
14250 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
14262 IF ( imurain == 3 )
THEN
14263 IF ( lzr > 1 )
THEN
14265 alphamlr = -2.0/3.0
14266 alphasmlr = -2.0/3.0
14270 alphasmlr = xnu(lr)
14274 massfacshr = ( (2. + 3.*(1. +alphashr) )**3/( 3.*(1. + alphashr) ) )
14275 massfacmlr = ( (2. + 3.*(1. +alphamlr) )**3/( 3.*(1. + alphamlr) ) )
14276 ELSEIF ( imurain == 1 )
THEN
14277 IF ( lzr > 1 )
THEN
14280 alphasmlr = alphasmlr0
14288 massfacshr = (3.0 + alphashr)**3/((3.+alphashr)*(2.+alphashr)*(1. + alphashr) )
14289 massfacmlr = (3.0 + alphamlr)**3/((3.+alphamlr)*(2.+alphamlr)*(1. + alphamlr) )
14300 IF ( ipconc >= 6 )
THEN
14303 IF ( ipconc >= 6 .and. imurain == 3 )
THEN
14307 g1x(mgs,il) = (alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0))
14312 IF ( imurain == 3 )
THEN
14313 g1shr = (alphashr+2.0)/((alphashr+1.0))
14314 g1mlr = (alphamlr+2.0)/((alphamlr+1.0))
14315 g1smlr = (alphasmlr+2.0)/((alphasmlr+1.0))
14316 ELSEIF ( imurain == 1 )
THEN
14319 g1shr = (6.0 + alphashr)*(5.0 + alphashr)*(4.0 + alphashr)/ &
14320 & ((3.0 + alphashr)*(2.0 + alphashr)*(1.0 + alphashr))
14323 g1mlr = (6.0 + alphamlr)*(5.0 + alphamlr)*(4.0 + alphamlr)/ &
14324 & ((3.0 + alphamlr)*(2.0 + alphamlr)*(1.0 + alphamlr))
14325 g1smlr = (6.0 + alphasmlr)*(5.0 + alphasmlr)*(4.0 + alphasmlr)/ &
14326 & ((3.0 + alphasmlr)*(2.0 + alphasmlr)*(1.0 + alphasmlr))
14330 IF ( lzr > 1 .and. imurain == 3 )
THEN
14338 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
14339 IF ( zx(mgs,il) <= zxmin )
THEN
14343 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14344 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14345 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14346 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
14349 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14352 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14353 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14354 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14356 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
14358 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
14361 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
14362 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
14363 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
14367 IF ( .false. .and. zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
14370 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14373 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14374 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14375 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14378 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
14380 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
14381 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
14384 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
14385 xv(mgs,lr) = xvmn(lr)
14386 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
14389 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
14391 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14394 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
14396 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
14398 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14401 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
14402 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
14404 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
14408 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
14409 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14411 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14414 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
14415 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14418 IF ( zx(mgs,lr) > 0.0 )
THEN
14419 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
14429 IF ( z .gt. 0.0 )
THEN
14431 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14433 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
14434 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
14435 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14436 alp = max( rnumin, min( rnumax, alp ) )
14440 IF ( (xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) ))
THEN
14442 IF ( ioldlimiter >= 2 )
THEN
14443 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
14444 x1 = max(0.0e-3, x - 3.0e-3)
14445 x2 = max(0.5, x/6.0e-3)
14447 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
14448 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
14450 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
14451 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
14452 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
14457 IF ( tmp < cx(mgs,il) )
THEN
14459 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14460 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
14461 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14470 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14472 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
14473 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
14474 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14475 alp = max( rnumin, min( rnumax, alp ) )
14486 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14487 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
14489 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
14490 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
14491 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
14493 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
14494 z = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
14496 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
14504 IF ( alp >= rnumax - 0.01 )
THEN
14507 g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
14512 tmp = alpha(mgs,lr) + 4./3.
14513 i = int(dgami*(tmp))
14515 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14517 tmp = alpha(mgs,lr) + 1.
14518 i = int(dgami*(tmp))
14520 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14525 ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
14527 IF ( imurain == 3 .and. izwisventr == 2 )
THEN
14529 tmp = alpha(mgs,lr) + 1.5 + br/6.
14530 i = int(dgami*(tmp))
14532 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14535 ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
14563 IF ( ipconc .ge. 6 )
THEN
14568 IF ( (.not. ( il == lr .and. imurain == 3 )) .and. ( il == lr .or. il == lh .or. il == lhl .or. il == lf ) )
THEN
14570 g1x(mgs,il) = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
14571 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
14575 IF ( lz(il) .gt. 1 .and. ( .not. ( il == lr .and. imurain == 3 )) )
THEN
14580 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
14581 IF ( zx(mgs,il) <= zxmin )
THEN
14586 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14587 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14588 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14589 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14590 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
14593 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14596 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14597 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14598 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14600 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
14601 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
14605 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14606 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14607 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14608 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14612 IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
14615 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14618 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14619 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14620 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14623 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
14625 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*max(1.0e-9,cx(mgs,il)))
14626 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
14628 IF ( xv(mgs,il) .lt. xvmn(il) )
THEN
14629 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
14630 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
14631 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
14634 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
14636 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
14637 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
14641 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
14643 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin )
THEN
14651 g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
14652 & ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
14653 zx(mgs,il) = max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
14654 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14656 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
14660 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
14661 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14663 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
14664 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
14668 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
14669 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14676 IF ( zx(mgs,il) .gt. 0. )
THEN
14679 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
14683 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
14684 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
14686 alp = max( alphamin, min( alphamax, alp ) )
14690 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
14691 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
14692 alp = alp + ( galpha(alp) - rdi )/dgalpha(alp)
14693 alp = max( alphamin, min( alphamax, alp ) )
14699 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
14700 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
14703 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
14704 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
14706 alp = max( alphamin, min( alphamax, alp ) )
14712 IF ( imaxdiaopt == 1 )
THEN
14713 xvbarmax = xvmx(il)
14714 ELSEIF ( imaxdiaopt == 2 )
THEN
14715 xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
14716 ELSEIF ( imaxdiaopt == 3 )
THEN
14717 xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
14719 xvbarmax = xvmx(il)
14722 IF ( xv(mgs,il) .gt. xvbarmax .or. (il == lr .and. ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.))
THEN
14724 IF( ioldlimiter >= 2 .and. il == lr)
THEN
14725 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
14726 x1 = max(0.0e-3, x - 3.0e-3)
14727 x2 = max(0.5, x/6.0e-3)
14729 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
14730 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
14732 xv(mgs,il) = min( xvbarmax, max( xvmn(il),xv(mgs,il) ) )
14733 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
14734 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
14736 IF ( tmp < cx(mgs,il) )
THEN
14737 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
14738 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
14739 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
14740 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14746 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
14747 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
14748 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
14750 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
14751 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
14752 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
14753 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
14754 alp = max( alphamin, min( alphamax, alp ) )
14765 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
14766 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
14768 IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and. &
14769 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
14773 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
14774 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
14775 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
14777 ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
14778 .not. ( il == lr .and. .not. rescale_low_alphar ) )
THEN
14780 IF ( irescalerainopt == 0 )
THEN
14782 ELSEIF ( irescalerainopt == 1 )
THEN
14783 wtest = qx(mgs,lc) > qxmin(lc)
14784 ELSEIF ( irescalerainopt == 2 )
THEN
14785 wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
14786 ELSEIF ( irescalerainopt == 3 )
THEN
14787 wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
14790 IF ( il == lr .and. ( wtest ) )
THEN
14794 chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
14796 an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
14800 z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
14801 z = z1*(6./(pi*xdn(mgs,il)))**2
14803 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
14815 IF ( alp >= alphamax - 0.5 )
THEN
14818 g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
14834 IF ( il == lr )
THEN
14850 tmp = alpha(mgs,lr) + 1.
14851 i = int(dgami*(tmp))
14853 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14857 IF ( iferwisventr == 2 )
THEN
14858 tmp = alpha(mgs,lr) + 2.5 + br/2.
14859 i = int(dgami*(tmp))
14861 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14894 IF ( .not. ( il == lr .and. imurain == 3 ) )
THEN
14897 IF ( qx(mgs,il) > qxmin(il) )
THEN
14898 xnutmp = (alpha(mgs,il) - 2.)/3.
14902 IF ( il .ne. ic .and. qx(mgs,ic) .gt. qxmin(ic))
THEN
14904 IF ( ic == lc .and. idiagnosecnu > 0 ) xnuc = alpha(mgs,lc)
14905 IF ( il /= lr .and. ic == lr .and. lzr > 1 )
THEN
14906 IF ( imurain == 3 )
THEN
14907 xnuc = alpha(mgs,lr)
14909 xnuc = ( alpha(mgs,lr) - 2. )/3.
14913 IF ( .false. )
THEN
14914 dab0lh(mgs,ic,il) =
delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 0)
14915 dab1lh(mgs,ic,il) =
delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 1)
14916 dab0lh(mgs,il,ic) =
delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 0)
14917 dab1lh(mgs,il,ic) =
delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 1)
14919 i = nint( alpha(mgs,il)*dqiacralphainv )
14920 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
14921 alp = (3.*alpha(mgs,ic) + 2.)
14922 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
14924 alp = alpha(mgs,ic)
14925 j = nint( alpha(mgs,ic)*dqiacralphainv )
14928 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
14929 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
14930 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
14931 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
14942 IF ( .false. .and. ny <= 2 )
THEN
14944 write(0,*)
'bb: ', bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic)
14945 write(0,*)
'il,ic = ',il,ic,alpha(mgs,il),i,xnuc,alp,j
14946 write(0,*)
'dab0lh,tmp1 = ',dab0lh(mgs,ic,il),tmp1
14947 write(0,*)
'dab1lh,tmp2 = ',dab1lh(mgs,ic,il),tmp2
14948 write(0,*)
'dab0lh,tmp3 = ',dab0lh(mgs,il,ic),tmp3,tmp5
14949 write(0,*)
'dab1lh,tmp4 = ',dab1lh(mgs,il,ic),tmp4,tmp6
14960 da0lx(mgs,il) =
delbk(bb(il), xnutmp, xmu(il), 0)
14961 IF ( il .eq. lh )
THEN
14962 da0lh(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
14963 IF ( lzr > 1 )
THEN
14966 rzxh(mgs) = ((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
14967 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
14970 IF ( lzhl < 1 )
THEN
14971 rzxhlh(mgs) = rzxhl(mgs)/(((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
14972 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr))))
14974 ELSEIF ( il .eq. lhl )
THEN
14975 da0lhl(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
14976 IF ( lzr > 1 )
THEN
14979 rzxhl(mgs) = ((4.0 + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
14980 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
14982 ELSEIF ( il == lr )
THEN
14983 xnutmp = (alpha(mgs,il) - 2.)/3.
14984 da0lr(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
14985 da1lr(mgs) =
delbk(bb(il), xnutmp, xmu(il), 1)
15007 kp1 = min(nz, kgs(mgs)+1 )
15012 wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs)) &
15013 & +w(igs(mgs),jgs,kgsm(mgs)))
15014 cninm(mgs) = t7(igs(mgs),jgs,kgsm(mgs))
15015 cnina(mgs) = t7(igs(mgs),jgs,kgs(mgs))
15016 cninp(mgs) = t7(igs(mgs),jgs,kgsp(mgs))
15034 IF ( rimdenvwgt > 0 ) infdo = 1
15036 call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp, &
15037 & xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs, &
15038 & ipconc,ndebug,ngs,nz,kgs,fadvisc, &
15039 & cwmasn,cwmasx,cwradn,cnina,cimn,cimx, &
15040 & itype1,itype2,temcg,infdo,alpha,0,axx,bxx)
15044 IF ( lwsm6 .and. ipconc == 0 )
THEN
15045 tmp = max(qxmin(lh), qxmin(ls))
15047 total = qx(mgs,lh) + qx(mgs,ls)
15048 IF ( total > tmp )
THEN
15049 vt2ave(mgs) = (qx(mgs,lh)*vtxbar(mgs,lh,1) + qx(mgs,ls)*vtxbar(mgs,ls,1))/total
15060 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set concentration'
15061 IF ( ipconc .lt. 1 )
THEN
15062 cina(1:ngscnt) = cx(1:ngscnt,li)
15064 if ( ipconc .lt. 5 )
then
15068 IF ( ipconc .lt. 3 )
THEN
15070 if ( qx(mgs,lr) .gt. qxmin(lh) )
then
15076 IF ( ipconc .lt. 4 )
THEN
15079 if ( qx(mgs,ls) .gt. qxmin(ls) )
then
15085 IF ( ipconc .lt. 5 )
THEN
15089 if ( qx(mgs,lh) .gt. qxmin(lh) )
then
15100 IF ( ipconc .ge. 2 )
THEN
15103 rb(mgs) = 0.5*xdia(mgs,lc,1)*(1./(1.+alpha(mgs,lc)))**(1./6.)
15104 xl2p(mgs) = max(0.0d0, 2.7e-2*xdn(mgs,lc)*cx(mgs,lc)*xv(mgs,lc)* &
15105 & ((0.5e20*rb(mgs)**3*xdia(mgs,lc,1))-0.4) )
15106 IF ( rb(mgs) .gt. 3.51e-6 )
THEN
15108 rh(mgs) = max( 41.d-6, 6.3d-4/(1.d6*(rb(mgs) - 3.5d-6)) )
15112 IF ( xl2p(mgs) .gt. 0.0 )
THEN
15113 nh(mgs) = 4.2d9*xl2p(mgs)
15127 if( ndebug .ge. 0 )
THEN
15131 qvimxd(mgs) = 0.70*(qx(mgs,lv)-qis(mgs))*dtpinv
15133 IF ( qx(mgs,lc) < qxmin(lc) ) qvimxd(mgs) = 0.99*(qx(mgs,lv)-qis(mgs))*dtpinv
15135 qvimxd(mgs) = max(qvimxd(mgs), 0.0)
15138 qimxd(mgs) = frac*qx(mgs,li)*dtpinv
15139 qcmxd(mgs) = frac*qx(mgs,lc)*dtpinv
15140 qrmxd(mgs) = frac*qx(mgs,lr)*dtpinv
15141 qsmxd(mgs) = frac*qx(mgs,ls)*dtpinv
15142 qhmxd(mgs) = frac*qx(mgs,lh)*dtpinv
15143 IF ( lhl > 1 ) qhlmxd(mgs) = frac*qx(mgs,lhl)*dtpinv
15146 if( ndebug .ge. 0 )
THEN
15152 if ( qx(mgs,lc) .le. qxmin(lc) )
then
15153 ccmxd(mgs) = 0.20*cx(mgs,lc)*dtpinv
15155 IF ( ipconc .ge. 2 )
THEN
15156 ccmxd(mgs) = frac*cx(mgs,lc)*dtpinv
15158 ccmxd(mgs) = frac*qx(mgs,lc)/(xmas(mgs,lc)*rho0(mgs)*dtp)
15162 if ( qx(mgs,li) .le. qxmin(li) )
then
15163 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15165 IF ( ipconc .ge. 1 )
THEN
15166 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15168 cimxd(mgs) = frac*qx(mgs,li)/(xmas(mgs,li)*rho0(mgs)*dtp)
15173 crmxd(mgs) = 0.10*cx(mgs,lr)*dtpinv
15174 csmxd(mgs) = frac*cx(mgs,ls)*dtpinv
15175 chmxd(mgs) = frac*cx(mgs,lh)*dtpinv
15177 ccmxd(mgs) = frac*cx(mgs,lc)*dtpinv
15178 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15179 crmxd(mgs) = frac*cx(mgs,lr)*dtpinv
15180 csmxd(mgs) = frac*cx(mgs,ls)*dtpinv
15181 chmxd(mgs) = frac*cx(mgs,lh)*dtpinv
15183 qxmxd(mgs,lv) = max(0.0, 0.1*(qx(mgs,lv) - qvs(mgs))*dtpinv)
15186 qxmxd(mgs,il) = frac*qx(mgs,il)*dtpinv
15187 cxmxd(mgs,il) = frac*cx(mgs,il)*dtpinv
15195 IF ( ipconc >= 6 )
THEN
15199 IF ( lz(il) > 0 .or. ( il == lr ) )
THEN
15201 zxmxd(mgs,il) = frac*zx(mgs,il)*dtpinv
15211 maxmassfac(lc) = ( (2. + 3.*(1. + xnu(lc)) )**3/( 3.*(1. + xnu(lc)) ) )
15212 maxmassfac(li) = ( (2. + 3.*(1. + xnu(li)) )**3/( 3.*(1. + xnu(li)) ) )
15214 IF ( imurain == 3 )
THEN
15215 maxmassfac(lr) = ( (2. + 3.*(1. + xnu(lr)) )**3/( 3.*(1. + xnu(lr)) ) )
15217 maxmassfac(lr) = (3.0 + alphar)**3/ &
15218 & ((3.+alphar)*(2.+alphar)*(1. + alphar) )
15221 IF ( imusnow == 3 )
THEN
15222 maxmassfac(ls) = ( (2. + 3.*(1. + alphas) )**3/( 3.*(1. + alphas) ) )
15224 maxmassfac(ls) = (3.0 + alphas)**3/ &
15225 & ((3.+alphas)*(2.+alphas)*(1. + alphas) )
15228 maxmassfac(lh) = (3.0 + alphah)**3/ &
15229 & ((3.+alphah)*(2.+alphah)*(1. + alphah) )
15231 IF ( lhl > 1 )
THEN
15232 maxmassfac(lhl) = (3.0 + alphahl)**3/ &
15233 & ((3.+alphahl)*(2.+alphahl)*(1. + alphahl) )
15241 vshdgs(mgs,il) = vshd
15243 IF ( qx(mgs,il) > qxmin(il) .and. ivshdgs > 0 )
THEN
15246 tmpdiam = (shedalp+alpha(mgs,il))*xdia(mgs,il,1)
15248 IF ( tmpdiam > sheddiam0 )
THEN
15249 vshdgs(mgs,il) = 0.523599*(1.5e-3)**3/massfacshr
15250 ELSEIF ( tmpdiam > sheddiam )
THEN
15251 vshdgs(mgs,il) = 0.523599*(3.0e-3)**3/massfacshr
15254 vshdgs(mgs,il) = min( xvmx(lr), 6./pi*xdn(mgs,il)*0.001*tmpdiam**3 )/massfacshr
15268 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set collection efficiencies'
15312 ehlsclsn(mgs) = 0.0
15313 ehliclsn(mgs) = 0.0
15318 IF ( exwmindiam > 0 .and. qx(mgs,lc) > qxmin(lc) )
THEN
15319 tmp = cx(mgs,lc)*exp(- (exwmindiam/xdia(mgs,lc,1))**3 )
15320 ccwresv(mgs) = min( cx(mgs,lc), max( 2.e6, cx(mgs,lc) - tmp ) )
15322 tmp = cx(mgs,lc) - ccwresv(mgs)
15324 volt = pi/6.*(exwmindiam)**3
15325 qcwresv(mgs) = qx(mgs,lc) - tmp*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
15328 IF ( .false. .and. qx(mgs,lc) > 0.1e-3 )
THEN
15330 write(0,*)
'cx,qx,crsv,qrsv = ',cx(mgs,lc),qx(mgs,lc),ccwresv(mgs),qcwresv(mgs)
15338 IF ( qx(mgs,lc) .gt. qxmin(lc) )
THEN
15339 cwrad = 0.5*xdia(mgs,lc,1)
15341 IF ( cwrad .ge. 1.e-6*cwr(il,1) ) icwr(mgs) = il
15347 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
15348 rwrad = 0.5*xdia(mgs,lr,3)
15350 IF ( rwrad .ge. 1.e-6*grad(il,1) ) irwr(mgs) = il
15359 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
15360 rwrad = 0.5*xdia(mgs,lh,3)
15362 IF ( rwrad .ge. 1.e-6*grad(il,1) ) igwr(mgs) = il
15367 IF ( lhl .gt. 1 )
THEN
15369 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
15370 rwrad = 0.5*xdia(mgs,lhl,3)
15372 IF ( rwrad .ge. 1.e-6*grad(il,1) ) ihlr(mgs) = il
15382 if ( qx(mgs,li) .gt. qxmin(li) )
then
15390 eii(mgs) = exp(0.025*min(temcg(mgs),0.0))
15392 if ( temg(mgs) .gt. 273.15 ) eii(mgs) = 1.0
15401 if ( qx(mgs,li).gt.qxmin(li) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15404 if (xdia(mgs,lc,1).gt.ewi_dcmin .and. xdia(mgs,li,1).gt.ewi_dimin)
then
15409 if ( temg(mgs) .ge. 273.15 ) eiw(mgs) = 0.0
15418 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15420 IF ( lnr .gt. 1 )
THEN
15435 icp1 = min( 8, ic+1 )
15437 irp1 = min( 6, ir+1 )
15438 cwrad = 0.5*xdia(mgs,lc,3)
15439 rwrad = 0.5*xdia(mgs,lr,3)
15441 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
15442 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
15446 x1 = ew(ic, ir) + slope1*max(0.0, (cwrad - cwr(ic,1)) )
15447 x2 = ew(icp1,ir) + slope2*max(0.0, (cwrad - cwr(ic,1)) )
15449 slope1 = (x2 - x1)*grad(ir,2)
15451 erw(mgs) = max(0.0, x1 + slope1*max(0.0, (rwrad - grad(ir,1)) ))
15456 erw(mgs) = max(0.0, erw(mgs) )
15457 IF ( rwrad .lt. 50.e-6 )
THEN
15459 ELSEIF ( rwrad .lt. 100.e-6 )
THEN
15460 erw(mgs) = erw(mgs)*(rwrad - 50.e-6)/50.e-6
15465 IF ( cx(mgs,lc) .le. 0.0 ) erw(mgs) = 0.0
15467 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lr).gt.qxmin(lr) )
then
15471 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,ls).gt.qxmin(ls) )
then
15475 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,li).gt.qxmin(li) )
then
15485 if ( xdia(mgs,li,3) .lt. eri_cimin ) eri(mgs)=0.0
15497 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15499 if ( xdia(mgs,lc,1) .gt. 15.e-6 .and. xdia(mgs,ls,1) .gt. 100.e-6)
then
15501 ELSEIF ( xdia(mgs,ls,1) .ge. 500.e-6 )
THEN
15502 esw(mgs) = min(0.5, 0.05 + (0.8-0.05)/(40.e-6)*xdia(mgs,lc,1) )
15506 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,lr).gt.qxmin(lr) &
15507 & .and. temg(mgs) .lt. tfr - 1. &
15509 esr(mgs)=exp(-(40.e-6)**3/xv(mgs,lr))*exp(-40.e-6/xdia(mgs,ls,1))
15510 IF ( qx(mgs,ls) < 1.e-4 .and. qx(mgs,lr) < 1.e-4 ) il2(mgs) = 1
15513 IF ( ipconc < 3 .and. temg(mgs) < tfr .and. qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lr) < 1.e-4 )
THEN
15518 if ( temcg(mgs) < 0.0 )
then
15520 IF ( ipconc .lt. 4 .or. temcg(mgs) < esstem1 )
THEN
15528 IF ( iessopt == 2 )
THEN
15530 IF ( wvel(mgs) > 2.0 )
THEN
15533 ELSEIF ( wvel(mgs) > 1.0 )
THEN
15534 fac = max(0.0, 2.0 - wvel(mgs))*fac
15536 ELSEIF ( iessopt == 3 )
THEN
15537 IF ( ssi(mgs) <= 1.0 )
THEN
15540 ELSEIF ( ssi(mgs) <= 1.02 )
THEN
15541 fac = fac*(ssi(mgs) - 1.0)/0.02
15542 ehsfac(mgs) = (ssi(mgs) - 1.0)/0.02
15544 ELSEIF ( iessopt == 4 )
THEN
15545 IF ( ssi(mgs) <= 1.0 )
THEN
15548 ELSEIF ( ssi(mgs) <= 1.005 )
THEN
15549 fac = max(0.1, fac*(ssi(mgs) - 1.0)/0.005)
15550 ehsfac(mgs) = max(0.1, (ssi(mgs) - 1.0)/0.005)
15554 IF ( temcg(mgs) > esstem1 .and. temcg(mgs) < esstem2 )
THEN
15555 ess(mgs) = fac*exp(ess1*(esstem2) )*(temcg(mgs) - esstem1)/(esstem2 - esstem1)
15556 ELSEIF ( temcg(mgs) >= esstem2 )
THEN
15557 ess(mgs) = fac*exp(ess1*min( temcg(mgs), 0.0 ) )
15563 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,li).gt.qxmin(li) )
then
15564 esiclsn(mgs) = esi_collsn
15566 IF ( ipconc < 1 .and. lwsm6 )
THEN
15567 esi(mgs) = exp(0.7*min(temcg(mgs),0.0))
15569 esi(mgs) = esi0*exp(0.1*min(temcg(mgs),0.0))
15570 esi(mgs) = min(0.1,esi(mgs))
15572 IF ( ipconc .le. 3 )
THEN
15573 esi(mgs) = exp(0.025*min(temcg(mgs),0.0))
15580 if ( temg(mgs) .gt. 273.15 ) esi(mgs) = 0.0
15589 xmascw(mgs) = xmas(mgs,lc)
15590 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15592 IF ( iehw .eq. 0 )
THEN
15594 ELSEIF ( iehw .eq. 1 .or. iehw .eq. 10 )
THEN
15595 cwrad = 0.5*xdia(mgs,lc,1)
15596 ehw(mgs) = min( ehw0, &
15597 & ewfac*min((aradcw + cwrad*(bradcw + cwrad* &
15598 & (cradcw + cwrad*(dradcw)))), 1.0) )
15600 ELSEIF ( iehw .eq. 2 .or. iehw .eq. 10 )
THEN
15602 icp1 = min( 8, ic+1 )
15604 irp1 = min( 6, ir+1 )
15605 cwrad = 0.5*xdia(mgs,lc,1)
15606 rwrad = 0.5*xdia(mgs,lh,3)
15608 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
15609 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
15613 x1 = ew(ic, ir) + slope1*max(0.0, (cwrad - cwr(ic,1)) )
15614 x2 = ew(icp1,ir) + slope2*max(0.0, (cwrad - cwr(ic,1)) )
15616 slope1 = (x2 - x1)*grad(ir,2)
15618 tmp = max( 0.0, min( 1.0, x1 + slope1*max(0.0, (rwrad - grad(ir,1)) ) ) )
15619 ehw(mgs) = min( ehw(mgs), tmp )
15629 ELSEIF ( iehw .eq. 3 .or. iehw .eq. 10 )
THEN
15630 tmp = exp(- (dmincw/xdia(mgs,lc,1))**3)
15631 xmascw(mgs) = xmas(mgs,lc) + xdn0(lc)*(pi*dmincw**3/6.0)
15632 ehw(mgs) = min( ehw(mgs), tmp )
15633 ELSEIF ( iehw .eq. 4 .or. iehw .eq. 10 )
THEN
15635 & 2.0*xdn(mgs,lc)*vtxbar(mgs,lh,1)*(0.5*xdia(mgs,lc,1))**2 &
15636 & /(9.0*fadvisc(mgs)*0.5*xdia(mgs,lh,3))
15637 tmp = max( 1.5, min(10.0, tmp) )
15638 ehw(mgs) = min( ehw(mgs), 0.55*log10(2.51*tmp) )
15640 if ( xdia(mgs,lc,1) .lt. 2.4e-06 ) ehw(mgs)=0.0
15642 ehw(mgs) = min( ehw0, ehw(mgs) )
15644 IF ( ibfc == -1 .and. temcg(mgs) < -41.0 )
THEN
15650 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lr).gt.qxmin(lr) &
15655 ehr(mgs) = exp(-(40.e-6)/xdia(mgs,lr,3))*exp(-40.e-6/xdia(mgs,lh,3))
15656 ehr(mgs) = min( ehr0, ehr(mgs) )
15659 IF ( qx(mgs,ls).gt.qxmin(ls) )
THEN
15660 IF ( ipconc .ge. 4 )
THEN
15661 ehscnv(mgs) = ehs0*exp(ehs1*min(temcg(mgs),0.0))
15663 ehscnv(mgs) = exp(0.09*min(temcg(mgs),0.0))
15666 IF ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc) >= qxmin(lc) )
THEN
15670 ehsclsn(mgs) = ehs_collsn
15671 IF ( xdia(mgs,ls,3) < 40.e-6 )
THEN
15673 ELSEIF ( xdia(mgs,ls,3) < 150.e-6 )
THEN
15674 ehsclsn(mgs) = ehs_collsn*(xdia(mgs,ls,3) - 40.e-6)/(150.e-6 - 40.e-6)
15676 ehsclsn(mgs) = ehs_collsn
15679 ehs(mgs) = ehscnv(mgs)*min(1.0, max(0.0,xdn(mgs,lh) - 300.)/300. )
15681 ehs(mgs) = min(ehs(mgs),ehsmax)
15685 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,li).gt.qxmin(li) )
then
15686 ehiclsn(mgs) = ehi_collsn
15687 ehi(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
15688 ehi(mgs) = min( ehimax, max( ehi(mgs), ehimin ) )
15692 IF ( lis > 1 )
THEN
15693 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lis).gt.qxmin(lis) )
then
15694 ehisclsn(mgs) = ehi_collsn
15695 ehis(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
15696 ehis(mgs) = min( ehimax, max( ehis(mgs), ehimin ) )
15707 IF ( lhl .gt. 1 )
THEN
15709 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15710 IF ( iehw == 3 ) iehlw = 3
15711 IF ( iehw == 4 ) iehlw = 4
15713 IF ( iehlw .eq. 0 )
THEN
15715 ELSEIF ( iehlw .eq. 1 .or. iehlw .eq. 10 )
THEN
15716 cwrad = 0.5*xdia(mgs,lc,1)
15717 ehlw(mgs) = min( ehlw0, &
15718 & ewfac*min((aradcw + cwrad*(bradcw + cwrad* &
15719 & (cradcw + cwrad*(dradcw)))), 1.0) )
15721 ELSEIF ( iehlw .eq. 2 .or. iehlw .eq. 10 )
THEN
15723 icp1 = min( 8, ic+1 )
15725 irp1 = min( 6, ir+1 )
15726 cwrad = 0.5*xdia(mgs,lc,1)
15727 rwrad = 0.5*xdia(mgs,lhl,3)
15729 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
15730 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
15732 x1 = ew(ic, ir) + slope1*(cwrad - cwr(ic,1))
15733 x2 = ew(icp1,ir) + slope2*(cwrad - cwr(ic,1))
15735 slope1 = (x2 - x1)*grad(ir,2)
15737 tmp = max( 0.0, min( 1.0, x1 + slope1*(rwrad - grad(ir,1)) ) )
15738 ehlw(mgs) = min( ehlw(mgs), tmp )
15739 ehlw(mgs) = min( ehlw0, ehlw(mgs) )
15745 ELSEIF ( iehlw .eq. 3 .or. iehlw .eq. 10 )
THEN
15746 tmp = exp(- (dmincw/xdia(mgs,lc,1))**3)
15747 ehlw(mgs) = min( ehlw(mgs), tmp )
15748 ELSEIF ( iehlw .eq. 4 .or. iehlw .eq. 10 )
THEN
15750 & 2.0*xdn(mgs,lc)*vtxbar(mgs,lhl,1)*(0.5*xdia(mgs,lc,1))**2 &
15751 & /(9.0*fadvisc(mgs)*0.5*xdia(mgs,lhl,3))
15752 tmp = max( 1.5, min(10.0, tmp) )
15753 ehlw(mgs) = min( ehlw(mgs), 0.55*log10(2.51*tmp) )
15755 if ( xdia(mgs,lc,1) .lt. 2.4e-06 ) ehlw(mgs)=0.0
15756 ehlw(mgs) = min( ehlw0, ehlw(mgs) )
15758 IF ( ibfc == -1 .and. temcg(mgs) < -41.0 )
THEN
15764 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lr).gt.qxmin(lr) &
15768 ehlr(mgs) = min( ehlr0, ehlr(mgs) )
15771 IF ( qx(mgs,ls).gt.qxmin(ls) )
THEN
15772 if ( qx(mgs,lhl).gt.qxmin(lhl) )
then
15773 ehlsclsn(mgs) = ehls_collsn
15774 ehls(mgs) = ehscnv(mgs)
15775 ehls(mgs) = min(ehls(mgs),ehsmax)
15779 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,li).gt.qxmin(li) )
then
15780 ehliclsn(mgs) = ehli_collsn
15781 ehli(mgs)=eii0hl*exp(eii1hl*min(temcg(mgs),0.0))
15782 ehli(mgs) = min( ehimax, max( ehli(mgs), ehimin ) )
15783 if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehli(mgs) = 0.0
15786 IF ( lis > 1 )
THEN
15787 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lis).gt.qxmin(lis) )
then
15788 ehlisclsn(mgs) = ehli_collsn
15789 ehlis(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
15790 ehlis(mgs) = min( ehimax, max( ehlis(mgs), ehimin ) )
15791 if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehlis(mgs) = 0.0
15841 if (ndebug .gt. 0 )
write(0,*)
'Collection: rain collects xxxxx'
15845 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. erw(mgs) .gt. 0.0 )
THEN
15846 IF ( ipconc .lt. 3 )
THEN
15847 IF ( erw(mgs) .gt. 0.0 .and. qx(mgs,lr) .gt. 1.e-7 )
THEN
15848 vt = (ar*(xdia(mgs,lc,1)**br))*rhovt(mgs)
15850 & (0.25)*pi*erw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lr) &
15852 & *max(0.0, vtxbar(mgs,lr,1)-vt) &
15853 & *( gf3*xdia(mgs,lr,2) &
15854 & + 2.0*gf2*xdia(mgs,lr,1)*xdia(mgs,lc,1) &
15855 & + gf1*xdia(mgs,lc,2) )
15864 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
15865 rwrad = 0.5*xdia(mgs,lr,3)
15866 IF ( rwrad .gt. rh(mgs) )
THEN
15867 IF ( rwrad .gt. rwradmn )
THEN
15870 qracw(mgs) = erw(mgs)*aa2*cx(mgs,lr)*cx(mgs,lc)*xmas(mgs,lc)* &
15871 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)/(alpha(mgs,lc) + 1.) + xv(mgs,lr))/rho0(mgs)
15874 IF ( imurain == 3 )
THEN
15883 qracw(mgs) = aa1*cx(mgs,lr)*(qx(mgs,lc)-qcwresv(mgs))* &
15884 & ((alpha(mgs,lc) + 3.)*(alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.)**2 + &
15885 & (alpha(mgs,lr) + 2.)*xv(mgs,lr)**2/(alpha(mgs,lr) + 1.))
15889 qracw(mgs) = aa1*cx(mgs,lr)*(qx(mgs,lc)-qcwresv(mgs))* &
15890 & ((alpha(mgs,lc) + 3.)*(alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.)**2 + &
15891 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)*xv(mgs,lr)**2/ &
15892 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.)))
15901 qracw(mgs) = min(qracw(mgs), qcmxd(mgs))
15909 IF ( eri(mgs) .gt. 0.0 .and. iacr .ge. 1 .and. xdia(mgs,lr,3) .gt. 2.*rwradmn )
THEN
15910 IF ( ipconc .ge. 3 )
THEN
15912 tmp = eri(mgs)*aa2*cx(mgs,lr)*cx(mgs,li)* &
15913 & ((cinu + 2.)*xv(mgs,li)/(cinu + 1.) + xv(mgs,lr))
15915 qraci(mgs) = min( qxmxd(mgs,li), tmp*xmas(mgs,li)*rhoinv(mgs) )
15916 craci(mgs) = min( cxmxd(mgs,li), tmp )
15941 & (0.25)*pi*eri(mgs)*qx(mgs,li)*cx(mgs,lr) &
15942 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,li,1)) &
15943 & *( gf3*xdia(mgs,lr,2) &
15944 & + 2.0*gf2*xdia(mgs,lr,1)*xdia(mgs,li,1) &
15945 & + gf1*xdia(mgs,li,2) ) &
15948 if ( temg(mgs) .gt. 268.15 )
then
15954 IF ( ipconc < 3 )
THEN
15957 IF ( ers(mgs) .gt. 0.0 .and. ipconc < 3 )
THEN
15958 IF ( lwsm6 .and. ipconc == 0 )
THEN
15961 vt = vtxbar(mgs,ls,1)
15965 & ((0.25)*pi/gf4)*ers(mgs)*qx(mgs,ls)*cx(mgs,lr) &
15966 & *abs(vtxbar(mgs,lr,1)-vt) &
15967 & *( gf6*gf1*xdia(mgs,ls,2) &
15968 & + 2.0*gf5*gf2*xdia(mgs,ls,1)*xdia(mgs,lr,1) &
15969 & + gf4*gf3*xdia(mgs,lr,2) ) &
15977 if (ndebug .gt. 0 )
write(0,*)
'Collection: snow collects xxxxx'
15983 IF ( esw(mgs) .gt. 0.0 )
THEN
15985 IF ( ipconc .ge. 4 )
THEN
15991 tmp = 1.0*rvt*aa2*cx(mgs,ls)*cx(mgs,lc)* &
15992 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)/(alpha(mgs,lc) + 1.) + xv(mgs,ls))
15994 qsacw(mgs) = min( qxmxd(mgs,lc), tmp*xmas(mgs,lc)*rhoinv(mgs) )
15995 csacw(mgs) = min( cxmxd(mgs,lc), tmp )
15997 IF ( lvol(ls) .gt. 1 )
THEN
15998 IF ( temg(mgs) .lt. 273.15)
THEN
15999 rimdn(mgs,ls) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16000 & *((0.60)*vtxbar(mgs,ls,1)) &
16001 & /(temg(mgs)-273.15))**(rimc2)
16002 rimdn(mgs,ls) = min( max( rimc3, rimdn(mgs,ls) ), rimc4 )
16004 rimdn(mgs,ls) = 1000.
16007 vsacw(mgs) = rho0(mgs)*qsacw(mgs)/rimdn(mgs,ls)
16024 vt = abs(vtxbar(mgs,ls,1)-vtxbar(mgs,lc,1))
16026 qsacw(mgs) = 0.25*pi*esw(mgs)*cx(mgs,ls)*qx(mgs,lc)*vt* &
16027 & ( da0(ls)*xdia(mgs,ls,3)**2 + &
16028 & dab1(ls,lc)*xdia(mgs,ls,3)*xdia(mgs,lc,3) + &
16029 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16030 qsacw(mgs) = min( qsacw(mgs), qxmxd(mgs,ls) )
16031 csacw(mgs) = rho0(mgs)*qsacw(mgs)/xmas(mgs,lc)
16041 IF ( ipconc .ge. 4 )
THEN
16042 IF ( esi(mgs) .gt. 0.0 .or. ( ipelec > 0 .and. esiclsn(mgs) > 0.0 ))
THEN
16046 tmp = esiclsn(mgs)*rvt*aa2*cx(mgs,ls)*cx(mgs,li)* &
16047 & ((cinu + 2.)*xv(mgs,li)/(cinu + 1.) + xv(mgs,ls))
16049 qsaci(mgs) = min( qxmxd(mgs,li), esi(mgs)*tmp*xmas(mgs,li)*rhoinv(mgs) )
16051 csaci(mgs) = min(cxmxd(mgs,li), esi(mgs)*tmp )
16063 IF ( esi(mgs) .gt. 0.0 )
THEN
16066 & ((0.25)*pi)*esi(mgs)*qx(mgs,li)*cx(mgs,ls) &
16067 & *abs(vtxbar(mgs,ls,1)-vtxbar(mgs,li,1)) &
16068 & *( gf3*xdia(mgs,ls,2) &
16069 & + 2.0*gf2*xdia(mgs,ls,1)*xdia(mgs,li,1) &
16070 & + gf1*xdia(mgs,li,2) ) &
16082 IF ( esr(mgs) .gt. 0.0 )
THEN
16083 IF ( ipconc .ge. 3 )
THEN
16095 IF ( lwsm6 .and. ipconc == 0 )
THEN
16098 vt = vtxbar(mgs,ls,1)
16103 & ((0.25)*pi/gf4)*esr(mgs)*qx(mgs,lr)*cx(mgs,ls) &
16104 & *abs(vtxbar(mgs,lr,1)-vt) &
16105 & *( gf6*gf1*xdia(mgs,lr,2) &
16106 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,ls,1) &
16107 & + gf4*gf3*xdia(mgs,ls,2) ) &
16116 if (ndebug .gt. 0 )
write(0,*)
'Collection: graupel collects xxxxx'
16120 qhacwmlr(mgs) = 0.0
16126 IF ( .false. )
THEN
16127 vtmax = (gz(igs(mgs),jgs,kgs(mgs))*dtpinv)
16128 vtxbar(mgs,lh,1) = min( vtmax, vtxbar(mgs,lh,1))
16129 vtxbar(mgs,lh,2) = min( vtmax, vtxbar(mgs,lh,2))
16130 vtxbar(mgs,lh,3) = min( vtmax, vtxbar(mgs,lh,3))
16132 IF ( ehw(mgs) .gt. 0.0 )
THEN
16134 IF ( ipconc .ge. 2 )
THEN
16136 IF ( .false. )
THEN
16137 qhacw(mgs) = (ehw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lh)*pi* &
16138 & abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1))* &
16139 & (2.0*xdia(mgs,lh,1)*(xdia(mgs,lh,1) + &
16140 & xdia(mgs,lc,1)*gf73rds) + &
16141 & xdia(mgs,lc,2)*gf83rds))/4.
16144 vt = abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1))
16146 qhacw(mgs) = 0.25*pi*ehw(mgs)*cx(mgs,lh)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
16147 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16148 & dab1lh(mgs,lh,lc)*xdia(mgs,lh,3)*xdia(mgs,lc,3) + &
16149 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16152 qhacw(mgs) = min( qhacw(mgs), 0.5*qx(mgs,lc)*dtpinv )
16154 IF ( lzh .gt. 1 )
THEN
16155 tmp = qx(mgs,lh)/cx(mgs,lh)
16168 & ((0.25)*pi)*ehw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lh) &
16169 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1)) &
16170 & *( gf3*xdia(mgs,lh,2) &
16171 & + 2.0*gf2*xdia(mgs,lh,1)*xdia(mgs,lc,1) &
16172 & + gf1*xdia(mgs,lc,2) ) &
16173 & , 0.5*(qx(mgs,lc)-qcwresv(mgs))*dtpinv)
16178 IF ( lwsm6 .and. qsacw(mgs) > 0.0 .and. qhacw(mgs) > 0.0)
THEN
16179 qaacw = ( qx(mgs,ls)*qsacw(mgs) + qx(mgs,lh)*qhacw(mgs) )/(qx(mgs,ls) + qx(mgs,lh))
16187 qhacwmlr(mgs) = qhacw(mgs)
16188 IF ( temg(mgs) > tfr .and. iqhacwshr == 0 )
THEN
16192 IF ( lvol(lh) .gt. 1 .or. lhl .gt. 1 )
THEN
16194 IF ( temg(mgs) .lt. 273.15)
THEN
16195 IF ( irimdenopt == 1 )
THEN
16196 vt = ( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) )
16198 rimdn(mgs,lh) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16200 & /(temg(mgs)-273.15))**(rimc2)
16202 rimdn(mgs,lh) = min( max( rimc3, rimdn(mgs,lh) ), rimc4 )
16212 ELSEIF ( irimdenopt == 2 )
THEN
16214 tmp = (-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16215 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) ) &
16216 & /(temg(mgs)-273.15))
16217 tmp = min( 5.5/0.6, max( 0.3/0.6, tmp ) )
16219 rimdn(mgs,lh) = 1000.*(0.051 + 0.114*tmp - 0.0055*tmp**2)
16221 ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4)
THEN
16223 tmp = (-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16224 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) ) &
16225 & /(temg(mgs)-273.15))
16228 IF ( irimdenopt == 3 )
THEN
16229 rimdn(mgs,lh) = min(900., max( 170., 110.*tmp**0.76 ) )
16230 ELSEIF ( irimdenopt == 4 )
THEN
16231 rimdn(mgs,lh) = min(917., max( 10., 900.0*(1.0 - 0.905**tmp ) ) )
16236 rimdn(mgs,lh) = 1000.
16239 IF ( lvol(lh) > 1 ) vhacw(mgs) = rho0(mgs)*qhacw(mgs)/rimdn(mgs,lh)
16243 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. ipelec .ge. 1 )
THEN
16245 & qhacw(mgs)*1.0e3*rho0(mgs)/((pi/2.0)*xdia(mgs,lh,2)*cx(mgs,lh))
16255 IF ( ehi(mgs) .gt. 0.0 )
THEN
16256 IF ( ipconc .ge. 5 )
THEN
16258 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,li,1))**2 + &
16259 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,li,1) )
16261 qhaci0(mgs) = 0.25*pi*ehiclsn(mgs)*cx(mgs,lh)*qx(mgs,li)*vt* &
16262 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16263 & dab1lh(mgs,lh,li)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
16264 & da1(li)*xdia(mgs,li,3)**2 )
16265 qhaci(mgs) = min( ehi(mgs)*qhaci0(mgs), qimxd(mgs) )
16269 & ((0.25)*pi)*ehi(mgs)*ehiclsn(mgs)*qx(mgs,li)*cx(mgs,lh) &
16270 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,li,1)) &
16271 & *( gf3*xdia(mgs,lh,2) &
16272 & + 2.0*gf2*xdia(mgs,lh,1)*xdia(mgs,li,1) &
16273 & + gf1*xdia(mgs,li,2) ) &
16280 IF ( lis > 1 .and. ipconc >= 5 )
THEN
16284 IF ( ehis(mgs) .gt. 0.0 )
THEN
16286 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,lis,1))**2 + &
16287 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,lis,1) )
16289 qhacis0(mgs) = 0.25*pi*ehisclsn(mgs)*cx(mgs,lh)*qx(mgs,lis)*vt* &
16290 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16291 & dab1lh(mgs,lh,lis)*xdia(mgs,lh,3)*xdia(mgs,lis,3) + &
16292 & da1(li)*xdia(mgs,lis,3)**2 )
16293 qhacis(mgs) = min( ehis(mgs)*qhacis0(mgs), qxmxd(mgs,lis) )
16303 IF ( ehs(mgs) .gt. 0.0 )
THEN
16304 IF ( ipconc .ge. 5 )
THEN
16306 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1))**2 + &
16307 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,ls,1) )
16309 qhacs0(mgs) = 0.25*pi*ehsclsn(mgs)*cx(mgs,lh)*qx(mgs,ls)*vt* &
16310 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16311 & dab1lh(mgs,lh,ls)*xdia(mgs,lh,3)*xdia(mgs,ls,3) + &
16312 & da1(ls)*xdia(mgs,ls,3)**2 )
16314 qhacs(mgs) = min( ehs(mgs)*qhacs0(mgs), qsmxd(mgs) )
16319 & ((0.25)*pi/gf4)*ehs(mgs)*ehsclsn(mgs)*qx(mgs,ls)*cx(mgs,lh) &
16320 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1)) &
16321 & *( gf6*gf1*xdia(mgs,ls,2) &
16322 & + 2.0*gf5*gf2*xdia(mgs,ls,1)*xdia(mgs,lh,1) &
16323 & + gf4*gf3*xdia(mgs,lh,2) ) &
16331 qhacrmlr(mgs) = 0.0
16335 IF ( temg(mgs) .gt. tfr ) raindn(mgs,lh) = 1000.0
16337 IF ( ehr(mgs) .gt. 0.0 )
THEN
16338 IF ( ipconc .ge. 3 )
THEN
16339 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,lr,1))**2 + &
16340 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,lr,1) )
16347 qhacr(mgs) = 0.25*pi*ehr(mgs)*cx(mgs,lh)*qx(mgs,lr)*vt* &
16348 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16349 & dab1lh(mgs,lh,lr)*xdia(mgs,lh,3)*xdia(mgs,lr,3) + &
16350 & da1lr(mgs)*xdia(mgs,lr,3)**2 )
16357 qhacr(mgs) = min( qhacr(mgs), qxmxd(mgs,lr) )
16359 qhacrmlr(mgs) = qhacr(mgs)
16361 IF ( temg(mgs) > tfr .and. iehr0c == 0 )
THEN
16364 IF ( iqhacrmlr == 0 )
THEN
16365 qhacrmlr(mgs) = -qhacw(mgs)
16377 chacr(mgs) = 0.25*pi*ehr(mgs)*cx(mgs,lh)*cx(mgs,lr)*vt* &
16378 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16379 & dab0lh(mgs,lh,lr)*xdia(mgs,lh,3)*xdia(mgs,lr,3) + &
16380 & da0lr(mgs)*xdia(mgs,lr,3)**2 )
16385 chacr(mgs) = min(chacr(mgs),crmxd(mgs))
16387 IF ( lzh .gt. 1 )
THEN
16388 tmp = qx(mgs,lh)/cx(mgs,lh)
16401 IF ( lwsm6 .and. ipconc == 0 )
THEN
16404 vt = vtxbar(mgs,lh,1)
16409 & ((0.25)*pi/gf4)*ehr(mgs)*qx(mgs,lr)*cx(mgs,lh) &
16410 & *abs(vt-vtxbar(mgs,lr,1)) &
16411 & *( gf6*gf1*xdia(mgs,lr,2) &
16412 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,lh,1) &
16413 & + gf4*gf3*xdia(mgs,lh,2) ) &
16416 IF ( temg(mgs) > tfr )
THEN
16417 IF ( iqhacrmlr >= 1 ) qhacrmlr(mgs) = qhacr(mgs)
16422 IF ( lvol(lh) .gt. 1 .or. lhl .gt. 1 )
THEN
16424 IF ( temg(mgs) .lt. 273.15)
THEN
16425 raindn(mgs,lh) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lr,3)) &
16427 & /(temg(mgs)-273.15))**(rimc2)
16429 raindn(mgs,lh) = min( max( rimc3, rimdn(mgs,lh) ), rimc4 )
16431 raindn(mgs,lh) = 1000.
16434 IF ( lvol(lh) > 1 ) vhacr(mgs) = rho0(mgs)*qhacr(mgs)/raindn(mgs,lh)
16441 if (ndebug .gt. 0 )
write(0,*)
'Collection: hail collects xxxxx'
16446 qhlacwmlr(mgs) = 0.0
16449 IF ( lhl > 1 .and. .true.)
THEN
16450 vtmax = (gz(igs(mgs),jgs,kgs(mgs))*dtpinv)
16451 vtxbar(mgs,lhl,1) = min( vtmax, vtxbar(mgs,lhl,1))
16452 vtxbar(mgs,lhl,2) = min( vtmax, vtxbar(mgs,lhl,2))
16453 vtxbar(mgs,lhl,3) = min( vtmax, vtxbar(mgs,lhl,3))
16456 IF ( lhl > 0 )
THEN
16457 rarx(mgs,lhl) = 0.0
16460 IF ( lhl .gt. 1 .and. ehlw(mgs) .gt. 0.0 )
THEN
16465 vt = abs(vtxbar(mgs,lhl,1)-vtxbar(mgs,lc,1))
16467 qhlacw(mgs) = 0.25*pi*ehlw(mgs)*cx(mgs,lhl)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
16468 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16469 & dab1lh(mgs,lhl,lc)*xdia(mgs,lhl,3)*xdia(mgs,lc,3) + &
16470 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16473 qhlacw(mgs) = min( qhlacw(mgs), 0.5*qx(mgs,lc)*dtpinv )
16475 qhlacwmlr(mgs) = qhlacw(mgs)
16476 IF ( temg(mgs) > tfr .and. iqhlacwshr == 0 )
THEN
16480 IF ( lvol(lhl) .gt. 1 )
THEN
16482 IF ( temg(mgs) .lt. 273.15)
THEN
16483 IF ( irimdenopt == 1 )
THEN
16484 rimdn(mgs,lhl) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16485 & *((0.60)*( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) )) &
16486 & /(temg(mgs)-273.15))**(rimc2)
16487 rimdn(mgs,lhl) = min( max( hldnmn, rimc3, rimdn(mgs,lhl) ), rimc4 )
16489 ELSEIF ( irimdenopt == 2 )
THEN
16490 tmp = -0.5*(1.e+06)*xdia(mgs,lc,1) &
16491 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) ) &
16492 & /(temg(mgs)-273.15)
16493 tmp = min( 5.5/0.6, max( 0.3/0.6, tmp ) )
16495 rimdn(mgs,lhl) = 1000.*(0.051 + 0.114*tmp - 0.005*tmp**2)
16497 ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4)
THEN
16498 tmp = -0.5*(1.e+06)*xdia(mgs,lc,1) &
16499 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) ) &
16500 & /(temg(mgs)-273.15)
16503 IF ( irimdenopt == 3 )
THEN
16504 rimdn(mgs,lhl) = min(900., max( 170., 110.*tmp**0.76 ) )
16505 ELSEIF ( irimdenopt == 4 )
THEN
16506 rimdn(mgs,lhl) = min(917., max( 10., 900.0*(1.0 - 0.905**tmp ) ) )
16511 rimdn(mgs,lhl) = 1000.
16514 vhlacw(mgs) = rho0(mgs)*qhlacw(mgs)/rimdn(mgs,lhl)
16519 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. ipelec .ge. 1 )
THEN
16521 & qhlacw(mgs)*1.0e3*rho0(mgs)/((pi/2.0)*xdia(mgs,lhl,2)*cx(mgs,lhl))
16529 IF ( lhl .gt. 1 )
THEN
16531 IF ( ehli(mgs) .gt. 0.0 )
THEN
16532 IF ( ipconc .ge. 5 )
THEN
16534 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,li,1))**2 + &
16535 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,li,1) )
16537 qhlaci0(mgs) = 0.25*pi*ehliclsn(mgs)*cx(mgs,lhl)*qx(mgs,li)*vt* &
16538 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16539 & dab1lh(mgs,lhl,li)*xdia(mgs,lhl,3)*xdia(mgs,li,3) + &
16540 & da1(li)*xdia(mgs,li,3)**2 )
16542 qhlaci(mgs) = min( ehli(mgs)*qhlaci0(mgs), qimxd(mgs) )
16550 IF ( lhl .gt. 1 )
THEN
16552 IF ( ehls(mgs) .gt. 0.0)
THEN
16553 IF ( ipconc .ge. 5 )
THEN
16555 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,ls,1))**2 + &
16556 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,ls,1) )
16558 qhlacs0(mgs) = 0.25*pi*ehlsclsn(mgs)*cx(mgs,lhl)*qx(mgs,ls)*vt* &
16559 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16560 & dab1lh(mgs,lhl,ls)*xdia(mgs,lhl,3)*xdia(mgs,ls,3) + &
16561 & da1(ls)*xdia(mgs,ls,3)**2 )
16563 qhlacs(mgs) = min( ehls(mgs)*qhlacs0(mgs), qsmxd(mgs) )
16572 qhlacrmlr(mgs) = 0.0
16575 IF ( lhl .gt. 1 .and. temg(mgs) .gt. tfr ) raindn(mgs,lhl) = 1000.0
16577 IF ( lhl .gt. 1 .and. ehlr(mgs) .gt. 0.0 )
THEN
16578 IF ( ipconc .ge. 3 )
THEN
16579 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,lr,1))**2 + &
16580 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,lr,1) )
16582 qhlacr(mgs) = 0.25*pi*ehlr(mgs)*cx(mgs,lhl)*qx(mgs,lr)*vt* &
16583 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16584 & dab1lh(mgs,lhl,lr)*xdia(mgs,lhl,3)*xdia(mgs,lr,3) + &
16585 & da1lr(mgs)*xdia(mgs,lr,3)**2 )
16592 qhlacr(mgs) = min( qhlacr(mgs), qxmxd(mgs,lr) )
16595 IF ( iqhlacrmlr >= 1 ) qhlacrmlr(mgs) = qhlacr(mgs)
16597 IF ( temg(mgs) > tfr .and. iehlr0c == 0)
THEN
16599 IF ( iqhlacrmlr == 0 )
THEN
16600 qhlacrmlr(mgs) = -qhlacw(mgs)
16603 chlacr(mgs) = 0.25*pi*ehlr(mgs)*cx(mgs,lhl)*cx(mgs,lr)*vt* &
16604 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16605 & dab0lh(mgs,lhl,lr)*xdia(mgs,lhl,3)*xdia(mgs,lr,3) + &
16606 & da0lr(mgs)*xdia(mgs,lr,3)**2 )
16608 chlacr(mgs) = min(chlacr(mgs),crmxd(mgs))
16610 IF ( lvol(lhl) .gt. 1 )
THEN
16611 vhlacr(mgs) = rho0(mgs)*qhlacr(mgs)/raindn(mgs,lhl)
16626 if (ndebug .gt. 0 )
write(0,*)
'Collection: cloud ice collects xxxx2'
16630 IF ( eiw(mgs) .gt. 0.0 )
THEN
16632 vt = sqrt((vtxbar(mgs,li,1)-vtxbar(mgs,lc,1))**2 + &
16633 & 0.04*vtxbar(mgs,li,1)*vtxbar(mgs,lc,1) )
16635 qiacw(mgs) = 0.25*pi*eiw(mgs)*cx(mgs,li)*qx(mgs,lc)*vt* &
16636 & ( da0(li)*xdia(mgs,li,3)**2 + &
16637 & dab1(li,lc)*xdia(mgs,li,3)*xdia(mgs,lc,3) + &
16638 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16640 qiacw(mgs) = min( qiacw(mgs), qxmxd(mgs,lc) )
16647 if (ndebug .gt. 0 )
write(0,*)
'Collection: cloud ice collects xxxx8'
16657 csplinter(mgs) = 0.0
16658 qsplinter(mgs) = 0.0
16659 csplinter2(mgs) = 0.0
16660 qsplinter2(mgs) = 0.0
16661 IF ( iacr .ge. 1 .and. eri(mgs) .gt. 0.0 &
16662 & .and. temg(mgs) .le. 270.15 )
THEN
16663 IF ( ipconc .ge. 3 )
THEN
16665 IF ( xdia(mgs,li,1) .ge. 10.e-6 )
THEN
16666 ni = ni + cx(mgs,li)*exp(- (40.e-6/xdia(mgs,li,1))**3 )
16668 IF ( imurain == 1 )
THEN
16669 IF ( iacrsize /= 4 )
THEN
16670 IF ( iacrsize .eq. 1 )
THEN
16671 ratio = 500.e-6/xdia(mgs,lr,1)
16672 ELSEIF ( iacrsize .eq. 2 )
THEN
16673 ratio = 300.e-6/xdia(mgs,lr,1)
16674 ELSEIF ( iacrsize .eq. 3 )
THEN
16675 ratio = 40.e-6/xdia(mgs,lr,1)
16676 ELSEIF ( iacrsize .eq. 5 )
THEN
16677 ratio = 150.e-6/xdia(mgs,lr,1)
16679 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
16680 j = int(max(0.0,min(15.,alpha(mgs,lr)))*dqiacralphainv)
16682 delx = ratio - float(i)*dqiacrratio
16683 dely = alpha(mgs,lr) - float(j)*dqiacralpha
16684 ip1 = min( i+1, nqiacrratio )
16685 jp1 = min( j+1, nqiacralpha )
16688 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
16689 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
16693 nr = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)
16696 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
16697 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
16701 qr = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)
16708 vt = sqrt((vtxbar(mgs,lr,1)-vtxbar(mgs,li,1))**2 + &
16709 & 0.04*vtxbar(mgs,lr,1)*vtxbar(mgs,li,1) )
16711 qiacr(mgs) = 0.25*pi*eri(mgs)*ni*qr*vt* &
16712 & ( da0(li)*xdia(mgs,li,3)**2 + &
16713 & dab1lh(mgs,li,lr)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
16714 & da1(lr)*xdia(mgs,lr,3)**2 )
16716 qiacr(mgs) = min( qrmxd(mgs), qiacr(mgs) )
16719 ciacr(mgs) = 0.25*pi*eri(mgs)*ni*nr*vt* &
16720 & ( da0(li)*xdia(mgs,li,3)**2 + &
16721 & dab0lh(mgs,li,lr)*xdia(mgs,lr,3)*xdia(mgs,li,3) + &
16722 & da0(lr)*xdia(mgs,lr,3)**2 )
16724 ciacr(mgs) = min( crmxd(mgs), ciacr(mgs) )
16731 ELSEIF ( imurain == 3 )
THEN
16733 arg = 1000.*xdia(mgs,lr,3)
16736 IF ( ipconc .ge. 3 )
THEN
16737 IF ( iacrsize .eq. 1 )
THEN
16739 ELSEIF ( iacrsize .eq. 2 .or. iacrsize .eq. 5 )
THEN
16741 ELSEIF ( iacrsize .eq. 3 )
THEN
16742 nr = cx(mgs,lr)*
gaml02( arg )
16743 ELSEIF ( iacrsize .eq. 4 )
THEN
16747 nr = cx(mgs,lr)*
gaml02( arg )
16752 IF ( ni .gt. 0.0 .and. nr .gt. 0.0 )
THEN
16753 d0 = xdia(mgs,lr,3)
16754 qiacr(mgs) = xdn(mgs,lr)*rhoinv(mgs)* &
16755 & (0.217239*(0.522295*(d0**5) + &
16756 & 49711.81*(d0**6) - &
16757 & 1.673016e7*(d0**7)+ &
16758 & 2.404471e9*(d0**8) - &
16759 & 1.22872e11*(d0**9))*ni*nr)
16760 qiacr(mgs) = min( qrmxd(mgs), qiacr(mgs) )
16762 & (0.217239*(0.2301947*(d0**2) + &
16763 & 15823.76*(d0**3) - &
16764 & 4.167685e6*(d0**4) + &
16765 & 4.920215e8*(d0**5) - &
16766 & 2.133344e10*(d0**6))*ni*nr)
16767 ciacr(mgs) = min( crmxd(mgs), ciacr(mgs) )
16771 IF ( iacr .eq. 1 .or. iacr .eq. 3 )
THEN
16772 ciacrf(mgs) = min(ciacr(mgs), qiacr(mgs)/(1.0*vr1mm*1000.0)*rho0(mgs) )
16773 ELSEIF ( iacr .eq. 2 )
THEN
16774 ciacrf(mgs) = ciacr(mgs)
16775 ELSEIF ( iacr .eq. 4 )
THEN
16776 ciacrf(mgs) = min(ciacr(mgs), qiacr(mgs)/(1.0*vfrz*1000.0)*rho0(mgs) )
16777 ELSEIF ( iacr .eq. 5 )
THEN
16778 ciacrf(mgs) = ciacr(mgs)*rzxh(mgs)
16787 & ((0.25/gf4)*pi)*eri(mgs)*cx(mgs,li)*qx(mgs,lr) &
16788 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,li,1)) &
16789 & *( gf6*gf1*xdia(mgs,lr,2) &
16790 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,li,1) &
16791 & + gf4*gf3*xdia(mgs,li,2) ) &
16799 IF ( ipconc .ge. 1 )
THEN
16800 IF ( nsplinter .ge. 1000 )
THEN
16803 IF ( qiacr(mgs)*dtp > qxmin(lh) .and. ciacr(mgs) > 1.e-3 )
THEN
16804 tmpdiam = 1.e6*( 6.*qiacr(mgs)/(1000.*pi*ciacr(mgs) ) )**(1./3.)
16805 csplinter(mgs) = lawson_splinter_fac*tmpdiam**4*ciacr(mgs)
16807 ELSEIF ( nsplinter .ge. 0 )
THEN
16808 csplinter(mgs) = nsplinter*ciacr(mgs)
16810 csplinter(mgs) = -nsplinter*ciacrf(mgs)
16812 qsplinter(mgs) = min(0.1*qiacr(mgs), csplinter(mgs)*splintermass/rho0(mgs) )
16816 IF ( ibiggsnow == 2 .or. ibiggsnow == 3 )
THEN
16817 IF ( ciacr(mgs) > qxmin(lh) )
THEN
16818 xvfrz = rho0(mgs)*qiacr(mgs)/(ciacr(mgs)*900.)
16819 frach = 0.5 *(1. + tanh(0.2e12 *( xvfrz - 1.15*xvbiggsnow)))
16821 qiacrs(mgs) = (1.-frach)*qiacr(mgs)
16822 ciacrs(mgs) = (1.-frach)*ciacrf(mgs)
16827 qiacrf(mgs) = frach*qiacr(mgs)
16828 ciacrf(mgs) = frach*ciacrf(mgs)
16830 IF ( lvol(lh) > 1 )
THEN
16831 viacrf(mgs) = rho0(mgs)*qiacrf(mgs)/rhofrz
16841 if ( ipconc .ge. 4 )
then
16844 IF ( qx(mgs,ls) > qxmin(ls) .and. ess(mgs) .gt. 0.0 )
THEN
16846 IF ( iessec0flag == 0 )
THEN
16849 tmp = xv(mgs,ls)/(xvmx(ls)*max(1.,100./min(100.,xdn(mgs,ls))))
16850 IF ( tmp .lt. essfrac1 )
THEN
16852 ELSEIF ( tmp .ge. essfrac2 )
THEN
16855 ec0(mgs) = (essfrac2 - tmp)/(essfrac2 - essfrac1)
16859 csacs(mgs) = ec0(mgs)*rvt*aa2*ess(mgs)*cx(mgs,ls)**2*min( xv(mgs,ls), 4.*pii/3.*essrmax**3 )
16861 csacs(mgs) = min(csacs(mgs),csmxd(mgs))
16867 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 11'
16868 if ( ipconc .ge. 2 .or. ipelec .ge. 9 )
then
16871 IF ( eiw(mgs) .gt. 0.0 )
THEN
16872 ciacw(mgs) = qiacw(mgs)*rho0(mgs)/xmas(mgs,lc)
16873 ciacw(mgs) = min(ciacw(mgs),ccmxd(mgs))
16879 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 18'
16880 if ( ipconc .ge. 2 .or. ipelec .ge. 1 )
then
16885 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. qx(mgs,lr) .gt. qxmin(lr) &
16886 & .and. qracw(mgs) .gt. 0.0 )
THEN
16888 IF ( ipconc .lt. 3 )
THEN
16889 IF ( erw(mgs) .gt. 0.0 )
THEN
16891 & ((0.25)*pi)*erw(mgs)*(cx(mgs,lc) - ccwresv(mgs))*cx(mgs,lr) &
16892 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,lc,1)) &
16893 & *( gf1*xdia(mgs,lc,2) &
16894 & + 2.0*gf2*xdia(mgs,lc,1)*xdia(mgs,lr,1) &
16895 & + gf3*xdia(mgs,lr,2) )
16898 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
16899 IF ( 0.5*xdia(mgs,lr,3) .gt. rh(mgs) )
THEN
16901 IF ( 0.5*xdia(mgs,lr,3) .gt. rwradmn )
THEN
16904 cracw(mgs) = aa2*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))*(xv(mgs,lc) + xv(mgs,lr))
16906 IF ( imurain == 3 )
THEN
16908 cracw(mgs) = aa1*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))* &
16909 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.) + &
16910 & (alpha(mgs,lr) + 2.)*xv(mgs,lr)**2/(alpha(mgs,lr) + 1.))
16912 cracw(mgs) = aa1*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))* &
16913 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.) + &
16914 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)*xv(mgs,lr)**2/ &
16915 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.)) )
16927 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
16928 rwrad = 0.5*xdia(mgs,lr,3)
16932 IF ( icracrthresh > 1 )
THEN
16933 IF ( imurain == 1 )
THEN
16934 tmp = (3.67+alpha(mgs,lr))*xdia(mgs,lr,1)
16936 tmp = (1.678+alpha(mgs,lr))**(1./3.)*xdia(mgs,lr,1)
16939 tmp = xdia(mgs,lr,3) - 0.1e-3
16943 IF ( tmp .gt. 1.9e-3 .or. icracr <= 0 )
THEN
16947 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
16948 IF ( xdia(mgs,lr,3) .lt. 6.1e-4 )
THEN
16951 ec0(mgs) = exp(-50.0*(50.0*(xdia(mgs,lr,3) - 6.0e-4)))
16955 IF ( rwrad .ge. 50.e-6 )
THEN
16956 cracr(mgs) = ec0(mgs)*aa2*cx(mgs,lr)**2*xv(mgs,lr)
16958 IF ( imurain == 3 )
THEN
16959 cracr(mgs) = ec0(mgs)*aa1*(cx(mgs,lr)*xv(mgs,lr))**2* &
16960 & (alpha(mgs,lr) + 2.)/(alpha(mgs,lr) + 1.)
16962 cracr(mgs) = ec0(mgs)*aa1*(cx(mgs,lr)*xv(mgs,lr))**2* &
16963 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)/ &
16964 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.))
16982 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22ii'
16984 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
16987 IF ( ipconc .ge. 5 )
THEN
16988 IF ( qhacw(mgs) .gt. 0.0 .and. xmas(mgs,lc) .gt. 0.0 )
THEN
17002 chacw(mgs) = qhacw(mgs)*rho0(mgs)/xmascw(mgs)
17004 chacw(mgs) = min( chacw(mgs), 0.5*(cx(mgs,lc) - ccwresv(mgs))*dtpinv )
17011 & ((0.25)*pi)*ehw(mgs)*cx(mgs,lc)*cx(mgs,lh) &
17012 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1)) &
17013 & *( gf1*xdia(mgs,lc,2) &
17014 & + 2.0*gf2*xdia(mgs,lc,1)*xdia(mgs,lh,1) &
17015 & + gf3*xdia(mgs,lh,2) )
17016 chacw(mgs) = min(chacw(mgs),0.5*cx(mgs,lc)*dtpinv)
17023 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22kk'
17026 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17028 IF ( ehi(mgs) .gt. 0.0 .or. ( ehiclsn(mgs) > 0.0 .and. ipelec > 0 ))
THEN
17029 IF ( ipconc .ge. 5 )
THEN
17031 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,li,1))**2 + &
17032 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,li,1) )
17034 chaci0(mgs) = 0.25*pi*ehiclsn(mgs)*cx(mgs,lh)*cx(mgs,li)*vt* &
17035 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
17036 & dab0lh(mgs,lh,li)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
17037 & da0(li)*xdia(mgs,li,3)**2 )
17041 & ((0.25)*pi)*ehiclsn(mgs)*cx(mgs,li)*cx(mgs,lh) &
17042 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,li,1)) &
17043 & *( gf1*xdia(mgs,li,2) &
17044 & + 2.0*gf2*xdia(mgs,li,1)*xdia(mgs,lh,1) &
17045 & + gf3*xdia(mgs,lh,2) )
17048 chaci(mgs) = min(ehi(mgs)*chaci0(mgs),cimxd(mgs))
17055 if ( lis > 1 .and. ipconc .ge. 5 .or. ipelec .ge. 1 )
then
17057 IF ( ehis(mgs) .gt. 0.0 .or. ( ehisclsn(mgs) > 0.0 .and. ipelec > 0 ))
THEN
17059 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,lis,1))**2 + &
17060 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,lis,1) )
17062 chacis0(mgs) = 0.25*pi*ehisclsn(mgs)*cx(mgs,lh)*cx(mgs,lis)*vt* &
17063 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
17064 & dab0lh(mgs,lh,lis)*xdia(mgs,lh,3)*xdia(mgs,lis,3) + &
17065 & da0(lis)*xdia(mgs,lis,3)**2 )
17068 chacis(mgs) = min(ehis(mgs)*chacis0(mgs),cxmxd(mgs,lis))
17074 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22nn'
17077 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17079 IF ( ehs(mgs) .gt. 0 )
THEN
17080 IF ( ipconc .ge. 5 .or. ( ehsclsn(mgs) > 0.0 .and. ipelec > 0 ) )
THEN
17082 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1))**2 + &
17083 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,ls,1) )
17085 chacs0(mgs) = 0.25*pi*ehsclsn(mgs)*cx(mgs,lh)*cx(mgs,ls)*vt* &
17086 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
17087 & dab0lh(mgs,lh,ls)*xdia(mgs,lh,3)*xdia(mgs,ls,3) + &
17088 & da0(ls)*xdia(mgs,ls,3)**2 )
17092 & ((0.25)*pi)*ehsclsn(mgs)*cx(mgs,ls)*cx(mgs,lh) &
17093 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1)) &
17094 & *( gf3*gf1*xdia(mgs,ls,2) &
17095 & + 2.0*gf2*gf2*xdia(mgs,ls,1)*xdia(mgs,lh,1) &
17096 & + gf1*gf3*xdia(mgs,lh,2) )
17098 chacs(mgs) = min(ehs(mgs)*chacs0(mgs),csmxd(mgs))
17108 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22ii'
17110 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17113 IF ( lhl .gt. 1 .and. ipconc .ge. 5 )
THEN
17114 IF ( qhlacw(mgs) .gt. 0.0 .and. xmas(mgs,lc) .gt. 0.0 )
THEN
17128 chlacw(mgs) = qhlacw(mgs)*rho0(mgs)/xmascw(mgs)
17130 chlacw(mgs) = min( chlacw(mgs), 0.5*cx(mgs,lc)*dtpinv )
17148 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22kk'
17151 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17153 IF ( lhl .gt. 1 .and. ( ehli(mgs) .gt. 0.0 .or. (ipelec > 0 .and. ehliclsn(mgs) > 0.0) ) )
THEN
17154 IF ( ipconc .ge. 5 )
THEN
17156 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,li,1))**2 + &
17157 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,li,1) )
17159 chlaci0(mgs) = 0.25*pi*ehliclsn(mgs)*cx(mgs,lhl)*cx(mgs,li)*vt* &
17160 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17161 & dab0(lhl,li)*xdia(mgs,lhl,3)*xdia(mgs,li,3) + &
17162 & da0(li)*xdia(mgs,li,3)**2 )
17173 chlaci(mgs) = min(ehli(mgs)*chlaci0(mgs),cimxd(mgs))
17179 IF ( lis > 1 .and. ipconc .ge. 5)
THEN
17181 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22kk'
17185 IF ( lhl .gt. 1 .and. ( ehlis(mgs) .gt. 0.0 .or. (ipelec > 0 .and. ehlisclsn(mgs) > 0.0) ) )
THEN
17187 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,lis,1))**2 + &
17188 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,lis,1) )
17190 chlacis0(mgs) = 0.25*pi*ehlisclsn(mgs)*cx(mgs,lhl)*cx(mgs,lis)*vt* &
17191 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17192 & dab0(lhl,lis)*xdia(mgs,lhl,3)*xdia(mgs,lis,3) + &
17193 & da0(lis)*xdia(mgs,lis,3)**2 )
17196 chlacis(mgs) = min(ehlis(mgs)*chlacis0(mgs),cxmxd(mgs,lis))
17203 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22jj'
17206 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17208 IF ( lhl .gt. 1 .and. ( ehls(mgs) .gt. 0.0 .or. (ipelec > 0 .and. ehlsclsn(mgs) > 0.0) ) )
THEN
17209 IF ( ipconc .ge. 5 )
THEN
17211 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,ls,1))**2 + &
17212 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,ls,1) )
17214 chlacs0(mgs) = 0.25*pi*ehlsclsn(mgs)*cx(mgs,lhl)*cx(mgs,ls)*vt* &
17215 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17216 & dab0(lhl,ls)*xdia(mgs,lhl,3)*xdia(mgs,ls,3) + &
17217 & da0(ls)*xdia(mgs,ls,3)**2 )
17227 chlacs(mgs) = min(ehls(mgs)*chlacs0(mgs),csmxd(mgs))
17236 IF ( ipconc .ge. 2 )
THEN
17237 if (ndebug .gt. 0 )
write(0,*)
'conc 26a'
17246 IF ( dmrauto >= -1 )
THEN
17250 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. 1000. .and. temg(mgs) .gt. tfrh+4.)
THEN
17252 volb = xv(mgs,lc)*(1./(1.+alpha(mgs,lc)))**(1./2.)
17253 cautn(mgs) = min(ccmxd(mgs), &
17254 & ((alpha(mgs,lc)+2.)/(alpha(mgs,lc)+1.))*aa1*cx(mgs,lc)**2*xv(mgs,lc)**2)
17255 cautn(mgs) = max( 0.0d0, cautn(mgs) )
17256 IF ( rb(mgs) .le. 7.51d-6 .or. dmrauto == -1)
THEN
17265 t2s = 3.72/(1.e6*(rb(mgs)-7.500d-6)*rho0(mgs)*qx(mgs,lc))
17267 qrcnw(mgs) = max( 0.0d0, xl2p(mgs)/(t2s*rho0(mgs)) )
17268 crcnw(mgs) = max( 0.0d0, min(3.5e9*xl2p(mgs)/t2s,0.5*cautn(mgs)) )
17270 IF ( dmrauto == 0 )
THEN
17271 IF ( qx(mgs,lr)*rho0(mgs) > 1.2*xl2p(mgs) .and. cx(mgs,lr) > cxmin )
THEN
17272 crcnw(mgs) = cx(mgs,lr)/qx(mgs,lr)*qrcnw(mgs)
17273 ELSEIF ( ( dmropt == 1 .or. dmropt == 3 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17274 tmp = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17275 crcnw(mgs) = min(tmp,crcnw(mgs) )
17276 ELSEIF ( ( dmropt == 4 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17278 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17280 crcnw(mgs) = (tmp*qrcnw(mgs)+tmp2*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17281 ELSEIF ( ( dmropt == 5 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17283 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17285 crcnw(mgs) = (tmp*qx(mgs,lc)+tmp2*qx(mgs,lr))/(qx(mgs,lc)+qx(mgs,lr))
17286 ELSEIF ( ( dmropt == 6 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17288 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17290 crcnw(mgs) = (tmp*xdia(mgs,lc,3)*qx(mgs,lc)+tmp2*xdia(mgs,lr,3)*qx(mgs,lr))/(xdia(mgs,lc,3)*qx(mgs,lc)+xdia(mgs,lr,3)*qx(mgs,lr))
17291 ELSEIF ( ( dmropt == 7 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17293 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17295 crcnw(mgs) = (tmp*xdia(mgs,lc,3)+tmp2*xdia(mgs,lr,3))/(xdia(mgs,lc,3)+xdia(mgs,lr,3))
17296 ELSEIF ( ( dmropt == 8 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17298 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17300 crcnw(mgs) = (tmp*sqrt(xdia(mgs,lc,3))+tmp2*sqrt(xdia(mgs,lr,3)))/(sqrt(xdia(mgs,lc,3))+sqrt(xdia(mgs,lr,3)))
17302 ELSEIF ( dmrauto == 1 .and. cx(mgs,lr) > cxmin)
THEN
17303 IF ( qx(mgs,lr) > qxmin(lr) )
THEN
17304 tmp = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17305 crcnw(mgs) = min(tmp,crcnw(mgs) )
17307 ELSEIF ( dmrauto == 2 .and. cx(mgs,lr) > cxmin)
THEN
17309 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17311 crcnw(mgs) = (tmp*qrcnw(mgs)+tmp2*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17312 ELSEIF ( dmrauto == 3 .and. cx(mgs,lr) > cxmin)
THEN
17313 tmp = max( 2.d0*rh(mgs), dble( xdia(mgs,lr,3) ) )
17314 crcnw(mgs) = rho0(mgs)*qrcnw(mgs)/(pi/6.*1000.*tmp**3)
17317 IF ( crcnw(mgs) < 1.e-30 ) qrcnw(mgs) = 0.0
17319 IF ( ipconc >= 6 )
THEN
17320 IF ( lzr > 1 .and. qrcnw(mgs) > 0.0 )
THEN
17326 IF (qx(mgs,lr) .gt. qxmin(lr) .and. ( dmrauto == 1 .or. dmrauto ==2 ) )
THEN
17327 tmp3 = qx(mgs,lr)/cx(mgs,lr)
17328 tmp4 = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
17329 & ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs) )
17330 if (imurain == 3)
then
17331 vr = rho0(mgs)*qrcnw(mgs)/(1000.)
17332 tmp3 = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
17334 tmp3 = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
17336 IF ( dmrauto == 1 )
THEN
17338 ELSEIF ( dmrauto == 2 )
THEN
17339 zrcnw(mgs) = (tmp3*qrcnw(mgs)+tmp4*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17342 IF ( imurain == 3 )
THEN
17343 vr = rho0(mgs)*qrcnw(mgs)/(1000.)
17344 zrcnw(mgs) = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
17346 IF ( dmropt <= 1 .or. dmropt >= 4 .or. ( qx(mgs,lr) < qxmin(lr) .and. cx(mgs,lr) < cxmin ) )
THEN
17347 zrcnw(mgs) = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
17349 tmp3 = qx(mgs,lr)/cx(mgs,lr)
17350 zrcnw(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
17351 & ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs) )
17400 if ( ircnw .eq. 4 )
then
17404 qdiff = max((qx(mgs,lc)-qminrncw),0.0)
17405 if ( qdiff .gt. 0.0 .and. xdia(mgs,lc,1) .gt. 20.0e-6 )
then
17407 & ((1.2e-4)+(1.596e-12)*(cx(mgs,lc)*1.0e-6) &
17408 & /(cwdisp*qdiff*1.0e-3*rho0(mgs)))
17409 qrcnw(mgs) = (rho0(mgs)*1e-3)*(qdiff**2)/argrcnw
17411 qrcnw(mgs) = (max(qrcnw(mgs),0.0))
17422 if ( ircnw .eq. 5 )
then
17426 qccrit = (pi/6.)*(cx(mgs,lc)*cwdiap**3)*xdn(mgs,lc)/rho0(mgs)
17427 qdiff = max((qx(mgs,lc)-qccrit),0.)
17428 if ( qdiff .gt. 0.0 .and. cx(mgs,lc) .gt. 1.0 )
then
17431 & ((1.2e-4)+(1.596e-12)*cx(mgs,lc)*1.0e-3/(cwdisp*rho0(mgs)*qdiff))
17434 & 1.0e-3*rho0(mgs)*(qdiff**2)/argrcnw
17435 qrcnw(mgs) = min(qxmxd(mgs,lc), (max(qrcnw(mgs),0.0)) )
17446 if ( ircnw .eq. 2 )
then
17449 qrcnw(mgs) = (0.001)*max((qx(mgs,lc)-qminrncw),0.0)
17457 if ( ircnw .eq. 1 )
then
17463 & (1.e+06) * ((c1/(0.38))**(1./3.)) * (xdia(mgs,lc,1)*(0.5))
17465 & (0.027) * ((100.0)*(bradp**3)*(xdia(mgs,lc,1)*(0.5)) - (0.4))
17466 bt2 = (bradp -7.5) / (3.72)
17468 if ( bl2 .gt. 0.0 .and. bt2 .gt. 0.0 )
then
17469 qrcnw(mgs) = bl2 * bt2 * rho0(mgs) &
17470 & * qx(mgs,lc) * qx(mgs,lc)
17484 if (ndebug .gt. 0 )
write(0,*)
'conc 27a'
17497 IF ( .not. ( ipconc == 0 .and. lwsm6 ) )
THEN
17500 if ( qx(mgs,lr) .gt. qxmin(lr) .and. temcg(mgs) .lt. -5. .and. ibiggopt > 0 )
then
17503 IF ( ipconc .lt. 3 )
THEN
17506 & (20.0)*(pi**2)*brz*(xdn(mgs,lr)/rho0(mgs)) &
17507 & *cx(mgs,lr)*(xdia(mgs,lr,1)**6) &
17508 & *(exp(max(-arz*temcg(mgs), 0.0))-1.0) &
17510 qrfrzf(mgs) = qrfrz(mgs)
17513 ELSEIF ( ipconc .ge. 3 )
THEN
17520 IF ( ibiggopt == 2 .and. imurain == 1 )
THEN
17523 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
17526 dbigg = (6./pi* volt )**(1./3.)
17529 IF ( dbigg < 8.e-3 )
THEN
17531 ratio = min(maxratiolu, dbigg/xdia(mgs,lr,1) )
17533 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
17534 IF ( alp0flag )
THEN
17535 j = int(max(0.0,min(15.,alpha(mgs,lr)))*dqiacralphainv)
17537 j = int(max(minalphalu,min(maxalphalu,alpha(mgs,lr)))*dqiacralphainv)
17539 delx = ratio - float(i)*dqiacrratio
17540 dely = alpha(mgs,lr) - float(j)*dqiacralpha
17541 ip1 = min( i+1, nqiacrratio )
17542 jp1 = min( j+1, nqiacralpha )
17545 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
17546 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
17550 crfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)*dtpinv
17551 crfrzf(mgs) = crfrz(mgs)
17553 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
17554 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
17558 qrfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)*dtpinv
17559 qrfrzf(mgs) = qrfrz(mgs)
17561 IF ( qrfrz(mgs)*dtp < qxmin(lh) .or. crfrz(mgs)*dtp < cxmin )
THEN
17570 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
17572 tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
17573 tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
17577 zrfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)*dtpinv
17580 IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < 2.*xvmn(lr) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) )
THEN
17585 crfrzs(mgs) = crfrz(mgs)
17586 qrfrzs(mgs) = qrfrz(mgs)
17588 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
17589 zrfrzs(mgs) = zrfrz(mgs)
17592 ELSEIF ( dbigg < max( biggsnowdiam, max(dfrz,dhmn)) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) )
THEN
17595 crfrzs(mgs) = crfrz(mgs)
17596 qrfrzs(mgs) = qrfrz(mgs)
17598 IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < 1.2*xvmn(lr) )
THEN
17603 IF (ipconc >= 6 .and. lzr > 1 )
THEN
17604 zrfrzs(mgs) = zrfrz(mgs)
17610 ratio = min( maxratiolu, max(dfrz,dhmn)/xdia(mgs,lr,1) )
17612 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
17615 IF ( alp0flag )
THEN
17616 j = int(max(0.0,min(15.,alpha(mgs,lr)))*dqiacralphainv)
17618 j = int(max(minalphalu,min(maxalphalu,alpha(mgs,lr)))*dqiacralphainv)
17620 delx = ratio - float(i)*dqiacrratio
17621 dely = alpha(mgs,lr) - float(j)*dqiacralpha
17622 ip1 = min( i+1, nqiacrratio )
17623 jp1 = min( j+1, nqiacralpha )
17626 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
17627 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
17632 crfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)*dtpinv
17635 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
17636 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
17640 qrfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)*dtpinv
17643 crfrzs(mgs) = crfrzs(mgs) - crfrzf(mgs)
17644 qrfrzs(mgs) = qrfrzs(mgs) - qrfrzf(mgs)
17646 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
17647 zrfrzs(mgs) = zrfrz(mgs)
17649 tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
17650 tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
17654 zrfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)*dtpinv
17655 zrfrzs(mgs) = zrfrzs(mgs) - zrfrzf(mgs)
17656 zrfrzf(mgs) = (1000./900.)**2*zrfrzf(mgs)
17667 IF ( (qrfrz(mgs))*dtp > qx(mgs,lr) )
THEN
17668 fac = ( qrfrz(mgs) )*dtp/qx(mgs,lr)
17669 qrfrz(mgs) = fac*qrfrz(mgs)
17670 qrfrzs(mgs) = fac*qrfrzs(mgs)
17671 qrfrzf(mgs) = fac*qrfrzf(mgs)
17672 crfrz(mgs) = fac*crfrz(mgs)
17673 crfrzs(mgs) = fac*crfrzs(mgs)
17674 crfrzf(mgs) = fac*crfrzf(mgs)
17675 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
17676 zrfrz(mgs) = fac*zrfrz(mgs)
17677 zrfrzf(mgs) = fac*zrfrzf(mgs)
17696 ELSEIF ( ibiggopt == 1 )
THEN
17698 tmp = xv(mgs,lr)*brz*cx(mgs,lr)*(exp(max( -arz*temcg(mgs), 0.0 )) - 1.0)
17699 IF ( .false. .and. tmp .gt. cxmxd(mgs,lr) )
THEN
17703 crfrz(mgs) = cxmxd(mgs,lr)
17704 qrfrz(mgs) = qxmxd(mgs,lr)
17714 IF ( lzr < 1 )
THEN
17715 IF ( imurain == 3 )
THEN
17722 IF ( imurain == 3 )
THEN
17723 bfnu = (alpha(mgs,lr)+2.0)/(alpha(mgs,lr)+1.)
17726 bfnu = (4. + alpha(mgs,lr))*(5. + alpha(mgs,lr))*(6. + alpha(mgs,lr))/ &
17727 & ((1. + alpha(mgs,lr))*(2. + alpha(mgs,lr))*(3. + alpha(mgs,lr)))
17731 qrfrz(mgs) = bfnu*xmas(mgs,lr)*rhoinv(mgs)*crfrz(mgs)
17733 qrfrz(mgs) = min( qrfrz(mgs), 1.*qx(mgs,lr)*dtpinv )
17734 crfrz(mgs) = min( crfrz(mgs), 1.*cx(mgs,lr)*dtpinv )
17735 qrfrz(mgs) = min( qrfrz(mgs), qx(mgs,lr) )
17736 qrfrzf(mgs) = qrfrz(mgs)
17742 IF ( crfrz(mgs) .gt. qxmin(lh) )
THEN
17747 IF ( (ibiggsnow == 1 .or. ibiggsnow == 3 ) .and. ibiggopt /= 2 )
THEN
17748 xvfrz = rho0(mgs)*qrfrz(mgs)/(crfrz(mgs)*900.)
17749 frach = 0.5 *(1. + tanh(0.2e12 *( xvfrz - 1.15*xvmn(lh))))
17751 qrfrzs(mgs) = (1.-frach)*qrfrz(mgs)
17752 crfrzs(mgs) = (1.-frach)*crfrz(mgs)
17757 IF ( ipconc .ge. 14 .and. 1.e-3*rho0(mgs)*qrfrz(mgs)/crfrz(mgs) .lt. xvmn(lh) )
THEN
17758 qrfrzs(mgs) = qrfrz(mgs)
17759 crfrzs(mgs) = crfrz(mgs)
17763 qrfrzf(mgs) = frach*qrfrz(mgs)
17765 IF ( ibfr .le. 1 )
THEN
17766 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*1.0*vr1mm*1000.0)*rho0(mgs) )
17767 ELSEIF ( ibfr .eq. 5 )
THEN
17768 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*vfrz*1000.0)*rho0(mgs) )*rzxh(mgs)
17769 ELSEIF ( ibfr .eq. 2 )
THEN
17770 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*vfrz*1000.0)*rho0(mgs) )
17771 ELSEIF ( ibfr .eq. 6 )
THEN
17772 crfrzf(mgs) = frach*max(crfrz(mgs), qrfrz(mgs)/(bfnu*9.*xv(mgs,lr)*1000.0)*rho0(mgs) )
17774 crfrzf(mgs) = frach*crfrz(mgs)
17790 IF ( lvol(lh) .gt. 1 )
THEN
17791 vrfrzf(mgs) = rho0(mgs)*qrfrzf(mgs)/rhofrz
17795 IF ( nsplinter .ne. 0 )
THEN
17796 IF ( nsplinter .ge. 1000 )
THEN
17800 IF ( qrfrz(mgs)*dtp > qxmin(lh) .and. crfrz(mgs) > 1.e-3 )
THEN
17801 tmpdiam = 1.e6*( 6.*qrfrz(mgs)/(1000.*pi*crfrz(mgs) ))**(1./3.)
17802 tmp = lawson_splinter_fac*tmpdiam**4*crfrz(mgs)
17804 ELSEIF ( nsplinter .gt. 0 )
THEN
17805 tmp = nsplinter*crfrz(mgs)
17807 tmp = -nsplinter*crfrzf(mgs)
17809 csplinter2(mgs) = tmp
17810 qsplinter2(mgs) = min(0.1*qrfrz(mgs), tmp*splintermass/rho0(mgs) )
17837 if (ndebug .gt. 0 )
write(0,*)
'conc 25b'
17845 IF ( ibfc .ge. 1 .and. ibfc /= 3 .and. temg(mgs) < 268.15 )
THEN
17848 if ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. cxmin )
THEN
17849 IF ( ipconc < 2 )
THEN
17850 qwfrz(mgs) = ((2.0)*(brz)/(xdn(mgs,lc)*cx(mgs,lc))) &
17851 & *(exp(max(-arz*temcg(mgs), 0.0))-1.0) &
17852 & *rho0(mgs)*(qx(mgs,lc)**2)
17853 qwfrz(mgs) = max(qwfrz(mgs), 0.0)
17854 qwfrz(mgs) = min(qwfrz(mgs),qcmxd(mgs))
17855 cwfrz(mgs) = qwfrz(mgs)*rho0(mgs)/xmas(mgs,li)
17856 ELSEIF ( ipconc .ge. 2 )
THEN
17857 IF ( xdia(mgs,lc,3) > 0.e-6 )
THEN
17858 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
17863 IF ( alpha(mgs,lc) == 0.0 )
THEN
17864 cwfrz(mgs) = cx(mgs,lc)*exp(-volt/xv(mgs,lc))*dtpinv
17868 qwfrz(mgs) = cwfrz(mgs)*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
17870 ratio = (1. + alpha(mgs,lc))*volt/xv(mgs,lc)
17872 IF ( .false. .and. usegamxinfcnu )
THEN
17873 i = nint(dgami*(1. + alpha(mgs,lc)))
17875 i = nint(dgami*(2. + alpha(mgs,lc)))
17878 cwfrz(mgs) = cx(mgs,lc)*
gamxinf(1.+alpha(mgs,lc), ratio)/(dtp*gcnup1)
17880 qwfrz(mgs) = cx(mgs,lc)*xdn0(lc)*xv(mgs,lc)*rhoinv(mgs)*
gamxinf(2.+alpha(mgs,lc), ratio)/(dtp*gcnup2)
17884 ratio = min( maxratiolu, ratio )
17888 tmp =
gaminterp(ratio,alpha(mgs,lc),1,1)
17890 cwfrz(mgs) = cx(mgs,lc)*tmp*dtpinv
17892 tmp =
gaminterp(ratio,alpha(mgs,lc),12,1)
17894 qwfrz(mgs) = cx(mgs,lc)*xdn0(lc)*xv(mgs,lc)*rhoinv(mgs)*dtpinv*tmp
17902 if ( temg(mgs) .gt. 268.15 )
then
17909 if ( xplate(mgs) .eq. 1 )
then
17910 qwfrzp(mgs) = qwfrz(mgs)
17911 cwfrzp(mgs) = cwfrz(mgs)
17914 if ( xcolmn(mgs) .eq. 1 )
then
17915 qwfrzc(mgs) = qwfrz(mgs)
17916 cwfrzc(mgs) = cwfrz(mgs)
17929 if (ndebug .gt. 0 )
write(0,*)
'conc 25a'
17944 IF ( icfn .ge. 1 )
THEN
17946 IF ( temg(mgs) .lt. 271.15 .and. qx(mgs,lc) .gt. qxmin(lc))
THEN
17950 IF ( icfn .ge. 2 )
THEN
17951 ccia(mgs) = exp( 4.11 - (0.262)*temcg(mgs) )
17957 knud(mgs) = 2.28e-5 * temg(mgs) / ( pres(mgs)*raero )
17958 knuda(mgs) = 1.257 + 0.4*exp(-1.1/knud(mgs))
17959 gtp(mgs) = 1. / ( fai(mgs) + fbi(mgs) )
17960 dfar(mgs) = kb*temg(mgs)*(1.+knuda(mgs)*knud(mgs))/(6.*pi*fadvisc(mgs)*raero)
17961 fn1(mgs) = 2.*pi*xdia(mgs,lc,1)*cx(mgs,lc)*ccia(mgs)
17962 fn2(mgs) = -gtp(mgs)*(ssw(mgs)-1.)*felv(mgs)/pres(mgs)
17963 fnft(mgs) = 0.4*(1.+1.45*knud(mgs)+0.4*knud(mgs)*exp(-1./knud(mgs)))*(ftka(mgs)+2.5*knud(mgs)*kaero) &
17964 & / ( (1.+3.*knud(mgs))*(2*ftka(mgs)+5.*knud(mgs)*kaero+kaero) )
17968 ctfzbd(mgs) = fn1(mgs)*dfar(mgs)
17971 ctfzth(mgs) = fn1(mgs)*fn2(mgs)*fnft(mgs)/rho0(mgs)
17974 ctfzdi(mgs) = fn1(mgs)*fn2(mgs)*rw*temg(mgs)/(felv(mgs)*rho0(mgs))
17976 cwctfz(mgs) = max( ctfzbd(mgs) + ctfzth(mgs) + ctfzdi(mgs) , 0.)
17986 ELSEIF ( icfn .eq. 1 )
THEN
17987 IF ( wvel(mgs) .lt. -0.05 )
THEN
17988 cwctfz(mgs) = cfnfac*exp( (-2.80) - (0.262)*temcg(mgs) )
17989 cwctfz(mgs) = min((1.0e3)*cwctfz(mgs), ccmxd(mgs) )
17993 IF ( ipconc .ge. 2 )
THEN
17994 cwctfz(mgs) = min( cwctfz(mgs)*dtpinv, ccmxd(mgs) )
17995 qwctfz(mgs) = xmas(mgs,lc)*cwctfz(mgs)/rho0(mgs)
17997 qwctfz(mgs) = (cimasn)*cwctfz(mgs)/(dtp*rho0(mgs))
17998 qwctfz(mgs) = max(qwctfz(mgs), 0.0)
17999 qwctfz(mgs) = min(qwctfz(mgs),qcmxd(mgs))
18003 if ( xplate(mgs) .eq. 1 )
then
18004 qwctfzp(mgs) = qwctfz(mgs)
18005 cwctfzp(mgs) = cwctfz(mgs)
18008 if ( xcolmn(mgs) .eq. 1 )
then
18009 qwctfzc(mgs) = qwctfz(mgs)
18010 cwctfzc(mgs) = cwctfz(mgs)
18031 if (ndebug .gt. 0 )
write(0,*)
'conc 23a'
18033 hrifac = (1.e-3)*((0.044)*(0.01**3))
18041 IF ( ihrn .ge. 1 )
THEN
18042 if ( qx(mgs,lc) .gt. qxmin(lc) )
then
18043 if ( temg(mgs) .lt. 273.15 )
then
18054 IF ( log(cx(mgs,lc)*(1.e-6)/(3.0)) .gt. 0.0 )
THEN
18055 ciihr(mgs) = ((1.69e17)/dthr) &
18056 & *(log(cx(mgs,lc)*(1.e-6)/(3.0)) * &
18057 & ((1.e-3)*rho0(mgs)*qx(mgs,lc))/(cx(mgs,lc)*(1.e-6)))**(7./3.)
18058 ciihr(mgs) = ciihr(mgs)*(1.0e6)
18059 qiihr(mgs) = hrifac*ciihr(mgs)/rho0(mgs)
18060 qiihr(mgs) = max(qiihr(mgs), 0.0)
18061 qiihr(mgs) = min(qiihr(mgs),qcmxd(mgs))
18064 if ( xplate(mgs) .eq. 1 )
then
18065 qipiphr(mgs) = qiihr(mgs)
18066 cipiphr(mgs) = ciihr(mgs)
18069 if ( xcolmn(mgs) .eq. 1 )
then
18070 qicichr(mgs) = qiihr(mgs)
18071 cicichr(mgs) = ciihr(mgs)
18112 IF ( temg(mgs) .lt. tfr .and. qx(mgs,li) .gt. qxmin(li) )
THEN
18113 IF ( ipconc .ge. 4 .and. .false. )
THEN
18114 if ( cx(mgs,li) .gt. 10. .and. xdia(mgs,li,1) .gt. 50.e-6 )
then
18116 & (qx(mgs,li)*rho0(mgs) &
18117 & /(pi*xdn(mgs,li)*cx(mgs,li)))**(1./3.)
18118 IF ( cirdiatmp .gt. 100.e-6 )
THEN
18120 & ((pi*xdn(mgs,li)*cx(mgs,li)) / (6.0*rho0(mgs)*dtp)) &
18121 & *exp(-hdia0/cirdiatmp) &
18122 & *( (hdia0**3) + 3.0*(hdia0**2)*cirdiatmp &
18123 & + 6.0*(hdia0)*(cirdiatmp**2) + 6.0*(cirdiatmp**3) )
18125 & min(qscnvi(mgs),qimxd(mgs))
18126 IF ( ipconc .ge. 4 )
THEN
18127 cscnvi(mgs) = min( cimxd(mgs), cx(mgs,li)*exp(-hdia0/cirdiatmp))
18132 ELSEIF ( ipconc .lt. 4 )
THEN
18134 qscnvi(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
18135 qscnvi(mgs) = min(qscnvi(mgs),qxmxd(mgs,li))
18136 cscnvi(mgs) = qscnvi(mgs)*rho0(mgs)/xmas(mgs,li)
18137 cscnvis(mgs) = 0.5*cscnvi(mgs)
18150 fvent(mgs) = (fschm(mgs)**(1./3.)) * (fakvisc(mgs)**(-0.5))
18154 if ( ndebug .gt. 0 )
write(0,*)
'civent'
18165 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
18166 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
18167 IF ( qx(mgs,li) .gt. qxmin(li) )
THEN
18169 & (civenta*xdia(mgs,li,1)**civentb &
18170 & +civentc*xdia(mgs,li,1)**civentd) &
18172 & (civente*xdia(mgs,li,1)**civentf+civentg)
18173 xcivent = (fschm(mgs)**(1./3.))*((cireyn/fakvisc(mgs))**0.5)
18174 if ( xcivent .lt. 1.0 )
then
18175 civent(mgs) = 1.0 + 0.14*xcivent**2
18177 if ( xcivent .ge. 1.0 )
then
18178 civent(mgs) = 0.86 + 0.28*xcivent
18191 igmrwb = 100.*((5.0+br)/2.0)
18192 rwventa = (0.78)*gmoi(igmrwa)
18193 rwventb = (0.308)*gmoi(igmrwb)
18195 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
18196 IF ( ipconc .ge. 3 )
THEN
18197 IF ( imurain == 3 )
THEN
18198 IF ( izwisventr == 1 )
THEN
18199 rwvent(mgs) = ventrx(mgs)*(1.6 + 124.9*(1.e-3*rho0(mgs)*qx(mgs,lr))**.2046)
18203 & (0.78*ventrx(mgs) + 0.308*ventrxn(mgs)*fvent(mgs) &
18204 & *sqrt((ar*rhovt(mgs))) &
18205 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18215 IF ( iferwisventr == 1 )
THEN
18219 alpr = min(alpharmax,alpha(mgs,lr) )
18221 x = 1. + alpha(mgs,lr)
18223 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18225 i = int(dgami*(tmp))
18227 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18229 tmp = 2.5 + alpha(mgs,lr) + 0.5*bx(lr)
18230 i = int(dgami*(tmp))
18232 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
18239 vent1 = dble(xdia(mgs,lr,1))**(0.5 + 0.5*bx(lr))
18240 vent2 = dble(1. + 0.5*fx(lr)*xdia(mgs,lr,1))**dble(2.5+alpr+0.5*bx(lr))
18245 & 0.308*fvent(mgs)*y* &
18246 & sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
18256 ELSEIF ( iferwisventr == 2 )
THEN
18259 x = 1. + alpha(mgs,lr)
18262 & (0.78*x + 0.308*ventrxn(mgs)*fvent(mgs) &
18263 & *sqrt((ar*rhovt(mgs))) &
18264 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18267 IF ( ipconc >= 7 )
THEN
18268 alpr = min(alpharmax,alpha(mgs,lr) )
18270 tmp = alpr + 5.5 + br/2.
18271 i = int(dgami*(tmp))
18273 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18278 & 0.78*(4. + alpr)*(3. + alpr)*(2. + alpr)*(1. + alpr) + &
18279 & 0.308*fvent(mgs)* &
18280 & sqrt(ax(lr)*rhovt(mgs))*(y/gf1palp(mgs))*(xdia(mgs,lr,1)**((1.0+br)/2.0))
18290 & (rwventa + rwventb*fvent(mgs) &
18291 & *sqrt((ar*rhovt(mgs))) &
18292 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18300 igmswb = 100.*((5.0+ds)/2.0)
18301 swventa = (0.78)*gmoi(igmswa)
18302 swventb = (0.308)*gmoi(igmswb)
18304 IF ( qx(mgs,ls) .gt. qxmin(ls) )
THEN
18305 IF ( ipconc .ge. 4 )
THEN
18306 swvent(mgs) = 0.65 + 0.44*fvent(mgs)*sqrt(vtxbar(mgs,ls,1)*xdia(mgs,ls,1))
18310 & (swventa + swventb*fvent(mgs) &
18311 & *sqrt((cs*rhovt(mgs))) &
18312 & *(xdia(mgs,ls,1)**((1.0+ds)/2.0)) )
18322 igmhwb = 100.0*2.75
18323 hwventa = (0.78)*gmoi(igmhwa)
18324 hwventb = (0.308)*gmoi(igmhwb)
18330 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
18331 hwventc = (4.0*gr/(3.0*cdxgs(mgs,lh)))**(0.25)
18332 IF ( .false. .or. alpha(mgs,lh) .eq. 0.0 )
THEN
18334 & ( hwventa + hwventb*hwventc*fvent(mgs) &
18335 & *((xdn(mgs,lh)/rho0(mgs))**(0.25)) &
18336 & *(xdia(mgs,lh,1)**(0.75)))
18346 x = 1. + alpha(mgs,lh)
18348 tmp = 1 + alpha(mgs,lh)
18349 i = int(dgami*(tmp))
18351 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18353 tmp = 2.5 + alpha(mgs,lh) + 0.5*bxx(mgs,lh)
18354 i = int(dgami*(tmp))
18356 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
18359 hwventy(mgs) = 0.308*fvent(mgs)*(xdia(mgs,lh,1)**(0.5 + 0.5*bxx(mgs,lh)))*sqrt(axx(mgs,lh)*rhovt(mgs))
18361 & ( 0.78*x + y*hwventy(mgs) )
18376 IF ( lhl .gt. 1 )
THEN
18378 igmhwb = 100.0*2.75
18379 hwventa = (0.78)*gmoi(igmhwa)
18380 hwventb = (0.308)*gmoi(igmhwb)
18383 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
18384 hwventc = (4.0*gr/(3.0*cdxgs(mgs,lhl)))**(0.25)
18386 IF ( .false. .or. alpha(mgs,lhl) .eq. 0.0 )
THEN
18388 & ( hwventa + hwventb*hwventc*fvent(mgs) &
18389 & *((xdn(mgs,lhl)/rho0(mgs))**(0.25)) &
18390 & *(xdia(mgs,lhl,1)**(0.75)))
18401 x = 1. + alpha(mgs,lhl)
18403 tmp = 1 + alpha(mgs,lhl)
18404 i = int(dgami*(tmp))
18406 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18408 tmp = 2.5 + alpha(mgs,lhl) + 0.5*bxx(mgs,lhl)
18409 i = int(dgami*(tmp))
18411 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
18413 hlventy(mgs) = 0.308*fvent(mgs)*(xdia(mgs,lhl,1)**(0.5 + 0.5*bxx(mgs,lhl)))*sqrt(axx(mgs,lhl)*rhovt(mgs))
18415 hlvent(mgs) = 0.78*x + y*hlventy(mgs)
18433 & ( felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qss0(mgs)-qx(mgs,lv)) &
18434 & -ftka(mgs)*temcg(mgs) ) &
18435 & / ( rho0(mgs)*(felf(mgs)+fcw(mgs)*temcg(mgs)) )
18437 & (1.0)-fci(mgs)*temcg(mgs) &
18438 & / ( felf(mgs)+fcw(mgs)*temcg(mgs) )
18444 fmlt1(mgs) = (2.0*pi)* &
18445 & ( felv(mgs)*fwvdf(mgs)*(qss0(mgs)-qx(mgs,lv)) &
18446 & -ftka(mgs)*temcg(mgs)/rho0(mgs) ) &
18448 fmlt2(mgs) = -fcw(mgs)*temcg(mgs)/felf(mgs)
18449 fmlt1e(mgs) = (2.0*pi)* &
18450 & ( felv(mgs)*fwvdf(mgs)*(qss0(mgs)-qx(mgs,lv)) ) / (felf(mgs))
18457 & (4.0*pi/rho0(mgs))*(ssi(mgs)-1.0)* &
18458 & (1.0/(fai(mgs)+fbi(mgs)))
18462 & (4.0*pi/rho0(mgs))*(ssw(mgs)-1.0)* &
18463 & (1.0/(fav(mgs)+fbv(mgs)))
18473 IF ( lhwlg > 1 )
THEN
18511 if ( .not. mixedphase )
then
18514 IF ( temg(mgs) .gt. tfr )
THEN
18516 IF ( qx(mgs,ls) .gt. qxmin(ls) )
THEN
18519 & (c1sw*fmlt1(mgs)*cx(mgs,ls)*swvent(mgs)*xdia(mgs,ls,1) ) &
18535 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
18537 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
18540 & fmlt1(mgs)*cx(mgs,lh)*hwvent(mgs)*xdia(mgs,lh,1) &
18541 & + fmlt2(mgs)*(qhacrmlr(mgs)+qhacwmlr(mgs)) &
18543 ELSEIF ( ibinhmlr == 1 )
THEN
18545 errmsg =
'ibinhmlr = 1 not available for 2-moment'
18549 ELSEIF ( ibinhmlr == 2 .or. ibinhmlr == 3 )
THEN
18554 IF ( ivhmltsoak > 0 .and. qhmlr(mgs) < 0.0 .and. lvol(lh) > 1 .and. xdn(mgs,lh) .lt. xdnmx(lh) )
THEN
18556 v1 = (1. - xdn(mgs,lh)/xdnmx(lh))*(vx(mgs,lh) + rho0(mgs)*qhmlr(mgs)/xdn(mgs,lh) )/(dtp)
18557 v2 = -1.0*rho0(mgs)*qhmlr(mgs)/xdnmx(lh)
18559 vhsoak(mgs) = min(v1,v2)
18566 IF ( lhl .gt. 1 .and. lhlw < 1 )
THEN
18568 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
18569 IF ( ibinhlmlr == 0 .or. lzhl < 1)
THEN
18572 & fmlt1(mgs)*cx(mgs,lhl)*hlvent(mgs)*xdia(mgs,lhl,1) &
18573 & + fmlt2(mgs)*(qhlacrmlr(mgs)+qhlacwmlr(mgs)) &
18576 ELSEIF ( ibinhlmlr == 1 )
THEN
18581 ELSEIF ( ibinhlmlr == -1 )
THEN
18586 IF ( ivhmltsoak > 0 .and. qhlmlr(mgs) < 0.0 .and. lvol(lhl) > 1 .and. xdn(mgs,lhl) .lt. xdnmx(lhl) )
THEN
18588 v1 = (1. - xdn(mgs,lhl)/xdnmx(lhl))*(vx(mgs,lhl) + rho0(mgs)*qhlmlr(mgs)/xdn(mgs,lhl) )/(dtp)
18589 v2 = -1.0*rho0(mgs)*qhlmlr(mgs)/xdnmx(lhl)
18591 vhlsoak(mgs) = min(v1,v2)
18604 if ( .not. mixedphase ) qsmlr(mgs) = max( qsmlr(mgs), min( -qsmxd(mgs), -0.7*qx(mgs,ls)*dtpinv ) )
18605 IF ( .not. mixedphase )
THEN
18606 qhmlr(mgs) = max( qhmlr(mgs), min( -qhmxd(mgs), -0.95*qx(mgs,lh)*dtpinv ) )
18607 chmlr(mgs) = max( chmlr(mgs), min( -chmxd(mgs), -0.95*cx(mgs,lh)*dtpinv ) )
18616 IF ( lhl .gt. 1 .and. lhlw < 1 )
THEN
18617 qhlmlr(mgs) = max( qhlmlr(mgs), min( -qxmxd(mgs,lhl), -0.95*qx(mgs,lhl)*dtpinv ) )
18618 chlmlr(mgs) = max( chlmlr(mgs), min( -cxmxd(mgs,lhl), -0.95*cx(mgs,lhl)*dtpinv ) )
18626 if ( ipconc .ge. 1 )
then
18628 cimlr(mgs) = (cx(mgs,li)/(qx(mgs,li)+1.e-20))*qimlr(mgs)
18629 IF ( .not. mixedphase )
THEN
18630 IF ( xdia(mgs,ls,1) .gt. 1.e-6 .and. -qsmlr(mgs) .ge. 0.5*qxmin(ls) .and. ipconc .ge. 4 )
THEN
18632 csmlr(mgs) = (cx(mgs,ls)/(qx(mgs,ls)))*qsmlr(mgs)
18633 ELSEIF ( qx(mgs,ls) > qxmin(ls) )
THEN
18634 csmlr(mgs) = (cx(mgs,ls)/(qx(mgs,ls)))*qsmlr(mgs)
18637 csmlrr(mgs) = csmlr(mgs)/rzxs(mgs)
18638 IF ( -csmlrr(mgs)*dtp > cxmin .and. -qsmlr(mgs)*dtp > qxmin(lr) .and. snowmeltdia > 0.0 )
THEN
18639 rmas = rho0(mgs)*qsmlr(mgs)/csmlrr(mgs)
18640 IF ( rmas > snowmeltmass )
THEN
18641 csmlrr(mgs) = rho0(mgs)*qsmlr(mgs)/snowmeltmass
18651 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
18652 chmlr(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhmlr(mgs)
18653 IF ( imltshddmr == 3 .and. qhmlr(mgs) < -qxmin(lh) )
THEN
18662 tmp = 1. + alpha(mgs,lh)
18663 i = int(dgami*(tmp))
18665 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18667 ratio = min( maxratiolu, mltdiam1/xdia(mgs,lh,1) )
18669 x =
gamxinfdp(2. + alpha(mgs,lh), ratio)/g1palp
18670 y =
gamxinfdp(2.5 + alpha(mgs,lh) + 0.5*bxx(mgs,lh), ratio)/g1palp
18672 hwvent1 = 0.78*x + y*hwventy(mgs)
18674 qhlmlr1 = min( fmlt1(mgs)*cx(mgs,lh)*hwvent1*xdia(mgs,lh,1), 0.0 )
18676 chmlr(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*(qhmlr(mgs) - qhlmlr1)
18687 IF ( chmlr(mgs) < 0.0 .and. (ibinhmlr < 1 .or. lzh < 1) )
THEN
18688 IF ( ipconc >= 6 .and. lzr .gt. 1 .and. lzh < 1 .and. qx(mgs,lh) > qxmin(lh) )
THEN
18689 tmp = qx(mgs,lh)/cx(mgs,lh)
18690 alp = alpha(mgs,lh)
18693 zhmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs) )
18697 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
18698 IF ( ihmlt .eq. 1 )
THEN
18699 chmlrr(mgs) = min( chmlr(mgs), rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vmlt) )
18700 ELSEIF ( ihmlt .eq. 2 )
THEN
18701 IF ( xv(mgs,lh) .gt. 0.0 .and. chmlr(mgs) .lt. 0.0 )
THEN
18704 IF(imltshddmr == 1)
THEN
18707 tmp = -rho0(mgs)*qhmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lh)*xv(mgs,lh)))
18708 tmp2 = -rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vr3mm)
18710 chmlrr(mgs) = tmp*(sheddiam0-xdia(mgs,lh,3))/(sheddiam0-sheddiam)+tmp2*(xdia(mgs,lh,3)-sheddiam)/(sheddiam0-sheddiam)
18711 chmlrr(mgs) = -max(tmp,min(tmp2,chmlrr(mgs)))
18712 ELSEIF ( imltshddmr == 2 .or. imltshddmr == 3 )
THEN
18715 chmlrr(mgs) = rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lh))
18717 chmlrr(mgs) = rho0(mgs)*qhmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lh)*xv(mgs,lh)))
18720 chmlrr(mgs) = chmlr(mgs)
18722 ELSEIF ( ihmlt .eq. 0 )
THEN
18723 chmlrr(mgs) = chmlr(mgs)
18727 chmlrr(mgs) = min( chmlrr(mgs), rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*xvmx(lr)) )
18732 IF ( lhl .gt. 1 .and. lhlw < 1 .and. .not. mixedphase .and. qhlmlr(mgs) < 0.0 )
THEN
18734 IF ( ibinhlmlr == 0 .or. lzhl < 1 )
THEN
18739 chlmlr(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlmlr(mgs)
18740 IF ( imltshddmr == 3 .and. qhlmlr(mgs) < -qxmin(lhl) )
THEN
18750 tmp = 1. + alpha(mgs,lhl)
18751 i = int(dgami*(tmp))
18753 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18755 ratio = min( maxratiolu, mltdiam1/xdia(mgs,lhl,1) )
18757 x =
gamxinfdp(2. + alpha(mgs,lhl), ratio)/g1palp
18758 y =
gamxinfdp(2.5 + alpha(mgs,lhl) + 0.5*bxx(mgs,lhl), ratio)/g1palp
18760 hwvent1 = 0.78*x + y*hlventy(mgs)
18762 qhlmlr1 = min( fmlt1(mgs)*cx(mgs,lhl)*hwvent1*xdia(mgs,lhl,1), 0.0 )
18764 chlmlr(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*min(0.0, qhlmlr(mgs) - qhlmlr1)
18770 IF ( ibinhlmlr == 0 .or. lzhl < 1 )
THEN
18771 IF ( ihmlt .eq. 1 )
THEN
18772 chlmlrr(mgs) = min( chlmlr(mgs), rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vmlt) )
18773 ELSEIF ( ihmlt .eq. 2 )
THEN
18774 IF ( xv(mgs,lhl) .gt. 0.0 .and. chlmlr(mgs) .lt. 0.0 )
THEN
18777 IF(imltshddmr == 1 )
THEN
18778 tmp = -rho0(mgs)*qhlmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lhl)*xv(mgs,lhl)))
18779 tmp2 = -rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vr3mm)
18780 chlmlrr(mgs) = tmp*(20.e-3-xdia(mgs,lhl,3))/(20.e-3-sheddiam)+tmp2*(xdia(mgs,lhl,3)-sheddiam)/(20.e-3-sheddiam)
18781 chlmlrr(mgs) = -max(tmp,min(tmp2,chlmlrr(mgs)))
18782 ELSEIF ( imltshddmr == 2 .or. imltshddmr == 3 )
THEN
18785 chlmlrr(mgs) = rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lhl))
18787 chlmlrr(mgs) = rho0(mgs)*qhlmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lhl)*xv(mgs,lhl)))
18790 chlmlrr(mgs) = chlmlr(mgs)
18792 ELSEIF ( ihmlt .eq. 0 )
THEN
18793 chlmlrr(mgs) = chlmlr(mgs)
18797 chlmlrr(mgs) = min( chlmlrr(mgs), rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*xvmx(lr)) )
18801 IF ( ipconc >= 8 .and. lzhl .gt. 1 .and. ibinhlmlr <= 0 )
THEN
18802 IF ( cx(mgs,lhl) > 0.0 )
THEN
18804 tmp = qx(mgs,lhl)/cx(mgs,lhl)
18805 alp = alpha(mgs,lhl)
18809 zhlmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( tmp * qhlmlr(mgs) )
18827 rwcap(mgs) = (0.5)*xdia(mgs,lr,1)
18828 swcap(mgs) = (0.5)*xdia(mgs,ls,1)
18829 hwcap(mgs) = (0.5)*xdia(mgs,lh,1)
18830 IF ( lhl .gt. 1 ) hlcap(mgs) = (0.5)*xdia(mgs,lhl,1)
18832 if ( qx(mgs,li).gt.qxmin(li) .and. xdia(mgs,li,1) .gt. 0.0 )
then
18836 cilen(mgs) = 0.4764*(xdia(mgs,li,1))**(0.958)
18837 cval = xdia(mgs,li,1)
18839 eval = sqrt(1.0-(aval**2)/(cval**2))
18840 fval = min(0.99,eval)
18841 gval = alog( abs( (1.+fval)/(1.-fval) ) )
18842 cicap(mgs) = cval*fval / gval
18853 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
18854 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
18856 & fvds(mgs)*cx(mgs,li)*civent(mgs)*cicap(mgs)*depfac
18858 & fvds(mgs)*cx(mgs,ls)*swvent(mgs)*swcap(mgs)*depfac
18870 & fvds(mgs)*cx(mgs,lh)*hwvent(mgs)*hwcap(mgs)*depfac
18872 IF ( lhl .gt. 1 ) qhldsv(mgs) = fvds(mgs)*cx(mgs,lhl)*hlvent(mgs)*hlcap(mgs)*depfac
18886 IF ( dosublimationfix )
THEN
18890 qitmp(mgs) = qx(mgs,li) + qx(mgs,ls) + qx(mgs,lh)
18891 IF ( lis > 1 ) qitmp(mgs) = qitmp(mgs) + qx(mgs,lis)
18892 IF ( lhl > 1 ) qitmp(mgs) = qitmp(mgs) + qx(mgs,lhl)
18893 qrtmp(mgs) = qx(mgs,lr)
18894 qctmp(mgs) = qx(mgs,lc)
18895 qsimxdep(mgs) = 0.0
18896 qsimxsub(mgs) = 0.0
18901 IF ( qitmp(mgs) > qxmin(li) )
THEN
18903 qitmp1 = qitmp(mgs)
18904 qctmp1 = qctmp(mgs)
18905 felvcptmp = felvcp(mgs)
18906 felscptmp = felscp(mgs)
18907 qvtmp(mgs) = qx(mgs,lv)
18908 qss(mgs) = qvs(mgs)
18912 thetatmp = theta(mgs)
18913 thetaptmp = thetap(mgs)
18914 temgtmp = temg(mgs)
18915 temcgtmp = temcg(mgs)
18916 qvaptmp = qx(mgs,lv)
18922 dqwvtmp(mgs) = ( qvtmp(mgs) - qsstmp )
18929 IF ( itertd == 1 )
THEN
18932 dqcitmp(mgs) = dqci(mgs)
18938 dqwv(mgs) = ( qvtmp(mgs) - qsstmp )
18942 if( dqwv(mgs) .lt. 0. )
then
18943 if( qitmp(mgs) .gt. -dqwv(mgs) )
then
18944 dqci(mgs) = dqwv(mgs)
18947 dqci(mgs) = -qitmp(mgs)
18948 dqwv(mgs) = dqwv(mgs) + qitmp(mgs)
18951 qvptmp = qvptmp - ( dqcw(mgs) + dqci(mgs) )
18953 IF ( itertd == 2 .and. eqtset > 1 )
THEN
18957 cvm = cv+cvv*qvtmp(mgs)+cpl*(qx(mgs,lc)+qrtmp(mgs)) &
18960 felvcptmp = (felv(mgs)-rw*temg(mgs))/cvm
18961 felscptmp = (fels(mgs)-rw*temg(mgs))/cvm
18966 qctmp(mgs) = qctmp(mgs) + dqcw(mgs)
18967 qitmp(mgs) = qitmp(mgs) + dqci(mgs)
18968 thetaptmp = thetaptmp + &
18970 & (felvcp(mgs)*dqcw(mgs) +felscp(mgs)*dqci(mgs))
18977 IF ( dqwv(mgs) .ge. 0. )
THEN
18984 if ( temg(mgs) .lt. tfr .and. temg(mgs) .gt. thnuc )
then
18988 if ( temg(mgs) .le. thnuc )
then
18994 gamss = (felvcp(mgs)*fracl(mgs) + felscp(mgs)*fraci(mgs)) &
18997 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv2(mgs)*qsstmp/ &
18998 & ((temg(mgs)-cbi)**2))
19000 if ( temg(mgs) .ge. tfr )
then
19001 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qsstmp/ &
19002 & ((temg(mgs)-cbw)**2))
19008 dqcw(mgs) = dqvcnd(mgs)*fracl(mgs)
19009 dqci(mgs) = dqvcnd(mgs)*fraci(mgs)
19011 thetaptmp = thetaptmp + &
19012 & (felvcp(mgs)*dqcw(mgs) + felscp(mgs)*dqci(mgs)) &
19015 qvptmp = qvptmp - ( dqvcnd(mgs) )
19016 qctmp(mgs) = qctmp(mgs) + dqcw(mgs)
19017 qitmp(mgs) = qitmp(mgs) + dqci(mgs)
19019 IF ( itertd == 2 .and. eqtset > 1 )
THEN
19023 cvm = cv+cvv*qvtmp(mgs)+cpl*(qctmp(mgs) +qrtmp(mgs)) &
19026 felvcptmp = (felv(mgs)-rw*temg(mgs))/cvm
19027 felscptmp = (fels(mgs)-rw*temg(mgs))/cvm
19030 IF ( eqtset > 2 )
THEN
19031 pipert(mgs) = pipert(mgs) + (0 &
19032 & +felspi(mgs)*dqci(mgs) &
19033 & +felvpi(mgs)*dqcw(mgs))*dtp
19042 IF ( itertd == 1 )
THEN
19045 thetatmp = thetaptmp + theta0(mgs)
19046 temgtmp = thetatmp*pk(mgs)
19047 qvaptmp = max((qvptmp + qv0(mgs)), 0.0)
19048 temcgtmp = temgtmp - tfr
19049 tqvcon = temgtmp-cbw
19050 ltemq = (temgtmp-163.15)/fqsat+1.5
19051 ltemq = min( nqsat, max(1,ltemq) )
19052 qvstmp = pqs(mgs)*tabqvs(ltemq)
19053 qisstmp = pqs(mgs)*tabqis(ltemq)
19054 qctmp(mgs) = max( 0.0, qctmp(mgs) )
19055 qitmp(mgs) = max( 0.0, qitmp(mgs) )
19056 qvtmp(mgs) = max( 0.0, qvaptmp )
19063 qctmp(mgs) = max( 0.0, qctmp(mgs) )
19064 qitmp(mgs) = max( 0.0, qitmp(mgs) )
19066 IF ( qitmp(mgs) < qitmp1 )
THEN
19067 qsimxsub(mgs) = (qitmp1 - qitmp(mgs))*dtpinv
19068 ELSEIF ( qitmp(mgs) > qitmp1 )
THEN
19069 qsimxdep(mgs) = (qitmp(mgs) - qitmp1)*dtpinv
19088 qsimxdep(mgs) = qvimxd(mgs)
19089 qsimxsub(mgs) = 1.e20
19110 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
19111 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
19115 qisbv(mgs) = max( min(qidsv(mgs), 0.0), min( -qimxd(mgs), -0.5*qx(mgs,li)*dtpinv ) )
19116 IF ( temg(mgs) < tfr .or. .not. qsmlr(mgs) < 0.0 )
THEN
19117 qssbv(mgs) = max( min(qsdsv(mgs), 0.0), min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
19119 qidpv(mgs) = max(qidsv(mgs), 0.0)
19120 qsdpv(mgs) = max(qsdsv(mgs), 0.0)
19122 IF ( qsmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19124 qscev(mgs) = evapfac* &
19125 & 4.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,ls)*swcap(mgs)*swvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19126 qscev(mgs) = max( min(0.0,qscev(mgs)), min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
19142 IF ( qx(mgs,lh) > qxmin(lh) )
THEN
19143 IF ( temg(mgs) < tfr .or. .not. qhmlr(mgs) < 0.0 )
THEN
19145 qhsbv(mgs) = max( min(qhdsv(mgs), 0.0), -qhmxd(mgs) )
19146 qhdpv(mgs) = max(qhdsv(mgs), 0.0)
19149 IF ( .true. .and. qhmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19155 qhcev(mgs) = evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))* &
19156 & cx(mgs,lh)*xdia(mgs,lh,1)*hwvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19158 qhcev(mgs) = max(qhcev(mgs), -qhmxd(mgs))
19159 IF ( temg(mgs) > tfr ) qhcev(mgs) = min(0.0, qhcev(mgs) )
19167 IF ( lhl .gt. 1 )
THEN
19168 IF ( qx(mgs,lhl) > qxmin(lhl) )
THEN
19169 IF ( temg(mgs) < tfr .or. .not. qhlmlr(mgs) < 0.0 )
THEN
19170 qhlsbv(mgs) = max( min(qhldsv(mgs), 0.0), -qxmxd(mgs,lhl) )
19171 qhldpv(mgs) = max(qhldsv(mgs), 0.0)
19173 IF ( qhlmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19175 qhlcev(mgs) = evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))* &
19176 & cx(mgs,lhl)*xdia(mgs,lhl,1)*hlvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19178 qhlcev(mgs) = max(qhlcev(mgs), -qhlmxd(mgs))
19179 IF ( temg(mgs) > tfr ) qhlcev(mgs) = min(0.0, qhlcev(mgs) )
19185 temp1 = qidpv(mgs) + qsdpv(mgs) + qhdpv(mgs) + qhldpv(mgs)
19191 IF ( temp1 .gt. qsimxdep(mgs) )
THEN
19192 frac = qsimxdep(mgs)/temp1
19194 qidpv(mgs) = frac*qidpv(mgs)
19195 qsdpv(mgs) = frac*qsdpv(mgs)
19196 qhdpv(mgs) = frac*qhdpv(mgs)
19197 qhldpv(mgs) = frac*qhldpv(mgs)
19206 temp1 = qisbv(mgs) + qssbv(mgs) + qhsbv(mgs) + qhlsbv(mgs)
19209 IF ( temp1 < -qsimxsub(mgs) )
THEN
19210 frac = -qsimxsub(mgs)/temp1
19212 qisbv(mgs) = frac*qisbv(mgs)
19213 qssbv(mgs) = frac*qssbv(mgs)
19214 qhsbv(mgs) = frac*qhsbv(mgs)
19215 qhlsbv(mgs) = frac*qhlsbv(mgs)
19228 if ( ipconc .ge. 1 )
then
19230 cssbv(mgs) = (cx(mgs,ls)/(qx(mgs,ls)+1.e-20))*qssbv(mgs)
19231 cisbv(mgs) = (cx(mgs,li)/(qx(mgs,li)+1.e-20))*qisbv(mgs)
19232 chsbv(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhsbv(mgs)
19233 IF ( lhl .gt. 1 ) chlsbv(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlsbv(mgs)
19245 if (ndebug .gt. 0 )
write(0,*)
'conc 29a'
19250 if ( ipconc .ge. 4 .and. iscni .ge. 1 .and. qx(mgs,li) .gt. qxmin(li) )
then
19251 IF ( iscni .eq. 1 )
THEN
19253 & pi*rho0(mgs)*((0.25)/(6.0)) &
19254 & *eii(mgs)*(qx(mgs,li)**2)*(xdia(mgs,li,2)) &
19255 & *vtxbar(mgs,li,1)/xmas(mgs,li)
19256 cscni(mgs) = min(cimxd(mgs),qscni(mgs)*rho0(mgs)/xmas(mgs,li))
19257 cscnis(mgs) = 0.5*cscni(mgs)
19258 ELSEIF ( iscni .eq. 2 .or. iscni .eq. 4 .or. iscni .eq. 5 )
THEN
19259 IF ( iscni .ne. 5 .and. qidpv(mgs) .gt. 0.0 .and. xdia(mgs,li,3) .ge. 100.e-6 )
THEN
19264 qscni(mgs) = min(0.5, xdia(mgs,li,3)/200.e-6)*qidpv(mgs)
19268 cscni(mgs) = fscni*qscni(mgs)*rho0(mgs)/max(rho_qs*xvmn(ls),xmas(mgs,li))
19272 cscnis(mgs) = cscni(mgs)
19278 IF ( iscni .ne. 4 )
THEN
19281 tmp = ess(mgs)*rvt*aa2*cx(mgs,li)*cx(mgs,li)*xv(mgs,li)
19286 qscni(mgs) = qscni(mgs) + min( qxmxd(mgs,li), 2.0*tmp*xmas(mgs,li)*rhoinv(mgs) )
19287 cscni(mgs) = cscni(mgs) + min( cxmxd(mgs,li), 2.0*tmp )
19288 cscnis(mgs) = cscnis(mgs) + min( cxmxd(mgs,li), tmp )
19290 ELSEIF ( iscni .eq. 3 )
THEN
19291 qscni(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
19292 qscni(mgs) = min(qscni(mgs),qxmxd(mgs,li))
19293 cscni(mgs) = qscni(mgs)*rho0(mgs)/xmas(mgs,li)
19294 cscnis(mgs) = 0.5*cscni(mgs)
19298 ELSEIF ( ipconc < 4 )
THEN
19300 qimax = rhoinv(mgs)*roqimax
19301 qscni(mgs) = min(0.90*qx(mgs,li), max( 0.0, (qx(mgs,li) - qimax)*dtpinv ) )
19303 qscni(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
19304 qscni(mgs) = min(qscni(mgs),qxmxd(mgs,li))
19307 if ( iscni > 0 .and. qx(mgs,li) .gt. qxmin(li) )
then
19309 & pi*rho0(mgs)*((0.25)/(6.0)) &
19310 & *eii(mgs)*(qx(mgs,li)**2)*(xdia(mgs,li,2)) &
19311 & *vtxbar(mgs,li,1)/xmas(mgs,li)
19312 cscni(mgs) = min(cimxd(mgs),qscni(mgs)*rho0(mgs)/xmas(mgs,li))
19328 qsdry(mgs) = qsacr(mgs) + qsacw(mgs) &
19331 qhdry(mgs) = qhaci(mgs) + qhacs(mgs) &
19337 IF ( lhl .gt. 1 )
THEN
19338 qhldry(mgs) = qhlaci(mgs) + qhlacs(mgs) &
19348 IF ( tfrdry < temg(mgs) .and. temg(mgs) < tfr )
THEN
19359 IF ( incwet == 0 )
THEN
19361 & ( xdia(mgs,lh,1)*hwvent(mgs)*cx(mgs,lh)*fwet1(mgs) &
19362 & + fwet2(mgs)*(qhaci(mgs) + qhacs(mgs)) )
19363 qhwet(mgs) = max( 0.0, qhwet(mgs))
19371 IF ( lhl .gt. 1 )
THEN
19372 IF ( incwet == 0 )
THEN
19374 & ( xdia(mgs,lhl,1)*hlvent(mgs)*cx(mgs,lhl)*fwet1(mgs) &
19375 & + fwet2(mgs)*(qhlaci(mgs) + qhlacs(mgs)) )
19376 qhlwet(mgs) = max( 0.0, qhlwet(mgs))
19384 qhwet(mgs) = qhdry(mgs)
19385 qhlwet(mgs) = qhldry(mgs)
19407 wetsfc(:) = .false.
19408 wetgrowth(:) = .false.
19409 wetsfchl(:) = .false.
19410 wetgrowthhl(:) = .false.
19416 qhshr(mgs) = min( 0.0, qhwet(mgs) - qhdry(mgs) )
19420 qhlshr(mgs) = min( 0.0, qhlwet(mgs) - qhldry(mgs) )
19430 if ( temg(mgs) .lt. 243.15 )
then
19436 wetsfc(mgs) = .false.
19437 wetgrowth(mgs) = .false.
19438 wetsfchl(mgs) = .false.
19439 wetgrowthhl(mgs) = .false.
19444 if ( temg(mgs) .gt. tfr )
then
19446 IF ( .false. )
THEN
19447 qsshr(mgs) = -qsdry(mgs)
19448 qhshr(mgs) = -qhdry(mgs)
19449 qhlshr(mgs) = -qhldry(mgs)
19452 qsshr(mgs) = - qsacr(mgs) - qsacw(mgs)
19453 qhlshr(mgs) = - qhlacw(mgs) - qhlacr(mgs)
19454 qhshr(mgs) = - qhacw(mgs) - qhacr(mgs)
19458 vhshdr(mgs) = -vhacw(mgs) - vhacr(mgs)
19459 vhlshdr(mgs) = -vhlacw(mgs) - vhlacr(mgs)
19465 wetsfc(mgs) = (qhshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr ) .or. ( qhmlr(mgs) < -qxmin(lh) .and. temg(mgs) > tfr )
19466 wetgrowth(mgs) = (qhshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
19468 if (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
THEN
19469 wetsfchl(mgs) = (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr ) .or. ( qhlmlr(mgs) < -qxmin(lhl) .and. temg(mgs) > tfr )
19470 wetgrowthhl(mgs) = (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
19475 if ( ipconc .ge. 1 )
then
19485 chshrr(mgs) = rho0(mgs)*qhshr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lh))
19491 IF ( lhl .gt. 1 )
THEN
19501 chlshrr(mgs) = rho0(mgs)*qhlshr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lhl))
19518 if ( qsshr(mgs) .lt. 0.0 )
then
19535 if ( wetgrowth(mgs) .or. (mixedphase .and. fhw(mgs) .gt. 0.05 .and. temg(mgs) .gt. 243.15) )
then
19540 IF ( lvol(lh) .gt. 1 .and. .not. mixedphase)
THEN
19542 IF ( iwetsoak )
THEN
19544 rimdn(mgs,lh) = xdnmx(lh)
19545 raindn(mgs,lh) = xdnmx(lh)
19546 vhacw(mgs) = qhacw(mgs)*rho0(mgs)/rimdn(mgs,lh)
19547 vhacr(mgs) = qhacr(mgs)*rho0(mgs)/raindn(mgs,lh)
19549 IF ( xdn(mgs,lh) .lt. xdnmx(lh) )
THEN
19552 v1 = (1. - xdn(mgs,lh)/xdnmx(lh))*vx(mgs,lh)/(dtp)
19554 v2 = rho0(mgs)*qhwet(mgs)/xdnmx(lh)
19556 vhsoak(mgs) = min(v1,v2)
19563 vhshdr(mgs) = min(0.0, rho0(mgs)*qhwet(mgs)/xdnmx(lh) - vhacw(mgs) - vhacr(mgs) )
19565 ELSEIF ( lvol(lh) .gt. 1 .and. mixedphase )
THEN
19578 IF ( ehi(mgs) .gt. 0.0 )
THEN
19579 qhaci(mgs) = min(qimxd(mgs),qhaci0(mgs))
19580 chaci(mgs) = min(cimxd(mgs),chaci0(mgs))
19582 IF ( ehs(mgs) .gt. 0.0 )
THEN
19584 qhacs(mgs) = min(qsmxd(mgs),qhacs0(mgs))
19585 chacs(mgs) = min(csmxd(mgs),chacs0(mgs))
19587 qhacs(mgs) = min(qsmxd(mgs),qhacs(mgs))
19591 wetsfc(mgs) = .true.
19601 if ( lhl > 1 .and. ( wetgrowthhl(mgs) .or. (mixedphase .and. fhlw(mgs) .gt. 0.05 .and. temg(mgs) .gt. 243.15) ) )
then
19613 IF ( lvol(lhl) .gt. 1 .and. .not. mixedphase )
THEN
19616 IF ( iwetsoak )
THEN
19618 rimdn(mgs,lhl) = xdnmx(lhl)
19619 raindn(mgs,lhl) = xdnmx(lhl)
19620 vhlacw(mgs) = qhlacw(mgs)*rho0(mgs)/rimdn(mgs,lhl)
19621 vhlacr(mgs) = qhlacr(mgs)*rho0(mgs)/raindn(mgs,lhl)
19623 IF ( xdn(mgs,lhl) .lt. xdnmx(lhl) )
THEN
19626 v1 = (1. - xdn(mgs,lhl)/xdnmx(lhl))*vx(mgs,lhl)/(dtp)
19628 v2 = rho0(mgs)*qhlwet(mgs)/xdnmx(lhl)
19629 IF ( v1 > v2 )
THEN
19645 vhlshdr(mgs) = min(0.0, rho0(mgs)*qhlwet(mgs)/xdnmx(lhl) - vhlacw(mgs) - vhlacr(mgs) )
19648 ELSEIF ( lvol(lhl) .gt. 1 .and. mixedphase )
THEN
19653 IF ( ehli(mgs) .gt. 0.0 )
THEN
19654 qhlaci(mgs) = min(qimxd(mgs),qhlaci0(mgs))
19655 chlaci(mgs) = min(cimxd(mgs),chlaci0(mgs))
19661 IF ( ehls(mgs) .gt. 0.0 )
THEN
19662 qhlacs(mgs) = min(qsmxd(mgs),qhlacs0(mgs))
19663 chlacs(mgs) = min(csmxd(mgs),chlacs0(mgs))
19672 wetsfchl(mgs) = .true.
19691 IF ( iglcnvi .ge. 1 )
THEN
19692 IF ( temg(mgs) .lt. 273.0 .and. qiacw(mgs) - qidpv(mgs) .gt. 0.0 )
THEN
19695 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
19696 & *((0.60)*vtxbar(mgs,li,1)) &
19697 & /(temg(mgs)-273.15))**(rimc2)
19698 tmp = min( max( rimc3, tmp ), 900.0 )
19706 IF ( tmp .ge. 200.0 .or. iglcnvi >= 2 )
THEN
19707 r = max( 0.5*(xdn(mgs,li) + tmp), xdnmn(lh) )
19709 qhcni(mgs) = (qiacw(mgs) - qidpv(mgs))
19710 chcni(mgs) = cx(mgs,li)*qhcni(mgs)/qx(mgs,li)
19712 chcnih(mgs) = min(chcni(mgs), rho0(mgs)*qhcni(mgs)/(r*xvmn(lh)) )
19714 vhcni(mgs) = rho0(mgs)*qhcni(mgs)/r
19717 ELSEIF ( iglcnvi == 3 )
THEN
19719 IF ( temg(mgs) .lt. 273.0 .and. qiacw(mgs)*dtp > 2.*qxmin(lh) .and. gamice73fac*xmas(mgs,li) > xdnmn(lh)*xvmn(lh) )
THEN
19722 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
19723 & *((0.60)*vtxbar(mgs,li,1)) &
19724 & /(temg(mgs)-273.15))**(rimc2)
19725 tmp = min( max( rimc3, tmp ), 900.0 )
19735 IF ( tmp .ge. xdnmn(lh) )
THEN
19736 r = max( 0.5*(xdn(mgs,li) + tmp), xdnmn(lh) )
19738 qhcni(mgs) = 0.5*qiacw(mgs)
19739 chcni(mgs) = qhcni(mgs)/(gamice73fac*xmas(mgs,li))
19740 chcnih(mgs) = min(chcni(mgs), rho0(mgs)*qhcni(mgs)/(r*xvmn(lh)) )
19742 vhcni(mgs) = rho0(mgs)*qhcni(mgs)/r
19768 IF ( lhl .gt. 1 )
THEN
19770 IF ( ihlcnh == 1 .or. ihlcnh == 3 )
THEN
19780 IF ( hlcnhdia > 0 )
THEN
19781 ltest = xdia(mgs,lh,3) .gt. hlcnhdia
19784 ltest = xdia(mgs,lh,1)*(4. + alpha(mgs,lh)) > abs( hlcnhdia )
19787 IF ( iusedw == 0 .and. ihlcnh == 1 )
THEN
19790 IF (((qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. temg(mgs) .le. tfr-2.0 &
19791 .and. temg(mgs) .gt. dwtempmin ) .or. ( wetgrowth(mgs) .and. qx(mgs,lh) > hlcnhqmin ) )
THEN
19795 x = 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
19796 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0
19797 IF ( x > 1.e-20 )
THEN
19798 arg = min(70.0, (-temcg(mgs)/x ))
19799 dwr = 0.01*(exp(arg) - 1.0)
19804 IF ( dwr < 0.2 .and. dwr > 0.0 .and. rho0(mgs)*(qx(mgs,lc)+qx(mgs,lr)) > 1.e-4 )
THEN
19805 sqrtrhovt = sqrt( rhovt(mgs) )
19806 fventh = sqrtrhovt*(fpndl(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
19807 fventm = sqrtrhovt*(fschm(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
19808 ltemq = (tfr-163.15)/fqsat+1.5
19809 qvs0 = pqs(mgs)*tabqvs(ltemq)
19810 denomdp = felf(mgs) + fcw(mgs)*temcg(mgs)
19811 denominvdp = 1.d0/(felf(mgs) + fcw(mgs)*temcg(mgs))
19814 h1 = ( -ftka(mgs)*temcg(mgs) - felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qx(mgs,lv) - qvs0) )
19815 h2 = ehi(mgs)*qx(mgs,li)*rho0(mgs)*fci(mgs)*temcg(mgs)
19816 h3 = max(dwehwmin, ehw(mgs))*qx(mgs,lc)
19817 h4 = ehr(mgs)* qx(mgs,lr)
19822 vth = axx(mgs,lh)*d**bxx(mgs,lh)
19823 x2 = fventh*sqrtrhovt*sqrt(d*vth)
19824 IF ( x2 > 1.4 )
THEN
19825 ah = 0.78 + 0.308*x2
19827 ah = 1.0 + 0.108*x2**2
19830 IF ( .false. )
THEN
19831 x1 = fventm*sqrtrhovt*sqrt(d*vth)
19832 IF ( x1 > 1.4 )
THEN
19833 am = 0.78 + 0.308*x1
19835 am = 1.0 + 0.108*x1**2
19838 d = 8.*denominvdp*( am*felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qvs0 - qx(mgs,lv)) - ah*ftka(mgs)*temcg(mgs) )/ &
19839 (dtp* ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
19840 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs) + &
19841 max(0.001,vth - vtxbar(mgs,li,1))*h2*denominvdp))
19848 ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
19849 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp + &
19850 max(0.001,vth - vtxbar(mgs,li,1))*h2)
19853 IF ( abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) )
EXIT
19858 dg0(mgs) = min( dwmax, max( d, dwmin ) )
19860 IF ( qx(mgs,lh) > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. temg(mgs) .le. tfr-2.0 )
THEN
19863 dg0(mgs) = dg0thresh + 0.0001
19867 IF ( ihlcnh == 3 .and. (qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin &
19868 .and. temg(mgs) .le. tfr-2.0 )
THEN
19870 dg0(mgs) = min( dg0(mgs), dg0thresh - 0.0001 )
19875 wtest = (dg0(mgs) > 0.0 .and. dg0(mgs) < dg0thresh )
19877 IF ( ihlcnh == 1 )
THEN
19879 IF ( ( wetgrowth(mgs) .and. (xdn(mgs,lh) .gt. hldnmn .or. lvh < 1 ) .and. &
19880 & rimdn(mgs,lh) .gt. 800. .and. &
19881 & ltest .and. qx(mgs,lh) .gt. hlcnhqmin ) .or. wtest )
THEN
19884 IF ( qhacw(mgs) .gt. 0.0 .and. qhacw(mgs) .gt. qhaci(mgs) .and. temg(mgs) .le. tfr-2.0 )
THEN
19891 x = (1.1e4*(rho0(mgs)*qx(mgs,lc)) - 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0e-3 )
19892 IF ( x > 1.e-20 )
THEN
19893 arg = min(70.0, (-temcg(mgs)/x ))
19894 dh0 = 0.01*(exp(arg) - 1.0)
19903 IF ( xdia(mgs,lh,3)/dh0 .gt. 0.1 )
THEN
19905 tmp = qhacw(mgs) + qhacr(mgs) + qhaci(mgs) + qhacs(mgs)
19907 qtmp = min( 100.0, xdia(mgs,lh,3)/(2.0*dh0) )*(tmp)
19908 qhlcnh(mgs) = min( qxmxd(mgs,lh), qtmp )
19910 IF ( ipconc .ge. 5 )
THEN
19912 IF ( .not. wtest ) dh0 = min( dh0, 10.e-3 )
19913 IF ( qx(mgs,lhl) > 0.1e-3 ) dh0 = max( dh0, xdia(mgs,lhl,3) )
19914 chlcnhhl(mgs) = min( cxmxd(mgs,lh), rho0(mgs)*qhlcnh(mgs)/(pi*xdn(mgs,lh)*dh0**3/6.0) )
19916 r = rho0(mgs)*qhlcnh(mgs)/(xdn(mgs,lh)*xv(mgs,lh))
19917 chlcnh(mgs) = max( chlcnhhl(mgs), r )
19920 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
19921 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
19928 ELSEIF ( ihlcnh == 3 )
THEN
19932 ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr-2. .and. qx(mgs,lh) > hlcnhqmin ) )
THEN
19934 IF ( ipconc == 5 )
THEN
19939 ratio = min( maxratiolu, dg0(mgs)/xdia(mgs,lh,1) )
19943 tmp2 =
gaminterp(ratio,alpha(mgs,lh),4,1)
19944 IF ( ipconc == 5 )
THEN
19947 qxd1 = qx(mgs,lh)*(tmp2)
19948 qhlcnh(mgs) = dtpinv*qxd1
19950 tmp3 = qxmxd(mgs,lh)
19951 IF (qxd1 > tmp3 )
THEN
19958 IF ( ( qxd1 > qxmin(lhl) .and. ipconc > 5 ) .or. ( qxd1 > 10.*qxmin(lhl) .and. ipconc == 5) )
THEN
19961 tmp =
gaminterp(ratio,alpha(mgs,lh),1,1)
19962 IF ( ipconc == 5 )
THEN
19965 cxd1 = flim*cx(mgs,lh)*( tmp)
19966 chlcnh(mgs) = dtpinv*cxd1
19967 chlcnhhl(mgs) = chlcnh(mgs)
19969 IF ( qx(mgs,lhl) > qxmin(lhl) .and. dmhlopt > 0 )
THEN
19970 tmp = rho0(mgs)*qhlcnh(mgs)/chlcnhhl(mgs)
19971 IF ( tmp < xmas(mgs,lhl) )
THEN
19973 dh0 = (( qxd1*tmp**(1./3.) + qx(mgs,lhl)*xmas(mgs,lhl)**(1./3.))/( qxd1 + qx(mgs,lhl)))**3
19974 chlcnhhl(mgs) = min( chlcnhhl(mgs), rho0(mgs)*qhlcnh(mgs)/dh0 )
19982 IF ( ipconc >= 6 .and. lzh > 1 .and. lzhl > 1 )
THEN
19983 tmp3 =
gaminterp(ratio,alpha(mgs,lh),11,1)
19984 zxd1 = flim*zx(mgs,lh)*(tmp3)
19985 zhlcnh(mgs) = dtpinv*zxd1
19994 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
19995 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20004 ELSEIF ( ihlcnh == 2 )
THEN
20015 IF ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr-2. .and. qx(mgs,lh) > qxmin(lh) )
THEN
20016 ratio = min( maxratiolu, hldia1/xdia(mgs,lh,1) )
20019 tmp =
gaminterp(ratio,alpha(mgs,lh),1,1)
20020 cxd1 = cx(mgs,lh)*( tmp)
20021 chlcnh(mgs) = dtpinv*cxd1
20022 chlcnhhl(mgs) = chlcnh(mgs)
20025 tmp2 =
gaminterp(ratio,alpha(mgs,lh),4,1)
20026 qxd1 = qx(mgs,lh)*(tmp2)
20027 qhlcnh(mgs) = dtpinv*qxd1
20030 IF ( lzh > 1 .and. lzhl > 1 )
THEN
20031 tmp3 =
gaminterp(ratio,alpha(mgs,lh),11,1)
20032 zxd1 = zx(mgs,lh)*(tmp3)
20033 zhlcnh(mgs) = dtpinv*zxd1
20037 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
20038 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20044 ELSEIF ( ihlcnh == 0 )
THEN
20049 if ( wetgrowth(mgs) .and. temg(mgs) .lt. tfr-5. .and. qx(mgs,lh) > qxmin(lh) )
then
20050 if ( qhacw(mgs).gt.1.e-6 .and. xdn(mgs,lh) > 700. )
then
20052 ((pi*xdn(mgs,lh)*cx(mgs,lh)) / (6.0*rho0(mgs)*dtp)) &
20053 *exp(-hldia1/xdia(mgs,lh,1)) &
20054 *( (hldia1**3) + 3.0*(hldia1**2)*xdia(mgs,lh,1) &
20055 + 6.0*(hldia1)*(xdia(mgs,lh,1)**2) + 6.0*(xdia(mgs,lh,1)**3) )
20056 qhlcnh(mgs) = min(qhlcnh(mgs),qhmxd(mgs))
20057 IF ( ipconc .ge. 5 )
THEN
20058 chlcnh(mgs) = min( cxmxd(mgs,lh), cx(mgs,lh)*exp(-hldia1/xdia(mgs,lh,1)))
20059 chlcnhhl(mgs) = chlcnh(mgs)
20062 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
20063 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20073 IF ( icvhl2h >= 1 )
THEN
20075 IF ( qx(mgs,lhl) > qxmin(lhl) .and. xdn(mgs,lhl) < 0.5*(xdnmn(lhl) + xdnmx(lhl)) )
THEN
20076 tmp = min(0.95, 1. - 0.5*(1. + tanh(0.125*(xdn(mgs,lhl) - 1.01*xdnmn(lhl) )) ))
20077 qhcnhl(mgs) = tmp*qx(mgs,lhl)*dtpinv
20078 chcnhl(mgs) = cx(mgs,lhl)*qhcnhl(mgs)/qx(mgs,lhl)
20079 vhcnhl(mgs) = vx(mgs,lhl)*qhcnhl(mgs)/qx(mgs,lhl)
20105 IF ( ipconc .ge. 5 )
THEN
20108 IF ( temg(mgs) < tfr .and. qx(mgs,lh) .gt. qxmin(lh) .and. qhdpv(mgs) > qxmin(lh)*dtpinv &
20109 & .and. qhacw(mgs) < qxmin(lh)*dtpinv )
THEN
20110 IF ( xdn(mgs,lh) < 290. )
THEN
20118 IF ( qx(mgs,ls) .gt. qxmin(ls) .and. qsacw(mgs) .gt. 0.0 )
THEN
20137 IF ( iglcnvs .eq. 1 )
THEN
20139 dnnet = cscnvis(mgs) + cscnis(mgs) - csacs(mgs)
20140 dqnet = qscnvi(mgs) + qscni(mgs) + qsacw(mgs) + qsdpv(mgs) + qssbv(mgs)
20142 a3 = 1./(rho0(mgs)*qx(mgs,ls))
20143 a1 = exp( - xdn(mgs,ls)*cx(mgs,ls)*vgra*a3 )
20145 a2 = (1.-(cx(mgs,ls)*vgra*xdn(mgs,ls)*a3))*dnnet
20147 a4 = cx(mgs,ls)**2*vgra*xdn(mgs,ls)*a3/qx(mgs,ls)*dqnet
20149 chcns(mgs) = max( 0.0, a1*(a2 + a4) )
20150 chcns(mgs) = min( chcns(mgs), cxmxd(mgs,ls) )
20151 chcnsh(mgs) = chcns(mgs)
20153 qhcns(mgs) = min( xdn(mgs,ls)*vgra*rhoinv(mgs)*chcns(mgs), qxmxd(mgs,ls) )
20154 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/max(xdn(mgs,ls),xdnmn(lh))
20157 ELSEIF ( iglcnvs .ge. 2 )
THEN
20159 IF ( temg(mgs) .lt. 273.0 .and. ( qsacw(mgs) - qsdpv(mgs) .gt. 0.0 .or. &
20160 ( iglcnvs >= 3 .and. qsacw(mgs)*dtp > 2.*qxmin(lh) .and. gamsnow73fac*xmas(mgs,ls) > xdnmn(lh)*xvmn(lh) ) ) )
THEN
20163 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
20164 & *((0.60)*vtxbar(mgs,ls,1)) &
20165 & /(temg(mgs)-273.15))**(rimc2)
20167 tmp = min( tmp , 900.0 )
20175 IF ( iglcnvs == 2 )
THEN
20176 IF ( tmp .ge. 200.0 )
THEN
20177 r = max( 0.5*(xdn(mgs,ls) + tmp), xdnmn(lh) )
20179 qhcns(mgs) = (qsacw(mgs) - qsdpv(mgs))
20180 chcns(mgs) = cx(mgs,ls)*qhcns(mgs)/qx(mgs,ls)
20182 chcnsh(mgs) = min(chcns(mgs), rho0(mgs)*qhcns(mgs)/(r*xvmn(lh)) )
20184 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/r
20187 ELSEIF ( iglcnvs == 3 )
THEN
20192 IF ( tmp > xdnmn(lh) )
THEN
20193 r = max( 0.5*(xdn(mgs,ls) + tmp), xdnmn(lh) )
20195 qhcns(mgs) = 0.5*qsacw(mgs)
20196 chcns(mgs) = qhcns(mgs)/(gamsnow73fac*xmas(mgs,ls))
20197 chcns(mgs) = min( chcns(mgs), cx(mgs,ls)*qhcns(mgs)/qx(mgs,ls))
20198 chcnsh(mgs) = min(chcns(mgs), rho0(mgs)*qhcns(mgs)/(r*xvmn(lh)) )
20199 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/r
20213 qhcns(mgs) = 0.001*ehscnv(mgs)*max((qx(mgs,ls)-6.e-4),0.0)
20214 qhcns(mgs) = min(qhcns(mgs),qxmxd(mgs,ls))
20215 IF ( lvol(lh) .ge. 1 ) vhcns(mgs) = rho0(mgs)*qhcns(mgs)/max(xdn(mgs,ls),400.)
20225 if ( irwfrz .gt. 0 .and. .not. mixedphase)
then
20231 qrztot(mgs) = qrfrz(mgs) + qiacr(mgs) + qsacr(mgs)
20237 & ( xdia(mgs,lr,1)*rwvent(mgs)*cx(mgs,lr)*fwet1(mgs) )
20238 qrzmax(mgs) = max(qrzmax(mgs), 0.0)
20239 qrzmax(mgs) = min(qrztot(mgs), qrzmax(mgs))
20240 qrzmax(mgs) = min(qx(mgs,lr)*dtpinv, qrzmax(mgs))
20242 IF ( temcg(mgs) < -30. )
THEN
20243 qrzmax(mgs) = qx(mgs,lr)*dtpinv
20250 IF ( qrztot(mgs) .gt. qrzmax(mgs) .and. qrztot(mgs) .gt. qxmin(lr) )
THEN
20251 qrzfac(mgs) = qrzmax(mgs)/(qrztot(mgs))
20255 qrzfac(mgs) = min(1.0, qrzfac(mgs))
20264 if ( temg(mgs) .le. 273.15 .and. qrzfac(mgs) .lt. 1.0 )
then
20265 qrfrz(mgs) = qrzfac(mgs)*qrfrz(mgs)
20266 qrfrzs(mgs) = qrzfac(mgs)*qrfrzs(mgs)
20267 qrfrzf(mgs) = qrzfac(mgs)*qrfrzf(mgs)
20268 qiacr(mgs) = qrzfac(mgs)*qiacr(mgs)
20269 qsacr(mgs) = qrzfac(mgs)*qsacr(mgs)
20270 qiacrf(mgs) = qrzfac(mgs)*qiacrf(mgs)
20271 qiacrs(mgs) = qrzfac(mgs)*qiacrs(mgs)
20272 crfrz(mgs) = qrzfac(mgs)*crfrz(mgs)
20273 crfrzf(mgs) = qrzfac(mgs)*crfrzf(mgs)
20274 crfrzs(mgs) = qrzfac(mgs)*crfrzs(mgs)
20275 ciacr(mgs) = qrzfac(mgs)*ciacr(mgs)
20276 ciacrf(mgs) = qrzfac(mgs)*ciacrf(mgs)
20277 ciacrs(mgs) = qrzfac(mgs)*ciacrs(mgs)
20284 vrfrzf(mgs) = qrzfac(mgs)*vrfrzf(mgs)
20285 viacrf(mgs) = qrzfac(mgs)*viacrf(mgs)
20305 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
20308 & fvce(mgs)*cx(mgs,lr)*rwvent(mgs)*rwcap(mgs)*evapfac
20310 IF ( rcond .eq. 1 )
THEN
20311 qrcev(mgs) = min(qrcev(mgs), qxmxd(mgs,lv))
20314 qrcev(mgs) = min(qrcev(mgs), 0.0)
20317 qrcev(mgs) = max(qrcev(mgs), -qrmxd(mgs))
20319 IF ( qrcev(mgs) .lt. 0. .and. lnr > 1 )
THEN
20322 IF ( icrcev == 1 )
THEN
20323 crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)
20324 ELSEIF ( icrcev == 2 )
THEN
20325 crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)*vtxbar(mgs,lr,2)/vtxbar(mgs,lr,1)
20340 IF ( lhwlg > 1 )
THEN
20344 IF ( lhlwlg > 1 )
THEN
20366 ltest = qx(mgs,lh) .gt. qxmin(lh)
20367 IF ( lhl > 1 ) ltest = ltest .or. qx(mgs,lhl) .gt. qxmin(lhl)
20369 IF ( (itype1 .ge. 1 .or. itype2 .ge. 1 ) &
20370 & .and. qx(mgs,lc) .gt. qxmin(lc))
THEN
20371 if ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 271.15 )
then
20372 IF ( ipconc .ge. 2 )
THEN
20373 IF ( xv(mgs,lc) .gt. 0.0 &
20380 IF ( alpha(mgs,lc) == 0.0 )
THEN
20381 ex1 = (1./250.)*exp(-7.23e-15/xv(mgs,lc))
20384 ratio = (1. + alpha(mgs,lc))*(7.23e-15)/xv(mgs,lc)
20386 IF ( usegamxinfcnu )
THEN
20387 i = nint(dgami*(1. + alpha(mgs,lc)))
20389 ex1 = (1./250.)*
gamxinf(1.+alpha(mgs,lc), ratio)/(gcnup1)
20391 ratio = min( maxratiolu, ratio )
20392 tmp =
gaminterp(ratio,alpha(mgs,lc),1,1)
20393 ex1 = (1./250.)*tmp
20396 IF ( itype2 .le. 2 )
THEN
20397 ft = max(0.0,min(1.0,-0.11*temcg(mgs)**2 - 1.1*temcg(mgs)-1.7))
20399 IF ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 267.15 )
THEN
20401 ELSEIF (temg(mgs) .ge. 267.15 .and. temg(mgs) .le. 269.15 )
THEN
20403 ELSEIF (temg(mgs) .ge. 269.15 .and. temg(mgs) .le. 271.15 )
THEN
20412 IF ( ft > 0.0 )
THEN
20414 IF ( itype2 > 0 )
THEN
20415 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. (.not. wetsfc(mgs)) )
THEN
20416 chmul1(mgs) = ft*ex1*chacw(mgs)
20418 qhmul1(mgs) = cimas0*chmul1(mgs)*rhoinv(mgs)
20420 IF ( lhl .gt. 1 )
THEN
20421 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
20422 chlmul1(mgs) = (ft*ex1*chlacw(mgs))
20423 qhlmul1(mgs) = cimas0*chlmul1(mgs)*rhoinv(mgs)
20428 IF ( itype1 > 0 )
THEN
20429 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. (.not. wetsfc(mgs)) )
THEN
20430 tmp = ft*(3.5e+08)*rho0(mgs)*qhacw(mgs)
20431 chmul1(mgs) = chmul1(mgs) + tmp
20432 qhmul1(mgs) = qhmul1(mgs) + cimas0*tmp*rhoinv(mgs)
20434 IF ( lhl .gt. 1 )
THEN
20435 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
20436 tmp = ft*(3.5e+08)*rho0(mgs)*qhlacw(mgs)
20437 chlmul1(mgs) = chlmul1(mgs) + tmp
20438 qhlmul1(mgs) = qhlmul1(mgs) + cimas0*tmp*rhoinv(mgs)
20456 if ( temg(mgs) .ge. 268.15 .and. temg(mgs) .le. 270.15 )
then
20457 fimt1(mgs) = 1.0 -(temg(mgs)-268.15)/2.0
20458 elseif (temg(mgs) .le. 268.15 .and. temg(mgs) .ge. 265.15 )
then
20459 fimt1(mgs) = 1.0 +(temg(mgs)-268.15)/3.0
20466 if ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 267.15 )
then
20468 elseif (temg(mgs) .ge. 267.15 .and. temg(mgs) .le. 269.15 )
then
20470 elseif (temg(mgs) .ge. 269.15 .and. temg(mgs) .le. 271.15 )
then
20481 IF ( itype1 .ge. 1 )
THEN
20482 fimta(mgs) = (3.5e+08)*rho0(mgs)
20495 xcwmas = xmas(mgs,lc) * 1000.
20497 IF ( itype2 .ge. 1 )
THEN
20498 if ( xcwmas.lt.1.26e-9 )
then
20501 if ( xcwmas .le. 3.55e-9 .and. xcwmas .ge. 1.26e-9 )
then
20502 fimt2(mgs) = (2.27)*alog(xcwmas) + 13.39
20504 if ( xcwmas .gt. 3.55e-9 )
then
20508 fimt2(mgs) = min(fimt2(mgs),1.0)
20509 fimt2(mgs) = max(fimt2(mgs),0.0)
20523 IF ( .not. wetsfc(mgs) )
THEN
20524 chmul1(mgs) = fimt1(mgs)*(fimta(mgs) + &
20525 & (4.0e-03)*fimt2(mgs))*qhacw(mgs)
20528 qhmul1(mgs) = chmul1(mgs)*(cimas0/rho0(mgs))
20530 IF ( lhl .gt. 1 )
THEN
20531 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
20532 tmp = fimt1(mgs)*(fimta(mgs) + &
20533 & (4.0e-03)*fimt2(mgs))*qhlacw(mgs)
20535 qhlmul1(mgs) = cimas0*tmp*rhoinv(mgs)
20563 IF ( isnwfrac /= 0 )
THEN
20565 IF (temg(mgs) .gt. 265.0)
THEN
20566 if (xdia(mgs,ls,1) .gt. 100.e-6 .and. xdia(mgs,ls,1) .lt. 2.0e-3)
then
20568 tmp = rhoinv(mgs)*pi*xdn(mgs,ls)*cx(mgs,ls)*(500.e-6)**3
20569 qsmul(mgs) = max( kfrag*( qx(mgs,ls) - tmp ) , 0.0 )
20571 qsmul(mgs) = min( qxmxd(mgs,li), qsmul(mgs) )
20572 csmul(mgs) = min( cxmxd(mgs,li), rho0(mgs)*qsmul(mgs)/mfrag )
20589 qracif(mgs) = qraci(mgs)
20590 cracif(mgs) = craci(mgs)
20625 IF ( icenucopt == 1 .or. icenucopt == -10 .or. icenucopt == -11 )
THEN
20626 if ( ( temg(mgs) .lt. 268.15 .or. &
20628 & ( imeyers5 .and. temg(mgs) .lt. 272.0 .and. temgkm2(mgs) .lt. tfr) ) .and. &
20629 & ciintmx .gt. (cx(mgs,li)+ccitmp) &
20632 fiinit(mgs) = (felv(mgs)**2)/(cp*rw)
20633 dqisdt(mgs) = (qx(mgs,lv)-qis(mgs))/ &
20634 & (1.0 + fiinit(mgs)*qis(mgs)/tsqr(mgs))
20637 if ( ssi(mgs) .gt. 1.0 )
THEN
20639 dzfacp = max( float(kgsp(mgs)-kgs(mgs)), 0.0 )
20640 dzfacm = max( float(kgs(mgs)-kgsm(mgs)), 0.0 )
20643 & *(cmassin/rho0(mgs)) &
20644 & *max(0.0,wvel(mgs)) &
20645 & *max((cninp(mgs)-cninm(mgs)),0.0)/gz(igs(mgs),jgs,kgs(mgs)) &
20646 & /((dzfacp+dzfacm))
20648 qiint(mgs) = min(qiint(mgs), max(0.25*dqisdt(mgs),0.0))
20649 ciint(mgs) = qiint(mgs)*rho0(mgs)/cmassin
20657 IF ( icenucopt /= -10 )
THEN
20659 IF ( lcin > 1 )
THEN
20660 ciint(mgs) = min(ciint(mgs), ccin(mgs)*dtpinv)
20661 ccin(mgs) = ccin(mgs) - ciint(mgs)*dtp
20662 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20663 ELSEIF ( lcina > 1 )
THEN
20664 ciint(mgs) = max(0.0, min( ciint(mgs), min( cnina(mgs), ciintmx ) - cina(mgs) ))
20665 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20667 ELSEIF ( icenucopt == 1 .and. ciint(mgs) .gt. max(0.0, ciintmx - cx(mgs,li) - ccitmp )*dtpinv )
THEN
20668 ciint(mgs) = max(0.0, ciintmx - (cx(mgs,li)) )*dtpinv
20669 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20671 ELSEIF ( icenucopt == -11 .and. dtp*ciint(mgs) .gt. ( cnina(mgs) - (cx(mgs,li) - ccitmp)))
THEN
20672 ciint(mgs) = max(0.0, cnina(mgs) - (cx(mgs,li)+ccitmp)*dtpinv )
20673 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20681 ELSEIF ( icenucopt == 2 .or. icenucopt == -1 .or. icenucopt == -2 )
THEN
20683 IF ( ( temg(mgs) .lt. 268.15 .and. ssw(mgs) > 1.0 ) .or. ssi(mgs) > 1.25 )
THEN
20684 IF ( lcin > 1 )
THEN
20685 ciint(mgs) = min(cnina(mgs), ccin(mgs))
20686 ciint(mgs) = min( ciint(mgs), max(0.0, ciintmx - (cx(mgs,li) - ccitmp) ) )
20687 ccin(mgs) = ccin(mgs) - ciint(mgs)
20688 ciint(mgs) = ciint(mgs)*dtpinv
20690 ciint(mgs) = max( 0.0, cnina(mgs) - cina(mgs) )*dtpinv
20692 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20694 fiinit(mgs) = (felv(mgs)**2)/(cp*rw)
20695 dqisdt(mgs) = (qx(mgs,lv)-qis(mgs))/(1.0 + fiinit(mgs)*qis(mgs)/tsqr(mgs))
20696 qiint(mgs) = min(qiint(mgs), max(0.25*dqisdt(mgs),0.0))
20697 ciint(mgs) = qiint(mgs)*rho0(mgs)/cmassin
20702 ELSEIF ( icenucopt == 3 .or. icenucopt == 4 .or. icenucopt == 10 )
THEN
20703 IF ( temg(mgs) .lt. 268.15 )
THEN
20704 IF ( lcin > 1 )
THEN
20705 ciint(mgs) = min(cnina(mgs), ccin(mgs))
20706 ciint(mgs) = min( ciint(mgs), max(0.0, ciintmx - (cx(mgs,li) + ccitmp) ) )
20707 ccin(mgs) = ccin(mgs) - ciint(mgs)
20708 ciint(mgs) = ciint(mgs)*dtpinv
20710 ciint(mgs) = max( 0.0, cnina(mgs) - cina(mgs) )*dtpinv
20712 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
20717 if ( xplate(mgs) .eq. 1 )
then
20718 qipipnt(mgs) = qiint(mgs)
20719 cipint(mgs) = ciint(mgs)
20722 if ( xcolmn(mgs) .eq. 1 )
then
20723 qicicnt(mgs) = qiint(mgs)
20724 cicint(mgs) = ciint(mgs)
20737 if (ndebug .gt. 0 )
write(0,*)
'dbg = 8'
20740 if (ndebug .gt. 0 )
write(0,*)
'Collection: set 3-component'
20772 qrshr(mgs) = qsshr(mgs) + qhshr(mgs) + qhlshr(mgs)
20773 crshr(mgs) = chshrr(mgs)/rzxh(mgs) + chlshrr(mgs)/rzxhl(mgs)
20776 IF ( ipconc .ge. 3 )
THEN
20788 IF ( ipconc .ge. 1 )
THEN
20819 IF ( warmonly < 0.5 )
THEN
20820 IF ( ffrzs < 1.0 )
THEN
20823 & il5(mgs)*cicint(mgs) &
20824 & +il5(mgs)*((1.0-cwfrz2snowfrac)*cwfrzc(mgs)+cwctfzc(mgs) &
20828 & + csplinter(mgs) + csplinter2(mgs) &
20831 pccii(mgs) = pccii(mgs)*(1.0 - ffrzs)
20835 & il5(mgs)*(-cscni(mgs) - cscnvi(mgs) &
20838 & -chaci(mgs) - chlaci(mgs) &
20840 & +il5(mgs)*cisbv(mgs) &
20841 & -(1.-il5(mgs))*cimlr(mgs)
20843 pccin(mgs) = ciint(mgs)
20848 ELSEIF ( warmonly < 0.8 )
THEN
20856 & il5(mgs)*cicint(mgs) &
20857 & +il5(mgs)*((1.0-cwfrz2snowfrac)*cwfrzc(mgs)+cwctfzc(mgs) &
20861 & + csplinter(mgs) + csplinter2(mgs) &
20864 pccii(mgs) = pccii(mgs)*(1. - ffrzs)
20871 & +il5(mgs)*cisbv(mgs) &
20872 & -(1.-il5(mgs))*cimlr(mgs)
20874 pccin(mgs) = ciint(mgs)
20884 IF ( ipconc .ge. 2 )
THEN
20887 pccwi(mgs) = (0.0) - cwshw(mgs)
20889 IF ( warmonly < 0.5 )
THEN
20892 & il5(mgs)*(-ciacw(mgs)-cwfrz(mgs)-cwctfzp(mgs) &
20895 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
20898 ELSEIF ( warmonly < 0.8 )
THEN
20902 & -ciacw(mgs)-cwfrz(mgs)-cwctfzp(mgs) &
20905 & -cracw(mgs) -chacw(mgs) -chlacw(mgs)
20922 & - cautn(mgs) -cracw(mgs)
20926 IF ( .false. .and. exwmindiam > 0.0 .and. ccwresv(mgs) > 0.0 )
THEN
20928 & il5(mgs)*(-ciacw(mgs) &
20930 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
20932 IF ( -pccwdacc(mgs)*dtp .gt. cx(mgs,lc) - ccwresv(mgs) )
THEN
20934 frac = -(cx(mgs,lc) - ccwresv(mgs) )/(pccwdacc(mgs)*dtp)
20935 pccwdacc(mgs) = -(cx(mgs,lc) - ccwresv(mgs) )*dtpinv
20937 ciacw(mgs) = frac*ciacw(mgs)
20938 cracw(mgs) = frac*cracw(mgs)
20939 csacw(mgs) = frac*csacw(mgs)
20940 chacw(mgs) = frac*chacw(mgs)
20941 cautn(mgs) = frac*cautn(mgs)
20943 IF ( lhl .gt. 1 ) chlacw(mgs) = frac*chlacw(mgs)
20948 & il5(mgs)*(-ciacw(mgs)-cwfrzp(mgs)-cwctfzp(mgs) &
20949 & -cwfrzc(mgs)-cwctfzc(mgs) &
20950 & -il5(mgs)*(ciihr(mgs)) &
20952 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
20959 IF ( -pccwd(mgs)*dtp .gt. cx(mgs,lc) )
THEN
20966 frac = -cx(mgs,lc)/(pccwd(mgs)*dtp)
20967 pccwd(mgs) = -cx(mgs,lc)*dtpinv
20969 ciacw(mgs) = frac*ciacw(mgs)
20970 cwfrz(mgs) = frac*cwfrz(mgs)
20971 cwfrzp(mgs) = frac*cwfrzp(mgs)
20972 cwctfzp(mgs) = frac*cwctfzp(mgs)
20973 cwfrzc(mgs) = frac*cwfrzc(mgs)
20974 cwctfzc(mgs) = frac*cwctfzc(mgs)
20975 cwctfz(mgs) = frac*cwctfz(mgs)
20976 cracw(mgs) = frac*cracw(mgs)
20977 csacw(mgs) = frac*csacw(mgs)
20978 chacw(mgs) = frac*chacw(mgs)
20979 cautn(mgs) = frac*cautn(mgs)
20981 pccii(mgs) = pccii(mgs) - (1.-frac)*il5(mgs)*(cwfrzc(mgs)+cwctfzc(mgs))*(1. - ffrzs)
20982 IF ( lhl .gt. 1 ) chlacw(mgs) = frac*chlacw(mgs)
20994 IF ( ipconc .ge. 3 )
THEN
20998 IF ( warmonly < 0.5 )
THEN
21002 & +(1-il5(mgs))*( &
21003 & -chmlrr(mgs)/rzxh(mgs) &
21004 & -chlmlrr(mgs)/rzxhl(mgs) &
21010 & il5(mgs)*(-ciacr(mgs) - crfrz(mgs) ) &
21012 & - chacr(mgs) - chlacr(mgs) &
21018 ELSEIF ( warmonly < 0.8 )
THEN
21021 & +(1-il5(mgs))*( &
21022 & -chmlrr(mgs)/rzxh(mgs) &
21023 & -chlmlrr(mgs)/rzxhl(mgs) &
21029 & il5(mgs)*( - crfrz(mgs) ) &
21050 IF ( -pcrwd(mgs)*dtp .gt. cx(mgs,lr) )
THEN
21058 frac = -cx(mgs,lr)/(pcrwd(mgs)*dtp)
21059 pcrwd(mgs) = -cx(mgs,lr)*dtpinv
21061 ciacr(mgs) = frac*ciacr(mgs)
21062 ciacrf(mgs) = frac*ciacrf(mgs)
21063 ciacrs(mgs) = frac*ciacrs(mgs)
21064 crfrz(mgs) = frac*crfrz(mgs)
21065 crfrzf(mgs) = frac*crfrzf(mgs)
21066 crfrzs(mgs) = frac*crfrzs(mgs)
21067 chacr(mgs) = frac*chacr(mgs)
21068 chlacr(mgs) = frac*chlacr(mgs)
21069 crcev(mgs) = frac*crcev(mgs)
21070 cracr(mgs) = frac*cracr(mgs)
21080 IF ( warmonly < 0.5 )
THEN
21085 IF ( ipconc .ge. 4 )
THEN
21089 & il5(mgs)*(cscnis(mgs) + cscnvis(mgs) ) &
21090 & + cwfrz2snowfrac*cwfrz(mgs)/cwfrz2snowratio &
21093 IF ( ffrzs > 0.0 )
THEN
21094 pcswi(mgs) = pcswi(mgs) + ffrzs* ( &
21095 & il5(mgs)*cicint(mgs) &
21096 & +il5(mgs)*(cwfrzc(mgs)+cwctfzc(mgs) &
21100 & + csplinter(mgs) + csplinter2(mgs) &
21105 IF ( ess0 < 0.0 )
THEN
21106 csacs(mgs) = max(0.0, csacs(mgs) - (ifrzs)*(crfrzs(mgs) + ciacrs(mgs)))
21111 & -chacs(mgs) - chlacs(mgs) &
21113 & +(1-il5(mgs))*csmlr(mgs) + csshr(mgs) &
21119 IF ( imixedphase == 0 )
THEN
21120 IF ( cx(mgs,ls) + dtp*(pcswi(mgs) + pcswd(mgs)) < 0.0 )
THEN
21121 frac = (-cx(mgs,ls) + pcswi(mgs)*dtp)/(pcswd(mgs)*dtp)
21123 pcswd(mgs) = frac*pcswd(mgs)
21125 chacs(mgs) = frac*chacs(mgs)
21126 chlacs(mgs) = frac*chlacs(mgs)
21127 chcns(mgs) = frac*chcns(mgs)
21128 csmlr(mgs) = frac*csmlr(mgs)
21129 csshr(mgs) = frac*csshr(mgs)
21130 cssbv(mgs) = frac*cssbv(mgs)
21131 csacs(mgs) = frac*csacs(mgs)
21138 pccii(mgs) = pccii(mgs) &
21139 & + (1. - ifrzs)*crfrzs(mgs) &
21140 & + (1. - ifrzs)*ciacrs(mgs)
21142 pcswi(mgs) = pcswi(mgs) &
21143 & + (ifrzs)*crfrzs(mgs) &
21144 & + (ifrzs)*ciacrs(mgs)
21153 IF ( ipconc .ge. 5 )
THEN
21156 & +(ffrzh*ifrzg*crfrzf(mgs) &
21157 & +il5(mgs)*ffrzh*ifiacrg*(ciacrf(mgs) )) &
21158 & + f2h*chcnsh(mgs) + f2h*chcnih(mgs) + chcnhl(mgs)
21161 & (1-il5(mgs))*chmlr(mgs) &
21164 & - il5(mgs)*chlcnh(mgs) &
21176 IF ( lhl .gt. 1 .and. lnhl > 1 )
THEN
21178 pchli(mgs) = (ffrzh*(1.0-ifrzg)*crfrzf(mgs) +il5(mgs)*ffrzh*(1.0-ifiacrg)*(ciacrf(mgs) )) &
21179 & + chlcnhhl(mgs) *rzxhlh(mgs)
21182 & (1-il5(mgs))*chlmlr(mgs) &
21184 & + chlsbv(mgs) - chcnhl(mgs)
21186 IF ( imixedphase == 0 )
THEN
21188 IF ( cx(mgs,lhl) + dtp*(pchli(mgs) + pchld(mgs)) < 0.0 )
THEN
21191 frac = (-cx(mgs,lhl) + pchli(mgs)*dtp)/(pchld(mgs)*dtp)
21193 chlmlr(mgs) = frac*chlmlr(mgs)
21194 chlsbv(mgs) = frac*chlsbv(mgs)
21195 chcnhl(mgs) = frac*chcnhl(mgs)
21197 pchld(mgs) = frac*pchld(mgs)
21209 ELSEIF ( warmonly < 0.8 )
THEN
21214 IF ( ipconc .ge. 5 )
THEN
21217 & +ifrzg*(crfrzf(mgs) )
21220 & (1-il5(mgs))*chmlr(mgs) &
21221 & - il5(mgs)*chlcnh(mgs)
21226 IF ( lhl .gt. 1 )
THEN
21228 pchli(mgs) = (1.0-ifrzg)*(crfrzf(mgs)) &
21229 & + chlcnhhl(mgs) *rzxhl(mgs)/rzxh(mgs)
21232 & (1-il5(mgs))*chlmlr(mgs)
21253 pctot(mgs) = pccwi(mgs) +pccwd(mgs) + &
21254 & pccii(mgs) +pccid(mgs) + &
21255 & pcrwi(mgs) +pcrwd(mgs) + &
21256 & pcswi(mgs) +pcswd(mgs) + &
21257 & pchwi(mgs) +pchwd(mgs) + &
21258 & pchli(mgs) +pchld(mgs)
21297 IF ( ipconc > 5 )
THEN
21310 IF ( warmonly < 0.5 )
THEN
21315 & -min(0.0, qrcev(mgs)) &
21316 & -min(0.0, qhcev(mgs)) &
21317 & -min(0.0, qhlcev(mgs)) &
21318 & -min(0.0, qscev(mgs)) &
21320 & -qhsbv(mgs) - qhlsbv(mgs) &
21322 & -il5(mgs)*qisbv(mgs)
21325 & -max(0.0, qrcev(mgs)) &
21326 & -max(0.0, qhcev(mgs)) &
21327 & -max(0.0, qhlcev(mgs)) &
21328 & -max(0.0, qscev(mgs)) &
21329 & +il5(mgs)*(-qiint(mgs) &
21330 & -qhdpv(mgs) -qsdpv(mgs) - qhldpv(mgs)) &
21331 & -il5(mgs)*qidpv(mgs)
21335 ELSEIF ( warmonly < 0.8 )
THEN
21338 & -min(0.0, qrcev(mgs)) &
21339 & -il5(mgs)*qisbv(mgs)
21341 & +il5(mgs)*(-qiint(mgs) &
21343 & -qhdpv(mgs) - qhldpv(mgs)) &
21345 & -max(0.0, qrcev(mgs)) &
21346 & -il5(mgs)*qidpv(mgs)
21352 & -min(0.0, qrcev(mgs))
21354 & -max(0.0, qrcev(mgs))
21363 pqcwi(mgs) = (0.0) + qwcnr(mgs) - qwshw(mgs)
21365 IF ( warmonly < 0.5 )
THEN
21367 & il5(mgs)*(-qiacw(mgs)-qwfrz(mgs)-qwctfz(mgs)) &
21368 & -il5(mgs)*(qiihr(mgs)) &
21369 & -qracw(mgs) -qsacw(mgs) -qrcnw(mgs) -qhacw(mgs) - qhlacw(mgs)
21371 ELSEIF ( warmonly < 0.8 )
THEN
21373 & il5(mgs)*(-qiacw(mgs)-qwfrz(mgs)-qwctfz(mgs)) &
21374 & -il5(mgs)*(qiihr(mgs)) &
21375 & -qracw(mgs) -qrcnw(mgs) -qhacw(mgs) -qhlacw(mgs)
21378 & -qracw(mgs) - qrcnw(mgs)
21382 IF ( pqcwd(mgs) .lt. 0.0 .and. -pqcwd(mgs)*dtp .gt. qx(mgs,lc) )
THEN
21384 frac = -max(0.0,qx(mgs,lc))/(pqcwd(mgs)*dtp)
21385 pqcwd(mgs) = -qx(mgs,lc)*dtpinv
21387 qiacw(mgs) = frac*qiacw(mgs)
21390 qwfrzc(mgs) = frac*qwfrzc(mgs)
21391 qwfrz(mgs) = frac*qwfrz(mgs)
21392 qwctfzc(mgs) = frac*qwctfzc(mgs)
21393 qwctfz(mgs) = frac*qwctfz(mgs)
21394 qracw(mgs) = frac*qracw(mgs)
21395 qsacw(mgs) = frac*qsacw(mgs)
21396 qhacw(mgs) = frac*qhacw(mgs)
21397 vhacw(mgs) = frac*vhacw(mgs)
21398 qrcnw(mgs) = frac*qrcnw(mgs)
21399 qwfrzp(mgs) = frac*qwfrzp(mgs)
21400 IF ( lhl .gt. 1 )
THEN
21401 qhlacw(mgs) = frac*qhlacw(mgs)
21402 vhlacw(mgs) = frac*vhlacw(mgs)
21414 IF ( warmonly < 0.5 )
THEN
21417 IF ( ffrzs < 1.0 )
THEN
21419 & il5(mgs)*qicicnt(mgs) &
21420 & +il5(mgs)*((1.0-cwfrz2snowfrac)*qwfrzc(mgs)+qwctfzc(mgs)) &
21421 & +il5(mgs)*(qicichr(mgs)) &
21423 & +qhmul1(mgs) + qhlmul1(mgs) &
21424 & + qsplinter(mgs) + qsplinter2(mgs)
21428 pqcii(mgs) = pqcii(mgs)*(1.0 - ffrzs) &
21429 & +il5(mgs)*qidpv(mgs) &
21430 & +il5(mgs)*qiacw(mgs)
21433 & il5(mgs)*(-qscni(mgs) - qscnvi(mgs) &
21438 & +il5(mgs)*qisbv(mgs) &
21439 & +(1.-il5(mgs))*qimlr(mgs) &
21444 ELSEIF ( warmonly < 0.8 )
THEN
21448 & il5(mgs)*qicicnt(mgs)*(1. - ffrzs) &
21449 & +il5(mgs)*((1.0-cwfrz2snowfrac)*qwfrzc(mgs)+qwctfzc(mgs))*(1. - ffrzs) &
21450 & +il5(mgs)*(qicichr(mgs))*(1. - ffrzs) &
21453 & +qhmul1(mgs) + qhlmul1(mgs) &
21454 & + qsplinter(mgs) + qsplinter2(mgs) &
21455 & +il5(mgs)*qidpv(mgs) &
21456 & +il5(mgs)*qiacw(mgs)
21469 & +il5(mgs)*qisbv(mgs) &
21470 & +(1.-il5(mgs))*qimlr(mgs)
21480 IF ( warmonly < 0.5 )
THEN
21482 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs)) &
21483 & +(1-il5(mgs))*( &
21485 & -qsmlr(mgs) - qhlmlr(mgs) &
21493 & il5(mgs)*(-qiacr(mgs)-qrfrz(mgs)) &
21494 & - qsacr(mgs) - qhacr(mgs) - qhlacr(mgs) - qwcnr(mgs) &
21495 & + min(0.0,qrcev(mgs))
21496 ELSEIF ( warmonly < 0.8 )
THEN
21498 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs)) &
21499 & +(1-il5(mgs))*( &
21505 & il5(mgs)*(-qrfrz(mgs)) &
21508 & + min(0.0,qrcev(mgs))
21511 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs))
21512 pqrwd(mgs) = min(0.0,qrcev(mgs))
21517 IF ( pqrwd(mgs) .lt. 0.0 .and. -(pqrwd(mgs) + pqrwi(mgs))*dtp .gt. qx(mgs,lr) )
THEN
21519 frac = (-qx(mgs,lr) + pqrwi(mgs)*dtp)/(pqrwd(mgs)*dtp)
21522 pqwvi(mgs) = pqwvi(mgs) &
21523 & + min(0.0, qrcev(mgs)) &
21524 & - frac*min(0.0, qrcev(mgs))
21525 pqwvd(mgs) = pqwvd(mgs) &
21526 & + max(0.0, qrcev(mgs)) &
21527 & - frac*max(0.0, qrcev(mgs))
21529 qiacr(mgs) = frac*qiacr(mgs)
21530 qiacrf(mgs) = frac*qiacrf(mgs)
21531 qiacrs(mgs) = frac*qiacrs(mgs)
21532 viacrf(mgs) = frac*viacrf(mgs)
21533 qrfrz(mgs) = frac*qrfrz(mgs)
21534 qrfrzs(mgs) = frac*qrfrzs(mgs)
21535 qrfrzf(mgs) = frac*qrfrzf(mgs)
21536 vrfrzf(mgs) = frac*vrfrzf(mgs)
21537 qsacr(mgs) = frac*qsacr(mgs)
21538 qhacr(mgs) = frac*qhacr(mgs)
21539 vhacr(mgs) = frac*vhacr(mgs)
21540 qrcev(mgs) = frac*qrcev(mgs)
21541 qhlacr(mgs) = frac*qhlacr(mgs)
21542 vhlacr(mgs) = frac*vhlacr(mgs)
21543 qhcev(mgs) = frac*qhcev(mgs)
21544 qhlcev(mgs) = frac*qhlcev(mgs)
21547 IF ( warmonly < 0.5 )
THEN
21549 & il5(mgs)*(-qiacr(mgs)-qrfrz(mgs) - qsacr(mgs)) &
21550 & - qhacr(mgs) - qhlacr(mgs) - qwcnr(mgs) &
21551 & + min(0.0,qrcev(mgs))
21552 ELSEIF ( warmonly < 0.8 )
THEN
21554 & il5(mgs)*(-qrfrz(mgs)) &
21557 & + min(0.0,qrcev(mgs))
21559 pqrwd(mgs) = min(0.0,qrcev(mgs))
21565 IF ( qrcev(mgs) .ne. 0.0 )
THEN
21567 & -min(0.0, qrcev(mgs)) &
21568 & -min(0.0, qhcev(mgs)) &
21569 & -min(0.0, qhlcev(mgs)) &
21570 & -min(0.0, qscev(mgs)) &
21572 & -qhsbv(mgs) - qhlsbv(mgs) &
21574 & -il5(mgs)*qisbv(mgs)
21577 & -max(0.0, qrcev(mgs)) &
21578 & -max(0.0, qhcev(mgs)) &
21579 & -max(0.0, qhlcev(mgs)) &
21580 & -max(0.0, qscev(mgs)) &
21581 & +il5(mgs)*(-qiint(mgs) &
21582 & -qhdpv(mgs) -qsdpv(mgs) - qhldpv(mgs)) &
21583 & -il5(mgs)*qidpv(mgs)
21594 IF ( warmonly < 0.5 )
THEN
21601 & il5(mgs)*(qscni(mgs)+qsaci(mgs)+qsdpv(mgs) &
21603 & + ifrzs*(qiacrs(mgs) + qrfrzs(mgs)) &
21604 & + il5(mgs)*(( qwfrzc(mgs) + qwctfzc(mgs) + qicichr(mgs) )*ffrzs &
21605 & + (1.0 - ffrzs)*cwfrz2snowfrac*qwfrz(mgs) ) &
21606 & + il2(mgs)*qsacr(mgs)) &
21607 & + il5(mgs)*qicicnt(mgs)*ffrzs &
21608 & + il3(mgs)*(qiacrf(mgs)+qracif(mgs)) &
21609 & + max(0.0, qscev(mgs)) &
21610 & + qsacw(mgs) + qscnh(mgs) &
21611 & + ffrzs*(qsmul(mgs) &
21612 & +qhmul1(mgs) + qhlmul1(mgs) &
21613 & + qsplinter(mgs) + qsplinter2(mgs))
21616 & -qracs(mgs)*(1-il2(mgs)) -qhacs(mgs) - qhlacs(mgs) &
21618 & +(1-il5(mgs))*qsmlr(mgs) + qsshr(mgs) &
21621 & + min(0.0, qscev(mgs)) &
21625 IF ( imixedphase == 0 .and. pqswd(mgs) .lt. 0.0 )
THEN
21626 IF ( qx(mgs,ls) + dtp*(pqswi(mgs) + pqswd(mgs)) < 0.0 )
THEN
21627 frac = (-qx(mgs,ls) + pqswi(mgs)*dtp)/(pqswd(mgs)*dtp)
21629 pqswd(mgs) = frac*pqswd(mgs)
21631 qracs(mgs) = frac*qracs(mgs)
21632 qhacs(mgs) = frac*qhacs(mgs)
21633 qhlacs(mgs) = frac*qhlacs(mgs)
21634 qhcns(mgs) = frac*qhcns(mgs)
21635 qsmlr(mgs) = frac*qsmlr(mgs)
21636 qsshr(mgs) = frac*qsshr(mgs)
21637 qssbv(mgs) = frac*qssbv(mgs)
21638 qsmul(mgs) = frac*qsmul(mgs)
21639 IF ( qscev(mgs) < 0.0 ) qscev(mgs) = frac*qscev(mgs)
21644 pqcii(mgs) = pqcii(mgs) &
21645 & + (1. - ifrzs)*qrfrzs(mgs) &
21646 & + (1. - ifrzs)*qiacrs(mgs)
21655 & +il5(mgs)*(ffrzh*ifrzg*qrfrzf(mgs) + (1-il3(mgs))*ffrzh*ifiacrg*(qiacrf(mgs)+qracif(mgs))) &
21656 & + (1-il2(mgs))*(qracs(mgs) + qsacr(mgs)) &
21657 & +il5(mgs)*(qhdpv(mgs)) &
21658 & +max(0.0, qhcev(mgs)) &
21659 & +qhacr(mgs)+qhacw(mgs) &
21660 & +qhacs(mgs)+qhaci(mgs) &
21661 & + f2h*qhcns(mgs) + f2h*qhcni(mgs) + qhcnhl(mgs)
21664 & +(1-il5(mgs))*qhmlr(mgs) &
21667 & + min(0.0, qhcev(mgs)) &
21668 & -qhmul1(mgs) - qhlcnh(mgs) - qscnh(mgs) &
21669 & - ffrzh*(qsplinter(mgs) + qsplinter2(mgs))
21678 IF ( lhl .gt. 1 )
THEN
21682 & +il5(mgs)*(qhldpv(mgs) + ((1.0-ifrzg)*qrfrzf(mgs) + (1.0-ifiacrg)*(qiacrf(mgs)+ qracif(mgs)))) &
21683 & +max(0.0, qhlcev(mgs)) &
21684 & +qhlacr(mgs)+qhlacw(mgs) &
21685 & +qhlacs(mgs)+qhlaci(mgs) &
21689 & +(1-il5(mgs))*qhlmlr(mgs) &
21692 & + min(0.0, qhlcev(mgs)) &
21693 & -qhlmul1(mgs) - qhcnhl(mgs)
21695 IF ( imixedphase == 0 )
THEN
21697 IF ( qx(mgs,lhl) + dtp*(pqhli(mgs) + pqhld(mgs)) < 0.0 )
THEN
21700 frac = (-qx(mgs,lhl) + pqhli(mgs)*dtp)/(pqhld(mgs)*dtp)
21702 qhlmlr(mgs) = frac*qhlmlr(mgs)
21703 qhlsbv(mgs) = frac*qhlsbv(mgs)
21704 qhcnhl(mgs) = frac*qhcnhl(mgs)
21705 qhlmul1(mgs) = frac*qhlmul1(mgs)
21706 IF ( qhlcev(mgs) < 0.0 ) qhlcev(mgs) = frac*qhlcev(mgs)
21708 pqhld(mgs) = frac*pqhld(mgs)
21718 ELSEIF ( warmonly < 0.8 )
THEN
21724 & +il5(mgs)*ifrzg*(qrfrzf(mgs) ) &
21725 & +il5(mgs)*(qhdpv(mgs)) &
21726 & +qhacr(mgs)+qhacw(mgs)
21731 & - qsplinter(mgs) - qsplinter2(mgs) &
21732 & +(1-il5(mgs))*qhmlr(mgs)
21738 IF ( lhl .gt. 1 )
THEN
21742 & +il5(mgs)*(qhldpv(mgs) ) &
21743 & +il5(mgs)*(1.0-ifrzg)*(qrfrzf(mgs) ) &
21744 & +qhlacr(mgs)+qhlacw(mgs) &
21749 & +(1-il5(mgs))*qhlmlr(mgs) &
21752 & -qhlmul1(mgs) - qhcnhl(mgs)
21769 IF ( mixedphase )
THEN
21773 vhmlr(:) = qhmlr(:)
21777 vhlmlr(:) = qhlmlr(:)
21788 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'graupel reflectivity'
21798 IF ( ffrzh > 0.0 )
THEN
21810 IF ( lzh .gt. 1 )
THEN
21814 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) .gt. 0.0 )
THEN
21815 tmp = qx(mgs,lh)/cx(mgs,lh)
21816 alp = max( alphamin, alpha(mgs,lh) )
21821 zhaci(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhaci(mgs) )
21822 zhacs(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhacs(mgs) )
21824 IF ( .not. mixedphase .and. ibinhmlr < 1 )
THEN
21825 zhmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs) )
21828 zhshr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs) )
21831 IF ( lzr > 0 .and. qhshr(mgs) /= 0.0 .and. chshrr(mgs) /= 0.0 )
THEN
21843 IF ( temg(mgs) >= tfr )
THEN
21848 IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam )
THEN
21849 z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
21851 z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
21857 zhshrr(mgs) = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
21860 zhshrr(mgs) = min( 0.0, zhshrr(mgs) )
21863 IF ( zhshr(mgs) > 0.0 )
THEN
21864 write(0,*)
'Problem with zhshr! zhshr,qhshr,chshr = ',zhshr(mgs),qhshr(mgs),chshr(mgs)
21865 write(0,*)
'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lh),cx(mgs,lh),zx(mgs,lh)
21866 write(0,*) ( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs) ), 2.*tmp * qhshr(mgs), - tmp**2 * chshr(mgs)
21867 write(0,*)
'temcg = ',temcg(mgs),
'chshr recalc = ',(cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhshr(mgs)
21875 qtmp = qhdpv(mgs) + qhcev(mgs) + qhsbv(mgs)
21876 ctmp = chdpv(mgs) + chcev(mgs) + chsbv(mgs)
21878 zhdsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
21880 alp = max( alphahacx, alpha(mgs,lh) )
21885 IF ( qhacr(mgs) .gt. 0.0 )
THEN
21890 zhacr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacr(mgs) )
21896 IF ( z > zx(mgs,lh) )
THEN
21909 IF ( qhacw(mgs) .gt. 0.0 )
THEN
21911 zhacw(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacw(mgs) )
21914 IF ( z > zx(mgs,lh) )
THEN
21921 IF ( qhacw(mgs) .gt. 0.0 .or. qhacr(mgs) .gt. 0.0 )
THEN
21922 z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lh)+dtp*(qhacr(mgs) + qhacw(mgs)-qhmul1(mgs)))**2)/(cx(mgs,lh))
21924 IF ( z > zx(mgs,lh) )
THEN
21925 zhacw(mgs) = (z - zx(mgs,lh))*dtpinv
21931 IF ( qhlcnh(mgs) .gt. 0.0 .and. ihlcnh < 2 )
THEN
21932 zhlcnh(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhlcnh(mgs) - tmp**2 * chlcnh(mgs) )
21936 IF ( ffrzh*qiacrf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr) )
THEN
21937 tmp = qx(mgs,lr)/cx(mgs,lr)
21940 IF ( imurain == 3 )
THEN
21942 ziacr(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.))* &
21943 & ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs) )
21945 ziacr(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2)* &
21946 & ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs) )
21948 ziacr(mgs) = min( ziacr(mgs), zxmxd(mgs,lr) )
21950 ziacrf(mgs) = (xdn(mgs,lr)/xdnmx(lh))**2 * ziacr(mgs)
21957 IF ( ffrzh*qrfrzf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 )
THEN
21958 tmp = qx(mgs,lr)/cx(mgs,lr)
21961 IF ( imurain == 3 )
THEN
21962 zrfrz(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.)) * &
21963 & ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs) )
21964 zrfrzf(mgs) = (xdn(mgs,lr)/xdn(mgs,lh))**2 * zrfrz(mgs)
21965 ELSEIF ( imurain == 1 .and. ibiggopt /= 2 )
THEN
21968 zrfrz(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2) * &
21969 & ( 2.*tmp * qrfrz(mgs) - tmp**2 * crfrz(mgs) )
21970 zrfrzf(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(rhofrz**2) * &
21971 & ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs) )
21973 zrfrz(mgs) = min( zrfrz(mgs), max(0.4,qrfrz(mgs)/qx(mgs,lr))*zx(mgs,lr)*dtpinv )
21981 IF ( lhl > 1 .and. qhcnhl(mgs) .gt. 0.0 )
THEN
21982 tmp = qx(mgs,lhl)/cx(mgs,lhl)
21983 zhcnhl(mgs) = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhcnhl(mgs) - tmp**2 * chcnhl(mgs) )
21987 IF ( qhcns(mgs) > 0.0 .and. chcns(mgs) > 0.0 .and. cx(mgs,ls) > cxmin .and. vhcns(mgs) > 0 )
THEN
21988 tmp = qx(mgs,ls)/cx(mgs,ls)
21989 r = rho0(mgs)*qhcns(mgs)/vhcns(mgs)
21990 IF ( imusnow == 3 )
THEN
21991 zhcns(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,ls)+2.)/(r**2*(alpha(mgs,ls)+1.)) * &
21992 & ( 2.*tmp * qhcns(mgs) - tmp**2 * chcns(mgs) )
21994 write(0,*)
'Value of imusnow not valid. Must be 3 (fix me for =1). imusnow = ',imusnow
21999 IF ( qhcni(mgs) > 0.0 .and. chcni(mgs) > 0.0 .and. cx(mgs,li) > cxmin .and. vhcni(mgs) > 0 )
THEN
22000 tmp = qx(mgs,li)/cx(mgs,li)
22001 r = rho0(mgs)*qhcni(mgs)/vhcni(mgs)
22002 zhcni(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,li)+2.)/(r**2*(alpha(mgs,li)+1.)) * &
22003 & ( 2.*tmp * qhcni(mgs) - tmp**2 * chcni(mgs) )
22008 & +ifrzg*ffrzh*(zrfrzf(mgs) &
22009 & +il5(mgs)*ifiacrg*(ziacrf(mgs) ) ) &
22016 & + f2h*zhcni(mgs) + f2h*zhcns(mgs) &
22017 & + max( 0.0, zhdsv(mgs) )
22020 & + (1-il5(mgs))*zhmlr(mgs) &
22022 & + min( 0.0, zhdsv(mgs) ) &
22023 & - il5(mgs)*zhlcnh(mgs)
22026 IF ( igs(mgs) == 44 .and. kgs(mgs) == 23 .or. dtp*( pqhwi(mgs) + pqhwd(mgs) ) > qxmin(lh) )
THEN
22043 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'end graupel reflectivity'
22059 IF ( lzhl .gt. 1 .or. ( lzr > 1 .and. lnhl > 1 ) )
THEN
22061 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'hail reflectivity'
22065 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) .gt. 0.0 )
THEN
22066 tmp = qx(mgs,lhl)/cx(mgs,lhl)
22067 alp = max( alphamin, alpha(mgs,lhl) )
22071 IF ( .not. mixedphase .and. qhlmlr(mgs) /= 0.0 .and. chlmlr(mgs) /= 0.0 .and. ibinhlmlr < 1 )
THEN
22072 zhlmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlmlr(mgs) - tmp**2 * chlmlr(mgs) )
22075 zhlshr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs) )
22076 IF ( lzr > 1 .and. qhlshr(mgs) /= 0.0 .and. chlshrr(mgs) /= 0.0 )
THEN
22077 IF ( temg(mgs) >= tfr )
THEN
22082 IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam )
THEN
22083 z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
22085 z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
22091 zhlshrr(mgs) = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
22094 zhlshrr(mgs) = min( 0.0, zhlshrr(mgs) )
22097 IF ( zhlshr(mgs) > 0.0 )
THEN
22098 write(0,*)
'Problem with zhlshr! zhlshr,qhlshr,chlshr = ',zhlshr(mgs),qhlshr(mgs),chlshr(mgs)
22099 write(0,*)
'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lhl),cx(mgs,lhl),zx(mgs,lhl)
22100 write(0,*) ( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs) ), 2.*tmp * qhlshr(mgs), - tmp**2 * chlshr(mgs)
22101 write(0,*)
'temcg = ',temcg(mgs),
'chlshr recalc = ',(cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlshr(mgs)
22109 qtmp = qhldpv(mgs) + qhlcev(mgs)
22110 ctmp = chldpv(mgs) + chlcev(mgs)
22112 zhldsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
22114 alp = max( alphahacx, alpha(mgs,lhl) )
22119 IF ( qhlacr(mgs) .gt. 0.0 )
THEN
22121 zhlacr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhlacr(mgs) )
22134 IF ( qhlacw(mgs) .gt. 0.0 )
THEN
22135 alp = max( 3.0, alpha(mgs,lhl)+1. )
22136 g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
22140 zhlacw(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlacw(mgs) )
22150 IF ( qhlacw(mgs) .gt. 0.0 .or. qhlacr(mgs) .gt. 0.0 )
THEN
22151 z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lhl)+dtp*(qhlacr(mgs) + qhlacw(mgs)-qhlmul1(mgs)))**2)/(cx(mgs,lhl))
22153 IF ( z > zx(mgs,lhl) )
THEN
22154 zhlacw(mgs) = (z - zx(mgs,lhl))*dtpinv
22163 IF ( lzhl > 1 )
THEN
22164 pzhli(mgs) = ffrzh*(((1.0-ifrzg)*zrfrzf(mgs) &
22165 & +il5(mgs)*(1.0-ifiacrg)*ziacrf(mgs) )) &
22166 & + il5(mgs)*zhlcnh(mgs) &
22170 & + max( 0.0, zhldsv(mgs) )
22173 & + (1-il5(mgs))*zhlmlr(mgs) &
22176 & + min( 0.0, zhldsv(mgs) )
22179 IF ( .not. ( -1.0 < pzhli(mgs) .and. pzhli(mgs) < 1.e20 ) )
THEN
22180 write(iunit,*)
'Problem with pzhli!'
22181 write(iunit,*)
'zhlcnh,zhlacw,zhlacr,zhldsv = ',zhlcnh(mgs),zhlacw(mgs),zhlacr(mgs),zhldsv(mgs)
22184 IF ( .not. ( -1.0e20 < pzhld(mgs) .and. pzhld(mgs) < 1. ) )
THEN
22185 write(iunit,*)
'Problem with pzhld!'
22186 write(iunit,*)
'zhlmlr,zhlshr,zhldsv = ',zhlmlr(mgs),zhlshr(mgs),zhldsv(mgs)
22198 if (ndebug .gt. 0 )
write(0,*)
'WARMZIEG: dbg = 11'
22200 IF ( lzr .gt. 1 )
THEN
22214 IF ( qx(mgs,ls) .gt. qxmin(ls) .and. ( csmlr(mgs) /= 0.0 .or. csshr(mgs) /= 0.0 .or. &
22215 csmlrr(mgs) /= 0.0 .or. csshrr(mgs) /= 0.0) )
THEN
22216 tmp = qx(mgs,ls)/cx(mgs,ls)
22217 g1 = 36.*(xnu(ls)+2.0)/((xnu(ls)+1.0)*pi**2)
22218 IF ( .not. mixedphase )
THEN
22222 IF ( csmlrr(mgs) /= 0.0 )
THEN
22223 z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsmlr(mgs)**2/ csmlrr(mgs) )
22231 IF ( csshrr(mgs) /= 0.0 )
THEN
22232 z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsshr(mgs)**2/ csshrr(mgs) )
22238 IF ( .not. mixedphase )
THEN
22239 IF ( zhmlr(mgs) < 0.0 .and. chmlrr(mgs) /= 0.0 .and. ibinhmlr == 0 )
THEN
22240 tmp = qx(mgs,lh)/cx(mgs,lh)
22247 IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam )
THEN
22248 z1 = g1x(mgs,lh)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs) )
22250 z1 = min(g1x(mgs,lh),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs) )
22260 IF ( lhl > 1 .and. qhlmlr(mgs) /= 0 .and. ibinhlmlr == 0)
THEN
22261 tmp = qx(mgs,lhl)/cx(mgs,lhl)
22269 IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam )
THEN
22270 z1 = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs) )
22272 z1 = min(g1x(mgs,lhl),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs) )
22285 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) .gt. 0.0 )
THEN
22287 tmp = qx(mgs,lr)/cx(mgs,lr)
22291 IF ( qracw(mgs) > 0.0 .and. cx(mgs,lr) > 0.0 )
THEN
22292 zracw(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*tmp * qracw(mgs) )
22295 IF ( cracr(mgs) > 0.0 .and. cx(mgs,lr) > 0.0 )
THEN
22296 zracr(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( tmp**2 * cracr(mgs) )
22305 zrcev(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
22308 IF ( iferwisventr == 2 )
THEN
22309 vent1 = min(0.0, (12./(pii*xdn(mgs,lr)))*xdia(mgs,lr,1)**3*fvce(mgs)*rwcap(mgs)*rwventz(mgs))
22310 zrcev(mgs) = max( zrcev(mgs), vent1 )
22318 zrcev(mgs) = max( zrcev(mgs), -zxmxd(mgs,lr) )
22320 IF ( qhacr(mgs) > 0.0 )
THEN
22321 zrach(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
22322 & ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhacr(mgs) - tmp**2 * chacr(mgs) )
22323 zrach(mgs) = min( zrach(mgs), zxmxd(mgs,lr) )
22327 IF ( lhl > 1 .and. qhlacr(mgs) > 0.0 )
THEN
22328 zrachl(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
22329 & ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhlacr(mgs) - tmp**2 * chlacr(mgs) )
22330 zrachl(mgs) = min( zrachl(mgs), zxmxd(mgs,lr) )
22337 pzrwi(mgs) = zrcnw(mgs) + zracw(mgs) + zracr(mgs) &
22338 & + max( 0.,zrcev(mgs) ) &
22339 & - (1-il5(mgs))*zsmlrr(mgs) &
22341 & - (1-il5(mgs))*zhmlrr(mgs) &
22343 & - (1-il5(mgs))*zhlmlrr(mgs) &
22348 & + min(0.,zrcev(mgs) ) &
22352 & - il5(mgs)*(ziacr(mgs) )
22355 IF ( zx(mgs,lr) + dtp*(pzrwi(mgs)+pzrwd(mgs)) <= 0.0 &
22356 .and. qx(mgs,lr) > qxmin(lr) )
THEN
22357 pzrwd(mgs) = -zx(mgs,lr)*dtpinv - pzrwi(mgs)
22369 IF ( lvol(ls) .gt. 1 )
THEN
22373 pvswi(mgs) = rho0(mgs)*( &
22376 & +il5(mgs)*(qscni(mgs)+qsaci(mgs)+qsdpv(mgs) &
22377 & + qscnvi(mgs) + (1. - ifrzs)*qiacrs(mgs) &
22378 & + (1. - ifrzs)*qrfrzs(mgs) &
22380 & + (qsacr(mgs))/rimdn(mgs,ls) ) + vsacw(mgs)
22382 pvswd(mgs) = rho0(mgs)*( pqswd(mgs) )/xdn0(ls) &
22387 & -rho0(mgs)*qsmul(mgs)/xdn0(ls)
22402 IF ( lvol(lh) .gt. 1 )
THEN
22409 pvhwi(mgs) = rho0(mgs)*( &
22410 & +il5(mgs)*( ifiacrg*ffrzh*qracif(mgs))/rhofrz &
22412 & + ( il5(mgs)*qhdpv(mgs)/qhdpvdn &
22413 & + (qhacs(mgs) + qhaci(mgs))/qhacidn ) ) &
22414 & + rho0(mgs)*max(0.0, qhcev(mgs))/1000. &
22416 & + f2h*vhcns(mgs) &
22417 & + vhacr(mgs) + vhacw(mgs) + vhfzh(mgs) &
22419 & + f2h*vhcni(mgs) + (ifiacrg*viacrf(mgs) + ifrzg*vrfrzf(mgs))*ffrzh
22424 pvhwd(mgs) = rho0(mgs)*( &
22427 & +( (1-il5(mgs))*vhmlr(mgs) &
22430 & + min(0.0, qhcev(mgs)) &
22431 & -qhmul1(mgs) )/xdn(mgs,lh) ) &
22432 & - vhlcnh(mgs) + vhshdr(mgs) - vhsoak(mgs) - vscnh(mgs)
22439 IF ( lzh > 1 .and. qx(mgs,lh) > qxmin(lh) )
THEN
22442 xdn_new = rho0(mgs)*(qx(mgs,lh) + dtp*(pqhwi(mgs) + pqhwd(mgs) ))/ &
22443 & (vx(mgs,lh) + dtp*(pvhwi(mgs) + pvhwd(mgs)) )
22445 IF ( mixedphase )
THEN
22446 IF ( qxw(mgs,lh) .gt. 0.0 )
THEN
22455 xdn_new = max( min( xdn_new, dnmx ), xdnmn(lh) )
22457 drhodt = (xdn_new - xdn(mgs,lh))*dtpinv
22459 zhwdn(mgs) = -2.*g1x(mgs,lh)*(rho0(mgs)*qx(mgs,lh)*6.*pii )**2/(cx(mgs,lh)*xdn(mgs,lh)**3)*drhodt
22461 pzhwi(mgs) = pzhwi(mgs) + max(0.0, zhwdn(mgs))
22462 pzhwd(mgs) = pzhwd(mgs) + min(0.0, zhwdn(mgs))
22466 IF ( .false. .and. ny .eq. 2 .and. kgs(mgs) .eq. 9 .and. igs(mgs) .eq. 19 )
THEN
22469 write(iunit,*)
'Graupel at ',igs(mgs),kgs(mgs)
22471 write(iunit,*) il5(mgs)*qrfrzf(mgs), qrfrzf(mgs) - qrfrz(mgs)
22472 write(iunit,*) il5(mgs)*qiacrf(mgs)
22473 write(iunit,*) il5(mgs)*qracif(mgs)
22474 write(iunit,*)
'qhcns',qhcns(mgs)
22475 write(iunit,*)
'qhcni',qhcni(mgs)
22476 write(iunit,*) il5(mgs)*(qhdpv(mgs))
22477 write(iunit,*)
'qhacr ',qhacr(mgs)
22478 write(iunit,*)
'qhacw', qhacw(mgs)
22479 write(iunit,*)
'qhacs', qhacs(mgs)
22480 write(iunit,*)
'qhaci', qhaci(mgs)
22481 write(iunit,*)
'pqhwi = ',pqhwi(mgs)
22483 write(iunit,*)
'qhcev',qhcev(mgs)
22485 write(iunit,*)
'qhshr',qhshr(mgs)
22486 write(iunit,*)
'qhmlr', (1-il5(mgs))*qhmlr(mgs)
22487 write(iunit,*)
'qhsbv', qhsbv(mgs)
22488 write(iunit,*)
'qhlcnh',-qhlcnh(mgs)
22489 write(iunit,*)
'qhmul1',-qhmul1(mgs)
22490 write(iunit,*)
'pqhwd = ', pqhwd(mgs)
22492 write(iunit,*)
'Volume'
22494 write(iunit,*)
'pvhwi',pvhwi(mgs)
22495 write(iunit,*)
'vhcns', vhcns(mgs)
22496 write(iunit,*)
'vhacr,vhacw',vhacr(mgs), vhacw(mgs)
22497 write(iunit,*)
'vhcni',vhcni(mgs)
22499 write(iunit,*)
'pvhwd',pvhwd(mgs)
22500 write(iunit,*)
'vhlcnh,vhshdr,vhsoak ', vhlcnh(mgs), vhshdr(mgs), vhsoak(mgs)
22501 write(iunit,*)
'vhmlr', vhmlr(mgs)
22506 write(iunit,*)
'Concentration'
22507 write(iunit,*) pchwi(mgs),pchwd(mgs)
22508 write(iunit,*) crfrzf(mgs)
22509 write(iunit,*) chcns(mgs)
22510 write(iunit,*) ciacrf(mgs)
22526 IF ( lhl .gt. 1 )
THEN
22527 IF ( lvol(lhl) .gt. 1 )
THEN
22530 pvhli(mgs) = rho0(mgs)*( &
22531 & + ( il5(mgs)*(((1.0-ifiacrg)*ffrzh*qracif(mgs))/rhofrz + qhldpv(mgs) ) &
22535 & + qhlacs(mgs) + qhlaci(mgs) )/500. ) &
22536 & + rho0(mgs)*max(0.0, qhlcev(mgs))/1000. &
22537 & + vhlcnhl(mgs) + ((1.0-ifiacrg)*ffrzh*viacrf(mgs) + (1.0-ifrzg)*ffrzh*vrfrzf(mgs)) &
22538 & + vhlacr(mgs) + vhlacw(mgs) + vhlfzhl(mgs)
22540 pvhld(mgs) = rho0(mgs)*( &
22542 & + min(0.0, qhlcev(mgs)) &
22543 & -qhlmul1(mgs) )/xdn(mgs,lhl) ) &
22545 & + rho0(mgs)*(1-il5(mgs))*vhlmlr(mgs)/xdn(mgs,lhl) &
22546 & + vhlshdr(mgs) - vhlsoak(mgs)
22548 IF ( lzhl > 1 .and. qx(mgs,lhl) > qxmin(lhl) )
THEN
22551 xdn_new = rho0(mgs)*(qx(mgs,lhl) + dtp*(pqhli(mgs) + pqhld(mgs) ))/ &
22552 & (vx(mgs,lhl) + dtp*(pvhli(mgs) + pvhld(mgs)) )
22554 IF ( mixedphase )
THEN
22555 IF ( qxw(mgs,lhl) .gt. 0.0 )
THEN
22563 xdn_new = max( min( xdn_new, dnmx ), xdnmn(lhl) )
22565 drhodt = (xdn_new - xdn(mgs,lhl))*dtpinv
22567 zhldn(mgs) = -2.*g1x(mgs,lhl)*(rho0(mgs)*qx(mgs,lhl)*6.*pii )**2/(cx(mgs,lhl)*xdn(mgs,lhl)**3)*drhodt
22569 pzhli(mgs) = pzhli(mgs) + max(0.0, zhldn(mgs))
22570 pzhld(mgs) = pzhld(mgs) + min(0.0, zhldn(mgs))
22581 if ( ndebug .ge. 1 )
then
22585 ptotal(mgs) = ptotal(mgs) &
22586 & + pqwvi(mgs) + pqwvd(mgs) &
22587 & + pqcwi(mgs) + pqcwd(mgs) &
22588 & + pqcii(mgs) + pqcid(mgs) &
22589 & + pqrwi(mgs) + pqrwd(mgs) &
22590 & + pqswi(mgs) + pqswd(mgs) &
22591 & + pqhwi(mgs) + pqhwd(mgs) &
22592 & + pqhli(mgs) + pqhld(mgs)
22601 if ( ( (ndebug .ge. 0 ) .and. abs(ptotal(mgs)) .gt. eqtot ) &
22608 & .or. .not. (ptotal(mgs) .lt. 1.0 .and. ptotal(mgs) .gt. -1.0) &
22610 write(iunit,*)
'YIKES! ',
'ptotal1',mgs,igs(mgs),jgs, &
22611 & kgs(mgs),ptotal(mgs)
22613 write(iunit,*)
't7: ', t7(igs(mgs),jgs,kgs(mgs))
22614 write(iunit,*)
'cci,ccw,crw,rdia: ',cx(mgs,li),cx(mgs,lc),cx(mgs,lr),0.5*xdia(mgs,lr,1)
22615 write(iunit,*)
'qc,qi,qr : ',qx(mgs,lc),qx(mgs,li),qx(mgs,lr)
22616 write(iunit,*)
'rmas, qrcalc : ',xmas(mgs,lr),xmas(mgs,lr)*cx(mgs,lr)/rho0(mgs)
22617 write(iunit,*)
'vti,vtc,eiw,vtr: ',vtxbar(mgs,li,1),vtxbar(mgs,lc,1),eiw(mgs),vtxbar(mgs,lr,1)
22618 write(iunit,*)
'cidia,cwdia,qcmxd: ', xdia(mgs,li,1),xdia(mgs,lc,1),qcmxd(mgs)
22619 write(iunit,*)
'snow: ',qx(mgs,ls),cx(mgs,ls),swvent(mgs),vtxbar(mgs,ls,1),xdia(mgs,ls,1)
22620 write(iunit,*)
'graupel: ',qx(mgs,lh),cx(mgs,lh),hwvent(mgs),vtxbar(mgs,lh,1),xdia(mgs,lh,1)
22621 IF ( lhl .gt. 1 )
write(iunit,*)
'hail: ',qx(mgs,lhl),cx(mgs,lhl),hlvent(mgs),vtxbar(mgs,lhl,1),xdia(mgs,lhl,1)
22624 write(iunit,*)
'li: ',xdia(mgs,li,1),xdia(mgs,li,2),xmas(mgs,li),qx(mgs,li), &
22628 write(iunit,*)
'rain cx,xv : ',cx(mgs,lr),xv(mgs,lr)
22629 write(iunit,*)
'temcg = ', temcg(mgs)
22631 write(iunit,*)
'v ', pqwvi(mgs) ,pqwvd(mgs)
22632 write(iunit,*)
'c ', pqcwi(mgs) ,pqcwd(mgs)
22633 write(iunit,*)
'ci', pqcii(mgs) ,pqcid(mgs)
22634 write(iunit,*)
'r ', pqrwi(mgs) ,pqrwd(mgs)
22635 write(iunit,*)
's ', pqswi(mgs) ,pqswd(mgs)
22636 write(iunit,*)
'h ', pqhwi(mgs) ,pqhwd(mgs)
22637 write(iunit,*)
'hl', pqhli(mgs) ,pqhld(mgs)
22638 tmp = pqwvi(mgs) + pqwvd(mgs) &
22639 & + pqcwi(mgs) + pqcwd(mgs) &
22640 & + pqcii(mgs) + pqcid(mgs) &
22641 & + pqrwi(mgs) + pqrwd(mgs) &
22642 & + pqswi(mgs) + pqswd(mgs) &
22643 & + pqhwi(mgs) + pqhwd(mgs) &
22644 & + pqhli(mgs) + pqhld(mgs)
22646 write(iunit,*)
'total = ',tmp
22647 write(iunit,*)
'END OF OUTPUT OF SOURCE AND SINK'
22653 write(iunit,*)
'Vapor'
22655 write(iunit,*) -min(0.0,qrcev(mgs))
22656 write(iunit,*) -il5(mgs)*qhsbv(mgs)
22657 write(iunit,*) -il5(mgs)*qhlsbv(mgs)
22658 write(iunit,*) -il5(mgs)*qssbv(mgs)
22659 write(iunit,*) -il5(mgs)*qisbv(mgs)
22660 write(iunit,*)
'pqwvi= ', pqwvi(mgs)
22661 write(iunit,*) -max(0.0,qrcev(mgs))
22662 write(iunit,*) -max(0.0,qhcev(mgs))
22663 write(iunit,*) -max(0.0,qhlcev(mgs))
22664 write(iunit,*) -max(0.0,qscev(mgs))
22665 write(iunit,*) -il5(mgs)*qiint(mgs)
22666 write(iunit,*) -il5(mgs)*qhdpv(mgs)
22667 write(iunit,*) -il5(mgs)*qhldpv(mgs)
22668 write(iunit,*) -il5(mgs)*qsdpv(mgs)
22669 write(iunit,*) -il5(mgs)*qidpv(mgs)
22670 write(iunit,*)
'pqwvd = ', pqwvd(mgs)
22673 write(iunit,*)
'Cloud ice'
22675 write(iunit,*) il5(mgs)*qicicnt(mgs)
22676 write(iunit,*) il5(mgs)*qidpv(mgs)
22677 write(iunit,*) il5(mgs)*qiacw(mgs)
22678 write(iunit,*) il5(mgs)*qwfrzc(mgs)
22679 write(iunit,*) il5(mgs)*qwctfzc(mgs)
22680 write(iunit,*) il5(mgs)*qicichr(mgs)
22681 write(iunit,*) qhmul1(mgs)
22682 write(iunit,*) qhlmul1(mgs)
22683 write(iunit,*)
'pqcii = ', pqcii(mgs)
22684 write(iunit,*) -il5(mgs)*qscni(mgs)
22685 write(iunit,*) -il5(mgs)*qscnvi(mgs)
22686 write(iunit,*) -il5(mgs)*qraci(mgs)
22687 write(iunit,*) -il5(mgs)*qsaci(mgs)
22688 write(iunit,*) -il5(mgs)*qhaci(mgs)
22689 write(iunit,*) -il5(mgs)*qhlaci(mgs)
22690 write(iunit,*) il5(mgs)*qisbv(mgs)
22691 write(iunit,*) (1.-il5(mgs))*qimlr(mgs)
22692 write(iunit,*) -il5(mgs)*qhcni(mgs)
22693 write(iunit,*)
'pqcid = ', pqcid(mgs)
22694 write(iunit,*)
' Conc:'
22695 write(iunit,*) pccii(mgs),pccid(mgs)
22696 write(iunit,*) il5(mgs),cicint(mgs)
22697 write(iunit,*) cwfrzc(mgs),cwctfzc(mgs)
22698 write(iunit,*) cicichr(mgs)
22699 write(iunit,*) chmul1(mgs)
22700 write(iunit,*) chlmul1(mgs)
22701 write(iunit,*) csmul(mgs)
22707 write(iunit,*)
'Cloud water'
22709 write(iunit,*)
'pqcwi =', pqcwi(mgs)
22710 write(iunit,*) -il5(mgs)*qiacw(mgs)
22711 write(iunit,*) -il5(mgs)*qwfrzc(mgs)
22712 write(iunit,*) -il5(mgs)*qwctfzc(mgs)
22715 write(iunit,*) -il5(mgs)*qiihr(mgs)
22716 write(iunit,*) -il5(mgs)*qicichr(mgs)
22717 write(iunit,*) -il5(mgs)*qipiphr(mgs)
22718 write(iunit,*) -qracw(mgs)
22719 write(iunit,*) -qsacw(mgs)
22720 write(iunit,*) -qrcnw(mgs)
22721 write(iunit,*) -qhacw(mgs)
22722 write(iunit,*) -qhlacw(mgs)
22723 write(iunit,*)
'pqcwd = ', pqcwd(mgs)
22727 write(iunit,*)
'Concentration:'
22728 write(iunit,*) -cautn(mgs)
22729 write(iunit,*) -cracw(mgs)
22730 write(iunit,*) -csacw(mgs)
22731 write(iunit,*) -chacw(mgs)
22732 write(iunit,*) -ciacw(mgs)
22733 write(iunit,*) -cwfrzp(mgs)
22734 write(iunit,*) -cwctfzp(mgs)
22735 write(iunit,*) -cwfrzc(mgs)
22736 write(iunit,*) -cwctfzc(mgs)
22737 write(iunit,*) pccwd(mgs)
22740 write(iunit,*)
'Rain '
22742 write(iunit,*) qracw(mgs)
22743 write(iunit,*) qrcnw(mgs)
22744 write(iunit,*) max(0.0, qrcev(mgs))
22745 write(iunit,*) -(1-il5(mgs))*qhmlr(mgs)
22746 write(iunit,*) -(1-il5(mgs))*qhlmlr(mgs)
22747 write(iunit,*) -(1-il5(mgs))*qsmlr(mgs)
22748 write(iunit,*) -(1-il5(mgs))*qimlr(mgs)
22749 write(iunit,*) -qrshr(mgs)
22750 write(iunit,*)
'pqrwi = ', pqrwi(mgs)
22751 write(iunit,*) -qsshr(mgs)
22752 write(iunit,*) -qhshr(mgs)
22753 write(iunit,*) -qhlshr(mgs)
22754 write(iunit,*) -il5(mgs)*qiacr(mgs),qiacr(mgs), qiacrf(mgs)
22755 write(iunit,*) -il5(mgs)*qrfrz(mgs)
22756 write(iunit,*) -qsacr(mgs)
22757 write(iunit,*) -qhacr(mgs)
22758 write(iunit,*) -qhlacr(mgs)
22759 write(iunit,*) qrcev(mgs)
22760 write(iunit,*)
'pqrwd = ', pqrwd(mgs)
22761 write(iunit,*)
'qrzfac = ', qrzfac(mgs)
22765 write(iunit,*)
'Rain concentration'
22766 write(iunit,*) pcrwi(mgs)
22767 write(iunit,*) crcnw(mgs)
22768 write(iunit,*) 1-il5(mgs)
22769 write(iunit,*) -chmlr(mgs),-csmlr(mgs)
22770 write(iunit,*) -crshr(mgs)
22771 write(iunit,*) pcrwd(mgs)
22772 write(iunit,*) il5(mgs)
22773 write(iunit,*) -ciacr(mgs),-crfrz(mgs)
22774 write(iunit,*) -csacr(mgs),-chacr(mgs)
22775 write(iunit,*) +crcev(mgs)
22776 write(iunit,*) cracr(mgs)
22781 write(iunit,*)
'Snow'
22783 write(iunit,*) il5(mgs)*qscni(mgs), qscnvi(mgs)
22784 write(iunit,*) il5(mgs)*qsaci(mgs)
22785 write(iunit,*) il5(mgs)*qrfrzs(mgs)
22786 write(iunit,*) il5(mgs)*qiacrs(mgs),il3(mgs)*(qiacrf(mgs)+qracif(mgs)),il3(mgs),qiacrf(mgs),qracif(mgs)
22787 write(iunit,*) il5(mgs)*qsdpv(mgs), qscev(mgs)
22788 write(iunit,*) qsacw(mgs)
22789 write(iunit,*) qsacr(mgs), qscnh(mgs)
22790 write(iunit,*)
'pqswi = ',pqswi(mgs)
22791 write(iunit,*) -qhcns(mgs)
22792 write(iunit,*) -qracs(mgs)
22793 write(iunit,*) -qhacs(mgs)
22794 write(iunit,*) -qhlacs(mgs)
22795 write(iunit,*) (1-il5(mgs))*qsmlr(mgs)
22796 write(iunit,*) qsshr(mgs)
22798 write(iunit,*) il5(mgs)*(qssbv(mgs))
22799 write(iunit,*)
'pqswd = ', pqswd(mgs)
22800 write(iunit,*) -qracs(mgs)*(1-il2(mgs)) , qhacs(mgs) , qhlacs(mgs)
22801 write(iunit,*) -qhcns(mgs)
22802 write(iunit,*) +(1-il5(mgs))*qsmlr(mgs) , qsshr(mgs)
22803 write(iunit,*) qssbv(mgs)
22804 write(iunit,*) min(0.0, qscev(mgs))
22805 write(iunit,*) -qsmul(mgs)
22809 write(iunit,*)
'Graupel'
22811 write(iunit,*) il5(mgs)*qrfrzf(mgs), qrfrzf(mgs) - qrfrz(mgs)
22812 write(iunit,*) il5(mgs)*qiacrf(mgs)
22813 write(iunit,*) il5(mgs)*qracif(mgs)
22814 write(iunit,*) qhcns(mgs)
22815 write(iunit,*) qhcni(mgs)
22816 write(iunit,*) il5(mgs)*(qhdpv(mgs))
22817 write(iunit,*) qhacr(mgs)
22818 write(iunit,*) qhacw(mgs)
22819 write(iunit,*) qhacs(mgs)
22820 write(iunit,*) qhaci(mgs)
22821 write(iunit,*)
'pqhwi = ',pqhwi(mgs)
22823 write(iunit,*) qhshr(mgs)
22824 write(iunit,*) (1-il5(mgs))*qhmlr(mgs)
22825 write(iunit,*) il5(mgs),qhsbv(mgs)
22826 write(iunit,*) -qhlcnh(mgs)
22827 write(iunit,*) -qhmul1(mgs)
22828 write(iunit,*)
'pqhwd = ', pqhwd(mgs)
22829 write(iunit,*)
'Concentration'
22830 write(iunit,*) pchwi(mgs),pchwd(mgs)
22831 write(iunit,*) crfrzf(mgs)
22832 write(iunit,*) chcns(mgs)
22833 write(iunit,*) ciacrf(mgs)
22837 write(iunit,*)
'Hail'
22839 write(iunit,*) qhlcnh(mgs)
22840 write(iunit,*) il5(mgs)*(qhldpv(mgs))
22841 write(iunit,*) qhlacr(mgs)
22842 write(iunit,*) qhlacw(mgs)
22843 write(iunit,*) qhlacs(mgs)
22844 write(iunit,*) qhlaci(mgs)
22845 write(iunit,*) pqhli(mgs)
22847 write(iunit,*) qhlshr(mgs)
22848 write(iunit,*) (1-il5(mgs))*qhlmlr(mgs)
22849 write(iunit,*) il5(mgs)*qhlsbv(mgs)
22850 write(iunit,*) pqhld(mgs)
22851 write(iunit,*)
'Concentration'
22852 write(iunit,*) pchli(mgs),pchld(mgs)
22853 write(iunit,*) chlcnh(mgs)
22858 write(iunit,*)
'END OF OUTPUT OF SOURCE AND SINK'
22859 write(iunit,*)
'PTOTAL',ptotal(mgs)
22872 IF ( warmonly < 0.5 )
THEN
22876 & qsmlr(mgs)+qhlmlr(mgs)) &
22877 & +il5(mgs)*(1-imixedphase)*( &
22878 & qsacw(mgs)+qhacw(mgs) + qhlacw(mgs) &
22879 & +qsacr(mgs)+qhacr(mgs) + qhlacr(mgs) &
22883 & +qrfrz(mgs)+qiacr(mgs) &
22885 & +il5(mgs)*(qwfrz(mgs) &
22886 & +qwctfz(mgs)+qiihr(mgs) &
22890 & (qhmlr(mgs)+qsmlr(mgs)+ &
22895 & + qsdpv(mgs) + qhdpv(mgs) &
22897 & + qidpv(mgs) + qisbv(mgs) ) &
22898 & + qssbv(mgs) + qhsbv(mgs) &
22900 & +il5(mgs)*(qiint(mgs))
22902 & qrcev(mgs) + qhcev(mgs) + qscev(mgs) + qhlcev(mgs) + qfcev(mgs)
22904 & min(0.0,qrcev(mgs)) + min(0.0,qhcev(mgs)) + min(0.0,qscev(mgs)) + min(0.0,qhlcev(mgs)) &
22905 + min(0.0,qfcev(mgs))
22909 & + qsdpv(mgs) + qhdpv(mgs) &
22912 & +il5(mgs)*(qiint(mgs))
22913 ELSEIF ( warmonly < 0.8 )
THEN
22916 & (qhmlr(mgs)+qhlmlr(mgs)) &
22917 & +il5(mgs)*(qhfzh(mgs)+qhlfzhl(mgs)) &
22921 & +qrfrz(mgs)+qwfrz(mgs) &
22922 & +qwctfz(mgs)+qiihr(mgs) &
22924 & +qhacw(mgs) + qhlacw(mgs) &
22925 & +qhacr(mgs) + qhlacr(mgs) )
22926 psub(mgs) = 0.0 + &
22930 & + qidpv(mgs) + qisbv(mgs) ) &
22931 & +il5(mgs)*(qiint(mgs))
22933 & qrcev(mgs) + qhcev(mgs) + qhlcev(mgs) + qfcev(mgs)
22937 pvap(mgs) = qrcev(mgs)
22941 & (felfcp(mgs)*pfrz(mgs) &
22942 & +felscp(mgs)*psub(mgs) &
22943 & +felvcp(mgs)*pvap(mgs))
22944 thetap(mgs) = thetap(mgs) + dtp*ptem(mgs)
22945 ptem2(mgs) = ptem(mgs)
22946 IF ( eqtset > 2 )
THEN
22947 pipert(mgs) = pipert(mgs) + (felfpi(mgs)*pfrz(mgs) &
22948 & +felspi(mgs)*psub(mgs) &
22949 & +felvpi(mgs)*pvap(mgs))*dtp
22963 qwvp(mgs) = qwvp(mgs) + &
22964 & dtp*(pqwvi(mgs)+pqwvd(mgs))
22965 qx(mgs,lc) = qx(mgs,lc) + &
22966 & dtp*(pqcwi(mgs)+pqcwd(mgs))
22967 qx(mgs,lr) = qx(mgs,lr) + &
22968 & dtp*(pqrwi(mgs)+pqrwd(mgs))
22969 qx(mgs,li) = qx(mgs,li) + &
22970 & dtp*(pqcii(mgs)+pqcid(mgs))
22971 qx(mgs,ls) = qx(mgs,ls) + &
22972 & dtp*(pqswi(mgs)+pqswd(mgs))
22973 qx(mgs,lh) = qx(mgs,lh) + &
22974 & dtp*(pqhwi(mgs)+pqhwd(mgs))
22976 IF ( lhl .gt. 1 )
THEN
22977 qx(mgs,lhl) = qx(mgs,lhl) + &
22978 & dtp*(pqhli(mgs)+pqhld(mgs))
22990 IF ( lvol(ls) .gt. 1 )
THEN
22991 vx(mgs,ls) = vx(mgs,ls) + &
22992 & dtp*(pvswi(mgs)+pvswd(mgs))
22995 IF ( lvol(lh) .gt. 1 )
THEN
22996 vx(mgs,lh) = vx(mgs,lh) + &
22997 & dtp*(pvhwi(mgs)+pvhwd(mgs))
23001 IF ( lhl .gt. 1 )
THEN
23002 IF ( lvol(lhl) .gt. 1 )
THEN
23003 vx(mgs,lhl) = vx(mgs,lhl) + &
23004 & dtp*(pvhli(mgs)+pvhld(mgs))
23018 if ( ipconc .ge. 1 )
then
23020 cx(mgs,li) = cx(mgs,li) + &
23021 & dtp*(pccii(mgs)+pccid(mgs))
23022 cina(mgs) = cina(mgs) + pccin(mgs)*dtp
23023 IF ( ipconc .ge. 2 )
THEN
23024 cx(mgs,lc) = cx(mgs,lc) + &
23025 & dtp*(pccwi(mgs)+pccwd(mgs))
23027 IF ( ipconc .ge. 3 )
THEN
23028 cx(mgs,lr) = cx(mgs,lr) + &
23029 & dtp*(pcrwi(mgs)+pcrwd(mgs))
23031 IF ( ipconc .ge. 4 )
THEN
23032 cx(mgs,ls) = cx(mgs,ls) + &
23033 & dtp*(pcswi(mgs)+pcswd(mgs))
23035 IF ( ipconc .ge. 5 )
THEN
23036 cx(mgs,lh) = cx(mgs,lh) + &
23037 & dtp*(pchwi(mgs)+pchwd(mgs))
23038 IF ( lhl .gt. 1 )
THEN
23039 cx(mgs,lhl) = cx(mgs,lhl) + &
23040 & dtp*(pchli(mgs)+pchld(mgs))
23047 IF ( ipconc .ge. 6 )
THEN
23048 IF ( lzr .gt. 1 )
THEN
23049 zx(mgs,lr) = zx(mgs,lr) + &
23050 & dtp*(pzrwi(mgs)+pzrwd(mgs))
23052 IF ( lzs .gt. 1 )
THEN
23053 zx(mgs,ls) = zx(mgs,ls) + &
23054 & dtp*(pzswi(mgs)+pzswd(mgs))
23056 IF ( lzh .gt. 1 )
THEN
23057 zx(mgs,lh) = zx(mgs,lh) + &
23058 & dtp*(pzhwi(mgs)+pzhwd(mgs))
23060 IF ( lzhl .gt. 1 )
THEN
23061 zx(mgs,lhl) = zx(mgs,lhl) + &
23062 & dtp*(pzhli(mgs)+pzhld(mgs))
23071 IF ( has_wetscav )
THEN
23073 evapprod2d(igs(mgs),kgs(mgs)) = -(qrcev(mgs) + qssbv(mgs) + qhsbv(mgs) + qhlsbv(mgs))
23074 rainprod2d(igs(mgs),kgs(mgs)) = qrcnw(mgs) + qracw(mgs) + qsacw(mgs) + qhacw(mgs) + qhlacw(mgs) + &
23075 qraci(mgs) + qsaci(mgs) + qhaci(mgs) + qhlaci(mgs) + qscni(mgs)
23083 if (ndebug .gt. 0 )
write(0,*)
'conc 30a'
23095 pqs(mgs) = (380.0)/(pres(mgs))
23096 theta(mgs) = thetap(mgs) + theta0(mgs)
23097 qvap(mgs) = max( (qwvp(mgs) + qv0(mgs)), 0.0 )
23098 temg(mgs) = theta(mgs)*pk(mgs)
23104 qcwtmp(mgs) = qx(mgs,lc)
23109 qitmp(mgs) = qx(mgs,li)
23110 if( temg(mgs) .gt. tfr .and. &
23111 & qitmp(mgs) .gt. 0.0 )
then
23112 qx(mgs,lc) = qx(mgs,lc) + qitmp(mgs)
23114 ptem(mgs) = ptem(mgs) + &
23116 & felfcp(mgs)*(- qitmp(mgs)*dtpinv)
23117 IF ( eqtset > 2 )
THEN
23118 pipert(mgs) = pipert(mgs) - (felfpi(mgs)*qitmp(mgs))
23120 pmlt(mgs) = pmlt(mgs) - qitmp(mgs)*dtpinv
23121 scx(mgs,lc) = scx(mgs,lc) + scx(mgs,li)
23122 thetap(mgs) = thetap(mgs) - &
23123 & fcc3(mgs)*qitmp(mgs)
23124 ptimlw(mgs) = -fcc3(mgs)*qitmp(mgs)*dtpinv
23125 cx(mgs,lc) = cx(mgs,lc) + cx(mgs,li)
23144 IF ( warmonly < 0.8 )
THEN
23147 qcwtmp(mgs) = qx(mgs,lc)
23166 if( ( ( temg(mgs) .lt. thnuc + 0.) .or. (temg(mgs) .lt. thnuc + 2. .and. ibfc >= 3) ) .and. &
23167 & qx(mgs,lc) .gt. 0.0 .and. (ipconc < 2 .or. ibfc == 0 .or. ibfc == 2))
then
23169 IF ( ibfc >= 3 )
THEN
23170 frac = max( 0.25, min( 1., ((thnuc + 2.) - temg(mgs) )/4.0 ) )
23171 ELSEIF ( ibfc /= 2 .or. ipconc < 2 )
THEN
23172 frac = max( 0.25, min( 1., ((thnuc + 1.) - temg(mgs) )/4.0 ) )
23174 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
23178 cwfrz(mgs) = cx(mgs,lc)*exp(-volt/xv(mgs,lc))
23180 qtmp = cwfrz(mgs)*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
23181 frac = qtmp/qx(mgs,lc)
23186 qtmp = frac*qx(mgs,lc)
23188 IF ( ibfc == 4 .and. lis >= 1 )
THEN
23189 qx(mgs,lis) = qx(mgs,lis) + qtmp
23191 qx(mgs,li) = qx(mgs,li) + qtmp
23193 pfrz(mgs) = pfrz(mgs) + qtmp*dtpinv
23194 ptem(mgs) = ptem(mgs) + &
23196 & felfcp(mgs)*(qtmp*dtpinv)
23198 IF ( eqtset > 2 )
THEN
23199 pipert(mgs) = pipert(mgs) + felfpi(mgs)*qtmp
23203 IF ( lvol(li) .gt. 1 ) vx(mgs,li) = vx(mgs,li) + rho0(mgs)*qtmp/xdn0(li)
23205 IF ( ipconc .ge. 2 )
THEN
23206 ctmp = frac*cx(mgs,lc)
23208 IF ( ibfc == 4 .and. lis >= 1 )
THEN
23209 cx(mgs,lis) = cx(mgs,lis) + ctmp
23211 cx(mgs,li) = cx(mgs,li) + ctmp
23215 IF ( t9(igs(mgs),jgs,kgs(mgs)-1) .gt. qx(mgs,lc) )
THEN
23216 qtmp = frac*t9(igs(mgs),jgs,kgs(mgs)-1)
23219 ctmp = cx(mgs,lc)*qx(mgs,lc)*rho0(mgs)/qtmp
23221 cx(mgs,lc) = max(0.0,wvel(mgs))*dtp*cwccn &
23222 & /gz(igs(mgs),jgs,kgs(mgs))
23226 IF ( ipconc .ge. 1 ) cx(mgs,li) = min(ccimx, cx(mgs,li) + cx(mgs,lc))
23229 sctmp = frac*scx(mgs,lc)
23231 scx(mgs,li) = scx(mgs,li) + sctmp
23237 thetap(mgs) = thetap(mgs) + fcc3(mgs)*qtmp
23238 ptwfzi(mgs) = fcc3(mgs)*qtmp*dtpinv
23239 qx(mgs,lc) = qx(mgs,lc) - qtmp
23240 cx(mgs,lc) = cx(mgs,lc) - ctmp
23241 scx(mgs,lc) = scx(mgs,lc) - sctmp
23255 IF ( ipconc .le. 1 .and. lwsm6 )
THEN
23258 qcwtmp(mgs) = qx(mgs,lc)
23259 theta(mgs) = thetap(mgs) + theta0(mgs)
23260 temgtmp = temg(mgs)
23264 temg(mgs) = theta(mgs)*pk(mgs)
23265 temcg(mgs) = temg(mgs) - tfr
23266 ltemq = (temg(mgs)-163.15)/fqsat+1.5
23267 ltemq = min( nqsat, max(1,ltemq) )
23269 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
23271 IF ( ( qvap(mgs) > qvs(mgs) .or. qx(mgs,lc) > qxmin(lc) ) .and. temg(mgs) > tfrh )
THEN
23272 tmp = (qvap(mgs) - qvs(mgs))/(1. + qvs(mgs)*felv(mgs)**2/(cp*rw*temg(mgs)**2) )
23273 qcond(mgs) = min( max( 0.0, tmp ), (qvap(mgs)-qvs(mgs)) )
23274 IF ( qx(mgs,lc) > qxmin(lc) .and. tmp < 0.0 )
THEN
23275 qcond(mgs) = max( tmp, -qx(mgs,lc) )
23277 qwvp(mgs) = qwvp(mgs) - qcond(mgs)
23278 qvap(mgs) = qvap(mgs) - qcond(mgs)
23279 qx(mgs,lc) = max( 0.0, qx(mgs,lc) + qcond(mgs) )
23280 thetap(mgs) = thetap(mgs) + felvcp(mgs)*qcond(mgs)/(pi0(mgs))
23289 IF ( ipconc .le. 1 .and. .not. lwsm6 )
THEN
23293 qx(mgs,lv) = max( 0.0, qvap(mgs) )
23294 qx(mgs,lc) = max( 0.0, qx(mgs,lc) )
23295 qx(mgs,li) = max( 0.0, qx(mgs,li) )
23296 qitmp(mgs) = qx(mgs,li)
23301 qcwtmp(mgs) = qx(mgs,lc)
23302 qitmp(mgs) = qx(mgs,li)
23303 theta(mgs) = thetap(mgs) + theta0(mgs)
23304 temgtmp = temg(mgs)
23305 temg(mgs) = theta(mgs)*(pinit(kgs(mgs)) + p2(igs(mgs),jgs,kgs(mgs)) )
23307 thsave(mgs) = thetap(mgs)
23308 temcg(mgs) = temg(mgs) - tfr
23309 tqvcon = temg(mgs)-cbw
23310 ltemq = (temg(mgs)-163.15)/fqsat+1.5
23311 ltemq = min( nqsat, max(1,ltemq) )
23313 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
23314 qis(mgs) = pqs(mgs)*tabqis(ltemq)
23315 qss(mgs) = qvs(mgs)
23316 if ( temg(mgs) .lt. tfr )
then
23317 if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) ) &
23318 & qss(mgs) = qvs(mgs)
23319 if( qx(mgs,lc) .le. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
23320 & qss(mgs) = qis(mgs)
23321 if( qx(mgs,lc) .gt. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
23322 & qss(mgs) = (qx(mgs,lc)*qvs(mgs) + qitmp(mgs)*qis(mgs)) / &
23323 & (qx(mgs,lc) + qitmp(mgs))
23335 qitmp(mgs) = qx(mgs,li)
23340 dqwv(mgs) = ( qx(mgs,lv) - qss(mgs) )
23344 if( dqwv(mgs) .lt. 0. )
then
23345 if( qx(mgs,lc) .gt. -dqwv(mgs) )
then
23346 dqcw(mgs) = dqwv(mgs)
23349 dqcw(mgs) = -qx(mgs,lc)
23350 dqwv(mgs) = dqwv(mgs) + qx(mgs,lc)
23353 if( qitmp(mgs) .gt. -dqwv(mgs) )
then
23354 dqci(mgs) = dqwv(mgs)
23357 dqci(mgs) = -qitmp(mgs)
23358 dqwv(mgs) = dqwv(mgs) + qitmp(mgs)
23361 qwvp(mgs) = qwvp(mgs) - ( dqcw(mgs) + dqci(mgs) )
23366 qitmp(mgs) = qx(mgs,li)
23367 IF ( qitmp(mgs) .ge. qxmin(li) )
THEN
23368 fcci(mgs) = qx(mgs,li)/(qitmp(mgs))
23372 qx(mgs,lc) = qx(mgs,lc) + dqcw(mgs)
23373 qx(mgs,li) = qx(mgs,li) + dqci(mgs) * fcci(mgs)
23374 thetap(mgs) = thetap(mgs) + &
23376 & (felvcp(mgs)*dqcw(mgs) +felscp(mgs)*dqci(mgs))
23378 IF ( eqtset > 2 )
THEN
23379 pipert(mgs) = pipert(mgs) &
23380 & +(felspi(mgs)*dqci(mgs) &
23381 & +felvpi(mgs)*dqcw(mgs))*dtp
23388 IF ( dqwv(mgs) .ge. 0. )
THEN
23392 qitmp(mgs) = qx(mgs,li)
23395 if ( temg(mgs) .lt. tfr .and. temg(mgs) .gt. thnuc )
then
23396 fracl(mgs) = max(min(1.,(temg(mgs)-233.15)/(20.)),0.0)
23397 fraci(mgs) = 1.0-fracl(mgs)
23399 if ( temg(mgs) .le. thnuc )
then
23403 fraci(mgs) = 1.0-fracl(mgs)
23405 gamss = (felvcp(mgs)*fracl(mgs) + felscp(mgs)*fraci(mgs)) &
23408 IF ( temg(mgs) .lt. tfr )
then
23409 IF (qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) )
then
23410 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qss(mgs)/ &
23411 & ((temg(mgs)-cbw)**2))
23413 IF ( qx(mgs,lc) .eq. 0.0 .and. qitmp(mgs) .gt. qxmin(li) )
then
23414 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv2(mgs)*qss(mgs)/ &
23415 & ((temg(mgs)-cbi)**2))
23417 IF ( qx(mgs,lc) .gt. 0.0 .and. qitmp(mgs) .gt. qxmin(li) )
then
23418 cdw = caw*pi0(mgs)*tfrcbw/((temg(mgs)-cbw)**2)
23419 cdi = cai*pi0(mgs)*tfrcbi/((temg(mgs)-cbi)**2)
23420 denom1 = qx(mgs,lc) + qitmp(mgs)
23421 denom2 = 1.0 + gamss* &
23422 & (qx(mgs,lc)*qvs(mgs)*cdw + qitmp(mgs)*qis(mgs)*cdi) / denom1
23423 dqvcnd(mgs) = dqwv(mgs) / denom2
23428 if ( temg(mgs) .ge. tfr )
then
23429 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qss(mgs)/ &
23430 & ((temg(mgs)-cbw)**2))
23435 IF ( qitmp(mgs) .gt. qxmin(li) )
THEN
23436 fcci(mgs) = qx(mgs,li)/(qitmp(mgs))
23441 dqcw(mgs) = dqvcnd(mgs)*fracl(mgs)
23442 dqci(mgs) = dqvcnd(mgs)*fraci(mgs)
23444 thetap(mgs) = thetap(mgs) + &
23445 & (felvcp(mgs)*dqcw(mgs) + felscp(mgs)*dqci(mgs)) &
23448 IF ( eqtset > 2 )
THEN
23449 pipert(mgs) = pipert(mgs) + (0 &
23450 & +felspi(mgs)*dqci(mgs) &
23451 & +felvpi(mgs)*dqcw(mgs))*dtp
23454 qwvp(mgs) = qwvp(mgs) - ( dqvcnd(mgs) )
23455 qx(mgs,lc) = qx(mgs,lc) + dqcw(mgs)
23457 qx(mgs,li) = qx(mgs,li) + dqci(mgs)*fcci(mgs)
23458 qitmp(mgs) = qx(mgs,li)
23467 qitmp(mgs) = qx(mgs,li)
23468 theta(mgs) = thetap(mgs) + theta0(mgs)
23469 temg(mgs) = theta(mgs)*pk(mgs)
23470 qvap(mgs) = max((qwvp(mgs) + qv0(mgs)), 0.0)
23471 temcg(mgs) = temg(mgs) - tfr
23472 tqvcon = temg(mgs)-cbw
23473 ltemq = (temg(mgs)-163.15)/fqsat+1.5
23474 ltemq = min( nqsat, max(1,ltemq) )
23475 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
23476 qis(mgs) = pqs(mgs)*tabqis(ltemq)
23477 qx(mgs,lc) = max( 0.0, qx(mgs,lc) )
23478 qitmp(mgs) = max( 0.0, qitmp(mgs) )
23479 qx(mgs,lv) = max( 0.0, qvap(mgs))
23493 qss(mgs) = qvs(mgs)
23494 if ( temg(mgs) .lt. tfr )
then
23495 if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) ) &
23496 & qss(mgs) = qvs(mgs)
23497 if( qx(mgs,lc) .le. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
23498 & qss(mgs) = qis(mgs)
23499 if( qx(mgs,lc) .gt. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
23500 & qss(mgs) = (qx(mgs,lc)*qvs(mgs) + qitmp(mgs)*qis(mgs)) / &
23501 & (qx(mgs,lc) + qitmp(mgs))
23520 if (ndebug .gt. 0 )
write(0,*)
'conc 30b'
23529 t0(igs(mgs),jy,kgs(mgs)) = temg(mgs)
23553 if (ndebug .gt. 0 )
write(0,*)
'gs 11'
23557 an(igs(mgs),jy,kgs(mgs),lt) = &
23558 & theta0(mgs) + thetap(mgs)
23559 an(igs(mgs),jy,kgs(mgs),lv) = qwvp(mgs) + qv0(mgs)
23561 IF ( eqtset > 2 )
THEN
23562 p2(igs(mgs),jy,kgs(mgs)) = pipert(mgs)
23567 IF ( ido(il) .eq. 1 )
THEN
23568 IF ( lf > 1 .and. il == lf )
THEN
23569 lfsave(mgs,1) = an(igs(mgs),jy,kgs(mgs),il)
23570 lfsave(mgs,2) = qx(mgs,il)
23572 an(igs(mgs),jy,kgs(mgs),il) = qx(mgs,il) + &
23573 & min( an(igs(mgs),jy,kgs(mgs),il), 0.0 )
23574 qx(mgs,il) = an(igs(mgs),jy,kgs(mgs),il)
23578 IF ( lcina > 1 )
THEN
23579 an(igs(mgs),jy,kgs(mgs),lcina) = cina(mgs)
23590 IF ( ipconc .ge. 6 )
THEN
23592 IF ( lz(il) .gt. 1 )
THEN
23593 IF ( lf > 1 .and. il == lf )
THEN
23594 lfsave(mgs,3) = an(igs(mgs),jy,kgs(mgs),lz(il))
23595 lfsave(mgs,4) = zx(mgs,il)
23598 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il) + &
23599 & min( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
23600 zx(mgs,il) = an(igs(mgs),jy,kgs(mgs),lz(il))
23610 if ( ipconc .ge. 1 )
then
23615 IF ( ipconc .ge. ipc(il) .and. ido(il) > 0 )
THEN
23617 IF ( ipconc .ge. 4 .and. ipc(il) .ge. 1 )
THEN
23622 IF ( lz(il) <= 1 .or. ioldlimiter == 1 )
THEN
23626 IF ( qx(mgs,il) .le. 0.0 )
THEN
23629 IF ( cx(mgs,il) .gt. cxmin )
THEN
23632 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*cx(mgs,il))
23639 IF ( imaxdiaopt == 1 .or. il == lc .or. il == li .or. (il == lr .and. imurain == 3) .or. &
23640 & (il == ls .and. imusnow == 3 ) )
THEN
23641 xvbarmax = xvmx(il)
23642 ELSEIF ( imaxdiaopt == 2 )
THEN
23643 xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
23644 ELSEIF ( imaxdiaopt == 3 )
THEN
23645 xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
23647 xvbarmax = xvmx(il)
23651 IF ( il == ls )
THEN
23652 xvbarmax = xvbarmax*max(1.,100./min(100.,xdn(mgs,ls)))
23655 IF ( xv(mgs,il) .lt. xvmn(il) .or. xv(mgs,il) .gt. xvbarmax )
THEN
23656 xv(mgs,il) = min( xvbarmax, xv(mgs,il) )
23657 xv(mgs,il) = max( xvmn(il), xv(mgs,il) )
23658 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xv(mgs,il)*xdn(mgs,il))
23671 IF ( il == lr .and. imurain == 3 )
THEN
23679 IF ( iresetmoments == 1 .or. iresetmoments == il )
THEN
23680 IF ( zx(mgs,lr) <= zxmin )
THEN
23681 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
23684 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
23685 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
23686 an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
23687 ELSEIF ( cx(mgs,lr) <= cxmin )
THEN
23688 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
23691 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
23692 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
23693 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
23697 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
23699 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
23700 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
23703 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
23704 xv(mgs,lr) = xvmn(lr)
23705 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
23708 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
23710 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
23713 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
23715 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
23717 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
23720 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
23721 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
23723 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
23727 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
23728 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23730 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
23733 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
23734 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
23737 IF ( zx(mgs,lr) > 0.0 )
THEN
23738 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
23748 IF ( z .gt. 0.0 )
THEN
23749 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
23751 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
23752 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
23753 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
23754 alp = max( rnumin, min( rnumax, alp ) )
23758 IF ( xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter == 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) )
THEN
23762 IF ( ioldlimiter == 2 )
THEN
23763 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
23764 x1 = max(0.0e-3, x - 3.0e-3)
23765 x2 = max(0.5, x/6.0e-3)
23767 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
23768 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
23770 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
23771 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
23772 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
23778 IF ( tmp < cx(mgs,il) )
THEN
23780 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
23781 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
23782 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23791 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
23793 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
23794 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
23795 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
23796 alp = max( rnumin, min( rnumax, alp ) )
23807 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
23808 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
23810 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
23811 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
23812 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
23814 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
23815 z = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
23817 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
23832 ELSEIF ( il == lh .or. il == lhl .or. il == lf .or. (il == lr .and. imurain == 1 ))
THEN
23838 IF ( lf > 1 .and. il == lf )
THEN
23839 lfsave(mgs,5) = an(igs(mgs),jy,kgs(mgs),ln(il))
23840 lfsave(mgs,6) = cx(mgs,il)
23843 IF ( il == lhl .and. lnhlf > 1 )
THEN
23844 IF ( cx(mgs,lhl) > cxmin )
THEN
23845 frac = chxf(mgs,lhl)/cx(mgs,lhl)
23851 IF ( il == lh .and. lnhf > 1 )
THEN
23852 IF ( cx(mgs,lh) > cxmin )
THEN
23853 frach = chxf(mgs,lh)/cx(mgs,lh)
23861 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
23862 IF ( zx(mgs,il) <= zxmin )
THEN
23866 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
23867 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
23868 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
23869 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
23872 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
23875 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
23876 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
23877 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23879 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
23880 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
23883 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
23884 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
23885 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23888 IF ( zx(mgs,il) < 0.0 )
THEN
23894 IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
23897 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
23899 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
23900 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
23901 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23904 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
23906 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*max(1.0e-9,cx(mgs,il)))
23907 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
23909 IF ( xv(mgs,il) .lt. xvmn(il) )
THEN
23910 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
23911 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
23912 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
23915 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
23917 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
23918 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
23922 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
23925 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
23933 g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
23934 & ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
23935 zx(mgs,il) = max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
23936 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23938 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
23945 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
23946 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
23948 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
23949 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
23953 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
23954 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
23964 IF ( zx(mgs,il) .gt. 0. )
THEN
23967 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
23971 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
23972 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
23976 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
23977 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
23980 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
23981 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
23983 alp = max( alphamin, min( alphamax, alp ) )
23988 IF ( xv(mgs,il) .gt. xvmx(il) )
THEN
23992 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
23993 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
23994 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
23995 IF ( tmp < cx(mgs,il) )
THEN
23996 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
23997 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
23998 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
23999 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24005 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
24006 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24007 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24009 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
24010 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
24011 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24012 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24013 alp = max( alphamin, min( alphamax, alp ) )
24024 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
24025 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
24027 IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and. &
24028 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
24030 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
24031 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
24032 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
24034 ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
24035 .not. ( il == lr .and. .not. rescale_low_alphar ) )
THEN
24038 IF ( irescalerainopt == 0 )
THEN
24040 ELSEIF ( irescalerainopt == 1 )
THEN
24041 wtest = qx(mgs,lc) > qxmin(lc)
24042 ELSEIF ( irescalerainopt == 2 )
THEN
24043 wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
24044 ELSEIF ( irescalerainopt == 3 )
THEN
24045 wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
24048 IF ( il == lr .and. ( wtest .or. .not. rescale_low_alphar ) )
THEN
24051 chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
24053 an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
24056 z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
24057 z = z1*(6./(pi*xdn(mgs,il)))**2
24059 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
24080 IF ( lzr > 1 )
THEN
24081 alpha2d(igs(mgs),kgs(mgs),1) = max(alphamin, min(alphamax, alpha(mgs,lr) ))
24083 IF ( lzh > 1 )
THEN
24084 alpha2d(igs(mgs),kgs(mgs),2) = max(alphamin, min(alphamax, alpha(mgs,lh) ))
24086 IF ( lzhl > 1 )
THEN
24087 alpha2d(igs(mgs),kgs(mgs),3) = max(alphamin, min(alphamax, alpha(mgs,lhl) ))
24090 IF ( il == lhl .and. lnhlf > 1 )
THEN
24092 chxf(mgs,lhl) = frac*cx(mgs,lhl)
24094 IF ( il == lh .and. lnhf > 1 )
THEN
24096 chxf(mgs,lh) = frach*cx(mgs,lh)
24124 IF ( il == lh )
THEN
24125 IF ( lnhf > 1 )
THEN
24126 an(igs(mgs),jy,kgs(mgs),lnhf) = max( chxf(mgs,lh), 0.0)
24130 IF ( il == lhl )
THEN
24132 IF ( lnhlf > 1 )
THEN
24134 an(igs(mgs),jy,kgs(mgs),lnhlf) = max( chxf(mgs,lhl), 0.0)
24137 an(igs(mgs),jy,kgs(mgs),ln(il)) = max(cx(mgs,il), 0.0)
24142 IF ( lcin > 1 )
THEN
24144 an(igs(mgs),jy,kgs(mgs),lcin) = max(0.0, ccin(mgs))
24148 IF ( ipconc .ge. 2 )
THEN
24150 IF ( lss > 1 )
THEN
24151 an(igs(mgs),jy,kgs(mgs),lss) = max(0.0, ssmax(mgs) )
24154 IF ( lccn > 1 )
THEN
24155 an(igs(mgs),jy,kgs(mgs),lccn) = max(0.0, ccnc(mgs) )
24160 ELSEIF ( ipconc .eq. 0 .and. lni .gt. 1 )
THEN
24163 an(igs(mgs),jy,kgs(mgs),lni) = max(cx(mgs,li), 0.0)
24173 IF ( lvol(il) .ge. 1 )
THEN
24177 an(igs(mgs),jy,kgs(mgs),lvol(il)) = max( 0.0, vx(mgs,il) )
24190 if (ndebug .gt. 0 )
write(0,*)
'gs 12'
24194 if (ndebug .gt. 0 )
write(0,*)
'gs 13'
24198 if ( kz .gt. nz-1 .and. ix .ge. itile)
then
24199 if ( ix .ge. itile )
then
24208 if ( ix .ge. itile )
then