12633 & (nx,ny,nz,na,jyslab &
12636 & ,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9 &
12640 & ventr,ventc,c1sw,jgs,ido, &
12644 & xdn0,tmp3d,tkediss &
12645 & ,thproc,numproc,dx1,dy1,ngs &
12646 & ,timevtcalc,axtra,io_flag &
12647 & , has_wetscav,rainprod2d, evapprod2d, alpha2d &
12649 & ,elec,its,ids,ide,jds,jde &
12713 integer,
parameter :: ng1 = 1
12715 integer nx,ny,nz,na,nba,nv
12716 integer nor,norz,istag,jstag,kstag
12720 logical,
intent(in) :: io_flag
12722 integer itile,jtile,ktile
12723 integer ixbeg,jybeg
12724 integer ixend,jyend,kzend,kzbeg
12725 integer nxend,nyend,nzend,nzbeg
12726 integer :: my_rank = 0
12727 integer,
parameter :: myprock = 1, nprock = 1
12728 logical,
intent(in) :: has_wetscav
12729 integer,
intent(in) :: numproc
12730 real,
intent(inout) :: thproc(nz,numproc)
12731 real,
intent(in) :: dx1,dy1
12732 real rainprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
12733 real evapprod2d(-nor+1:nx+nor,-norz+ng1:nz+norz)
12736 real :: alpha2d(-nor+1:nx+nor,-norz+ng1:nz+norz,3)
12738 real,
parameter :: tfrdry = 243.15
12740 logical lrescalelow(lc:lhab)
12741 real tkediss(-nor+1:nx+nor,-norz+ng1:nz+norz)
12742 real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
12747 integer jyslab,its,ids,ide,jds,jde
12748 integer,
intent(in) :: iunit
12750 integer iraincv, icgxconv
12751 parameter( iraincv = 1, icgxconv = 1)
12753 real :: ffrzh = 1.0
12755 real qcitmp,cirdiatmp
12761 double precision dp1
12763 double precision frac, frach, xvfrz, xvbiggsnow
12765 double precision :: timevtcalc
12766 double precision :: dpt1,dpt2
12768 logical,
parameter :: gammacheck = .false.
12770 double precision :: tmpgam
12771 logical,
parameter :: usegamxinfcnu = .false.
12772 logical,
parameter :: usegamxinf = .false.
12773 logical,
parameter :: usegamxinf2 = .false.
12774 logical,
parameter :: usegamxinf3 = .false.
12778 character(len=*),
intent( out) :: errmsg
12779 integer,
intent( out) :: errflg
12784 double precision chgneg,chgpos,sctot
12788 real pb(-norz+ng1:nz+norz)
12789 real pinit(-norz+ng1:nz+norz)
12791 real gz(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12793 real qimax,xni0,roqi0
12799 integer itest,nidx,id1,jd1,kd1
12802 parameter(id1=1,jd1=1,kd1=1)
12806 integer ix,kz, il, ic, ir, icp1, irp1, ip1,jp1,kp1
12810 real slope1, slope2
12811 real x1, x2, x3, y1
12813 parameter(eps=1.e-20,eps2=1.e-5)
12820 logical ldovol, ishail, ltest, wtest
12821 logical ,
parameter :: alp0flag = .false.
12827 parameter(mu=1,mv=2,mw=3)
12831 integer mqcw,mqxw,mtem,mrho,mtim
12832 parameter(mqcw=21,mqxw=21,mtem=21,mrho=5,mtim=6)
12834 real xftim,xftimi,yftim, xftem,yftem, xfqcw,yfqcw, xfqxw,yfqxw
12835 parameter(xftim=0.05,xftimi = 1./xftim,yftim=1.)
12836 parameter(xftem=0.5,yftem=1.)
12837 parameter(xfqcw=2000.,yfqcw=1.)
12838 parameter(xfqxw=2000.,yfqxw=1.)
12840 parameter( dtfac = 1.0 )
12841 integer ido(lc:lqmx)
12854 real delqnxa(lc:lqmx)
12855 real delqxxa(lc:lqmx)
12859 real t00(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12860 real t77(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12862 real t0(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12863 real t1(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12864 real t2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12865 real t3(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12866 real t4(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12867 real t5(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12868 real t6(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12869 real t7(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12870 real t8(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12871 real t9(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12873 real p2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12874 real pn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12875 real an(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,na)
12876 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12877 real w(-nor+1:nx+nor,-nor+1:ny+nor,-norz+ng1:nz+norz)
12879 real tmp3d(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
12884 integer nxmpb,nzmpb,nxz
12885 integer jgs,mgs,ngs,numgs
12886 integer,
parameter :: ngsz = 500
12892 integer ngscnt,igs(ngs),kgs(ngs)
12893 integer kgsp(ngs),kgsm(ngs),kgsm2(ngs)
12896 integer il0(ngs),il5(ngs),il2(ngs),il3(ngs)
12899 real tdtol,temsav,tfrcbw,tfrcbi
12900 real,
parameter :: thnuc = 235.15
12904 real fimt1(ngs),fimta(ngs),fimt2(ngs)
12912 real ccnc(ngs),ccin(ngs),cina(ngs),ccna(ngs)
12915 parameter( sscb = 2.0 )
12917 parameter( idecss = 1 )
12923 parameter( ifilt = 0 )
12925 real :: mwat, mice, dice, mwshed, fwmax, fw, mwcrit, massfactor, tmpdiam
12926 real,
parameter :: shedalp = 3.
12932 real bfnu, bfnu0, bfnu1
12933 parameter( bfnu0 = (rnu + 2.0)/(rnu + 1.0) )
12936 double precision t2s, xdp
12937 double precision xl2p(ngs),rb(ngs)
12938 real,
parameter :: aa1 = 9.44e15, aa2 = 5.78e3
12940 real,
parameter :: cexs = 0.1, cecs = 0.5
12941 real,
parameter :: rvt = 0.104
12942 real,
parameter :: kfrag = 1.0e-6
12943 real,
parameter :: mfrag = 1.0e-10
12944 double precision cautn(ngs), rh(ngs), nh(ngs)
12945 real ex1, ft, rhoinv(ngs)
12948 real ac1,bc, c1,d1,e1,f1,p380,tmp,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,temp3
12949 real :: flim, xmass
12951 double precision :: tmpz, tmpzmlt
12953 real ratio, delx, dely
12955 real chgtmp,fac,mixedphasefac
12956 real x,y,y2,del,r,rtmp,alpr
12957 double precision :: vent1,vent2
12958 double precision :: g1palp,g4palp
12959 double precision :: g1palpinf,g4palpinf
12963 real d1r, d1i, d1s, e1i
12965 real,
parameter :: vr1mm = 5.23599e-10
12966 real,
parameter :: vr3mm = 5.23599e-10*(3.0/1.)**3
12967 real,
parameter :: vr4p5mm = 5.23599e-10*(4.5/1.)**3
12968 real vmlt,vshd, vshdgs(ngs,lh:lhab), maxmassfac(lc:lhab)
12970 parameter( rhosm = 500. )
12972 real dtcon,dtcon1,dtcon2
12974 integer ltemq1,ltemq1m
12975 real dqv,qv1,ss1,ss2,qvs1,dqvs,dtemp,dt1
12976 real ssi1, ssi2, dqvi, dqvis, dqvii,qis1
12977 real dqvr, dqc, dqr, dqi, dqs
12978 real qv1m,qvs1m,ss1m,ssi1m,qis1m
12980 real dcloud,dcloud2
12982 double precision xvc, xvr
12990 parameter( vgra = 0.523599*(1.0e-3)**3 )
12994 real :: d, dold, denom,denominv,vth
12995 double precision :: h1, h2, h3, h4,denomdp, denominvdp
12998 real vr,nrx,chw,g1,qr,z,z1,rdi,alp,xnutmp,xnuc,g1r,rd1,rdia,rmas
12999 real :: snowmeltmass = 0
13002 real,
parameter :: rimedens = 500.
13009 parameter( raero = 3.e-7, kaero = 5.39e-3 )
13011 parameter(kb = 1.3807e-23)
13013 real knud(ngs),knuda(ngs)
13016 real fn1(ngs),fn2(ngs),fnft(ngs)
13019 real ctfzbd(ngs),ctfzth(ngs),ctfzdi(ngs)
13024 real dqvcnd(ngs),dqwv(ngs),dqcw(ngs),dqci(ngs),dqcitmp(ngs),dqwvtmp(ngs)
13026 real temg(ngs),temcg(ngs),theta(ngs),qvap(ngs)
13027 real temgkm1(ngs), temgkm2(ngs)
13028 real temgx(ngs),temcgx(ngs)
13029 real qvs(ngs),qis(ngs),qss(ngs),pqs(ngs)
13030 real elv(ngs),elf(ngs),els(ngs)
13031 real tsqr(ngs),ssi(ngs),ssw(ngs),ssi0(ngs)
13032 real qcwtmp(ngs),qtmp,qtot(ngs)
13035 real cimasn,cimasx,ccimx
13037 real cs,ds,gf7,gf6,gf5,gf4,gf3,gf2,gf1
13039 real gf73rds, gf83rds
13040 real gamice73fac, gamsnow73fac
13041 real gf43rds, gf53rds
13042 real aradcw,bradcw,cradcw,dradcw,cwrad,rwrad,rwradmn
13043 parameter( rwradmn = 50.e-6 )
13045 real dg0(ngs),df0(ngs)
13046 real dhwet(ngs),dhlwet(ngs),dfwet(ngs)
13048 real clionpmx,clionnmx
13049 parameter(clionpmx=1.e9,clionnmx=1.e9)
13053 real fwet1(ngs),fwet2(ngs)
13054 real fmlt1(ngs),fmlt2(ngs),fmlt1e(ngs)
13055 real fvds(ngs),fvce(ngs),fiinit(ngs)
13056 real fvent(ngs),fraci(ngs),fracl(ngs)
13058 real fai(ngs),fav(ngs),fbi(ngs),fbv(ngs)
13059 real felv(ngs),fels(ngs),felf(ngs)
13060 real felvcp(ngs),felscp(ngs),felfcp(ngs)
13061 real felvpi(ngs),felspi(ngs),felfpi(ngs)
13062 real felvs(ngs),felss(ngs)
13063 real fwvdf(ngs),ftka(ngs),fthdf(ngs)
13064 real fadvisc(ngs),fakvisc(ngs)
13065 real fci(ngs),fcw(ngs)
13066 real fschm(ngs),fpndl(ngs)
13067 real fgamw(ngs),fgams(ngs)
13068 real fcqv1(ngs),fcqv2(ngs),fcc3(ngs)
13072 real,
parameter :: cpv = 1885.0
13074 real fcci(ngs), fcip(ngs)
13076 real :: sfm1(ngs),sfm2(ngs)
13077 real :: gfm1(ngs),gfm2(ngs)
13078 real :: ffm1(ngs),ffm2(ngs)
13079 real :: hfm1(ngs),hfm2(ngs)
13081 logical :: wetsfc(ngs),wetsfchl(ngs),wetsfcf(ngs)
13082 logical :: wetgrowth(ngs), wetgrowthhl(ngs), wetgrowthf(ngs)
13084 real qitmp(ngs),qistmp(ngs)
13086 real rzxh(ngs), rzxhl(ngs), rzxhlh(ngs), rzxhlf(ngs)
13087 real rzxs(ngs), rzxf(ngs)
13089 real cdh(ngs),cdhl(ngs)
13090 real :: axx(ngs,lh:lhab),bxx(ngs,lh:lhab)
13093 real :: qcwresv(ngs), ccwresv(ngs)
13095 real :: lfsave(ngs,6)
13096 real :: qx(ngs,lv:lhab)
13097 real :: qxw(ngs,ls:lhab)
13098 real :: qxwlg(ngs,lh:lhab)
13099 real :: chxf(ngs,lh:lhab)
13100 real :: cx(ngs,lc:lhab)
13101 real :: cxmxd(ngs,lc:lhab)
13102 real :: qxmxd(ngs,lv:lhab)
13103 real :: scx(ngs,lc:lhab)
13104 real :: xv(ngs,lc:lhab)
13105 real :: vtxbar(ngs,lc:lhab,3)
13106 real :: xmas(ngs,lc:lhab)
13107 real :: xdn(ngs,lc:lhab)
13108 real :: xdntmp(ngs,lc:lhab)
13109 real :: cdxgs(ngs,lc:lhab)
13110 real :: xdia(ngs,lc:lhab,3)
13111 real :: vtwtdia(ngs,lr:lhab)
13112 real :: rarx(ngs,ls:lhab)
13113 real :: vx(ngs,li:lhab)
13114 real :: rimdn(ngs,li:lhab)
13115 real :: raindn(ngs,li:lhab)
13116 real :: alpha(ngs,lc:lhab)
13117 real :: dab0lh(ngs,lc:lhab,lc:lhab)
13118 real :: dab1lh(ngs,lc:lhab,lc:lhab)
13119 real :: zx(ngs,lr:lhab)
13120 real :: zxmxd(ngs,lr:lhab)
13121 real :: g1x(ngs,lr:lhab)
13123 real :: g1xmax,g1xmin
13124 real :: qsimxdep(ngs)
13125 real :: qsimxsub(ngs)
13126 logical,
parameter :: DoSublimationFix = .true.
13127 real :: qrtmp(ngs),qvtmp(ngs),qctmp(ngs)
13128 real :: felvcptmp,felscptmp,qsstmp
13129 real :: thetatmp, thetaptmp, temcgtmp,qvaptmp
13130 real :: qvstmp, qisstmp, qvptmp, qitmp1, qctmp1
13136 real g1shr, alphashr
13137 real g1mlr, alphamlr
13138 real g1smlr, alphasmlr
13139 real massfacshr, massfacmlr
13147 real,
parameter :: d1t = (6.0 * 0.268e-3/(917.* pi))**(1./3.)
13148 real,
parameter :: srasheym = 0.1389
13151 real swvent(ngs),hwvent(ngs),rwvent(ngs),hlvent(ngs),hwventy(ngs),hlventy(ngs),rwventz(ngs)
13153 real hlventinc(ngs),hwventinc(ngs)
13154 integer,
parameter :: ndiam = 10
13156 real hwvent0(ndiam+4),hlvent0
13157 real hwvent1,hlvent1
13158 real hwvent2,hlvent2
13163 real :: mltdiam(ndiam+4)
13164 real mltmass0inv,mltmass1inv,mltmass2inv, mltmass1cgs, mltmass2cgs,mltmass3inv, mltmass3cgs
13165 real qhmlr0, qhmlr05, qhmlr1, qhmlr2,qhmlr3, qhmlr12, qhmlr23
13166 real qhlmlr0, qhlmlr05, qhlmlr1, qhlmlr2,qhlmlr3, qhlmlr12, qhlmlr23
13167 real qxd1, cxd1, zxd1
13169 real :: qrbreak, crbreaksmall, crbreak, zrbreak, breakbin
13171 real :: qxd(ndiam+4), cxd(ndiam+4), qhml(ndiam+4), qhml0(ndiam+4)
13172 real :: dqxd(ndiam+4), dcxd(ndiam+4), dqhml(ndiam+4)
13179 real xdnmx(lc:lhab), xdnmn(lc:lhab)
13181 real :: xdiamxmas(ngs,lc:lhab)
13186 real rwcap(ngs),swcap(ngs)
13193 real qimxd(ngs),qismxd(ngs),qcmxd(ngs),qrmxd(ngs),qsmxd(ngs),qhmxd(ngs),qhlmxd(ngs)
13194 real cimxd(ngs),ccmxd(ngs),crmxd(ngs),csmxd(ngs),chmxd(ngs)
13195 real cionpmxd(ngs),cionnmxd(ngs)
13196 real clionpmxd(ngs),clionnmxd(ngs)
13199 real elec(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz)
13204 real chmul1(ngs),chlmul1(ngs),csmul1(ngs),csmul(ngs)
13205 real qhmul1(ngs),qhlmul1(ngs),qsmul1(ngs),qsmul(ngs)
13208 real csplinter(ngs),qsplinter(ngs)
13209 real csplinter2(ngs),qsplinter2(ngs)
13214 real :: chlcnh(ngs), vhlcnh(ngs), vhlcnhl(ngs)
13215 real :: chlcnhhl(ngs)
13216 real cracif(ngs), ciacrf(ngs)
13220 real ciint(ngs), crfrz(ngs), crfrzf(ngs), crfrzs(ngs)
13223 real ciacw(ngs), cwacii(ngs)
13224 real ciacr(ngs), craci(ngs)
13227 real csaci(ngs), csacs(ngs)
13229 real chacw(ngs), chacr(ngs)
13230 real :: chlacw(ngs)
13231 real chaci(ngs), chacs(ngs)
13233 real :: chlacr(ngs)
13234 real :: chlaci(ngs), chlacs(ngs)
13236 real cidpv(ngs),cisbv(ngs)
13237 real cisdpv(ngs),cissbv(ngs)
13238 real cimlr(ngs),cismlr(ngs)
13240 real chlsbv(ngs), chldpv(ngs)
13241 real chlmlr(ngs), chlmlrr(ngs)
13244 real chlshr(ngs), chlshrr(ngs)
13247 real chdpv(ngs),chsbv(ngs)
13248 real chmlr(ngs),chcev(ngs)
13250 real chshr(ngs), chshrr(ngs)
13252 real csdpv(ngs),cssbv(ngs)
13253 real csmlr(ngs),csmlrr(ngs),cscev(ngs)
13254 real csshr(ngs), csshrr(ngs)
13258 real cwshw(ngs), qwshw(ngs)
13265 real qrcnw(ngs), qwcnr(ngs)
13266 real zrcnw(ngs),zracr(ngs),zracw(ngs),zrcev(ngs)
13273 real :: qhlacw(ngs), qxacwtmp, qxacrtmp, qxacitmp, qxacstmp
13274 real vhacw(ngs), vsacw(ngs), vhlacw(ngs), vhlacr(ngs)
13277 real qfmul1(ngs),cfmul1(ngs)
13284 real qsacr(ngs),qracs(ngs)
13285 real qhacr(ngs),qhacrmlr(ngs),qhacwmlr(ngs)
13286 real vhacr(ngs), zhacr(ngs), zhacrf(ngs), zrach(ngs), zrachl(ngs)
13287 real qiacr(ngs),qraci(ngs)
13291 real qracif(ngs),qiacrf(ngs),qiacrs(ngs),ciacrs(ngs)
13293 real :: qhlacr(ngs),qhlacrmlr(ngs), qhlacwmlr(ngs)
13304 real :: qhacis(ngs)
13305 real :: chacis(ngs)
13306 real :: chacis0(ngs)
13308 real :: csaci0(ngs)
13309 real :: csacis0(ngs)
13310 real :: chaci0(ngs)
13311 real :: chacs0(ngs)
13312 real :: chlaci0(ngs)
13313 real :: chlacis(ngs)
13314 real :: chlacis0(ngs)
13315 real :: chlacs0(ngs)
13317 real :: qsaci0(ngs)
13318 real :: qsacis0(ngs)
13319 real :: qhaci0(ngs)
13320 real :: qhacis0(ngs)
13321 real :: qhacs0(ngs)
13322 real :: qhlaci0(ngs)
13323 real :: qhlacis0(ngs)
13324 real :: qhlacs0(ngs)
13326 real :: qhlaci(ngs)
13327 real :: qhlacis(ngs)
13328 real :: qhlacs(ngs)
13333 real zrfrz(ngs), zrfrzf(ngs), zrfrzs(ngs)
13334 real ziacrf(ngs), zhcnsh(ngs), zhcnih(ngs)
13335 real zhacw(ngs), zhacs(ngs), zhaci(ngs)
13336 real zhmlr(ngs), zhdsv(ngs), zhsbv(ngs), zhlcnh(ngs), zhshr(ngs)
13337 real zfacw(ngs), zfacs(ngs), zfaci(ngs)
13338 real zfmlr(ngs), zfdsv(ngs), zfsbv(ngs), zhlcnf(ngs), zfshr(ngs), zfshrr(ngs)
13339 real zhmlrtmp,zhmlr0inf,zhlmlr0inf
13340 real zhmlrr(ngs),zhlmlrr(ngs),zhshrr(ngs),zhlshrr(ngs),zfmlrr(ngs)
13342 real zsmlrr(ngs), zsshr(ngs), zsshrr(ngs)
13343 real zhcns(ngs), zhcni(ngs)
13344 real zhwdn(ngs), zfwdn(ngs)
13347 real zhlacw(ngs), zhlacs(ngs), zhlacr(ngs)
13348 real zhlmlr(ngs), zhldsv(ngs), zhlsbv(ngs), zhlshr(ngs)
13351 real vrfrzf(ngs), viacrf(ngs)
13352 real qrfrzs(ngs), qrfrzf(ngs)
13353 real qwfrz(ngs), qwctfz(ngs)
13354 real cwfrz(ngs), cwctfz(ngs)
13355 real qwfrzis(ngs), qwctfzis(ngs)
13356 real cwfrzis(ngs), cwctfzis(ngs)
13357 real qwfrzc(ngs), qwctfzc(ngs)
13358 real cwfrzc(ngs), cwctfzc(ngs)
13359 real qwfrzp(ngs), qwctfzp(ngs)
13360 real cwfrzp(ngs), cwctfzp(ngs)
13361 real xcolmn(ngs), xplate(ngs)
13362 real ciihr(ngs), qiihr(ngs)
13363 real cicichr(ngs), qicichr(ngs)
13364 real cipiphr(ngs), qipiphr(ngs)
13365 real qscni(ngs), cscni(ngs), cscnis(ngs)
13366 real qscnvi(ngs), cscnvi(ngs), cscnvis(ngs)
13367 real qhcns(ngs), chcns(ngs), chcnsh(ngs), vhcns(ngs)
13368 real qscnh(ngs), cscnh(ngs), vscnh(ngs)
13369 real qhcni(ngs), chcni(ngs), chcnih(ngs), vhcni(ngs)
13370 real qiint(ngs),qipipnt(ngs),qicicnt(ngs)
13371 real cninm(ngs),cnina(ngs),cninp(ngs),wvel(ngs),wvelkm1(ngs)
13373 real uvel(ngs),vvel(ngs)
13375 real qidpv(ngs),qisbv(ngs)
13376 real qimlr(ngs),qidsv(ngs),qisdsv(ngs),qidsvp(ngs)
13381 real :: qhldpv(ngs), qhlsbv(ngs)
13382 real :: qhlmlr(ngs), qhldsv(ngs), qhlmlrsave(ngs)
13383 real :: qhlwet(ngs), qhldry(ngs), qhlshr(ngs), qxwettmp
13385 real :: qrfz(ngs),qsfz(ngs),qhfz(ngs),qhlfz(ngs)
13388 real qhdpv(ngs),qhsbv(ngs)
13389 real qhmlr(ngs),qhdsv(ngs),qhcev(ngs),qhcndv(ngs),qhevv(ngs)
13390 real qhlcev(ngs), chlcev(ngs)
13391 real qhwet(ngs),qhdry(ngs),qhshr(ngs)
13399 real qhmlrlg(ngs),qhlmlrlg(ngs)
13401 real qhlfzhllg(ngs)
13402 real qhlcevlg(ngs), chlcevlg(ngs)
13403 real qhcevlg(ngs), chcevlg(ngs)
13405 real vhfzh(ngs), vffzf(ngs)
13416 real qsdpv(ngs),qssbv(ngs)
13417 real qsmlr(ngs),qsdsv(ngs),qscev(ngs),qscndv(ngs),qsevv(ngs)
13418 real qswet(ngs),qsdry(ngs),qsshr(ngs)
13423 real qipdpv(ngs),qipsbv(ngs)
13424 real qipmlr(ngs),qipdsv(ngs)
13426 real qirdpv(ngs),qirsbv(ngs)
13427 real qirmlr(ngs),qirdsv(ngs),qirmlw(ngs)
13429 real qgldpv(ngs),qglsbv(ngs)
13430 real qglmlr(ngs),qgldsv(ngs)
13431 real qglwet(ngs),qgldry(ngs),qglshr(ngs)
13434 real qgmdpv(ngs),qgmsbv(ngs)
13435 real qgmmlr(ngs),qgmdsv(ngs)
13436 real qgmwet(ngs),qgmdry(ngs),qgmshr(ngs)
13438 real qghdpv(ngs),qghsbv(ngs)
13439 real qghmlr(ngs),qghdsv(ngs)
13440 real qghwet(ngs),qghdry(ngs),qghshr(ngs)
13443 real qrztot(ngs),qrzmax(ngs),qrzfac(ngs)
13446 real fsw(ngs),fhw(ngs),fhlw(ngs),ffw(ngs)
13447 real fswmax(ngs),fhwmax(ngs),fhlwmax(ngs)
13450 real :: qhlcnh(ngs)
13451 real qhcngh(ngs),qhcngm(ngs),qhcngl(ngs)
13453 real :: qhcnhl(ngs), chcnhl(ngs), zhcnhl(ngs), vhcnhl(ngs)
13455 real eiw(ngs),eii(ngs),eiri(ngs),eipir(ngs),eisw(ngs)
13456 real erw(ngs),esw(ngs),eglw(ngs),eghw(ngs),efw(ngs)
13457 real ehxw(ngs),ehlw(ngs),egmw(ngs),ehw(ngs)
13458 real err(ngs),esr(ngs),eglr(ngs),eghr(ngs),efr(ngs)
13459 real ehxr(ngs),ehlr(ngs),egmr(ngs)
13460 real eri(ngs),esi(ngs),esis(ngs),egli(ngs),eghi(ngs),efi(ngs),efis(ngs)
13461 real ehxi(ngs),ehli(ngs),egmi(ngs),ehi(ngs),ehis(ngs),ehlis(ngs)
13462 real ers(ngs),ess(ngs),egls(ngs),eghs(ngs),efs(ngs),ehs(ngs),ehsfac(ngs)
13464 real ehxs(ngs),ehls(ngs),egms(ngs),egmip(ngs)
13466 real ehsclsn(ngs),ehiclsn(ngs),ehisclsn(ngs)
13467 real efsclsn(ngs),eficlsn(ngs),efisclsn(ngs)
13468 real ehlsclsn(ngs),ehliclsn(ngs),ehlisclsn(ngs)
13469 real esiclsn(ngs),esisclsn(ngs)
13471 real :: ehs_collsn = 0.5, ehi_collsn = 1.0
13472 real :: efs_collsn = 0.5, efi_collsn = 1.0
13473 real :: ehls_collsn = 1.0, ehli_collsn = 1.0
13474 real :: esi_collsn = 1.0
13478 data cwr / 2.0, 3.0, 4.0, 6.0, 8.0, 10.0, 15.0, 20.0 , &
13479 & 1.0, 1.0, 0.5, 0.5, 0.5, 0.2, 0.2, 1. /
13480 integer icwr(ngs), igwr(ngs), irwr(ngs), ihlr(ngs), ifwr(ngs)
13482 data grad / 100., 200., 300., 400., 600., 1000., &
13483 & 1.e-2,1.e-2,1.e-2,5.e-3,2.5e-3, 1. /
13485 data ew /0.03, 0.07, 0.17, 0.41, 0.58, 0.69, 0.82, 0.88, &
13487 & 0.10, 0.20, 0.34, 0.58, 0.70, 0.78, 0.88, 0.92, &
13488 & 0.15, 0.31, 0.44, 0.65, 0.75, 0.83, 0.96, 0.91, &
13489 & 0.17, 0.37, 0.50, 0.70, 0.81, 0.87, 0.93, 0.96, &
13490 & 0.17, 0.40, 0.54, 0.71, 0.83, 0.88, 0.94, 0.98, &
13491 & 0.15, 0.37, 0.52, 0.74, 0.82, 0.88, 0.94, 0.98 /
13495 real da0lr(ngs),da1lr(ngs)
13496 real da0lc(ngs),da1lc(ngs)
13500 real :: da0lx(ngs,lr:lhab)
13503 real vab0(lc:lqmx,lc:lqmx)
13504 real vab1(lc:lqmx,lc:lqmx)
13506 real ehip(ngs),ehlip(ngs),ehlir(ngs)
13507 real erir(ngs),esir(ngs),eglir(ngs),egmir(ngs),eghir(ngs)
13508 real efir(ngs),ehir(ngs),eirw(ngs),eirir(ngs),ehr(ngs)
13509 real erip(ngs),esip(ngs),eglip(ngs),eghip(ngs)
13510 real efip(ngs),eipi(ngs),eipw(ngs),eipip(ngs)
13516 real pqcwi(ngs),pqcii(ngs),pqrwi(ngs),pqisi(ngs)
13517 real pqswi(ngs),pqhwi(ngs),pqwvi(ngs)
13518 real pqgli(ngs),pqghi(ngs),pqfwi(ngs)
13519 real pqgmi(ngs),pqhli(ngs)
13520 real pqiri(ngs),pqipi(ngs)
13521 real pqlwsi(ngs),pqlwhi(ngs),pqlwhli(ngs),pqlwfi(ngs)
13523 real pqlwlghi(ngs),pqlwlghli(ngs)
13524 real pqlwlghd(ngs),pqlwlghld(ngs)
13529 real pvhwi(ngs), pvhwd(ngs)
13530 real pvfwi(ngs), pvfwd(ngs)
13531 real pvhli(ngs), pvhld(ngs)
13532 real pvswi(ngs), pvswd(ngs)
13534 real pqcwd(ngs),pqcid(ngs),pqrwd(ngs),pqisd(ngs), pqcwdacc(ngs)
13535 real pqswd(ngs),pqhwd(ngs),pqwvd(ngs)
13536 real pqgld(ngs),pqghd(ngs),pqfwd(ngs)
13537 real pqgmd(ngs),pqhld(ngs)
13538 real pqird(ngs),pqipd(ngs)
13539 real pqlwsd(ngs),pqlwhd(ngs),pqlwhld(ngs),pqlwfd(ngs)
13544 real pcipi(ngs), pcipd(ngs)
13545 real pciri(ngs), pcird(ngs)
13546 real pccwi(ngs), pccwd(ngs), pccwdacc(ngs)
13547 real pccii(ngs), pccid(ngs)
13548 real pcisi(ngs), pcisd(ngs)
13550 real pcrwi(ngs), pcrwd(ngs)
13551 real pcswi(ngs), pcswd(ngs)
13552 real pchwi(ngs), pchwd(ngs)
13553 real pchli(ngs), pchld(ngs)
13554 real pcfwi(ngs), pcfwd(ngs)
13555 real pcgli(ngs), pcgld(ngs)
13556 real pcgmi(ngs), pcgmd(ngs)
13557 real pcghi(ngs), pcghd(ngs)
13559 real pzrwi(ngs), pzrwd(ngs)
13560 real pzhwi(ngs), pzhwd(ngs)
13561 real pzfwi(ngs), pzfwd(ngs)
13562 real pzhli(ngs), pzhld(ngs)
13563 real pzswi(ngs), pzswd(ngs)
13573 real pres(ngs),pipert(ngs)
13575 real rho0(ngs),pi0(ngs)
13576 real rhovt(ngs),sqrtrhovt
13577 real thetap(ngs),theta0(ngs),qwvp(ngs),qv0(ngs)
13579 real ptwfzi(ngs),ptimlw(ngs)
13580 real psub(ngs),pvap(ngs),pfrz(ngs),ptem(ngs),pmlt(ngs),pevap(ngs),pdep(ngs),ptem2(ngs)
13594 parameter(iholef = 1)
13595 parameter(iholen = 1)
13596 real cqtotn,cqtotn1
13606 real cqtotp,cqtotp1
13631 real ssifac, qvapor
13635 real,
parameter :: cwmas30 = 1000.*0.523599*(2.*30.e-6)**3
13636 real,
parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3
13637 integer ireadqf,lrho,lqsw,lqgl,lqgm ,lqgh
13641 real erbnd1, fdgt1, costhe1
13643 real dyi2,dzi2,bta1,cnit,dragh,dnz00,pii
13644 real qccrit,gf4br,gf4ds,gf4p5, gf3ds, gf1ds
13649 real xdn_new,drhodt
13651 integer l ,ltemq,inumgs, idelq
13658 real cval,aval,eval,fval,gval ,qsign,ftelwc,qconkq,elecfac,altelecfac
13659 real qconm,qconn,cfce15,gf8,gf4i,gf3p5,gf1a,gf1p5,qdiff,argrcnw
13660 real c4,bradp,bl2,bt2,dthr,hrifac, hdia0,hdia1,civenta,civentb
13661 real civentc,civentd,civente,civentf,civentg,cireyn,xcivent
13662 real cipventa,cipventb,cipventc,cipventd,cipreyn,cirventa
13664 integer igmrwa,igmrwb,igmswa, igmswb,igmfwa,igmfwb,igmhwa,igmhwb
13665 real rwventa ,rwventb,swventa,swventb,fwventa,fwventb,fwventc
13666 real hwventa,hwventb
13667 real hwventc, hlventa, hlventb, hlventc
13668 real glventa, glventb, glventc
13669 real gmventa, gmventb, gmventc, ghventa, ghventb, ghventc
13670 real dzfacp, dzfacm, cmassin, cwdiar
13671 real rimmas, rhobar
13672 real argtim, argqcw, argqxw, argtem
13673 real frcswsw, frcswgl, frcswgm, frcswgh, frcswfw, frcswsw1
13674 real frcglgl, frcglgm, frcglgh, frcglfw, frcglgl1
13675 real frcgmgl, frcgmgm, frcgmgh, frcgmfw, frcgmgm1
13676 real frcghgl, frcghgm, frcghgh, frcghfw, frcghgh1
13677 real frcfwgl, frcfwgm, frcfwgh, frcfwfw, frcfwfw1
13678 real frcswrsw, frcswrgl, frcswrgm, frcswrgh, frcswrfw
13680 real frcrswsw, frcrswgl, frcrswgm, frcrswgh, frcrswfw
13682 real frcglrgl, frcglrgm, frcglrgh, frcglrfw, frcglrgl1
13684 real frcrglgm, frcrglgh, frcrglfw, frcrglgl1
13685 real frcgmrgl, frcgmrgm, frcgmrgh, frcgmrfw, frcgmrgm1
13686 real frcrgmgl, frcrgmgm, frcrgmgh, frcrgmfw, frcrgmgm1
13687 real total, qweps, gf2a, gf4a, dqldt, dqidt, dqdt
13688 real frcghrgl, frcghrgm, frcghrgh, frcghrfw, frcghrgh1, frcrghgl
13689 real frcrghgm, frcrghgh, frcrghfw, frcrghgh1
13690 real a1,a2,a3,a4,a5,a6
13692 real cdw, cdi, denom1, denom2, delqci1, delqip1
13693 real cirtotn, ciptotn, cgmtotn, chltotn, cirtotp
13694 real cgmfac, chlfac, cirfac
13695 integer igmhla, igmhlb, igmgla, igmglb, igmgma, igmgmb
13696 integer igmgha, igmghb
13697 integer idqis, item, itim0
13698 integer iqgl, iqgm, iqgh, iqrw, iqsw
13705 integer cntnic_noliq
13706 real q_noliqmn, q_noliqmx
13707 real scsacimn, scsacimx
13713 real :: xden,xmlt,cmlt,cmlttot,fventm,fventh,am,ah,felfinv,dmwdt
13715 real :: qhmlrtmp,qhmlrtmp2, chmlrtmp, chmlrtmpd1inf, chlmlrtmp, zhlmlrtmp, zhlmlrrtmp, qvs0,tmpcmlt
13717 real :: term1,term2,term3,term4
13721 real,
parameter :: c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0
13722 real,
parameter :: c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5
13723 real,
parameter :: c1hl=3.7, c2hl=0.3, c3hl=9.0, c4hl=6.5, c5hl=1.0, c6hl=6.5
13727 real :: galpha, dgalpha
13729 logical,
parameter :: newton = .false.
13732 galpha(a_in) = ((4. + a_in)*(5. + a_in)*(6. + a_in))/((1. + a_in)*(2. + a_in)*(3. + a_in))
13733 dgalpha(a_in) = (876. + 1260.*a_in + 621.*a_in**2 + 126.*a_in**3 + 9.*a_in**4)/ &
13734 & (36. + 132.*a_in + 193.*a_in**2 + 144.*a_in**3 + 58.*a_in**4 + 12.*a_in**5 + a_in**6)
13764 lrescalelow(:) = rescale_low_alpha
13765 lrescalelow(lr) = rescale_low_alphar .and. rescale_low_alpha
13766 lrescalelow(lh) = rescale_low_alphah .and. rescale_low_alpha
13767 IF ( lf > 1 ) lrescalelow(lf) = rescale_low_alphah .and. rescale_low_alpha
13768 IF ( lhl > 1 ) lrescalelow(lhl) = rescale_low_alphahl .and. rescale_low_alpha
13775 IF ( ngs .lt. nz )
THEN
13789 ldovol = ldovol .or. ( lvol(il) .gt. 1 )
13827 bradcw = 0.26249e+06
13828 cradcw = -1.8896e+10
13829 dradcw = 4.4626e+14
13843 gf1p5 = 0.8862269255
13851 gf4br = 17.837861981813607
13852 gf4ds = 10.41688578110938
13853 gf4p5 = 11.63172839656745
13854 gf3ds = 3.0458730354120997
13855 gf1ds = 0.8863557896089221
13857 gf43rds = 0.8929795116
13858 gf53rds = 0.9027452930
13859 gf73rds = 1.190639349
13860 gf83rds = 1.504575488
13862 gamice73fac = (
gamma_sp(7./3. + cinu))**3/ (
gamma_sp(1. + cinu)**3 * (1. + cinu)**4)
13863 gamsnow73fac = (
gamma_sp(7./3. + snu))**3/ (
gamma_sp(1. + snu)**3 * (1. + snu)**4)
13876 bfnu1 = (4. + alphar)*(5. + alphar)*(6. + alphar)/ &
13877 & ((1. + alphar)*(2. + alphar)*(3. + alphar))
13879 galpharaut = (6.+alpharaut)*(5.+alpharaut)*(4.+alpharaut)/ &
13880 & ((3.+alpharaut)*(2.+alpharaut)*(1.+alpharaut))
13882 vfrz = 0.523599*(dfrz)**3
13883 vmlt = min(xvmx(lr), 0.523599*(dmlt)**3 )
13884 vshd = min(xvmx(lr), 0.523599*(dshd)**3 )
13886 IF ( snowmeltdia > 0.0 )
THEN
13887 snowmeltmass = pi/6.0 * 1000. * snowmeltdia**3
13894 IF ( mixedphase )
THEN
13913 mltmass0inv = 1.0/( 1000.0* xvmx(lr) )
13914 mltmass1inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize1)**3) )
13915 mltmass2inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize2)**3) )
13916 mltmass3inv = 1.0/( 1000.0*(4.0*pi/3.0)*((0.01*0.5*takshedsize3)**3) )
13917 mltmass1cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize1)**3)
13918 mltmass2cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize2)**3)
13919 mltmass3cgs = 1.0*(4.0*pi/3.0)*((0.5*takshedsize3)**3)
13923 IF ( ibinnum == 1 )
THEN
13925 mltdiam(1) = 4.5e-3
13926 ELSEIF ( ibinnum == 2 )
THEN
13928 mltdiam(1) = mltdiam1/6.
13929 mltdiam(2) = mltdiam1/2.
13930 ELSEIF ( ibinnum > 2 )
THEN
13931 numdiam = min(ibinnum, ndiam)
13933 mltdiam(k) = (k - 0.5)*mltdiam1/float(numdiam)
13938 mltdiam(1) = 0.5e-3
13939 mltdiam(2) = 1.0e-3
13940 mltdiam(3) = 2.0e-3
13941 mltdiam(4) = 4.0e-3
13942 mltdiam(5) = 6.0e-3
13946 IF ( numshedregimes == 2 )
THEN
13947 mltdiam(ndiam+1) = mltdiam1
13948 mltdiam(ndiam+2) = mltdiam3
13949 mltdiam(ndiam+3) = mltdiam4
13950 ELSEIF ( numshedregimes == 3 )
THEN
13951 mltdiam(ndiam+1) = mltdiam1
13952 mltdiam(ndiam+2) = mltdiam2
13953 mltdiam(ndiam+3) = mltdiam3
13954 mltdiam(ndiam+4) = mltdiam4
13965 mwfac = 6.0**(1./3.)
13966 IF ( ipconc .ge. 2 )
THEN
13971 rwmasn = xvmn(lr)*1000.
13972 rwmasx = xvmx(lr)*1000.
13974 IF ( biggsnowdiam > 0.0 )
THEN
13975 xvbiggsnow = (pi/6.0)*biggsnowdiam**3
13977 xvbiggsnow = xvmn(lh)
13983 cimasn = min(cimas0, cimas1)
14021 IF ( ipconc < 2 )
THEN
14024 t9(ix,jy,kz) = an(ix,jy,kz,lc)
14032 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: ENTER GATHER STAGE'
14039 numgs = nxz/ngs + 1
14042 do 1000 inumgs = 1,numgs
14046 do ix = nxmpb,itile
14048 pqs(1) = t00(ix,jy,kz)
14049 pres(1) = pn(ix,jy,kz) + pb(kz)
14051 theta(1) = an(ix,jy,kz,lt)
14052 temg(1) = t0(ix,jy,kz)
14053 temcg(1) = temg(1) - tfr
14054 tqvcon = temg(1)-cbw
14055 ltemq = (temg(1)-163.15)/fqsat + 1.5
14056 ltemq = min( nqsat, max(1,ltemq) )
14057 IF ( iqvsopt == 0 )
THEN
14058 qvs(1) = pqs(1)*tabqvs(ltemq)
14059 ELSEIF ( iqvsopt == 1 )
THEN
14060 qvs(1) = rdorv*esbolton*tabqvs(ltemq)/(pres(1) - esbolton*tabqvs(ltemq))
14063 IF ( iqis0 == 1 .or. temg(1) <= tfr+0.5 )
THEN
14064 qis(1) = pqs(1)*tabqis(ltemq)
14066 ltemq = (tfr - 163.15)/fqsat + 1.5
14067 qis(1) = pqs(1)*tabqis(ltemq)
14072 if ( temg(1) .lt. tfr )
then
14077 IF ( lhl > 1 )
THEN
14078 IF ( an(ix,jy,kz,lhl) .gt. qxmin(lhl) ) ishail = .true.
14083 if ( an(ix,jy,kz,lv) .gt. qss(1) .or. &
14084 & an(ix,jy,kz,lc) .gt. qxmin(lc) .or. &
14085 & an(ix,jy,kz,li) .gt. qxmin(li) .or. &
14086 & an(ix,jy,kz,lr) .gt. qxmin(lr) .or. &
14087 & an(ix,jy,kz,ls) .gt. qxmin(ls) .or. &
14088 & an(ix,jy,kz,lh) .gt. qxmin(lh) .or. ishail )
then
14089 ngscnt = ngscnt + 1
14092 if ( ngscnt .eq. ngs )
goto 1100
14099 if ( ngscnt .eq. 0 )
go to 9998
14101 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: dbg = 5, ngscnt = ',ngscnt
14108 vtxbar(:,:,:) = 0.0
14112 IF ( lnhf > 1 .or. lnhlf > 1 ) chxf(:,:) = 0.0
14116 rimdn(mgs,il) = rimedens
14122 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: dbg = def temps'
14124 kgsm(mgs) = max(kgs(mgs)-1,1)
14125 kgsp(mgs) = min(kgs(mgs)+1,nz-1)
14126 kgsm2(mgs) = max(kgs(mgs)-2,1)
14127 theta0(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
14128 thetap(mgs) = an(igs(mgs),jy,kgs(mgs),lt) - theta0(mgs)
14129 theta(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
14130 qv0(mgs) = an(igs(mgs),jy,kgs(mgs),lv)
14131 qwvp(mgs) = an(igs(mgs),jy,kgs(mgs),lv) - qv0(mgs)
14133 pres(mgs) = pn(igs(mgs),jy,kgs(mgs)) + pb(kgs(mgs))
14134 pipert(mgs) = p2(igs(mgs),jy,kgs(mgs))
14135 rho0(mgs) = dn(igs(mgs),jy,kgs(mgs))
14136 rhoinv(mgs) = 1.0/rho0(mgs)
14137 rhovt(mgs) = sqrt(rho00/max(0.05,rho0(mgs)))
14138 pi0(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
14139 temg(mgs) = t0(igs(mgs),jy,kgs(mgs))
14140 temgkm1(mgs) = t0(igs(mgs),jy,kgsm(mgs))
14141 temgkm2(mgs) = t0(igs(mgs),jy,kgsm2(mgs))
14142 pk(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
14143 temcg(mgs) = temg(mgs) - tfr
14144 qss0(mgs) = (380.0)/(pres(mgs))
14145 pqs(mgs) = (380.0)/(pres(mgs))
14146 ltemq = (temg(mgs)-163.15)/fqsat+1.5
14147 ltemq = min( nqsat, max(1,ltemq) )
14149 IF ( iqvsopt == 0 )
THEN
14150 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
14151 ELSEIF ( iqvsopt == 1 )
THEN
14152 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
14155 IF ( iqis0 == 1 .or. temg(mgs) <= tfr+0.5 )
THEN
14156 qis(mgs) = pqs(mgs)*tabqis(ltemq)
14158 ltemq = (tfr - 163.15)/fqsat + 1.5
14159 qis(mgs) = pqs(mgs)*tabqis(ltemq)
14161 qss(mgs) = qvs(mgs)
14164 cnostmp(mgs) = cno(ls)
14168 if ( temg(mgs) .lt. tfr )
then
14173 IF ( ipconc < 1 .and. lwsm6 )
THEN
14175 tmp = min( 0.0, temcg(mgs) )
14176 cnostmp(mgs) = min( 2.e8, 2.e6*exp(0.12*tmp) )
14192 qx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),il), 0.0)
14208 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*)
'ICEZVD_GS: dbg = 5b'
14210 if ( ipconc .ge. 1 )
then
14212 cx(mgs,li) = max(an(igs(mgs),jy,kgs(mgs),lni), 0.0)
14213 IF ( qx(mgs,li) .le. qxmin(li) )
THEN
14217 IF ( lcina .gt. 1 )
THEN
14218 cina(mgs) = an(igs(mgs),jy,kgs(mgs),lcina)
14220 cina(mgs) = cx(mgs,li)
14222 IF ( lcin > 1 )
THEN
14223 ccin(mgs) = an(igs(mgs),jy,kgs(mgs),lcin)
14227 if ( ipconc .ge. 2 )
then
14229 cx(mgs,lc) = max(an(igs(mgs),jy,kgs(mgs),lnc), 0.0)
14231 IF ( qx(mgs,lc) .le. qxmin(lc) )
THEN
14234 IF ( lss > 1 )
THEN
14235 ssmax(mgs) = an(igs(mgs),jy,kgs(mgs),lss)
14237 IF ( lccn .gt. 1 )
THEN
14238 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
14242 IF ( lccna .gt. 1 )
THEN
14243 ccna(mgs) = an(igs(mgs),jy,kgs(mgs),lccna)
14245 ccna(mgs) = cx(mgs,lc)
14251 if ( ipconc .ge. 3 )
then
14253 cx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lnr), 0.0)
14254 IF ( qx(mgs,lr) .le. qxmin(lr) )
THEN
14256 ELSEIF ( cx(mgs,lr) .eq. 0.0 .and. qx(mgs,lr) .lt. 3.0*qxmin(lr) )
THEN
14257 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lr)
14260 cx(mgs,lr) = max( 1.e-9, cx(mgs,lr) )
14264 if ( ipconc .ge. 4 )
then
14266 cx(mgs,ls) = max(an(igs(mgs),jy,kgs(mgs),lns), 0.0)
14267 IF ( qx(mgs,ls) .le. qxmin(ls) )
THEN
14269 ELSEIF ( cx(mgs,ls) .eq. 0.0 .and. qx(mgs,ls) .lt. 3.0*qxmin(ls) )
THEN
14270 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,ls)
14273 cx(mgs,ls) = max( 1.e-9, cx(mgs,ls) )
14275 IF ( ilimit .ge. ipc(ls) )
THEN
14276 tmp = (xdn0(ls)*cx(mgs,ls))/(rho0(mgs)*qx(mgs,ls))
14277 tmp2 = (tmp*(3.14159))**(1./3.)
14278 cnox = cx(mgs,ls)*(tmp2)
14279 IF ( cnox .gt. 3.0*cno(ls) )
THEN
14280 cx(mgs,ls) = 3.0*cno(ls)/tmp2
14286 if ( ipconc .ge. 5 )
then
14289 cx(mgs,lh) = max(an(igs(mgs),jy,kgs(mgs),lnh), 0.0)
14290 IF ( qx(mgs,lh) .le. qxmin(lh) )
THEN
14292 ELSEIF ( cx(mgs,lh) .eq. 0.0 .and. qx(mgs,lh) .lt. 3.0*qxmin(lh) )
THEN
14293 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lh)
14296 cx(mgs,lh) = max( 1.e-9, cx(mgs,lh) )
14297 IF ( ilimit .ge. ipc(lh) )
THEN
14298 tmp = (xdn0(lh)*cx(mgs,lh))/(rho0(mgs)*qx(mgs,lh))
14299 tmp2 = (tmp*(3.14159))**(1./3.)
14300 cnox = cx(mgs,lh)*(tmp2)
14301 IF ( cnox .gt. 3.0*cno(lh) )
THEN
14302 cx(mgs,lh) = 3.0*cno(lh)/tmp2
14313 if ( lhl .gt. 1 .and. ipconc .ge. 5 )
then
14316 cx(mgs,lhl) = max(an(igs(mgs),jy,kgs(mgs),lnhl), 0.0)
14317 IF ( qx(mgs,lhl) .le. qxmin(lhl) )
THEN
14319 ELSEIF ( cx(mgs,lhl) .eq. 0.0 .and. qx(mgs,lhl) .lt. 3.0*qxmin(lhl) )
THEN
14320 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,lhl)
14323 cx(mgs,lhl) = max( 1.e-9, cx(mgs,lhl) )
14324 IF ( ilimit .ge. ipc(lhl) )
THEN
14325 tmp = (xdn0(lhl)*cx(mgs,lhl))/(rho0(mgs)*qx(mgs,lhl))
14326 tmp2 = (tmp*(3.14159))**(1./3.)
14327 cnox = cx(mgs,lhl)*(tmp2)
14328 IF ( cnox .gt. 3.0*cno(lhl) )
THEN
14329 cx(mgs,lhl) = 3.0*cno(lhl)/tmp2
14347 IF ( lvol(il) .ge. 1 )
THEN
14350 vx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),lvol(il)), 0.0)
14373 IF ( ipconc .ge. 6 )
THEN
14376 IF ( lz(il) .gt. 1 )
THEN
14378 zx(mgs,il) = max( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
14385 IF ( ipconc .ge. 6 )
THEN
14387 tmp = alphamax - 1.0
14388 g1xmax = (6.0 + tmp)*(5.0 + tmp)*(4.0 + tmp)/ &
14389 & ((3.0 + tmp)*(2.0 + tmp)*(1.0 + tmp))
14390 g1xmin = (6.0 + alphamin)*(5.0 + alphamin)*(4.0 + alphamin)/ &
14391 & ((3.0 + alphamin)*(2.0 + alphamin)*(1.0 + alphamin))
14393 IF ( lz(lr) .lt. 1 )
THEN
14394 g1x(:,lr) = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
14395 & ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
14399 IF ( cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr) )
THEN
14401 vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
14402 IF ( lzr < 1 )
THEN
14403 IF ( imurain == 3 )
THEN
14404 zx(mgs,lr) = 3.6476*(rnu+2.0)*cx(mgs,lr)*vr**2/(rnu+1.0)
14406 zx(mgs,lr) = 3.6476*g1x(mgs,lr)*cx(mgs,lr)*vr**2
14417 IF ( ipconc == 5 )
THEN
14419 g1x(:,lr) = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
14420 & ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
14421 g1x(:,lh) = (6.0 + alphah)*(5.0 + alphah)*(4.0 + alphah)/ &
14422 & ((3.0 + alphah)*(2.0 + alphah)*(1.0 + alphah))
14423 IF ( lhl > 0 )
THEN
14424 g1x(:,lhl) = (6.0 + alphahl)*(5.0 + alphahl)*(4.0 + alphahl)/ &
14425 & ((3.0 + alphahl)*(2.0 + alphahl)*(1.0 + alphahl))
14433 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set alpha'
14434 IF ( imurain == 1 )
THEN
14435 alpha(:,lr) = alphar
14436 ELSEIF ( imurain == 3 )
THEN
14437 alpha(:,lr) = xnu(lr)
14440 alpha(:,li) = xnu(li)
14441 alpha(:,lc) = xnu(lc)
14443 IF ( imusnow == 1 )
THEN
14444 alpha(:,ls) = alphas
14445 ELSEIF ( imusnow == 3 )
THEN
14446 alpha(:,ls) = xnu(ls)
14449 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set dab'
14453 IF ( il .ge. lg ) alpha(mgs,il) = dnu(il)
14457 dab0lh(mgs,il,ic) = dab0(il,ic)
14458 dab1lh(mgs,il,ic) = dab1(il,ic)
14466 da0lx(:,il) = da0(il)
14474 if ( ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'ICEZVD_GS: dbg = set rz'
14476 IF ( lzh < 1 .or. lzhl < 1 )
THEN
14477 rzxhlh(:) = rzhl/rz
14478 ELSEIF ( lzh > 1 .and. lzhl > 1 )
THEN
14481 IF ( lzr > 1 )
THEN
14489 IF ( imurain == 1 .and. imusnow == 3 .and. lzr < 1 )
THEN
14491 ELSEIF ( imurain == imusnow .or. lzr > 1 )
THEN
14496 IF ( lhl .gt. 1 )
THEN
14498 da0lhl(mgs) = da0(lhl)
14503 ventrxn(:) = ventrn
14504 gf1palp(:) =
gamma_sp(1.0 + alphar)
14511 ssi(mgs) = qx(mgs,lv)/qis(mgs)
14512 ssw(mgs) = qx(mgs,lv)/qvs(mgs)
14514 tsqr(mgs) = temg(mgs)**2
14516 temgx(mgs) = min(temg(mgs),313.15)
14517 temgx(mgs) = max(temgx(mgs),233.15)
14518 felv(mgs) = 2500837.367 * (273.15/temgx(mgs))**((0.167)+(3.67e-4)*temgx(mgs))
14520 temcgx(mgs) = min(temg(mgs),273.15)
14521 temcgx(mgs) = max(temcgx(mgs),223.15)
14522 temcgx(mgs) = temcgx(mgs)-273.15
14525 felf(mgs) = 333690.6098 + (2030.61425)*temcgx(mgs) - (10.46708312)*temcgx(mgs)**2
14527 fels(mgs) = felv(mgs) + felf(mgs)
14529 felvs(mgs) = felv(mgs)*felv(mgs)
14530 felss(mgs) = fels(mgs)*fels(mgs)
14532 IF ( eqtset <= 1 )
THEN
14533 felvcp(mgs) = felv(mgs)*cpi
14534 felscp(mgs) = fels(mgs)*cpi
14535 felfcp(mgs) = felf(mgs)*cpi
14541 tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
14542 IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
14543 cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
14546 IF ( eqtset == 2 )
THEN
14547 felvcp(mgs) = (felv(mgs)-rw*temg(mgs))/cvm
14548 felscp(mgs) = (fels(mgs)-rw*temg(mgs))/cvm
14549 felfcp(mgs) = felf(mgs)/cvm
14554 cpm = cp+cpv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
14556 rmm=rd+rw*qx(mgs,lv)
14558 felvcp(mgs) = (felv(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
14559 felscp(mgs) = (fels(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
14560 felfcp(mgs) = felf(mgs)*cv/(cp*cvm)
14562 felvpi(mgs) = pi0(mgs)*rovcp*(felv(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
14563 felspi(mgs) = pi0(mgs)*rovcp*(fels(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
14564 felfpi(mgs) = pi0(mgs)*rovcp*(felf(mgs)/(cvm*temg(mgs)))
14570 fgamw(mgs) = felvcp(mgs)/pi0(mgs)
14571 fgams(mgs) = felscp(mgs)/pi0(mgs)
14573 fcqv1(mgs) = 4098.0258*pi0(mgs)*fgamw(mgs)
14574 fcqv2(mgs) = 5807.6953*pi0(mgs)*fgams(mgs)
14575 fcc3(mgs) = felfcp(mgs)/pi0(mgs)
14578 fwvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)*(101325.0/(pres(mgs)))
14582 fadvisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))*(temg(mgs)/296.0)**(1.5)
14584 fakvisc(mgs) = fadvisc(mgs)*rhoinv(mgs)
14586 temcgx(mgs) = min(temg(mgs),273.15)
14587 temcgx(mgs) = max(temcgx(mgs),233.15)
14588 temcgx(mgs) = temcgx(mgs)-273.15
14589 fci(mgs) = (2.118636 + 0.007371*(temcgx(mgs)))*(1.0e+03)
14591 if ( temg(mgs) .lt. 273.15 )
then
14592 temcgx(mgs) = min(temg(mgs),273.15)
14593 temcgx(mgs) = max(temcgx(mgs),233.15)
14594 temcgx(mgs) = temcgx(mgs)-273.15
14595 fcw(mgs) = 4203.1548 + (1.30572e-2)*((temcgx(mgs)-35.)**2) &
14596 & + (1.60056e-5)*((temcgx(mgs)-35.)**4)
14598 if ( temg(mgs) .ge. 273.15 )
then
14599 temcgx(mgs) = min(temg(mgs),308.15)
14600 temcgx(mgs) = max(temcgx(mgs),273.15)
14601 temcgx(mgs) = temcgx(mgs)-273.15
14602 fcw(mgs) = 4243.1688 + (3.47104e-1)*(temcgx(mgs)**2)
14605 ftka(mgs) = tka0*fadvisc(mgs)/advisc1
14606 fthdf(mgs) = ftka(mgs)*cpi*rhoinv(mgs)
14608 fschm(mgs) = (fakvisc(mgs)/fwvdf(mgs))
14609 fpndl(mgs) = (fakvisc(mgs)/fthdf(mgs))
14611 fai(mgs) = (fels(mgs)**2)/(ftka(mgs)*rw*temg(mgs)**2)
14612 fbi(mgs) = (1.0/(rho0(mgs)*fwvdf(mgs)*qis(mgs)))
14613 fav(mgs) = (felv(mgs)**2)/(ftka(mgs)*rw*temg(mgs)**2)
14614 fbv(mgs) = (1.0/(rho0(mgs)*fwvdf(mgs)*qvs(mgs)))
14616 kp1 = min(nz, kgs(mgs)+1 )
14617 wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1) &
14618 & +w(igs(mgs),jgs,kgs(mgs)))
14630 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set density'
14634 xdn(mgs,li) = xdn0(li)
14635 xdn(mgs,lc) = xdn0(lc)
14636 xdn(mgs,lr) = xdn0(lr)
14637 xdn(mgs,ls) = xdn0(ls)
14638 xdn(mgs,lh) = xdn0(lh)
14639 IF ( lvol(ls) .gt. 1 )
THEN
14640 IF ( vx(mgs,ls) .gt. 0.0 .and. qx(mgs,ls) .gt. qxmin(ls) )
THEN
14641 xdn(mgs,ls) = min( xdnmx(ls), max( xdnmn(ls), rho0(mgs)*qx(mgs,ls)/vx(mgs,ls) ) )
14645 IF ( lvol(lh) .gt. 1 )
THEN
14646 IF ( vx(mgs,lh) .gt. 0.0 .and. qx(mgs,lh) .gt. qxmin(lh) )
THEN
14647 IF ( mixedphase )
THEN
14651 xdn(mgs,lh) = min( dnmx, max( xdnmn(lh), rho0(mgs)*qx(mgs,lh)/vx(mgs,lh) ) )
14652 vx(mgs,lh) = rho0(mgs)*qx(mgs,lh)/xdn(mgs,lh)
14654 ELSEIF ( vx(mgs,lh) == 0.0 .and. qx(mgs,lh) .gt. qxmin(lh) )
THEN
14656 vx(mgs,lh) = rho0(mgs)*qx(mgs,lh)/xdn(mgs,lh)
14662 IF ( lhl .gt. 1 )
THEN
14664 xdn(mgs,lhl) = xdn0(lhl)
14665 xdntmp(mgs,lhl) = xdn0(lhl)
14667 IF ( lvol(lhl) .gt. 1 )
THEN
14668 IF ( vx(mgs,lhl) .gt. 0.0 .and. qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
14670 IF ( mixedphase .and. lhlw > 1 )
THEN
14675 xdn(mgs,lhl) = min( dnmx, max( xdnmn(lhl), rho0(mgs)*qx(mgs,lhl)/vx(mgs,lhl) ) )
14676 vx(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/xdn(mgs,lhl)
14677 xdntmp(mgs,lhl) = xdn(mgs,lhl)
14679 ELSEIF ( vx(mgs,lhl) == 0.0 .and. qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
14681 vx(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/xdn(mgs,lhl)
14691 IF ( ipconc == 5 .and. imydiagalpha == 2 )
THEN
14693 cwchtmp = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
14697 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin )
THEN
14698 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
14699 xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.)
14705 i = int(dgami*(tmp))
14707 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14710 i = int(dgami*(tmp))
14712 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14714 tmp = (x/y)**(1./3.)*xdia(mgs,lr,3)*cwchtmp
14716 alpha(mgs,lr) = min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
14718 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin )
THEN
14720 xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))
14721 xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.)
14726 i = int(dgami*(tmp))
14728 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14731 i = int(dgami*(tmp))
14733 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
14735 tmp = (x/y)**(1./3.)*xdia(mgs,lh,3)*cwchtmp
14737 alpha(mgs,lh) = min(15., 11.8*(1000.*tmp - 0.7)**2 + 2.)
14743 i = nint( alpha(mgs,il)*dqiacralphainv )
14744 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
14745 alp = (3.*alpha(mgs,ic) + 2.)
14746 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
14748 alp = alpha(mgs,ic)
14749 j = nint( alpha(mgs,ic)*dqiacralphainv )
14752 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
14753 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
14754 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
14755 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
14760 IF ( lhl > 0 )
THEN
14761 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) > cxmin )
THEN
14762 xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl))
14763 xdia(mgs,lhl,3) = (xv(mgs,lhl)*6.*piinv)**(1./3.)
14764 IF ( xdia(mgs,lhl,3) < 0.008 )
THEN
14765 alpha(mgs,lhl) = min(alphamax, c1hl*tanh(c2hl*(xdia(mgs,lhl,3)*1000. - c3hl)) + c4hl)
14767 alpha(mgs,lhl) = min(alphamax, c5hl*xdia(mgs,lhl,3)*1000. + c6hl)
14772 i = nint( alpha(mgs,il)*dqiacralphainv )
14773 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
14774 alp = (3.*alpha(mgs,ic) + 2.)
14775 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
14777 alp = alpha(mgs,ic)
14778 j = nint( alpha(mgs,ic)*dqiacralphainv )
14781 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
14782 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
14783 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
14784 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
14796 IF ( imurain == 3 )
THEN
14797 IF ( lzr > 1 )
THEN
14799 alphamlr = -2.0/3.0
14800 alphasmlr = -2.0/3.0
14804 alphasmlr = xnu(lr)
14808 massfacshr = ( (2. + 3.*(1. +alphashr) )**3/( 3.*(1. + alphashr) ) )
14809 massfacmlr = ( (2. + 3.*(1. +alphamlr) )**3/( 3.*(1. + alphamlr) ) )
14810 ELSEIF ( imurain == 1 )
THEN
14811 IF ( lzr > 1 )
THEN
14814 alphasmlr = alphasmlr0
14822 massfacshr = (3.0 + alphashr)**3/((3.+alphashr)*(2.+alphashr)*(1. + alphashr) )
14823 massfacmlr = (3.0 + alphamlr)**3/((3.+alphamlr)*(2.+alphamlr)*(1. + alphamlr) )
14834 IF ( ipconc >= 6 )
THEN
14837 IF ( ipconc >= 6 .and. imurain == 3 )
THEN
14841 g1x(mgs,il) = (alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0))
14846 IF ( imurain == 3 )
THEN
14847 g1shr = (alphashr+2.0)/((alphashr+1.0))
14848 g1mlr = (alphamlr+2.0)/((alphamlr+1.0))
14849 g1smlr = (alphasmlr+2.0)/((alphasmlr+1.0))
14850 ELSEIF ( imurain == 1 )
THEN
14853 g1shr = (6.0 + alphashr)*(5.0 + alphashr)*(4.0 + alphashr)/ &
14854 & ((3.0 + alphashr)*(2.0 + alphashr)*(1.0 + alphashr))
14857 g1mlr = (6.0 + alphamlr)*(5.0 + alphamlr)*(4.0 + alphamlr)/ &
14858 & ((3.0 + alphamlr)*(2.0 + alphamlr)*(1.0 + alphamlr))
14859 g1smlr = (6.0 + alphasmlr)*(5.0 + alphasmlr)*(4.0 + alphasmlr)/ &
14860 & ((3.0 + alphasmlr)*(2.0 + alphasmlr)*(1.0 + alphasmlr))
14864 IF ( lzr > 1 .and. imurain == 3 )
THEN
14872 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
14873 IF ( zx(mgs,il) <= zxmin )
THEN
14877 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14878 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14879 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14880 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
14883 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14886 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14887 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14888 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14890 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
14892 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
14895 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
14896 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
14897 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
14901 IF ( .false. .and. zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
14904 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
14907 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
14908 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14909 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14912 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
14914 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
14915 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
14918 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
14919 xv(mgs,lr) = xvmn(lr)
14920 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
14923 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
14925 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14928 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
14930 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
14932 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14935 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
14936 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
14938 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
14942 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
14943 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
14945 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14948 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
14949 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
14952 IF ( zx(mgs,lr) > 0.0 )
THEN
14953 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
14963 IF ( z .gt. 0.0 )
THEN
14965 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14967 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
14968 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
14969 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
14970 alp = max( rnumin, min( rnumax, alp ) )
14974 IF ( (xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) ))
THEN
14976 IF ( ioldlimiter >= 2 )
THEN
14977 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
14978 x1 = max(0.0e-3, x - 3.0e-3)
14979 x2 = max(0.5, x/6.0e-3)
14981 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
14982 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
14984 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
14985 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
14986 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
14991 IF ( tmp < cx(mgs,il) )
THEN
14993 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
14994 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
14995 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15004 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
15006 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
15007 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
15008 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
15009 alp = max( rnumin, min( rnumax, alp ) )
15020 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
15021 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
15023 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
15024 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
15025 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
15027 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
15028 z = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
15030 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
15038 IF ( alp >= rnumax - 0.01 )
THEN
15041 g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
15046 tmp = alpha(mgs,lr) + 4./3.
15047 i = int(dgami*(tmp))
15049 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
15051 tmp = alpha(mgs,lr) + 1.
15052 i = int(dgami*(tmp))
15054 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
15059 ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
15061 IF ( imurain == 3 .and. izwisventr == 2 )
THEN
15063 tmp = alpha(mgs,lr) + 1.5 + br/6.
15064 i = int(dgami*(tmp))
15066 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
15069 ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
15097 IF ( ipconc .ge. 6 )
THEN
15102 IF ( (.not. ( il == lr .and. imurain == 3 )) .and. ( il == lr .or. il == lh .or. il == lhl .or. il == lf ) )
THEN
15104 g1x(mgs,il) = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
15105 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
15109 IF ( lz(il) .gt. 1 .and. ( .not. ( il == lr .and. imurain == 3 )) )
THEN
15114 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
15115 IF ( zx(mgs,il) <= zxmin )
THEN
15120 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
15121 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
15122 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
15123 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15124 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
15127 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
15130 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
15131 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
15132 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15134 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
15135 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
15139 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
15140 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
15141 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15142 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
15146 IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
15149 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
15152 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
15153 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
15154 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15157 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
15159 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*max(1.0e-9,cx(mgs,il)))
15160 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
15162 IF ( xv(mgs,il) .lt. xvmn(il) )
THEN
15163 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
15164 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
15165 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
15168 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
15170 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
15171 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
15175 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
15177 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin )
THEN
15185 g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
15186 & ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
15187 zx(mgs,il) = max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
15188 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15190 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
15194 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
15195 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15197 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
15198 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
15202 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
15203 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
15210 IF ( zx(mgs,il) .gt. 0. )
THEN
15213 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
15217 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
15218 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
15220 alp = max( alphamin, min( alphamax, alp ) )
15224 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
15225 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
15226 alp = alp + ( galpha(alp) - rdi )/dgalpha(alp)
15227 alp = max( alphamin, min( alphamax, alp ) )
15233 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
15234 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
15237 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
15238 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
15240 alp = max( alphamin, min( alphamax, alp ) )
15246 IF ( imaxdiaopt == 1 .or. il /= lr )
THEN
15247 xvbarmax = xvmx(il)
15248 ELSEIF ( imaxdiaopt == 2 )
THEN
15249 xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
15250 ELSEIF ( imaxdiaopt == 3 )
THEN
15251 xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
15253 xvbarmax = xvmx(il)
15256 IF ( xv(mgs,il) .gt. xvbarmax .or. (il == lr .and. ioldlimiter >= 2 .and. xv(mgs,il) .gt. xvmx(il)/8.))
THEN
15258 IF( ioldlimiter >= 2 .and. il == lr)
THEN
15259 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
15260 x1 = max(0.0e-3, x - 3.0e-3)
15261 x2 = max(0.5, x/6.0e-3)
15263 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
15264 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
15266 xv(mgs,il) = min( xvbarmax, max( xvmn(il),xv(mgs,il) ) )
15267 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
15268 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
15270 IF ( tmp < cx(mgs,il) )
THEN
15271 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
15272 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
15276 tmpz = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/tmp
15277 IF ( tmpz > zx(mgs,il) )
THEN
15278 tmpc = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/zx(mgs,il)
15279 cx(mgs,il) = max(cx(mgs,il), tmpc)
15282 zx(mgs,il) = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/cx(mgs,il)
15283 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
15289 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
15290 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
15291 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
15293 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
15294 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
15295 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
15296 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
15297 alp = max( alphamin, min( alphamax, alp ) )
15308 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
15309 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
15311 IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and. &
15312 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
15316 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
15317 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
15318 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
15320 ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
15321 .not. ( il == lr .and. .not. rescale_low_alphar ) )
THEN
15323 IF ( irescalerainopt == 0 )
THEN
15325 ELSEIF ( irescalerainopt == 1 )
THEN
15326 wtest = qx(mgs,lc) > qxmin(lc)
15327 ELSEIF ( irescalerainopt == 2 )
THEN
15328 wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
15329 ELSEIF ( irescalerainopt == 3 )
THEN
15330 wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
15333 IF ( il == lr .and. ( wtest ) )
THEN
15337 chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
15339 an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
15343 z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
15344 z = z1*(6./(pi*xdn(mgs,il)))**2
15346 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
15358 IF ( alp >= alphamax - 0.5 )
THEN
15361 g1x(mgs,il) = (pi*xdn(mgs,il))**2*zx(mgs,il)*cx(mgs,il)/((6.*rho0(mgs)*qx(mgs,il))**2)
15377 IF ( il == lr )
THEN
15393 tmp = alpha(mgs,lr) + 1.
15394 i = int(dgami*(tmp))
15396 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
15400 IF ( iferwisventr == 2 )
THEN
15402 tmp = alpha(mgs,lr) + 2.5 + br/2.
15403 i = int(dgami*(tmp))
15405 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
15437 IF ( .not. ( il == lr .and. imurain == 3 ) )
THEN
15440 IF ( qx(mgs,il) > qxmin(il) )
THEN
15441 xnutmp = (alpha(mgs,il) - 2.)/3.
15445 IF ( il .ne. ic .and. qx(mgs,ic) .gt. qxmin(ic))
THEN
15447 IF ( ic == lc .and. idiagnosecnu > 0 ) xnuc = alpha(mgs,lc)
15448 IF ( il /= lr .and. ic == lr .and. lzr > 1 )
THEN
15449 IF ( imurain == 3 )
THEN
15450 xnuc = alpha(mgs,lr)
15452 xnuc = ( alpha(mgs,lr) - 2. )/3.
15456 IF ( .false. )
THEN
15457 dab0lh(mgs,ic,il) =
delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 0)
15458 dab1lh(mgs,ic,il) =
delabk(bb(ic), bb(il), xnuc, xnutmp, xmu(ic), xmu(il), 1)
15459 dab0lh(mgs,il,ic) =
delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 0)
15460 dab1lh(mgs,il,ic) =
delabk(bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic), 1)
15462 i = nint( alpha(mgs,il)*dqiacralphainv )
15463 IF ( ic == lc .or. ic == li .or. ic == ls .or. (ic == lr .and. imurain == 3) )
THEN
15464 alp = (3.*alpha(mgs,ic) + 2.)
15465 j = nint( (3.*alpha(mgs,ic) + 2.)*dqiacralphainv )
15467 alp = alpha(mgs,ic)
15468 j = nint( alpha(mgs,ic)*dqiacralphainv )
15471 dab0lh(mgs,ic,il) = dab0lu(j,i,ic,il)
15472 dab1lh(mgs,ic,il) = dab1lu(j,i,ic,il)
15473 dab0lh(mgs,il,ic) = dab0lu(i,j,il,ic)
15474 dab1lh(mgs,il,ic) = dab1lu(i,j,il,ic)
15485 IF ( .false. .and. ny <= 2 )
THEN
15487 write(0,*)
'bb: ', bb(il), bb(ic), xnutmp, xnuc, xmu(il), xmu(ic)
15488 write(0,*)
'il,ic = ',il,ic,alpha(mgs,il),i,xnuc,alp,j
15489 write(0,*)
'dab0lh,tmp1 = ',dab0lh(mgs,ic,il),tmp1
15490 write(0,*)
'dab1lh,tmp2 = ',dab1lh(mgs,ic,il),tmp2
15491 write(0,*)
'dab0lh,tmp3 = ',dab0lh(mgs,il,ic),tmp3,tmp5
15492 write(0,*)
'dab1lh,tmp4 = ',dab1lh(mgs,il,ic),tmp4,tmp6
15503 da0lx(mgs,il) =
delbk(bb(il), xnutmp, xmu(il), 0)
15504 IF ( il .eq. lh )
THEN
15505 da0lh(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
15506 IF ( lzr > 1 )
THEN
15509 rzxh(mgs) = ((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
15510 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
15513 IF ( lzhl < 1 )
THEN
15514 rzxhlh(mgs) = rzxhl(mgs)/(((4. + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
15515 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr))))
15517 ELSEIF ( il .eq. lhl )
THEN
15518 da0lhl(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
15519 IF ( lzr > 1 )
THEN
15522 rzxhl(mgs) = ((4.0 + alpha(mgs,il))*(5. + alpha(mgs,il))*(6. + alpha(mgs,il))*(1. + xnu(lr)))/ &
15523 & ((1. + alpha(mgs,il))*(2. + alpha(mgs,il))*(3. + alpha(mgs,il))*(2. + xnu(lr)))
15525 ELSEIF ( il == lr )
THEN
15526 xnutmp = (alpha(mgs,il) - 2.)/3.
15527 da0lr(mgs) =
delbk(bb(il), xnutmp, xmu(il), 0)
15528 da1lr(mgs) =
delbk(bb(il), xnutmp, xmu(il), 1)
15550 kp1 = min(nz, kgs(mgs)+1 )
15555 wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs)) &
15556 & +w(igs(mgs),jgs,kgsm(mgs)))
15557 cninm(mgs) = t7(igs(mgs),jgs,kgsm(mgs))
15558 cnina(mgs) = t7(igs(mgs),jgs,kgs(mgs))
15559 cninp(mgs) = t7(igs(mgs),jgs,kgsp(mgs))
15577 IF ( rimdenvwgt > 0 ) infdo = 1
15579 call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp, &
15580 & xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs, &
15581 & ipconc,ndebug,ngs,nz,igs,kgs,fadvisc, &
15582 & cwmasn,cwmasx,cwradn,cnina,cimn,cimx, &
15583 & itype1,itype2,temcg,infdo,alpha,axx,bxx,0)
15587 IF ( lwsm6 .and. ipconc == 0 )
THEN
15588 tmp = max(qxmin(lh), qxmin(ls))
15590 total = qx(mgs,lh) + qx(mgs,ls)
15591 IF ( total > tmp )
THEN
15592 vt2ave(mgs) = (qx(mgs,lh)*vtxbar(mgs,lh,1) + qx(mgs,ls)*vtxbar(mgs,ls,1))/total
15603 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set concentration'
15604 IF ( ipconc .lt. 1 )
THEN
15605 cina(1:ngscnt) = cx(1:ngscnt,li)
15607 if ( ipconc .lt. 5 )
then
15611 IF ( ipconc .lt. 3 )
THEN
15613 if ( qx(mgs,lr) .gt. qxmin(lh) )
then
15619 IF ( ipconc .lt. 4 )
THEN
15622 if ( qx(mgs,ls) .gt. qxmin(ls) )
then
15628 IF ( ipconc .lt. 5 )
THEN
15632 if ( qx(mgs,lh) .gt. qxmin(lh) )
then
15643 IF ( ipconc .ge. 2 )
THEN
15646 rb(mgs) = 0.5*xdia(mgs,lc,1)*(1./(1.+alpha(mgs,lc)))**(1./6.)
15647 xl2p(mgs) = max(0.0d0, 2.7e-2*xdn(mgs,lc)*cx(mgs,lc)*xv(mgs,lc)* &
15648 & ((0.5e20*rb(mgs)**3*xdia(mgs,lc,1))-0.4) )
15649 IF ( rb(mgs) .gt. 3.51e-6 )
THEN
15651 rh(mgs) = max( 41.d-6, 6.3d-4/(1.d6*(rb(mgs) - 3.5d-6)) )
15655 IF ( xl2p(mgs) .gt. 0.0 )
THEN
15656 nh(mgs) = 4.2d9*xl2p(mgs)
15670 if( ndebug .ge. 0 )
THEN
15674 qvimxd(mgs) = 0.70*(qx(mgs,lv)-qis(mgs))*dtpinv
15676 IF ( qx(mgs,lc) < qxmin(lc) ) qvimxd(mgs) = 0.99*(qx(mgs,lv)-qis(mgs))*dtpinv
15678 qvimxd(mgs) = max(qvimxd(mgs), 0.0)
15681 qimxd(mgs) = frac*qx(mgs,li)*dtpinv
15682 qcmxd(mgs) = frac*qx(mgs,lc)*dtpinv
15683 qrmxd(mgs) = frac*qx(mgs,lr)*dtpinv
15684 qsmxd(mgs) = frac*qx(mgs,ls)*dtpinv
15685 qhmxd(mgs) = frac*qx(mgs,lh)*dtpinv
15686 IF ( lhl > 1 ) qhlmxd(mgs) = frac*qx(mgs,lhl)*dtpinv
15689 if( ndebug .ge. 0 )
THEN
15695 if ( qx(mgs,lc) .le. qxmin(lc) )
then
15696 ccmxd(mgs) = 0.20*cx(mgs,lc)*dtpinv
15698 IF ( ipconc .ge. 2 )
THEN
15699 ccmxd(mgs) = frac*cx(mgs,lc)*dtpinv
15701 ccmxd(mgs) = frac*qx(mgs,lc)/(xmas(mgs,lc)*rho0(mgs)*dtp)
15705 if ( qx(mgs,li) .le. qxmin(li) )
then
15706 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15708 IF ( ipconc .ge. 1 )
THEN
15709 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15711 cimxd(mgs) = frac*qx(mgs,li)/(xmas(mgs,li)*rho0(mgs)*dtp)
15716 crmxd(mgs) = 0.10*cx(mgs,lr)*dtpinv
15717 csmxd(mgs) = frac*cx(mgs,ls)*dtpinv
15718 chmxd(mgs) = frac*cx(mgs,lh)*dtpinv
15720 ccmxd(mgs) = frac*cx(mgs,lc)*dtpinv
15721 cimxd(mgs) = frac*cx(mgs,li)*dtpinv
15722 crmxd(mgs) = frac*cx(mgs,lr)*dtpinv
15723 csmxd(mgs) = frac*cx(mgs,ls)*dtpinv
15724 chmxd(mgs) = frac*cx(mgs,lh)*dtpinv
15726 qxmxd(mgs,lv) = max(0.0, 0.1*(qx(mgs,lv) - qvs(mgs))*dtpinv)
15729 qxmxd(mgs,il) = frac*qx(mgs,il)*dtpinv
15730 cxmxd(mgs,il) = frac*cx(mgs,il)*dtpinv
15738 IF ( ipconc >= 6 )
THEN
15742 IF ( lz(il) > 0 .or. ( il == lr ) )
THEN
15744 zxmxd(mgs,il) = frac*zx(mgs,il)*dtpinv
15754 maxmassfac(lc) = ( (2. + 3.*(1. + xnu(lc)) )**3/( 3.*(1. + xnu(lc)) ) )
15755 maxmassfac(li) = ( (2. + 3.*(1. + xnu(li)) )**3/( 3.*(1. + xnu(li)) ) )
15757 IF ( imurain == 3 )
THEN
15758 maxmassfac(lr) = ( (2. + 3.*(1. + xnu(lr)) )**3/( 3.*(1. + xnu(lr)) ) )
15760 maxmassfac(lr) = (3.0 + alphar)**3/ &
15761 & ((3.+alphar)*(2.+alphar)*(1. + alphar) )
15764 IF ( imusnow == 3 )
THEN
15765 maxmassfac(ls) = ( (2. + 3.*(1. + alphas) )**3/( 3.*(1. + alphas) ) )
15767 maxmassfac(ls) = (3.0 + alphas)**3/ &
15768 & ((3.+alphas)*(2.+alphas)*(1. + alphas) )
15771 maxmassfac(lh) = (3.0 + alphah)**3/ &
15772 & ((3.+alphah)*(2.+alphah)*(1. + alphah) )
15774 IF ( lhl > 1 )
THEN
15775 maxmassfac(lhl) = (3.0 + alphahl)**3/ &
15776 & ((3.+alphahl)*(2.+alphahl)*(1. + alphahl) )
15784 vshdgs(mgs,il) = vshd
15786 IF ( qx(mgs,il) > qxmin(il) .and. ivshdgs > 0 )
THEN
15790 tmpdiam = (shedalp+0.0)*xdia(mgs,il,1)
15792 IF ( tmpdiam > sheddiam0 )
THEN
15793 vshdgs(mgs,il) = 0.523599*(1.5e-3)**3/massfacshr
15794 ELSEIF ( tmpdiam > sheddiam )
THEN
15795 vshdgs(mgs,il) = 0.523599*(3.0e-3)**3/massfacshr
15798 vshdgs(mgs,il) = min( xvmx(lr), 6./pi*xdn(mgs,il)*0.001*tmpdiam**3 )/massfacshr
15812 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: Set collection efficiencies'
15856 ehlsclsn(mgs) = 0.0
15857 ehliclsn(mgs) = 0.0
15862 IF ( exwmindiam > 0 .and. qx(mgs,lc) > qxmin(lc) )
THEN
15863 tmp = cx(mgs,lc)*exp(- (exwmindiam/xdia(mgs,lc,1))**3 )
15864 ccwresv(mgs) = min( cx(mgs,lc), max( 2.e6, cx(mgs,lc) - tmp ) )
15866 tmp = cx(mgs,lc) - ccwresv(mgs)
15868 volt = pi/6.*(exwmindiam)**3
15869 qcwresv(mgs) = qx(mgs,lc) - tmp*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
15872 IF ( .false. .and. qx(mgs,lc) > 0.1e-3 )
THEN
15874 write(0,*)
'cx,qx,crsv,qrsv = ',cx(mgs,lc),qx(mgs,lc),ccwresv(mgs),qcwresv(mgs)
15882 IF ( qx(mgs,lc) .gt. qxmin(lc) )
THEN
15883 cwrad = 0.5*xdia(mgs,lc,1)
15885 IF ( cwrad .ge. 1.e-6*cwr(il,1) ) icwr(mgs) = il
15891 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
15892 rwrad = 0.5*xdia(mgs,lr,3)
15894 IF ( rwrad .ge. 1.e-6*grad(il,1) ) irwr(mgs) = il
15903 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
15904 rwrad = 0.5*xdia(mgs,lh,3)
15906 IF ( rwrad .ge. 1.e-6*grad(il,1) ) igwr(mgs) = il
15911 IF ( lhl .gt. 1 )
THEN
15913 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
15914 rwrad = 0.5*xdia(mgs,lhl,3)
15916 IF ( rwrad .ge. 1.e-6*grad(il,1) ) ihlr(mgs) = il
15926 if ( qx(mgs,li) .gt. qxmin(li) )
then
15934 eii(mgs) = exp(0.025*min(temcg(mgs),0.0))
15936 if ( temg(mgs) .gt. 273.15 ) eii(mgs) = 1.0
15945 if ( qx(mgs,li).gt.qxmin(li) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15948 if (xdia(mgs,lc,1).gt.ewi_dcmin .and. xdia(mgs,li,1).gt.ewi_dimin)
then
15953 if ( temg(mgs) .ge. 273.15 ) eiw(mgs) = 0.0
15962 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lc).gt.qxmin(lc) )
then
15964 IF ( lnr .gt. 1 )
THEN
15979 icp1 = min( 8, ic+1 )
15981 irp1 = min( 6, ir+1 )
15982 cwrad = 0.5*xdia(mgs,lc,3)
15983 rwrad = 0.5*xdia(mgs,lr,3)
15985 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
15986 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
15990 x1 = ew(ic, ir) + slope1*max(0.0, (cwrad - cwr(ic,1)) )
15991 x2 = ew(icp1,ir) + slope2*max(0.0, (cwrad - cwr(ic,1)) )
15993 slope1 = (x2 - x1)*grad(ir,2)
15995 erw(mgs) = max(0.0, x1 + slope1*max(0.0, (rwrad - grad(ir,1)) ))
16000 erw(mgs) = max(0.0, erw(mgs) )
16001 IF ( rwrad .lt. 50.e-6 )
THEN
16003 ELSEIF ( rwrad .lt. 100.e-6 )
THEN
16004 erw(mgs) = erw(mgs)*(rwrad - 50.e-6)/50.e-6
16009 IF ( cx(mgs,lc) .le. 0.0 ) erw(mgs) = 0.0
16011 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lr).gt.qxmin(lr) )
then
16015 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,ls).gt.qxmin(ls) )
then
16019 if ( qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,li).gt.qxmin(li) )
then
16029 if ( xdia(mgs,li,3) .lt. eri_cimin ) eri(mgs)=0.0
16041 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,lc).gt.qxmin(lc) )
then
16043 if ( xdia(mgs,lc,1) .gt. 15.e-6 .and. xdia(mgs,ls,1) .gt. 100.e-6)
then
16045 ELSEIF ( xdia(mgs,ls,1) .ge. 500.e-6 )
THEN
16046 esw(mgs) = min(0.5, 0.05 + (0.8-0.05)/(40.e-6)*xdia(mgs,lc,1) )
16050 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,lr).gt.qxmin(lr) &
16051 & .and. temg(mgs) .lt. tfr - 1. &
16053 esr(mgs)=exp(-(40.e-6)**3/xv(mgs,lr))*exp(-40.e-6/xdia(mgs,ls,1))
16054 IF ( qx(mgs,ls) < 1.e-4 .and. qx(mgs,lr) < 1.e-4 ) il2(mgs) = 1
16057 IF ( ipconc < 3 .and. temg(mgs) < tfr .and. qx(mgs,lr).gt.qxmin(lr) .and. qx(mgs,lr) < 1.e-4 )
THEN
16062 if ( temcg(mgs) < 0.0 )
then
16064 IF ( ipconc .lt. 4 .or. temcg(mgs) < esstem1 )
THEN
16072 IF ( iessopt == 2 )
THEN
16074 IF ( wvel(mgs) > 2.0 )
THEN
16077 ELSEIF ( wvel(mgs) > 1.0 )
THEN
16078 fac = max(0.0, 2.0 - wvel(mgs))*fac
16080 ELSEIF ( iessopt == 3 )
THEN
16081 IF ( ssi(mgs) <= 1.0 )
THEN
16084 ELSEIF ( ssi(mgs) <= 1.02 )
THEN
16085 fac = fac*(ssi(mgs) - 1.0)/0.02
16086 ehsfac(mgs) = (ssi(mgs) - 1.0)/0.02
16088 ELSEIF ( iessopt == 4 )
THEN
16089 IF ( ssi(mgs) <= 1.0 )
THEN
16092 ELSEIF ( ssi(mgs) <= 1.005 )
THEN
16093 fac = max(0.1, fac*(ssi(mgs) - 1.0)/0.005)
16094 ehsfac(mgs) = max(0.1, (ssi(mgs) - 1.0)/0.005)
16098 IF ( temcg(mgs) > esstem1 .and. temcg(mgs) < esstem2 )
THEN
16099 ess(mgs) = fac*exp(ess1*(esstem2) )*(temcg(mgs) - esstem1)/(esstem2 - esstem1)
16100 ELSEIF ( temcg(mgs) >= esstem2 )
THEN
16101 ess(mgs) = fac*exp(ess1*min( temcg(mgs), 0.0 ) )
16107 if ( qx(mgs,ls).gt.qxmin(ls) .and. qx(mgs,li).gt.qxmin(li) )
then
16108 esiclsn(mgs) = esi_collsn
16110 IF ( ipconc < 1 .and. lwsm6 )
THEN
16111 esi(mgs) = exp(0.7*min(temcg(mgs),0.0))
16113 esi(mgs) = esi0*exp(0.1*min(temcg(mgs),0.0))
16114 esi(mgs) = min(0.1,esi(mgs))
16116 IF ( ipconc .le. 3 )
THEN
16117 esi(mgs) = exp(0.025*min(temcg(mgs),0.0))
16124 if ( temg(mgs) .gt. 273.15 ) esi(mgs) = 0.0
16134 xmascw(mgs) = xmas(mgs,lc)
16135 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc).gt.qxmin(lc) )
then
16137 IF ( iehw .eq. 0 )
THEN
16139 ELSEIF ( iehw .eq. 1 .or. iehw .eq. 10 )
THEN
16140 cwrad = 0.5*xdia(mgs,lc,1)
16141 ehw(mgs) = min( ehw0, &
16142 & ewfac*min((aradcw + cwrad*(bradcw + cwrad* &
16143 & (cradcw + cwrad*(dradcw)))), 1.0) )
16145 ELSEIF ( iehw .eq. 2 .or. iehw .eq. 10 )
THEN
16147 icp1 = min( 8, ic+1 )
16149 irp1 = min( 6, ir+1 )
16150 cwrad = 0.5*xdia(mgs,lc,1)
16151 rwrad = 0.5*xdia(mgs,lh,3)
16153 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
16154 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
16158 x1 = ew(ic, ir) + slope1*max(0.0, (cwrad - cwr(ic,1)) )
16159 x2 = ew(icp1,ir) + slope2*max(0.0, (cwrad - cwr(ic,1)) )
16161 slope1 = (x2 - x1)*grad(ir,2)
16163 tmp = max( 0.0, min( 1.0, x1 + slope1*max(0.0, (rwrad - grad(ir,1)) ) ) )
16164 ehw(mgs) = min( ehw(mgs), tmp )
16174 ELSEIF ( iehw .eq. 3 .or. iehw .eq. 10 )
THEN
16175 tmp = exp(- (dmincw/xdia(mgs,lc,1))**3)
16176 xmascw(mgs) = xmas(mgs,lc) + xdn0(lc)*(pi*dmincw**3/6.0)
16177 ehw(mgs) = min( ehw(mgs), tmp )
16178 ELSEIF ( iehw .eq. 4 .or. iehw .eq. 10 )
THEN
16180 & 2.0*xdn(mgs,lc)*vtxbar(mgs,lh,1)*(0.5*xdia(mgs,lc,1))**2 &
16181 & /(9.0*fadvisc(mgs)*0.5*xdia(mgs,lh,3))
16182 tmp = max( 1.5, min(10.0, tmp) )
16183 ehw(mgs) = min( ehw(mgs), 0.55*log10(2.51*tmp) )
16185 if ( xdia(mgs,lc,1) .lt. 2.4e-06 ) ehw(mgs)=0.0
16187 ehw(mgs) = min( ehw0, ehw(mgs) )
16189 IF ( ibfc == -1 .and. temcg(mgs) < -41.0 )
THEN
16195 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lr).gt.qxmin(lr) &
16200 ehr(mgs) = exp(-(40.e-6)/xdia(mgs,lr,3))*exp(-40.e-6/xdia(mgs,lh,3))
16201 ehr(mgs) = min( ehr0, ehr(mgs) )
16204 IF ( qx(mgs,ls).gt.qxmin(ls) )
THEN
16205 IF ( ipconc .ge. 4 )
THEN
16206 ehscnv(mgs) = ehs0*exp(ehs1*min(temcg(mgs),0.0))
16208 ehscnv(mgs) = exp(0.09*min(temcg(mgs),0.0))
16211 IF ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lc) >= qxmin(lc) )
THEN
16215 ehsclsn(mgs) = ehs_collsn
16216 IF ( xdia(mgs,ls,3) < 40.e-6 )
THEN
16218 ELSEIF ( xdia(mgs,ls,3) < 150.e-6 )
THEN
16219 ehsclsn(mgs) = ehs_collsn*(xdia(mgs,ls,3) - 40.e-6)/(150.e-6 - 40.e-6)
16221 ehsclsn(mgs) = ehs_collsn
16224 ehs(mgs) = ehscnv(mgs)*min(1.0, max(0.0,xdn(mgs,lh) - 300.)/300. )
16226 ehs(mgs) = min(ehs(mgs),ehsmax)
16230 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,li).gt.qxmin(li) )
then
16231 ehiclsn(mgs) = ehi_collsn
16232 ehi(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
16233 ehi(mgs) = min( ehimax, max( ehi(mgs), ehimin ) )
16237 IF ( lis > 1 )
THEN
16238 if ( qx(mgs,lh).gt.qxmin(lh) .and. qx(mgs,lis).gt.qxmin(lis) )
then
16239 ehisclsn(mgs) = ehi_collsn
16240 ehis(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
16241 ehis(mgs) = min( ehimax, max( ehis(mgs), ehimin ) )
16252 IF ( lhl .gt. 1 )
THEN
16254 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lc).gt.qxmin(lc) )
then
16255 IF ( iehw == 3 ) iehlw = 3
16256 IF ( iehw == 4 ) iehlw = 4
16258 IF ( iehlw .eq. 0 )
THEN
16260 ELSEIF ( iehlw .eq. 1 .or. iehlw .eq. 10 )
THEN
16261 cwrad = 0.5*xdia(mgs,lc,1)
16262 ehlw(mgs) = min( ehlw0, &
16263 & ewfac*min((aradcw + cwrad*(bradcw + cwrad* &
16264 & (cradcw + cwrad*(dradcw)))), 1.0) )
16266 ELSEIF ( iehlw .eq. 2 .or. iehlw .eq. 10 )
THEN
16268 icp1 = min( 8, ic+1 )
16270 irp1 = min( 6, ir+1 )
16271 cwrad = 0.5*xdia(mgs,lc,1)
16272 rwrad = 0.5*xdia(mgs,lhl,3)
16274 slope1 = (ew(icp1, ir ) - ew(ic,ir ))*cwr(ic,2)
16275 slope2 = (ew(icp1, irp1) - ew(ic,irp1))*cwr(ic,2)
16277 x1 = ew(ic, ir) + slope1*(cwrad - cwr(ic,1))
16278 x2 = ew(icp1,ir) + slope2*(cwrad - cwr(ic,1))
16280 slope1 = (x2 - x1)*grad(ir,2)
16282 tmp = max( 0.0, min( 1.0, x1 + slope1*(rwrad - grad(ir,1)) ) )
16283 ehlw(mgs) = min( ehlw(mgs), tmp )
16284 ehlw(mgs) = min( ehlw0, ehlw(mgs) )
16290 ELSEIF ( iehlw .eq. 3 .or. iehlw .eq. 10 )
THEN
16291 tmp = exp(- (dmincw/xdia(mgs,lc,1))**3)
16292 ehlw(mgs) = min( ehlw(mgs), tmp )
16293 ELSEIF ( iehlw .eq. 4 .or. iehlw .eq. 10 )
THEN
16295 & 2.0*xdn(mgs,lc)*vtxbar(mgs,lhl,1)*(0.5*xdia(mgs,lc,1))**2 &
16296 & /(9.0*fadvisc(mgs)*0.5*xdia(mgs,lhl,3))
16297 tmp = max( 1.5, min(10.0, tmp) )
16298 ehlw(mgs) = min( ehlw(mgs), 0.55*log10(2.51*tmp) )
16300 if ( xdia(mgs,lc,1) .lt. 2.4e-06 ) ehlw(mgs)=0.0
16301 ehlw(mgs) = min( ehlw0, ehlw(mgs) )
16303 IF ( ibfc == -1 .and. temcg(mgs) < -41.0 )
THEN
16309 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lr).gt.qxmin(lr) &
16313 ehlr(mgs) = min( ehlr0, ehlr(mgs) )
16316 IF ( qx(mgs,ls).gt.qxmin(ls) )
THEN
16317 if ( qx(mgs,lhl).gt.qxmin(lhl) )
then
16318 ehlsclsn(mgs) = ehls_collsn
16319 ehls(mgs) = ehscnv(mgs)
16320 ehls(mgs) = min(ehls(mgs),ehsmax)
16324 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,li).gt.qxmin(li) )
then
16325 ehliclsn(mgs) = ehli_collsn
16326 ehli(mgs)=eii0hl*exp(eii1hl*min(temcg(mgs),0.0))
16327 ehli(mgs) = min( ehimax, max( ehli(mgs), ehimin ) )
16328 if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehli(mgs) = 0.0
16331 IF ( lis > 1 )
THEN
16332 if ( qx(mgs,lhl).gt.qxmin(lhl) .and. qx(mgs,lis).gt.qxmin(lis) )
then
16333 ehlisclsn(mgs) = ehli_collsn
16334 ehlis(mgs)=eii0*exp(eii1*min(temcg(mgs),0.0))
16335 ehlis(mgs) = min( ehimax, max( ehlis(mgs), ehimin ) )
16336 if ( temg(mgs) .gt. 273.15 .or. ( qx(mgs,lc) < qxmin(lc)) ) ehlis(mgs) = 0.0
16386 if (ndebug .gt. 0 )
write(0,*)
'Collection: rain collects xxxxx'
16390 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. erw(mgs) .gt. 0.0 )
THEN
16391 IF ( ipconc .lt. 3 )
THEN
16392 IF ( erw(mgs) .gt. 0.0 .and. qx(mgs,lr) .gt. 1.e-7 )
THEN
16393 vt = (ar*(xdia(mgs,lc,1)**br))*rhovt(mgs)
16395 & (0.25)*pi*erw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lr) &
16397 & *max(0.0, vtxbar(mgs,lr,1)-vt) &
16398 & *( gf3*xdia(mgs,lr,2) &
16399 & + 2.0*gf2*xdia(mgs,lr,1)*xdia(mgs,lc,1) &
16400 & + gf1*xdia(mgs,lc,2) )
16409 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
16410 rwrad = 0.5*xdia(mgs,lr,3)
16411 IF ( rwrad .gt. rh(mgs) )
THEN
16412 IF ( rwrad .gt. rwradmn )
THEN
16415 qracw(mgs) = erw(mgs)*aa2*cx(mgs,lr)*cx(mgs,lc)*xmas(mgs,lc)* &
16416 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)/(alpha(mgs,lc) + 1.) + xv(mgs,lr))/rho0(mgs)
16419 IF ( imurain == 3 )
THEN
16428 qracw(mgs) = aa1*cx(mgs,lr)*(qx(mgs,lc)-qcwresv(mgs))* &
16429 & ((alpha(mgs,lc) + 3.)*(alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.)**2 + &
16430 & (alpha(mgs,lr) + 2.)*xv(mgs,lr)**2/(alpha(mgs,lr) + 1.))
16434 qracw(mgs) = aa1*cx(mgs,lr)*(qx(mgs,lc)-qcwresv(mgs))* &
16435 & ((alpha(mgs,lc) + 3.)*(alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.)**2 + &
16436 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)*xv(mgs,lr)**2/ &
16437 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.)))
16446 qracw(mgs) = min(qracw(mgs), qcmxd(mgs))
16454 IF ( eri(mgs) .gt. 0.0 .and. iacr .ge. 1 .and. xdia(mgs,lr,3) .gt. 2.*rwradmn )
THEN
16455 IF ( ipconc .ge. 3 )
THEN
16457 tmp = eri(mgs)*aa2*cx(mgs,lr)*cx(mgs,li)* &
16458 & ((cinu + 2.)*xv(mgs,li)/(cinu + 1.) + xv(mgs,lr))
16460 qraci(mgs) = min( qxmxd(mgs,li), tmp*xmas(mgs,li)*rhoinv(mgs) )
16461 craci(mgs) = min( cxmxd(mgs,li), tmp )
16486 & (0.25)*pi*eri(mgs)*qx(mgs,li)*cx(mgs,lr) &
16487 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,li,1)) &
16488 & *( gf3*xdia(mgs,lr,2) &
16489 & + 2.0*gf2*xdia(mgs,lr,1)*xdia(mgs,li,1) &
16490 & + gf1*xdia(mgs,li,2) ) &
16493 if ( temg(mgs) .gt. 268.15 )
then
16499 IF ( ipconc < 3 )
THEN
16502 IF ( ers(mgs) .gt. 0.0 .and. ipconc < 3 )
THEN
16503 IF ( lwsm6 .and. ipconc == 0 )
THEN
16506 vt = vtxbar(mgs,ls,1)
16510 & ((0.25)*pi/gf4)*ers(mgs)*qx(mgs,ls)*cx(mgs,lr) &
16511 & *abs(vtxbar(mgs,lr,1)-vt) &
16512 & *( gf6*gf1*xdia(mgs,ls,2) &
16513 & + 2.0*gf5*gf2*xdia(mgs,ls,1)*xdia(mgs,lr,1) &
16514 & + gf4*gf3*xdia(mgs,lr,2) ) &
16522 if (ndebug .gt. 0 )
write(0,*)
'Collection: snow collects xxxxx'
16528 IF ( esw(mgs) .gt. 0.0 )
THEN
16530 IF ( ipconc .ge. 4 )
THEN
16536 tmp = 1.0*rvt*aa2*cx(mgs,ls)*cx(mgs,lc)* &
16537 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)/(alpha(mgs,lc) + 1.) + xv(mgs,ls))
16539 qsacw(mgs) = min( qxmxd(mgs,lc), tmp*xmas(mgs,lc)*rhoinv(mgs) )
16540 csacw(mgs) = min( cxmxd(mgs,lc), tmp )
16542 IF ( lvol(ls) .gt. 1 )
THEN
16543 IF ( temg(mgs) .lt. 273.15)
THEN
16544 rimdn(mgs,ls) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16545 & *((0.60)*vtxbar(mgs,ls,1)) &
16546 & /(temg(mgs)-273.15))**(rimc2)
16547 rimdn(mgs,ls) = min( max( rimc3, rimdn(mgs,ls) ), rimc4 )
16549 rimdn(mgs,ls) = 1000.
16552 vsacw(mgs) = rho0(mgs)*qsacw(mgs)/rimdn(mgs,ls)
16569 vt = abs(vtxbar(mgs,ls,1)-vtxbar(mgs,lc,1))
16571 qsacw(mgs) = 0.25*pi*esw(mgs)*cx(mgs,ls)*qx(mgs,lc)*vt* &
16572 & ( da0(ls)*xdia(mgs,ls,3)**2 + &
16573 & dab1(ls,lc)*xdia(mgs,ls,3)*xdia(mgs,lc,3) + &
16574 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16575 qsacw(mgs) = min( qsacw(mgs), qxmxd(mgs,ls) )
16576 csacw(mgs) = rho0(mgs)*qsacw(mgs)/xmas(mgs,lc)
16586 IF ( ipconc .ge. 4 )
THEN
16587 IF ( esi(mgs) .gt. 0.0 .or. ( ipelec > 0 .and. esiclsn(mgs) > 0.0 ))
THEN
16591 tmp = esiclsn(mgs)*rvt*aa2*cx(mgs,ls)*cx(mgs,li)* &
16592 & ((cinu + 2.)*xv(mgs,li)/(cinu + 1.) + xv(mgs,ls))
16594 qsaci(mgs) = min( qxmxd(mgs,li), esi(mgs)*tmp*xmas(mgs,li)*rhoinv(mgs) )
16596 csaci(mgs) = min(cxmxd(mgs,li), esi(mgs)*tmp )
16608 IF ( esi(mgs) .gt. 0.0 )
THEN
16611 & ((0.25)*pi)*esi(mgs)*qx(mgs,li)*cx(mgs,ls) &
16612 & *abs(vtxbar(mgs,ls,1)-vtxbar(mgs,li,1)) &
16613 & *( gf3*xdia(mgs,ls,2) &
16614 & + 2.0*gf2*xdia(mgs,ls,1)*xdia(mgs,li,1) &
16615 & + gf1*xdia(mgs,li,2) ) &
16627 IF ( esr(mgs) .gt. 0.0 )
THEN
16628 IF ( ipconc .ge. 3 )
THEN
16640 IF ( lwsm6 .and. ipconc == 0 )
THEN
16643 vt = vtxbar(mgs,ls,1)
16648 & ((0.25)*pi/gf4)*esr(mgs)*qx(mgs,lr)*cx(mgs,ls) &
16649 & *abs(vtxbar(mgs,lr,1)-vt) &
16650 & *( gf6*gf1*xdia(mgs,lr,2) &
16651 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,ls,1) &
16652 & + gf4*gf3*xdia(mgs,ls,2) ) &
16661 if (ndebug .gt. 0 )
write(0,*)
'Collection: graupel collects xxxxx'
16665 qhacwmlr(mgs) = 0.0
16671 IF ( .false. )
THEN
16672 vtmax = (gz(igs(mgs),jgs,kgs(mgs))*dtpinv)
16673 vtxbar(mgs,lh,1) = min( vtmax, vtxbar(mgs,lh,1))
16674 vtxbar(mgs,lh,2) = min( vtmax, vtxbar(mgs,lh,2))
16675 vtxbar(mgs,lh,3) = min( vtmax, vtxbar(mgs,lh,3))
16677 IF ( ehw(mgs) .gt. 0.0 )
THEN
16679 IF ( ipconc .ge. 2 )
THEN
16681 IF ( .false. )
THEN
16682 qhacw(mgs) = (ehw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lh)*pi* &
16683 & abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1))* &
16684 & (2.0*xdia(mgs,lh,1)*(xdia(mgs,lh,1) + &
16685 & xdia(mgs,lc,1)*gf73rds) + &
16686 & xdia(mgs,lc,2)*gf83rds))/4.
16689 vt = abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1))
16691 qhacw(mgs) = 0.25*pi*ehw(mgs)*cx(mgs,lh)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
16692 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16693 & dab1lh(mgs,lh,lc)*xdia(mgs,lh,3)*xdia(mgs,lc,3) + &
16694 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
16697 qhacw(mgs) = min( qhacw(mgs), 0.5*qx(mgs,lc)*dtpinv )
16699 IF ( lzh .gt. 1 )
THEN
16700 tmp = qx(mgs,lh)/cx(mgs,lh)
16713 & ((0.25)*pi)*ehw(mgs)*(qx(mgs,lc)-qcwresv(mgs))*cx(mgs,lh) &
16714 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1)) &
16715 & *( gf3*xdia(mgs,lh,2) &
16716 & + 2.0*gf2*xdia(mgs,lh,1)*xdia(mgs,lc,1) &
16717 & + gf1*xdia(mgs,lc,2) ) &
16718 & , 0.5*(qx(mgs,lc)-qcwresv(mgs))*dtpinv)
16723 IF ( lwsm6 .and. qsacw(mgs) > 0.0 .and. qhacw(mgs) > 0.0)
THEN
16724 qaacw = ( qx(mgs,ls)*qsacw(mgs) + qx(mgs,lh)*qhacw(mgs) )/(qx(mgs,ls) + qx(mgs,lh))
16732 qhacwmlr(mgs) = qhacw(mgs)
16733 IF ( temg(mgs) > tfr .and. iqhacwshr == 0 )
THEN
16737 IF ( lvol(lh) .gt. 1 .or. lhl .gt. 1 )
THEN
16739 IF ( temg(mgs) .lt. 273.15)
THEN
16740 IF ( irimdenopt == 1 )
THEN
16741 vt = ( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) )
16743 rimdn(mgs,lh) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16745 & /(temg(mgs)-273.15))**(rimc2)
16747 rimdn(mgs,lh) = min( max( rimc3, rimdn(mgs,lh) ), rimc4 )
16757 ELSEIF ( irimdenopt == 2 )
THEN
16759 tmp = (-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16760 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) ) &
16761 & /(temg(mgs)-273.15))
16762 tmp = min( 5.5/0.6, max( 0.3/0.6, tmp ) )
16764 rimdn(mgs,lh) = 1000.*(0.051 + 0.114*tmp - 0.0055*tmp**2)
16766 ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4)
THEN
16768 tmp = (-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
16769 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lh,1) + rimdenvwgt*vtxbar(mgs,lh,2) ) &
16770 & /(temg(mgs)-273.15))
16773 IF ( irimdenopt == 3 )
THEN
16774 rimdn(mgs,lh) = min(900., max( 170., 110.*tmp**0.76 ) )
16775 ELSEIF ( irimdenopt == 4 )
THEN
16776 rimdn(mgs,lh) = min(917., max( 10., 900.0*(1.0 - 0.905**tmp ) ) )
16781 rimdn(mgs,lh) = 1000.
16784 IF ( lvol(lh) > 1 ) vhacw(mgs) = rho0(mgs)*qhacw(mgs)/rimdn(mgs,lh)
16788 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. ipelec .ge. 1 )
THEN
16790 & qhacw(mgs)*1.0e3*rho0(mgs)/((pi/2.0)*xdia(mgs,lh,2)*cx(mgs,lh))
16800 IF ( ehi(mgs) .gt. 0.0 )
THEN
16801 IF ( ipconc .ge. 5 )
THEN
16803 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,li,1))**2 + &
16804 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,li,1) )
16806 qhaci0(mgs) = 0.25*pi*ehiclsn(mgs)*cx(mgs,lh)*qx(mgs,li)*vt* &
16807 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16808 & dab1lh(mgs,lh,li)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
16809 & da1(li)*xdia(mgs,li,3)**2 )
16810 qhaci(mgs) = min( ehi(mgs)*qhaci0(mgs), qimxd(mgs) )
16814 & ((0.25)*pi)*ehi(mgs)*ehiclsn(mgs)*qx(mgs,li)*cx(mgs,lh) &
16815 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,li,1)) &
16816 & *( gf3*xdia(mgs,lh,2) &
16817 & + 2.0*gf2*xdia(mgs,lh,1)*xdia(mgs,li,1) &
16818 & + gf1*xdia(mgs,li,2) ) &
16830 IF ( ehs(mgs) .gt. 0.0 )
THEN
16831 IF ( ipconc .ge. 5 )
THEN
16833 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1))**2 + &
16834 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,ls,1) )
16836 qhacs0(mgs) = 0.25*pi*ehsclsn(mgs)*cx(mgs,lh)*qx(mgs,ls)*vt* &
16837 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16838 & dab1lh(mgs,lh,ls)*xdia(mgs,lh,3)*xdia(mgs,ls,3) + &
16839 & da1(ls)*xdia(mgs,ls,3)**2 )
16841 qhacs(mgs) = min( ehs(mgs)*qhacs0(mgs), qsmxd(mgs) )
16846 & ((0.25)*pi/gf4)*ehs(mgs)*ehsclsn(mgs)*qx(mgs,ls)*cx(mgs,lh) &
16847 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1)) &
16848 & *( gf6*gf1*xdia(mgs,ls,2) &
16849 & + 2.0*gf5*gf2*xdia(mgs,ls,1)*xdia(mgs,lh,1) &
16850 & + gf4*gf3*xdia(mgs,lh,2) ) &
16858 qhacrmlr(mgs) = 0.0
16862 IF ( temg(mgs) .gt. tfr ) raindn(mgs,lh) = 1000.0
16864 IF ( ehr(mgs) .gt. 0.0 )
THEN
16865 IF ( ipconc .ge. 3 )
THEN
16866 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,lr,1))**2 + &
16867 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,lr,1) )
16874 qhacr(mgs) = 0.25*pi*ehr(mgs)*cx(mgs,lh)*qx(mgs,lr)*vt* &
16875 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16876 & dab1lh(mgs,lh,lr)*xdia(mgs,lh,3)*xdia(mgs,lr,3) + &
16877 & da1lr(mgs)*xdia(mgs,lr,3)**2 )
16884 qhacr(mgs) = min( qhacr(mgs), qxmxd(mgs,lr) )
16886 qhacrmlr(mgs) = qhacr(mgs)
16888 IF ( temg(mgs) > tfr .and. iehr0c == 0 )
THEN
16891 IF ( iqhacrmlr == 0 )
THEN
16892 qhacrmlr(mgs) = -qhacw(mgs)
16904 chacr(mgs) = 0.25*pi*ehr(mgs)*cx(mgs,lh)*cx(mgs,lr)*vt* &
16905 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
16906 & dab0lh(mgs,lh,lr)*xdia(mgs,lh,3)*xdia(mgs,lr,3) + &
16907 & da0lr(mgs)*xdia(mgs,lr,3)**2 )
16912 chacr(mgs) = min(chacr(mgs),crmxd(mgs))
16914 IF ( lzh .gt. 1 )
THEN
16915 tmp = qx(mgs,lh)/cx(mgs,lh)
16928 IF ( lwsm6 .and. ipconc == 0 )
THEN
16931 vt = vtxbar(mgs,lh,1)
16936 & ((0.25)*pi/gf4)*ehr(mgs)*qx(mgs,lr)*cx(mgs,lh) &
16937 & *abs(vt-vtxbar(mgs,lr,1)) &
16938 & *( gf6*gf1*xdia(mgs,lr,2) &
16939 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,lh,1) &
16940 & + gf4*gf3*xdia(mgs,lh,2) ) &
16943 IF ( temg(mgs) > tfr )
THEN
16944 IF ( iqhacrmlr >= 1 ) qhacrmlr(mgs) = qhacr(mgs)
16949 IF ( lvol(lh) .gt. 1 .or. lhl .gt. 1 )
THEN
16951 IF ( temg(mgs) .lt. 273.15)
THEN
16952 raindn(mgs,lh) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lr,3)) &
16954 & /(temg(mgs)-273.15))**(rimc2)
16956 raindn(mgs,lh) = min( max( rimc3, rimdn(mgs,lh) ), rimc4 )
16958 raindn(mgs,lh) = 1000.
16961 IF ( lvol(lh) > 1 ) vhacr(mgs) = rho0(mgs)*qhacr(mgs)/raindn(mgs,lh)
16968 if (ndebug .gt. 0 )
write(0,*)
'Collection: hail collects xxxxx'
16973 qhlacwmlr(mgs) = 0.0
16976 IF ( lhl > 1 .and. .true.)
THEN
16977 vtmax = (gz(igs(mgs),jgs,kgs(mgs))*dtpinv)
16978 vtxbar(mgs,lhl,1) = min( vtmax, vtxbar(mgs,lhl,1))
16979 vtxbar(mgs,lhl,2) = min( vtmax, vtxbar(mgs,lhl,2))
16980 vtxbar(mgs,lhl,3) = min( vtmax, vtxbar(mgs,lhl,3))
16983 IF ( lhl > 0 )
THEN
16984 rarx(mgs,lhl) = 0.0
16987 IF ( lhl .gt. 1 .and. ehlw(mgs) .gt. 0.0 )
THEN
16992 vt = abs(vtxbar(mgs,lhl,1)-vtxbar(mgs,lc,1))
16994 qhlacw(mgs) = 0.25*pi*ehlw(mgs)*cx(mgs,lhl)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
16995 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
16996 & dab1lh(mgs,lhl,lc)*xdia(mgs,lhl,3)*xdia(mgs,lc,3) + &
16997 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
17000 qhlacw(mgs) = min( qhlacw(mgs), 0.5*qx(mgs,lc)*dtpinv )
17002 qhlacwmlr(mgs) = qhlacw(mgs)
17003 IF ( temg(mgs) > tfr .and. iqhlacwshr == 0 )
THEN
17007 IF ( lvol(lhl) .gt. 1 )
THEN
17009 IF ( temg(mgs) .lt. 273.15)
THEN
17010 IF ( irimdenopt == 1 )
THEN
17011 rimdn(mgs,lhl) = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
17012 & *((0.60)*( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) )) &
17013 & /(temg(mgs)-273.15))**(rimc2)
17014 rimdn(mgs,lhl) = min( max( hldnmn, rimc3, rimdn(mgs,lhl) ), rimc4 )
17016 ELSEIF ( irimdenopt == 2 )
THEN
17017 tmp = -0.5*(1.e+06)*xdia(mgs,lc,1) &
17018 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) ) &
17019 & /(temg(mgs)-273.15)
17020 tmp = min( 5.5/0.6, max( 0.3/0.6, tmp ) )
17022 rimdn(mgs,lhl) = 1000.*(0.051 + 0.114*tmp - 0.005*tmp**2)
17024 ELSEIF ( irimdenopt == 3 .or. irimdenopt == 4)
THEN
17025 tmp = -0.5*(1.e+06)*xdia(mgs,lc,1) &
17026 & *( (1.0-rimdenvwgt)*vtxbar(mgs,lhl,1) + rimdenvwgt*vtxbar(mgs,lhl,2) ) &
17027 & /(temg(mgs)-273.15)
17030 IF ( irimdenopt == 3 )
THEN
17031 rimdn(mgs,lhl) = min(900., max( 170., 110.*tmp**0.76 ) )
17032 ELSEIF ( irimdenopt == 4 )
THEN
17033 rimdn(mgs,lhl) = min(917., max( 10., 900.0*(1.0 - 0.905**tmp ) ) )
17038 rimdn(mgs,lhl) = 1000.
17041 vhlacw(mgs) = rho0(mgs)*qhlacw(mgs)/rimdn(mgs,lhl)
17046 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. ipelec .ge. 1 )
THEN
17048 & qhlacw(mgs)*1.0e3*rho0(mgs)/((pi/2.0)*xdia(mgs,lhl,2)*cx(mgs,lhl))
17056 IF ( lhl .gt. 1 )
THEN
17058 IF ( ehli(mgs) .gt. 0.0 )
THEN
17059 IF ( ipconc .ge. 5 )
THEN
17061 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,li,1))**2 + &
17062 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,li,1) )
17064 qhlaci0(mgs) = 0.25*pi*ehliclsn(mgs)*cx(mgs,lhl)*qx(mgs,li)*vt* &
17065 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17066 & dab1lh(mgs,lhl,li)*xdia(mgs,lhl,3)*xdia(mgs,li,3) + &
17067 & da1(li)*xdia(mgs,li,3)**2 )
17069 qhlaci(mgs) = min( ehli(mgs)*qhlaci0(mgs), qimxd(mgs) )
17080 IF ( lhl .gt. 1 )
THEN
17082 IF ( ehls(mgs) .gt. 0.0)
THEN
17083 IF ( ipconc .ge. 5 )
THEN
17085 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,ls,1))**2 + &
17086 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,ls,1) )
17088 qhlacs0(mgs) = 0.25*pi*ehlsclsn(mgs)*cx(mgs,lhl)*qx(mgs,ls)*vt* &
17089 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17090 & dab1lh(mgs,lhl,ls)*xdia(mgs,lhl,3)*xdia(mgs,ls,3) + &
17091 & da1(ls)*xdia(mgs,ls,3)**2 )
17093 qhlacs(mgs) = min( ehls(mgs)*qhlacs0(mgs), qsmxd(mgs) )
17102 qhlacrmlr(mgs) = 0.0
17105 IF ( lhl .gt. 1 .and. temg(mgs) .gt. tfr ) raindn(mgs,lhl) = 1000.0
17107 IF ( lhl .gt. 1 .and. ehlr(mgs) .gt. 0.0 )
THEN
17108 IF ( ipconc .ge. 3 )
THEN
17109 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,lr,1))**2 + &
17110 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,lr,1) )
17112 qhlacr(mgs) = 0.25*pi*ehlr(mgs)*cx(mgs,lhl)*qx(mgs,lr)*vt* &
17113 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17114 & dab1lh(mgs,lhl,lr)*xdia(mgs,lhl,3)*xdia(mgs,lr,3) + &
17115 & da1lr(mgs)*xdia(mgs,lr,3)**2 )
17122 qhlacr(mgs) = min( qhlacr(mgs), qxmxd(mgs,lr) )
17125 IF ( iqhlacrmlr >= 1 ) qhlacrmlr(mgs) = qhlacr(mgs)
17127 IF ( temg(mgs) > tfr .and. iehlr0c == 0)
THEN
17129 IF ( iqhlacrmlr == 0 )
THEN
17130 qhlacrmlr(mgs) = -qhlacw(mgs)
17133 chlacr(mgs) = 0.25*pi*ehlr(mgs)*cx(mgs,lhl)*cx(mgs,lr)*vt* &
17134 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17135 & dab0lh(mgs,lhl,lr)*xdia(mgs,lhl,3)*xdia(mgs,lr,3) + &
17136 & da0lr(mgs)*xdia(mgs,lr,3)**2 )
17138 chlacr(mgs) = min(chlacr(mgs),crmxd(mgs))
17140 IF ( lvol(lhl) .gt. 1 )
THEN
17141 vhlacr(mgs) = rho0(mgs)*qhlacr(mgs)/raindn(mgs,lhl)
17156 if (ndebug .gt. 0 )
write(0,*)
'Collection: cloud ice collects xxxx2'
17160 IF ( eiw(mgs) .gt. 0.0 )
THEN
17162 vt = sqrt((vtxbar(mgs,li,1)-vtxbar(mgs,lc,1))**2 + &
17163 & 0.04*vtxbar(mgs,li,1)*vtxbar(mgs,lc,1) )
17165 qiacw(mgs) = 0.25*pi*eiw(mgs)*cx(mgs,li)*qx(mgs,lc)*vt* &
17166 & ( da0(li)*xdia(mgs,li,3)**2 + &
17167 & dab1(li,lc)*xdia(mgs,li,3)*xdia(mgs,lc,3) + &
17168 & da1lc(mgs)*xdia(mgs,lc,3)**2 )
17170 qiacw(mgs) = min( qiacw(mgs), qxmxd(mgs,lc) )
17177 if (ndebug .gt. 0 )
write(0,*)
'Collection: cloud ice collects xxxx8'
17187 csplinter(mgs) = 0.0
17188 qsplinter(mgs) = 0.0
17189 csplinter2(mgs) = 0.0
17190 qsplinter2(mgs) = 0.0
17191 IF ( iacr .ge. 1 .and. eri(mgs) .gt. 0.0 &
17192 & .and. temg(mgs) .le. 270.15 )
THEN
17193 IF ( ipconc .ge. 3 )
THEN
17195 IF ( xdia(mgs,li,1) .ge. 10.e-6 )
THEN
17196 ni = ni + cx(mgs,li)*exp(- (40.e-6/xdia(mgs,li,1))**3 )
17198 IF ( imurain == 1 )
THEN
17199 IF ( iacrsize /= 4 )
THEN
17200 IF ( iacrsize .eq. 1 )
THEN
17201 ratio = 500.e-6/xdia(mgs,lr,1)
17202 ELSEIF ( iacrsize .eq. 2 )
THEN
17203 ratio = 300.e-6/xdia(mgs,lr,1)
17204 ELSEIF ( iacrsize .eq. 3 )
THEN
17205 ratio = 40.e-6/xdia(mgs,lr,1)
17206 ELSEIF ( iacrsize .eq. 5 )
THEN
17207 ratio = 150.e-6/xdia(mgs,lr,1)
17209 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
17210 j = int(max(0.0,min(15.,alpha(mgs,lr)))*dqiacralphainv)
17212 delx = ratio - float(i)*dqiacrratio
17213 dely = alpha(mgs,lr) - float(j)*dqiacralpha
17214 ip1 = min( i+1, nqiacrratio )
17215 jp1 = min( j+1, nqiacralpha )
17218 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
17219 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
17223 nr = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)
17226 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
17227 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
17231 qr = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)
17238 vt = sqrt((vtxbar(mgs,lr,1)-vtxbar(mgs,li,1))**2 + &
17239 & 0.04*vtxbar(mgs,lr,1)*vtxbar(mgs,li,1) )
17241 qiacr(mgs) = 0.25*pi*eri(mgs)*ni*qr*vt* &
17242 & ( da0(li)*xdia(mgs,li,3)**2 + &
17243 & dab1lh(mgs,li,lr)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
17244 & da1(lr)*xdia(mgs,lr,3)**2 )
17246 qiacr(mgs) = min( qrmxd(mgs), qiacr(mgs) )
17249 ciacr(mgs) = 0.25*pi*eri(mgs)*ni*nr*vt* &
17250 & ( da0(li)*xdia(mgs,li,3)**2 + &
17251 & dab0lh(mgs,li,lr)*xdia(mgs,lr,3)*xdia(mgs,li,3) + &
17252 & da0(lr)*xdia(mgs,lr,3)**2 )
17254 ciacr(mgs) = min( crmxd(mgs), ciacr(mgs) )
17261 ELSEIF ( imurain == 3 )
THEN
17263 arg = 1000.*xdia(mgs,lr,3)
17266 IF ( ipconc .ge. 3 )
THEN
17267 IF ( iacrsize .eq. 1 )
THEN
17269 ELSEIF ( iacrsize .eq. 2 .or. iacrsize .eq. 5 )
THEN
17271 ELSEIF ( iacrsize .eq. 3 )
THEN
17272 nr = cx(mgs,lr)*
gaml02( arg )
17273 ELSEIF ( iacrsize .eq. 4 )
THEN
17277 nr = cx(mgs,lr)*
gaml02( arg )
17282 IF ( ni .gt. 0.0 .and. nr .gt. 0.0 )
THEN
17283 d0 = xdia(mgs,lr,3)
17284 qiacr(mgs) = xdn(mgs,lr)*rhoinv(mgs)* &
17285 & (0.217239*(0.522295*(d0**5) + &
17286 & 49711.81*(d0**6) - &
17287 & 1.673016e7*(d0**7)+ &
17288 & 2.404471e9*(d0**8) - &
17289 & 1.22872e11*(d0**9))*ni*nr)
17290 qiacr(mgs) = min( qrmxd(mgs), qiacr(mgs) )
17292 & (0.217239*(0.2301947*(d0**2) + &
17293 & 15823.76*(d0**3) - &
17294 & 4.167685e6*(d0**4) + &
17295 & 4.920215e8*(d0**5) - &
17296 & 2.133344e10*(d0**6))*ni*nr)
17297 ciacr(mgs) = min( crmxd(mgs), ciacr(mgs) )
17301 IF ( iacr .eq. 1 .or. iacr .eq. 3 )
THEN
17302 ciacrf(mgs) = min(ciacr(mgs), qiacr(mgs)/(1.0*vr1mm*1000.0)*rho0(mgs) )
17303 ELSEIF ( iacr .eq. 2 )
THEN
17304 ciacrf(mgs) = ciacr(mgs)
17305 ELSEIF ( iacr .eq. 4 )
THEN
17306 ciacrf(mgs) = min(ciacr(mgs), qiacr(mgs)/(1.0*vfrz*1000.0)*rho0(mgs) )
17307 ELSEIF ( iacr .eq. 5 )
THEN
17308 ciacrf(mgs) = ciacr(mgs)*rzxh(mgs)
17317 & ((0.25/gf4)*pi)*eri(mgs)*cx(mgs,li)*qx(mgs,lr) &
17318 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,li,1)) &
17319 & *( gf6*gf1*xdia(mgs,lr,2) &
17320 & + 2.0*gf5*gf2*xdia(mgs,lr,1)*xdia(mgs,li,1) &
17321 & + gf4*gf3*xdia(mgs,li,2) ) &
17329 IF ( ipconc .ge. 1 )
THEN
17330 IF ( nsplinter .ge. 1000 )
THEN
17333 IF ( qiacr(mgs)*dtp > qxmin(lh) .and. ciacr(mgs) > 1.e-3 )
THEN
17334 tmpdiam = 1.e6*( 6.*qiacr(mgs)/(1000.*pi*ciacr(mgs) ) )**(1./3.)
17336 IF ( nsplinter .eq. 1001 )
THEN
17339 fac = 0.2*exp(-0.5*((258.-temg(mgs))/10.)**2 )
17341 csplinter(mgs) = fac*lawson_splinter_fac*tmpdiam**4*ciacr(mgs)
17343 ELSEIF ( nsplinter .ge. 0 )
THEN
17344 csplinter(mgs) = nsplinter*ciacr(mgs)
17346 csplinter(mgs) = -nsplinter*ciacrf(mgs)
17348 qsplinter(mgs) = min(0.1*qiacr(mgs), csplinter(mgs)*splintermass/rho0(mgs) )
17352 IF ( ibiggsnow == 2 .or. ibiggsnow == 3 )
THEN
17353 IF ( ciacr(mgs) > qxmin(lh) )
THEN
17354 xvfrz = rho0(mgs)*qiacr(mgs)/(ciacr(mgs)*900.)
17355 frach = 0.5 *(1. + tanh(0.2e12 *( xvfrz - 1.15*xvbiggsnow)))
17357 qiacrs(mgs) = (1.-frach)*qiacr(mgs)
17358 ciacrs(mgs) = (1.-frach)*ciacrf(mgs)
17363 qiacrf(mgs) = frach*qiacr(mgs)
17364 ciacrf(mgs) = frach*ciacrf(mgs)
17366 IF ( lvol(lh) > 1 )
THEN
17367 viacrf(mgs) = rho0(mgs)*qiacrf(mgs)/rhofrz
17377 if ( ipconc .ge. 4 )
then
17380 IF ( qx(mgs,ls) > qxmin(ls) .and. ess(mgs) .gt. 0.0 )
THEN
17382 IF ( iessec0flag == 0 )
THEN
17385 tmp = xv(mgs,ls)/(xvmx(ls)*max(1.,100./min(100.,xdn(mgs,ls))))
17386 IF ( tmp .lt. essfrac1 )
THEN
17388 ELSEIF ( tmp .ge. essfrac2 )
THEN
17391 ec0(mgs) = (essfrac2 - tmp)/(essfrac2 - essfrac1)
17395 csacs(mgs) = ec0(mgs)*rvt*aa2*ess(mgs)*cx(mgs,ls)**2*min( xv(mgs,ls), 4.*pii/3.*essrmax**3 )
17397 csacs(mgs) = min(csacs(mgs),csmxd(mgs))
17403 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 11'
17404 if ( ipconc .ge. 2 .or. ipelec .ge. 9 )
then
17407 IF ( eiw(mgs) .gt. 0.0 .and. xmas(mgs,lc) > 0.0 )
THEN
17408 ciacw(mgs) = qiacw(mgs)*rho0(mgs)/xmas(mgs,lc)
17409 ciacw(mgs) = min(ciacw(mgs),ccmxd(mgs))
17415 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 18'
17416 if ( ipconc .ge. 2 .or. ipelec .ge. 1 )
then
17422 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. qx(mgs,lr) .gt. qxmin(lr) &
17423 & .and. qracw(mgs) .gt. 0.0 )
THEN
17425 IF ( ipconc .lt. 3 )
THEN
17426 IF ( erw(mgs) .gt. 0.0 )
THEN
17428 & ((0.25)*pi)*erw(mgs)*(cx(mgs,lc) - ccwresv(mgs))*cx(mgs,lr) &
17429 & *abs(vtxbar(mgs,lr,1)-vtxbar(mgs,lc,1)) &
17430 & *( gf1*xdia(mgs,lc,2) &
17431 & + 2.0*gf2*xdia(mgs,lc,1)*xdia(mgs,lr,1) &
17432 & + gf3*xdia(mgs,lr,2) )
17435 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
17436 IF ( 0.5*xdia(mgs,lr,3) .gt. rh(mgs) )
THEN
17438 IF ( 0.5*xdia(mgs,lr,3) .gt. rwradmn )
THEN
17441 cracw(mgs) = aa2*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))*(xv(mgs,lc) + xv(mgs,lr))
17443 IF ( imurain == 3 )
THEN
17445 cracw(mgs) = aa1*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))* &
17446 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.) + &
17447 & (alpha(mgs,lr) + 2.)*xv(mgs,lr)**2/(alpha(mgs,lr) + 1.))
17449 cracw(mgs) = aa1*cx(mgs,lr)*(cx(mgs,lc) - ccwresv(mgs))* &
17450 & ((alpha(mgs,lc) + 2.)*xv(mgs,lc)**2/(alpha(mgs,lc) + 1.) + &
17451 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)*xv(mgs,lr)**2/ &
17452 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.)) )
17464 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
17465 rwrad = 0.5*xdia(mgs,lr,3)
17469 IF ( icracrthresh > 1 )
THEN
17470 IF ( imurain == 1 )
THEN
17471 tmp = (3.67+alpha(mgs,lr))*xdia(mgs,lr,1)
17473 tmp = (1.678+alpha(mgs,lr))**(1./3.)*xdia(mgs,lr,1)
17476 tmp = xdia(mgs,lr,3) - 0.1e-3
17482 IF ( ( tmp .gt. 1.9e-3 .and. irainbreak /= 10 .and. irainbreak /= 20 ) .or. icracr <= 0 )
THEN
17485 IF ( ibincracr == 3 )
THEN
17486 tmp1 = aa1*(cx(mgs,lr)*xv(mgs,lr))**2* &
17487 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)/ &
17488 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.))
17491 IF ( dmrauto <= 0 .or. rho0(mgs)*qx(mgs,lr) > 1.2*xl2p(mgs) )
THEN
17493 IF ( xdia(mgs,lr,3) .lt. 6.1e-4 .or. irainbreak == 10 )
THEN
17496 ec0(mgs) = exp( -2500.0*(xdia(mgs,lr,3) - 6.0e-4) )
17501 IF ( rwrad .ge. 50.e-6 )
THEN
17502 tmp1 = aa2*cx(mgs,lr)**2*xv(mgs,lr)
17503 cracr(mgs) = ec0(mgs)*tmp1
17504 IF ( irainbreak == 20 )
THEN
17508 IF ( imurain == 3 )
THEN
17509 cracr(mgs) = ec0(mgs)*aa1*(cx(mgs,lr)*xv(mgs,lr))**2* &
17510 & (alpha(mgs,lr) + 2.)/(alpha(mgs,lr) + 1.)
17512 tmp1 = aa1*(cx(mgs,lr)*xv(mgs,lr))**2* &
17513 & (alpha(mgs,lr) + 6.)*(alpha(mgs,lr) + 5.)*(alpha(mgs,lr) + 4.)/ &
17514 & ((alpha(mgs,lr) + 3.)*(alpha(mgs,lr) + 2.)*(alpha(mgs,lr) + 1.))
17515 cracr(mgs) = ec0(mgs)*tmp1
17516 IF ( irainbreak == 20 )
THEN
17525 IF ( irainbreak == 100 )
THEN
17527 IF ( xdia(mgs,lr,1) > 300.e-6 )
THEN
17528 ec0(mgs) = 2. - exp(2300.*(xdia(mgs,lr,1)-300.e-6))
17530 cracr(mgs) = 5.78*ec0(mgs)*cx(mgs,lr)*qx(mgs,lr)
17537 IF ( irainbreak == 1 .or. irainbreak == 10 )
THEN
17538 crbreak = max( 0.0, rainbreakfac* (rho0(mgs)*qx(mgs,lr))**2 )
17539 cracr(mgs) = cracr(mgs) - crbreak
17540 ELSEIF ( irainbreak == 2 .or. irainbreak == 20 )
THEN
17542 crbreak = max( 0.0, rainbreakfac*(1. - ec0(mgs))*(rho0(mgs)*qx(mgs,lr))**2 )
17544 cracr(mgs) = cracr(mgs) - crbreak
17545 ELSEIF ( irainbreak == 11 .and. rho0(mgs)*qx(mgs,lr) > qrbrthresh1 .and. ipconc >= 5 )
THEN
17549 ratio = min( maxratiolu, draintail/xdia(mgs,lr,1) )
17551 tmp2 =
gaminterp(ratio,alpha(mgs,lr),4,1)
17552 qxd1 = qx(mgs,lr)*(tmp2)
17553 qrbreak = dtpinv*qxd1
17555 crbreaksmall = rho0(mgs)*qrbreak/(xdn(mgs,lr)*pi/6.*drsmall**3)
17556 IF ( ( qxd1 > qxmin(lr)) )
THEN
17559 tmp =
gaminterp(ratio,alpha(mgs,lr),1,1)
17560 IF ( ipconc == 5 )
THEN
17563 cxd1 = cx(mgs,lr)*( tmp)
17564 IF ( rho0(mgs)*qx(mgs,lr) > qrbrthresh2 )
THEN
17567 flim = (rho0(mgs)*qx(mgs,lr) - qrbrthresh1)/(qrbrthresh2 - qrbrthresh1)
17569 crbreak = flim*(crbreaksmall - dtpinv*cxd1)
17574 cracr(mgs) = cracr(mgs) - crbreak
17585 ELSEIF ( irainbreak == 12 )
THEN
17586 crbreak = max( 0.0, 3.8098 * (rho0(mgs)*qx(mgs,lr))**1.9416 )
17587 cracr(mgs) = cracr(mgs) - crbreak
17601 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22ii'
17603 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17606 IF ( ipconc .ge. 5 )
THEN
17607 IF ( qhacw(mgs) .gt. 0.0 .and. xmas(mgs,lc) .gt. 0.0 )
THEN
17621 chacw(mgs) = qhacw(mgs)*rho0(mgs)/xmascw(mgs)
17623 chacw(mgs) = min( chacw(mgs), 0.5*(cx(mgs,lc) - ccwresv(mgs))*dtpinv )
17630 & ((0.25)*pi)*ehw(mgs)*cx(mgs,lc)*cx(mgs,lh) &
17631 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1)) &
17632 & *( gf1*xdia(mgs,lc,2) &
17633 & + 2.0*gf2*xdia(mgs,lc,1)*xdia(mgs,lh,1) &
17634 & + gf3*xdia(mgs,lh,2) )
17635 chacw(mgs) = min(chacw(mgs),0.5*cx(mgs,lc)*dtpinv)
17642 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22kk'
17645 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17647 IF ( ehi(mgs) .gt. 0.0 .or. ( ehiclsn(mgs) > 0.0 .and. ipelec > 0 ))
THEN
17648 IF ( ipconc .ge. 5 )
THEN
17650 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,li,1))**2 + &
17651 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,li,1) )
17653 chaci0(mgs) = 0.25*pi*ehiclsn(mgs)*cx(mgs,lh)*cx(mgs,li)*vt* &
17654 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
17655 & dab0lh(mgs,lh,li)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
17656 & da0(li)*xdia(mgs,li,3)**2 )
17660 & ((0.25)*pi)*ehiclsn(mgs)*cx(mgs,li)*cx(mgs,lh) &
17661 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,li,1)) &
17662 & *( gf1*xdia(mgs,li,2) &
17663 & + 2.0*gf2*xdia(mgs,li,1)*xdia(mgs,lh,1) &
17664 & + gf3*xdia(mgs,lh,2) )
17667 chaci(mgs) = min(ehi(mgs)*chaci0(mgs),cimxd(mgs))
17675 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22nn'
17678 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17680 IF ( ehs(mgs) .gt. 0 )
THEN
17681 IF ( ipconc .ge. 5 .or. ( ehsclsn(mgs) > 0.0 .and. ipelec > 0 ) )
THEN
17683 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1))**2 + &
17684 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,ls,1) )
17686 chacs0(mgs) = 0.25*pi*ehsclsn(mgs)*cx(mgs,lh)*cx(mgs,ls)*vt* &
17687 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
17688 & dab0lh(mgs,lh,ls)*xdia(mgs,lh,3)*xdia(mgs,ls,3) + &
17689 & da0(ls)*xdia(mgs,ls,3)**2 )
17693 & ((0.25)*pi)*ehsclsn(mgs)*cx(mgs,ls)*cx(mgs,lh) &
17694 & *abs(vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1)) &
17695 & *( gf3*gf1*xdia(mgs,ls,2) &
17696 & + 2.0*gf2*gf2*xdia(mgs,ls,1)*xdia(mgs,lh,1) &
17697 & + gf1*gf3*xdia(mgs,lh,2) )
17699 chacs(mgs) = min(ehs(mgs)*chacs0(mgs),csmxd(mgs))
17709 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22ii'
17711 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17714 IF ( lhl .gt. 1 .and. ipconc .ge. 5 )
THEN
17715 IF ( qhlacw(mgs) .gt. 0.0 .and. xmas(mgs,lc) .gt. 0.0 )
THEN
17729 chlacw(mgs) = qhlacw(mgs)*rho0(mgs)/xmascw(mgs)
17731 chlacw(mgs) = min( chlacw(mgs), 0.5*cx(mgs,lc)*dtpinv )
17749 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22kk'
17752 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17754 IF ( lhl .gt. 1 .and. ( ehli(mgs) .gt. 0.0 .or. (ipelec > 0 .and. ehliclsn(mgs) > 0.0) ) )
THEN
17755 IF ( ipconc .ge. 5 )
THEN
17757 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,li,1))**2 + &
17758 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,li,1) )
17760 chlaci0(mgs) = 0.25*pi*ehliclsn(mgs)*cx(mgs,lhl)*cx(mgs,li)*vt* &
17761 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17762 & dab0(lhl,li)*xdia(mgs,lhl,3)*xdia(mgs,li,3) + &
17763 & da0(li)*xdia(mgs,li,3)**2 )
17774 chlaci(mgs) = min(ehli(mgs)*chlaci0(mgs),cimxd(mgs))
17782 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_GS: conc 22jj'
17785 if ( ipconc .ge. 1 .or. ipelec .ge. 1 )
then
17787 IF ( lhl .gt. 1 .and. ( ehls(mgs) .gt. 0.0 .or. (ipelec > 0 .and. ehlsclsn(mgs) > 0.0) ) )
THEN
17788 IF ( ipconc .ge. 5 )
THEN
17790 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,ls,1))**2 + &
17791 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,ls,1) )
17793 chlacs0(mgs) = 0.25*pi*ehlsclsn(mgs)*cx(mgs,lhl)*cx(mgs,ls)*vt* &
17794 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
17795 & dab0(lhl,ls)*xdia(mgs,lhl,3)*xdia(mgs,ls,3) + &
17796 & da0(ls)*xdia(mgs,ls,3)**2 )
17806 chlacs(mgs) = min(ehls(mgs)*chlacs0(mgs),csmxd(mgs))
17815 IF ( ipconc .ge. 2 )
THEN
17816 if (ndebug .gt. 0 )
write(0,*)
'conc 26a'
17825 IF ( dmrauto >= -1 )
THEN
17829 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. 1000. .and. temg(mgs) .gt. tfrh+4.)
THEN
17831 volb = xv(mgs,lc)*(1./(1.+alpha(mgs,lc)))**(1./2.)
17832 cautn(mgs) = min(ccmxd(mgs), &
17833 & ((alpha(mgs,lc)+2.)/(alpha(mgs,lc)+1.))*aa1*cx(mgs,lc)**2*xv(mgs,lc)**2)
17834 cautn(mgs) = max( 0.0d0, cautn(mgs) )
17835 IF ( rb(mgs) .le. 7.51d-6 .or. dmrauto == -1)
THEN
17844 t2s = 3.72/(1.e6*(rb(mgs)-7.500d-6)*rho0(mgs)*qx(mgs,lc))
17846 qrcnw(mgs) = max( 0.0d0, xl2p(mgs)/(t2s*rho0(mgs)) )
17847 crcnw(mgs) = max( 0.0d0, min(3.5e9*xl2p(mgs)/t2s,0.5*cautn(mgs)) )
17849 IF ( dmrauto == 0 )
THEN
17850 IF ( qx(mgs,lr)*rho0(mgs) > 1.2*xl2p(mgs) .and. cx(mgs,lr) > cxmin )
THEN
17851 crcnw(mgs) = cx(mgs,lr)/qx(mgs,lr)*qrcnw(mgs)
17852 ELSEIF ( ( dmropt == 1 .or. dmropt == 3 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17853 tmp = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17854 crcnw(mgs) = min(tmp,crcnw(mgs) )
17855 ELSEIF ( ( dmropt == 4 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17857 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17859 crcnw(mgs) = (tmp*qrcnw(mgs)+tmp2*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17860 ELSEIF ( ( dmropt == 5 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17862 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17864 crcnw(mgs) = (tmp*qx(mgs,lc)+tmp2*qx(mgs,lr))/(qx(mgs,lc)+qx(mgs,lr))
17865 ELSEIF ( ( dmropt == 6 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17867 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17869 crcnw(mgs) = (tmp*xdia(mgs,lc,3)*qx(mgs,lc)+tmp2*xdia(mgs,lr,3)*qx(mgs,lr))/ &
17870 (xdia(mgs,lc,3)*qx(mgs,lc)+xdia(mgs,lr,3)*qx(mgs,lr))
17871 ELSEIF ( ( dmropt == 7 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17873 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17875 crcnw(mgs) = (tmp*xdia(mgs,lc,3)+tmp2*xdia(mgs,lr,3))/(xdia(mgs,lc,3)+xdia(mgs,lr,3))
17876 ELSEIF ( ( dmropt == 8 ) .and. qx(mgs,lr) > qxmin(lr) )
THEN
17878 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17880 crcnw(mgs) = (tmp*sqrt(xdia(mgs,lc,3))+tmp2*sqrt(xdia(mgs,lr,3)))/ &
17881 (sqrt(xdia(mgs,lc,3))+sqrt(xdia(mgs,lr,3)))
17883 ELSEIF ( dmrauto == 1 .and. cx(mgs,lr) > cxmin)
THEN
17884 IF ( qx(mgs,lr) > qxmin(lr) )
THEN
17885 tmp = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17886 crcnw(mgs) = min(tmp,crcnw(mgs) )
17888 ELSEIF ( dmrauto == 2 .and. cx(mgs,lr) > cxmin)
THEN
17890 tmp2 = qrcnw(mgs)*cx(mgs,lr)/qx(mgs,lr)
17892 crcnw(mgs) = (tmp*qrcnw(mgs)+tmp2*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17893 ELSEIF ( dmrauto == 3 .and. cx(mgs,lr) > cxmin)
THEN
17894 tmp = max( 2.d0*rh(mgs), dble( xdia(mgs,lr,3) ) )
17895 crcnw(mgs) = rho0(mgs)*qrcnw(mgs)/(pi/6.*1000.*tmp**3)
17898 IF ( crcnw(mgs) < 1.e-30 ) qrcnw(mgs) = 0.0
17900 IF ( ipconc >= 6 )
THEN
17901 IF ( lzr > 1 .and. qrcnw(mgs) > 0.0 )
THEN
17907 IF (qx(mgs,lr) .gt. qxmin(lr) .and. ( dmrauto == 1 .or. dmrauto ==2 ) )
THEN
17908 tmp3 = qx(mgs,lr)/cx(mgs,lr)
17909 tmp4 = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
17910 & ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs) )
17911 if (imurain == 3)
then
17912 vr = rho0(mgs)*qrcnw(mgs)/(1000.)
17913 tmp3 = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
17915 tmp3 = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
17917 IF ( dmrauto == 1 )
THEN
17919 ELSEIF ( dmrauto == 2 )
THEN
17920 zrcnw(mgs) = (tmp3*qrcnw(mgs)+tmp4*qx(mgs,lr))/(qrcnw(mgs)+qx(mgs,lr))
17923 IF ( imurain == 3 )
THEN
17924 vr = rho0(mgs)*qrcnw(mgs)/(1000.)
17925 zrcnw(mgs) = 36.*(xnu(lc)+2.0)*vr**2/(crcnw(mgs)*(xnu(lc)+1.0)*pi**2)
17927 IF ( dmropt <= 1 .or. dmropt >= 4 .or. ( qx(mgs,lr) < qxmin(lr) .and. cx(mgs,lr) < cxmin ) )
THEN
17928 zrcnw(mgs) = galpharaut*(6.*rho0(mgs)*qrcnw(mgs)/(pi*xdn0(lr)))**2/crcnw(mgs)
17930 tmp3 = qx(mgs,lr)/cx(mgs,lr)
17931 zrcnw(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
17932 & ( 2.*tmp3 * qrcnw(mgs) - tmp3**2 * crcnw(mgs) )
17981 if ( ircnw .eq. 4 )
then
17985 qdiff = max((qx(mgs,lc)-qminrncw),0.0)
17986 if ( qdiff .gt. 0.0 .and. xdia(mgs,lc,1) .gt. 20.0e-6 )
then
17988 & ((1.2e-4)+(1.596e-12)*(cx(mgs,lc)*1.0e-6) &
17989 & /(cwdisp*qdiff*1.0e-3*rho0(mgs)))
17990 qrcnw(mgs) = (rho0(mgs)*1e-3)*(qdiff**2)/argrcnw
17992 qrcnw(mgs) = (max(qrcnw(mgs),0.0))
18003 if ( ircnw .eq. 5 )
then
18007 qccrit = (pi/6.)*(cx(mgs,lc)*cwdiap**3)*xdn(mgs,lc)/rho0(mgs)
18008 qdiff = max((qx(mgs,lc)-qccrit),0.)
18009 if ( qdiff .gt. 0.0 .and. cx(mgs,lc) .gt. 1.0 )
then
18012 & ((1.2e-4)+(1.596e-12)*cx(mgs,lc)*1.0e-3/(cwdisp*rho0(mgs)*qdiff))
18015 & 1.0e-3*rho0(mgs)*(qdiff**2)/argrcnw
18016 qrcnw(mgs) = min(qxmxd(mgs,lc), (max(qrcnw(mgs),0.0)) )
18027 if ( ircnw .eq. 2 )
then
18030 qrcnw(mgs) = (0.001)*max((qx(mgs,lc)-qminrncw),0.0)
18038 if ( ircnw .eq. 1 )
then
18044 & (1.e+06) * ((c1/(0.38))**(1./3.)) * (xdia(mgs,lc,1)*(0.5))
18046 & (0.027) * ((100.0)*(bradp**3)*(xdia(mgs,lc,1)*(0.5)) - (0.4))
18047 bt2 = (bradp -7.5) / (3.72)
18049 if ( bl2 .gt. 0.0 .and. bt2 .gt. 0.0 )
then
18050 qrcnw(mgs) = bl2 * bt2 * rho0(mgs) &
18051 & * qx(mgs,lc) * qx(mgs,lc)
18065 if (ndebug .gt. 0 )
write(0,*)
'conc 27a'
18078 IF ( .not. ( ipconc == 0 .and. lwsm6 ) )
THEN
18081 if ( qx(mgs,lr) .gt. qxmin(lr) .and. temcg(mgs) .lt. -5. .and. ibiggopt > 0 )
then
18084 IF ( ipconc .lt. 3 )
THEN
18087 & (20.0)*(pi**2)*brz*(xdn(mgs,lr)/rho0(mgs)) &
18088 & *cx(mgs,lr)*(xdia(mgs,lr,1)**6) &
18089 & *(exp(max(-arz*temcg(mgs), 0.0))-1.0) &
18091 qrfrzf(mgs) = qrfrz(mgs)
18094 ELSEIF ( ipconc .ge. 3 )
THEN
18101 IF ( ibiggopt == 2 .and. imurain == 1 )
THEN
18104 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
18107 dbigg = (6./pi* volt )**(1./3.)
18110 IF ( dbigg < 8.e-3 )
THEN
18112 ratio = min(maxratiolu, dbigg/xdia(mgs,lr,1) )
18114 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
18115 IF ( alp0flag )
THEN
18116 j = int(max(0.0,min(15.,alpha(mgs,lr)))*dqiacralphainv)
18118 j = int(max(minalphalu,min(maxalphalu,alpha(mgs,lr)))*dqiacralphainv)
18120 delx = ratio - float(i)*dqiacrratio
18121 dely = alpha(mgs,lr) - float(j)*dqiacralpha
18122 ip1 = min( i+1, nqiacrratio )
18123 jp1 = min( j+1, nqiacralpha )
18126 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
18127 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
18131 crfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)*dtpinv
18132 crfrzf(mgs) = crfrz(mgs)
18134 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
18135 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
18139 qrfrz(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)*dtpinv
18140 qrfrzf(mgs) = qrfrz(mgs)
18142 IF ( qrfrz(mgs)*dtp < qxmin(lh) .or. crfrz(mgs)*dtp < cxmin )
THEN
18151 IF ( ipconc >= 5 .or. lzr > 1 )
THEN
18153 cxd1 = crfrz(mgs)*dtp
18154 qxd1 = qrfrz(mgs)*dtp
18157 tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
18158 tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
18162 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18163 zxd1 = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)
18165 zrfrz(mgs) = zxd1*dtpinv
18167 tmp3 = g1xmax*(rho0(mgs)*qxd1)**2/((pi*xdn(mgs,lh)/6.0)**2)
18169 IF ( tmp4 > zxd1 )
THEN
18173 crfrzf(mgs) = dtpinv*cxd1
18177 tmp5 = g1x(mgs,lr)*(rho0(mgs)*qx(mgs,lr))**2/((pi*xdn(mgs,lr)/6.)**2*cx(mgs,lr))
18178 zxd1 = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*tmp5
18181 tmp3 = g1x(mgs,lr)*(rho0(mgs)*qxd1)**2/((pi*xdn(mgs,lr)/6.0)**2)
18183 IF ( tmp4 > zxd1 )
THEN
18184 crfrzf(mgs) = tmp3/zxd1*dtpinv
18190 IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < 2.*xvmn(lr) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) )
THEN
18195 crfrzs(mgs) = crfrz(mgs)
18196 qrfrzs(mgs) = qrfrz(mgs)
18198 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18199 zrfrzs(mgs) = zrfrz(mgs)
18202 ELSEIF ( dbigg < max( biggsnowdiam, max(dfrz,dhmn)) .and. ( ibiggsnow == 1 .or. ibiggsnow == 3 ) )
THEN
18205 crfrzs(mgs) = crfrz(mgs)
18206 qrfrzs(mgs) = qrfrz(mgs)
18208 IF ( ibiggsmallrain > 0 .and. xv(mgs,lr) < 1.2*xvmn(lr) )
THEN
18213 IF (ipconc >= 6 .and. lzr > 1 )
THEN
18214 zrfrzs(mgs) = zrfrz(mgs)
18220 ratio = min( maxratiolu, max(dfrz,dhmn)/xdia(mgs,lr,1) )
18222 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
18225 IF ( alp0flag )
THEN
18226 j = int(max(0.0,min(alphamax,alpha(mgs,lr)))*dqiacralphainv)
18228 j = int(max(minalphalu,min(maxalphalu,alpha(mgs,lr)))*dqiacralphainv)
18230 delx = ratio - float(i)*dqiacrratio
18231 dely = alpha(mgs,lr) - float(j)*dqiacralpha
18232 ip1 = min( i+1, nqiacrratio )
18233 jp1 = min( j+1, nqiacralpha )
18236 tmp1 = ciacrratio(i,j) + delx*dqiacrratioinv*(ciacrratio(ip1,j) - ciacrratio(i,j))
18237 tmp2 = ciacrratio(i,jp1) + delx*dqiacrratioinv*(ciacrratio(ip1,jp1) - ciacrratio(i,jp1))
18242 crfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*cx(mgs,lr)*dtpinv
18245 tmp1 = qiacrratio(i,j) + delx*dqiacrratioinv*(qiacrratio(ip1,j) - qiacrratio(i,j))
18246 tmp2 = qiacrratio(i,jp1) + delx*dqiacrratioinv*(qiacrratio(ip1,jp1) - qiacrratio(i,jp1))
18250 qrfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*qx(mgs,lr)*dtpinv
18253 crfrzs(mgs) = crfrzs(mgs) - crfrzf(mgs)
18254 qrfrzs(mgs) = qrfrzs(mgs) - qrfrzf(mgs)
18256 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18257 zrfrzs(mgs) = zrfrz(mgs)
18259 tmp1 = ziacrratio(i,j) + delx*dqiacrratioinv*(ziacrratio(ip1,j) - ziacrratio(i,j))
18260 tmp2 = ziacrratio(i,jp1) + delx*dqiacrratioinv*(ziacrratio(ip1,jp1) - ziacrratio(i,jp1))
18264 zrfrzf(mgs) = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))*zx(mgs,lr)*dtpinv
18265 zrfrzs(mgs) = zrfrzs(mgs) - zrfrzf(mgs)
18266 zrfrzf(mgs) = (1000./900.)**2*zrfrzf(mgs)
18277 IF ( (qrfrz(mgs))*dtp > qx(mgs,lr) )
THEN
18278 fac = ( qrfrz(mgs) )*dtp/qx(mgs,lr)
18279 qrfrz(mgs) = fac*qrfrz(mgs)
18280 qrfrzs(mgs) = fac*qrfrzs(mgs)
18281 qrfrzf(mgs) = fac*qrfrzf(mgs)
18282 crfrz(mgs) = fac*crfrz(mgs)
18283 crfrzs(mgs) = fac*crfrzs(mgs)
18284 crfrzf(mgs) = fac*crfrzf(mgs)
18285 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18286 zrfrz(mgs) = fac*zrfrz(mgs)
18287 zrfrzf(mgs) = fac*zrfrzf(mgs)
18306 ELSEIF ( ibiggopt == 1 )
THEN
18308 tmp = xv(mgs,lr)*brz*cx(mgs,lr)*(exp(max( -arz*temcg(mgs), 0.0 )) - 1.0)
18309 IF ( .false. .and. tmp .gt. cxmxd(mgs,lr) )
THEN
18313 crfrz(mgs) = cxmxd(mgs,lr)
18314 qrfrz(mgs) = qxmxd(mgs,lr)
18324 IF ( lzr < 1 )
THEN
18325 IF ( imurain == 3 )
THEN
18332 IF ( imurain == 3 )
THEN
18333 bfnu = (alpha(mgs,lr)+2.0)/(alpha(mgs,lr)+1.)
18336 bfnu = (4. + alpha(mgs,lr))*(5. + alpha(mgs,lr))*(6. + alpha(mgs,lr))/ &
18337 & ((1. + alpha(mgs,lr))*(2. + alpha(mgs,lr))*(3. + alpha(mgs,lr)))
18341 qrfrz(mgs) = bfnu*xmas(mgs,lr)*rhoinv(mgs)*crfrz(mgs)
18343 qrfrz(mgs) = min( qrfrz(mgs), 1.*qx(mgs,lr)*dtpinv )
18344 crfrz(mgs) = min( crfrz(mgs), 1.*cx(mgs,lr)*dtpinv )
18345 qrfrz(mgs) = min( qrfrz(mgs), qx(mgs,lr) )
18346 qrfrzf(mgs) = qrfrz(mgs)
18352 IF ( crfrz(mgs) .gt. qxmin(lh) )
THEN
18357 IF ( (ibiggsnow == 1 .or. ibiggsnow == 3 ) .and. ibiggopt /= 2 )
THEN
18358 xvfrz = rho0(mgs)*qrfrz(mgs)/(crfrz(mgs)*900.)
18359 frach = 0.5 *(1. + tanh(0.2e12 *( xvfrz - 1.15*xvmn(lh))))
18361 qrfrzs(mgs) = (1.-frach)*qrfrz(mgs)
18362 crfrzs(mgs) = (1.-frach)*crfrz(mgs)
18367 IF ( ipconc .ge. 14 .and. 1.e-3*rho0(mgs)*qrfrz(mgs)/crfrz(mgs) .lt. xvmn(lh) )
THEN
18368 qrfrzs(mgs) = qrfrz(mgs)
18369 crfrzs(mgs) = crfrz(mgs)
18373 qrfrzf(mgs) = frach*qrfrz(mgs)
18375 IF ( ibfr .le. 1 )
THEN
18376 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*1.0*vr1mm*1000.0)*rho0(mgs) )
18377 ELSEIF ( ibfr .eq. 5 )
THEN
18378 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*vfrz*1000.0)*rho0(mgs) )*rzxh(mgs)
18379 ELSEIF ( ibfr .eq. 2 )
THEN
18380 crfrzf(mgs) = frach*min(crfrz(mgs), qrfrz(mgs)/(bfnu*vfrz*1000.0)*rho0(mgs) )
18381 ELSEIF ( ibfr .eq. 6 )
THEN
18382 crfrzf(mgs) = frach*max(crfrz(mgs), qrfrz(mgs)/(bfnu*9.*xv(mgs,lr)*1000.0)*rho0(mgs) )
18384 crfrzf(mgs) = frach*crfrz(mgs)
18400 IF ( lvol(lh) .gt. 1 )
THEN
18401 vrfrzf(mgs) = rho0(mgs)*qrfrzf(mgs)/rhofrz
18405 IF ( nsplinter .ne. 0 )
THEN
18406 IF ( nsplinter .ge. 1000 )
THEN
18410 IF ( qrfrz(mgs)*dtp > qxmin(lh) .and. crfrz(mgs) > 1.e-3 )
THEN
18411 tmpdiam = 1.e6*( 6.*qrfrz(mgs)/(1000.*pi*crfrz(mgs) ))**(1./3.)
18413 IF ( nsplinter .eq. 1001 )
THEN
18416 fac = 0.2*exp(-0.5*((258.-temg(mgs))/10.)**2 )
18418 tmp = fac*lawson_splinter_fac*tmpdiam**4*crfrz(mgs)
18420 ELSEIF ( nsplinter .gt. 0 )
THEN
18421 tmp = nsplinter*crfrz(mgs)
18423 tmp = -nsplinter*crfrzf(mgs)
18425 csplinter2(mgs) = tmp
18426 qsplinter2(mgs) = min(0.1*qrfrz(mgs), tmp*splintermass/rho0(mgs) )
18453 if (ndebug .gt. 0 )
write(0,*)
'conc 25b'
18461 IF ( ibfc .ge. 1 .and. ibfc /= 3 .and. temg(mgs) < 268.15 )
THEN
18464 if ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. cxmin )
THEN
18465 IF ( ipconc < 2 )
THEN
18466 qwfrz(mgs) = ((2.0)*(brz)/(xdn(mgs,lc)*cx(mgs,lc))) &
18467 & *(exp(max(-arz*temcg(mgs), 0.0))-1.0) &
18468 & *rho0(mgs)*(qx(mgs,lc)**2)
18469 qwfrz(mgs) = max(qwfrz(mgs), 0.0)
18470 qwfrz(mgs) = min(qwfrz(mgs),qcmxd(mgs))
18471 cwfrz(mgs) = qwfrz(mgs)*rho0(mgs)/xmas(mgs,li)
18472 ELSEIF ( ipconc .ge. 2 )
THEN
18473 IF ( xdia(mgs,lc,3) > 0.e-6 )
THEN
18474 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
18479 IF ( alpha(mgs,lc) == 0.0 )
THEN
18480 cwfrz(mgs) = cx(mgs,lc)*exp(-volt/xv(mgs,lc))*dtpinv
18484 qwfrz(mgs) = cwfrz(mgs)*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
18486 ratio = (1. + alpha(mgs,lc))*volt/xv(mgs,lc)
18488 IF ( .false. .and. usegamxinfcnu )
THEN
18489 i = nint(dgami*(1. + alpha(mgs,lc)))
18491 i = nint(dgami*(2. + alpha(mgs,lc)))
18494 cwfrz(mgs) = cx(mgs,lc)*
gamxinf(1.+alpha(mgs,lc), ratio)/(dtp*gcnup1)
18496 qwfrz(mgs) = cx(mgs,lc)*xdn0(lc)*xv(mgs,lc)*rhoinv(mgs)*
gamxinf(2.+alpha(mgs,lc), ratio)/(dtp*gcnup2)
18500 ratio = min( maxratiolu, ratio )
18504 tmp =
gaminterp(ratio,alpha(mgs,lc),1,1)
18506 cwfrz(mgs) = cx(mgs,lc)*tmp*dtpinv
18508 tmp =
gaminterp(ratio,alpha(mgs,lc),12,1)
18510 qwfrz(mgs) = cx(mgs,lc)*xdn0(lc)*xv(mgs,lc)*rhoinv(mgs)*dtpinv*tmp
18518 if ( temg(mgs) .gt. 268.15 )
then
18525 if ( xplate(mgs) .eq. 1 )
then
18526 qwfrzp(mgs) = qwfrz(mgs)
18527 cwfrzp(mgs) = cwfrz(mgs)
18530 if ( xcolmn(mgs) .eq. 1 )
then
18531 qwfrzc(mgs) = qwfrz(mgs)
18532 cwfrzc(mgs) = cwfrz(mgs)
18545 if (ndebug .gt. 0 )
write(0,*)
'conc 25a'
18560 IF ( icfn .ge. 1 )
THEN
18562 IF ( temg(mgs) .lt. 271.15 .and. qx(mgs,lc) .gt. qxmin(lc))
THEN
18566 IF ( icfn .ge. 2 )
THEN
18567 ccia(mgs) = exp( 4.11 - (0.262)*temcg(mgs) )
18573 knud(mgs) = 2.28e-5 * temg(mgs) / ( pres(mgs)*raero )
18574 knuda(mgs) = 1.257 + 0.4*exp(-1.1/knud(mgs))
18575 gtp(mgs) = 1. / ( fai(mgs) + fbi(mgs) )
18576 dfar(mgs) = kb*temg(mgs)*(1.+knuda(mgs)*knud(mgs))/(6.*pi*fadvisc(mgs)*raero)
18577 fn1(mgs) = 2.*pi*xdia(mgs,lc,1)*cx(mgs,lc)*ccia(mgs)
18578 fn2(mgs) = -gtp(mgs)*(ssw(mgs)-1.)*felv(mgs)/pres(mgs)
18579 fnft(mgs) = 0.4*(1.+1.45*knud(mgs)+0.4*knud(mgs)*exp(-1./knud(mgs)))*(ftka(mgs)+2.5*knud(mgs)*kaero) &
18580 & / ( (1.+3.*knud(mgs))*(2*ftka(mgs)+5.*knud(mgs)*kaero+kaero) )
18584 ctfzbd(mgs) = fn1(mgs)*dfar(mgs)
18587 ctfzth(mgs) = fn1(mgs)*fn2(mgs)*fnft(mgs)/rho0(mgs)
18590 ctfzdi(mgs) = fn1(mgs)*fn2(mgs)*rw*temg(mgs)/(felv(mgs)*rho0(mgs))
18592 cwctfz(mgs) = max( ctfzbd(mgs) + ctfzth(mgs) + ctfzdi(mgs) , 0.)
18602 ELSEIF ( icfn .eq. 1 )
THEN
18603 IF ( wvel(mgs) .lt. -0.05 )
THEN
18604 cwctfz(mgs) = cfnfac*exp( (-2.80) - (0.262)*temcg(mgs) )
18605 cwctfz(mgs) = min((1.0e3)*cwctfz(mgs), ccmxd(mgs) )
18609 IF ( ipconc .ge. 2 )
THEN
18610 cwctfz(mgs) = min( cwctfz(mgs)*dtpinv, ccmxd(mgs) )
18611 qwctfz(mgs) = xmas(mgs,lc)*cwctfz(mgs)/rho0(mgs)
18613 qwctfz(mgs) = (cimasn)*cwctfz(mgs)/(dtp*rho0(mgs))
18614 qwctfz(mgs) = max(qwctfz(mgs), 0.0)
18615 qwctfz(mgs) = min(qwctfz(mgs),qcmxd(mgs))
18619 if ( xplate(mgs) .eq. 1 )
then
18620 qwctfzp(mgs) = qwctfz(mgs)
18621 cwctfzp(mgs) = cwctfz(mgs)
18624 if ( xcolmn(mgs) .eq. 1 )
then
18625 qwctfzc(mgs) = qwctfz(mgs)
18626 cwctfzc(mgs) = cwctfz(mgs)
18647 if (ndebug .gt. 0 )
write(0,*)
'conc 23a'
18649 hrifac = (1.e-3)*((0.044)*(0.01**3))
18657 IF ( ihrn .ge. 1 )
THEN
18658 if ( qx(mgs,lc) .gt. qxmin(lc) )
then
18659 if ( temg(mgs) .lt. 273.15 )
then
18670 IF ( log(cx(mgs,lc)*(1.e-6)/(3.0)) .gt. 0.0 )
THEN
18671 ciihr(mgs) = ((1.69e17)/dthr) &
18672 & *(log(cx(mgs,lc)*(1.e-6)/(3.0)) * &
18673 & ((1.e-3)*rho0(mgs)*qx(mgs,lc))/(cx(mgs,lc)*(1.e-6)))**(7./3.)
18674 ciihr(mgs) = ciihr(mgs)*(1.0e6)
18675 qiihr(mgs) = hrifac*ciihr(mgs)/rho0(mgs)
18676 qiihr(mgs) = max(qiihr(mgs), 0.0)
18677 qiihr(mgs) = min(qiihr(mgs),qcmxd(mgs))
18680 if ( xplate(mgs) .eq. 1 )
then
18681 qipiphr(mgs) = qiihr(mgs)
18682 cipiphr(mgs) = ciihr(mgs)
18685 if ( xcolmn(mgs) .eq. 1 )
then
18686 qicichr(mgs) = qiihr(mgs)
18687 cicichr(mgs) = ciihr(mgs)
18728 IF ( temg(mgs) .lt. tfr .and. qx(mgs,li) .gt. qxmin(li) )
THEN
18729 IF ( ipconc .ge. 4 .and. .false. )
THEN
18730 if ( cx(mgs,li) .gt. 10. .and. xdia(mgs,li,1) .gt. 50.e-6 )
then
18732 & (qx(mgs,li)*rho0(mgs) &
18733 & /(pi*xdn(mgs,li)*cx(mgs,li)))**(1./3.)
18734 IF ( cirdiatmp .gt. 100.e-6 )
THEN
18736 & ((pi*xdn(mgs,li)*cx(mgs,li)) / (6.0*rho0(mgs)*dtp)) &
18737 & *exp(-hdia0/cirdiatmp) &
18738 & *( (hdia0**3) + 3.0*(hdia0**2)*cirdiatmp &
18739 & + 6.0*(hdia0)*(cirdiatmp**2) + 6.0*(cirdiatmp**3) )
18741 & min(qscnvi(mgs),qimxd(mgs))
18742 IF ( ipconc .ge. 4 )
THEN
18743 cscnvi(mgs) = min( cimxd(mgs), cx(mgs,li)*exp(-hdia0/cirdiatmp))
18748 ELSEIF ( ipconc .lt. 4 )
THEN
18750 qscnvi(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
18751 qscnvi(mgs) = min(qscnvi(mgs),qxmxd(mgs,li))
18752 cscnvi(mgs) = qscnvi(mgs)*rho0(mgs)/xmas(mgs,li)
18753 cscnvis(mgs) = 0.5*cscnvi(mgs)
18766 fvent(mgs) = (fschm(mgs)**(1./3.)) * (fakvisc(mgs)**(-0.5))
18770 if ( ndebug .gt. 0 )
write(0,*)
'civent'
18781 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
18782 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
18783 IF ( qx(mgs,li) .gt. qxmin(li) )
THEN
18785 & (civenta*xdia(mgs,li,1)**civentb &
18786 & +civentc*xdia(mgs,li,1)**civentd) &
18788 & (civente*xdia(mgs,li,1)**civentf+civentg)
18789 xcivent = (fschm(mgs)**(1./3.))*((cireyn/fakvisc(mgs))**0.5)
18790 if ( xcivent .lt. 1.0 )
then
18791 civent(mgs) = 1.0 + 0.14*xcivent**2
18793 if ( xcivent .ge. 1.0 )
then
18794 civent(mgs) = 0.86 + 0.28*xcivent
18807 igmrwb = 100.*((5.0+br)/2.0)
18808 rwventa = (0.78)*gmoi(igmrwa)
18809 rwventb = (0.308)*gmoi(igmrwb)
18811 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
18812 IF ( ipconc .ge. 3 )
THEN
18813 IF ( imurain == 3 )
THEN
18814 IF ( izwisventr == 1 )
THEN
18815 rwvent(mgs) = ventrx(mgs)*(1.6 + 124.9*(1.e-3*rho0(mgs)*qx(mgs,lr))**.2046)
18819 & (0.78*ventrx(mgs) + 0.308*ventrxn(mgs)*fvent(mgs) &
18820 & *sqrt((ar*rhovt(mgs))) &
18821 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18831 IF ( iferwisventr == 1 )
THEN
18835 alpr = min(alpharmax,alpha(mgs,lr) )
18837 x = 1. + alpha(mgs,lr)
18839 IF ( ipconc >= 6 .and. lzr > 1 )
THEN
18841 i = int(dgami*(tmp))
18843 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18845 tmp = 2.5 + alpha(mgs,lr) + 0.5*bx(lr)
18846 i = int(dgami*(tmp))
18848 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
18855 vent1 = dble(xdia(mgs,lr,1))**(0.5 + 0.5*bx(lr))
18856 vent2 = dble(1. + 0.5*fx(lr)*xdia(mgs,lr,1))**dble(2.5+alpr+0.5*bx(lr))
18861 & 0.308*fvent(mgs)*y* &
18862 & sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
18872 ELSEIF ( iferwisventr == 2 )
THEN
18875 x = 1. + alpha(mgs,lr)
18878 & (0.78*x + 0.308*ventrxn(mgs)*fvent(mgs) &
18879 & *sqrt((ar*rhovt(mgs))) &
18880 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18883 IF ( ipconc >= 7 )
THEN
18885 alpr = min(alpharmax,alpha(mgs,lr) )
18887 tmp = alpr + 5.5 + br/2.
18888 i = int(dgami*(tmp))
18890 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18895 & 0.78*(4. + alpr)*(3. + alpr)*(2. + alpr)*(1. + alpr) + &
18896 & 0.308*fvent(mgs)* &
18897 & sqrt(ax(lr)*rhovt(mgs))*(y/gf1palp(mgs))*(xdia(mgs,lr,1)**((1.0+br)/2.0))
18907 & (rwventa + rwventb*fvent(mgs) &
18908 & *sqrt((ar*rhovt(mgs))) &
18909 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
18917 igmswb = 100.*((5.0+ds)/2.0)
18918 swventa = (0.78)*gmoi(igmswa)
18919 swventb = (0.308)*gmoi(igmswb)
18921 IF ( qx(mgs,ls) .gt. qxmin(ls) )
THEN
18922 IF ( ipconc .ge. 4 )
THEN
18923 swvent(mgs) = 0.65 + 0.44*fvent(mgs)*sqrt(vtxbar(mgs,ls,1)*xdia(mgs,ls,1))
18927 & (swventa + swventb*fvent(mgs) &
18928 & *sqrt((cs*rhovt(mgs))) &
18929 & *(xdia(mgs,ls,1)**((1.0+ds)/2.0)) )
18939 igmhwb = 100.0*2.75
18940 hwventa = (0.78)*gmoi(igmhwa)
18941 hwventb = (0.308)*gmoi(igmhwb)
18947 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
18948 hwventc = (4.0*gr/(3.0*cdxgs(mgs,lh)))**(0.25)
18949 IF ( .false. .or. alpha(mgs,lh) .eq. 0.0 )
THEN
18951 & ( hwventa + hwventb*hwventc*fvent(mgs) &
18952 & *((xdn(mgs,lh)/rho0(mgs))**(0.25)) &
18953 & *(xdia(mgs,lh,1)**(0.75)))
18963 x = 1. + alpha(mgs,lh)
18965 tmp = 1 + alpha(mgs,lh)
18966 i = int(dgami*(tmp))
18968 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
18970 tmp = 2.5 + alpha(mgs,lh) + 0.5*bxx(mgs,lh)
18971 i = int(dgami*(tmp))
18973 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
18976 hwventy(mgs) = 0.308*fvent(mgs)*(xdia(mgs,lh,1)**(0.5 + 0.5*bxx(mgs,lh)))*sqrt(axx(mgs,lh)*rhovt(mgs))
18978 & ( 0.78*x + y*hwventy(mgs) )
18993 IF ( lhl .gt. 1 )
THEN
18995 igmhwb = 100.0*2.75
18996 hwventa = (0.78)*gmoi(igmhwa)
18997 hwventb = (0.308)*gmoi(igmhwb)
19000 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
19001 hwventc = (4.0*gr/(3.0*cdxgs(mgs,lhl)))**(0.25)
19003 IF ( .false. .or. alpha(mgs,lhl) .eq. 0.0 )
THEN
19005 & ( hwventa + hwventb*hwventc*fvent(mgs) &
19006 & *((xdn(mgs,lhl)/rho0(mgs))**(0.25)) &
19007 & *(xdia(mgs,lhl,1)**(0.75)))
19018 x = 1. + alpha(mgs,lhl)
19020 tmp = 1 + alpha(mgs,lhl)
19021 i = int(dgami*(tmp))
19023 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
19025 tmp = 2.5 + alpha(mgs,lhl) + 0.5*bxx(mgs,lhl)
19026 i = int(dgami*(tmp))
19028 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
19030 hlventy(mgs) = 0.308*fvent(mgs)*(xdia(mgs,lhl,1)**(0.5 + 0.5*bxx(mgs,lhl)))*sqrt(axx(mgs,lhl)*rhovt(mgs))
19032 hlvent(mgs) = 0.78*x + y*hlventy(mgs)
19050 & ( felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qss0(mgs)-qx(mgs,lv)) &
19051 & -ftka(mgs)*temcg(mgs) ) &
19052 & / ( rho0(mgs)*(felf(mgs)+fcw(mgs)*temcg(mgs)) )
19054 & (1.0)-fci(mgs)*temcg(mgs) &
19055 & / ( felf(mgs)+fcw(mgs)*temcg(mgs) )
19061 fmlt1(mgs) = (2.0*pi)* &
19062 & ( felv(mgs)*fwvdf(mgs)*(qss0(mgs)-qx(mgs,lv)) &
19063 & -ftka(mgs)*temcg(mgs)/rho0(mgs) ) &
19065 fmlt2(mgs) = -fcw(mgs)*temcg(mgs)/felf(mgs)
19066 fmlt1e(mgs) = (2.0*pi)* &
19067 & ( felv(mgs)*fwvdf(mgs)*(qss0(mgs)-qx(mgs,lv)) ) / (felf(mgs))
19074 & (4.0*pi/rho0(mgs))*(ssi(mgs)-1.0)* &
19075 & (1.0/(fai(mgs)+fbi(mgs)))
19079 & (4.0*pi/rho0(mgs))*(ssw(mgs)-1.0)* &
19080 & (1.0/(fav(mgs)+fbv(mgs)))
19090 IF ( lhwlg > 1 )
THEN
19128 if ( .not. mixedphase )
then
19131 IF ( temg(mgs) .gt. tfr )
THEN
19133 IF ( qx(mgs,ls) .gt. qxmin(ls) )
THEN
19136 & (c1sw*fmlt1(mgs)*cx(mgs,ls)*swvent(mgs)*xdia(mgs,ls,1) ) &
19152 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
19154 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
19157 & fmlt1(mgs)*cx(mgs,lh)*hwvent(mgs)*xdia(mgs,lh,1) &
19158 & + fmlt2(mgs)*(qhacrmlr(mgs)+qhacwmlr(mgs)) &
19160 ELSEIF ( ibinhmlr == 1 )
THEN
19162 errmsg =
'ibinhmlr = 1 not available for 2-moment'
19166 ELSEIF ( ibinhmlr == 2 .or. ibinhmlr == 3 )
THEN
19171 IF ( ivhmltsoak > 0 .and. qhmlr(mgs) < 0.0 .and. lvol(lh) > 1 .and. xdn(mgs,lh) .lt. xdnmx(lh) )
THEN
19173 v1 = (1. - xdn(mgs,lh)/xdnmx(lh))*(vx(mgs,lh) + rho0(mgs)*qhmlr(mgs)/xdn(mgs,lh) )/(dtp)
19174 v2 = -1.0*rho0(mgs)*qhmlr(mgs)/xdnmx(lh)
19176 vhsoak(mgs) = min(v1,v2)
19183 IF ( lhl .gt. 1 .and. lhlw < 1 )
THEN
19185 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
19186 IF ( ibinhlmlr == 0 .or. lzhl < 1)
THEN
19189 & fmlt1(mgs)*cx(mgs,lhl)*hlvent(mgs)*xdia(mgs,lhl,1) &
19190 & + fmlt2(mgs)*(qhlacrmlr(mgs)+qhlacwmlr(mgs)) &
19193 ELSEIF ( ibinhlmlr == 1 )
THEN
19196 ELSEIF ( ibinhlmlr == -1 )
THEN
19201 IF ( ivhmltsoak > 0 .and. qhlmlr(mgs) < 0.0 .and. lvol(lhl) > 1 .and. xdn(mgs,lhl) .lt. xdnmx(lhl) )
THEN
19203 v1 = (1. - xdn(mgs,lhl)/xdnmx(lhl))*(vx(mgs,lhl) + rho0(mgs)*qhlmlr(mgs)/xdn(mgs,lhl) )/(dtp)
19204 v2 = -1.0*rho0(mgs)*qhlmlr(mgs)/xdnmx(lhl)
19206 vhlsoak(mgs) = min(v1,v2)
19219 if ( .not. mixedphase ) qsmlr(mgs) = max( qsmlr(mgs), min( -qsmxd(mgs), -0.7*qx(mgs,ls)*dtpinv ) )
19220 IF ( .not. mixedphase )
THEN
19221 qhmlr(mgs) = max( qhmlr(mgs), min( -qhmxd(mgs), -0.95*qx(mgs,lh)*dtpinv ) )
19222 chmlr(mgs) = max( chmlr(mgs), min( -chmxd(mgs), -0.95*cx(mgs,lh)*dtpinv ) )
19231 IF ( lhl .gt. 1 .and. lhlw < 1 )
THEN
19232 qhlmlr(mgs) = max( qhlmlr(mgs), min( -qxmxd(mgs,lhl), -0.95*qx(mgs,lhl)*dtpinv ) )
19233 chlmlr(mgs) = max( chlmlr(mgs), min( -cxmxd(mgs,lhl), -0.95*cx(mgs,lhl)*dtpinv ) )
19241 if ( ipconc .ge. 1 )
then
19243 cimlr(mgs) = (cx(mgs,li)/(qx(mgs,li)+1.e-20))*qimlr(mgs)
19244 IF ( .not. mixedphase )
THEN
19245 IF ( xdia(mgs,ls,1) .gt. 1.e-6 .and. -qsmlr(mgs) .ge. 0.5*qxmin(ls) .and. ipconc .ge. 4 )
THEN
19247 csmlr(mgs) = (cx(mgs,ls)/(qx(mgs,ls)))*qsmlr(mgs)
19248 ELSEIF ( qx(mgs,ls) > qxmin(ls) )
THEN
19249 csmlr(mgs) = (cx(mgs,ls)/(qx(mgs,ls)))*qsmlr(mgs)
19252 csmlrr(mgs) = csmlr(mgs)/rzxs(mgs)
19253 IF ( -csmlrr(mgs)*dtp > cxmin .and. -qsmlr(mgs)*dtp > qxmin(lr) .and. snowmeltdia > 0.0 )
THEN
19254 rmas = rho0(mgs)*qsmlr(mgs)/csmlrr(mgs)
19255 IF ( rmas > snowmeltmass )
THEN
19256 csmlrr(mgs) = rho0(mgs)*qsmlr(mgs)/snowmeltmass
19266 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
19267 chmlr(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhmlr(mgs)
19268 IF ( imltshddmr == 3 .and. qhmlr(mgs) < -qxmin(lh) )
THEN
19277 tmp = 1. + alpha(mgs,lh)
19278 i = int(dgami*(tmp))
19280 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
19282 ratio = min( maxratiolu, mltdiam1/xdia(mgs,lh,1) )
19284 x =
gamxinfdp(2. + alpha(mgs,lh), ratio)/g1palp
19285 y =
gamxinfdp(2.5 + alpha(mgs,lh) + 0.5*bxx(mgs,lh), ratio)/g1palp
19287 hwvent1 = 0.78*x + y*hwventy(mgs)
19289 qhlmlr1 = min( fmlt1(mgs)*cx(mgs,lh)*hwvent1*xdia(mgs,lh,1), 0.0 )
19291 chmlr(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*(qhmlr(mgs) - qhlmlr1)
19302 IF ( chmlr(mgs) < 0.0 .and. (ibinhmlr < 1 .or. lzh < 1) )
THEN
19303 IF ( ipconc >= 6 .and. lzr .gt. 1 .and. lzh < 1 .and. qx(mgs,lh) > qxmin(lh) )
THEN
19304 tmp = qx(mgs,lh)/cx(mgs,lh)
19305 alp = alpha(mgs,lh)
19308 zhmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs) )
19312 IF ( ibinhmlr == 0 .or. lzh < 1 )
THEN
19313 IF ( ihmlt .eq. 1 )
THEN
19314 chmlrr(mgs) = min( chmlr(mgs), rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vmlt) )
19315 ELSEIF ( ihmlt .eq. 2 )
THEN
19316 IF ( xv(mgs,lh) .gt. 0.0 .and. chmlr(mgs) .lt. 0.0 )
THEN
19319 IF(imltshddmr == 1)
THEN
19322 tmp = -rho0(mgs)*qhmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lh)*xv(mgs,lh)))
19323 tmp2 = -rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vr3mm)
19325 chmlrr(mgs) = tmp*(sheddiam0-xdia(mgs,lh,3))/(sheddiam0-sheddiam)+tmp2*(xdia(mgs,lh,3)-sheddiam)/(sheddiam0-sheddiam)
19326 chmlrr(mgs) = -max(tmp,min(tmp2,chmlrr(mgs)))
19327 ELSEIF ( imltshddmr == 2 .or. imltshddmr == 3 )
THEN
19330 chmlrr(mgs) = rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lh))
19332 chmlrr(mgs) = rho0(mgs)*qhmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lh)*xv(mgs,lh)))
19335 chmlrr(mgs) = chmlr(mgs)
19337 ELSEIF ( ihmlt .eq. 0 )
THEN
19338 chmlrr(mgs) = chmlr(mgs)
19342 chmlrr(mgs) = min( chmlrr(mgs), rho0(mgs)*qhmlr(mgs)/(xdn(mgs,lr)*xvmx(lr)) )
19347 IF ( lhl .gt. 1 .and. lhlw < 1 .and. .not. mixedphase .and. qhlmlr(mgs) < 0.0 )
THEN
19349 IF ( ibinhlmlr == 0 .or. lzhl < 1 )
THEN
19354 chlmlr(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlmlr(mgs)
19355 IF ( imltshddmr == 3 .and. qhlmlr(mgs) < -qxmin(lhl) )
THEN
19365 tmp = 1. + alpha(mgs,lhl)
19366 i = int(dgami*(tmp))
19368 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
19370 ratio = min( maxratiolu, mltdiam1/xdia(mgs,lhl,1) )
19372 x =
gamxinfdp(2. + alpha(mgs,lhl), ratio)/g1palp
19373 y =
gamxinfdp(2.5 + alpha(mgs,lhl) + 0.5*bxx(mgs,lhl), ratio)/g1palp
19375 hwvent1 = 0.78*x + y*hlventy(mgs)
19377 qhlmlr1 = min( fmlt1(mgs)*cx(mgs,lhl)*hwvent1*xdia(mgs,lhl,1), 0.0 )
19379 chlmlr(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*min(0.0, qhlmlr(mgs) - qhlmlr1)
19385 IF ( ibinhlmlr == 0 .or. lzhl < 1 )
THEN
19386 IF ( ihmlt .eq. 1 )
THEN
19387 chlmlrr(mgs) = min( chlmlr(mgs), rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vmlt) )
19388 ELSEIF ( ihmlt .eq. 2 )
THEN
19389 IF ( xv(mgs,lhl) .gt. 0.0 .and. chlmlr(mgs) .lt. 0.0 )
THEN
19392 IF(imltshddmr == 1 )
THEN
19393 tmp = -rho0(mgs)*qhlmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lhl)*xv(mgs,lhl)))
19394 tmp2 = -rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vr3mm)
19395 chlmlrr(mgs) = tmp*(20.e-3-xdia(mgs,lhl,3))/(20.e-3-sheddiam)+tmp2*(xdia(mgs,lhl,3)-sheddiam)/(20.e-3-sheddiam)
19396 chlmlrr(mgs) = -max(tmp,min(tmp2,chlmlrr(mgs)))
19397 ELSEIF ( imltshddmr == 2 .or. imltshddmr == 3 )
THEN
19400 chlmlrr(mgs) = rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lhl))
19402 chlmlrr(mgs) = rho0(mgs)*qhlmlr(mgs)/(min(xdn(mgs,lr)*xvmx(lr), xdn(mgs,lhl)*xv(mgs,lhl)))
19405 chlmlrr(mgs) = chlmlr(mgs)
19407 ELSEIF ( ihmlt .eq. 0 )
THEN
19408 chlmlrr(mgs) = chlmlr(mgs)
19412 chlmlrr(mgs) = min( chlmlrr(mgs), rho0(mgs)*qhlmlr(mgs)/(xdn(mgs,lr)*xvmx(lr)) )
19416 IF ( ipconc >= 8 .and. lzhl .gt. 1 .and. ibinhlmlr <= 0 )
THEN
19417 IF ( cx(mgs,lhl) > 0.0 )
THEN
19419 tmp = qx(mgs,lhl)/cx(mgs,lhl)
19420 alp = alpha(mgs,lhl)
19424 zhlmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( tmp * qhlmlr(mgs) )
19442 rwcap(mgs) = (0.5)*xdia(mgs,lr,1)
19443 swcap(mgs) = (0.5)*xdia(mgs,ls,1)
19444 hwcap(mgs) = (0.5)*xdia(mgs,lh,1)
19445 IF ( lhl .gt. 1 ) hlcap(mgs) = (0.5)*xdia(mgs,lhl,1)
19447 if ( qx(mgs,li).gt.qxmin(li) .and. xdia(mgs,li,1) .gt. 0.0 )
then
19451 cilen(mgs) = 0.4764*(xdia(mgs,li,1))**(0.958)
19452 cval = xdia(mgs,li,1)
19454 eval = sqrt(1.0-(aval**2)/(cval**2))
19455 fval = min(0.99,eval)
19456 gval = alog( abs( (1.+fval)/(1.-fval) ) )
19457 cicap(mgs) = cval*fval / gval
19468 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
19469 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
19471 & fvds(mgs)*cx(mgs,li)*civent(mgs)*cicap(mgs)*depfac
19473 & fvds(mgs)*cx(mgs,ls)*swvent(mgs)*swcap(mgs)*depfac
19485 & fvds(mgs)*cx(mgs,lh)*hwvent(mgs)*hwcap(mgs)*depfac
19487 IF ( lhl .gt. 1 ) qhldsv(mgs) = fvds(mgs)*cx(mgs,lhl)*hlvent(mgs)*hlcap(mgs)*depfac
19501 IF ( dosublimationfix )
THEN
19505 qitmp(mgs) = qx(mgs,li) + qx(mgs,ls) + qx(mgs,lh)
19506 IF ( lis > 1 ) qitmp(mgs) = qitmp(mgs) + qx(mgs,lis)
19507 IF ( lhl > 1 ) qitmp(mgs) = qitmp(mgs) + qx(mgs,lhl)
19508 qrtmp(mgs) = qx(mgs,lr)
19509 qctmp(mgs) = qx(mgs,lc)
19510 qsimxdep(mgs) = 0.0
19511 qsimxsub(mgs) = 0.0
19516 IF ( qitmp(mgs) > qxmin(li) )
THEN
19518 qitmp1 = qitmp(mgs)
19519 qctmp1 = qctmp(mgs)
19520 felvcptmp = felvcp(mgs)
19521 felscptmp = felscp(mgs)
19522 qvtmp(mgs) = qx(mgs,lv)
19523 qss(mgs) = qvs(mgs)
19527 thetatmp = theta(mgs)
19528 thetaptmp = thetap(mgs)
19529 temgtmp = temg(mgs)
19530 temcgtmp = temcg(mgs)
19531 qvaptmp = qx(mgs,lv)
19537 dqwvtmp(mgs) = ( qvtmp(mgs) - qsstmp )
19544 IF ( itertd == 1 )
THEN
19547 dqcitmp(mgs) = dqci(mgs)
19553 dqwv(mgs) = ( qvtmp(mgs) - qsstmp )
19557 if( dqwv(mgs) .lt. 0. )
then
19558 if( qitmp(mgs) .gt. -dqwv(mgs) )
then
19559 dqci(mgs) = dqwv(mgs)
19562 dqci(mgs) = -qitmp(mgs)
19563 dqwv(mgs) = dqwv(mgs) + qitmp(mgs)
19566 qvptmp = qvptmp - ( dqcw(mgs) + dqci(mgs) )
19568 IF ( itertd == 2 .and. eqtset > 1 )
THEN
19572 cvm = cv+cvv*qvtmp(mgs)+cpl*(qx(mgs,lc)+qrtmp(mgs)) &
19575 felvcptmp = (felv(mgs)-rw*temg(mgs))/cvm
19576 felscptmp = (fels(mgs)-rw*temg(mgs))/cvm
19581 qctmp(mgs) = qctmp(mgs) + dqcw(mgs)
19582 qitmp(mgs) = qitmp(mgs) + dqci(mgs)
19583 thetaptmp = thetaptmp + &
19585 & (felvcp(mgs)*dqcw(mgs) +felscp(mgs)*dqci(mgs))
19592 IF ( dqwv(mgs) .ge. 0. )
THEN
19599 if ( temg(mgs) .lt. tfr .and. temg(mgs) .gt. thnuc )
then
19603 if ( temg(mgs) .le. thnuc )
then
19609 gamss = (felvcp(mgs)*fracl(mgs) + felscp(mgs)*fraci(mgs)) &
19612 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv2(mgs)*qsstmp/ &
19613 & ((temg(mgs)-cbi)**2))
19615 if ( temg(mgs) .ge. tfr )
then
19616 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qsstmp/ &
19617 & ((temg(mgs)-cbw)**2))
19623 dqcw(mgs) = dqvcnd(mgs)*fracl(mgs)
19624 dqci(mgs) = dqvcnd(mgs)*fraci(mgs)
19626 thetaptmp = thetaptmp + &
19627 & (felvcp(mgs)*dqcw(mgs) + felscp(mgs)*dqci(mgs)) &
19630 qvptmp = qvptmp - ( dqvcnd(mgs) )
19631 qctmp(mgs) = qctmp(mgs) + dqcw(mgs)
19632 qitmp(mgs) = qitmp(mgs) + dqci(mgs)
19634 IF ( itertd == 2 .and. eqtset > 1 )
THEN
19638 cvm = cv+cvv*qvtmp(mgs)+cpl*(qctmp(mgs) +qrtmp(mgs)) &
19641 felvcptmp = (felv(mgs)-rw*temg(mgs))/cvm
19642 felscptmp = (fels(mgs)-rw*temg(mgs))/cvm
19657 IF ( itertd == 1 )
THEN
19660 thetatmp = thetaptmp + theta0(mgs)
19661 temgtmp = thetatmp*pk(mgs)
19662 qvaptmp = max((qvptmp + qv0(mgs)), 0.0)
19663 temcgtmp = temgtmp - tfr
19664 tqvcon = temgtmp-cbw
19665 ltemq = (temgtmp-163.15)/fqsat+1.5
19666 ltemq = min( nqsat, max(1,ltemq) )
19668 IF ( iqvsopt == 0 )
THEN
19669 qvstmp = pqs(mgs)*tabqvs(ltemq)
19670 ELSEIF ( iqvsopt == 1 )
THEN
19671 qvstmp = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
19674 qisstmp = pqs(mgs)*tabqis(ltemq)
19675 qctmp(mgs) = max( 0.0, qctmp(mgs) )
19676 qitmp(mgs) = max( 0.0, qitmp(mgs) )
19677 qvtmp(mgs) = max( 0.0, qvaptmp )
19684 qctmp(mgs) = max( 0.0, qctmp(mgs) )
19685 qitmp(mgs) = max( 0.0, qitmp(mgs) )
19687 IF ( qitmp(mgs) < qitmp1 )
THEN
19688 qsimxsub(mgs) = (qitmp1 - qitmp(mgs))*dtpinv
19689 ELSEIF ( qitmp(mgs) > qitmp1 )
THEN
19690 qsimxdep(mgs) = (qitmp(mgs) - qitmp1)*dtpinv
19709 qsimxdep(mgs) = qvimxd(mgs)
19710 qsimxsub(mgs) = 1.e20
19731 IF ( icond .eq. 1 .or. temg(mgs) .le. tfrh &
19732 & .or. (qx(mgs,lr) .le. qxmin(lr) .and. qx(mgs,lc) .le. qxmin(lc)) )
THEN
19736 qisbv(mgs) = max( min(qidsv(mgs), 0.0), min( -qimxd(mgs), -0.5*qx(mgs,li)*dtpinv ) )
19737 IF ( temg(mgs) < tfr .or. .not. qsmlr(mgs) < 0.0 )
THEN
19738 qssbv(mgs) = max( min(qsdsv(mgs), 0.0), min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
19740 qidpv(mgs) = max(qidsv(mgs), 0.0)
19741 qsdpv(mgs) = max(qsdsv(mgs), 0.0)
19743 IF ( qsmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19745 qscev(mgs) = evapfac* &
19746 & 4.0*pi*(qx(mgs,lv)-qss0(mgs))*cx(mgs,ls)*swcap(mgs)*swvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19747 qscev(mgs) = max( min(0.0,qscev(mgs)), min( -qsmxd(mgs), -0.5*qx(mgs,ls)*dtpinv ) )
19763 IF ( qx(mgs,lh) > qxmin(lh) )
THEN
19764 IF ( temg(mgs) < tfr .or. .not. qhmlr(mgs) < 0.0 )
THEN
19766 qhsbv(mgs) = max( min(qhdsv(mgs), 0.0), -qhmxd(mgs) )
19767 qhdpv(mgs) = max(qhdsv(mgs), 0.0)
19770 IF ( .true. .and. qhmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19776 qhcev(mgs) = evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))* &
19777 & cx(mgs,lh)*xdia(mgs,lh,1)*hwvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19779 qhcev(mgs) = max(qhcev(mgs), -qhmxd(mgs))
19780 IF ( temg(mgs) > tfr ) qhcev(mgs) = min(0.0, qhcev(mgs) )
19788 IF ( lhl .gt. 1 )
THEN
19789 IF ( qx(mgs,lhl) > qxmin(lhl) )
THEN
19790 IF ( temg(mgs) < tfr .or. .not. qhlmlr(mgs) < 0.0 )
THEN
19791 qhlsbv(mgs) = max( min(qhldsv(mgs), 0.0), -qxmxd(mgs,lhl) )
19792 qhldpv(mgs) = max(qhldsv(mgs), 0.0)
19794 IF ( qhlmlr(mgs) < 0.0 .and. .not. mixedphase )
THEN
19796 qhlcev(mgs) = evapfac*2.0*pi*(qx(mgs,lv)-qss0(mgs))* &
19797 & cx(mgs,lhl)*xdia(mgs,lhl,1)*hlvent(mgs)/(qss0(mgs)*(fav(mgs)+fbv(mgs)))
19799 qhlcev(mgs) = max(qhlcev(mgs), -qhlmxd(mgs))
19800 IF ( temg(mgs) > tfr ) qhlcev(mgs) = min(0.0, qhlcev(mgs) )
19806 temp1 = qidpv(mgs) + qsdpv(mgs) + qhdpv(mgs) + qhldpv(mgs)
19812 IF ( temp1 .gt. qsimxdep(mgs) )
THEN
19813 frac = qsimxdep(mgs)/temp1
19815 qidpv(mgs) = frac*qidpv(mgs)
19816 qsdpv(mgs) = frac*qsdpv(mgs)
19817 qhdpv(mgs) = frac*qhdpv(mgs)
19818 qhldpv(mgs) = frac*qhldpv(mgs)
19827 temp1 = qisbv(mgs) + qssbv(mgs) + qhsbv(mgs) + qhlsbv(mgs)
19830 IF ( temp1 < -qsimxsub(mgs) )
THEN
19831 frac = -qsimxsub(mgs)/temp1
19833 qisbv(mgs) = frac*qisbv(mgs)
19834 qssbv(mgs) = frac*qssbv(mgs)
19835 qhsbv(mgs) = frac*qhsbv(mgs)
19836 qhlsbv(mgs) = frac*qhlsbv(mgs)
19849 if ( ipconc .ge. 1 )
then
19851 cssbv(mgs) = (cx(mgs,ls)/(qx(mgs,ls)+1.e-20))*qssbv(mgs)
19852 cisbv(mgs) = (cx(mgs,li)/(qx(mgs,li)+1.e-20))*qisbv(mgs)
19853 chsbv(mgs) = (cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhsbv(mgs)
19854 IF ( lhl .gt. 1 ) chlsbv(mgs) = (cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlsbv(mgs)
19866 if (ndebug .gt. 0 )
write(0,*)
'conc 29a'
19871 if ( ipconc .ge. 4 .and. iscni .ge. 1 .and. qx(mgs,li) .gt. qxmin(li) )
then
19872 IF ( iscni .eq. 1 )
THEN
19874 & pi*rho0(mgs)*((0.25)/(6.0)) &
19875 & *eii(mgs)*(qx(mgs,li)**2)*(xdia(mgs,li,2)) &
19876 & *vtxbar(mgs,li,1)/xmas(mgs,li)
19877 cscni(mgs) = min(cimxd(mgs),qscni(mgs)*rho0(mgs)/xmas(mgs,li))
19878 cscnis(mgs) = 0.5*cscni(mgs)
19879 ELSEIF ( iscni .eq. 2 .or. iscni .eq. 4 .or. iscni .eq. 5 )
THEN
19880 IF ( iscni .ne. 5 .and. qidpv(mgs) .gt. 0.0 .and. xdia(mgs,li,3) .ge. 100.e-6 )
THEN
19885 qscni(mgs) = min(0.5, xdia(mgs,li,3)/200.e-6)*qidpv(mgs)
19889 cscni(mgs) = fscni*qscni(mgs)*rho0(mgs)/max(rho_qs*xvmn(ls),xmas(mgs,li))
19893 cscnis(mgs) = cscni(mgs)
19899 IF ( iscni .ne. 4 )
THEN
19902 tmp = ess(mgs)*rvt*aa2*cx(mgs,li)*cx(mgs,li)*xv(mgs,li)
19907 qscni(mgs) = qscni(mgs) + min( qxmxd(mgs,li), 2.0*tmp*xmas(mgs,li)*rhoinv(mgs) )
19908 cscni(mgs) = cscni(mgs) + min( cxmxd(mgs,li), 2.0*tmp )
19909 cscnis(mgs) = cscnis(mgs) + min( cxmxd(mgs,li), tmp )
19911 ELSEIF ( iscni .eq. 3 )
THEN
19912 qscni(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
19913 qscni(mgs) = min(qscni(mgs),qxmxd(mgs,li))
19914 cscni(mgs) = qscni(mgs)*rho0(mgs)/xmas(mgs,li)
19915 cscnis(mgs) = 0.5*cscni(mgs)
19919 ELSEIF ( ipconc < 4 )
THEN
19921 qimax = rhoinv(mgs)*roqimax
19922 qscni(mgs) = min(0.90*qx(mgs,li), max( 0.0, (qx(mgs,li) - qimax)*dtpinv ) )
19924 qscni(mgs) = 0.001*eii(mgs)*max((qx(mgs,li)-1.e-3),0.0)
19925 qscni(mgs) = min(qscni(mgs),qxmxd(mgs,li))
19928 if ( iscni > 0 .and. qx(mgs,li) .gt. qxmin(li) )
then
19930 & pi*rho0(mgs)*((0.25)/(6.0)) &
19931 & *eii(mgs)*(qx(mgs,li)**2)*(xdia(mgs,li,2)) &
19932 & *vtxbar(mgs,li,1)/xmas(mgs,li)
19933 cscni(mgs) = min(cimxd(mgs),qscni(mgs)*rho0(mgs)/xmas(mgs,li))
19939 IF ( incwet < 1 )
THEN
19945 IF ( incwet >= 1 )
THEN
19950 dhwet(:) = dg0thresh + 0.0001
19951 dhlwet(:) = dg0thresh + 0.0001
19952 dfwet(:) = dg0thresh + 0.0001
19956 sqrtrhovt = sqrt( rhovt(mgs) )
19957 fventh = sqrtrhovt*(fpndl(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
19958 fventm = sqrtrhovt*(fschm(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
19959 ltemq = (tfr-163.15)/fqsat+1.5
19960 qvs0 = pqs(mgs)*tabqvs(ltemq)
19961 denomdp = felf(mgs) + fcw(mgs)*temcg(mgs)
19962 denominvdp = 1.d0/(felf(mgs) + fcw(mgs)*temcg(mgs))
19964 IF (((qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin .and. &
19965 temg(mgs) .le. tfr + wetgrthtoffset .and. temg(mgs) .ge. 243.15 ) )
THEN
19969 x = 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
19970 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0
19971 IF ( x > 1.e-20 )
THEN
19972 arg = min(70.0, (-temcg(mgs)/x ))
19973 dwr = 0.01*(exp(arg) - 1.0)
19979 IF ( dwr < 0.2 .and. dwr > 0.0 .and. rho0(mgs)*(qx(mgs,lc)+qx(mgs,lr)) > 1.e-4 )
THEN
19981 h1 = ( -ftka(mgs)*temcg(mgs) - felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qx(mgs,lv) - qvs0) )
19982 h2 = ehi(mgs)*qx(mgs,li)*rho0(mgs)*fci(mgs)*temcg(mgs)
19983 h3 = max(dwehwmin, ehw(mgs))*qx(mgs,lc)
19984 h4 = ehr(mgs)* qx(mgs,lr)
19989 vth = axx(mgs,lh)*d**bxx(mgs,lh)
19990 x2 = fventh*sqrtrhovt*sqrt(d*vth)
19991 IF ( x2 > 1.4 )
THEN
19992 ah = 0.78 + 0.308*x2
19994 ah = 1.0 + 0.108*x2**2
19999 ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
20000 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp + &
20001 max(0.001,vth - vtxbar(mgs,li,1))*h2)
20003 IF ( abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) )
EXIT
20008 dhwet(mgs) = min(dg0thresh + 0.0001, max( d, dwetmin ))
20010 dhwet(mgs) = dg0thresh + 0.0001
20013 IF (((qhlacw(mgs) + qhlacr(mgs))*dtp > qxmin(lhl) .and. qx(mgs,lhl) > 0.01e-3 &
20014 .and. temg(mgs) .le. tfr + wetgrthtoffset .and. temg(mgs) .ge. 243.15 ) )
THEN
20018 x = 1.1e4 * rho0(mgs)*(ehlw(mgs)*qx(mgs,lc)+ehlr(mgs)*qx(mgs,lr)) - &
20019 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0
20020 IF ( x > 1.e-20 )
THEN
20021 arg = min(70.0, (-temcg(mgs)/x ))
20022 dwr = 0.01*(exp(arg) - 1.0)
20027 IF ( dwr < 0.2 .and. dwr > 0.0 .and. rho0(mgs)*(qx(mgs,lc)+qx(mgs,lr)) > 1.e-4 )
THEN
20030 h1 = ( -ftka(mgs)*temcg(mgs) - felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qx(mgs,lv) - qvs0) )
20031 h2 = ehi(mgs)*qx(mgs,li)*rho0(mgs)*fci(mgs)*temcg(mgs)
20032 h3 = max(dwehwmin, ehlw(mgs))*qx(mgs,lc)
20033 h4 = ehlr(mgs)* qx(mgs,lr)
20038 vth = axx(mgs,lhl)*d**bxx(mgs,lhl)
20039 x2 = fventh*sqrtrhovt*sqrt(d*vth)
20040 IF ( x2 > 1.4 )
THEN
20041 ah = 0.78 + 0.308*x2
20043 ah = 1.0 + 0.108*x2**2
20048 ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
20049 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp + &
20050 max(0.001,vth - vtxbar(mgs,li,1))*h2)
20052 IF ( abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) )
EXIT
20057 dhlwet(mgs) = min(dg0thresh + 0.0001, max( d, dwetmin ) )
20059 dhlwet(mgs) = dg0thresh + 0.0001
20075 qsdry(mgs) = qsacr(mgs) + qsacw(mgs) &
20078 qhdry(mgs) = qhaci(mgs) + qhacs(mgs) &
20084 IF ( lhl .gt. 1 )
THEN
20085 qhldry(mgs) = qhlaci(mgs) + qhlacs(mgs) &
20095 IF ( tfrdry < temg(mgs) .and. temg(mgs) < tfr )
THEN
20108 & ( xdia(mgs,lh,1)*hwvent(mgs)*cx(mgs,lh)*fwet1(mgs) &
20109 & + fwet2(mgs)*(qhaci(mgs) + qhacs(mgs)) )
20110 qhwet(mgs) = max( 0.0, qhwet(mgs))
20112 IF ( incwet == 1 .and. qhwet(mgs) < qhdry(mgs) .and. dhwet(mgs) < dg0thresh )
THEN
20117 ratio = min( maxratiolu, dhwet(mgs)/xdia(mgs,lh,1) )
20119 tmp1 =
gaminterp(ratio,alpha(mgs,lh),13,1)
20120 tmp2 =
gaminterp(ratio,alpha(mgs,lh),12,1)
20121 tmp3 =
gaminterp(ratio,alpha(mgs,lh), 9,1)
20123 IF ( qhacw(mgs)*dtp > qxmin(lh) )
THEN
20124 vt = abs(vtxbar(mgs,lh,1)-vtxbar(mgs,lc,1))
20126 qxacwtmp = 0.25*pi*ehw(mgs)*cx(mgs,lh)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
20127 & ( tmp1*da0lh(mgs)*xdia(mgs,lh,3)**2 + &
20128 & tmp2*dab1lh(mgs,lh,lc)*xdia(mgs,lh,3)*xdia(mgs,lc,3) + &
20129 & tmp3*da1lc(mgs)*xdia(mgs,lc,3)**2 )
20134 IF ( qhacr(mgs)*dtp > qxmin(lh) )
THEN
20136 vt = sqrt((vtxbar(mgs,lh,1)-vtxbar(mgs,lr,1))**2 + &
20137 & 0.04*vtxbar(mgs,lh,1)*vtxbar(mgs,lr,1) )
20139 qxacrtmp = 0.25*pi*ehr(mgs)*cx(mgs,lh)*qx(mgs,lr)*vt* &
20140 & ( tmp1*da0lh(mgs)*xdia(mgs,lh,3)**2 + &
20141 & tmp2*dab1lh(mgs,lh,lr)*xdia(mgs,lh,3)*xdia(mgs,lr,3) + &
20142 & tmp3*da1lr(mgs)*xdia(mgs,lr,3)**2 )
20151 hxventtmp = 0.78*x + y*hwventy(mgs)
20155 IF ( qhaci(mgs)*dtp > qxmin(lh) )
THEN
20156 vt = abs(vtxbar(mgs,lh,1)-vtxbar(mgs,li,1))
20158 qxacitmp = 0.25*pi*ehiclsn(mgs)*cx(mgs,lh)*qx(mgs,li)*vt* &
20159 & ( tmp1*da0lh(mgs)*xdia(mgs,lh,3)**2 + &
20160 & tmp2*dab1lh(mgs,lh,li)*xdia(mgs,lh,3)*xdia(mgs,li,3) + &
20161 & tmp3*da1(li)*xdia(mgs,li,3)**2 )
20165 IF ( qhacs(mgs)*dtp > qxmin(lh) )
THEN
20166 vt = abs(vtxbar(mgs,lh,1)-vtxbar(mgs,ls,1))
20168 qxacstmp = 0.25*pi*ehsclsn(mgs)*cx(mgs,lh)*qx(mgs,ls)*vt* &
20169 & ( da0lh(mgs)*xdia(mgs,lh,3)**2 + &
20170 & dab1lh(mgs,lh,ls)*xdia(mgs,lh,3)*xdia(mgs,ls,3) + &
20171 & da1(ls)*xdia(mgs,ls,3)**2 )
20175 & xdia(mgs,lh,1)*hxventtmp*cx(mgs,lh)*fwet1(mgs) &
20176 & + fwet2(mgs)*(qxacitmp + qxacstmp)
20179 qhwet(mgs) = qhacw(mgs) + qhacr(mgs) + qhaci(mgs) + qhacs(mgs) &
20180 - ehi(mgs)*qxacitmp - ehs(mgs)*qxacstmp &
20181 - qxacwtmp - qxacrtmp + qxwettmp
20194 IF ( lhl .gt. 1 )
THEN
20197 & ( xdia(mgs,lhl,1)*hlvent(mgs)*cx(mgs,lhl)*fwet1(mgs) &
20198 & + fwet2(mgs)*(qhlaci(mgs) + qhlacs(mgs)) )
20199 qhlwet(mgs) = max( 0.0, qhlwet(mgs))
20201 IF ( incwet == 1 .and. qhlwet(mgs) < qhldry(mgs) .and. dhlwet(mgs) < dg0thresh )
THEN
20207 ratio = min( maxratiolu, dhlwet(mgs)/xdia(mgs,lhl,1) )
20209 tmp1 =
gaminterp(ratio,alpha(mgs,lhl),13,2)
20210 tmp2 =
gaminterp(ratio,alpha(mgs,lhl),12,2)
20211 tmp3 =
gaminterp(ratio,alpha(mgs,lhl), 9,2)
20213 IF ( qhlacw(mgs)*dtp > qxmin(lhl) )
THEN
20214 vt = abs(vtxbar(mgs,lhl,1)-vtxbar(mgs,lc,1))
20216 qxacwtmp = 0.25*pi*ehlw(mgs)*cx(mgs,lhl)*(qx(mgs,lc)-qcwresv(mgs))*vt* &
20217 & ( tmp1*da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
20218 & tmp2*dab1lh(mgs,lhl,lc)*xdia(mgs,lhl,3)*xdia(mgs,lc,3) + &
20219 & tmp3*da1lc(mgs)*xdia(mgs,lc,3)**2 )
20224 IF ( qhlacr(mgs)*dtp > qxmin(lhl) )
THEN
20226 vt = sqrt((vtxbar(mgs,lhl,1)-vtxbar(mgs,lr,1))**2 + &
20227 & 0.04*vtxbar(mgs,lhl,1)*vtxbar(mgs,lr,1) )
20229 qxacrtmp = 0.25*pi*ehlr(mgs)*cx(mgs,lhl)*qx(mgs,lr)*vt* &
20230 & ( tmp1*da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
20231 & tmp2*dab1lh(mgs,lhl,lr)*xdia(mgs,lhl,3)*xdia(mgs,lr,3) + &
20232 & tmp3*da1lr(mgs)*xdia(mgs,lr,3)**2 )
20237 x =
gaminterp(ratio,alpha(mgs,lhl),9,2)
20238 y =
gaminterp(ratio,alpha(mgs,lhl),3,2)
20240 hxventtmp = 0.78*x + y*hlventy(mgs)
20243 IF ( qhlaci(mgs)*dtp > qxmin(lhl) )
THEN
20244 vt = abs(vtxbar(mgs,lhl,1)-vtxbar(mgs,li,1))
20246 qxacitmp = 0.25*pi*ehliclsn(mgs)*cx(mgs,lhl)*qx(mgs,li)*vt* &
20247 & ( tmp1*da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
20248 & tmp2*dab1lh(mgs,lhl,li)*xdia(mgs,lhl,3)*xdia(mgs,li,3) + &
20249 & tmp3*da1(li)*xdia(mgs,li,3)**2 )
20253 IF ( qhlacs(mgs)*dtp > qxmin(lhl) )
THEN
20254 vt = abs(vtxbar(mgs,lhl,1)-vtxbar(mgs,ls,1))
20256 qxacstmp = 0.25*pi*ehlsclsn(mgs)*cx(mgs,lhl)*qx(mgs,ls)*vt* &
20257 & ( da0lhl(mgs)*xdia(mgs,lhl,3)**2 + &
20258 & dab1lh(mgs,lhl,ls)*xdia(mgs,lhl,3)*xdia(mgs,ls,3) + &
20259 & da1(ls)*xdia(mgs,ls,3)**2 )
20263 & xdia(mgs,lhl,1)*hxventtmp*cx(mgs,lhl)*fwet1(mgs) &
20264 & + fwet2(mgs)*(qxacitmp + qxacstmp)
20270 qhlwet(mgs) = qhlacw(mgs) + qhlacr(mgs) + qhlaci(mgs) + qhlacs(mgs) &
20271 - ehli(mgs)*qxacitmp - ehls(mgs)*qxacstmp &
20272 - qxacwtmp - qxacrtmp + qxwettmp
20282 qhwet(mgs) = qhdry(mgs)
20283 qhlwet(mgs) = qhldry(mgs)
20305 wetsfc(:) = .false.
20306 wetgrowth(:) = .false.
20307 wetsfchl(:) = .false.
20308 wetgrowthhl(:) = .false.
20314 qhshr(mgs) = min( 0.0, qhwet(mgs) - qhdry(mgs) )
20318 qhlshr(mgs) = min( 0.0, qhlwet(mgs) - qhldry(mgs) )
20328 if ( temg(mgs) .lt. 243.15 )
then
20334 wetsfc(mgs) = .false.
20335 wetgrowth(mgs) = .false.
20336 wetsfchl(mgs) = .false.
20337 wetgrowthhl(mgs) = .false.
20342 if ( temg(mgs) .gt. tfr )
then
20344 IF ( .false. )
THEN
20345 qsshr(mgs) = -qsdry(mgs)
20346 qhshr(mgs) = -qhdry(mgs)
20347 qhlshr(mgs) = -qhldry(mgs)
20350 qsshr(mgs) = - qsacr(mgs) - qsacw(mgs)
20351 qhlshr(mgs) = - qhlacw(mgs) - qhlacr(mgs)
20352 qhshr(mgs) = - qhacw(mgs) - qhacr(mgs)
20356 vhshdr(mgs) = -vhacw(mgs) - vhacr(mgs)
20357 vhlshdr(mgs) = -vhlacw(mgs) - vhlacr(mgs)
20363 wetsfc(mgs) = (qhshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr ) .or. ( qhmlr(mgs) < -qxmin(lh) .and. temg(mgs) > tfr )
20364 wetgrowth(mgs) = (qhshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
20366 if (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
THEN
20367 wetsfchl(mgs) = (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr ) .or. ( qhlmlr(mgs) < -qxmin(lhl) .and. temg(mgs) > tfr )
20368 wetgrowthhl(mgs) = (qhlshr(mgs) .lt. 0.0 .and. temg(mgs) < tfr )
20373 if ( ipconc .ge. 1 )
then
20383 chshrr(mgs) = rho0(mgs)*qhshr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lh))
20389 IF ( lhl .gt. 1 )
THEN
20399 chlshrr(mgs) = rho0(mgs)*qhlshr(mgs)/(xdn(mgs,lr)*vshdgs(mgs,lhl))
20416 if ( qsshr(mgs) .lt. 0.0 )
then
20433 if ( wetgrowth(mgs) .or. (mixedphase .and. fhw(mgs) .gt. 0.05 .and. temg(mgs) .gt. 243.15) )
then
20438 IF ( lvol(lh) .gt. 1 .and. .not. mixedphase)
THEN
20440 IF ( iwetsoak )
THEN
20442 rimdn(mgs,lh) = xdnmx(lh)
20443 raindn(mgs,lh) = xdnmx(lh)
20444 vhacw(mgs) = qhacw(mgs)*rho0(mgs)/rimdn(mgs,lh)
20445 vhacr(mgs) = qhacr(mgs)*rho0(mgs)/raindn(mgs,lh)
20447 IF ( xdn(mgs,lh) .lt. xdnmx(lh) )
THEN
20450 v1 = (1. - xdn(mgs,lh)/xdnmx(lh))*vx(mgs,lh)/(dtp)
20452 v2 = rho0(mgs)*qhwet(mgs)/xdnmx(lh)
20454 vhsoak(mgs) = min(v1,v2)
20461 vhshdr(mgs) = min(0.0, rho0(mgs)*qhwet(mgs)/xdnmx(lh) - vhacw(mgs) - vhacr(mgs) )
20463 ELSEIF ( lvol(lh) .gt. 1 .and. mixedphase )
THEN
20476 IF ( ehi(mgs) .gt. 0.0 )
THEN
20477 qhaci(mgs) = min(qimxd(mgs),qhaci0(mgs))
20478 chaci(mgs) = min(cimxd(mgs),chaci0(mgs))
20480 IF ( ehs(mgs) .gt. 0.0 )
THEN
20482 qhacs(mgs) = min(qsmxd(mgs),qhacs0(mgs))
20483 chacs(mgs) = min(csmxd(mgs),chacs0(mgs))
20485 qhacs(mgs) = min(qsmxd(mgs),qhacs(mgs))
20489 wetsfc(mgs) = .true.
20499 if ( lhl > 1 .and. ( wetgrowthhl(mgs) .or. (mixedphase .and. fhlw(mgs) .gt. 0.05 .and. temg(mgs) .gt. 243.15) ) )
then
20511 IF ( lvol(lhl) .gt. 1 .and. .not. mixedphase )
THEN
20514 IF ( iwetsoak )
THEN
20516 rimdn(mgs,lhl) = xdnmx(lhl)
20517 raindn(mgs,lhl) = xdnmx(lhl)
20518 vhlacw(mgs) = qhlacw(mgs)*rho0(mgs)/rimdn(mgs,lhl)
20519 vhlacr(mgs) = qhlacr(mgs)*rho0(mgs)/raindn(mgs,lhl)
20521 IF ( xdn(mgs,lhl) .lt. xdnmx(lhl) )
THEN
20524 v1 = (1. - xdn(mgs,lhl)/xdnmx(lhl))*vx(mgs,lhl)/(dtp)
20526 v2 = rho0(mgs)*qhlwet(mgs)/xdnmx(lhl)
20527 IF ( v1 > v2 )
THEN
20543 vhlshdr(mgs) = min(0.0, rho0(mgs)*qhlwet(mgs)/xdnmx(lhl) - vhlacw(mgs) - vhlacr(mgs) )
20546 ELSEIF ( lvol(lhl) .gt. 1 .and. mixedphase )
THEN
20551 IF ( ehli(mgs) .gt. 0.0 )
THEN
20552 qhlaci(mgs) = min(qimxd(mgs),qhlaci0(mgs))
20553 chlaci(mgs) = min(cimxd(mgs),chlaci0(mgs))
20559 IF ( ehls(mgs) .gt. 0.0 )
THEN
20560 qhlacs(mgs) = min(qsmxd(mgs),qhlacs0(mgs))
20561 chlacs(mgs) = min(csmxd(mgs),chlacs0(mgs))
20570 wetsfchl(mgs) = .true.
20589 IF ( iglcnvi .ge. 1 )
THEN
20590 IF ( temg(mgs) .lt. 273.0 .and. qiacw(mgs) - qidpv(mgs) .gt. 0.0 )
THEN
20593 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
20594 & *((0.60)*vtxbar(mgs,li,1)) &
20595 & /(temg(mgs)-273.15))**(rimc2)
20596 tmp = min( max( rimc3, tmp ), 900.0 )
20604 IF ( tmp .ge. 200.0 .or. iglcnvi >= 2 )
THEN
20605 r = max( 0.5*(xdn(mgs,li) + tmp), xdnmn(lh) )
20607 qhcni(mgs) = (qiacw(mgs) - qidpv(mgs))
20608 chcni(mgs) = cx(mgs,li)*qhcni(mgs)/qx(mgs,li)
20610 chcnih(mgs) = min(chcni(mgs), rho0(mgs)*qhcni(mgs)/(r*xvmn(lh)) )
20612 vhcni(mgs) = rho0(mgs)*qhcni(mgs)/r
20615 ELSEIF ( iglcnvi == 3 )
THEN
20617 IF ( temg(mgs) .lt. 273.0 .and. qiacw(mgs)*dtp > 2.*qxmin(lh) .and. gamice73fac*xmas(mgs,li) > xdnmn(lh)*xvmn(lh) )
THEN
20620 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
20621 & *((0.60)*vtxbar(mgs,li,1)) &
20622 & /(temg(mgs)-273.15))**(rimc2)
20623 tmp = min( max( rimc3, tmp ), 900.0 )
20633 IF ( tmp .ge. xdnmn(lh) )
THEN
20634 r = max( 0.5*(xdn(mgs,li) + tmp), xdnmn(lh) )
20636 qhcni(mgs) = 0.5*qiacw(mgs)
20637 chcni(mgs) = qhcni(mgs)/(gamice73fac*xmas(mgs,li))
20638 chcnih(mgs) = min(chcni(mgs), rho0(mgs)*qhcni(mgs)/(r*xvmn(lh)) )
20640 vhcni(mgs) = rho0(mgs)*qhcni(mgs)/r
20666 IF ( lhl .gt. 1 )
THEN
20668 IF ( ihlcnh == 1 .or. ihlcnh == 3 )
THEN
20678 IF ( hlcnhdia > 0 )
THEN
20679 ltest = xdia(mgs,lh,3) .gt. hlcnhdia
20682 ltest = xdia(mgs,lh,1)*(4. + alpha(mgs,lh)) > abs( hlcnhdia )
20686 IF ( iusedw == 0 .and. ihlcnh == 1 )
THEN
20689 IF ( temg(mgs) .le. tfr+hailcnvtoffset .and. &
20690 (( (qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin &
20691 .and. temg(mgs) .gt. dwtempmin ) .or. ( wetgrowth(mgs) .and. qx(mgs,lh) > hlcnhqmin )) )
THEN
20695 IF ( incwet > 0 )
THEN
20699 x = 1.1e4 * rho0(mgs)*(ehw(mgs)*qx(mgs,lc)+ehr(mgs)*qx(mgs,lr)) - &
20700 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0
20701 IF ( x > 1.e-20 )
THEN
20702 arg = min(70.0, (-temcg(mgs)/x ))
20703 dwr = 0.01*(exp(arg) - 1.0)
20707 d = min(dwr, dg0thresh + 0.0001)
20708 IF ( dwr < 0.2 .and. dwr > 0.0 .and. rho0(mgs)*(qx(mgs,lc)+qx(mgs,lr)) > 1.e-4 )
THEN
20709 sqrtrhovt = sqrt( rhovt(mgs) )
20710 fventh = sqrtrhovt*(fpndl(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
20711 fventm = sqrtrhovt*(fschm(mgs)**(1./3.)) * (fakvisc(mgs))**(-0.5)
20712 ltemq = (tfr-163.15)/fqsat+1.5
20713 qvs0 = pqs(mgs)*tabqvs(ltemq)
20714 denomdp = felf(mgs) + fcw(mgs)*temcg(mgs)
20715 denominvdp = 1.d0/(felf(mgs) + fcw(mgs)*temcg(mgs))
20718 h1 = ( -ftka(mgs)*temcg(mgs) - felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qx(mgs,lv) - qvs0) )
20719 h2 = ehi(mgs)*qx(mgs,li)*rho0(mgs)*fci(mgs)*temcg(mgs)
20720 h3 = max(dwehwmin, ehw(mgs))*qx(mgs,lc)
20721 h4 = ehr(mgs)* qx(mgs,lr)
20726 vth = axx(mgs,lh)*d**bxx(mgs,lh)
20727 x2 = fventh*sqrtrhovt*sqrt(d*vth)
20728 IF ( x2 > 1.4 )
THEN
20729 ah = 0.78 + 0.308*x2
20731 ah = 1.0 + 0.108*x2**2
20734 IF ( .false. )
THEN
20735 x1 = fventm*sqrtrhovt*sqrt(d*vth)
20736 IF ( x1 > 1.4 )
THEN
20737 am = 0.78 + 0.308*x1
20739 am = 1.0 + 0.108*x1**2
20742 d = 8.*denominvdp*( am*felv(mgs)*fwvdf(mgs)*rho0(mgs)*(qvs0 - qx(mgs,lv)) - ah*ftka(mgs)*temcg(mgs) )/ &
20743 (dtp* ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
20744 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs) + &
20745 max(0.001,vth - vtxbar(mgs,li,1))*h2*denominvdp))
20752 ( ( max(0.001,vth - vtxbar(mgs,lc,1))*h3 + &
20753 max(0.001,vth - vtxbar(mgs,lr,1))*h4) *rho0(mgs)*denomdp + &
20754 max(0.001,vth - vtxbar(mgs,li,1))*h2)
20757 IF ( abs(dold - d)/dold < 0.05 .or. ( n > 3 .and. d > dg0thresh ) )
EXIT
20761 d = min( d, dg0thresh + 0.0001 )
20766 dg0(mgs) = max( d, dwmin )
20771 dg0(mgs) = dg0thresh + 0.0001
20775 IF ( ihlcnh == 3 .and. (qhacw(mgs) + qhacr(mgs))*dtp > qxmin(lh) .and. qx(mgs,lh) > hlcnhqmin &
20776 .and. temg(mgs) .le. tfr+hailcnvtoffset .and. temg(mgs) > 238.0 )
THEN
20779 dg0(mgs) = min( dg0(mgs), dwmax )
20784 wtest = (dg0(mgs) > 0.0 .and. dg0(mgs) < dg0thresh )
20786 IF ( ihlcnh == 1 )
THEN
20788 IF ( ( wetgrowth(mgs) .and. (xdn(mgs,lh) .gt. hldnmn .or. lvh < 1 ) .and. &
20789 & rimdn(mgs,lh) .gt. 800. .and. &
20790 & ltest .and. qx(mgs,lh) .gt. hlcnhqmin ) .or. wtest )
THEN
20793 IF ( qhacw(mgs) .gt. 0.0 .and. qhacw(mgs) .gt. qhaci(mgs) .and. temg(mgs) .le. tfr+hailcnvtoffset )
THEN
20800 x = (1.1e4*(rho0(mgs)*qx(mgs,lc)) - 1.3e3*rho0(mgs)*qx(mgs,li) + 1.0e-3 )
20801 IF ( x > 1.e-20 )
THEN
20802 arg = min(70.0, (-temcg(mgs)/x ))
20803 dh0 = 0.01*(exp(arg) - 1.0)
20807 dg0(mgs) = min(dh0, dg0thresh + 0.0001)
20813 IF ( xdia(mgs,lh,3)/dh0 .gt. 0.1 )
THEN
20815 tmp = qhacw(mgs) + qhacr(mgs) + qhaci(mgs) + qhacs(mgs)
20817 qtmp = min( 100.0, xdia(mgs,lh,3)/(2.0*dh0) )*(tmp)
20818 qhlcnh(mgs) = min( qxmxd(mgs,lh), qtmp )
20820 IF ( ipconc .ge. 5 )
THEN
20822 IF ( .not. wtest ) dh0 = min( dh0, 10.e-3 )
20823 IF ( qx(mgs,lhl) > 0.1e-3 ) dh0 = max( dh0, xdia(mgs,lhl,3) )
20824 chlcnhhl(mgs) = min( cxmxd(mgs,lh), rho0(mgs)*qhlcnh(mgs)/(pi*xdn(mgs,lh)*dh0**3/6.0) )
20826 r = rho0(mgs)*qhlcnh(mgs)/(xdn(mgs,lh)*xv(mgs,lh))
20827 chlcnh(mgs) = max( chlcnhhl(mgs), r )
20830 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
20831 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20838 ELSEIF ( ihlcnh == 3 )
THEN
20842 ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr+hailcnvtoffset .and. qx(mgs,lh) > hlcnhqmin ) )
THEN
20844 IF ( ipconc == 5 )
THEN
20849 ratio = min( maxratiolu, dg0(mgs)/xdia(mgs,lh,1) )
20853 tmp2 =
gaminterp(ratio,alpha(mgs,lh),4,1)
20854 IF ( ipconc == 5 )
THEN
20857 qxd1 = qx(mgs,lh)*(tmp2)
20858 qhlcnh(mgs) = dtpinv*qxd1
20860 tmp3 = qxmxd(mgs,lh)
20861 IF (qxd1 > tmp3 )
THEN
20868 IF ( ( qxd1 > qxmin(lhl) .and. ipconc > 5 ) .or. ( qxd1 > 10.*qxmin(lhl) .and. ipconc == 5) )
THEN
20871 tmp =
gaminterp(ratio,alpha(mgs,lh),1,1)
20872 IF ( ipconc == 5 )
THEN
20875 cxd1 = flim*cx(mgs,lh)*( tmp)
20876 chlcnh(mgs) = dtpinv*cxd1
20877 chlcnhhl(mgs) = chlcnh(mgs)
20879 IF ( qx(mgs,lhl) > qxmin(lhl) .and. dmhlopt > 0 )
THEN
20880 tmp = rho0(mgs)*qhlcnh(mgs)/chlcnhhl(mgs)
20881 IF ( tmp < xmas(mgs,lhl) )
THEN
20883 dh0 = (( qxd1*tmp**(1./3.) + qx(mgs,lhl)*xmas(mgs,lhl)**(1./3.))/( qxd1 + qx(mgs,lhl)))**3
20884 chlcnhhl(mgs) = min( chlcnhhl(mgs), rho0(mgs)*qhlcnh(mgs)/dh0 )
20892 IF ( ipconc >= 6 .and. lzh > 1 .and. lzhl > 1 )
THEN
20893 tmp3 =
gaminterp(ratio,alpha(mgs,lh),11,1)
20894 zxd1 = flim*zx(mgs,lh)*(tmp3)
20895 zhlcnh(mgs) = dtpinv*zxd1
20898 tmp3 = g1xmax*(rho0(mgs)*qxd1)**2/((pi*xdn(mgs,lh)/6.0)**2)
20900 IF ( tmp4 > zxd1 )
THEN
20904 chlcnhhl(mgs) = dtpinv*cxd1
20909 IF ( ipconc == 5 )
THEN
20910 tmp3 =
gaminterp(ratio,alpha(mgs,lh),11,1)
20912 tmp5 = g1x(mgs,lh)*(rho0(mgs)*qx(mgs,lh))**2/((pi*xdn(mgs,lh)/6.)**2*cx(mgs,lh))
20913 zxd1 = flim*(tmp3)*tmp5
20916 tmp3 = g1x(mgs,lh)*(rho0(mgs)*qxd1)**2/((pi*xdn(mgs,lh)/6.0)**2)
20918 IF ( tmp4 > zxd1 )
THEN
20927 chlcnhhl(mgs) = dtpinv*cxd1
20936 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
20937 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20946 ELSEIF ( ihlcnh == 2 )
THEN
20957 IF ( qhacw(mgs)*dtp > qxmin(lh) .and. temg(mgs) .lt. tfr+hailcnvtoffset .and. qx(mgs,lh) > qxmin(lh) )
THEN
20958 ratio = min( maxratiolu, hldia1/xdia(mgs,lh,1) )
20961 tmp =
gaminterp(ratio,alpha(mgs,lh),1,1)
20962 cxd1 = cx(mgs,lh)*( tmp)
20963 chlcnh(mgs) = dtpinv*cxd1
20964 chlcnhhl(mgs) = chlcnh(mgs)
20967 tmp2 =
gaminterp(ratio,alpha(mgs,lh),4,1)
20968 qxd1 = qx(mgs,lh)*(tmp2)
20969 qhlcnh(mgs) = dtpinv*qxd1
20972 IF ( lzh > 1 .and. lzhl > 1 )
THEN
20973 tmp3 =
gaminterp(ratio,alpha(mgs,lh),11,1)
20974 zxd1 = zx(mgs,lh)*(tmp3)
20975 zhlcnh(mgs) = dtpinv*zxd1
20979 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
20980 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
20986 ELSEIF ( ihlcnh == 0 )
THEN
20991 if ( wetgrowth(mgs) .and. temg(mgs) .lt. tfr-5. .and. qx(mgs,lh) > qxmin(lh) )
then
20992 if ( qhacw(mgs).gt.1.e-6 .and. ( xdn(mgs,lh) > 700. .or. lvh == 0 ) )
then
20994 ((pi*xdn(mgs,lh)*cx(mgs,lh)) / (6.0*rho0(mgs)*dtp)) &
20995 *exp(-hldia1/xdia(mgs,lh,1)) &
20996 *( (hldia1**3) + 3.0*(hldia1**2)*xdia(mgs,lh,1) &
20997 + 6.0*(hldia1)*(xdia(mgs,lh,1)**2) + 6.0*(xdia(mgs,lh,1)**3) )
20998 qhlcnh(mgs) = min(qhlcnh(mgs),qhmxd(mgs))
20999 IF ( ipconc .ge. 5 )
THEN
21000 chlcnh(mgs) = min( cxmxd(mgs,lh), cx(mgs,lh)*exp(-hldia1/xdia(mgs,lh,1)))
21001 chlcnhhl(mgs) = chlcnh(mgs)
21004 vhlcnh(mgs) = rho0(mgs)*qhlcnh(mgs)/xdn(mgs,lh)
21005 vhlcnhl(mgs) = rho0(mgs)*qhlcnh(mgs)/max(xdnmn(lhl), xdn(mgs,lh))
21015 IF ( icvhl2h >= 1 )
THEN
21017 IF ( qx(mgs,lhl) > qxmin(lhl) .and. xdn(mgs,lhl) < 0.5*(xdnmn(lhl) + xdnmx(lhl)) )
THEN
21018 tmp = min(0.95, 1. - 0.5*(1. + tanh(0.125*(xdn(mgs,lhl) - 1.01*xdnmn(lhl) )) ))
21019 qhcnhl(mgs) = tmp*qx(mgs,lhl)*dtpinv
21020 chcnhl(mgs) = cx(mgs,lhl)*qhcnhl(mgs)/qx(mgs,lhl)
21021 vhcnhl(mgs) = vx(mgs,lhl)*qhcnhl(mgs)/qx(mgs,lhl)
21047 IF ( ipconc .ge. 5 )
THEN
21050 IF ( temg(mgs) < tfr .and. qx(mgs,lh) .gt. qxmin(lh) .and. qhdpv(mgs) > qxmin(lh)*dtpinv &
21051 & .and. qhacw(mgs) < qxmin(lh)*dtpinv )
THEN
21052 IF ( xdn(mgs,lh) < 290. )
THEN
21060 IF ( qx(mgs,ls) .gt. qxmin(ls) .and. qsacw(mgs) .gt. 0.0 )
THEN
21079 IF ( iglcnvs .eq. 1 )
THEN
21081 dnnet = cscnvis(mgs) + cscnis(mgs) - csacs(mgs)
21082 dqnet = qscnvi(mgs) + qscni(mgs) + qsacw(mgs) + qsdpv(mgs) + qssbv(mgs)
21084 a3 = 1./(rho0(mgs)*qx(mgs,ls))
21085 a1 = exp( - xdn(mgs,ls)*cx(mgs,ls)*vgra*a3 )
21087 a2 = (1.-(cx(mgs,ls)*vgra*xdn(mgs,ls)*a3))*dnnet
21089 a4 = cx(mgs,ls)**2*vgra*xdn(mgs,ls)*a3/qx(mgs,ls)*dqnet
21091 chcns(mgs) = max( 0.0, a1*(a2 + a4) )
21092 chcns(mgs) = min( chcns(mgs), cxmxd(mgs,ls) )
21093 chcnsh(mgs) = chcns(mgs)
21095 qhcns(mgs) = min( xdn(mgs,ls)*vgra*rhoinv(mgs)*chcns(mgs), qxmxd(mgs,ls) )
21096 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/max(xdn(mgs,ls),xdnmn(lh))
21099 ELSEIF ( iglcnvs .ge. 2 )
THEN
21101 IF ( temg(mgs) .lt. 273.0 .and. ( qsacw(mgs) - qsdpv(mgs) .gt. 0.0 .or. &
21102 ( iglcnvs >= 3 .and. qsacw(mgs)*dtp > 2.*qxmin(lh) .and. gamsnow73fac*xmas(mgs,ls) > xdnmn(lh)*xvmn(lh) ) ) )
THEN
21105 tmp = rimc1*(-((0.5)*(1.e+06)*xdia(mgs,lc,1)) &
21106 & *((0.60)*vtxbar(mgs,ls,1)) &
21107 & /(temg(mgs)-273.15))**(rimc2)
21109 tmp = min( tmp , 900.0 )
21117 IF ( iglcnvs == 2 )
THEN
21118 IF ( tmp .ge. 200.0 )
THEN
21119 r = max( 0.5*(xdn(mgs,ls) + tmp), xdnmn(lh) )
21121 qhcns(mgs) = (qsacw(mgs) - qsdpv(mgs))
21122 chcns(mgs) = cx(mgs,ls)*qhcns(mgs)/qx(mgs,ls)
21124 chcnsh(mgs) = min(chcns(mgs), rho0(mgs)*qhcns(mgs)/(r*xvmn(lh)) )
21126 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/r
21129 ELSEIF ( iglcnvs == 3 )
THEN
21134 IF ( tmp > xdnmn(lh) )
THEN
21135 r = max( 0.5*(xdn(mgs,ls) + tmp), xdnmn(lh) )
21137 qhcns(mgs) = 0.5*qsacw(mgs)
21138 chcns(mgs) = qhcns(mgs)/(gamsnow73fac*xmas(mgs,ls))
21139 chcns(mgs) = min( chcns(mgs), cx(mgs,ls)*qhcns(mgs)/qx(mgs,ls))
21140 chcnsh(mgs) = min(chcns(mgs), rho0(mgs)*qhcns(mgs)/(r*xvmn(lh)) )
21141 vhcns(mgs) = rho0(mgs)*qhcns(mgs)/r
21155 qhcns(mgs) = 0.001*ehscnv(mgs)*max((qx(mgs,ls)-6.e-4),0.0)
21156 qhcns(mgs) = min(qhcns(mgs),qxmxd(mgs,ls))
21157 IF ( lvol(lh) .ge. 1 ) vhcns(mgs) = rho0(mgs)*qhcns(mgs)/max(xdn(mgs,ls),400.)
21167 if ( irwfrz .gt. 0 .and. .not. mixedphase)
then
21173 qrztot(mgs) = qrfrz(mgs) + qiacr(mgs) + qsacr(mgs)
21179 & ( xdia(mgs,lr,1)*rwvent(mgs)*cx(mgs,lr)*fwet1(mgs) )
21180 qrzmax(mgs) = max(qrzmax(mgs), 0.0)
21181 qrzmax(mgs) = min(qrztot(mgs), qrzmax(mgs))
21182 qrzmax(mgs) = min(qx(mgs,lr)*dtpinv, qrzmax(mgs))
21184 IF ( temcg(mgs) < -30. )
THEN
21185 qrzmax(mgs) = qx(mgs,lr)*dtpinv
21192 IF ( qrztot(mgs) .gt. qrzmax(mgs) .and. qrztot(mgs) .gt. qxmin(lr) )
THEN
21193 qrzfac(mgs) = qrzmax(mgs)/(qrztot(mgs))
21197 qrzfac(mgs) = min(1.0, qrzfac(mgs))
21206 if ( temg(mgs) .le. 273.15 .and. qrzfac(mgs) .lt. 1.0 )
then
21207 qrfrz(mgs) = qrzfac(mgs)*qrfrz(mgs)
21208 qrfrzs(mgs) = qrzfac(mgs)*qrfrzs(mgs)
21209 qrfrzf(mgs) = qrzfac(mgs)*qrfrzf(mgs)
21210 qiacr(mgs) = qrzfac(mgs)*qiacr(mgs)
21211 qsacr(mgs) = qrzfac(mgs)*qsacr(mgs)
21212 qiacrf(mgs) = qrzfac(mgs)*qiacrf(mgs)
21213 qiacrs(mgs) = qrzfac(mgs)*qiacrs(mgs)
21214 crfrz(mgs) = qrzfac(mgs)*crfrz(mgs)
21215 crfrzf(mgs) = qrzfac(mgs)*crfrzf(mgs)
21216 crfrzs(mgs) = qrzfac(mgs)*crfrzs(mgs)
21217 ciacr(mgs) = qrzfac(mgs)*ciacr(mgs)
21218 ciacrf(mgs) = qrzfac(mgs)*ciacrf(mgs)
21219 ciacrs(mgs) = qrzfac(mgs)*ciacrs(mgs)
21226 vrfrzf(mgs) = qrzfac(mgs)*vrfrzf(mgs)
21227 viacrf(mgs) = qrzfac(mgs)*viacrf(mgs)
21247 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
21250 & fvce(mgs)*cx(mgs,lr)*rwvent(mgs)*rwcap(mgs)*evapfac
21252 IF ( rcond .eq. 1 )
THEN
21253 qrcev(mgs) = min(qrcev(mgs), qxmxd(mgs,lv))
21256 qrcev(mgs) = min(qrcev(mgs), 0.0)
21259 qrcev(mgs) = max(qrcev(mgs), -qrmxd(mgs))
21261 IF ( qrcev(mgs) .lt. 0. .and. lnr > 1 )
THEN
21264 IF ( icrcev == 1 )
THEN
21265 crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)
21266 ELSEIF ( icrcev == 2 )
THEN
21267 crcev(mgs) = (cx(mgs,lr)/(qx(mgs,lr)))*qrcev(mgs)*vtxbar(mgs,lr,2)/vtxbar(mgs,lr,1)
21282 IF ( lhwlg > 1 )
THEN
21286 IF ( lhlwlg > 1 )
THEN
21308 ltest = qx(mgs,lh) .gt. qxmin(lh)
21309 IF ( lhl > 1 ) ltest = ltest .or. qx(mgs,lhl) .gt. qxmin(lhl)
21311 IF ( (itype1 .ge. 1 .or. itype2 .ge. 1 ) &
21312 & .and. qx(mgs,lc) .gt. qxmin(lc))
THEN
21313 if ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 271.15 )
then
21314 IF ( ipconc .ge. 2 )
THEN
21315 IF ( xv(mgs,lc) .gt. 0.0 &
21322 IF ( alpha(mgs,lc) == 0.0 )
THEN
21323 ex1 = (1./250.)*exp(-7.23e-15/xv(mgs,lc))
21326 ratio = (1. + alpha(mgs,lc))*(7.23e-15)/xv(mgs,lc)
21328 IF ( usegamxinfcnu )
THEN
21329 i = nint(dgami*(1. + alpha(mgs,lc)))
21331 ex1 = (1./250.)*
gamxinf(1.+alpha(mgs,lc), ratio)/(gcnup1)
21333 ratio = min( maxratiolu, ratio )
21334 tmp =
gaminterp(ratio,alpha(mgs,lc),1,1)
21335 ex1 = (1./250.)*tmp
21338 IF ( itype2 .le. 2 )
THEN
21339 ft = max(0.0,min(1.0,-0.11*temcg(mgs)**2 - 1.1*temcg(mgs)-1.7))
21341 IF ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 267.15 )
THEN
21343 ELSEIF (temg(mgs) .ge. 267.15 .and. temg(mgs) .le. 269.15 )
THEN
21345 ELSEIF (temg(mgs) .ge. 269.15 .and. temg(mgs) .le. 271.15 )
THEN
21354 IF ( ft > 0.0 )
THEN
21356 IF ( itype2 > 0 )
THEN
21357 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. (.not. wetsfc(mgs)) )
THEN
21358 chmul1(mgs) = ft*ex1*chacw(mgs)
21360 qhmul1(mgs) = cimas0*chmul1(mgs)*rhoinv(mgs)
21362 IF ( lhl .gt. 1 )
THEN
21363 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
21364 chlmul1(mgs) = (ft*ex1*chlacw(mgs))
21365 qhlmul1(mgs) = cimas0*chlmul1(mgs)*rhoinv(mgs)
21370 IF ( itype1 > 0 )
THEN
21371 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. (.not. wetsfc(mgs)) )
THEN
21372 tmp = ft*(3.5e+08)*rho0(mgs)*qhacw(mgs)
21373 chmul1(mgs) = chmul1(mgs) + tmp
21374 qhmul1(mgs) = qhmul1(mgs) + cimas0*tmp*rhoinv(mgs)
21376 IF ( lhl .gt. 1 )
THEN
21377 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
21378 tmp = ft*(3.5e+08)*rho0(mgs)*qhlacw(mgs)
21379 chlmul1(mgs) = chlmul1(mgs) + tmp
21380 qhlmul1(mgs) = qhlmul1(mgs) + cimas0*tmp*rhoinv(mgs)
21398 if ( temg(mgs) .ge. 268.15 .and. temg(mgs) .le. 270.15 )
then
21399 fimt1(mgs) = 1.0 -(temg(mgs)-268.15)/2.0
21400 elseif (temg(mgs) .le. 268.15 .and. temg(mgs) .ge. 265.15 )
then
21401 fimt1(mgs) = 1.0 +(temg(mgs)-268.15)/3.0
21408 if ( temg(mgs) .ge. 265.15 .and. temg(mgs) .le. 267.15 )
then
21410 elseif (temg(mgs) .ge. 267.15 .and. temg(mgs) .le. 269.15 )
then
21412 elseif (temg(mgs) .ge. 269.15 .and. temg(mgs) .le. 271.15 )
then
21423 IF ( itype1 .ge. 1 )
THEN
21424 fimta(mgs) = (3.5e+08)*rho0(mgs)
21437 xcwmas = xmas(mgs,lc) * 1000.
21439 IF ( itype2 .ge. 1 )
THEN
21440 if ( xcwmas.lt.1.26e-9 )
then
21443 if ( xcwmas .le. 3.55e-9 .and. xcwmas .ge. 1.26e-9 )
then
21444 fimt2(mgs) = (2.27)*alog(xcwmas) + 13.39
21446 if ( xcwmas .gt. 3.55e-9 )
then
21450 fimt2(mgs) = min(fimt2(mgs),1.0)
21451 fimt2(mgs) = max(fimt2(mgs),0.0)
21465 IF ( .not. wetsfc(mgs) )
THEN
21466 chmul1(mgs) = fimt1(mgs)*(fimta(mgs) + &
21467 & (4.0e-03)*fimt2(mgs))*qhacw(mgs)
21470 qhmul1(mgs) = chmul1(mgs)*(cimas0/rho0(mgs))
21472 IF ( lhl .gt. 1 )
THEN
21473 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. (.not. wetsfchl(mgs)) )
THEN
21474 tmp = fimt1(mgs)*(fimta(mgs) + &
21475 & (4.0e-03)*fimt2(mgs))*qhlacw(mgs)
21477 qhlmul1(mgs) = cimas0*tmp*rhoinv(mgs)
21505 IF ( isnwfrac /= 0 )
THEN
21507 IF (temg(mgs) .gt. 265.0)
THEN
21508 if (xdia(mgs,ls,1) .gt. 100.e-6 .and. xdia(mgs,ls,1) .lt. 2.0e-3)
then
21510 tmp = rhoinv(mgs)*pi*xdn(mgs,ls)*cx(mgs,ls)*(500.e-6)**3
21511 qsmul(mgs) = max( kfrag*( qx(mgs,ls) - tmp ) , 0.0 )
21513 qsmul(mgs) = min( qxmxd(mgs,li), qsmul(mgs) )
21514 csmul(mgs) = min( cxmxd(mgs,li), rho0(mgs)*qsmul(mgs)/mfrag )
21531 qracif(mgs) = qraci(mgs)
21532 cracif(mgs) = craci(mgs)
21567 IF ( icenucopt == 1 .or. icenucopt == -10 .or. icenucopt == -11 )
THEN
21568 if ( ( temg(mgs) .lt. 268.15 .or. &
21570 & ( imeyers5 .and. temg(mgs) .lt. 272.0 .and. temgkm2(mgs) .lt. tfr) ) .and. &
21571 & ciintmx .gt. (cx(mgs,li)+ccitmp) &
21574 fiinit(mgs) = (felv(mgs)**2)/(cp*rw)
21575 dqisdt(mgs) = (qx(mgs,lv)-qis(mgs))/ &
21576 & (1.0 + fiinit(mgs)*qis(mgs)/tsqr(mgs))
21579 if ( ssi(mgs) .gt. 1.0 )
THEN
21581 dzfacp = max( float(kgsp(mgs)-kgs(mgs)), 0.0 )
21582 dzfacm = max( float(kgs(mgs)-kgsm(mgs)), 0.0 )
21585 & *(cmassin/rho0(mgs)) &
21586 & *max(0.0,wvel(mgs)) &
21587 & *max((cninp(mgs)-cninm(mgs)),0.0)/gz(igs(mgs),jgs,kgs(mgs)) &
21588 & /((dzfacp+dzfacm))
21590 qiint(mgs) = min(qiint(mgs), max(0.25*dqisdt(mgs),0.0))
21591 ciint(mgs) = qiint(mgs)*rho0(mgs)/cmassin
21599 IF ( icenucopt /= -10 )
THEN
21601 IF ( lcin > 1 )
THEN
21602 ciint(mgs) = min(ciint(mgs), ccin(mgs)*dtpinv)
21603 ccin(mgs) = ccin(mgs) - ciint(mgs)*dtp
21604 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21605 ELSEIF ( lcina > 1 )
THEN
21606 ciint(mgs) = max(0.0, min( ciint(mgs), min( cnina(mgs), ciintmx ) - cina(mgs) ))
21607 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21609 ELSEIF ( icenucopt == 1 .and. ciint(mgs) .gt. max(0.0, ciintmx - cx(mgs,li) - ccitmp )*dtpinv )
THEN
21610 ciint(mgs) = max(0.0, ciintmx - (cx(mgs,li)) )*dtpinv
21611 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21613 ELSEIF ( icenucopt == -11 .and. dtp*ciint(mgs) .gt. ( cnina(mgs) - (cx(mgs,li) - ccitmp)))
THEN
21614 ciint(mgs) = max(0.0, cnina(mgs) - (cx(mgs,li)+ccitmp)*dtpinv )
21615 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21623 ELSEIF ( icenucopt == 2 .or. icenucopt == -1 .or. icenucopt == -2 )
THEN
21625 IF ( ( temg(mgs) .lt. 268.15 .and. ssw(mgs) > 1.0 ) .or. ssi(mgs) > 1.25 )
THEN
21626 IF ( lcin > 1 )
THEN
21627 ciint(mgs) = min(cnina(mgs), ccin(mgs))
21628 ciint(mgs) = min( ciint(mgs), max(0.0, ciintmx - (cx(mgs,li) - ccitmp) ) )
21629 ccin(mgs) = ccin(mgs) - ciint(mgs)
21630 ciint(mgs) = ciint(mgs)*dtpinv
21632 ciint(mgs) = max( 0.0, cnina(mgs) - cina(mgs) )*dtpinv
21634 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21636 fiinit(mgs) = (felv(mgs)**2)/(cp*rw)
21637 dqisdt(mgs) = (qx(mgs,lv)-qis(mgs))/(1.0 + fiinit(mgs)*qis(mgs)/tsqr(mgs))
21638 qiint(mgs) = min(qiint(mgs), max(0.25*dqisdt(mgs),0.0))
21639 ciint(mgs) = qiint(mgs)*rho0(mgs)/cmassin
21644 ELSEIF ( icenucopt == 3 .or. icenucopt == 4 .or. icenucopt == 10 )
THEN
21645 IF ( temg(mgs) .lt. 268.15 )
THEN
21646 IF ( lcin > 1 )
THEN
21647 ciint(mgs) = min(cnina(mgs), ccin(mgs))
21648 ciint(mgs) = min( ciint(mgs), max(0.0, ciintmx - (cx(mgs,li) + ccitmp) ) )
21649 ccin(mgs) = ccin(mgs) - ciint(mgs)
21650 ciint(mgs) = ciint(mgs)*dtpinv
21652 ciint(mgs) = max( 0.0, cnina(mgs) - cina(mgs) )*dtpinv
21654 qiint(mgs) = ciint(mgs)*cmassin/rho0(mgs)
21659 if ( xplate(mgs) .eq. 1 )
then
21660 qipipnt(mgs) = qiint(mgs)
21661 cipint(mgs) = ciint(mgs)
21664 if ( xcolmn(mgs) .eq. 1 )
then
21665 qicicnt(mgs) = qiint(mgs)
21666 cicint(mgs) = ciint(mgs)
21679 if (ndebug .gt. 0 )
write(0,*)
'dbg = 8'
21682 if (ndebug .gt. 0 )
write(0,*)
'Collection: set 3-component'
21714 qrshr(mgs) = qsshr(mgs) + qhshr(mgs) + qhlshr(mgs)
21715 crshr(mgs) = chshrr(mgs)/rzxh(mgs) + chlshrr(mgs)/rzxhl(mgs)
21718 IF ( ipconc .ge. 3 )
THEN
21725 if (ndebug .gt. 0 )
write(0,*)
'dbg = 8a'
21731 IF ( ipconc .ge. 1 )
THEN
21761 if (ndebug .gt. 0 )
write(0,*)
'cloud ice sum'
21763 IF ( warmonly < 0.5 )
THEN
21764 IF ( ffrzs < 1.0 )
THEN
21767 & il5(mgs)*cicint(mgs) &
21768 & +il5(mgs)*((1.0-cwfrz2snowfrac)*cwfrzc(mgs)+cwctfzc(mgs) &
21772 & + csplinter(mgs) + csplinter2(mgs) &
21775 pccii(mgs) = pccii(mgs)*(1.0 - ffrzs)
21779 & il5(mgs)*(-cscni(mgs) - cscnvi(mgs) &
21782 & -chaci(mgs) - chlaci(mgs) &
21784 & +il5(mgs)*cisbv(mgs) &
21785 & -(1.-il5(mgs))*cimlr(mgs)
21787 pccin(mgs) = ciint(mgs)
21792 ELSEIF ( warmonly < 0.8 )
THEN
21800 & il5(mgs)*cicint(mgs) &
21801 & +il5(mgs)*((1.0-cwfrz2snowfrac)*cwfrzc(mgs)+cwctfzc(mgs) &
21805 & + csplinter(mgs) + csplinter2(mgs) &
21808 pccii(mgs) = pccii(mgs)*(1. - ffrzs)
21815 & +il5(mgs)*cisbv(mgs) &
21816 & -(1.-il5(mgs))*cimlr(mgs)
21818 pccin(mgs) = ciint(mgs)
21828 IF ( ipconc .ge. 2 )
THEN
21831 pccwi(mgs) = (0.0) - cwshw(mgs)
21833 IF ( warmonly < 0.5 )
THEN
21836 & il5(mgs)*(-ciacw(mgs)-cwfrz(mgs)-cwctfzp(mgs) &
21839 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
21842 ELSEIF ( warmonly < 0.8 )
THEN
21846 & -ciacw(mgs)-cwfrz(mgs)-cwctfzp(mgs) &
21849 & -cracw(mgs) -chacw(mgs) -chlacw(mgs)
21866 & - cautn(mgs) -cracw(mgs)
21870 IF ( .false. .and. exwmindiam > 0.0 .and. ccwresv(mgs) > 0.0 )
THEN
21872 & il5(mgs)*(-ciacw(mgs) &
21874 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
21876 IF ( -pccwdacc(mgs)*dtp .gt. cx(mgs,lc) - ccwresv(mgs) )
THEN
21878 frac = -(cx(mgs,lc) - ccwresv(mgs) )/(pccwdacc(mgs)*dtp)
21879 pccwdacc(mgs) = -(cx(mgs,lc) - ccwresv(mgs) )*dtpinv
21881 ciacw(mgs) = frac*ciacw(mgs)
21882 cracw(mgs) = frac*cracw(mgs)
21883 csacw(mgs) = frac*csacw(mgs)
21884 chacw(mgs) = frac*chacw(mgs)
21885 cautn(mgs) = frac*cautn(mgs)
21887 IF ( lhl .gt. 1 ) chlacw(mgs) = frac*chlacw(mgs)
21892 & il5(mgs)*(-ciacw(mgs)-cwfrzp(mgs)-cwctfzp(mgs) &
21893 & -cwfrzc(mgs)-cwctfzc(mgs) &
21894 & -il5(mgs)*(ciihr(mgs)) &
21896 & -cracw(mgs) -csacw(mgs) -chacw(mgs) - chlacw(mgs)
21903 IF ( -pccwd(mgs)*dtp .gt. cx(mgs,lc) )
THEN
21910 frac = -cx(mgs,lc)/(pccwd(mgs)*dtp)
21911 pccwd(mgs) = -cx(mgs,lc)*dtpinv
21913 ciacw(mgs) = frac*ciacw(mgs)
21914 cwfrz(mgs) = frac*cwfrz(mgs)
21915 cwfrzp(mgs) = frac*cwfrzp(mgs)
21916 cwctfzp(mgs) = frac*cwctfzp(mgs)
21917 cwfrzc(mgs) = frac*cwfrzc(mgs)
21918 cwctfzc(mgs) = frac*cwctfzc(mgs)
21919 cwctfz(mgs) = frac*cwctfz(mgs)
21920 cracw(mgs) = frac*cracw(mgs)
21921 csacw(mgs) = frac*csacw(mgs)
21922 chacw(mgs) = frac*chacw(mgs)
21923 cautn(mgs) = frac*cautn(mgs)
21925 pccii(mgs) = pccii(mgs) - (1.-frac)*il5(mgs)*(cwfrzc(mgs)+cwctfzc(mgs))*(1. - ffrzs)
21926 IF ( lhl .gt. 1 ) chlacw(mgs) = frac*chlacw(mgs)
21939 IF ( ipconc .ge. 3 )
THEN
21943 IF ( warmonly < 0.5 )
THEN
21947 & +(1-il5(mgs))*( &
21948 & -chmlrr(mgs)/rzxh(mgs) &
21949 & -chlmlrr(mgs)/rzxhl(mgs) &
21953 & - min(0.0,cracr(mgs)) &
21956 & il5(mgs)*(-ciacr(mgs) - crfrz(mgs) ) &
21958 & - chacr(mgs) - chlacr(mgs) &
21960 & - max(0.0,cracr(mgs))
21963 ELSEIF ( warmonly < 0.8 )
THEN
21966 & +(1-il5(mgs))*( &
21967 & -chmlrr(mgs)/rzxh(mgs) &
21968 & -chlmlrr(mgs)/rzxhl(mgs) &
21974 & il5(mgs)*( - crfrz(mgs) ) &
21995 IF ( -pcrwd(mgs)*dtp .gt. cx(mgs,lr) )
THEN
22003 frac = -cx(mgs,lr)/(pcrwd(mgs)*dtp)
22004 pcrwd(mgs) = -cx(mgs,lr)*dtpinv
22006 ciacr(mgs) = frac*ciacr(mgs)
22007 ciacrf(mgs) = frac*ciacrf(mgs)
22008 ciacrs(mgs) = frac*ciacrs(mgs)
22009 crfrz(mgs) = frac*crfrz(mgs)
22010 crfrzf(mgs) = frac*crfrzf(mgs)
22011 crfrzs(mgs) = frac*crfrzs(mgs)
22012 chacr(mgs) = frac*chacr(mgs)
22013 chlacr(mgs) = frac*chlacr(mgs)
22014 crcev(mgs) = frac*crcev(mgs)
22015 cracr(mgs) = frac*cracr(mgs)
22025 IF ( warmonly < 0.5 )
THEN
22030 IF ( ipconc .ge. 4 )
THEN
22034 & il5(mgs)*(cscnis(mgs) + cscnvis(mgs) ) &
22035 & + cwfrz2snowfrac*cwfrz(mgs)/cwfrz2snowratio &
22038 IF ( ffrzs > 0.0 )
THEN
22039 pcswi(mgs) = pcswi(mgs) + ffrzs* ( &
22040 & il5(mgs)*cicint(mgs) &
22041 & +il5(mgs)*(cwfrzc(mgs)+cwctfzc(mgs) &
22045 & + csplinter(mgs) + csplinter2(mgs) &
22050 IF ( ess0 < 0.0 )
THEN
22051 csacs(mgs) = max(0.0, csacs(mgs) - (ifrzs)*(crfrzs(mgs) + ciacrs(mgs)))
22056 & -chacs(mgs) - chlacs(mgs) &
22058 & +(1-il5(mgs))*csmlr(mgs) + csshr(mgs) &
22064 IF ( imixedphase == 0 )
THEN
22065 IF ( cx(mgs,ls) + dtp*(pcswi(mgs) + pcswd(mgs)) < 0.0 )
THEN
22066 frac = (-cx(mgs,ls) + pcswi(mgs)*dtp)/(pcswd(mgs)*dtp)
22068 pcswd(mgs) = frac*pcswd(mgs)
22070 chacs(mgs) = frac*chacs(mgs)
22071 chlacs(mgs) = frac*chlacs(mgs)
22072 chcns(mgs) = frac*chcns(mgs)
22073 csmlr(mgs) = frac*csmlr(mgs)
22074 csshr(mgs) = frac*csshr(mgs)
22075 cssbv(mgs) = frac*cssbv(mgs)
22076 csacs(mgs) = frac*csacs(mgs)
22083 pccii(mgs) = pccii(mgs) &
22084 & + (1. - ifrzs)*crfrzs(mgs) &
22085 & + (1. - ifrzs)*ciacrs(mgs)
22087 pcswi(mgs) = pcswi(mgs) &
22088 & + (ifrzs)*crfrzs(mgs) &
22089 & + (ifrzs)*ciacrs(mgs)
22098 IF ( ipconc .ge. 5 )
THEN
22101 & +(ffrzh*ifrzg*crfrzf(mgs) &
22102 & +il5(mgs)*ffrzh*ifiacrg*(ciacrf(mgs) )) &
22103 & + f2h*chcnsh(mgs) + f2h*chcnih(mgs) + chcnhl(mgs)
22106 & (1-il5(mgs))*chmlr(mgs) &
22109 & - il5(mgs)*chlcnh(mgs) &
22121 IF ( lhl .gt. 1 .and. lnhl > 1 )
THEN
22123 pchli(mgs) = (ffrzh*(1.0-ifrzg)*crfrzf(mgs) +il5(mgs)*ffrzh*(1.0-ifiacrg)*(ciacrf(mgs) )) &
22124 & + chlcnhhl(mgs) *rzxhlh(mgs)
22127 & (1-il5(mgs))*chlmlr(mgs) &
22129 & + chlsbv(mgs) - chcnhl(mgs)
22131 IF ( imixedphase == 0 )
THEN
22133 IF ( cx(mgs,lhl) + dtp*(pchli(mgs) + pchld(mgs)) < 0.0 )
THEN
22136 frac = (-cx(mgs,lhl) + pchli(mgs)*dtp)/(pchld(mgs)*dtp)
22138 chlmlr(mgs) = frac*chlmlr(mgs)
22139 chlsbv(mgs) = frac*chlsbv(mgs)
22140 chcnhl(mgs) = frac*chcnhl(mgs)
22142 pchld(mgs) = frac*pchld(mgs)
22154 ELSEIF ( warmonly < 0.8 )
THEN
22159 IF ( ipconc .ge. 5 )
THEN
22162 & +ifrzg*(crfrzf(mgs) )
22165 & (1-il5(mgs))*chmlr(mgs) &
22166 & - il5(mgs)*chlcnh(mgs)
22171 IF ( lhl .gt. 1 )
THEN
22173 pchli(mgs) = (1.0-ifrzg)*(crfrzf(mgs)) &
22174 & + chlcnhhl(mgs) *rzxhl(mgs)/rzxh(mgs)
22177 & (1-il5(mgs))*chlmlr(mgs)
22198 pctot(mgs) = pccwi(mgs) +pccwd(mgs) + &
22199 & pccii(mgs) +pccid(mgs) + &
22200 & pcrwi(mgs) +pcrwd(mgs) + &
22201 & pcswi(mgs) +pcswd(mgs) + &
22202 & pchwi(mgs) +pchwd(mgs) + &
22203 & pchli(mgs) +pchld(mgs)
22242 IF ( ipconc > 5 )
THEN
22255 IF ( warmonly < 0.5 )
THEN
22260 & -min(0.0, qrcev(mgs)) &
22261 & -min(0.0, qhcev(mgs)) &
22262 & -min(0.0, qhlcev(mgs)) &
22263 & -min(0.0, qscev(mgs)) &
22265 & -qhsbv(mgs) - qhlsbv(mgs) &
22267 & -il5(mgs)*qisbv(mgs)
22270 & -max(0.0, qrcev(mgs)) &
22271 & -max(0.0, qhcev(mgs)) &
22272 & -max(0.0, qhlcev(mgs)) &
22273 & -max(0.0, qscev(mgs)) &
22274 & +il5(mgs)*(-qiint(mgs) &
22275 & -qhdpv(mgs) -qsdpv(mgs) - qhldpv(mgs)) &
22276 & -il5(mgs)*qidpv(mgs)
22280 ELSEIF ( warmonly < 0.8 )
THEN
22283 & -min(0.0, qrcev(mgs)) &
22284 & -il5(mgs)*qisbv(mgs)
22286 & +il5(mgs)*(-qiint(mgs) &
22288 & -qhdpv(mgs) - qhldpv(mgs)) &
22290 & -max(0.0, qrcev(mgs)) &
22291 & -il5(mgs)*qidpv(mgs)
22297 & -min(0.0, qrcev(mgs))
22299 & -max(0.0, qrcev(mgs))
22308 pqcwi(mgs) = (0.0) + qwcnr(mgs) - qwshw(mgs)
22310 IF ( warmonly < 0.5 )
THEN
22312 & il5(mgs)*(-qiacw(mgs)-qwfrz(mgs)-qwctfz(mgs)) &
22313 & -il5(mgs)*(qiihr(mgs)) &
22314 & -qracw(mgs) -qsacw(mgs) -qrcnw(mgs) -qhacw(mgs) - qhlacw(mgs)
22316 ELSEIF ( warmonly < 0.8 )
THEN
22318 & il5(mgs)*(-qiacw(mgs)-qwfrz(mgs)-qwctfz(mgs)) &
22319 & -il5(mgs)*(qiihr(mgs)) &
22320 & -qracw(mgs) -qrcnw(mgs) -qhacw(mgs) -qhlacw(mgs)
22323 & -qracw(mgs) - qrcnw(mgs)
22327 IF ( pqcwd(mgs) .lt. 0.0 .and. -pqcwd(mgs)*dtp .gt. qx(mgs,lc) )
THEN
22329 frac = -max(0.0,qx(mgs,lc))/(pqcwd(mgs)*dtp)
22330 pqcwd(mgs) = -qx(mgs,lc)*dtpinv
22332 qiacw(mgs) = frac*qiacw(mgs)
22335 qwfrzc(mgs) = frac*qwfrzc(mgs)
22336 qwfrz(mgs) = frac*qwfrz(mgs)
22337 qwctfzc(mgs) = frac*qwctfzc(mgs)
22338 qwctfz(mgs) = frac*qwctfz(mgs)
22339 qracw(mgs) = frac*qracw(mgs)
22340 qsacw(mgs) = frac*qsacw(mgs)
22341 qhacw(mgs) = frac*qhacw(mgs)
22342 vhacw(mgs) = frac*vhacw(mgs)
22343 qrcnw(mgs) = frac*qrcnw(mgs)
22344 qwfrzp(mgs) = frac*qwfrzp(mgs)
22345 IF ( lhl .gt. 1 )
THEN
22346 qhlacw(mgs) = frac*qhlacw(mgs)
22347 vhlacw(mgs) = frac*vhlacw(mgs)
22359 IF ( warmonly < 0.5 )
THEN
22362 IF ( ffrzs < 1.0 )
THEN
22364 & il5(mgs)*qicicnt(mgs) &
22365 & +il5(mgs)*((1.0-cwfrz2snowfrac)*qwfrzc(mgs)+qwctfzc(mgs)) &
22366 & +il5(mgs)*(qicichr(mgs)) &
22368 & +qhmul1(mgs) + qhlmul1(mgs) &
22369 & + qsplinter(mgs) + qsplinter2(mgs)
22373 pqcii(mgs) = pqcii(mgs)*(1.0 - ffrzs) &
22374 & +il5(mgs)*qidpv(mgs) &
22375 & +il5(mgs)*qiacw(mgs)
22378 & il5(mgs)*(-qscni(mgs) - qscnvi(mgs) &
22383 & +il5(mgs)*qisbv(mgs) &
22384 & +(1.-il5(mgs))*qimlr(mgs) &
22389 ELSEIF ( warmonly < 0.8 )
THEN
22393 & il5(mgs)*qicicnt(mgs)*(1. - ffrzs) &
22394 & +il5(mgs)*((1.0-cwfrz2snowfrac)*qwfrzc(mgs)+qwctfzc(mgs))*(1. - ffrzs) &
22395 & +il5(mgs)*(qicichr(mgs))*(1. - ffrzs) &
22398 & +qhmul1(mgs) + qhlmul1(mgs) &
22399 & + qsplinter(mgs) + qsplinter2(mgs) &
22400 & +il5(mgs)*qidpv(mgs) &
22401 & +il5(mgs)*qiacw(mgs)
22414 & +il5(mgs)*qisbv(mgs) &
22415 & +(1.-il5(mgs))*qimlr(mgs)
22425 IF ( warmonly < 0.5 )
THEN
22427 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs)) &
22428 & +(1-il5(mgs))*( &
22430 & -qsmlr(mgs) - qhlmlr(mgs) &
22438 & il5(mgs)*(-qiacr(mgs)-qrfrz(mgs)) &
22439 & - qsacr(mgs) - qhacr(mgs) - qhlacr(mgs) - qwcnr(mgs) &
22440 & + min(0.0,qrcev(mgs))
22441 ELSEIF ( warmonly < 0.8 )
THEN
22443 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs)) &
22444 & +(1-il5(mgs))*( &
22450 & il5(mgs)*(-qrfrz(mgs)) &
22453 & + min(0.0,qrcev(mgs))
22456 & qracw(mgs) + qrcnw(mgs) + max(0.0, qrcev(mgs))
22457 pqrwd(mgs) = min(0.0,qrcev(mgs))
22462 IF ( pqrwd(mgs) .lt. 0.0 .and. -(pqrwd(mgs) + pqrwi(mgs))*dtp .gt. qx(mgs,lr) )
THEN
22464 frac = (-qx(mgs,lr) + pqrwi(mgs)*dtp)/(pqrwd(mgs)*dtp)
22467 pqwvi(mgs) = pqwvi(mgs) &
22468 & + min(0.0, qrcev(mgs)) &
22469 & - frac*min(0.0, qrcev(mgs))
22470 pqwvd(mgs) = pqwvd(mgs) &
22471 & + max(0.0, qrcev(mgs)) &
22472 & - frac*max(0.0, qrcev(mgs))
22474 qiacr(mgs) = frac*qiacr(mgs)
22475 qiacrf(mgs) = frac*qiacrf(mgs)
22476 qiacrs(mgs) = frac*qiacrs(mgs)
22477 viacrf(mgs) = frac*viacrf(mgs)
22478 qrfrz(mgs) = frac*qrfrz(mgs)
22479 qrfrzs(mgs) = frac*qrfrzs(mgs)
22480 qrfrzf(mgs) = frac*qrfrzf(mgs)
22481 vrfrzf(mgs) = frac*vrfrzf(mgs)
22482 qsacr(mgs) = frac*qsacr(mgs)
22483 qhacr(mgs) = frac*qhacr(mgs)
22484 vhacr(mgs) = frac*vhacr(mgs)
22485 qrcev(mgs) = frac*qrcev(mgs)
22486 qhlacr(mgs) = frac*qhlacr(mgs)
22487 vhlacr(mgs) = frac*vhlacr(mgs)
22488 qhcev(mgs) = frac*qhcev(mgs)
22489 qhlcev(mgs) = frac*qhlcev(mgs)
22492 IF ( warmonly < 0.5 )
THEN
22494 & il5(mgs)*(-qiacr(mgs)-qrfrz(mgs) - qsacr(mgs)) &
22495 & - qhacr(mgs) - qhlacr(mgs) - qwcnr(mgs) &
22496 & + min(0.0,qrcev(mgs))
22497 ELSEIF ( warmonly < 0.8 )
THEN
22499 & il5(mgs)*(-qrfrz(mgs)) &
22502 & + min(0.0,qrcev(mgs))
22504 pqrwd(mgs) = min(0.0,qrcev(mgs))
22510 IF ( qrcev(mgs) .ne. 0.0 )
THEN
22512 & -min(0.0, qrcev(mgs)) &
22513 & -min(0.0, qhcev(mgs)) &
22514 & -min(0.0, qhlcev(mgs)) &
22515 & -min(0.0, qscev(mgs)) &
22517 & -qhsbv(mgs) - qhlsbv(mgs) &
22519 & -il5(mgs)*qisbv(mgs)
22522 & -max(0.0, qrcev(mgs)) &
22523 & -max(0.0, qhcev(mgs)) &
22524 & -max(0.0, qhlcev(mgs)) &
22525 & -max(0.0, qscev(mgs)) &
22526 & +il5(mgs)*(-qiint(mgs) &
22527 & -qhdpv(mgs) -qsdpv(mgs) - qhldpv(mgs)) &
22528 & -il5(mgs)*qidpv(mgs)
22539 IF ( warmonly < 0.5 )
THEN
22546 & il5(mgs)*(qscni(mgs)+qsaci(mgs)+qsdpv(mgs) &
22548 & + ifrzs*(qiacrs(mgs) + qrfrzs(mgs)) &
22549 & + il5(mgs)*(( qwfrzc(mgs) + qwctfzc(mgs) + qicichr(mgs) )*ffrzs &
22550 & + (1.0 - ffrzs)*cwfrz2snowfrac*qwfrz(mgs) ) &
22551 & + il2(mgs)*qsacr(mgs)) &
22552 & + il5(mgs)*qicicnt(mgs)*ffrzs &
22553 & + il3(mgs)*(qiacrf(mgs)+qracif(mgs)) &
22554 & + max(0.0, qscev(mgs)) &
22555 & + qsacw(mgs) + qscnh(mgs) &
22556 & + ffrzs*(qsmul(mgs) &
22557 & +qhmul1(mgs) + qhlmul1(mgs) &
22558 & + qsplinter(mgs) + qsplinter2(mgs))
22561 & -qracs(mgs)*(1-il2(mgs)) -qhacs(mgs) - qhlacs(mgs) &
22563 & +(1-il5(mgs))*qsmlr(mgs) + qsshr(mgs) &
22566 & + min(0.0, qscev(mgs)) &
22570 IF ( imixedphase == 0 .and. pqswd(mgs) .lt. 0.0 )
THEN
22571 IF ( qx(mgs,ls) + dtp*(pqswi(mgs) + pqswd(mgs)) < 0.0 )
THEN
22572 frac = (-qx(mgs,ls) + pqswi(mgs)*dtp)/(pqswd(mgs)*dtp)
22574 pqswd(mgs) = frac*pqswd(mgs)
22576 qracs(mgs) = frac*qracs(mgs)
22577 qhacs(mgs) = frac*qhacs(mgs)
22578 qhlacs(mgs) = frac*qhlacs(mgs)
22579 qhcns(mgs) = frac*qhcns(mgs)
22580 qsmlr(mgs) = frac*qsmlr(mgs)
22581 qsshr(mgs) = frac*qsshr(mgs)
22582 qssbv(mgs) = frac*qssbv(mgs)
22583 qsmul(mgs) = frac*qsmul(mgs)
22584 IF ( qscev(mgs) < 0.0 ) qscev(mgs) = frac*qscev(mgs)
22589 pqcii(mgs) = pqcii(mgs) &
22590 & + (1. - ifrzs)*qrfrzs(mgs) &
22591 & + (1. - ifrzs)*qiacrs(mgs)
22600 & +il5(mgs)*(ffrzh*ifrzg*qrfrzf(mgs) + (1-il3(mgs))*ffrzh*ifiacrg*(qiacrf(mgs)+qracif(mgs))) &
22601 & + (1-il2(mgs))*(qracs(mgs) + qsacr(mgs)) &
22602 & +il5(mgs)*(qhdpv(mgs)) &
22603 & +max(0.0, qhcev(mgs)) &
22604 & +qhacr(mgs)+qhacw(mgs) &
22605 & +qhacs(mgs)+qhaci(mgs) &
22606 & + f2h*qhcns(mgs) + f2h*qhcni(mgs) + qhcnhl(mgs)
22609 & +(1-il5(mgs))*qhmlr(mgs) &
22612 & + min(0.0, qhcev(mgs)) &
22613 & -qhmul1(mgs) - qhlcnh(mgs) - qscnh(mgs) &
22614 & - ffrzh*(qsplinter(mgs) + qsplinter2(mgs))
22623 IF ( lhl .gt. 1 )
THEN
22627 & +il5(mgs)*(qhldpv(mgs) + ((1.0-ifrzg)*qrfrzf(mgs) + (1.0-ifiacrg)*(qiacrf(mgs)+ qracif(mgs)))) &
22628 & +max(0.0, qhlcev(mgs)) &
22629 & +qhlacr(mgs)+qhlacw(mgs) &
22630 & +qhlacs(mgs)+qhlaci(mgs) &
22634 & +(1-il5(mgs))*qhlmlr(mgs) &
22637 & + min(0.0, qhlcev(mgs)) &
22638 & -qhlmul1(mgs) - qhcnhl(mgs)
22640 IF ( imixedphase == 0 )
THEN
22642 IF ( qx(mgs,lhl) + dtp*(pqhli(mgs) + pqhld(mgs)) < 0.0 )
THEN
22645 frac = (-qx(mgs,lhl) + pqhli(mgs)*dtp)/(pqhld(mgs)*dtp)
22647 qhlmlr(mgs) = frac*qhlmlr(mgs)
22648 qhlsbv(mgs) = frac*qhlsbv(mgs)
22649 qhcnhl(mgs) = frac*qhcnhl(mgs)
22650 qhlmul1(mgs) = frac*qhlmul1(mgs)
22651 IF ( qhlcev(mgs) < 0.0 ) qhlcev(mgs) = frac*qhlcev(mgs)
22653 pqhld(mgs) = frac*pqhld(mgs)
22663 ELSEIF ( warmonly < 0.8 )
THEN
22669 & +il5(mgs)*ifrzg*(qrfrzf(mgs) ) &
22670 & +il5(mgs)*(qhdpv(mgs)) &
22671 & +qhacr(mgs)+qhacw(mgs)
22676 & - qsplinter(mgs) - qsplinter2(mgs) &
22677 & +(1-il5(mgs))*qhmlr(mgs)
22683 IF ( lhl .gt. 1 )
THEN
22687 & +il5(mgs)*(qhldpv(mgs) ) &
22688 & +il5(mgs)*(1.0-ifrzg)*(qrfrzf(mgs) ) &
22689 & +qhlacr(mgs)+qhlacw(mgs) &
22694 & +(1-il5(mgs))*qhlmlr(mgs) &
22697 & -qhlmul1(mgs) - qhcnhl(mgs)
22714 IF ( mixedphase )
THEN
22718 vhmlr(:) = qhmlr(:)
22722 vhlmlr(:) = qhlmlr(:)
22733 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'graupel reflectivity'
22743 IF ( ffrzh > 0.0 )
THEN
22755 IF ( lzh .gt. 1 )
THEN
22759 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) .gt. 0.0 )
THEN
22760 tmp = qx(mgs,lh)/cx(mgs,lh)
22761 alp = max( alphamin, alpha(mgs,lh) )
22766 zhaci(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhaci(mgs) )
22767 zhacs(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhacs(mgs) )
22769 IF ( .not. mixedphase .and. ibinhmlr < 1 )
THEN
22770 zhmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhmlr(mgs) - tmp**2 * chmlr(mgs) )
22773 zhshr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs) )
22776 IF ( lzr > 0 .and. qhshr(mgs) /= 0.0 .and. chshrr(mgs) /= 0.0 )
THEN
22788 IF ( temg(mgs) >= tfr )
THEN
22793 IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam )
THEN
22794 z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
22796 z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
22802 zhshrr(mgs) = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhshr(mgs)**2/ chshrr(mgs) )
22805 zhshrr(mgs) = min( 0.0, zhshrr(mgs) )
22808 IF ( zhshr(mgs) > 0.0 )
THEN
22809 write(0,*)
'Problem with zhshr! zhshr,qhshr,chshr = ',zhshr(mgs),qhshr(mgs),chshr(mgs)
22810 write(0,*)
'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lh),cx(mgs,lh),zx(mgs,lh)
22811 write(0,*) ( 2.*tmp * qhshr(mgs) - tmp**2 * chshr(mgs) ), 2.*tmp * qhshr(mgs), - tmp**2 * chshr(mgs)
22812 write(0,*)
'temcg = ',temcg(mgs),
'chshr recalc = ',(cx(mgs,lh)/(qx(mgs,lh)+1.e-20))*qhshr(mgs)
22820 qtmp = qhdpv(mgs) + qhcev(mgs) + qhsbv(mgs)
22821 ctmp = chdpv(mgs) + chcev(mgs) + chsbv(mgs)
22823 zhdsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
22825 alp = max( alphahacx, alpha(mgs,lh) )
22830 IF ( qhacr(mgs) .gt. 0.0 )
THEN
22835 zhacr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacr(mgs) )
22846 IF ( qhacw(mgs) .gt. 0.0 )
THEN
22848 zhacw(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( qx(mgs,lh)/cx(mgs,lh)) * qhacw(mgs) )
22853 IF ( qhacw(mgs) .gt. 0.0 .or. qhacr(mgs) .gt. 0.0 )
THEN
22854 z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lh)+dtp*(qhacr(mgs) + qhacw(mgs)-qhmul1(mgs)))**2)/(cx(mgs,lh))
22856 IF ( z > zx(mgs,lh) )
THEN
22857 zhacw(mgs) = (z - zx(mgs,lh))*dtpinv
22863 IF ( qhlcnh(mgs) .gt. 0.0 .and. ihlcnh < 2 )
THEN
22864 zhlcnh(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lh)))**2*( 2.*( tmp ) * qhlcnh(mgs) - tmp**2 * chlcnh(mgs) )
22868 IF ( ffrzh*qiacrf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 .and. qx(mgs,lr) .gt. qxmin(lr) )
THEN
22869 tmp = qx(mgs,lr)/cx(mgs,lr)
22872 IF ( imurain == 3 )
THEN
22874 ziacr(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.))* &
22875 & ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs) )
22877 ziacr(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2)* &
22878 & ( 2.*tmp * qiacrf(mgs) - tmp**2 * ciacrf(mgs) )
22880 ziacr(mgs) = min( ziacr(mgs), zxmxd(mgs,lr) )
22882 ziacrf(mgs) = (xdn(mgs,lr)/xdnmx(lh))**2 * ziacr(mgs)
22889 IF ( ffrzh*qrfrzf(mgs) .gt. 0.0 .and. cx(mgs,lr) .gt. 0.0 )
THEN
22890 tmp = qx(mgs,lr)/cx(mgs,lr)
22893 IF ( imurain == 3 )
THEN
22894 zrfrz(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,lr)+2.)/(xdn0(lr)**2*(alpha(mgs,lr)+1.)) * &
22895 & ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs) )
22896 zrfrzf(mgs) = (xdn(mgs,lr)/xdn(mgs,lh))**2 * zrfrz(mgs)
22897 ELSEIF ( imurain == 1 .and. ibiggopt /= 2 )
THEN
22900 zrfrz(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(xdn0(lr)**2) * &
22901 & ( 2.*tmp * qrfrz(mgs) - tmp**2 * crfrz(mgs) )
22902 zrfrzf(mgs) = 3.6476*rho0(mgs)**2*g1x(mgs,lr)/(rhofrz**2) * &
22903 & ( 2.*tmp * qrfrzf(mgs) - tmp**2 * crfrzf(mgs) )
22905 zrfrz(mgs) = min( zrfrz(mgs), max(0.4,qrfrz(mgs)/qx(mgs,lr))*zx(mgs,lr)*dtpinv )
22913 IF ( lhl > 1 .and. qhcnhl(mgs) .gt. 0.0 )
THEN
22914 tmp = qx(mgs,lhl)/cx(mgs,lhl)
22915 zhcnhl(mgs) = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhcnhl(mgs) - tmp**2 * chcnhl(mgs) )
22919 IF ( qhcns(mgs) > 0.0 .and. chcns(mgs) > 0.0 .and. cx(mgs,ls) > cxmin .and. vhcns(mgs) > 0 )
THEN
22920 tmp = qx(mgs,ls)/cx(mgs,ls)
22921 r = rho0(mgs)*qhcns(mgs)/vhcns(mgs)
22922 IF ( imusnow == 3 )
THEN
22923 zhcns(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,ls)+2.)/(r**2*(alpha(mgs,ls)+1.)) * &
22924 & ( 2.*tmp * qhcns(mgs) - tmp**2 * chcnsh(mgs) )
22926 write(0,*)
'Value of imusnow not valid. Must be 3 (fix me for =1). imusnow = ',imusnow
22931 IF ( qhcni(mgs) > 0.0 .and. chcnih(mgs) > 0.0 .and. cx(mgs,li) > cxmin .and. vhcni(mgs) > 0 )
THEN
22932 tmp = qx(mgs,li)/cx(mgs,li)
22933 r = rho0(mgs)*qhcni(mgs)/vhcni(mgs)
22934 zhcni(mgs) = 3.6476*rho0(mgs)**2*(alpha(mgs,li)+2.)/(r**2*(alpha(mgs,li)+1.)) * &
22935 & ( 2.*tmp * qhcni(mgs) - tmp**2 * chcnih(mgs) )
22940 & +ifrzg*ffrzh*(zrfrzf(mgs) &
22941 & +il5(mgs)*ifiacrg*(ziacrf(mgs) ) ) &
22948 & + f2h*zhcni(mgs) + f2h*zhcns(mgs) &
22949 & + max( 0.0, zhdsv(mgs) )
22952 & + (1-il5(mgs))*zhmlr(mgs) &
22954 & + min( 0.0, zhdsv(mgs) ) &
22955 & - il5(mgs)*zhlcnh(mgs)
22967 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'end graupel reflectivity'
22983 IF ( lzhl .gt. 1 .or. ( lzr > 1 .and. lnhl > 1 ) )
THEN
22985 if (ndebug .gt. 0 .and. my_rank>=0 )
write(0,*) my_rank,
'hail reflectivity'
22989 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) .gt. 0.0 )
THEN
22990 tmp = qx(mgs,lhl)/cx(mgs,lhl)
22991 alp = max( alphamin, alpha(mgs,lhl) )
22995 IF ( .not. mixedphase .and. qhlmlr(mgs) /= 0.0 .and. chlmlr(mgs) /= 0.0 .and. ibinhlmlr < 1 )
THEN
22996 zhlmlr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlmlr(mgs) - tmp**2 * chlmlr(mgs) )
22999 zhlshr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs) )
23000 IF ( lzr > 1 .and. qhlshr(mgs) /= 0.0 .and. chlshrr(mgs) /= 0.0 )
THEN
23001 IF ( temg(mgs) >= tfr )
THEN
23006 IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam )
THEN
23007 z1 = g1*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
23009 z1 = g1shr*(6.0*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
23015 zhlshrr(mgs) = g1shr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlshr(mgs)**2/ chlshrr(mgs) )
23018 zhlshrr(mgs) = min( 0.0, zhlshrr(mgs) )
23021 IF ( zhlshr(mgs) > 0.0 )
THEN
23022 write(0,*)
'Problem with zhlshr! zhlshr,qhlshr,chlshr = ',zhlshr(mgs),qhlshr(mgs),chlshr(mgs)
23023 write(0,*)
'g1,tmp, qx,cx,zx = ',g1,tmp,qx(mgs,lhl),cx(mgs,lhl),zx(mgs,lhl)
23024 write(0,*) ( 2.*tmp * qhlshr(mgs) - tmp**2 * chlshr(mgs) ), 2.*tmp * qhlshr(mgs), - tmp**2 * chlshr(mgs)
23025 write(0,*)
'temcg = ',temcg(mgs),
'chlshr recalc = ',(cx(mgs,lhl)/(qx(mgs,lhl)+1.e-20))*qhlshr(mgs)
23033 qtmp = qhldpv(mgs) + qhlcev(mgs)
23034 ctmp = chldpv(mgs) + chlcev(mgs)
23036 zhldsv(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
23038 alp = max( alphahacx, alpha(mgs,lhl) )
23043 IF ( qhlacr(mgs) .gt. 0.0 )
THEN
23045 zhlacr(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*( tmp ) * qhlacr(mgs) )
23058 IF ( qhlacw(mgs) .gt. 0.0 )
THEN
23059 alp = max( 3.0, alpha(mgs,lhl)+1. )
23060 g1 = (6.0 + alp)*(5.0 + alp)*(4.0 + alp)/((3.0 + alp)*(2.0 + alp)*(1.0 + alp))
23064 zhlacw(mgs) = g1*(6.*rho0(mgs)/(pi*xdn(mgs,lhl)))**2*( 2.*tmp * qhlacw(mgs) )
23074 IF ( qhlacw(mgs) .gt. 0.0 .or. qhlacr(mgs) .gt. 0.0 )
THEN
23075 z = g1*(6.*rho0(mgs)/(pi*1000.))**2*( (qx(mgs,lhl)+dtp*(qhlacr(mgs) + qhlacw(mgs)-qhlmul1(mgs)))**2)/(cx(mgs,lhl))
23077 IF ( z > zx(mgs,lhl) )
THEN
23078 zhlacw(mgs) = (z - zx(mgs,lhl))*dtpinv
23087 IF ( lzhl > 1 )
THEN
23088 pzhli(mgs) = ffrzh*(((1.0-ifrzg)*zrfrzf(mgs) &
23089 & +il5(mgs)*(1.0-ifiacrg)*ziacrf(mgs) )) &
23090 & + il5(mgs)*zhlcnh(mgs) &
23094 & + max( 0.0, zhldsv(mgs) )
23097 & + (1-il5(mgs))*zhlmlr(mgs) &
23100 & + min( 0.0, zhldsv(mgs) )
23103 IF ( .not. ( -1.0 < pzhli(mgs) .and. pzhli(mgs) < 1.e20 ) )
THEN
23104 write(iunit,*)
'Problem with pzhli!'
23105 write(iunit,*)
'zhlcnh,zhlacw,zhlacr,zhldsv = ',zhlcnh(mgs),zhlacw(mgs),zhlacr(mgs),zhldsv(mgs)
23108 IF ( .not. ( -1.0e20 < pzhld(mgs) .and. pzhld(mgs) < 1. ) )
THEN
23109 write(iunit,*)
'Problem with pzhld!'
23110 write(iunit,*)
'zhlmlr,zhlshr,zhldsv = ',zhlmlr(mgs),zhlshr(mgs),zhldsv(mgs)
23122 if (ndebug .gt. 0 )
write(0,*)
'WARMZIEG: dbg = 11'
23124 IF ( lzr .gt. 1 )
THEN
23138 IF ( qx(mgs,ls) .gt. qxmin(ls) .and. ( csmlr(mgs) /= 0.0 .or. csshr(mgs) /= 0.0 .or. &
23139 csmlrr(mgs) /= 0.0 .or. csshrr(mgs) /= 0.0) )
THEN
23140 tmp = qx(mgs,ls)/cx(mgs,ls)
23141 g1 = 36.*(xnu(ls)+2.0)/((xnu(ls)+1.0)*pi**2)
23142 IF ( .not. mixedphase )
THEN
23146 IF ( csmlrr(mgs) /= 0.0 )
THEN
23147 z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsmlr(mgs)**2/ csmlrr(mgs) )
23155 IF ( csshrr(mgs) /= 0.0 )
THEN
23156 z1 = g1smlr*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qsshr(mgs)**2/ csshrr(mgs) )
23162 IF ( .not. mixedphase )
THEN
23163 IF ( zhmlr(mgs) < 0.0 .and. chmlrr(mgs) /= 0.0 .and. ibinhmlr == 0 )
THEN
23164 tmp = qx(mgs,lh)/cx(mgs,lh)
23171 IF ( (shedalp + alpha(mgs,lh))*xdia(mgs,lh,1) < sheddiam )
THEN
23172 z1 = g1x(mgs,lh)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs) )
23174 z1 = min(g1x(mgs,lh),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhmlr(mgs)**2/ chmlrr(mgs) )
23184 IF ( lhl > 1 .and. qhlmlr(mgs) /= 0 .and. ibinhlmlr == 0)
THEN
23185 tmp = qx(mgs,lhl)/cx(mgs,lhl)
23193 IF ( (shedalp + alpha(mgs,lhl))*xdia(mgs,lhl,1) < sheddiam )
THEN
23194 z1 = g1x(mgs,lhl)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs) )
23196 z1 = min(g1x(mgs,lhl),g1shr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( qhlmlr(mgs)**2/ chlmlrr(mgs) )
23209 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) .gt. 0.0 )
THEN
23211 tmp = qx(mgs,lr)/cx(mgs,lr)
23215 IF ( qracw(mgs) > 0.0 .and. cx(mgs,lr) > 0.0 )
THEN
23216 zracw(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( 2.*tmp * qracw(mgs) )
23219 IF ( cracr(mgs) /= 0.0 .and. cx(mgs,lr) > 0.0 )
THEN
23220 zracr(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*1000.))**2*( tmp**2 * cracr(mgs) )
23229 zrcev(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2*( 2.*( tmp ) * qtmp - tmp**2 * ctmp )
23232 IF ( iferwisventr == 2 )
THEN
23233 vent1 = min(0.0, (12./(pii*xdn(mgs,lr)))*xdia(mgs,lr,1)**3*fvce(mgs)*rwcap(mgs)*rwventz(mgs))
23234 zrcev(mgs) = max( dble(zrcev(mgs)), vent1 )
23242 zrcev(mgs) = max( zrcev(mgs), -zxmxd(mgs,lr) )
23244 IF ( qhacr(mgs) > 0.0 )
THEN
23245 zrach(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
23246 & ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhacr(mgs) - tmp**2 * chacr(mgs) )
23247 zrach(mgs) = min( zrach(mgs), zxmxd(mgs,lr) )
23251 IF ( lhl > 1 .and. qhlacr(mgs) > 0.0 )
THEN
23252 zrachl(mgs) = g1x(mgs,lr)*(6.*rho0(mgs)/(pi*xdn(mgs,lr)))**2* &
23253 & ( 2.*( qx(mgs,lr)/cx(mgs,lr)) * qhlacr(mgs) - tmp**2 * chlacr(mgs) )
23254 zrachl(mgs) = min( zrachl(mgs), zxmxd(mgs,lr) )
23261 pzrwi(mgs) = zrcnw(mgs) + zracw(mgs) + zracr(mgs) &
23262 & + max( 0.,zrcev(mgs) ) &
23263 & - (1-il5(mgs))*zsmlrr(mgs) &
23265 & - (1-il5(mgs))*zhmlrr(mgs) &
23267 & - (1-il5(mgs))*zhlmlrr(mgs) &
23272 & + min(0.,zrcev(mgs) ) &
23276 & - il5(mgs)*(ziacr(mgs) )
23279 IF ( zx(mgs,lr) + dtp*(pzrwi(mgs)+pzrwd(mgs)) <= 0.0 &
23280 .and. qx(mgs,lr) > qxmin(lr) )
THEN
23281 pzrwd(mgs) = -zx(mgs,lr)*dtpinv - pzrwi(mgs)
23293 IF ( lvol(ls) .gt. 1 )
THEN
23297 pvswi(mgs) = rho0(mgs)*( &
23300 & +il5(mgs)*(qscni(mgs)+qsaci(mgs)+qsdpv(mgs) &
23301 & + qscnvi(mgs) + (1. - ifrzs)*qiacrs(mgs) &
23302 & + (1. - ifrzs)*qrfrzs(mgs) &
23304 & + (qsacr(mgs))/rimdn(mgs,ls) ) + vsacw(mgs)
23306 pvswd(mgs) = rho0(mgs)*( pqswd(mgs) )/xdn0(ls) &
23311 & -rho0(mgs)*qsmul(mgs)/xdn0(ls)
23326 IF ( lvol(lh) .gt. 1 )
THEN
23333 pvhwi(mgs) = rho0(mgs)*( &
23334 & +il5(mgs)*( ifiacrg*ffrzh*qracif(mgs))/rhofrz &
23336 & + ( il5(mgs)*qhdpv(mgs)/qhdpvdn &
23337 & + (qhacs(mgs) + qhaci(mgs))/qhacidn ) ) &
23338 & + rho0(mgs)*max(0.0, qhcev(mgs))/1000. &
23340 & + f2h*vhcns(mgs) &
23341 & + vhacr(mgs) + vhacw(mgs) + vhfzh(mgs) &
23343 & + f2h*vhcni(mgs) + (ifiacrg*viacrf(mgs) + ifrzg*vrfrzf(mgs))*ffrzh
23348 pvhwd(mgs) = rho0(mgs)*( &
23351 & +( (1-il5(mgs))*vhmlr(mgs) &
23354 & + min(0.0, qhcev(mgs)) &
23355 & -qhmul1(mgs) )/xdn(mgs,lh) ) &
23356 & - vhlcnh(mgs) + vhshdr(mgs) - vhsoak(mgs) - vscnh(mgs)
23363 IF ( lzh > 1 .and. qx(mgs,lh) > qxmin(lh) .and. &
23364 vx(mgs,lh) + dtp*(pvhwi(mgs) + pvhwd(mgs)) > rho0(mgs)*qxmin(lh)/900. )
THEN
23367 xdn_new = rho0(mgs)*(qx(mgs,lh) + dtp*(pqhwi(mgs) + pqhwd(mgs) ))/ &
23368 & (vx(mgs,lh) + dtp*(pvhwi(mgs) + pvhwd(mgs)) )
23370 IF ( mixedphase )
THEN
23371 IF ( qxw(mgs,lh) .gt. 0.0 )
THEN
23380 xdn_new = max( min( xdn_new, dnmx ), xdnmn(lh) )
23382 drhodt = (xdn_new - xdn(mgs,lh))*dtpinv
23384 zhwdn(mgs) = -2.*g1x(mgs,lh)*(rho0(mgs)*qx(mgs,lh)*6.*pii )**2/(cx(mgs,lh)*xdn(mgs,lh)**3)*drhodt
23386 pzhwi(mgs) = pzhwi(mgs) + max(0.0, zhwdn(mgs))
23387 pzhwd(mgs) = pzhwd(mgs) + min(0.0, zhwdn(mgs))
23391 IF ( .false. .and. ny .eq. 2 .and. kgs(mgs) .eq. 9 .and. igs(mgs) .eq. 19 )
THEN
23394 write(iunit,*)
'Graupel at ',igs(mgs),kgs(mgs)
23396 write(iunit,*) il5(mgs)*qrfrzf(mgs), qrfrzf(mgs) - qrfrz(mgs)
23397 write(iunit,*) il5(mgs)*qiacrf(mgs)
23398 write(iunit,*) il5(mgs)*qracif(mgs)
23399 write(iunit,*)
'qhcns',qhcns(mgs)
23400 write(iunit,*)
'qhcni',qhcni(mgs)
23401 write(iunit,*) il5(mgs)*(qhdpv(mgs))
23402 write(iunit,*)
'qhacr ',qhacr(mgs)
23403 write(iunit,*)
'qhacw', qhacw(mgs)
23404 write(iunit,*)
'qhacs', qhacs(mgs)
23405 write(iunit,*)
'qhaci', qhaci(mgs)
23406 write(iunit,*)
'pqhwi = ',pqhwi(mgs)
23408 write(iunit,*)
'qhcev',qhcev(mgs)
23410 write(iunit,*)
'qhshr',qhshr(mgs)
23411 write(iunit,*)
'qhmlr', (1-il5(mgs))*qhmlr(mgs)
23412 write(iunit,*)
'qhsbv', qhsbv(mgs)
23413 write(iunit,*)
'qhlcnh',-qhlcnh(mgs)
23414 write(iunit,*)
'qhmul1',-qhmul1(mgs)
23415 write(iunit,*)
'pqhwd = ', pqhwd(mgs)
23417 write(iunit,*)
'Volume'
23419 write(iunit,*)
'pvhwi',pvhwi(mgs)
23420 write(iunit,*)
'vhcns', vhcns(mgs)
23421 write(iunit,*)
'vhacr,vhacw',vhacr(mgs), vhacw(mgs)
23422 write(iunit,*)
'vhcni',vhcni(mgs)
23424 write(iunit,*)
'pvhwd',pvhwd(mgs)
23425 write(iunit,*)
'vhlcnh,vhshdr,vhsoak ', vhlcnh(mgs), vhshdr(mgs), vhsoak(mgs)
23426 write(iunit,*)
'vhmlr', vhmlr(mgs)
23431 write(iunit,*)
'Concentration'
23432 write(iunit,*) pchwi(mgs),pchwd(mgs)
23433 write(iunit,*) crfrzf(mgs)
23434 write(iunit,*) chcns(mgs)
23435 write(iunit,*) ciacrf(mgs)
23451 IF ( lhl .gt. 1 )
THEN
23452 IF ( lvol(lhl) .gt. 1 )
THEN
23455 pvhli(mgs) = rho0(mgs)*( &
23456 & + ( il5(mgs)*(((1.0-ifiacrg)*ffrzh*qracif(mgs))/rhofrz + qhldpv(mgs) ) &
23460 & + qhlacs(mgs) + qhlaci(mgs) )/500. ) &
23461 & + rho0(mgs)*max(0.0, qhlcev(mgs))/1000. &
23462 & + vhlcnhl(mgs) + ((1.0-ifiacrg)*ffrzh*viacrf(mgs) + (1.0-ifrzg)*ffrzh*vrfrzf(mgs)) &
23463 & + vhlacr(mgs) + vhlacw(mgs) + vhlfzhl(mgs)
23465 pvhld(mgs) = rho0(mgs)*( &
23467 & + min(0.0, qhlcev(mgs)) &
23468 & -qhlmul1(mgs) )/xdn(mgs,lhl) ) &
23470 & + rho0(mgs)*(1-il5(mgs))*vhlmlr(mgs)/xdn(mgs,lhl) &
23471 & + vhlshdr(mgs) - vhlsoak(mgs)
23473 IF ( lzhl > 1 .and. qx(mgs,lhl) > qxmin(lhl) .and. &
23474 vx(mgs,lhl) + dtp*(pvhli(mgs) + pvhld(mgs)) > rho0(mgs)*qxmin(lhl)/900. )
THEN
23477 xdn_new = rho0(mgs)*(qx(mgs,lhl) + dtp*(pqhli(mgs) + pqhld(mgs) ))/ &
23478 & (vx(mgs,lhl) + dtp*(pvhli(mgs) + pvhld(mgs)) )
23480 IF ( mixedphase )
THEN
23481 IF ( qxw(mgs,lhl) .gt. 0.0 )
THEN
23489 xdn_new = max( min( xdn_new, dnmx ), xdnmn(lhl) )
23491 drhodt = (xdn_new - xdn(mgs,lhl))*dtpinv
23493 zhldn(mgs) = -2.*g1x(mgs,lhl)*(rho0(mgs)*qx(mgs,lhl)*6.*pii )**2/(cx(mgs,lhl)*xdn(mgs,lhl)**3)*drhodt
23495 pzhli(mgs) = pzhli(mgs) + max(0.0, zhldn(mgs))
23496 pzhld(mgs) = pzhld(mgs) + min(0.0, zhldn(mgs))
23507 if ( ndebug .ge. 1 )
then
23511 ptotal(mgs) = ptotal(mgs) &
23512 & + pqwvi(mgs) + pqwvd(mgs) &
23513 & + pqcwi(mgs) + pqcwd(mgs) &
23514 & + pqcii(mgs) + pqcid(mgs) &
23515 & + pqrwi(mgs) + pqrwd(mgs) &
23516 & + pqswi(mgs) + pqswd(mgs) &
23517 & + pqhwi(mgs) + pqhwd(mgs) &
23518 & + pqhli(mgs) + pqhld(mgs)
23527 if ( ( (ndebug .ge. 0 ) .and. abs(ptotal(mgs)) .gt. eqtot ) &
23534 & .or. .not. (ptotal(mgs) .lt. 1.0 .and. ptotal(mgs) .gt. -1.0) &
23536 write(iunit,*)
'YIKES! ',
'ptotal1',mgs,igs(mgs),jgs, &
23537 & kgs(mgs),ptotal(mgs)
23539 write(iunit,*)
't7: ', t7(igs(mgs),jgs,kgs(mgs))
23540 write(iunit,*)
'cci,ccw,crw,rdia: ',cx(mgs,li),cx(mgs,lc),cx(mgs,lr),0.5*xdia(mgs,lr,1)
23541 write(iunit,*)
'qc,qi,qr : ',qx(mgs,lc),qx(mgs,li),qx(mgs,lr)
23542 write(iunit,*)
'rmas, qrcalc : ',xmas(mgs,lr),xmas(mgs,lr)*cx(mgs,lr)/rho0(mgs)
23543 write(iunit,*)
'vti,vtc,eiw,vtr: ',vtxbar(mgs,li,1),vtxbar(mgs,lc,1),eiw(mgs),vtxbar(mgs,lr,1)
23544 write(iunit,*)
'cidia,cwdia,qcmxd: ', xdia(mgs,li,1),xdia(mgs,lc,1),qcmxd(mgs)
23545 write(iunit,*)
'snow: ',qx(mgs,ls),cx(mgs,ls),swvent(mgs),vtxbar(mgs,ls,1),xdia(mgs,ls,1)
23546 write(iunit,*)
'graupel: ',qx(mgs,lh),cx(mgs,lh),hwvent(mgs),vtxbar(mgs,lh,1),xdia(mgs,lh,1)
23547 IF ( lhl .gt. 1 )
write(iunit,*)
'hail: ',qx(mgs,lhl),cx(mgs,lhl),hlvent(mgs),vtxbar(mgs,lhl,1),xdia(mgs,lhl,1)
23550 write(iunit,*)
'li: ',xdia(mgs,li,1),xdia(mgs,li,2),xmas(mgs,li),qx(mgs,li), &
23554 write(iunit,*)
'rain cx,xv : ',cx(mgs,lr),xv(mgs,lr)
23555 write(iunit,*)
'temcg = ', temcg(mgs)
23557 write(iunit,*)
'v ', pqwvi(mgs) ,pqwvd(mgs)
23558 write(iunit,*)
'c ', pqcwi(mgs) ,pqcwd(mgs)
23559 write(iunit,*)
'ci', pqcii(mgs) ,pqcid(mgs)
23560 write(iunit,*)
'r ', pqrwi(mgs) ,pqrwd(mgs)
23561 write(iunit,*)
's ', pqswi(mgs) ,pqswd(mgs)
23562 write(iunit,*)
'h ', pqhwi(mgs) ,pqhwd(mgs)
23563 write(iunit,*)
'hl', pqhli(mgs) ,pqhld(mgs)
23564 tmp = pqwvi(mgs) + pqwvd(mgs) &
23565 & + pqcwi(mgs) + pqcwd(mgs) &
23566 & + pqcii(mgs) + pqcid(mgs) &
23567 & + pqrwi(mgs) + pqrwd(mgs) &
23568 & + pqswi(mgs) + pqswd(mgs) &
23569 & + pqhwi(mgs) + pqhwd(mgs) &
23570 & + pqhli(mgs) + pqhld(mgs)
23572 write(iunit,*)
'total = ',tmp
23573 write(iunit,*)
'END OF OUTPUT OF SOURCE AND SINK'
23579 write(iunit,*)
'Vapor'
23581 write(iunit,*) -min(0.0,qrcev(mgs))
23582 write(iunit,*) -il5(mgs)*qhsbv(mgs)
23583 write(iunit,*) -il5(mgs)*qhlsbv(mgs)
23584 write(iunit,*) -il5(mgs)*qssbv(mgs)
23585 write(iunit,*) -il5(mgs)*qisbv(mgs)
23586 write(iunit,*)
'pqwvi= ', pqwvi(mgs)
23587 write(iunit,*) -max(0.0,qrcev(mgs))
23588 write(iunit,*) -max(0.0,qhcev(mgs))
23589 write(iunit,*) -max(0.0,qhlcev(mgs))
23590 write(iunit,*) -max(0.0,qscev(mgs))
23591 write(iunit,*) -il5(mgs)*qiint(mgs)
23592 write(iunit,*) -il5(mgs)*qhdpv(mgs)
23593 write(iunit,*) -il5(mgs)*qhldpv(mgs)
23594 write(iunit,*) -il5(mgs)*qsdpv(mgs)
23595 write(iunit,*) -il5(mgs)*qidpv(mgs)
23596 write(iunit,*)
'pqwvd = ', pqwvd(mgs)
23599 write(iunit,*)
'Cloud ice'
23601 write(iunit,*) il5(mgs)*qicicnt(mgs)
23602 write(iunit,*) il5(mgs)*qidpv(mgs)
23603 write(iunit,*) il5(mgs)*qiacw(mgs)
23604 write(iunit,*) il5(mgs)*qwfrzc(mgs)
23605 write(iunit,*) il5(mgs)*qwctfzc(mgs)
23606 write(iunit,*) il5(mgs)*qicichr(mgs)
23607 write(iunit,*) qhmul1(mgs)
23608 write(iunit,*) qhlmul1(mgs)
23609 write(iunit,*)
'pqcii = ', pqcii(mgs)
23610 write(iunit,*) -il5(mgs)*qscni(mgs)
23611 write(iunit,*) -il5(mgs)*qscnvi(mgs)
23612 write(iunit,*) -il5(mgs)*qraci(mgs)
23613 write(iunit,*) -il5(mgs)*qsaci(mgs)
23614 write(iunit,*) -il5(mgs)*qhaci(mgs)
23615 write(iunit,*) -il5(mgs)*qhlaci(mgs)
23616 write(iunit,*) il5(mgs)*qisbv(mgs)
23617 write(iunit,*) (1.-il5(mgs))*qimlr(mgs)
23618 write(iunit,*) -il5(mgs)*qhcni(mgs)
23619 write(iunit,*)
'pqcid = ', pqcid(mgs)
23620 write(iunit,*)
' Conc:'
23621 write(iunit,*) pccii(mgs),pccid(mgs)
23622 write(iunit,*) il5(mgs),cicint(mgs)
23623 write(iunit,*) cwfrzc(mgs),cwctfzc(mgs)
23624 write(iunit,*) cicichr(mgs)
23625 write(iunit,*) chmul1(mgs)
23626 write(iunit,*) chlmul1(mgs)
23627 write(iunit,*) csmul(mgs)
23633 write(iunit,*)
'Cloud water'
23635 write(iunit,*)
'pqcwi =', pqcwi(mgs)
23636 write(iunit,*) -il5(mgs)*qiacw(mgs)
23637 write(iunit,*) -il5(mgs)*qwfrzc(mgs)
23638 write(iunit,*) -il5(mgs)*qwctfzc(mgs)
23641 write(iunit,*) -il5(mgs)*qiihr(mgs)
23642 write(iunit,*) -il5(mgs)*qicichr(mgs)
23643 write(iunit,*) -il5(mgs)*qipiphr(mgs)
23644 write(iunit,*) -qracw(mgs)
23645 write(iunit,*) -qsacw(mgs)
23646 write(iunit,*) -qrcnw(mgs)
23647 write(iunit,*) -qhacw(mgs)
23648 write(iunit,*) -qhlacw(mgs)
23649 write(iunit,*)
'pqcwd = ', pqcwd(mgs)
23653 write(iunit,*)
'Concentration:'
23654 write(iunit,*) -cautn(mgs)
23655 write(iunit,*) -cracw(mgs)
23656 write(iunit,*) -csacw(mgs)
23657 write(iunit,*) -chacw(mgs)
23658 write(iunit,*) -ciacw(mgs)
23659 write(iunit,*) -cwfrzp(mgs)
23660 write(iunit,*) -cwctfzp(mgs)
23661 write(iunit,*) -cwfrzc(mgs)
23662 write(iunit,*) -cwctfzc(mgs)
23663 write(iunit,*) pccwd(mgs)
23666 write(iunit,*)
'Rain '
23668 write(iunit,*) qracw(mgs)
23669 write(iunit,*) qrcnw(mgs)
23670 write(iunit,*) max(0.0, qrcev(mgs))
23671 write(iunit,*) -(1-il5(mgs))*qhmlr(mgs)
23672 write(iunit,*) -(1-il5(mgs))*qhlmlr(mgs)
23673 write(iunit,*) -(1-il5(mgs))*qsmlr(mgs)
23674 write(iunit,*) -(1-il5(mgs))*qimlr(mgs)
23675 write(iunit,*) -qrshr(mgs)
23676 write(iunit,*)
'pqrwi = ', pqrwi(mgs)
23677 write(iunit,*) -qsshr(mgs)
23678 write(iunit,*) -qhshr(mgs)
23679 write(iunit,*) -qhlshr(mgs)
23680 write(iunit,*) -il5(mgs)*qiacr(mgs),qiacr(mgs), qiacrf(mgs)
23681 write(iunit,*) -il5(mgs)*qrfrz(mgs)
23682 write(iunit,*) -qsacr(mgs)
23683 write(iunit,*) -qhacr(mgs)
23684 write(iunit,*) -qhlacr(mgs)
23685 write(iunit,*) qrcev(mgs)
23686 write(iunit,*)
'pqrwd = ', pqrwd(mgs)
23687 write(iunit,*)
'qrzfac = ', qrzfac(mgs)
23691 write(iunit,*)
'Rain concentration'
23692 write(iunit,*) pcrwi(mgs)
23693 write(iunit,*) crcnw(mgs)
23694 write(iunit,*) 1-il5(mgs)
23695 write(iunit,*) -chmlr(mgs),-csmlr(mgs)
23696 write(iunit,*) -crshr(mgs)
23697 write(iunit,*) pcrwd(mgs)
23698 write(iunit,*) il5(mgs)
23699 write(iunit,*) -ciacr(mgs),-crfrz(mgs)
23700 write(iunit,*) -csacr(mgs),-chacr(mgs)
23701 write(iunit,*) +crcev(mgs)
23702 write(iunit,*) cracr(mgs)
23707 write(iunit,*)
'Snow'
23709 write(iunit,*) il5(mgs)*qscni(mgs), qscnvi(mgs)
23710 write(iunit,*) il5(mgs)*qsaci(mgs)
23711 write(iunit,*) il5(mgs)*qrfrzs(mgs), qiacrs(mgs)
23712 write(iunit,*) il5(mgs)*qiacrs(mgs),il3(mgs)*(qiacrf(mgs)+qracif(mgs)),il3(mgs),qiacrf(mgs),qracif(mgs)
23713 write(iunit,*) il5(mgs)*qsdpv(mgs), qscev(mgs)
23714 write(iunit,*) qsacw(mgs),qwfrzc(mgs), qwctfzc(mgs), qicichr(mgs)
23715 write(iunit,*) qsacr(mgs), qscnh(mgs)
23716 write(iunit,*) il2(mgs)*qsacr(mgs)
23717 write(iunit,*) il5(mgs)*qicicnt(mgs)*ffrzs
23718 write(iunit,*) il3(mgs)*(qiacrf(mgs)+qracif(mgs))
23719 write(iunit,*) max(0.0, qscev(mgs))
23720 write(iunit,*) qsacw(mgs) + qscnh(mgs)
23721 write(iunit,*)
'pqswi = ',pqswi(mgs)
23722 write(iunit,*) -qhcns(mgs)
23723 write(iunit,*) -qracs(mgs)
23724 write(iunit,*) -qhacs(mgs)
23725 write(iunit,*) -qhlacs(mgs)
23726 write(iunit,*) (1-il5(mgs))*qsmlr(mgs)
23727 write(iunit,*) qsshr(mgs)
23729 write(iunit,*) il5(mgs)*(qssbv(mgs))
23730 write(iunit,*)
'pqswd = ', pqswd(mgs)
23731 write(iunit,*) -qracs(mgs)*(1-il2(mgs)) , qhacs(mgs) , qhlacs(mgs)
23732 write(iunit,*) -qhcns(mgs)
23733 write(iunit,*) +(1-il5(mgs))*qsmlr(mgs) , qsshr(mgs)
23734 write(iunit,*) qssbv(mgs)
23735 write(iunit,*) min(0.0, qscev(mgs))
23736 write(iunit,*) -qsmul(mgs)
23740 write(iunit,*)
'Graupel'
23742 write(iunit,*) il5(mgs)*qrfrzf(mgs), qrfrzf(mgs) - qrfrz(mgs)
23743 write(iunit,*) il5(mgs)*qiacrf(mgs)
23744 write(iunit,*) il5(mgs)*qracif(mgs)
23745 write(iunit,*) qhcns(mgs)
23746 write(iunit,*) qhcni(mgs)
23747 write(iunit,*) il5(mgs)*(qhdpv(mgs))
23748 write(iunit,*) qhacr(mgs)
23749 write(iunit,*) qhacw(mgs)
23750 write(iunit,*) qhacs(mgs)
23751 write(iunit,*) qhaci(mgs)
23752 write(iunit,*)
'pqhwi = ',pqhwi(mgs)
23754 write(iunit,*) qhshr(mgs)
23755 write(iunit,*) (1-il5(mgs))*qhmlr(mgs)
23756 write(iunit,*) il5(mgs),qhsbv(mgs)
23757 write(iunit,*) -qhlcnh(mgs)
23758 write(iunit,*) -qhmul1(mgs)
23759 write(iunit,*)
'pqhwd = ', pqhwd(mgs)
23760 write(iunit,*)
'Concentration'
23761 write(iunit,*) pchwi(mgs),pchwd(mgs)
23762 write(iunit,*) crfrzf(mgs)
23763 write(iunit,*) chcns(mgs)
23764 write(iunit,*) ciacrf(mgs)
23768 write(iunit,*)
'Hail'
23770 write(iunit,*) qhlcnh(mgs)
23771 write(iunit,*) il5(mgs)*(qhldpv(mgs))
23772 write(iunit,*) qhlacr(mgs)
23773 write(iunit,*) qhlacw(mgs)
23774 write(iunit,*) qhlacs(mgs)
23775 write(iunit,*) qhlaci(mgs)
23776 write(iunit,*) pqhli(mgs)
23778 write(iunit,*) qhlshr(mgs)
23779 write(iunit,*) (1-il5(mgs))*qhlmlr(mgs)
23780 write(iunit,*) il5(mgs)*qhlsbv(mgs)
23781 write(iunit,*) pqhld(mgs)
23782 write(iunit,*)
'Concentration'
23783 write(iunit,*) pchli(mgs),pchld(mgs)
23784 write(iunit,*) chlcnh(mgs)
23789 write(iunit,*)
'END OF OUTPUT OF SOURCE AND SINK'
23790 write(iunit,*)
'PTOTAL',ptotal(mgs)
23803 IF ( warmonly < 0.5 )
THEN
23807 & qsmlr(mgs)+qhlmlr(mgs)) &
23808 & +il5(mgs)*(1-imixedphase)*( &
23809 & qsacw(mgs)+qhacw(mgs) + qhlacw(mgs) &
23810 & +qsacr(mgs)+qhacr(mgs) + qhlacr(mgs) &
23814 & +qrfrz(mgs)+qiacr(mgs) &
23816 & +il5(mgs)*(qwfrz(mgs) &
23817 & +qwctfz(mgs)+qiihr(mgs) &
23821 & (qhmlr(mgs)+qsmlr(mgs)+ &
23826 & + qsdpv(mgs) + qhdpv(mgs) &
23828 & + qidpv(mgs) + qisbv(mgs) ) &
23829 & + qssbv(mgs) + qhsbv(mgs) &
23831 & +il5(mgs)*(qiint(mgs))
23833 & qrcev(mgs) + qhcev(mgs) + qscev(mgs) + qhlcev(mgs) + qfcev(mgs)
23835 & min(0.0,qrcev(mgs)) + min(0.0,qhcev(mgs)) + min(0.0,qscev(mgs)) + min(0.0,qhlcev(mgs)) &
23836 + min(0.0,qfcev(mgs))
23840 & + qsdpv(mgs) + qhdpv(mgs) &
23843 & +il5(mgs)*(qiint(mgs))
23844 ELSEIF ( warmonly < 0.8 )
THEN
23847 & (qhmlr(mgs)+qhlmlr(mgs)) &
23848 & +il5(mgs)*(qhfzh(mgs)+qhlfzhl(mgs)) &
23852 & +qrfrz(mgs)+qwfrz(mgs) &
23853 & +qwctfz(mgs)+qiihr(mgs) &
23855 & +qhacw(mgs) + qhlacw(mgs) &
23856 & +qhacr(mgs) + qhlacr(mgs) )
23857 psub(mgs) = 0.0 + &
23861 & + qidpv(mgs) + qisbv(mgs) ) &
23862 & +il5(mgs)*(qiint(mgs))
23864 & qrcev(mgs) + qhcev(mgs) + qhlcev(mgs) + qfcev(mgs)
23868 pvap(mgs) = qrcev(mgs)
23872 & (felfcp(mgs)*pfrz(mgs) &
23873 & +felscp(mgs)*psub(mgs) &
23874 & +felvcp(mgs)*pvap(mgs))
23875 thetap(mgs) = thetap(mgs) + dtp*ptem(mgs)
23876 ptem2(mgs) = ptem(mgs)
23877 IF ( eqtset > 2 )
THEN
23878 pipert(mgs) = pipert(mgs) + (felfpi(mgs)*pfrz(mgs) &
23879 & +felspi(mgs)*psub(mgs) &
23880 & +felvpi(mgs)*pvap(mgs))*dtp
23894 qwvp(mgs) = qwvp(mgs) + &
23895 & dtp*(pqwvi(mgs)+pqwvd(mgs))
23897 qx(mgs,lc) = qx(mgs,lc) + &
23898 & dtp*(pqcwi(mgs)+pqcwd(mgs))
23899 qx(mgs,lr) = qx(mgs,lr) + &
23900 & dtp*(pqrwi(mgs)+pqrwd(mgs))
23901 qx(mgs,li) = qx(mgs,li) + &
23902 & dtp*(pqcii(mgs)+pqcid(mgs))
23903 qx(mgs,ls) = qx(mgs,ls) + &
23904 & dtp*(pqswi(mgs)+pqswd(mgs))
23905 qx(mgs,lh) = qx(mgs,lh) + &
23906 & dtp*(pqhwi(mgs)+pqhwd(mgs))
23908 IF ( lhl .gt. 1 )
THEN
23909 qx(mgs,lhl) = qx(mgs,lhl) + &
23910 & dtp*(pqhli(mgs)+pqhld(mgs))
23922 IF ( lvol(ls) .gt. 1 )
THEN
23923 vx(mgs,ls) = vx(mgs,ls) + &
23924 & dtp*(pvswi(mgs)+pvswd(mgs))
23927 IF ( lvol(lh) .gt. 1 )
THEN
23928 vx(mgs,lh) = vx(mgs,lh) + &
23929 & dtp*(pvhwi(mgs)+pvhwd(mgs))
23933 IF ( lhl .gt. 1 )
THEN
23934 IF ( lvol(lhl) .gt. 1 )
THEN
23935 vx(mgs,lhl) = vx(mgs,lhl) + &
23936 & dtp*(pvhli(mgs)+pvhld(mgs))
23950 if ( ipconc .ge. 1 )
then
23952 cx(mgs,li) = cx(mgs,li) + &
23953 & dtp*(pccii(mgs)+pccid(mgs))
23954 cina(mgs) = cina(mgs) + pccin(mgs)*dtp
23955 IF ( ipconc .ge. 2 )
THEN
23956 cx(mgs,lc) = cx(mgs,lc) + &
23957 & dtp*(pccwi(mgs)+pccwd(mgs))
23959 IF ( ipconc .ge. 3 )
THEN
23960 cx(mgs,lr) = cx(mgs,lr) + &
23961 & dtp*(pcrwi(mgs)+pcrwd(mgs))
23963 IF ( ipconc .ge. 4 )
THEN
23964 cx(mgs,ls) = cx(mgs,ls) + &
23965 & dtp*(pcswi(mgs)+pcswd(mgs))
23967 IF ( ipconc .ge. 5 )
THEN
23968 cx(mgs,lh) = cx(mgs,lh) + &
23969 & dtp*(pchwi(mgs)+pchwd(mgs))
23970 IF ( lhl .gt. 1 )
THEN
23971 cx(mgs,lhl) = cx(mgs,lhl) + &
23972 & dtp*(pchli(mgs)+pchld(mgs))
23979 IF ( ipconc .ge. 6 )
THEN
23980 IF ( lzr .gt. 1 )
THEN
23981 zx(mgs,lr) = zx(mgs,lr) + &
23982 & dtp*(pzrwi(mgs)+pzrwd(mgs))
23984 IF ( lzs .gt. 1 )
THEN
23985 zx(mgs,ls) = zx(mgs,ls) + &
23986 & dtp*(pzswi(mgs)+pzswd(mgs))
23988 IF ( lzh .gt. 1 )
THEN
23989 zx(mgs,lh) = zx(mgs,lh) + &
23990 & dtp*(pzhwi(mgs)+pzhwd(mgs))
23992 IF ( lzhl .gt. 1 )
THEN
23993 zx(mgs,lhl) = zx(mgs,lhl) + &
23994 & dtp*(pzhli(mgs)+pzhld(mgs))
24003 IF ( has_wetscav )
THEN
24005 evapprod2d(igs(mgs),kgs(mgs)) = -(qrcev(mgs) + qssbv(mgs) + qhsbv(mgs) + qhlsbv(mgs))
24006 rainprod2d(igs(mgs),kgs(mgs)) = qrcnw(mgs) + qracw(mgs) + qsacw(mgs) + qhacw(mgs) + qhlacw(mgs) + &
24007 qraci(mgs) + qsaci(mgs) + qhaci(mgs) + qhlaci(mgs) + qscni(mgs)
24015 if (ndebug .gt. 0 )
write(0,*)
'conc 30a'
24027 pqs(mgs) = (380.0)/(pres(mgs))
24028 theta(mgs) = thetap(mgs) + theta0(mgs)
24029 qvap(mgs) = max( (qwvp(mgs) + qv0(mgs)), 0.0 )
24030 temg(mgs) = theta(mgs)*pk(mgs)
24036 qcwtmp(mgs) = qx(mgs,lc)
24041 qitmp(mgs) = qx(mgs,li)
24042 if( temg(mgs) .gt. tfr .and. &
24043 & qitmp(mgs) .gt. 0.0 )
then
24044 qx(mgs,lc) = qx(mgs,lc) + qitmp(mgs)
24046 ptem(mgs) = ptem(mgs) + &
24048 & felfcp(mgs)*(- qitmp(mgs)*dtpinv)
24049 IF ( eqtset > 2 )
THEN
24050 pipert(mgs) = pipert(mgs) - (felfpi(mgs)*qitmp(mgs))
24052 pmlt(mgs) = pmlt(mgs) - qitmp(mgs)*dtpinv
24053 scx(mgs,lc) = scx(mgs,lc) + scx(mgs,li)
24054 thetap(mgs) = thetap(mgs) - &
24055 & fcc3(mgs)*qitmp(mgs)
24056 ptimlw(mgs) = -fcc3(mgs)*qitmp(mgs)*dtpinv
24057 cx(mgs,lc) = cx(mgs,lc) + cx(mgs,li)
24076 IF ( warmonly < 0.8 )
THEN
24079 qcwtmp(mgs) = qx(mgs,lc)
24098 if( ( ( temg(mgs) .lt. thnuc + 0.) .or. (temg(mgs) .lt. thnuc + 2. .and. ibfc >= 3) ) .and. &
24099 & qx(mgs,lc) .gt. 0.0 .and. (ipconc < 2 .or. ibfc == 0 .or. ibfc == 2))
then
24101 IF ( ibfc >= 3 )
THEN
24102 frac = max( 0.25, min( 1., ((thnuc + 2.) - temg(mgs) )/4.0 ) )
24103 ELSEIF ( ibfc /= 2 .or. ipconc < 2 )
THEN
24104 frac = max( 0.25, min( 1., ((thnuc + 1.) - temg(mgs) )/4.0 ) )
24106 volt = exp( 16.2 + 1.0*temcg(mgs) )* 1.0e-6
24110 cwfrz(mgs) = cx(mgs,lc)*exp(-volt/xv(mgs,lc))
24112 qtmp = cwfrz(mgs)*xdn0(lc)*rhoinv(mgs)*(volt + xv(mgs,lc))
24113 frac = qtmp/qx(mgs,lc)
24118 qtmp = frac*qx(mgs,lc)
24120 IF ( ibfc == 4 .and. lis >= 1 )
THEN
24121 qx(mgs,lis) = qx(mgs,lis) + qtmp
24123 qx(mgs,li) = qx(mgs,li) + qtmp
24125 pfrz(mgs) = pfrz(mgs) + qtmp*dtpinv
24126 ptem(mgs) = ptem(mgs) + &
24128 & felfcp(mgs)*(qtmp*dtpinv)
24130 IF ( eqtset > 2 )
THEN
24131 pipert(mgs) = pipert(mgs) + felfpi(mgs)*qtmp
24135 IF ( lvol(li) .gt. 1 ) vx(mgs,li) = vx(mgs,li) + rho0(mgs)*qtmp/xdn0(li)
24137 IF ( ipconc .ge. 2 )
THEN
24138 ctmp = frac*cx(mgs,lc)
24140 IF ( ibfc == 4 .and. lis >= 1 )
THEN
24141 cx(mgs,lis) = cx(mgs,lis) + ctmp
24143 cx(mgs,li) = cx(mgs,li) + ctmp
24147 IF ( t9(igs(mgs),jgs,kgs(mgs)-1) .gt. qx(mgs,lc) )
THEN
24148 qtmp = frac*t9(igs(mgs),jgs,kgs(mgs)-1)
24151 ctmp = cx(mgs,lc)*qx(mgs,lc)*rho0(mgs)/qtmp
24153 cx(mgs,lc) = max(0.0,wvel(mgs))*dtp*cwccn &
24154 & /gz(igs(mgs),jgs,kgs(mgs))
24158 IF ( ipconc .ge. 1 ) cx(mgs,li) = min(ccimx, cx(mgs,li) + cx(mgs,lc))
24161 sctmp = frac*scx(mgs,lc)
24163 scx(mgs,li) = scx(mgs,li) + sctmp
24169 thetap(mgs) = thetap(mgs) + fcc3(mgs)*qtmp
24170 ptwfzi(mgs) = fcc3(mgs)*qtmp*dtpinv
24171 qx(mgs,lc) = qx(mgs,lc) - qtmp
24172 cx(mgs,lc) = cx(mgs,lc) - ctmp
24173 scx(mgs,lc) = scx(mgs,lc) - sctmp
24187 IF ( ipconc .le. 1 .and. lwsm6 )
THEN
24190 qcwtmp(mgs) = qx(mgs,lc)
24191 theta(mgs) = thetap(mgs) + theta0(mgs)
24192 temgtmp = temg(mgs)
24196 temg(mgs) = theta(mgs)*pk(mgs)
24197 temcg(mgs) = temg(mgs) - tfr
24198 ltemq = (temg(mgs)-163.15)/fqsat+1.5
24199 ltemq = min( nqsat, max(1,ltemq) )
24201 IF ( iqvsopt == 0 )
THEN
24202 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
24203 ELSEIF ( iqvsopt == 1 )
THEN
24204 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
24207 IF ( ( qvap(mgs) > qvs(mgs) .or. qx(mgs,lc) > qxmin(lc) ) .and. temg(mgs) > tfrh )
THEN
24208 tmp = (qvap(mgs) - qvs(mgs))/(1. + qvs(mgs)*felv(mgs)**2/(cp*rw*temg(mgs)**2) )
24209 qcond(mgs) = min( max( 0.0, tmp ), (qvap(mgs)-qvs(mgs)) )
24210 IF ( qx(mgs,lc) > qxmin(lc) .and. tmp < 0.0 )
THEN
24211 qcond(mgs) = max( tmp, -qx(mgs,lc) )
24213 qwvp(mgs) = qwvp(mgs) - qcond(mgs)
24214 qvap(mgs) = qvap(mgs) - qcond(mgs)
24215 qx(mgs,lc) = max( 0.0, qx(mgs,lc) + qcond(mgs) )
24216 thetap(mgs) = thetap(mgs) + felvcp(mgs)*qcond(mgs)/(pi0(mgs))
24225 IF ( ipconc .le. 1 .and. .not. lwsm6 )
THEN
24229 qx(mgs,lv) = max( 0.0, qvap(mgs) )
24230 qx(mgs,lc) = max( 0.0, qx(mgs,lc) )
24231 qx(mgs,li) = max( 0.0, qx(mgs,li) )
24232 qitmp(mgs) = qx(mgs,li)
24237 qcwtmp(mgs) = qx(mgs,lc)
24238 qitmp(mgs) = qx(mgs,li)
24239 theta(mgs) = thetap(mgs) + theta0(mgs)
24240 temgtmp = temg(mgs)
24241 temg(mgs) = theta(mgs)*(pinit(kgs(mgs)) + p2(igs(mgs),jgs,kgs(mgs)) )
24243 thsave(mgs) = thetap(mgs)
24244 temcg(mgs) = temg(mgs) - tfr
24245 tqvcon = temg(mgs)-cbw
24246 ltemq = (temg(mgs)-163.15)/fqsat+1.5
24247 ltemq = min( nqsat, max(1,ltemq) )
24249 IF ( iqvsopt == 0 )
THEN
24250 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
24251 ELSEIF ( iqvsopt == 1 )
THEN
24252 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
24254 qis(mgs) = pqs(mgs)*tabqis(ltemq)
24255 qss(mgs) = qvs(mgs)
24256 if ( temg(mgs) .lt. tfr )
then
24257 if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) ) &
24258 & qss(mgs) = qvs(mgs)
24259 if( qx(mgs,lc) .le. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
24260 & qss(mgs) = qis(mgs)
24261 if( qx(mgs,lc) .gt. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
24262 & qss(mgs) = (qx(mgs,lc)*qvs(mgs) + qitmp(mgs)*qis(mgs)) / &
24263 & (qx(mgs,lc) + qitmp(mgs))
24275 qitmp(mgs) = qx(mgs,li)
24280 dqwv(mgs) = ( qx(mgs,lv) - qss(mgs) )
24284 if( dqwv(mgs) .lt. 0. )
then
24285 if( qx(mgs,lc) .gt. -dqwv(mgs) )
then
24286 dqcw(mgs) = dqwv(mgs)
24289 dqcw(mgs) = -qx(mgs,lc)
24290 dqwv(mgs) = dqwv(mgs) + qx(mgs,lc)
24293 if( qitmp(mgs) .gt. -dqwv(mgs) )
then
24294 dqci(mgs) = dqwv(mgs)
24297 dqci(mgs) = -qitmp(mgs)
24298 dqwv(mgs) = dqwv(mgs) + qitmp(mgs)
24301 qwvp(mgs) = qwvp(mgs) - ( dqcw(mgs) + dqci(mgs) )
24306 qitmp(mgs) = qx(mgs,li)
24307 IF ( qitmp(mgs) .ge. qxmin(li) )
THEN
24308 fcci(mgs) = qx(mgs,li)/(qitmp(mgs))
24312 qx(mgs,lc) = qx(mgs,lc) + dqcw(mgs)
24313 qx(mgs,li) = qx(mgs,li) + dqci(mgs) * fcci(mgs)
24314 thetap(mgs) = thetap(mgs) + &
24316 & (felvcp(mgs)*dqcw(mgs) +felscp(mgs)*dqci(mgs))
24318 IF ( eqtset > 2 )
THEN
24319 pipert(mgs) = pipert(mgs) &
24320 & +(felspi(mgs)*dqci(mgs) &
24321 & +felvpi(mgs)*dqcw(mgs))
24328 IF ( dqwv(mgs) .ge. 0. )
THEN
24332 qitmp(mgs) = qx(mgs,li)
24335 if ( temg(mgs) .lt. tfr .and. temg(mgs) .gt. thnuc )
then
24336 fracl(mgs) = max(min(1.,(temg(mgs)-233.15)/(20.)),0.0)
24337 fraci(mgs) = 1.0-fracl(mgs)
24339 if ( temg(mgs) .le. thnuc )
then
24343 fraci(mgs) = 1.0-fracl(mgs)
24345 gamss = (felvcp(mgs)*fracl(mgs) + felscp(mgs)*fraci(mgs)) &
24348 IF ( temg(mgs) .lt. tfr )
then
24349 IF (qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) )
then
24350 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qss(mgs)/ &
24351 & ((temg(mgs)-cbw)**2))
24353 IF ( qx(mgs,lc) .eq. 0.0 .and. qitmp(mgs) .gt. qxmin(li) )
then
24354 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv2(mgs)*qss(mgs)/ &
24355 & ((temg(mgs)-cbi)**2))
24357 IF ( qx(mgs,lc) .gt. 0.0 .and. qitmp(mgs) .gt. qxmin(li) )
then
24358 cdw = caw*pi0(mgs)*tfrcbw/((temg(mgs)-cbw)**2)
24359 cdi = cai*pi0(mgs)*tfrcbi/((temg(mgs)-cbi)**2)
24360 denom1 = qx(mgs,lc) + qitmp(mgs)
24361 denom2 = 1.0 + gamss* &
24362 & (qx(mgs,lc)*qvs(mgs)*cdw + qitmp(mgs)*qis(mgs)*cdi) / denom1
24363 dqvcnd(mgs) = dqwv(mgs) / denom2
24368 if ( temg(mgs) .ge. tfr )
then
24369 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qss(mgs)/ &
24370 & ((temg(mgs)-cbw)**2))
24375 IF ( qitmp(mgs) .gt. qxmin(li) )
THEN
24376 fcci(mgs) = qx(mgs,li)/(qitmp(mgs))
24381 dqcw(mgs) = dqvcnd(mgs)*fracl(mgs)
24382 dqci(mgs) = dqvcnd(mgs)*fraci(mgs)
24384 thetap(mgs) = thetap(mgs) + &
24385 & (felvcp(mgs)*dqcw(mgs) + felscp(mgs)*dqci(mgs)) &
24388 IF ( eqtset > 2 )
THEN
24389 pipert(mgs) = pipert(mgs) + (0 &
24390 & +felspi(mgs)*dqci(mgs) &
24391 & +felvpi(mgs)*dqcw(mgs))
24394 qwvp(mgs) = qwvp(mgs) - ( dqvcnd(mgs) )
24395 qx(mgs,lc) = qx(mgs,lc) + dqcw(mgs)
24397 qx(mgs,li) = qx(mgs,li) + dqci(mgs)*fcci(mgs)
24398 qitmp(mgs) = qx(mgs,li)
24407 qitmp(mgs) = qx(mgs,li)
24408 theta(mgs) = thetap(mgs) + theta0(mgs)
24409 temg(mgs) = theta(mgs)*pk(mgs)
24410 qvap(mgs) = max((qwvp(mgs) + qv0(mgs)), 0.0)
24411 temcg(mgs) = temg(mgs) - tfr
24412 tqvcon = temg(mgs)-cbw
24413 ltemq = (temg(mgs)-163.15)/fqsat+1.5
24414 ltemq = min( nqsat, max(1,ltemq) )
24416 IF ( iqvsopt == 0 )
THEN
24417 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
24418 ELSEIF ( iqvsopt == 1 )
THEN
24419 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
24421 qis(mgs) = pqs(mgs)*tabqis(ltemq)
24422 qx(mgs,lc) = max( 0.0, qx(mgs,lc) )
24423 qitmp(mgs) = max( 0.0, qitmp(mgs) )
24424 qx(mgs,lv) = max( 0.0, qvap(mgs))
24438 qss(mgs) = qvs(mgs)
24439 if ( temg(mgs) .lt. tfr )
then
24440 if( qx(mgs,lc) .ge. 0.0 .and. qitmp(mgs) .le. qxmin(li) ) &
24441 & qss(mgs) = qvs(mgs)
24442 if( qx(mgs,lc) .le. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
24443 & qss(mgs) = qis(mgs)
24444 if( qx(mgs,lc) .gt. qxmin(lc) .and. qitmp(mgs) .gt. qxmin(li)) &
24445 & qss(mgs) = (qx(mgs,lc)*qvs(mgs) + qitmp(mgs)*qis(mgs)) / &
24446 & (qx(mgs,lc) + qitmp(mgs))
24465 if (ndebug .gt. 0 )
write(0,*)
'conc 30b'
24474 t0(igs(mgs),jy,kgs(mgs)) = temg(mgs)
24498 if (ndebug .gt. 0 )
write(0,*)
'gs 11'
24502 an(igs(mgs),jy,kgs(mgs),lt) = &
24503 & theta0(mgs) + thetap(mgs)
24504 an(igs(mgs),jy,kgs(mgs),lv) = qwvp(mgs) + qv0(mgs)
24506 IF ( eqtset > 2 )
THEN
24507 p2(igs(mgs),jy,kgs(mgs)) = pipert(mgs)
24512 IF ( ido(il) .eq. 1 )
THEN
24513 IF ( lf > 1 .and. il == lf )
THEN
24514 lfsave(mgs,1) = an(igs(mgs),jy,kgs(mgs),il)
24515 lfsave(mgs,2) = qx(mgs,il)
24517 an(igs(mgs),jy,kgs(mgs),il) = qx(mgs,il) + &
24518 & min( an(igs(mgs),jy,kgs(mgs),il), 0.0 )
24519 qx(mgs,il) = an(igs(mgs),jy,kgs(mgs),il)
24523 IF ( lcina > 1 )
THEN
24524 an(igs(mgs),jy,kgs(mgs),lcina) = cina(mgs)
24535 IF ( ipconc .ge. 6 )
THEN
24537 IF ( lz(il) .gt. 1 )
THEN
24538 IF ( lf > 1 .and. il == lf )
THEN
24539 lfsave(mgs,3) = an(igs(mgs),jy,kgs(mgs),lz(il))
24540 lfsave(mgs,4) = zx(mgs,il)
24543 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il) + &
24544 & min( an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0 )
24545 zx(mgs,il) = an(igs(mgs),jy,kgs(mgs),lz(il))
24555 if ( ipconc .ge. 1 )
then
24560 IF ( ipconc .ge. ipc(il) .and. ido(il) > 0 )
THEN
24562 IF ( ipconc .ge. 4 .and. ipc(il) .ge. 1 )
THEN
24567 IF ( lz(il) <= 1 .or. ioldlimiter == 1 )
THEN
24571 IF ( qx(mgs,il) .le. 0.0 )
THEN
24574 IF ( cx(mgs,il) .gt. cxmin .and. qx(mgs,il) > qxmin(il) )
THEN
24577 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*cx(mgs,il))
24584 IF ( imaxdiaopt == 1 .or. il == lc .or. il == li .or. (il == lr .and. imurain == 3) .or. &
24585 & (il == ls .and. imusnow == 3 ) .or. ( il >= lh .and. lh > 0 ) )
THEN
24587 xvbarmax = xvmx(il)
24588 ELSEIF ( imaxdiaopt == 2 )
THEN
24589 xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
24590 ELSEIF ( imaxdiaopt == 3 )
THEN
24591 xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
24593 xvbarmax = xvmx(il)
24597 IF ( il == ls )
THEN
24598 xvbarmax = xvbarmax*max(1.,100./min(100.,xdn(mgs,ls)))
24601 IF ( xv(mgs,il) .lt. xvmn(il) .or. xv(mgs,il) .gt. xvbarmax )
THEN
24602 xv(mgs,il) = min( xvbarmax, xv(mgs,il) )
24603 xv(mgs,il) = max( xvmn(il), xv(mgs,il) )
24604 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xv(mgs,il)*xdn(mgs,il))
24617 IF ( il == lr .and. imurain == 3 )
THEN
24625 IF ( iresetmoments == 1 .or. iresetmoments == il )
THEN
24626 IF ( zx(mgs,lr) <= zxmin )
THEN
24627 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
24630 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
24631 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
24632 an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
24633 ELSEIF ( cx(mgs,lr) <= cxmin )
THEN
24634 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
24637 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
24638 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
24639 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
24643 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
24645 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
24646 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
24649 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
24650 xv(mgs,lr) = xvmn(lr)
24651 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
24654 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
24656 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
24659 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*xdn(mgs,lr)**2)
24661 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
24663 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
24666 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
24667 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
24669 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
24673 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
24674 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24676 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
24679 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
24680 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
24683 IF ( zx(mgs,lr) > 0.0 )
THEN
24684 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
24694 IF ( z .gt. 0.0 )
THEN
24695 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
24697 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
24698 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
24699 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
24700 alp = max( rnumin, min( rnumax, alp ) )
24704 IF ( xv(mgs,il) .gt. xvmx(il) .or. (ioldlimiter == 2 .and. xv(mgs,il) .gt. xvmx(il)/8.) )
THEN
24708 IF ( ioldlimiter == 2 )
THEN
24709 x = (6.*rho0(mgs)*qx(mgs,il)/(pi*xdn(mgs,il)*cx(mgs,il)))**(1./3.)
24710 x1 = max(0.0e-3, x - 3.0e-3)
24711 x2 = max(0.5, x/6.0e-3)
24713 cx(mgs,il) = cx(mgs,il)*max((1.+2.222e3*x1**2), x3)
24714 xv(mgs,il) = xv(mgs,il)/max((1.+2.222e3*x1**2), x3)
24716 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
24717 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
24718 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
24724 IF ( tmp < cx(mgs,il) )
THEN
24726 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
24727 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
24728 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24737 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
24739 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
24740 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
24741 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
24742 alp = max( rnumin, min( rnumax, alp ) )
24753 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
24754 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
24756 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
24757 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
24758 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
24760 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
24761 z = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
24763 an(igs(mgs),jy,kgs(mgs),lz(il)) = zx(mgs,il)
24778 ELSEIF ( il == lh .or. il == lhl .or. il == lf .or. (il == lr .and. imurain == 1 ))
THEN
24784 IF ( lf > 1 .and. il == lf )
THEN
24785 lfsave(mgs,5) = an(igs(mgs),jy,kgs(mgs),ln(il))
24786 lfsave(mgs,6) = cx(mgs,il)
24789 IF ( il == lhl .and. lnhlf > 1 )
THEN
24790 IF ( cx(mgs,lhl) > cxmin )
THEN
24791 frac = chxf(mgs,lhl)/cx(mgs,lhl)
24797 IF ( il == lh .and. lnhf > 1 )
THEN
24798 IF ( cx(mgs,lh) > cxmin )
THEN
24799 frach = chxf(mgs,lh)/cx(mgs,lh)
24807 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
24808 IF ( zx(mgs,il) <= zxmin )
THEN
24812 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
24813 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
24814 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
24815 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
24818 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
24821 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
24822 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
24823 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24825 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
24826 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
24829 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
24830 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
24831 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24834 IF ( zx(mgs,il) < 0.0 )
THEN
24840 IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
24843 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
24845 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
24846 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
24847 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24850 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
24852 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*max(1.0e-9,cx(mgs,il)))
24853 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
24855 IF ( xv(mgs,il) .lt. xvmn(il) )
THEN
24856 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
24857 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
24858 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
24861 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
24863 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
24864 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
24868 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
24871 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
24879 g1 = (6.0 + alphamax)*(5.0 + alphamax)*(4.0 + alphamax)/ &
24880 & ((3.0 + alphamax)*(2.0 + alphamax)*(1.0 + alphamax))
24881 zx(mgs,il) = max(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
24882 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24884 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
24891 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
24892 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24894 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
24895 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
24899 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6.*qr)**2/(z*(pi*xdn(mgs,il))**2)
24900 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
24910 IF ( zx(mgs,il) .gt. zxmin .and. qr > qxmin(il) .and. chw > cxmin )
THEN
24913 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
24917 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24918 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24922 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
24923 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
24926 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24927 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24929 alp = max( alphamin, min( alphamax, alp ) )
24934 IF ( xv(mgs,il) .gt. xvmx(il) )
THEN
24938 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
24939 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
24940 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
24941 IF ( tmp < cx(mgs,il) )
THEN
24942 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
24943 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
24944 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
24945 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
24951 rdi = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
24952 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24953 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24955 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
24956 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
24957 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
24958 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rdi) - 1.0
24959 alp = max( alphamin, min( alphamax, alp ) )
24970 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
24971 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
24973 IF ( ( lrescalelow(il) .or. rescale_high_alpha ) .and. &
24974 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
24976 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
24977 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
24978 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
24980 ELSEIF ( lrescalelow(il) .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) .and. &
24981 .not. ( il == lr .and. .not. rescale_low_alphar ) )
THEN
24984 IF ( irescalerainopt == 0 )
THEN
24986 ELSEIF ( irescalerainopt == 1 )
THEN
24987 wtest = qx(mgs,lc) > qxmin(lc)
24988 ELSEIF ( irescalerainopt == 2 )
THEN
24989 wtest = qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
24990 ELSEIF ( irescalerainopt == 3 )
THEN
24991 wtest = temcg(mgs) > rescale_tempthresh .and. qx(mgs,lc) > qxmin(lc) .and. wvel(mgs) < rescale_wthresh
24994 IF ( il == lr .and. ( wtest .or. .not. rescale_low_alphar ) )
THEN
24997 chw = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
24999 an(igs(mgs),jy,kgs(mgs),ln(il)) = chw
25002 z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
25003 z = z1*(6./(pi*xdn(mgs,il)))**2
25005 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
25026 IF ( lzr > 1 )
THEN
25027 alpha2d(igs(mgs),kgs(mgs),1) = max(alphamin, min(alphamax, alpha(mgs,lr) ))
25029 IF ( lzh > 1 )
THEN
25030 alpha2d(igs(mgs),kgs(mgs),2) = max(alphamin, min(alphamax, alpha(mgs,lh) ))
25032 IF ( lzhl > 1 )
THEN
25033 alpha2d(igs(mgs),kgs(mgs),3) = max(alphamin, min(alphamax, alpha(mgs,lhl) ))
25036 IF ( il == lhl .and. lnhlf > 1 )
THEN
25038 chxf(mgs,lhl) = frac*cx(mgs,lhl)
25040 IF ( il == lh .and. lnhf > 1 )
THEN
25042 chxf(mgs,lh) = frach*cx(mgs,lh)
25070 IF ( il == lh )
THEN
25071 IF ( lnhf > 1 )
THEN
25072 an(igs(mgs),jy,kgs(mgs),lnhf) = max( chxf(mgs,lh), 0.0)
25076 IF ( il == lhl )
THEN
25078 IF ( lnhlf > 1 )
THEN
25080 an(igs(mgs),jy,kgs(mgs),lnhlf) = max( chxf(mgs,lhl), 0.0)
25083 an(igs(mgs),jy,kgs(mgs),ln(il)) = max(cx(mgs,il), 0.0)
25088 IF ( lcin > 1 )
THEN
25090 an(igs(mgs),jy,kgs(mgs),lcin) = max(0.0, ccin(mgs))
25094 IF ( ipconc .ge. 2 )
THEN
25096 IF ( lss > 1 )
THEN
25097 an(igs(mgs),jy,kgs(mgs),lss) = max(0.0, ssmax(mgs) )
25100 IF ( lccn > 1 )
THEN
25101 an(igs(mgs),jy,kgs(mgs),lccn) = max(0.0, ccnc(mgs) )
25106 ELSEIF ( ipconc .eq. 0 .and. lni .gt. 1 )
THEN
25109 an(igs(mgs),jy,kgs(mgs),lni) = max(cx(mgs,li), 0.0)
25119 IF ( lvol(il) .ge. 1 )
THEN
25123 an(igs(mgs),jy,kgs(mgs),lvol(il)) = max( 0.0, vx(mgs,il) )
25136 if (ndebug .gt. 0 )
write(0,*)
'gs 12'
25140 if (ndebug .gt. 0 )
write(0,*)
'gs 13'
25144 if ( kz .gt. nz-1 .and. ix .ge. itile)
then
25145 if ( ix .ge. itile )
then
25154 if ( ix .ge. itile )
then