185 private gamma_sp,gamxinf,gaml02, gaml02d300, gaml02d500, fqvs, fqis
186 private gamma_dp, gamxinfdp, gamma_dpr
187 private delbk, delabk
190 logical,
private :: cleardiag = .false.
194 integer,
parameter :: wrfchem_flag = 1
196 integer,
parameter :: wrfchem_flag = 0
199 LOGICAL,
PRIVATE:: is_aerosol_aware = .false.
201 logical,
private :: turn_on_cin = .false.
203 integer,
private :: eqtset = 1
205 double precision,
parameter,
public :: zscale = 1.0d0
206 double precision,
parameter,
public :: zscaleinv = 1.0d0/zscale
209 real,
parameter :: warmonly = 0.0
211 logical,
parameter :: lwsm6 = .false.
214 real,
parameter :: dimax = 500.e-6
215 real,
parameter :: roqimax = 2.08e22*dimax**8
218 integer :: iuseferrier = 1
219 integer :: idbzci = 1
220 integer :: iusewetgraupel = 1
222 integer :: iusewethail = 0
223 integer :: iusewetsnow = 0
226 real,
private :: rho_qr = 1000., cnor = 8.0e5
227 real,
private :: rho_qs = 100., cnos = 3.0e6
228 real,
private :: rho_qh = 500., cnoh = 4.0e5
229 real,
private :: rho_qhl= 800., cnohl = 4.0e4
231 real,
private :: hdnmn = 170.0
232 real,
private :: hldnmn = 500.0
234 real :: cnohmn = 1.e-2
235 real :: cnohlmn = 1.e-2
239 real ,
private :: qcmincwrn = 2.0e-3
240 real ,
private :: cwdiap = 20.0e-6
241 real ,
private :: cwdisp = 0.15
242 real ,
private :: ccn = 0.6e+09
243 real ,
private :: ccnuf = 0
244 real ,
public :: qccn, qccnuf
245 real ,
private :: old_qccn = -1.0
246 integer,
private :: iauttim = 1
247 real ,
private :: auttim = 300.
248 real ,
private :: qcwmntim = 1.0e-5
252 logical,
parameter :: invertccn = .true.
254 logical,
private :: invertccn = .false.
256 logical :: switchccn = .false.
257 real :: old_cccn = -1.0
258 logical :: restoreccn = .true.
259 real :: ccntimeconst = 3600.
260 real,
private :: restoreccnfrac = 1.0
261 real :: ufccntimeconst = 6.*3600.
262 real :: ufbackground = 0.1e9
263 logical :: decayufccn = .false.
264 integer :: i_uf_or_ccn = 0
270 integer,
private :: itfall = 0
271 integer,
private :: iscfall = 1
272 integer,
private :: irfall = -1
273 integer,
private :: iifall = 0
274 integer,
private :: isfall = 2
275 logical,
private :: do_accurate_sedimentation = .true.
278 integer,
private :: interval_sedi_vt = 2
279 integer,
private :: infall = 4
285 integer :: imydiagalpha = 0
286 real,
private :: rainfallfac = 1.0
287 real,
private :: icefallfac = 1.5
288 real,
private :: snowfallfac = 1.25
289 real,
private :: graupelfallfac = 1.0
290 real,
private :: hailfallfac = 1.0
291 integer,
private :: icefallopt = 3
292 integer,
private :: icdx = 6
294 integer,
private :: icdxhl = 6
296 real :: axh = 75.7149, bxh = 0.5
297 real :: axf = 75.7149, bxf = 0.5
298 real :: axhl = 206.984, bxhl = 0.6384
299 real ,
private :: cdhmin = 0.45, cdhmax = 0.8
300 real ,
private :: cdhdnmin = 500., cdhdnmax = 800.0
301 real ,
private :: cdhlmin = 0.45, cdhlmax = 0.6
302 real ,
private :: cdhldnmin = 500., cdhldnmax = 800.0
303 real ,
private :: vtmaxsed = 70.
305 integer :: rssflg = 1
306 integer :: sssflg = 1
307 integer :: hssflg = 1
308 integer :: hlssflg = 1
312 integer,
private :: ndebug = -1, ncdebug = 0
313 integer,
private :: ipconc = 5
314 integer,
private :: inucopt = 0
315 integer,
private :: ichaff = 0
316 integer,
parameter :: ilimit = 0
318 real,
private :: constccw = -1.
320 real,
private :: cimn = 1.0e3, cimx = 1.0e6
322 real ,
private :: rhofrz = 900
323 real ,
private :: ifrzg = 1.0
324 real ,
private :: ifiacrg = 1.0
325 real ,
private :: ifrzs = 1.0
326 real ,
private :: ffrzs = 0.0
327 real ,
private :: f2h = 1.0
328 integer,
private :: irwfrz = 1
329 integer,
private :: irimtim = 0
332 integer,
private :: irimdenopt = 1
333 real ,
private :: rimc1 = 300.0, rimc2 = 0.44
334 real ,
private :: rimc3 = 170.0
335 real :: rimc4 = 900.0
336 real ,
private :: rimtim = 120.0
337 real ,
private :: eqtot = 1.0e-9
338 real,
private :: rimdenvwgt = 0.0
340 integer,
private :: ireadmic = 0
342 integer,
private :: idiagnosecnu = 0
343 integer,
private :: iccwflg = 1
345 integer,
private :: issfilt = 0
346 integer,
private :: icnuclimit = 0
347 integer,
private :: irenuc = 5
352 integer,
private :: irenuc3d = 0
353 real :: renucfrac = 0.0
356 real :: ssf2kmax = 10.
357 real ,
private :: cck = 0.6
358 real ,
private :: ciintmx = 1.0e6
360 real ,
private :: cwccn
361 real ,
private :: ccwmx
363 integer,
private :: idocw = 1, idorw = 1, idoci = 1, idoir = 1, idoip = 1, idosw = 1
364 integer,
private :: idogl = 1, idogm = 1, idogh = 1, idofw = 1, idohw = 1, idohl = 1
369 integer,
private :: itype1 = 0, itype2 = 2
370 integer,
private :: in_freeze_rain_first = 0
371 integer,
private :: icenucopt = 1
372 real,
private :: naer = 1.0e6
373 integer,
private :: icfn = 2
374 integer,
private :: ihrn = 0
375 integer,
private :: ibfc = 1
376 real,
private :: cwfrz2snowfrac = 0.0
377 real,
private :: cwfrz2snowratio = 5.
378 integer,
private :: iremoveqwfrz = 1
379 integer,
private :: iacr = 2
381 integer,
private :: icrcev = 1
382 integer,
private :: icracr = 1
383 integer,
private :: icracrthresh = 1
384 integer,
private :: ibfr = 2
386 integer,
private :: ibiggopt = 2
387 integer :: ibiggsmallrain = 0
388 integer,
private :: iacrsize = 5
394 real ,
private :: cimas0 = 6.62e-11
396 real ,
private :: cimas1 = 6.88e-13
397 real ,
private :: splintermass = 6.88e-13
398 real ,
private :: cfnfac = 0.1
399 integer,
private :: iscni = 4
400 real ,
private :: fscni = 1.0
401 logical,
private :: imeyers5 = .false.
402 real ,
private :: dmincw = 15.0e-6
403 integer,
private :: iehw = 1
404 integer,
private :: iefw = 1
405 integer,
private :: iehlw = 1
407 integer,
private :: ierw = 1
408 integer,
private :: iehr0c = 0
409 integer,
private :: iehlr0c = 0
410 real ,
private :: eiw0 = 0.5
411 real ,
private :: esw0 = 0.5
412 real ,
private :: ehw0 = 0.9
413 real ,
private :: erw0 = 1.0
414 real ,
private :: ehlw0 = 0.9
415 real ,
private :: efw0 = 0.5
419 real ,
private :: exwmindiam = 0.0
422 real ,
private :: esilfo0 = 1.0
423 real ,
private :: ehslfo0 = 1.0
425 integer,
private :: ircnw = 5
426 real ,
private :: qminrncw = 2.0e-3
428 integer,
private :: iqcinit = 2
433 real ,
private :: ssmxinit = 0.4
436 real ,
private :: ewfac = 1.0
437 real ,
private :: eii0 = 0.1 ,eii1 = 0.1
439 real ,
private :: eii0hl = 0.2 ,eii1hl = 0.0
441 real,
private :: ewi_dcmin = 15.0e-06
442 real,
private :: ewi_dimin = 30.0e-06
443 real ,
private :: eri0 = 0.1
444 real ,
private :: eri_cimin = 10.e-6
445 real ,
private :: esi0 = 0.1
446 real ,
private :: ehs0 = 0.1, ehs1 = 0.1
448 integer :: iessopt = 1
450 real ,
private :: ess0 = 0.5, ess1 = 0.05
452 real ,
private :: esstem1 = -15.
453 real ,
private :: esstem2 = -10.
454 real ,
private :: essrmax = 0.02
455 real ,
private :: essfrac1 = 0.5
456 real ,
private :: essfrac2 = 0.75
457 integer,
private :: iessec0flag = 0
458 real ,
private :: ehsfrac = 1.0
459 real ,
private :: ehimin = 0.0
460 real ,
private :: ehimax = 1.0
461 real ,
private :: ehsmax = 0.5
462 real ,
private :: ecollmx = 0.5
463 integer,
private :: iglcnvi = 1
464 integer,
private :: iglcnvs = 2
469 real ,
private :: rzhl
472 real ,
private :: rzs
474 real ,
private :: alphahacx = 0.0
476 real ,
private :: fconv = 1.0
478 real ,
private :: rg0 = 400.0
480 integer,
private :: rcond = 2
482 integer,
parameter,
private :: icond = 1
484 integer,
private :: iqis0 = 2
486 real ,
private :: dfrz = 0.15e-3
488 real ,
private :: dmlt = 3.0e-3
489 real ,
private :: dshd = 1.0e-3
490 integer,
private :: ivshdgs = 1
491 integer,
private :: ished2cld = 0
493 integer,
private :: ihmlt = 2
494 integer,
private :: imltshddmr = 2
503 real :: mltdiam1 = 9.0e-3, mltdiam2 = 16.0e-3, mltdiam3 = 19.0e-3, mltdiam4 = 200.0e-3, mltdiam05 = 4.5e-3
505 integer,
private :: nsplinter = 0
506 real,
private :: lawson_splinter_fac = 2.5e-11
507 integer,
private :: isnwfrac = 0
511 real,
private :: qhdpvdn = -1.
512 real,
private :: qhacidn = -1.
514 integer,
private :: iraintypes = 0
515 logical,
private :: mixedphase = .false.
516 integer,
private :: imixedphase = 0
517 logical,
private :: qsdenmod = .false.
518 logical,
private :: qhdenmod = .false.
519 logical,
private :: qsvtmod = .false.
520 real ,
private :: sheddiam = 8.0e-03
521 real :: sheddiamlg = 10.0e-03
522 real :: sheddiam0 = 20.0e-03
524 real :: fwmhtmptem = -15.
525 integer :: ifwmhtmptemopt = 1
526 integer :: ifwmhopt = 2
530 integer :: ihxw2rain = 0
533 real ,
private :: fwms = 0.5
534 real ,
private :: fwmh = 0.5
535 real ,
private :: fwmhl = 0.5
536 real :: fwmlarge = 0.2
537 integer :: ifwmfall = 0
540 logical :: rescale_high_alpha = .false.
541 logical :: rescale_low_alpha = .true.
542 logical :: rescale_low_alphar = .true.
543 logical :: rescale_low_alphah = .true.
544 logical :: rescale_low_alphahl = .true.
546 real,
parameter :: alpharmax = 8.
548 integer,
private :: ihlcnh = -1
552 real,
private :: hlcnhdia = 1.e-3
553 real,
private :: hlcnhqmin = 0.1e-3
554 real ,
private :: hldia1 = 10.0e-3
555 integer,
private :: incwet = 0
556 integer,
private :: iusedw = 0
557 real ,
private :: dwmin = 5.0e-3
558 real ,
private :: dwetmin = 5.0e-3
559 real ,
private :: dwmax = 15.e-3
560 real ,
private :: dwtempmin = 242.
561 real ,
private :: dwehwmin = 0.
562 real ,
private :: dg0thresh = 0.15
563 real ,
private :: wetgrthtoffset = -1.
564 real ,
private :: hailcnvtoffset = -2.
565 integer :: ifddenfac = 0
566 real :: fddenthresh = 500.
567 integer :: icvhl2h = 0
569 integer,
private :: imurain = 1
570 integer,
private :: imusnow = 3
571 integer,
private :: iturbenhance = 0
575 integer,
private :: isedonly = 0
576 integer,
private :: iferwisventr = 2
577 integer,
private :: izwisventr = 2
578 integer :: iresetmoments = 0
579 integer,
private :: imaxdiaopt = 3
583 integer :: irainbreak = -1
589 integer :: ibincracr = 0
590 real :: rainbreakfac = 1.0e6
591 real :: draintail = 10.e-3
592 real :: drsmall = 1.e-3
593 real :: qrbrthresh1 = 0.1e-3
594 real :: qrbrthresh2 = 1.0e-3
595 integer,
private :: dmrauto = 0
601 integer :: dmropt = 0
602 integer :: dmhlopt = 0
603 integer :: irescalerainopt = 3
607 real :: rescale_wthresh = 3.0
608 real :: rescale_tempthresh = 0.0
609 real,
parameter :: alpharaut = 0.0
610 real :: cxmin = 1.e-8
611 real :: zxmin = 1.e-28
613 integer :: ithompsoncnoh = 0
617 integer :: ivhmltsoak = 1
619 logical,
private :: iwetsoak = .true.
620 integer,
private :: ioldlimiter = 0
621 integer,
private :: isnowfall = 2
625 integer,
private :: isnowdens = 1
629 integer,
private :: ibiggsnow = 3
632 real :: biggsnowdiam = -1.0
634 integer,
private :: ixtaltype = 1
636 real,
private :: takshedsize1 = 0.15
637 real,
private :: takshedsize2 = 0.3
638 real,
private :: takshedsize3 = 0.45
639 integer,
private :: numshedregimes = 3
641 real,
private :: evapfac = 1.0
642 real,
private :: depfac = 1.0
643 real,
private,
parameter :: meltfac = 1.0
645 integer,
private :: ibinhmlr = 0
647 integer,
private :: ibinhlmlr = 0
649 integer,
private :: ibinnum = 2
650 integer,
private :: iqhacrmlr = 1
651 integer,
private :: iqhlacrmlr = 1
652 integer,
private :: iqhacwshr = 1
653 integer,
private :: iqhlacwshr = 1
654 real,
private :: binmlrmxdia = 40.e-3
655 real,
private :: binmlrzrrfac = 1.0
656 real,
private :: snowmeltdia = 0
657 real,
private :: alphasmlr0 = 14.0
658 real,
private :: delta_alphamlr = 0.5
660 integer,
private :: iqvsopt = 1
662 integer :: imaxsupopt = 4
667 real :: maxsupersat = 1.9
668 real :: maxlowtempss = 1.08
672 integer,
parameter :: icespheres = 0
673 integer,
parameter :: lqmx = 30
674 integer,
parameter :: lt = 1
675 integer,
parameter :: lv = 2
676 integer,
parameter :: lc = 3
677 integer,
parameter :: lr = 4
678 integer,
parameter :: li = 5
679 integer,
private :: lis = 0
680 integer,
private :: ls = 6
681 integer,
private :: lh = 7
682 integer,
private :: lf = 0
683 integer,
private :: lhl = 0
685 integer,
private :: lccn = 9
686 integer,
private :: lccnuf = 0
687 integer,
private :: lccna = 0
688 integer,
private :: lccnaco = 0
689 integer,
private :: lccnanu = 0
690 integer,
private :: lcina = 0
691 integer,
private :: lcin = 0
692 integer,
private :: lnc = 9
693 integer,
private :: lnr = 10
694 integer,
private :: lni = 11
695 integer,
private :: lnis = 0
696 integer,
private :: lns = 12
697 integer,
private :: lnh = 13
698 integer,
private :: lnf = 0
699 integer,
private :: lnhl = 0
700 integer,
private :: lnhf = 0
701 integer,
private :: lnhlf = 0
702 integer,
private :: lss = 0
705 integer,
private :: lhab = 8
706 integer,
private :: lg = 7
725 integer :: lhlwlg = 0
752 integer :: lscpli = 0
753 integer :: lscnli = 0
754 integer :: lschab = 0
764 real :: cnoh0 = 4.0e+5
765 real :: hwdn1 = 700.0
770 real,
private :: alphah = 0.0
771 real,
private :: alphahl = 1.0
776 real,
private :: alphamax = 15.
777 real,
private :: alphamin = 0.
778 real,
parameter :: rnumin = -0.8
779 real,
parameter :: rnumax = 15.0
783 real,
parameter :: rnu = -0.8, snu = -0.8, cinu = 0.0
796 real dab0(lc:lqmx,lc:lqmx)
797 real dab1(lc:lqmx,lc:lqmx)
803 integer :: ipelec = 0
804 integer :: isaund = 0
805 logical :: idoniconly = .false.
806 integer,
private :: elec_on_time = -1
807 integer,
private :: elec_ramp_time = 0
814 real :: charging_border = 4000.
815 real,
private :: delqnw = -1.0e-10
816 real,
private :: delqxw = 1.0e-10
817 real :: tindmn = 233, tindmx = 298.0
819 integer,
private :: imorrgdnglimit = 0
820 real,
private :: morrdnglimit = 2000.e-6
825 integer ngm0,ngm1,ngm2
826 parameter(ngm0=3001,ngm1=500,ngm2=500)
827 double precision,
parameter :: dgam = 0.01, dgami = 100.
828 double precision gmoi(0:ngm0)
830 integer,
parameter :: nqiacralpha = 300
831 integer,
parameter :: nqiacrratio = 400
833 real,
parameter :: maxratiolu = 100.
834 real,
parameter :: maxalphalu = 15.
835 real,
parameter :: minalphalu = -0.95
836 real,
parameter :: dqiacralpha = maxalphalu/float(nqiacralpha), dqiacrratio = maxratiolu/float(nqiacrratio)
837 real,
parameter :: dqiacrratioinv = 1./dqiacrratio, dqiacralphainv = 1./dqiacralpha
838 integer,
parameter :: ialpstart = minalphalu*dqiacralphainv
839 real :: ciacrratio(0:nqiacrratio,ialpstart:nqiacralpha)
840 real :: qiacrratio(0:nqiacrratio,ialpstart:nqiacralpha)
841 real :: ziacrratio(0:nqiacrratio,ialpstart:nqiacralpha)
842 double precision :: gamxinflu(0:nqiacrratio,ialpstart:nqiacralpha,12,2)
849 real,
save :: dab0lu(ialpstart:nqiacralpha,ialpstart:nqiacralpha,lc:lqmx,lc:lqmx)
850 real,
save :: dab1lu(ialpstart:nqiacralpha,ialpstart:nqiacralpha,lc:lqmx,lc:lqmx)
852 integer,
parameter :: ngdnmm = 9
853 real :: mmgraupvt(ngdnmm,3)
855 DATA mmgraupvt(:,1) / 50., 150., 250., 350., 450., 550., 650., 750., 850./
856 DATA mmgraupvt(:,2) / 62.923, 94.122, 114.74, 131.21, 145.26, 157.71, 168.98, 179.36, 189.02 /
857 DATA mmgraupvt(:,3) / 0.67819, 0.63789, 0.62197, 0.61240, 0.60572, 0.60066, 0.59663, 0.59330, 0.59048 /
862 integer lvol(lc:lqmx)
864 integer lliq(li:lqmx)
865 integer linfall(lc:lqmx)
866 integer denscale(lc:lqmx)
872 real xdnmx(lc:lqmx), xdnmn(lc:lqmx)
875 real xvmn(lc:lqmx), xvmx(lc:lqmx)
877 real qxmin_init(lc:lqmx)
880 parameter(nqsat=1000001)
882 parameter(fqsat=0.002,fqsati=1./fqsat)
883 real tabqvs(nqsat),tabqis(nqsat),dtabqvs(nqsat),dtabqis(nqsat)
888 real,
parameter :: ar = 841.99666
889 real,
parameter :: br = 0.8
890 real,
parameter :: aradcw = -0.27544
891 real,
parameter :: bradcw = 0.26249e+06
892 real,
parameter :: cradcw = -1.8896e+10
893 real,
parameter :: dradcw = 4.4626e+14
894 real,
parameter :: bta1 = 0.6
895 real,
parameter :: cnit = 1.0e-02
896 real,
parameter :: dragh = 0.60
897 real,
parameter :: dnz00 = 1.225
898 real,
parameter :: rho00 = 1.225
902 real,
parameter :: cs = 12.42
903 real,
parameter :: ds = 0.42
904 real :: cp608 = 0.608
907 real,
parameter :: pi = 3.141592653589793
908 real,
parameter :: piinv = 1./pi
909 real,
parameter :: pid4 = pi/4.0
918 real xvhmn, xvhmn0, xvhmx, xvhmx0
919 real xvhlmn, xvhlmx, xvhlmx0
921 real,
parameter :: dhlmn = 0.3e-3
922 real,
parameter :: dhmn0 = 0.3e-3
923 real,
private :: dhmn = dhmn0, dhmx = -1., dhlmx = -1.
925 real,
parameter :: cwradn = 2.0e-6, xcradmn = cwradn
926 real,
parameter :: cwradx = 60.e-6, xcradmx = cwradx
927 real,
parameter :: cwc1 = 6.0/(pi*1000.)
930 real,
parameter :: xvcmn=0.523599*(2.*cwradn)**3
931 real,
parameter :: xvcmx=0.523599*(2.*xcradmx)**3
932 real,
parameter :: cwmasn = 1000.*xvcmn
933 real,
parameter :: cwmasx = 1000.*xvcmx
934 real,
parameter :: cwmasn5 = 1000.*0.523599*(2.*5.0e-6)**3
936 real,
parameter :: xvimn=0.523599*(2.*5.e-6)**3
937 real,
parameter :: xvimx=0.523599*(2.*1.e-3)**3
939 real,
private :: xvdmx = -1.0
941 parameter( xvrmn=0.523599*(80.e-6)**3, xvrmx0=0.523599*(6.e-3)**3 )
942 parameter( xvsmn=0.523599*(0.01e-3)**3, xvsmx=0.523599*(10.e-3)**3 )
943 parameter( xvfmn=0.523599*(0.1e-3)**3, xvfmx=0.523599*(10.e-3)**3 )
944 parameter( xvgmn=0.523599*(0.1e-3)**3, xvgmx=0.523599*(10.e-3)**3 )
945 parameter( xvhmn0=0.523599*(0.3e-3)**3, xvhmx0=0.523599*(20.e-3)**3 )
946 parameter( xvhlmn=0.523599*(dhlmn)**3, xvhlmx0=0.523599*(40.e-3)**3 )
952 parameter(eperao = 8.8592e-12 )
955 parameter(ec = 1.602e-19)
956 parameter(eci = 1.0/ec)
958 real :: scwppmx = 20.0e-12
959 real :: scippmx = 20.0e-12
963 real,
parameter :: c1f3 = 1.0/3.0
965 real,
parameter :: cai = 21.87455
966 real,
parameter :: caw = 17.2693882
967 real,
parameter :: cbi = 7.66
968 real,
parameter :: cbw = 35.86
970 real,
parameter :: cbwbolton = 29.65
971 real,
parameter :: cawbolton = 17.67
972 real,
parameter :: esbolton = 6.112e2
974 real,
parameter :: tfrh = 233.15
978 real :: cp = 1004.0, rd = 287.04
981 real :: cpigb = 2106.0
982 real :: cpi = 1.0/1004.0
983 real :: cap = 287.04/1004.0
984 real :: tfrcbw = 273.15 - cbw
985 real :: tfrcbi = 273.15 - cbi
986 real :: rovcp = 287.04/1004.0
987 real :: rdorv = 0.622
989 real,
parameter :: poo = 1.0e+05
990 real,
parameter :: advisc0 = 1.832e-05
991 real,
parameter :: advisc1 = 1.718e-05
992 real,
parameter :: tka0 = 2.43e-02
996 real,
private,
parameter :: cv = 717.0
997 REAL,
PRIVATE,
parameter :: cvv = 1408.5
1000 real,
parameter :: bfnu0 = (rnu + 2.0)/(rnu + 1.0)
1001 real :: ventr, ventrn, ventc, c1sw
1004 real :: cckm,ccne,ccnefac,cnexp,CCNE0
1006 integer,
public :: na = 9
1007 integer :: nxtra = 1
1008 real gf4p5, gf4ds, gf4br
1009 real gsnow1, gsnow53, gsnow73
1010 real gfcinu1, gfcinu1p47, gfcinu2p47
1011 real gfcinu1p22,gfcinu2p22
1012 real gfcinu1p18,gfcinu2p18
1014 real :: cwchtmp0 = 1.0
1015 real :: cwchltmp0 = 1.0
1017 real :: esctot = 1.0e-13
1019 integer iexy(lc:lqmx,lc:lqmx)
1020 integer :: ieswi = 1, ieswc = 1, ieswr = 0
1021 integer :: iehlsw = 1, iehli = 1, iehlc = 1, iehlr = 0
1022 integer :: iehwsw = 1, iehwi = 1, iehwc = 1, iehwr = 0
1024 logical,
parameter :: do_satadj_for_wrfchem = .true.
1026 integer,
private :: lcn_nu = 0
1027 integer,
private :: lcn_ac = 0
1028 integer,
private :: lcn_co = 0
1029 integer,
private :: lcinp = 0
1030 integer,
private :: ac_opt = 0
1037 real,
private :: ac_wthresh = 10.0
1038 logical,
private :: nuaccoinp = .false.
1043 logical,
private :: arg_para = .true.
1044 real,
private :: nu_pmr = 7.5 * 1.e-3 * 1.e-6
1045 real,
private :: nu_pgw = 0.53
1046 real,
private :: nu_kappa = 0.07
1047 real,
private :: ac_pmr = 3.8 * 1.e-2 * 1.e-6
1048 real,
private :: ac_pgw = 0.69
1049 real,
private :: ac_kappa = 0.61
1050 real,
private :: co_pmr = 0.51 * 1.e-6
1051 real,
private :: co_pgw = 0.77
1052 real,
private :: co_kappa = 0.61
1054 real,
parameter :: cn_minlimit = 1.e3
1056 logical :: dm15_para = .false.
1062 namelist /nssl_mp_params/ &
1065 ac_kappa, ac_pmr, ac_pgw, &
1066 nu_kappa, nu_pmr, nu_pgw, &
1067 co_kappa, co_pmr, co_pgw, &
1076 infall,irfall,isfall,iifall, &
1081 irainbreak, rainbreakfac, &
1082 irimdenopt,rimdenvwgt, &
1083 rimc1, rimc2, rimc3, rimc4, &
1087 restoreccn, ccntimeconst, cck, &
1088 decayufccn, ufccntimeconst, &
1089 switchccn, old_cccn, &
1092 icenucopt, in_freeze_rain_first, &
1095 ibfc, iacr, icracr, &
1097 cwfrz2snowfrac, cwfrz2snowratio, &
1104 cimas0, cimas1, cfnfac, &
1112 ess0, ess1, iessopt, &
1138 axh,bxh,axf,bxf,axhl,bxhl, &
1140 cdhdnmin, cdhdnmax, &
1142 cdhldnmin, cdhldnmax, &
1154 lawson_splinter_fac, &
1158 dhmn, dhmx, dhlmx, &
1165 qsdenmod,qhdenmod, &
1167 alphamin,alphamax, &
1169 rescale_low_alpha, &
1170 rescale_low_alphar, &
1171 rescale_low_alphah, &
1172 rescale_low_alphahl, &
1173 rescale_high_alpha, &
1174 ihlcnh, hldia1,iusedw, dwehwmin, dwmin, dwmax, dwtempmin, dg0thresh, incwet, &
1175 wetgrthtoffset, hailcnvtoffset, &
1176 icvhl2h, hldnmn,hdnmn, &
1177 hlcnhdia, hlcnhqmin, &
1186 sheddiam,sheddiamlg, &
1188 mltdiam1,mltdiam2,mltdiam3,mltdiam4,mltdiam05, &
1200 dmrauto,irescalerainopt, dmropt,dmhlopt, &
1201 rescale_tempthresh, rescale_wthresh, &
1202 ibinhmlr,ibinhlmlr,imltshddmr, binmlrmxdia, binmlrzrrfac,ibinnum, &
1203 iqhacrmlr, iqhlacrmlr, &
1208 do_accurate_sedimentation, interval_sedi_vt
1220 REAL FUNCTION fqvs(t)
1223 fqvs = exp(caw*(t-273.15)/(t-cbw))
1228 REAL FUNCTION fqis(t)
1231 fqis = exp(cai*(t-273.15)/(t-cbi))
1246 con_g, con_rd, con_cp, con_rv, con_t0c, con_cliq, con_csol, con_eps )
1249 real,
intent(in) :: con_g, con_rd, con_cp, con_rv, &
1250 con_t0c, con_cliq, con_csol, con_eps
1277 & ims,ime, jms,jme, kms,kme, nssl_params, ipctmp, mixphase,ihvol,idoniconlytmp, &
1278 & namelist_filename, internal_nml, &
1279 & nssl_graupelfallfac, &
1280 & nssl_hailfallfac, &
1285 & nssl_icefallfac, &
1286 & nssl_snowfallfac, &
1292 & nssl_density_on, nssl_hail_on, nssl_ccn_on, nssl_icecrystals_on, ccn_is_ccna, &
1301 real,
intent(in),
optional :: &
1302 & nssl_graupelfallfac, &
1303 & nssl_hailfallfac, &
1306 & nssl_icefallfac, &
1307 & nssl_snowfallfac, &
1312 integer,
intent(in),
optional :: &
1314 & nssl_icdxhl, myrank, mpiroot, &
1317 logical,
intent(in),
optional :: nssl_density_on, nssl_ccn_on, nssl_hail_on, nssl_icecrystals_on
1318 integer,
intent(inout),
optional :: ccn_is_ccna
1320 integer,
intent(in),
optional :: infileunit
1322 integer,
parameter::strsize=64
1323 character(len=*),
intent(in),
optional :: internal_nml(:)
1324 character(len=strsize),
intent(in),
optional :: namelist_filename
1325 character(len=strsize) :: namelist_inputfile
1328 character(len=*),
intent( out) :: errmsg
1329 integer,
intent( out) :: errflg
1330 integer,
intent(in),
optional :: ims,ime, jms,jme, kms,kme
1332 real,
intent(in),
dimension(20),
optional :: nssl_params
1336 integer,
intent(in) :: ipctmp,mixphase
1337 integer,
optional,
intent(in) :: ihvol
1338 logical,
optional,
intent(in) :: idoniconlytmp
1340 integer :: igvol_local = 1
1341 logical :: wrote_namelist = .false.
1342 logical :: wrf_dm_on_monitor
1343 integer :: hail_on = -1, density_on = -1, icecrystals_on = 1
1344 integer :: ccn_on = -1
1346 double precision :: arg,cwch
1355 double precision :: x,y,y2,y7
1356 logical :: turn_on_ccna, turn_on_cina
1357 integer :: iufccn = 0
1360 real :: alpjj, alpii, xnuii, xnujj
1366 turn_on_ccna = .false.
1367 turn_on_cina = .false.
1373 IF (
present( nssl_hail_on ) )
THEN
1374 IF ( nssl_hail_on )
THEN
1381 IF (
present( nssl_density_on ) )
THEN
1382 IF ( nssl_density_on )
THEN
1389 IF (
present( nssl_icecrystals_on ) )
THEN
1390 IF ( nssl_icecrystals_on )
THEN
1404 IF (
present( nssl_params ) )
THEN
1405 ccn = abs( nssl_params(1) )
1406 alphah = nssl_params(2)
1407 alphahl = nssl_params(3)
1408 cnoh = nssl_params(4)
1409 cnohl = nssl_params(5)
1410 cnor = nssl_params(6)
1411 cnos = nssl_params(7)
1412 rho_qh = nssl_params(8)
1413 rho_qhl = nssl_params(9)
1414 rho_qs = nssl_params(10)
1415 IF ( nint(nssl_params(13)) == 1 )
THEN
1418 turn_on_ccna = .true.
1421 ccnuf = abs( nssl_params(14) )
1422 IF (
present(nssl_ufccn) ) iufccn = nssl_ufccn
1425 alphar = nssl_params(15)
1430 IF (
present(nssl_graupelfallfac) ) graupelfallfac = nssl_graupelfallfac
1431 IF (
present(nssl_hailfallfac) ) hailfallfac = nssl_hailfallfac
1432 IF (
present(nssl_ehw0) )
THEN
1433 IF ( nssl_ehw0 > 0.0 ) ehw0 = nssl_ehw0
1435 IF (
present(nssl_ehlw0) )
THEN
1436 IF ( nssl_ehlw0 > 0.0 ) ehlw0 = nssl_ehlw0
1438 IF (
present(nssl_icdx) ) icdx = nssl_icdx
1439 IF (
present(nssl_icdxhl) ) icdxhl = nssl_icdxhl
1440 IF (
present(nssl_icefallfac) ) icefallfac = nssl_icefallfac
1441 IF (
present(nssl_snowfallfac) ) snowfallfac = nssl_snowfallfac
1442 IF (
present(nssl_cccn) )
THEN
1443 IF (nssl_cccn > 1 ) ccn = nssl_cccn
1445 IF (
present(nssl_alphah) )
THEN
1446 IF ( nssl_alphah > -1. ) alphah = nssl_alphah
1448 IF (
present(nssl_alphahl) )
THEN
1449 IF ( nssl_alphahl > -1. ) alphahl = nssl_alphahl
1451 IF (
present(nssl_alphar) )
THEN
1452 IF ( nssl_alphar > -1.0 ) alphar = nssl_alphar
1459 IF ( ihlcnh <= 0 )
THEN
1460 IF ( ipconc < 5 )
THEN
1462 ELSEIF ( ipconc == 5 )
THEN
1464 ELSEIF ( ipconc >= 6 )
THEN
1471 IF ( irainbreak == -1 )
THEN
1472 IF ( ipconc >= 6 )
THEN
1479#ifdef INTERNAL_FILE_NML
1480 read (internal_nml, nml = nssl_mp_params, iostat=istat)
1483 namelist_inputfile =
'namelist.input'
1484 IF (
present( namelist_filename ) )
THEN
1485 namelist_inputfile = namelist_filename
1487 namelist_inputfile =
'input.nml'
1490 open(15,file=trim(namelist_inputfile),status=
'old',form=
'formatted',action=
'read')
1492 read(15,nml=nssl_mp_params,iostat=istat)
1496 IF (
present ( myrank ) .and.
present ( mpiroot ) )
THEN
1497 IF ( myrank == mpiroot )
THEN
1498 IF ( istat /= 0 )
THEN
1499 write(0,*)
'NSSL_2MOM_INIT: PROBLEM WITH NSSL_MP_PARAMS namelist: not found or bad token'
1504 open(15,file=
'nssl_mp_params.out',status=
'unknown',form=
'formatted')
1505 write(15,nml=nssl_mp_params)
1511 IF ( iufccn > 0 )
THEN
1513 IF ( ccnuf <= 0.0 ) decayufccn = .true.
1514 IF ( i_uf_or_ccn > 0 )
THEN
1516 ccntimeconst = ufccntimeconst
1520 IF (
present( nssl_ccn_on ) )
THEN
1521 IF ( nssl_ccn_on )
THEN
1523 IF (
present( nssl_ccn_opt ) )
THEN
1524 IF ( nssl_ccn_opt > 10 ) ac_opt = 22
1532 IF ( irenuc >= 5 )
THEN
1533 turn_on_ccna = .true.
1534 IF (
present( nssl_ccn_on ) )
THEN
1535 IF ( .not. nssl_ccn_on )
THEN
1536 errmsg =
'NSSL_MP Error: Must have nssl_ccn_on=1/true for irenuc >= 5!'
1543 IF (
present( ccn_is_ccna ) .and. ccn_on == 1 )
THEN
1544 IF ( ccn_is_ccna > 0 )
THEN
1545 turn_on_ccna = .true.
1547 IF ( irenuc >= 5 )
THEN
1557 IF ( icespheres >= 1 )
THEN
1564 IF ( hail_on == -1 )
THEN
1566 IF ( ihvol <= -1 .or. ihvol == 2 )
THEN
1567 IF ( ihvol == -1 .or. ihvol == -2 )
THEN
1576 IF ( ihvol == -2 .or. ihvol == 2 .or. icecrystals_on == 0 )
THEN
1585 IF ( hail_on == 0 )
THEN
1593 IF ( density_on == -1 )
THEN
1598 IF ( iresetmoments == 0 ) iresetmoments = 1
1608 temq = 163.15 + (l-1)*fqsat
1609 IF ( iqvsopt == 0 )
THEN
1610 tabqvs(l) = exp(caw*(temq-273.15)/(temq-cbw))
1611 dtabqvs(l) = ((-caw*(-273.15 + temq))/(temq - cbw)**2 + &
1612 & caw/(temq - cbw))*tabqvs(l)
1614 tabqvs(l) = exp(cawbolton*(temq-273.15)/(temq-cbwbolton))
1615 dtabqvs(l) = ((-cawbolton*(-273.15 + temq))/(temq - cbwbolton)**2 + &
1616 & cawbolton/(temq - cbwbolton))*tabqvs(l)
1618 tabqis(l) = exp(cai*(temq-273.15)/(temq-cbi))
1619 dtabqis(l) = ((-cai*(-273.15 + temq))/(temq - cbi)**2 + &
1620 & cai/(temq - cbi))*tabqis(l)
1629 IF ( icdx == 6 )
THEN
1635 ELSEIF ( icdx > 1 )
THEN
1638 ELSEIF ( icdx == 0 )
THEN
1650 IF ( lhl .gt. 1 )
THEN
1651 IF ( icdxhl == 6 )
THEN
1654 ELSEIF (icdxhl == 0 )
THEN
1657 ELSEIF (icdxhl > 0 )
THEN
1670 gmoi(igam) = gamma_dp(arg)
1679 bxhl1 = bx(max(lh,lhl))
1682 DO j = ialpstart,nqiacralpha
1683 alp = float(j)*dqiacralpha
1684 y = gamma_dpr(1.+alp)
1685 y2 = gamma_dpr(2.+alp)
1686 DO i = 0,nqiacrratio
1687 ratio = float(i)*dqiacrratio
1688 x = gamxinfdp( 1.+alp, ratio )
1690 ciacrratio(i,j) = x/y
1693 gamxinflu(i,j,1,1) = x/y
1694 gamxinflu(i,j,2,1) = gamxinfdp( 2.0+alp, ratio )/y
1695 gamxinflu(i,j,3,1) = gamxinfdp( 2.5+alp+0.5*bxh1, ratio )/y
1696 gamxinflu(i,j,5,1) = (gamma_dpr(5.0+alp) - gamxinfdp( 5.0+alp, ratio ))/y
1697 gamxinflu(i,j,6,1) = (gamma_dpr(5.5+alp+0.5*bxh1) - gamxinfdp( 5.5+alp+0.5*bxh1, ratio ))/y
1698 gamxinflu(i,j,9,1) = gamxinfdp( 1.0+alp, ratio )/y
1699 gamxinflu(i,j,10,1)= gamxinfdp( 4.0+alp, ratio )/y
1701 gamxinflu(i,j,12,1) = gamxinfdp( 2.0+alp, ratio )/y2
1704 gamxinflu(i,j,1,2) = gamxinflu(i,j,1,1)
1705 gamxinflu(i,j,2,2) = gamxinflu(i,j,2,1)
1706 gamxinflu(i,j,3,2) = gamxinfdp( 2.5+alp+0.5*bxhl1, ratio )/y
1707 gamxinflu(i,j,5,2) = gamxinflu(i,j,5,1)
1708 gamxinflu(i,j,6,2) = (gamma_dpr(5.5+alp+0.5*bxhl1) - gamxinfdp( 5.5+alp+0.5*bxhl1, ratio ))/y
1709 gamxinflu(i,j,9,2) = gamxinflu(i,j,9,1)
1710 gamxinflu(i,j,10,2)= gamxinflu(i,j,10,1)
1712 IF ( alp > 1.1 )
THEN
1714 gamxinflu(i,j,7,1) = (gamma_dpr(alp - 1.) - gamxinfdp( alp - 1., ratio ))/y
1716 gamxinflu(i,j,8,1) = (gamma_dpr(alp - 0.5 + 0.5*bxh1) - gamxinfdp( alp - 0.5 + 0.5*bxh1, ratio ))/y
1718 gamxinflu(i,j,8,2) = (gamma_dpr(alp - 0.5 + 0.5*bxhl1) - gamxinfdp( alp - 0.5 + 0.5*bxhl1, ratio ))/y
1721 gamxinflu(i,j,7,1) = (gamma_dpr(0.1) - gamxinfdp( 0.1, ratio ) )/y
1724 gamxinflu(i,j,8,1) = (gamma_dpr(1.1 - 0.5 + 0.5*bxh1) - gamxinfdp( 1.1 - 0.5 + 0.5*bxh1, ratio ) )/y
1725 gamxinflu(i,j,8,2) = (gamma_dpr(1.1 - 0.5 + 0.5*bxhl1) - gamxinfdp( 1.1 - 0.5 + 0.5*bxhl1, ratio ) )/y
1728 gamxinflu(i,j,7,2) = gamxinflu(i,j,7,1)
1732 ciacrratio(0,:) = 1.0
1734 DO j = ialpstart,nqiacralpha
1735 alp = float(j)*dqiacralpha
1736 y = gamma_sp(4.+alp)
1737 y7 = gamma_sp(7.+alp)
1738 DO i = 0,nqiacrratio
1739 ratio = float(i)*dqiacrratio
1742 x = gamxinfdp( 4.+alp, ratio )
1744 qiacrratio(i,j) = x/y
1745 gamxinflu(i,j,4,1) = x/y
1746 gamxinflu(i,j,4,2) = x/y
1749 x = gamxinfdp( 7.+alp, ratio )
1750 ziacrratio(i,j) = x/y7
1751 gamxinflu(i,j,11,1) = x/y7
1752 gamxinflu(i,j,11,2) = x/y7
1756 qiacrratio(0,:) = 1.0
1785 IF ( ipconc == 0 )
THEN
1786 IF ( hail_on == 1 )
THEN
1787 IF ( density_on >= 1 )
THEN
1800 ELSEIF ( ipconc == 5 )
THEN
1802 IF ( iufccn > 0 )
THEN
1805 denscale(lccnuf) = 1
1814 IF ( hail_on == 1 )
THEN
1818 IF ( density_on >= 1 )
THEN
1823 denscale(lccn:ltmp) = 1
1824 IF ( density_on == 1 .and. hail_on == 1 )
THEN
1830 IF ( mixedphase )
THEN
1841 ELSEIF ( ipconc >= 6 )
THEN
1843 IF ( iufccn > 0 )
THEN
1846 denscale(lccnuf) = 1
1860 IF ( density_on == 1 )
THEN
1865 denscale(lccn:ltmp) = 1
1866 IF ( density_on == 1 .and. hail_on == 1 )
THEN
1873 IF ( ipconc == 6 )
THEN
1876 ELSEIF ( ipconc == 7 )
THEN
1881 ELSEIF ( ipconc == 8 )
THEN
1894 IF ( mixedphase )
THEN
1906 errmsg =
'nssl_2mom_init: Invalid value of ipctmp'
1916 IF ( turn_on_ccna )
THEN
1922 IF ( turn_on_cina )
THEN
1928 IF ( turn_on_cin .or. is_aerosol_aware )
THEN
1942 IF ( lhl .gt. 1 ) ln(lhl) = lnhl
1950 IF ( lhl .gt. 1 ) ipc(lhl) = 5
1957 IF ( lhl .gt. 1 .and. lvhl .gt. 1 ) lvol(lhl) = lvhl
1970 IF ( lhl .gt. 1 ) lsc(lhl) = lschl
1974 ldovol = ldovol .or. ( lvol(il) .gt. 1 )
1984 IF ( lhl .gt. 1 .and. lzhl > 1 ) lz(lhl) = lzhl
1989 IF ( lhl .gt. 1 ) lliq(lhl) = lhlw
1990 IF ( mixedphase )
THEN
1999 IF ( imurain == 3 )
THEN
2002 ELSEIF ( imurain == 1 )
THEN
2003 xnu(lr) = (alphar - 2.0)/3.0
2010 IF ( lis >= 1 )
THEN
2015 dnu(lc) = 3.*xnu(lc) + 2.
2016 dmu(lc) = 3.*xmu(lc)
2018 dnu(lr) = 3.*xnu(lr) + 2.
2019 dmu(lr) = 3.*xmu(lr)
2024 dnu(ls) = 3.*xnu(ls) + 2.
2025 dmu(ls) = 3.*xmu(ls)
2031 xnu(lh) = (dnu(lh) - 2.)/3.
2035 IF ( imurain == 3 )
THEN
2036 rz = ((4. + alphah)*(5. + alphah)*(6. + alphah)*(1. + xnu(lr)))/ &
2037 & ((1 + alphah)*(2 + alphah)*(3 + alphah)*(2. + xnu(lr)))
2041 rzhl = ((4. + alphahl)*(5. + alphahl)*(6. + alphahl)*(1. + xnu(lr)))/ &
2042 & ((1. + alphahl)*(2. + alphahl)*(3. + alphahl)*(2. + xnu(lr)))
2048 rz = ((4. + alphah)*(5. + alphah)*(6. + alphah)*(1. + alphar)*(2. + alphar)*(3. + alphar))/ &
2049 & ((1 + alphah)*(2 + alphah)*(3 + alphah)*(4. + alphar)*(5. + alphar)*(6. + alphar))
2051 rzhl = ((4. + alphahl)*(5. + alphahl)*(6. + alphahl)*(1. + alphar)*(2. + alphar)*(3. + alphar))/ &
2052 & ((1 + alphahl)*(2 + alphahl)*(3 + alphahl)*(4. + alphar)*(5. + alphar)*(6. + alphar))
2056 & ((1. + alphar)*(2. + alphar)*(3. + alphar)*(2. + xnu(ls)))/ &
2057 & ((4. + alphar)*(5. + alphar)*(6. + alphar)*(1. + xnu(ls)))
2062 IF ( ipconc <= 5 )
THEN
2063 imltshddmr = min(1, imltshddmr)
2068 IF ( ipconc > 5 .and. (ibinhmlr == 0 .and. ibinhlmlr == 0 ) )
THEN
2069 imltshddmr = min(1, imltshddmr)
2074 IF ( ipconc .lt. 4 )
THEN
2079 xnu(ls) = (dnu(ls) - 2.)/3.
2085 IF ( lhl .gt. 1 )
THEN
2090 xnu(lhl) = (dnu(lhl) - 2.)/3.
2096 IF ( li .gt. 1 ) cno(li) = 1.0e+08
2098 IF ( ls .gt. 1 ) cno(ls) = cnos
2099 IF ( lh .gt. 1 ) cno(lh) = cnoh
2100 IF ( lhl .gt. 1 ) cno(lhl) = cnohl
2111 IF ( lhl .gt. 1 ) xdnmx(lhl) = 900.0
2120 IF ( lhl .gt. 1 ) xdnmn(lhl) = hldnmn
2129 IF ( lhl .gt. 1 ) xdn0(lhl) = rho_qhl
2138 IF ( lhl .gt. 1 ) cdx(lhl) = 0.45
2145 IF ( lhl .gt. 1 ) ido(lhl) = idohl
2149 IF ( irfall .lt. 0 ) irfall = infall
2150 IF ( isfall .lt. 0 ) isfall = infall
2151 IF ( iifall .lt. 0 ) iifall = infall
2152 IF ( lzr > 0 ) irfall = 0
2153 IF ( lzs > 0 ) isfall = 0
2154 IF ( lzh > 0 ) linfall(lh) = 0
2155 IF ( lzhl > 0 .and. lhl > 0 ) linfall(lhl) = 0
2156 IF ( lzr > 0 .and. lf > 0 ) linfall(lf) = 0
2157 linfall(lr) = irfall
2158 linfall(ls) = isfall
2159 linfall(li) = iifall
2162 qccnuf = ccnuf/rho00
2163 IF ( old_cccn > 0.0 )
THEN
2164 old_qccn = old_cccn/rho00
2171 IF ( xvdmx .gt. 0.0 )
THEN
2172 xvrmx = 0.523599*(xvdmx)**3
2177 IF ( dhmn <= 0.0 )
THEN
2181 xvhmn = 0.523599*(dhmn)**3
2185 IF ( dhmx <= 0.0 )
THEN
2188 xvhmx = 0.523599*(dhmx)**3
2191 IF ( dhlmx <= 0.0 )
THEN
2194 xvhlmx = 0.523599*(dhlmx)**3
2197 IF ( ipconc == 5 .and. imorrgdnglimit >= 1 )
THEN
2199 cwch = ((3. + alphah)*(2. + alphah)*(1.0 + alphah))**(-1./3.)
2200 xvhmx = pi/6.0*(morrdnglimit/cwch)**3
2201 dhmx = morrdnglimit/cwch
2204 IF ( qhdpvdn < 0. ) qhdpvdn = xdnmn(lh)
2205 IF ( qhacidn < 0. ) qhacidn = xdnmn(lh)
2220 IF ( lhl .gt. 1 )
THEN
2234 IF ( ipconc .ge. 2 )
THEN
2243 IF ( lhl < 1 ) ifrzg = 1
2246 IF ( imurain == 3 )
THEN
2248 ventr = gamma_sp(rnu + 4./3.)/((rnu + 1.)**(1./3.)*gamma_sp(rnu + 1.))
2250 ventrn = gamma_sp(rnu + 1.5 + br/6.)/(gamma_sp(rnu + 1.)*(rnu + 1.)**((1.+br)/6. + 1./3.) )
2256 ventr = gamma_sp(2. + alphar)
2258 ventrn = gamma_sp(alphar + 2.5 + br/2.)/gamma_sp(alphar + 1.)
2261 ventc = gamma_sp(cnu + 4./3.)/(cnu + 1.)**(1./3.)/gamma_sp(cnu + 1.)
2262 c1sw = gamma_sp(snu + 4./3.)*(snu + 1.0)**(-1./3.)/gamma_sp(snu + 1.0)
2270 IF ( li > 1 ) qxmin(li) = 1.e-12
2271 IF ( ls > 1 ) qxmin(ls) = 1.e-7
2272 IF ( lh > 1 ) qxmin(lh) = 1.e-7
2273 IF ( lhl .gt. 1 ) qxmin(lhl) = 1.e-7
2275 IF ( lc .gt. 1 .and. lnc .gt. 1 ) qxmin(lc) = 1.0e-13
2276 IF ( lr .gt. 1 .and. lnr .gt. 1 ) qxmin(lr) = 1.0e-12
2278 IF ( li .gt. 1 .and. lni .gt. 1 ) qxmin(li ) = 1.0e-13
2279 IF ( ls .gt. 1 .and. lns .gt. 1 ) qxmin(ls ) = 1.0e-13
2280 IF ( lh .gt. 1 .and. lnh .gt. 1 ) qxmin(lh ) = 1.0e-12
2281 IF ( lhl.gt. 1 .and. lnhl.gt. 1 ) qxmin(lhl) = 1.0e-12
2283 qxmin_init(:) = 1.0e-8
2287 ccnefac = (1.63/(cck * beta(3./2., cck/2.)))**(cck/(cck + 2.0))
2288 cnexp = (3./2.)*cck/(cck+2.0)
2291 ccne = ccnefac*1.e6*(1.e-6*abs(cwccn))**(2./(2.+cck))
2292 ccne0 = ccnefac*1.e6*(1.e-6)**(2./(2.+cck))
2294 IF ( cwccn .lt. 0.0 )
THEN
2308 da0(il) = delbk(bb(il), xnu(il), xmu(il), 0)
2309 da1(il) = delbk(bb(il), xnu(il), xmu(il), 1)
2319 IF ( il .ne. j )
THEN
2321 dab0(il,j) = delabk(bb(il), bb(j), xnu(il), xnu(j), xmu(il), xmu(j), 0)
2322 dab1(il,j) = delabk(bb(il), bb(j), xnu(il), xnu(j), xmu(il), xmu(j), 1)
2329 dab0lu(:,:,:,:) = 0.0
2330 dab1lu(:,:,:,:) = 0.0
2332 IF ( ipconc >= 6 )
THEN
2335 IF ( il .ne. j )
THEN
2337 DO jj = ialpstart,nqiacralpha
2338 alpjj = float(jj)*dqiacralpha
2339 xnujj = (alpjj - 2.)/3.
2340 DO ii = ialpstart,nqiacralpha
2341 alpii = float(ii)*dqiacralpha
2342 xnuii = (alpii - 2.)/3.
2344 dab0lu(ii,jj,il,j) = delabk(bb(il), bb(j), xnuii, xnujj, xmu(il), xmu(j), 0)
2345 dab1lu(ii,jj,il,j) = delabk(bb(il), bb(j), xnuii, xnujj, xmu(il), xmu(j), 1)
2356 gf4br = gamma_sp(4.0+br)
2357 gf4ds = gamma_sp(4.0+ds)
2358 gf4p5 = gamma_sp(4.0+0.5)
2359 gfcinu1 = gamma_sp(cinu + 1.0)
2360 gfcinu1p47 = gamma_sp(cinu + 1.47167)
2361 gfcinu2p47 = gamma_sp(cinu + 2.47167)
2362 gfcinu1p22 = gamma_sp(cinu + 1.22117)
2363 gfcinu2p22 = gamma_sp(cinu + 2.22117)
2364 gfcinu1p18 = gamma_sp(cinu + 1.18333)
2365 gfcinu2p18 = gamma_sp(cinu + 2.18333)
2367 gsnow1 = gamma_sp(snu + 1.0)
2368 gsnow53 = gamma_sp(snu + 5./3.)
2369 gsnow73 = gamma_sp(snu + 7./3.)
2371 IF ( lh .gt. 1 ) cwchtmp0 = 6.0/pi*gamma_sp( (xnu(lh) + 1.)/xmu(lh) )/gamma_sp( (xnu(lh) + 2.)/xmu(lh) )
2372 IF ( lhl .gt. 1 ) cwchltmp0 = 6.0/pi*gamma_sp( (xnu(lhl) + 1)/xmu(lhl) )/gamma_sp( (xnu(lhl) + 2)/xmu(lhl) )
2379 iexy(ls,lc) = ieswc ; iexy(ls,lr) = ieswr ;
2382 iexy(lh,ls) = iehwsw ; iexy(lh,li) = iehwi ;
2383 iexy(lh,lc) = iehwc ; iexy(lh,lr) = iehwr ;
2386 IF (lhl .gt. 1 )
THEN
2387 iexy(lhl,ls) = iehlsw ; iexy(lhl,li) = iehli ;
2388 iexy(lhl,lc) = iehlc ; iexy(lhl,lr) = iehlr ;
2402SUBROUTINE nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw, chl, &
2403 cn, vhw, vhl, cna, cni, f_cn, f_cna, f_cina, &
2404 f_qc, f_qr, f_qi, f_qs, f_qh, f_qhl, &
2405 cn_nu, cn_co, cinp, f_cnnu, f_cnco, f_cinp, &
2406 cna_co, cna_nu, f_cnaco, f_cnanu, &
2407 cnuf, f_cnuf, cn_ac, f_cnac, &
2408 zrw, zhw, zhl, f_zrw, f_zhw, f_zhl, f_vhw, f_vhl, &
2410 tt, th, pii, p, w, dn, dz, dtp, itimestep, &
2412 ntmul, ntcnt, lastloop, &
2416 SNOWNC, SNOWNCV, GRPLNC, GRPLNCV, &
2417 SR,HAILNC, HAILNCV, &
2418 hail_maxk1, hail_max2d, nwp_diagnostics, &
2420 re_cloud, re_ice, re_snow, re_rain, &
2421 re_graup, re_hail, &
2422 has_reqc, has_reqi, has_reqs, has_reqr, &
2423 has_reqg, has_reqh, &
2424 rainncw2, rainnci2, &
2426 rscghis_2d,rscghis_2dp,rscghis_2dn, &
2427 scr,scw,sci,scs,sch,schl,sctot, &
2429 induc,elecz,scion,sciona,f_scion,f_sciona, &
2430 noninduc,noninducp,noninducn, &
2431 ssat3d,ssati,nssl_ssat_output, &
2432 pcc2, pre2, depsubr, &
2433 mnucf2, melr2, ctr2, &
2434 rim1_2, rim2_2,rim3_2, &
2435 nctr2, nnuccd2, nnucf2, &
2436 effc2,effr2,effi2, &
2438 fc2, fr2,fi2,fs2,fg2, &
2439 fnc2, fnr2,fni2,fns2,fng2, &
2440! qcond,qdep,qfrz,qrauto,qhcnvi,qhcollw,qscollw, &
2441! ncauto, niinit,nifrz, &
2442! re_liquid, re_graupel, re_hail, re_icesnow, &
2443! vtcloud, vtrain, vtsnow, vtgraupel, vthail, &
2448 nssl_progn, & ! wrf-chem
2449! 20130903 acd_mb_washout start
2450 wetscav_on, rainprod, evapprod, & ! wrf-chem
2451! 20130903 acd_mb_washout end
2452 cu_used, qrcuten, qscuten, qicuten, qccuten, & ! hm added
2453 ids,ide, jds,jde, kds,kde, & ! domain dims
2454 ims,ime, jms,jme, kms,kme, & ! memory dims
2455 its,ite, jts,jte, kts,kte)
2466 integer,
intent(in):: &
2467 ids,ide, jds,jde, kds,kde, &
2468 ims,ime, jms,jme, kms,kme, &
2469 its,ite, jts,jte, kts,kte
2470 real,
dimension(ims:ime, kms:kme, jms:jme),
intent(inout):: &
2473 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: &
2477 qi,qhl,ccw,crw,cci,csw,chw,chl,vhw,vhl
2478 integer,
optional,
intent(in) :: is_theta_or_temp
2479 logical,
optional,
intent(in) :: f_zrw, f_zhw, f_zhl, f_vhw, f_vhl
2480 integer,
optional,
intent(in) :: nssl_ssat_output
2481 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: dbz, vzf, cn, cna, cni, cnuf
2482 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: cn_nu, cn_ac, cn_co, cinp, cna_co, cna_nu
2483 logical,
optional,
intent(in) :: f_cnnu, f_cnac, f_cnco, f_cinp, f_cnaco, f_cnanu
2485 real,
dimension(ims:ime, jms:jme),
optional,
intent(inout):: compdbz
2486 real,
dimension(ims:ime, jms:jme),
optional,
intent(inout):: rscghis_2d, &
2490 integer,
optional,
intent(in) :: elec_physics
2491 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: &
2492 scr,scw,sci,scs,sch,schl,sciona,sctot
2493 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: &
2494 induc,noninduc,noninducp,noninducn
2495 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(in) :: elecz
2496 real,
dimension(ims:ime, kms:kme, jms:jme, 2),
optional,
intent(inout) :: scion
2497 real,
dimension(ims:ime, kms:kme, jms:jme),
intent(in):: p,w,dz,dn
2499 real,
dimension(ims:ime, kms:kme, jms:jme),
intent(in):: pii
2500 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout):: &
2502 pcc2, pre2, depsubr, &
2503 mnucf2, melr2, ctr2, &
2504 rim1_2, rim2_2,rim3_2, &
2505 nctr2, nnuccd2, nnucf2, &
2506 effc2,effr2,effi2, &
2508 fc2, fr2,fi2,fs2,fg2, &
2509 fnc2, fnr2,fni2,fns2,fng2
2515 real,
dimension(ims:ime, kms:kme, jms:jme),
optional,
intent(inout) :: axtra
2518 real,
dimension(ims:ime, jms:jme) :: &
2520 real,
dimension(ims:ime, jms:jme),
optional,
intent(inout):: &
2521 snownc,snowncv,grplnc,grplncv,sr
2522 real,
dimension(ims:ime, jms:jme),
optional,
intent(inout):: &
2524 real,
dimension(ims:ime, jms:jme),
optional,
intent(inout) :: hail_maxk1, hail_max2d
2525 integer,
optional,
intent(in) :: nwp_diagnostics
2527 integer,
parameter :: nproc = 1
2528 double precision :: proctot(nproc),proctotmpi(nproc)
2529 REAL,
DIMENSION(ims:ime, kms:kme, jms:jme),
optional,
INTENT(INOUT):: re_cloud, re_ice, re_snow, &
2530 re_rain, re_graup, re_hail
2531 REAL,
DIMENSION(ims:ime, kms:kme, jms:jme),
optional,
INTENT(IN):: tkediss
2532 INTEGER,
INTENT(IN),
optional :: has_reqc, has_reqi, has_reqs, has_reqr, has_reqg, has_reqh
2533 real,
dimension(ims:ime, jms:jme),
intent(out),
optional :: &
2535 real,
optional,
intent(in) :: dx,dy
2536 real,
intent(in) :: dtp
2537 integer,
intent(in) :: itimestep
2538 integer,
intent(in),
optional :: ntmul, ntcnt
2539 logical,
optional,
intent(in) :: lastloop
2540 logical,
optional,
intent(in) :: diagflag, f_cna, f_cn, f_cina, f_cnuf
2541 logical,
optional,
intent(in) :: f_qc, f_qr, f_qi, f_qs, f_qh, f_qhl
2542 logical,
optional,
intent(in) :: f_scion,f_sciona
2543 integer,
optional,
intent(in) :: ipelectmp, ke_diag, isedonly_in
2546 character(len=*),
intent( out) :: errmsg
2547 integer,
intent( out) :: errflg
2549 LOGICAL,
INTENT(IN),
OPTIONAL :: nssl_progn
2552 LOGICAL :: flag_qndrop
2553 LOGICAL :: flag_qnifa , flag_qnwfa
2554 logical :: flag_cnuf = .false.
2555 logical :: flag_ccn = .false.
2556 logical :: flag_qi = .true.
2557 logical :: has_reqr_local = .false., has_reqg_local = .false., has_reqh_local = .false.
2559 logical :: nwp_diagflag = .false.
2560 real :: cinchange, t7max,testmax,wmax
2566 REAL,
DIMENSION(ims:ime, kms:kme, jms:jme),
optional,
INTENT(INOUT):: rainprod, evapprod
2572 REAL,
DIMENSION(ims:ime, kms:kme, jms:jme),
optional,
INTENT(IN):: qrcuten, qscuten, qicuten, qccuten
2573 INTEGER,
optional,
intent(in) :: cu_used
2574 LOGICAL,
optional,
intent(in) :: wetscav_on
2579 real,
dimension(its:ite, 1, kts:kte) :: elec2
2581 real,
dimension(its:ite, kts:kte) :: rainprod2d, evapprod2d,tke2d
2582 real,
dimension(its:ite, 1, kts:kte, na) :: an, ancuten
2583 real,
dimension(its:ite, 1, kts:kte, nxtra) :: axtra2d
2584 real,
dimension(its:ite, 1, kts:kte, 3) :: alpha2d
2585 real,
dimension(its:ite, 1, kts:kte) :: t0,t1,t2,t3,t4,t5,t6,t7,t8,t9
2586 real,
dimension(its:ite, 1, kts:kte) :: dn1,t00,t77,ssat,pn,wn,dz2d,dz2dinv,dbz2d,vzf2d
2587 real,
dimension(its:ite, 1, na) :: xfall
2588 real,
dimension(its:ite, 1) :: hailmax1d,hailmaxk1
2589 real,
dimension(kts:kte, nproc) :: thproclocal
2590 integer,
parameter :: nor = 0, ng = 0
2591 integer :: nx,ny,nz,ngs
2592 integer ix,jy,kz,i,j,k,il,n
2594 real :: ssival, ssifac, t8s, t9s, qvapor
2596 double precision :: dp1
2600 integer :: vzflag0 = 0
2603 real,
parameter :: cnin20 = 1.0e3
2604 real,
parameter :: cnin10 = 5.0e1
2605 real,
parameter :: cnin1a = 4.5
2606 real,
parameter :: cnin2a = 12.96
2607 real,
parameter :: cnin2b = 0.639
2609 double precision :: cwmass1,cwmass2
2610 double precision :: rwmass1,rwmass2
2611 double precision :: icemass1,icemass2
2612 double precision :: swmass1,swmass2
2613 double precision :: grmass1,grmass2
2614 double precision :: hlmass1,hlmass2
2615 double precision :: wvol5,wvol10
2616 real :: tmp,dv,dv1,tmpchg
2620 double precision :: dt1,dt2
2621 double precision :: timesed,timesed1,timesed2,timesed3, timegs, timenucond, timedbz,zmaxsed
2622 double precision :: timevtcalc,timesetvt
2624 logical :: f_cnatmp, f_cinatmp, f_cnacotmp, f_cnanutmp
2625 logical :: has_wetscav
2627 integer :: kediagloc
2629 integer :: isedonly_local
2631 real :: ycent, y, emissrate, emissrate0, emissrate1, z, fac, factot
2632 real :: fach(kts:kte)
2634 logical,
parameter :: debugdriver = .false.
2636 integer :: loopcnt, loopmax, outerloopcnt
2637 logical :: lastlooptmp
2647 IF ( debugdriver )
write(0,*)
'N2M: entering routine'
2649 flag_qndrop = .false.
2650 flag_qnifa = .false.
2651 flag_qnwfa = .false.
2654 nwp_diagflag = .false.
2656 IF (
PRESENT ( nssl_progn ) ) flag_qndrop = nssl_progn
2657 IF (
present ( f_cnuf ) ) flag_cnuf = f_cnuf
2658 IF (
present ( nwp_diagnostics ) ) nwp_diagflag = ( nwp_diagnostics > 0 )
2660 IF (
present ( f_cn ) .and.
present( cn ) )
THEN
2662 ELSEIF (
present( cn ) )
THEN
2666 IF (
present( f_qi ) )
THEN
2669 IF ( ffrzs < 1.0 )
THEN
2676 IF ( .not. flag_qi .and. ffrzs < 1.0 ) ffrzs = 1.0
2679 IF (
PRESENT ( has_reqr ) ) has_reqr_local = has_reqr > 0
2680 IF (
PRESENT ( has_reqg ) ) has_reqg_local = has_reqg > 0
2681 IF (
PRESENT ( has_reqh ) ) has_reqh_local = has_reqh > 0
2685 lastlooptmp = .true.
2686 IF (
present( ntmul ) .and.
present( ntcnt ) .and.
present( lastloop ) )
THEN
2688 outerloopcnt = ntcnt
2689 lastlooptmp = lastloop
2693 has_wetscav = .false.
2694 IF ( wrfchem_flag > 0 )
THEN
2695 IF (
PRESENT( wetscav_on ) )
THEN
2696 has_wetscav = wetscav_on
2700 IF (
present( f_cna ) )
THEN
2706 IF (
present( f_cina ) )
THEN
2712 IF (
present( vzf ) ) vzflag0 = 1
2714 IF (
present( ipelectmp ) )
THEN
2720 IF (
present( isedonly_in ) )
THEN
2721 isedonly_local = isedonly_in
2736 IF (
present( dx ) .and.
present( dy ) )
THEN
2746 IF (
present( diagflag ) )
THEN
2747 makediag = diagflag .or. itimestep == 1
2750 IF ( debugdriver )
write(0,*)
'N2M: makediag = ',makediag
2758 IF ( .not. flag_ccn )
THEN
2772 IF ( infall .ne. 1 .or. iscfall .ge. 2 )
THEN
2778 IF ( any(linfall(:) .ge. 3 ) .or. ipconc .ge. 6 )
THEN
2782 IF (
present( hailncv ) .and. lhl < 1 )
THEN
2783 hailncv(its:ite,jts:jte) = 0.
2793 IF (
present( compdbz ) .and. makediag )
THEN
2796 compdbz(ix,jy) = -3.0
2813 IF ( debugdriver )
write(0,*)
'N2M: jy loop 1, lhl,na = ',lhl,na,
present(qhl)
2815 ancuten(its:ite,1,kts:kte,:) = 0.0
2816 thproclocal(:,:) = 0.0
2823 IF ( (
present( pcc2 ) .or.
present( axtra ) ) .and. makediag )
THEN
2824 axtra2d(its:ite,1,kts:kte,:) = 0.0
2827 IF ( nwp_diagflag )
THEN
2828 alpha2d(its:ite,1,kts:kte,1) = alphar
2829 alpha2d(its:ite,1,kts:kte,2) = alphah
2830 alpha2d(its:ite,1,kts:kte,3) = alphahl
2838 IF (
present( tt ) )
THEN
2839 an(ix,1,kz,lt) = tt(ix,kz,jy)/pii(ix,kz,jy)
2841 an(ix,1,kz,lt) = th(ix,kz,jy)
2843 an(ix,1,kz,lv) = qv(ix,kz,jy)
2844 an(ix,1,kz,lc) = qc(ix,kz,jy)
2845 an(ix,1,kz,lr) = qr(ix,kz,jy)
2847 an(ix,1,kz,li) = qi(ix,kz,jy)
2849 an(ix,1,kz,li) = 0.0
2851 an(ix,1,kz,ls) = qs(ix,kz,jy)
2852 an(ix,1,kz,lh) = qh(ix,kz,jy)
2853 IF ( lhl > 1 ) an(ix,1,kz,lhl) = qhl(ix,kz,jy)
2854 IF ( lccn > 1 )
THEN
2855 IF ( is_aerosol_aware .and. flag_qnwfa )
THEN
2857 ELSEIF ( flag_ccn )
THEN
2858 IF ( lccna > 1 .and. .not. (
present( cna ) .and. f_cnatmp ) )
THEN
2859 an(ix,1,kz,lccna) = cn(ix,kz,jy)
2860 an(ix,1,kz,lccn) = qccn
2862 an(ix,1,kz,lccn) = cn(ix,kz,jy)
2864 IF ( i_uf_or_ccn > 0 .and. lccnuf > 1 )
THEN
2865 an(ix,1,kz,lccn) = an(ix,1,kz,lccn) + cnuf(ix,kz,jy)
2868 IF ( lccna == 0 .and. ( .not. f_cnatmp ) )
THEN
2869 an(ix,1,kz,lccn) = qccn - ccw(ix,kz,jy)
2871 an(ix,1,kz,lccn) = qccn
2877 IF ( lccnuf > 0 .and. flag_cnuf )
THEN
2878 IF ( i_uf_or_ccn == 0 )
THEN
2879 an(ix,1,kz,lccnuf) = max(0.0, cnuf(ix,kz,jy) )
2881 an(ix,1,kz,lccnuf) = 0.0
2885 IF ( lccna > 1 )
THEN
2886 IF (
present( cna ) .and. f_cnatmp )
THEN
2887 an(ix,1,kz,lccna) = max(0.0, cna(ix,kz,jy) )
2891 IF ( lcina > 1 )
THEN
2892 IF (
present( cni ) .and. f_cinatmp )
THEN
2893 an(ix,1,kz,lcina) = cni(ix,kz,jy)
2897 IF ( ipconc >= 5 )
THEN
2898 an(ix,1,kz,lnc) = ccw(ix,kz,jy)
2899 IF ( constccw > 0.0 )
THEN
2900 an(ix,1,kz,lnc) = constccw
2902 an(ix,1,kz,lnr) = crw(ix,kz,jy)
2903 IF (
present( cci ) )
THEN
2904 an(ix,1,kz,lni) = cci(ix,kz,jy)
2906 an(ix,1,kz,lni) = 0.0
2908 an(ix,1,kz,lns) = csw(ix,kz,jy)
2909 an(ix,1,kz,lnh) = chw(ix,kz,jy)
2910 IF ( lhl > 1 ) an(ix,1,kz,lnhl) = chl(ix,kz,jy)
2912 IF ( lvh > 0 .and.
present( vhw ) ) an(ix,1,kz,lvh) = vhw(ix,kz,jy)
2913 IF ( lvhl > 0 .and.
present( vhl ) ) an(ix,1,kz,lvhl) = vhl(ix,kz,jy)
2915 IF ( ipconc >= 6 )
THEN
2916 IF ( lzr > 0 ) an(ix,1,kz,lzr) = zrw(ix,kz,jy)*zscale
2917 IF ( lzh > 0 ) an(ix,1,kz,lzh) = zhw(ix,kz,jy)*zscale
2918 IF ( lzhl > 0 ) an(ix,1,kz,lzhl) = zhl(ix,kz,jy)*zscale
2930 IF (
present( tt ) )
THEN
2931 t0(ix,1,kz) = tt(ix,kz,jy)
2933 t0(ix,1,kz) = th(ix,kz,jy)*pii(ix,kz,jy)
2935 t00(ix,1,kz) = 380.0/p(ix,kz,jy)
2936 t77(ix,1,kz) = pii(ix,kz,jy)
2937 dbz2d(ix,1,kz) = 0.0
2938 vzf2d(ix,1,kz) = 0.0
2943 rainncv(ix,jy) = 0.0
2944 IF (
present( grplncv ) ) grplncv(ix,jy) = 0.0
2945 IF (
present( hailncv ) ) hailncv(ix,jy) = 0.0
2946 IF (
present( snowncv ) ) snowncv(ix,jy) = 0.0
2949 DO loopcnt = 1,loopmax
2965 pn(ix,1,kz) = p(ix,kz,jy)
2966 wn(ix,1,kz) = w(ix,kz,jy)
2968 dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
2970 dz2d(ix,1,kz) = dz(ix,kz,jy)
2971 dz2dinv(ix,1,kz) = 1./dz(ix,kz,jy)
2973 ltemq = int( (t0(ix,1,kz)-163.15)/fqsat+1.5 )
2974 ltemq = min( nqsat, max(1,ltemq) )
2978 IF ( iqvsopt == 0 )
THEN
2979 t8s = t00(ix,1,kz)*tabqvs(ltemq)
2981 t8s = rdorv*esbolton*tabqvs(ltemq)/(pn(ix,1,kz) - esbolton*tabqvs(ltemq))
2983 t9s = t00(ix,1,kz)*tabqis(ltemq)
2988 ssival = min(t8s,max(an(ix,1,kz,lv),0.0))/t9s
2991 if ( ssival .gt. 1.0 )
then
2993 IF ( icenucopt == 1 )
THEN
2995 if ( t0(ix,1,kz).le.268.15 )
then
2997 dp1 = dn1(ix,1,kz)/rho00*cnin20*exp( min( 57.0 ,(cnin2a*(ssival-1.0)-cnin2b) ) )
2998 t7(ix,1,kz) = min(dp1, 1.0d30)
3004 IF ( imeyers5 )
THEN
3005 if ( t0(ix,1,kz).lt.tfr .and. t0(ix,1,kz).gt.268.15 )
then
3006 qvapor = max(an(ix,1,kz,lv),0.0)
3008 if ( (qvapor-t9s) .gt. 1.0e-5 )
then
3009 if ( (t8s-t9s) .gt. 1.0e-5 )
then
3010 ssifac = (qvapor-t9s) /(t8s-t9s)
3011 ssifac = ssifac**cnin1a
3014 t7(ix,1,kz) = dn1(ix,1,kz)/rho00*cnin10*ssifac*exp(-(t0(ix,1,kz)-tfr)*bta1)
3020 ELSEIF ( icenucopt == 2 )
THEN
3025 t7(ix,1,kz) = 1000.*0.00446684*exp(0.3108*(273.16 - max(233.0, t0(ix,1,kz) ) ) )
3029 ELSEIF ( icenucopt == 3 )
THEN
3031 if ( t0(ix,1,kz).le.268.15 .and. t0(ix,1,kz) > 243.15 )
then
3033 dp1 = 0.06*cnin20*exp( min( 57.0 ,(cnin2a*(ssival-1.0)-cnin2b) ) )
3034 t7(ix,1,kz) = min(dp1, 1.0d30)
3035 elseif ( t0(ix,1,kz) <= 243.15 )
then
3036 dp1 = 1000.*( exp( min( 57.0 ,cnin2a*(ssival-1.1) ) ) )**0.3
3037 t7(ix,1,kz) = min(dp1, 1.0d30)
3041 ELSEIF ( icenucopt == 4 )
THEN
3043 IF ( t0(ix,1,kz) < 268.16 .and. t0(ix,1,kz) > 223.15 .and. ssival > 1.001 )
THEN
3052 dp1 = 1.e3*dn1(ix,1,kz)/rho00*0.0000594*(273.16 - t0(ix,1,kz))**3.33 * tmp**(0.0264*(273.16 - t0(ix,1,kz)) + 0.0033)
3053 t7(ix,1,kz) = min(dp1, 1.0d30)
3069 IF ( wrfchem_flag > 0 )
THEN
3070 IF ( has_wetscav )
THEN
3071 IF (
PRESENT( rainprod ) ) rainprod2d(its:ite,kts:kte) = 0
3072 IF (
PRESENT( evapprod ) ) evapprod2d(its:ite,kts:kte) = 0
3079 IF ( loopcnt == 1 )
THEN
3081 IF ( denscale(il) == 1 )
THEN
3084 an(ix,1,kz,il) = an(ix,1,kz,il)*dn1(ix,1,kz)
3100 IF ( itimestep == 1 .and. ipconc > 0 .and. loopcnt == 1 )
THEN
3104 IF (
present(cu_used) .and. &
3105 (
present( qrcuten ) .or.
present( qscuten ) .or. &
3106 present( qicuten ) .or.
present( qccuten ) ) )
THEN
3108 IF ( cu_used == 1 )
THEN
3112 IF (
present( qrcuten ) ) ancuten(ix,1,kz,lr) = dtp*qrcuten(ix,kz,jy)
3113 IF (
present( qscuten ) ) ancuten(ix,1,kz,ls) = dtp*qscuten(ix,kz,jy)
3114 IF (
present( qicuten ) ) ancuten(ix,1,kz,li) = dtp*qicuten(ix,kz,jy)
3115 IF (
present( qccuten ) ) ancuten(ix,1,kz,lc) = dtp*qccuten(ix,kz,jy)
3120 call calcnfromcuten(nx,ny,nz,ancuten,an,na,nor,nor,dn1)
3127 IF ( isedonly_local == 0 )
THEN
3129 call sediment1d(dtp,nx,ny,nz,an,na,nor,nor,xfall,dn1,dz2d,dz2dinv, &
3130 & t0,t7,infdo,jy,its,jts &
3131 & ,timesed1,timesed2,timesed3,zmaxsed,timesetvt)
3136 IF ( debugdriver )
write(0,*)
'N2M: end sediment, jy = ',jy
3140 rainncv(ix,jy) = rainncv(ix,jy) + &
3141 dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
3142 & xfall(ix,1,lh)*1000./xdn0(lr) + xfall(ix,1,lhl)*1000./xdn0(lr) )
3144 rainncv(ix,jy) = rainncv(ix,jy) + &
3145 dtp*dn1(ix,1,1)*(xfall(ix,1,lr) + xfall(ix,1,ls)*1000./xdn0(lr) + &
3146 & xfall(ix,1,lh)*1000./xdn0(lr) )
3148 IF (
present ( rainncw2 ) )
THEN
3149 rainncw2(ix,jy) = rainncw2(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,lr)
3151 IF (
present ( rainnci2 ) )
THEN
3153 rainnci2(ix,jy) = rainnci2(ix,jy) + dtp*dn1(ix,1,1)*(xfall(ix,1,ls)*1000./xdn0(lr) + &
3154 & xfall(ix,1,lh)*1000./xdn0(lr) + xfall(ix,1,lhl)*1000./xdn0(lr) )
3156 rainnci2(ix,jy) = rainnci2(ix,jy) + dtp*dn1(ix,1,1)*(xfall(ix,1,ls)*1000./xdn0(lr) + &
3157 & xfall(ix,1,lh)*1000./xdn0(lr) )
3160 IF (
present( snowncv ) ) snowncv(ix,jy) = snowncv(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,ls)*1000./xdn0(lr)
3161 IF (
present( grplncv ) )
THEN
3162 IF ( lhl > 1 .and. .not.
present( hailnc) )
THEN
3163 grplncv(ix,jy) = grplncv(ix,jy) + dtp*dn1(ix,1,1)*(xfall(ix,1,lh) + xfall(ix,1,lhl)) *1000./xdn0(lr)
3165 grplncv(ix,jy) = grplncv(ix,jy) + dtp*dn1(ix,1,1)*xfall(ix,1,lh)*1000./xdn0(lr)
3168 IF ( loopcnt == loopmax ) rainnc(ix,jy) = rainnc(ix,jy) + rainncv(ix,jy)
3170 IF (
present (snownc) .and.
present (snowncv) .and. loopcnt == loopmax )
THEN
3171 snownc(ix,jy) = snownc(ix,jy) + snowncv(ix,jy)
3174 IF (
present( hailnc ) )
THEN
3175 hailncv(ix,jy) = dtp*dn1(ix,1,1)*xfall(ix,1,lhl)*1000./xdn0(lr)
3176 IF ( loopcnt == loopmax ) hailnc(ix,jy) = hailnc(ix,jy) + hailncv(ix,jy)
3181 IF (
present( grplncv ) .and. loopcnt == loopmax )
THEN
3182 grplnc(ix,jy) = grplnc(ix,jy) + grplncv(ix,jy)
3184 IF (
present( sr ) .and.
present (snowncv) .and.
present(grplncv) .and. loopcnt == loopmax )
THEN
3185 IF (
present( hailnc ) )
THEN
3186 sr(ix,jy) = (snowncv(ix,jy)+hailncv(ix,jy)+grplncv(ix,jy))/(rainncv(ix,jy)+1.e-12)
3188 sr(ix,jy) = (snowncv(ix,jy)+grplncv(ix,jy))/(rainncv(ix,jy)+1.e-12)
3197 IF ( isedonly /= 1 )
THEN
3200 IF ( debugdriver )
write(0,*)
'N2M: gs, jy = ',jy
3208 & ,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9 &
3212 & ventr,ventc,c1sw,1,ido, &
3216 & xdn0,dbz2d,tke2d, &
3217 & thproclocal,nproc,dx1,dy1,ngs, &
3218 & timevtcalc,axtra2d, makediag &
3219 & ,has_wetscav, rainprod2d, evapprod2d, alpha2d &
3221 & ,elec2,its,ids,ide,jds,jde &
3229 dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
3246 & ,axtra2d, makediag &
3247 & ,ssat,t00,t77,flag_qndrop)
3260 dn1(ix,1,kz) = rdorv*pn(ix,1,kz)/(rd*t0(ix,1,kz)*(an(ix,1,kz,lv) + rdorv))
3271 IF (
present( pcc2 ) .and. makediag )
THEN
3281 IF ( (
present( ssat3d ) .and.
present( nssl_ssat_output ) ) .and. makediag )
THEN
3287 ltemq = int( (temp1-163.15)/fqsat+1.5 )
3288 ltemq = min( nqsat, max(1,ltemq) )
3290 IF (
present( ssat3d ) .and. nssl_ssat_output >= 1 )
THEN
3293 IF ( iqvsopt == 0 )
THEN
3294 c1 = (380.0/pn(ix,1,kz))*tabqvs(ltemq)
3295 ELSEIF ( iqvsopt == 1 )
THEN
3296 c1 = rdorv*esbolton*tabqvs(ltemq)/(pn(ix,1,kz) - esbolton*tabqvs(ltemq))
3300 ssat3d(ix,kz,jy) = 100.*(an(ix,1,kz,lv)/c1 - 1.0)
3305 IF (
present( ssati ) .and. nssl_ssat_output >= 2 )
THEN
3306 t9s = (380.0/pn(ix,1,kz))*tabqis(ltemq)
3307 ssati(ix,kz,jy) = 100.*(an(ix,1,kz,lv)/t9s - 1.0)
3317 IF (
present( dbz ) .and. makediag .and. lastlooptmp )
THEN
3321 IF (
present(ke_diag) )
THEN
3326 call radardd02(nx,ny,nz,nor,na,an,t0, &
3327 & dbz2d,dn1,nz,cnoh,rho_qh,ipconc,kediagloc, 0)
3331 DO kz = kts,kediagloc
3333 dbz(ix,kz,jy) = dbz2d(ix,1,kz)
3334 IF (
present( vzf ) )
THEN
3335 vzf(ix,kz,jy) = vzf2d(ix,1,kz)
3336 IF ( dbz2d(ix,1,kz) <= 0.0 )
THEN
3338 ELSEIF ( dbz2d(ix,1,kz) <= 15.0 )
THEN
3339 refl = 10**(0.1*dbz2d(ix,1,kz))
3340 vzf(ix,kz,jy) = min( vzf2d(ix,1,kz), 2.6 * max(0.0,refl)**0.107 * (1.2/dn1(ix,1,kz))**0.4 )
3343 IF (
present( compdbz ) )
THEN
3344 compdbz(ix,jy) = max( compdbz(ix,jy), dbz2d(ix,1,kz) )
3354 IF (
present( has_reqc ).and.
present( has_reqi ) .and.
present( has_reqs ) .and. &
3355 present( re_cloud ).and.
present( re_ice ) .and.
present( re_snow ) .and. &
3357 IF ( has_reqc.ne.0 .or. has_reqi.ne.0 .or. has_reqs.ne.0)
THEN
3360 re_cloud(ix,kz,jy) = 2.51e-6
3361 re_ice(ix,kz,jy) = 10.01e-6
3362 re_snow(ix,kz,jy) = 25.e-6
3363 t1(ix,1,kz) = 2.51e-6
3364 t2(ix,1,kz) = 10.01e-6
3365 t3(ix,1,kz) = 25.e-6
3366 t4(ix,1,kz) = 50.e-6
3374 & ,t1=t1,t2=t2,t3=t3,t4=t4,t5=t5,t6=t6 &
3375 & ,f_t4=has_reqr_local,f_t5=has_reqg_local, f_t6=has_reqh_local &
3380 re_cloud(ix,kz,jy) = max(2.51e-6, min(t1(ix,1,kz), 50.e-6))
3381 re_ice(ix,kz,jy) = max(10.01e-6, min(t2(ix,1,kz), 125.e-6))
3382 re_snow(ix,kz,jy) = max(25.e-6, min(t3(ix,1,kz), 999.e-6))
3384 IF ( .not.
present(qi) ) re_ice(ix,kz,jy) = max(10.e-6, min(t3(ix,1,kz), 125.e-6))
3388 IF (
present(has_reqr) .and.
present( re_rain ) )
THEN
3389 IF ( has_reqr /= 0 )
THEN
3392 re_rain(ix,kz,jy) = max(50.e-6, min(t4(ix,1,kz), 2999.e-6))
3398 IF (
present(has_reqg) .and.
present( re_graup ) )
THEN
3399 IF ( has_reqg /= 0 )
THEN
3402 re_graup(ix,kz,jy) = max(50.e-6, min(t5(ix,1,kz), 10.e-3))
3408 IF (
present(has_reqh) .and.
present( re_hail ) )
THEN
3409 IF ( has_reqh /= 0 )
THEN
3412 re_hail(ix,kz,jy) = max(50.e-6, min(t5(ix,1,kz), 40.e-3))
3422 IF (
present( hail_maxk1 ) .and.
present( hail_max2d ) .and. nwp_diagflag )
THEN
3424 hailmax1d(ix,1) = hail_max2d(ix,jy)
3425 hailmaxk1(ix,1) = hail_maxk1(ix,jy)
3428 call hailmaxd(dtp,nx,ny,nz,an,na,nor,nor,alpha2d,dn1, &
3429 hailmax1d,hailmaxk1,1 )
3432 hail_max2d(ix,jy) = hailmax1d(ix,1)
3433 hail_maxk1(ix,jy) = hailmaxk1(ix,1)
3440 IF ( denscale(il) == 1 )
THEN
3443 an(ix,1,kz,il) = an(ix,1,kz,il)/dn1(ix,1,kz)
3455 IF (
present( tt ) )
THEN
3456 tt(ix,kz,jy) = t0(ix,1,kz)
3458 th(ix,kz,jy) = an(ix,1,kz,lt)
3461 qv(ix,kz,jy) = an(ix,1,kz,lv)
3462 qc(ix,kz,jy) = an(ix,1,kz,lc)
3463 qr(ix,kz,jy) = an(ix,1,kz,lr)
3464 IF ( flag_qi ) qi(ix,kz,jy) = an(ix,1,kz,li)
3465 qs(ix,kz,jy) = an(ix,1,kz,ls)
3466 qh(ix,kz,jy) = an(ix,1,kz,lh)
3467 IF ( lhl > 1 ) qhl(ix,kz,jy) = an(ix,1,kz,lhl)
3469 IF ( lccn > 1 .and. is_aerosol_aware .and. flag_qnwfa )
THEN
3471 ELSEIF ( flag_ccn .and. lccn > 1 .and. .not. flag_qndrop)
THEN
3472 IF ( lccna > 1 .and. .not. (
present( cna ) .and. f_cnatmp ) )
THEN
3473 cn(ix,kz,jy) = max(0.0, an(ix,1,kz,lccna) )
3475 cn(ix,kz,jy) = an(ix,1,kz,lccn)
3478 IF ( lccna > 1 )
THEN
3479 IF (
present( cna ) .and. f_cnatmp )
THEN
3480 cna(ix,kz,jy) = max(0.0, an(ix,1,kz,lccna) )
3484 IF ( lcina > 1 )
THEN
3485 IF (
present( cni ) .and. f_cinatmp )
THEN
3486 cni(ix,kz,jy) = max(0.0, an(ix,1,kz,lcina) )
3490 IF ( lccnuf > 0 .and. flag_cnuf )
THEN
3491 IF ( i_uf_or_ccn > 0 )
THEN
3492 an(ix,1,kz,lccnuf) = max(0.0, cnuf(ix,kz,jy) )
3494 IF ( decayufccn )
THEN
3495 IF ( an(ix,1,kz,lccnuf) > ufbackground )
THEN
3496 an(ix,1,kz,lccnuf) = an(ix,1,kz,lccnuf) - (an(ix,1,kz,lccnuf) - &
3497 ufbackground)*(1.0 - exp(-dtp/ufccntimeconst))
3500 cnuf(ix,kz,jy) = an(ix,1,kz,lccnuf)
3505 IF ( ipconc >= 5 )
THEN
3507 ccw(ix,kz,jy) = an(ix,1,kz,lnc)
3508 crw(ix,kz,jy) = an(ix,1,kz,lnr)
3509 IF (
present( cci ) ) cci(ix,kz,jy) = an(ix,1,kz,lni)
3510 csw(ix,kz,jy) = an(ix,1,kz,lns)
3511 chw(ix,kz,jy) = an(ix,1,kz,lnh)
3512 IF ( lhl > 1 ) chl(ix,kz,jy) = an(ix,1,kz,lnhl)
3515 IF ( ipconc >= 6 )
THEN
3516 IF ( lzr > 0 ) zrw(ix,kz,jy) = an(ix,1,kz,lzr) *zscaleinv
3517 IF ( lzh > 0 ) zhw(ix,kz,jy) = an(ix,1,kz,lzh) *zscaleinv
3518 IF ( lzhl > 0 ) zhl(ix,kz,jy) = an(ix,1,kz,lzhl)*zscaleinv
3523 IF ( lvh > 0 .and.
present( vhw ) ) vhw(ix,kz,jy) = an(ix,1,kz,lvh)
3524 IF ( lvhl > 0 .and.
present( vhl ) ) vhl(ix,kz,jy) = an(ix,1,kz,lvhl)
3526#if ( WRF_CHEM == 1 )
3527 IF ( has_wetscav )
THEN
3528 IF ( loopmax > 1 )
THEN
3531 IF (
PRESENT( rainprod ) ) rainprod(ix,kz,jy) = rainprod2d(ix,kz)
3532 IF (
PRESENT( evapprod ) ) evapprod(ix,kz,jy) = evapprod2d(ix,kz)
3557 REAL function gamma_sp(xx)
3563 double precision :: ser,stp,tmp,x,y,cof(6)
3565 DATA cof /76.18009172947146d+0, &
3566 & -86.50532032941677d0, &
3567 & 24.01409824083091d0, &
3568 & -1.231739572450155d0, &
3569 & 0.1208650973866179d-2,&
3570 & -0.5395239384953d-5/
3571 DATA stp/2.5066282746310005d0/
3573 IF ( xx <= 0.0 )
THEN
3574 write(0,*)
'Argument to gamma must be > 0!! xx = ',xx
3580 tmp = (x + 0.5d0)*log(tmp) - tmp
3581 ser = 1.000000000190015d0
3584 ser = ser + cof(j)/y
3586 gamma_sp = exp(tmp + log(stp*ser/x))
3589 END FUNCTION gamma_sp
3595 DOUBLE PRECISION FUNCTION gamma_dpr(x)
3599 double precision :: xx
3603 gamma_dpr = gamma_dp(xx)
3606 end FUNCTION gamma_dpr
3615 real function gamxinf(a1,x1)
3629 double precision :: xam,dlog,s,r,ga,t0,a,x
3631 double precision :: gin, gim
3635 IF ( x1 <= 0.0 )
THEN
3636 gamxinf = gamma_sp(a1)
3640 IF (xam.GT.700.0.OR.a.GT.170.0)
THEN
3641 WRITE(*,*)
'a and/or x too large'
3646 ELSE IF (x.LE.1.0+a)
THEN
3652 IF (dabs(r/s).LT.1.0d-15)
GO TO 15
3657 ELSE IF (x.GT.1.0+a)
THEN
3660 t0=(k-a)/(1.0d0+k/(x+t0))
3662 gim=dexp(xam)/(x+t0)
3669 END function gamxinf
3675 double precision function gamxinfdp(A1,X1)
3691 double precision :: xam,dlog,s,r,ga,t0,a,x
3693 double precision :: gin, gim
3697 IF ( x1 <= 0.0 )
THEN
3698 gamxinfdp = gamma_dp(a)
3702 IF (xam.GT.700.0.OR.a.GT.170.0)
THEN
3703 WRITE(*,*)
'a and/or x too large'
3708 ELSE IF (x.LE.1.0+a)
THEN
3714 IF (dabs(r/s).LT.1.0d-15)
GO TO 15
3719 ELSE IF (x.GT.1.0+a)
THEN
3722 t0=(k-a)/(1.0d0+k/(x+t0))
3724 gim=dexp(xam)/(x+t0)
3731 END function gamxinfdp
3738 real function gaminterp(ratio, alp, luindex, ilh)
3742 real,
intent(in) :: ratio, alp
3743 integer,
intent(in) :: ilh
3744 integer,
intent(in) :: luindex
3752 real :: delx, dely, tmp1, tmp2, temp3
3753 integer :: i,j,ip1,jp1
3758 i = min(nqiacrratio,int(ratio*dqiacrratioinv))
3759 j = int(max(0.0,min(maxalphalu,alp))*dqiacralphainv)
3760 delx = min(maxratiolu,ratio) - float(i)*dqiacrratio
3761 dely = alp - float(j)*dqiacralpha
3762 ip1 = min( i+1, nqiacrratio )
3763 jp1 = min( j+1, nqiacralpha )
3766 tmp1 = gamxinflu(i,j,luindex,ilh) + delx*dqiacrratioinv* &
3767 & (gamxinflu(ip1,j,luindex,ilh) - gamxinflu(i,j,luindex,ilh))
3768 tmp2 = gamxinflu(i,jp1,luindex,ilh) + delx*dqiacrratioinv* &
3769 & (gamxinflu(ip1,jp1,luindex,ilh) - gamxinflu(i,jp1,luindex,ilh))
3773 gaminterp = (tmp1 + dely*dqiacralphainv*(tmp2 - tmp1))
3780 END FUNCTION gaminterp
3790 real function gaml02(x)
3792 integer ig, i, ii, n, np
3796 real gamxg(ng), xg(ng)
3797 DATA xg/0.01,0.02,0.025,0.04,0.075,0.1,0.25,0.5,0.75,1.,2.,10./
3799 & 7.391019203578037e-8,0.02212726874591478,0.06959352407989682, &
3800 & 0.2355654024970809,0.46135930387500346,0.545435791452399, &
3801 & 0.7371571313308203, &
3802 & 0.8265676632204345,0.8640182781845841,0.8855756211304151, &
3803 & 0.9245079225301251, &
3804 & 0.9712578342732681/
3805 IF ( x .ge. xg(ng) )
THEN
3809 IF ( x .lt. xg(1) )
THEN
3817 IF ( x .ge. xg(i) )
THEN
3819 gaml02 = gamxg(n)+((x-xg(n))/(xg(np)-xg(n)))* &
3820 & ( gamxg(np) - gamxg(n) )
3834 real function gaml02d300(x)
3836 integer ig, i, ii, n, np
3840 real gamxg(ng), xg(ng)
3841 DATA xg/0.04,0.075,0.1,0.25,0.5,0.75,1.,2.,10./
3844 & 7.391019203578011e-8,0.0002260640810600053, &
3845 & 0.16567071824457152, &
3846 & 0.4231369044918005,0.5454357914523988, &
3847 & 0.6170290936864555, &
3848 & 0.7471346054110058,0.9037156157718299 /
3849 IF ( x .ge. xg(ng) )
THEN
3853 IF ( x .lt. xg(1) )
THEN
3861 IF ( x .ge. xg(i) )
THEN
3863 gaml02d300 = gamxg(n)+((x-xg(n))/(xg(np)-xg(n)))* &
3864 & ( gamxg(np) - gamxg(n) )
3869 END FUNCTION gaml02d300
3882 real function gaml02d500(x)
3884 integer ig, i, ii, n, np
3888 real gamxg(ng), xg(ng)
3889 DATA xg/0.04,0.075,0.1,0.25,0.5,0.75,1.,2.,10./
3892 & 2.2346039e-13, 0.0221272687459, &
3893 & 0.23556540, 0.38710348, &
3894 & 0.48136183,0.6565833, &
3896 IF ( x .ge. xg(ng) )
THEN
3900 IF ( x .lt. xg(1) )
THEN
3908 IF ( x .ge. xg(i) )
THEN
3910 gaml02d500 = gamxg(n)+((x-xg(n))/(xg(np)-xg(n)))* &
3911 & ( gamxg(np) - gamxg(n) )
3916 END FUNCTION gaml02d500
3924 real function beta(p,q)
3936 double precision p1,gp,q1,gq, ppq,gpq
3944 CALL gammadp(ppq,gpq)
3954 DOUBLE PRECISION FUNCTION gamma_dp(xx)
3957 double precision :: xx
3960 double precision ser,stp,tmp,x,y,cof(6)
3962 DATA cof /76.18009172947146d+0, &
3963 & -86.50532032941677d0, &
3964 & 24.01409824083091d0, &
3965 & -1.231739572450155d0, &
3966 & 0.1208650973866179d-2,&
3967 & -0.5395239384953d-5/
3968 DATA stp/2.5066282746310005d0/
3973 tmp = (x + 0.5d0)*log(tmp) - tmp
3974 ser = 1.000000000190015d0
3977 ser = ser + cof(j)/y
3979 gamma_dp = exp(tmp + log(stp*ser/x))
3982 END function gamma_dp
3987 SUBROUTINE gammadp(X,GA)
3999 double precision,
parameter :: pi=3.141592653589793d0
4000 double precision :: x,ga,z,r,gr
4003 double precision :: g(26)
4005 DATA g/1.0d0,0.5772156649015329d0, &
4006 & -0.6558780715202538d0, -0.420026350340952d-1, &
4007 & 0.1665386113822915d0,-.421977345555443d-1, &
4008 & -.96219715278770d-2, .72189432466630d-2, &
4009 & -.11651675918591d-2, -.2152416741149d-3, &
4010 & .1280502823882d-3, -.201348547807d-4, &
4011 & -.12504934821d-5, .11330272320d-5, &
4012 & -.2056338417d-6, .61160950d-8, &
4013 & .50020075d-8, -.11812746d-8, &
4014 & .1043427d-9, .77823d-11, &
4015 & -.36968d-11, .51d-12, &
4016 & -.206d-13, -.54d-14, .14d-14, .1d-15/
4018 IF (x.EQ.int(x))
THEN
4019 IF (x.GT.0.0d0)
THEN
4029 IF (dabs(x).GT.1.0d0)
THEN
4045 IF (dabs(x).GT.1.0d0)
THEN
4047 IF (x.LT.0.0d0) ga=-pi/(x*ga*dsin(pi*x))
4051 END SUBROUTINE gammadp
4061 Function delbk(bb,nu,mu,k)
4085 tmp = ((1.0 + nu)/mu)
4086 i = int(dgami*(tmp))
4088 x1 = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4090 tmp = ((2.0 + nu)/mu)
4091 i = int(dgami*(tmp))
4093 x2 = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4095 tmp = ((1.0 + 2.0*bb + k + nu)/mu)
4096 i = int(dgami*(tmp))
4098 x3 = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4105 & ((x1/x2)**(2.0*bb + k)* &
4118 Function delabk(ba,bb,nua,nub,mua,mub,k)
4129 real g1pnua, g2pnua, g1pbapnua, g1pbbpk, g1pnub, g2pnub
4131 tmp = (1. + nua)/mua
4132 i = int(dgami*(tmp))
4134 IF ( i+1 > ngm0 )
THEN
4135 write(0,*)
'delabk: i+1 > ngm0!!!!',i,ngm0,nua,mua,tmp
4137 g1pnua = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4140 tmp = ((2. + nua)/mua)
4141 i = int(dgami*(tmp))
4143 g2pnua = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4145 tmp = ((1. + ba + nua)/mua)
4146 i = int(dgami*(tmp))
4148 g1pbapnua = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4150 tmp = ((1. + nub)/mub)
4151 i = int(dgami*(tmp))
4153 g1pnub = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4155 tmp = ((2 + nub)/mub)
4156 i = int(dgami*(tmp))
4158 g2pnub = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4160 tmp = ((1. + bb + k + nub)/mub)
4161 i = int(dgami*(tmp))
4163 g1pbbpk = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4166 & (2.*(g1pnua/g2pnua)**ba* &
4168 & (g1pnub/g2pnub)**(bb + k)* &
4182 subroutine hailmaxd(dtp,nx,ny,nz,an,na,nor,norz,alpha2d,dn, &
4183 & hailmax1d,hailmaxk1,jslab )
4196 integer nx,ny,nz,nor,norz,ngt,jgs,na,ia
4203 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
4204 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4208 real alpha2d(-nor+1:nx+nor,1,-norz+1:nz+norz,3)
4209 real :: hailmax1d(nx,ny),hailmaxk1(nx,ny)
4213 integer ix,jy,kz,ndfall,n,k,il,in
4214 double precision :: tmp, ratio, del, g1palp
4215 real,
parameter :: dz = 200.
4217 real :: db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1)
4219 real :: rhovtzx(nz,nx)
4221 real :: alp, diam, diam1, hwdn
4224 DOUBLE PRECISION,
PARAMETER:: thresh_conc = 0.0005d0
4225 real :: cwchtmp,cwchltmp, maxdia
4229 integer :: ixb, jyb, kzb
4230 integer :: ixe, jye, kze
4232 integer :: ialp, i, j
4234 logical :: debug_mpi = .false.
4240 cwchtmp = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
4243 cwchltmp = ((3. + dnu(lhl))*(2. + dnu(lhl))*(1.0 + dnu(lhl)))**(-1./3.)
4261 if ( ndebug .gt. 0 )
write(0,*)
'dbg = 3a'
4265 IF ( lh > 1 .and. lnh > 1 )
THEN
4268 IF ( an(ix,jy,kz,lh) .gt. qxmin(lh) .and. an(ix,jy,kz,lnh) .gt. thresh_conc )
THEN
4269 IF ( lvh .gt. 1 )
THEN
4270 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
4275 tmp = 1. + alpha2d(ix,1,kz,2)
4276 i = int(dgami*(tmp))
4278 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4280 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lh)/(hwdn*an(ix,jy,kz,lnh))
4281 diam = (6.0*tmp/pi)**(1./3.)
4283 cwchtmp = ((3. + alpha2d(ix,1,kz,2))*(2. + alpha2d(ix,1,kz,2))*(1.0 + alpha2d(ix,1,kz,2)))**(-1./3.)
4285 diam1 = diam*cwchtmp
4291 tmp = thresh_conc*g1palp/an(ix,jy,kz,lnh)
4292 alp = alpha2d(ix,1,kz,2)
4294 j = int(max(0.0,min(maxalphalu,alp))*dqiacralphainv)
4299 DO i = 0,nqiacrratio-1
4300 IF ( gamxinflu(i,j,1,1) >= tmp .and. tmp >= gamxinflu(i+1,j,1,1) )
THEN
4302 ratio = i*dqiacrratio
4303 del = tmp - gamxinflu(i,j,1,1)
4304 ratio = (float(i) + del/(gamxinflu(i+1,j,1,1) - gamxinflu(i,j,1,1)))*dqiacrratio
4309 IF ( ratio > 0.0 )
THEN
4310 maxdia = ratio*diam1
4313 IF ( kz == kzb )
THEN
4314 hailmaxk1(ix,jy) = max( maxdia, hailmaxk1(ix,jy) )
4324 hailmax1d(ix,jy) = max(maxdia, hailmax1d(ix,jy) )
4336 IF ( lhl > 1 .and. lnhl > 1 )
THEN
4339 IF ( an(ix,jy,kz,lhl) .gt. qxmin(lhl) .and. an(ix,jy,kz,lnhl) .gt. thresh_conc )
THEN
4340 IF ( lvhl .gt. 1 )
THEN
4341 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
4346 tmp = 1. + alpha2d(ix,1,kz,3)
4347 i = int(dgami*(tmp))
4349 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
4351 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/(hwdn*an(ix,jy,kz,lnhl))
4352 diam = (6.0*tmp/pi)**(1./3.)
4353 IF ( lzhl > 1 )
THEN
4354 cwchltmp = ((3. + alpha2d(ix,1,kz,3))*(2. + alpha2d(ix,1,kz,3))*(1.0 + alpha2d(ix,1,kz,3)))**(-1./3.)
4356 diam1 = diam*cwchltmp
4362 tmp = thresh_conc*g1palp/an(ix,jy,kz,lnhl)
4363 alp = alpha2d(ix,1,kz,3)
4365 j = int(max(0.0,min(maxalphalu,alp))*dqiacralphainv)
4370 DO i = 0,nqiacrratio-1
4371 IF ( gamxinflu(i,j,1,1) >= tmp .and. tmp >= gamxinflu(i+1,j,1,1) )
THEN
4373 ratio = i*dqiacrratio
4374 del = tmp - gamxinflu(i,j,1,1)
4375 ratio = (float(i) + del/(gamxinflu(i+1,j,1,1) - gamxinflu(i,j,1,1)))*dqiacrratio
4380 IF ( ratio > 0.0 )
THEN
4381 maxdia = ratio*diam1
4384 IF ( kz == kzb )
THEN
4385 hailmaxk1(ix,jy) = max( maxdia, hailmaxk1(ix,jy) )
4395 hailmax1d(ix,jy) = max(maxdia, hailmax1d(ix,jy) )
4407 END SUBROUTINE hailmaxd
4412 subroutine sediment1d(dtp,nx,ny,nz,an,na,nor,norz,xfall,dn,dz3d,dz3dinv, &
4413 & t0,t7,infdo,jslab,its,jts, &
4414 & timesed1,timesed2,timesed3,zmaxsed,timesetvt)
4424 integer nx,ny,nz,nor,norz,ngt,jgs,na,ia
4431 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
4432 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4433 real dz3d(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4434 real dz3dinv(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4435 real t0(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4436 real t7(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
4440 real xfall(nx,ny,na)
4444 integer ix,jy,kz,ndfall,n,k,il,in
4445 real tmp, vtmax, dtptmp, dtfrac
4446 real,
parameter :: dz = 200.
4448 real,
allocatable :: db1(:,:), dtz1(:,:,:),dz2dinv(:,:),db1inv(:,:)
4449 real,
allocatable :: rhovtzx(:,:)
4450 real,
allocatable :: xfall0(:,:), xvt(:,:,:,:),tmpn(:,:,:),tmpn2(:,:,:),z(:,:,:)
4452 double precision :: timesed1,timesed2,timesed3, zmaxsed,timesetvt,dummy
4453 double precision :: dt1,dt2,dt3,dt4
4456 integer :: ngscnt,mgs,ipconc0
4459 real,
allocatable :: qx(:,:)
4460 real,
allocatable :: qxw(:,:)
4461 real,
allocatable :: cx(:,:)
4462 real,
allocatable :: xv(:,:)
4463 real,
allocatable :: vtxbar(:,:,:)
4464 real,
allocatable :: xmas(:,:)
4465 real,
allocatable :: xdn(:,:)
4466 real,
allocatable :: xdia(:,:,:)
4467 real,
allocatable :: vx(:,:)
4468 real,
allocatable :: alpha(:,:)
4469 real,
allocatable :: zx(:,:)
4470 logical,
allocatable :: hasmass(:,:)
4472 integer,
allocatable :: igs(:),kgs(:)
4474 real,
allocatable :: rho0(:),temcg(:)
4476 real,
allocatable :: temg(:)
4478 real,
allocatable :: rhovt(:)
4480 real,
allocatable :: cwnc(:),cinc(:)
4481 real,
allocatable :: fadvisc(:),cwdia(:),cipmas(:)
4483 real,
allocatable :: cnina(:),cimas(:)
4485 real,
allocatable :: cnostmp(:)
4487 real :: cimasn,cimasx
4492 integer :: ixb, jyb, kzb
4493 integer :: ixe, jye, kze
4499 allocate( db1(nx,nz+1),dtz1(nz+1,nx,0:1),dz2dinv(nz+1,nx),db1inv(nx,nz+1),rhovtzx(nz,nx) )
4500 allocate( xfall0(nx,ny), xvt(nz+1,nx,3,lc:lhab), tmpn(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz) )
4501 allocate( tmpn2(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz), z(-nor+ng1:nx+nor,-norz+ng1:nz+norz,lr:lhab))
4505 allocate( qx(ngs,lv:lhab), &
4509 vtxbar(ngs,lc:lhab,3), &
4510 xmas(ngs,lc:lhab), &
4512 xdia(ngs,lc:lhab,3), &
4514 alpha(ngs,lc:lhab), &
4516 hasmass(nx,lc+1:lhab), &
4517 igs(ngs),kgs(ngs), &
4518 rho0(ngs),temcg(ngs),temg(ngs), rhovt(ngs), &
4519 cwnc(ngs),cinc(ngs), &
4520 fadvisc(ngs),cwdia(ngs),cipmas(ngs), &
4521 cnina(ngs),cimas(ngs), &
4541 if ( ndebug .gt. 0 )
write(0,*)
'dbg = 3a'
4546 db1(ix,kz) = dn(ix,jy,kz)
4547 db1inv(ix,kz) = 1./dn(ix,jy,kz)
4548 rhovtzx(kz,ix) = sqrt(rho00*min(1.0/0.05, db1inv(ix,kz)))
4554 dtz1(kz,ix,0) = dz3dinv(ix,jy,kz)
4555 dtz1(kz,ix,1) = dz3dinv(ix,jy,kz)*db1inv(ix,kz)
4556 dz2dinv(kz,ix) = dz3dinv(ix,jy,kz)
4560 IF ( lzh .gt. 1 )
THEN
4563 an(ix,jy,kz,lzh) = max( 0., an(ix,jy,kz,lzh) )
4578 if (ndebug .gt. 0 )
write(0,*)
'dbg = 3a2'
4586 call ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ix, &
4588 & an,dn,ipconc,t0,t7,cwmasn,cwmasx, &
4590 & qxmin,xdnmx,xdnmn,cdx,cno,xdn0,xvmn,xvmx, &
4591 & ngs,qx,qxw,cx,xv,vtxbar,xmas,xdn,xdia,vx,alpha,zx,igs,kgs, &
4592 & rho0,temcg,temg,rhovt,cwnc,cinc,fadvisc,cwdia,cipmas,cnina,cimas, &
4600 IF ( ido(il) == 0 ) cycle
4613 xvt(kz,ix,1,il) = min( vtmaxsed, xvt(kz,ix,1,il) )
4614 xvt(kz,ix,2,il) = min( vtmaxsed, xvt(kz,ix,2,il) )
4615 xvt(kz,ix,3,il) = min( vtmaxsed, xvt(kz,ix,3,il) )
4617 vtmax = max(vtmax,xvt(kz,ix,1,il)*dz2dinv(kz,ix))
4618 vtmax = max(vtmax,xvt(kz,ix,2,il)*dz2dinv(kz,ix))
4619 vtmax = max(vtmax,xvt(kz,ix,3,il)*dz2dinv(kz,ix))
4633 IF ( vtmax == 0.0 ) cycle
4637 IF ( dtp*vtmax .lt. 0.7 )
THEN
4640 IF ( dtp > 20.0 )
THEN
4641 ndfall = max(2, int(dtp*vtmax/0.7) + 1)
4643 ndfall = 1+int(dtp*vtmax + 0.301)
4647 IF ( ndfall .gt. 1 )
THEN
4648 dtptmp = dtp/real(ndfall)
4660 IF ( do_accurate_sedimentation .and. n .ge. 2 .and. ( n == interval_sedi_vt*(n/interval_sedi_vt) ) )
THEN
4667 xvt(kzb:kze,ix,1:3,il) = 0.0
4669 call ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ix, &
4671 & an,dn,ipconc,t0,t7,cwmasn,cwmasx, &
4673 & qxmin,xdnmx,xdnmn,cdx,cno,xdn0,xvmn,xvmx, &
4674 & ngs,qx,qxw,cx,xv,vtxbar,xmas,xdn,xdia,vx,alpha,zx,igs,kgs, &
4675 & rho0,temcg,temg,rhovt,cwnc,cinc,fadvisc,cwdia,cipmas,cnina,cimas, &
4682 xvt(kz,ix,1,il) = min( vtmaxsed, xvt(kz,ix,1,il) )
4683 xvt(kz,ix,2,il) = min( vtmaxsed, xvt(kz,ix,2,il) )
4684 xvt(kz,ix,3,il) = min( vtmaxsed, xvt(kz,ix,3,il) )
4693 IF ( il >= lr .and. ( linfall(il) .eq. 3 .or. linfall(il) .eq. 4 ) .and. ln(il) > 0 )
THEN
4694 call calczgr1d(nx,ny,nz,nor,na,an,ixe,kze, &
4695 & z,db1,jgs,ipconc, dnu(il), il, ln(il), qxmin(il), xvmn(il), xvmx(il), lvol(il), xdn0(il), ix )
4698 if (ndebug .gt. 0 )
write(0,*)
'dbg = 1b'
4702 call fallout1d(nx,ny,nz,nor,na,dtptmp,dtfrac,jgs,xvt(1,1,1,il), &
4703 & an,db1,il,1,xfall,dtz1,ix)
4706 if (ndebug .gt. 0 )
write(0,*)
'dbg = 3c'
4710 IF ( ldovol .and. il >= li )
THEN
4711 IF ( lvol(il) .gt. 1 )
THEN
4712 call fallout1d(nx,ny,nz,nor,na,dtptmp,dtfrac,jgs,xvt(1,1,1,il), &
4713 & an,db1,lvol(il),0,xfall,dtz1,ix)
4719 IF ( ipconc .ge. 6 )
THEN
4720 IF ( lz(il) .gt. 1 )
THEN
4721 call fallout1d(nx,ny,nz,nor,na,dtptmp,dtfrac,jgs,xvt(1,1,3,il), &
4722 & an,db1,lz(il),0,xfall,dtz1,ix)
4726 if (ndebug .gt. 0 )
write(0,*)
'dbg = 3d'
4729 IF ( ipconc .gt. 0 )
THEN
4730 IF ( ipconc .ge. ipc(il) )
THEN
4732 IF ( ( linfall(il) .ge. 2 ) .and. lz(il) .lt. 1)
THEN
4738 IF ( linfall(il) == 3 .or. linfall(il) == 4 )
THEN
4741 tmpn2(ix,jy,kz) = z(ix,kz,il)
4744 tmpn(ix,jy,kz) = an(ix,jy,kz,ln(il))
4750 tmpn(ix,jy,kz) = an(ix,jy,kz,ln(il))
4758 if (ndebug .gt. 0 )
write(0,*)
'dbg = 3f'
4761 IF ( linfall(il) .eq. 1 ) in = 1
4763 call fallout1d(nx,ny,nz,nor,na,dtptmp,dtfrac,jgs,xvt(1,1,in,il), &
4764 & an,db1,ln(il),0,xfall,dtz1,ix)
4767 IF ( lz(il) .lt. 1 )
THEN
4768 IF ( linfall(il) >= 2 )
THEN
4771 IF ( ( infall .eq. 3 .or. infall .eq. 4 ) .and. &
4772 & ( il .ge. lh .or. (il .eq. lr .and. irfall .eq. infall) &
4773 .or. (il .eq. ls .and. isfall .eq. infall) ) )
THEN
4774 call fallout1d(nx,ny,nz,nor,1,dtptmp,dtfrac,jgs,xvt(1,1,3,il), &
4775 & tmpn2,db1,1,0,xfall0,dtz1,ix)
4776 call fallout1d(nx,ny,nz,nor,1,dtptmp,dtfrac,jgs,xvt(1,1,1,il), &
4777 & tmpn,db1,1,0,xfall0,dtz1,ix)
4779 call fallout1d(nx,ny,nz,nor,1,dtptmp,dtfrac,jgs,xvt(1,1,1,il), &
4780 & tmpn,db1,1,0,xfall0,dtz1,ix)
4783 IF ( linfall(il) == 3 .or. linfall(il) == 4 )
THEN
4789 call calcnfromz1d(nx,ny,nz,nor,na,an,tmpn2,ixe,kze, &
4790 & z,db1,jgs,ipconc, dnu(il), il, ln(il), qxmin(il), xvmn(il), xvmx(il),tmpn, &
4791 & lvol(il), xdn0(il), infall, ix)
4793 ELSEIF ( linfall(il) .eq. 5 .and. il .ge. lh .or. ( il == lr .and. irfall == 5 ) )
THEN
4796 an(ix,jgs,kz,ln(il)) = max( an(ix,jgs,kz,ln(il)), 0.5* ( an(ix,jgs,kz,ln(il)) + tmpn(ix,jy,kz) ))
4799 ELSEIF ( .not. (il .eq. lr .and. irfall .eq. 0) .and. .not. (il .eq. ls .and. isfall .eq. 0) )
THEN
4803 an(ix,jgs,kz,ln(il)) = max( an(ix,jgs,kz,ln(il)), tmpn(ix,jy,kz) )
4822 deallocate( db1,dtz1,dz2dinv,db1inv,rhovtzx )
4823 deallocate( xfall0, xvt, tmpn )
4824 deallocate( tmpn2, z)
4839 rho0,temcg,temg, rhovt, &
4841 fadvisc,cwdia,cipmas, &
4846 END SUBROUTINE sediment1d
4862 subroutine fallout1d(nx,ny,nz,nor,na,dtp,dtfrac,jgs,vt, &
4863 & a,db1,ia,id,xfall,dtz1,ixcol)
4873 integer nx,ny,nz,nor,ngt,jgs,na,ia
4881 real a(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor,na)
4885 real xfall(nx,ny,na)
4886 real db1(nx,nz+1),dtz1(nz+1,nx,0:1)
4890 integer ix,jy,kz,n,k
4893 integer imn,imx,kmn,kmx
4898 integer :: ixb, jyb, kzb
4899 integer :: ixe, jye, kze
4929 qtmp1(kz) = a(ix,jgs,kz,ia)*vt(kz,ix)*db1(ix,kz)
4931 qtmp1(kz) = a(ix,jgs,kz,ia)*vt(kz,ix)
4934 IF ( a(ix,jgs,kz,ia) .ne. 0.0 )
THEN
4950 IF ( kmn == 1 )
THEN
4954 xfall(ix,jy,ia) = xfall(ix,jy,ia) + a(ix,jgs,kz,ia)*vt(kz,ix)*dtfrac
4961 a(ix,jgs,kz,ia) = a(ix,jgs,kz,ia) + dtp*dtz1(kz,ix,id)*(qtmp1(kz+1) - qtmp1(kz) )
4967 END SUBROUTINE fallout1d
4974 subroutine calczgr1d(nx,ny,nz,nor,na,a,ixe,kze, &
4975 & z,db,jgs,ipconc, alpha, l,ln, qmin, xvmn,xvmx, lvol, rho_qx, ixcol)
4980 integer nx,ny,nz,nor,na,ngt,jgs
4982 integer,
parameter :: norz = 3
4983 real a(-nor+1:nx+nor,-nor+1:ny+nor,-nor+1:nz+nor,na)
4984 real z(-nor+1:nx+nor,-nor+1:nz+nor,lr:lhab)
5000 real vr,qr,nrx,rd,xv,g1,zx,chw,xdn,ynu
5006 IF ( l .eq. lh .or. l .eq. lhl .or. ( l .eq. lr .and. imurain == 1 ) &
5007 .or. ( l .eq. ls .and. imusnow == 1 ) )
THEN
5014 IF ( a(ix,jy,kz,l) .gt. qmin .and. a(ix,jy,kz,ln) .gt. 1.e-15 )
THEN
5016 IF ( lvol .gt. 1 )
THEN
5017 IF ( a(ix,jy,kz,lvol) .gt. 0.0 )
THEN
5018 xdn = db(ix,kz)*a(ix,jy,kz,l)/a(ix,jy,kz,lvol)
5019 xdn = min( 900., max( hdnmn, xdn ) )
5027 IF ( l == lr ) xdn = 1000.
5030 xv = db(ix,kz)*a(ix,jy,kz,l)/(xdn*a(ix,jy,kz,ln))
5031 chw = a(ix,jy,kz,ln)
5033 IF ( xv .lt. xvmn .or. xv .gt. xvmx )
THEN
5034 xv = min( xvmx, max( xvmn,xv ) )
5035 chw = db(ix,kz)*a(ix,jy,kz,l)/(xv*xdn)
5038 g1 = (6.0 + alpha)*(5.0 + alpha)*(4.0 + alpha)/ &
5039 & ((3.0 + alpha)*(2.0 + alpha)*(1.0 + alpha))
5040 zx = g1*db(ix,kz)**2*(a(ix,jy,kz,l))*a(ix,jy,kz,l)/chw
5042 z(ix,kz,l) = zx*(6./(pi*1000.))**2
5057 ELSEIF ( (l == ls .and. imusnow == 3) .or. ( l .eq. lr .and. imurain == 3 ) )
THEN
5060 IF ( l == ls ) ynu = snu
5061 IF ( l == lr ) ynu = rnu
5065 IF ( a(ix,jy,kz,l) .gt. qmin .and. a(ix,jy,kz,ln) .gt. 1.e-15 )
THEN
5067 vr = db(ix,kz)*a(ix,jy,kz,l)/(xdn*a(ix,jy,kz,ln))
5069 z(ix,kz,l) = 3.6*(ynu+2.0)*a(ix,jy,kz,ln)*vr**2/(ynu+1.0)
5086 END subroutine calczgr1d
5098 subroutine calcnfromz1d(nx,ny,nz,nor,na,a,t0,ixe,kze, &
5099 & z0,db,jgs,ipconc, alpha, l,ln, qmin, xvmn,xvmx,t1, &
5100 & lvol, rho_qx, infall, ixcol)
5105 integer nx,ny,nz,nor,na,ngt,jgs,ixcol
5107 real a(-nor+1:nx+nor,-nor+1:ny+nor,-nor+1:nz+nor,na)
5108 real t0(-nor+1:nx+nor,-nor+1:ny+nor,-nor+1:nz+nor)
5109 real t1(-nor+1:nx+nor,-nor+1:ny+nor,-nor+1:nz+nor)
5111 real z0(-nor+1:nx+nor,-nor+1:nz+nor,lr:lhab)
5128 double precision vr,qr,nrx,rd,g1,zx,chw,z,znew,zt,zxt
5130 integer :: ndbz, nmwgt, nnwgt, nwlessthanz
5142 IF ( l .eq. lh .or. l .eq. lhl .or. ( l == lr .and. imurain == 1 ) )
THEN
5144 g1 = (6.0 + alpha)*(5.0 + alpha)*(4.0 + alpha)/ &
5145 & ((3.0 + alpha)*(2.0 + alpha)*(1.0 + alpha))
5150 IF ( t0(ix,jy,kz) .gt. 0. )
THEN
5152 IF ( lvol .gt. 1 )
THEN
5153 IF ( a(ix,jy,kz,lvol) .gt. 0.0 )
THEN
5154 xdn = db(ix,kz)*a(ix,jy,kz,l)/a(ix,jy,kz,lvol)
5155 xdn = min( 900., max( hdnmn, xdn ) )
5163 IF ( l == lr ) xdn = 1000.
5166 xv = db(ix,kz)*a(ix,jy,kz,l)/(xdn*a(ix,jy,kz,ln))
5167 chw = a(ix,jy,kz,ln)
5169 IF ( xv .lt. xvmn .or. xv .gt. xvmx )
THEN
5170 xv = min( xvmx, max( xvmn,xv ) )
5171 chw = db(ix,kz)*a(ix,jy,kz,l)/(xv*xdn)
5174 zx = g1*db(ix,kz)**2*( a(ix,jy,kz,l))*a(ix,jy,kz,l)/chw
5175 z = zx*(6./(pi*1000.))**2
5178 IF ( (z .gt. t0(ix,jy,kz) .and. z .gt. 0.0 .and. &
5179 & t0(ix,jy,kz) .gt. z0(ix,kz,l) ))
THEN
5181 zx = t0(ix,jy,kz)/((6./(pi*1000.))**2)
5183 nrx = g1*db(ix,kz)**2*( a(ix,jy,kz,l))*a(ix,jy,kz,l)/zx
5184 IF ( infall .eq. 3 )
THEN
5185 IF ( nrx .gt. a(ix,jy,kz,ln) )
THEN
5187 IF ( t1(ix,jy,kz) .lt. ndbz ) nwlessthanz = nwlessthanz + 1
5191 a(ix,jy,kz,ln) = max( real(nrx), a(ix,jy,kz,ln) )
5193 IF ( nrx .gt. a(ix,jy,kz,ln) .and. t1(ix,jy,kz) .gt. a(ix,jy,kz,ln) )
THEN
5194 IF ( nrx .lt. t1(ix,jy,kz) )
THEN
5198 IF ( t1(ix,jy,kz) .lt. ndbz ) nwlessthanz = nwlessthanz + 1
5204 a(ix,jy,kz,ln) = max(min( real(nrx), t1(ix,jy,kz) ), a(ix,jy,kz,ln) )
5208 IF ( t1(ix,jy,kz) .gt. 0 .and. a(ix,jy,kz,ln) .gt. 0 )
THEN
5209 IF ( t1(ix,jy,kz) .gt. a(ix,jy,kz,ln) )
THEN
5215 a(ix,jy,kz,ln) = max(t1(ix,jy,kz), a(ix,jy,kz,ln) )
5216 nrx = a(ix,jy,kz,ln)
5224 IF ( t1(ix,jy,kz) .gt. 0 .and. a(ix,jy,kz,ln) .gt. 0 )
THEN
5225 IF ( t1(ix,jy,kz) .gt. a(ix,jy,kz,ln) )
THEN
5236 ELSEIF ( l .eq. lr .and. imurain == 3)
THEN
5241 IF ( t0(ix,jy,kz) .gt. 0. )
THEN
5243 vr = db(ix,kz)*a(ix,jy,kz,l)/(xdn*a(ix,jy,kz,ln))
5244 z = 3.6*(rnu+2.0)*a(ix,jy,kz,ln)*vr**2/(rnu+1.0)
5246 IF ( z .gt. t0(ix,jy,kz) .and. z .gt. 0.0 .and. &
5247 & t0(ix,jy,kz) .gt. 0.0 &
5248 & .and. t0(ix,jy,kz) .gt. z0(ix,kz,l) )
THEN
5250 vr = db(ix,kz)*a(ix,jy,kz,l)/(xdn)
5251 chw = a(ix,jy,kz,ln)
5252 nrx = 3.6*(rnu+2.0)*vr**2/((rnu+1.0)*t0(ix,jy,kz))
5253 IF ( infall .eq. 3 )
THEN
5254 a(ix,jy,kz,ln) = max( real(nrx), a(ix,jy,kz,ln) )
5255 ELSEIF ( infall .eq. 4 )
THEN
5256 a(ix,jy,kz,ln) = max( min( real(nrx), t1(ix,jy,kz)), a(ix,jy,kz,ln) )
5261 a(ix,jy,kz,ln) = max(t1(ix,jy,kz), a(ix,jy,kz,ln) )
5267 a(ix,jy,kz,ln) = max(t1(ix,jy,kz), a(ix,jy,kz,ln) )
5278 END subroutine calcnfromz1d
5294 & qcw,qci,qsw,qrw,qhw,qhl, &
5295 & ccw,cci,csw,crw,chw,chl, &
5296 & cccn,cccna, vhw,vhl,qv,spechum, invertccn_flag, cwmasin )
5302 integer nx,ny,nz,nor,norz,na,ngt,jgs,ixcol
5304 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
5308 real,
optional,
dimension(nx,nz),
intent(inout) :: qcw,qci,qsw,qrw,qhw,qhl, &
5309 ccw,cci,csw,crw,chw,chl, &
5310 cccn,cccna,vhw,vhl,qv, spechum
5311 logical,
optional,
intent(in) :: invertccn_flag
5312 real,
optional :: cwmasin
5324 double precision vr,q,nrx,nrx2,rd,g1h,g1hl,g1r,g1s,zx,z,znew,zt,zxt,n1,laminv1
5325 double precision :: zr, zs, zh, dninv
5326 real,
parameter :: xn0s = 3.0e8, xn0r = 8.0e6, xn0h = 2.0e5, xn0hl = 4.0e4
5327 real,
parameter :: xdnr = 1000., xdns = 100. ,xdnh = 700.0, xdnhl = 900.0
5328 real,
parameter :: zhlfac = 1./(pi*xdnhl*xn0hl)
5329 real,
parameter :: zhfac = 1./(pi*xdnh*xn0h)
5330 real,
parameter :: zrfac = 1./(pi*xdnr*xn0r)
5331 real,
parameter :: zsfac = 1./(pi*xdns*xn0s)
5332 real,
parameter :: g0 = (6.0)*(5.0)*(4.0)/((3.0)*(2.0)*(1.0))
5333 real,
parameter :: xims=900.*0.523599*(2.*50.e-6)**3
5334 real,
parameter :: xgms=xdnh*0.523599*(300.e-6)**3
5335 real,
parameter :: cwmas09 = 1000.*0.523599*(2.*9.e-6)**3
5337 real xv,xdn,cwmasinv
5338 integer :: ndbz, nmwgt, nnwgt, nwlessthanz
5339 double precision :: mixconv, mixconvqv, qsmax,qsmax2,qsmax3,qsmax4
5340 logical :: invertccn_local
5344 IF (
present( invertccn_flag ) )
THEN
5345 invertccn_local = invertccn_flag
5347 invertccn_local = .false.
5350 IF (
present( cwmasin ) )
THEN
5351 cwmasinv = 1.0/cwmasin
5353 cwmasinv = 1.0/cwmas09
5359 g1h = (6.0 + alphah)*(5.0 + alphah)*(4.0 + alphah)/ &
5360 & ((3.0 + alphah)*(2.0 + alphah)*(1.0 + alphah))
5362 g1hl = (6.0 + alphahl)*(5.0 + alphahl)*(4.0 + alphahl)/ &
5363 & ((3.0 + alphahl)*(2.0 + alphahl)*(1.0 + alphahl))
5365 IF ( imurain == 3 )
THEN
5366 g1r = (rnu+2.0)/(rnu+1.0)
5368 g1r = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
5369 & ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
5372 g1s = (snu+2.0)/(snu+1.0)
5385 IF (
present( spechum ) )
THEN
5386 an(ix,jy,kz,lv) = spechum(ix,kz)/(1.0d0 - spechum(ix,kz))
5387 mixconv = 1.0d0/(1.0d0 - spechum(ix,kz))
5391 IF (
present( qv ) ) an(ix,jy,kz,lv) = qv(ix,kz)
5392 IF (
present( qcw ) ) an(ix,jy,kz,lc) = qcw(ix,kz)*mixconv
5393 IF (
present( qrw ) ) an(ix,jy,kz,lr) = qrw(ix,kz)*mixconv
5394 IF (
present( qci ) ) an(ix,jy,kz,li) = qci(ix,kz)*mixconv
5395 IF (
present( qsw ) )
THEN
5396 an(ix,jy,kz,ls) = qsw(ix,kz)*mixconv
5400 IF (
present( qhw ) ) an(ix,jy,kz,lh) = qhw(ix,kz)*mixconv
5401 IF ( lhl > 1 .and.
present( qhl ) ) an(ix,jy,kz,lhl) = qhl(ix,kz)*mixconv
5402 IF (
present( ccw ) ) an(ix,jy,kz,lnc) = ccw(ix,kz)*mixconv*dn(ix,kz)
5403 IF (
present( crw ) ) an(ix,jy,kz,lnr) = crw(ix,kz)*mixconv*dn(ix,kz)
5404 IF (
present( cci ) ) an(ix,jy,kz,lni) = cci(ix,kz)*mixconv*dn(ix,kz)
5405 IF (
present( csw ) ) an(ix,jy,kz,lns) = csw(ix,kz)*mixconv*dn(ix,kz)
5406 IF (
present( chw ) ) an(ix,jy,kz,lnh) = chw(ix,kz)*mixconv*dn(ix,kz)
5407 IF ( lhl > 1 .and.
present( chl ) ) an(ix,jy,kz,lnhl) = chl(ix,kz)*mixconv*dn(ix,kz)
5408 IF ( lvh > 1 .and.
present( vhw ) ) an(ix,jy,kz,lvh) = vhw(ix,kz)*mixconv
5409 IF ( lvhl > 1 .and.
present( vhl ) ) an(ix,jy,kz,lvhl) = vhl(ix,kz)*mixconv
5410 IF ( lccn > 1 .and.
present( cccn ) ) an(ix,jy,kz,lccn) = cccn(ix,kz)*mixconv*dn(ix,kz)
5411 IF ( lccna > 1 .and.
present( cccna ) ) an(ix,jy,kz,lccna) = cccna(ix,kz)*mixconv
5413 dninv = 1./dn(ix,kz)
5419 IF ( an(ix,jy,kz,lnc) <= cxmin .and. an(ix,jy,kz,lc) > qxmin_init(lc) )
THEN
5421 an(ix,jy,kz,lnc) = min(qccn, an(ix,jy,kz,lc)*cwmasinv )*dn(ix,kz)
5423 IF ( invertccn_local )
THEN
5424 an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) + an(ix,jy,kz,lnc)
5427 IF ( lccn > 1 .and. lccna < 1 )
THEN
5428 an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) - an(ix,jy,kz,lnc)
5430 IF ( lccna > 1 )
THEN
5431 an(ix,jy,kz,lccna) = an(ix,jy,kz,lccna) + an(ix,jy,kz,lnc)
5435 ELSEIF ( an(ix,jy,kz,lc) <= qxmin(lc) .or. &
5436 ( an(ix,jy,kz,lnc) <= cxmin .and. an(ix,jy,kz,lc) <= qxmin_init(lc)) )
THEN
5438 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lc)
5439 an(ix,jy,kz,lnc) = 0.0
5440 an(ix,jy,kz,lc) = 0.0
5448 IF ( an(ix,jy,kz,lni) <= cxmin .and. an(ix,jy,kz,li) > qxmin_init(li) )
THEN
5449 an(ix,jy,kz,lni) = dn(ix,kz)*an(ix,jy,kz,li)/xims
5451 ELSEIF ( an(ix,jy,kz,li) <= qxmin(li) .or. &
5452 ( an(ix,jy,kz,lni) <= cxmin .and. an(ix,jy,kz,li) <= qxmin_init(li)) )
THEN
5453 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,li)
5454 an(ix,jy,kz,lni) = 0.0
5455 an(ix,jy,kz,li) = 0.0
5462 IF ( an(ix,jy,kz,lnr) <= 0.1*cxmin .and. an(ix,jy,kz,lr) > qxmin_init(lr) )
THEN
5466 laminv1 = (dn(ix,kz) * q * zrfac)**(0.25)
5472 an(ix,jy,kz,lnr) = nrx
5474 ELSEIF ( an(ix,jy,kz,lr) <= qxmin(lr) .or. &
5475 ( an(ix,jy,kz,lnr) <= cxmin .and. an(ix,jy,kz,lr) <= qxmin_init(lr)) )
THEN
5476 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lr)
5477 an(ix,jy,kz,lnr) = 0.0
5478 an(ix,jy,kz,lr) = 0.0
5483 IF ( an(ix,jy,kz,lr) > qxmin_init(lr) .and. an(ix,jy,kz,lzr) < zxmin .and. &
5484 an(ix,jy,kz,lnr) > cxmin )
THEN
5486 nrx = an(ix,jy,kz,lnr)
5487 an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx)
5493 IF ( an(ix,jy,kz,lns) <= 0.1*cxmin .and. an(ix,jy,kz,ls) > qxmin_init(ls) )
THEN
5497 laminv1 = (dn(ix,kz) * q * zsfac)**(0.25)
5503 an(ix,jy,kz,lns) = nrx
5505 ELSEIF ( an(ix,jy,kz,ls) <= qxmin(ls) .or. &
5506 ( an(ix,jy,kz,lns) <= cxmin .and. an(ix,jy,kz,ls) <= qxmin_init(ls)) )
THEN
5507 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,ls)
5508 an(ix,jy,kz,lns) = 0.0
5509 an(ix,jy,kz,ls) = 0.0
5517 IF ( an(ix,jy,kz,lnh) <= 0.1*cxmin .and. an(ix,jy,kz,lh) > qxmin_init(lh) )
THEN
5519 IF ( an(ix,jy,kz,lvh) <= 0.0 )
THEN
5520 an(ix,jy,kz,lvh) = an(ix,jy,kz,lh)/xdnh
5526 laminv1 = (dn(ix,kz) * q * zhfac)**(0.25)
5532 nrx2 = dn(ix,kz) * q / xgms
5534 nrx = min( nrx, nrx2 )
5536 IF ( nrx > cxmin )
THEN
5537 an(ix,jy,kz,lnh) = nrx
5539 an(ix,jy,kz,lh) = 0.0
5540 an(ix,jy,kz,lnh) = 0.0
5541 an(ix,jy,kz,lvh) = 0.0
5544 ELSEIF ( an(ix,jy,kz,lh) <= qxmin(lh) .or. &
5545 ( an(ix,jy,kz,lnh) <= cxmin .and. an(ix,jy,kz,lh) <= qxmin_init(lh)) )
THEN
5547 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lh)
5548 an(ix,jy,kz,lh) = 0.0
5554 IF ( an(ix,jy,kz,lh) > qxmin_init(lh) .and. an(ix,jy,kz,lzh) < zxmin .and. &
5555 an(ix,jy,kz,lnh) > cxmin )
THEN
5557 nrx = an(ix,jy,kz,lnh)
5558 an(ix,jy,kz,lzh) = 36.*g1h*dn(ix,kz)**2*q**2/(pi**2*xdnh**2*nrx)
5564 IF ( lnhl > 1 .and. lhl > 1 )
THEN
5565 IF ( an(ix,jy,kz,lnhl) <= 0.1*cxmin .and. an(ix,jy,kz,lhl) > qxmin_init(lhl) )
THEN
5566 IF ( lvhl > 1 )
THEN
5567 IF ( an(ix,jy,kz,lvhl) <= 0.0 )
THEN
5568 an(ix,jy,kz,lvhl) = an(ix,jy,kz,lhl)/xdnhl
5572 q = an(ix,jy,kz,lhl)
5574 laminv1 = (dn(ix,kz) * q * zhlfac)**(0.25)
5580 an(ix,jy,kz,lnhl) = nrx
5582 ELSEIF ( an(ix,jy,kz,lhl) <= qxmin(lhl) .or. &
5583 ( an(ix,jy,kz,lnhl) <= cxmin .and. an(ix,jy,kz,lhl) <= qxmin_init(lhl)) )
THEN
5585 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lhl)
5586 an(ix,jy,kz,lhl) = 0.0
5591 IF ( lzhl > 1 )
THEN
5592 IF ( an(ix,jy,kz,lhl) > qxmin_init(lhl) .and. an(ix,jy,kz,lzhl) < zxmin .and. &
5593 an(ix,jy,kz,lnhl) > cxmin )
THEN
5594 q = an(ix,jy,kz,lhl)
5595 nrx = an(ix,jy,kz,lnhl)
5596 an(ix,jy,kz,lzhl) = 36.*g1hl*dn(ix,kz)**2*q**2/(pi**2*xdnhl**2*nrx)
5607 IF (
present( spechum ) )
THEN
5609 mixconvqv = 1.0d0/(1.0d0 + an(ix,jy,kz,lv))
5610 spechum(ix,kz) = an(ix,jy,kz,lv)*mixconvqv
5615 IF (
present( qv ) ) qv(ix,kz) = an(ix,jy,kz,lv)
5616 IF (
present( qcw ) ) qcw(ix,kz) = an(ix,jy,kz,lc)*mixconvqv
5617 IF (
present( qrw ) ) qrw(ix,kz) = an(ix,jy,kz,lr)*mixconvqv
5618 IF (
present( qci ) ) qci(ix,kz) = an(ix,jy,kz,li)*mixconvqv
5619 IF (
present( qsw ) )
THEN
5620 qsw(ix,kz) = an(ix,jy,kz,ls)*mixconvqv
5624 IF (
present( qhw ) ) qhw(ix,kz) = an(ix,jy,kz,lh)*mixconvqv
5625 IF ( lhl > 1 .and.
present( qhl ) ) qhl(ix,kz) = an(ix,jy,kz,lhl)*mixconvqv
5626 IF (
present( ccw ) ) ccw(ix,kz) = an(ix,jy,kz,lnc)*mixconvqv*dninv
5627 IF (
present( crw ) ) crw(ix,kz) = an(ix,jy,kz,lnr)*mixconvqv*dninv
5628 IF (
present( cci ) ) cci(ix,kz) = an(ix,jy,kz,lni)*mixconvqv*dninv
5629 IF (
present( csw ) ) csw(ix,kz) = an(ix,jy,kz,lns)*mixconvqv*dninv
5630 IF (
present( chw ) ) chw(ix,kz) = an(ix,jy,kz,lnh)*mixconvqv*dninv
5631 IF ( lhl > 1 .and.
present( chl ) ) chl(ix,kz) = an(ix,jy,kz,lnhl)*mixconvqv*dninv
5632 IF ( lvh > 1 .and.
present( vhw ) ) vhw(ix,kz) = an(ix,jy,kz,lvh)*mixconvqv
5633 IF ( lvhl > 1 .and.
present( vhl ) ) vhl(ix,kz) = an(ix,jy,kz,lvhl)*mixconvqv
5634 IF ( lccn > 1 .and.
present( cccn ) ) cccn(ix,kz) = an(ix,jy,kz,lccn)*mixconvqv*dninv
5635 IF ( lccna > 1 .and.
present( cccna ) ) cccna(ix,kz) = an(ix,jy,kz,lccna)*mixconvqv
5666 subroutine calcnfromcuten(nx,ny,nz,an,anold,na,nor,norz,dn)
5671 integer nx,ny,nz,nor,norz,na,ngt,jgs,ixcol
5673 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
5674 real anold(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
5688 double precision vr,q,nrx,rd,g1h,g1hl,g1r,g1s,zx,chw,z,znew,zt,zxt,n1,laminv1
5689 double precision :: zr, zs, zh, dninv
5690 real,
parameter :: xn0s = 3.0e6, xn0r = 8.0e6, xn0h = 4.0e4, xn0hl = 4.0e4
5691 real,
parameter :: xdnr = 1000., xdns = 100. ,xdnh = 700.0, xdnhl = 900.0
5692 real,
parameter :: zhlfac = 1./(pi*xdnhl*xn0hl)
5693 real,
parameter :: zhfac = 1./(pi*xdnh*xn0h)
5694 real,
parameter :: zrfac = 1./(pi*xdnr*xn0r)
5695 real,
parameter :: zsfac = 1./(pi*xdns*xn0s)
5696 real,
parameter :: g0 = (6.0)*(5.0)*(4.0)/((3.0)*(2.0)*(1.0))
5697 real,
parameter :: xims=900.*0.523599*(2.*50.e-6)**3
5698 real,
parameter :: xcms=1000.*0.523599*(2.*7.5e-6)**3
5700 real :: xmass,xv,xdn
5701 integer :: ndbz, nmwgt, nnwgt, nwlessthanz
5709 g1h = (6.0 + alphah)*(5.0 + alphah)*(4.0 + alphah)/ &
5710 & ((3.0 + alphah)*(2.0 + alphah)*(1.0 + alphah))
5712 g1hl = (6.0 + alphahl)*(5.0 + alphahl)*(4.0 + alphahl)/ &
5713 & ((3.0 + alphahl)*(2.0 + alphahl)*(1.0 + alphahl))
5715 IF ( imurain == 3 )
THEN
5716 g1r = (rnu+2.0)/(rnu+1.0)
5718 g1r = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/ &
5719 & ((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
5722 g1s = (snu+2.0)/(snu+1.0)
5727 dninv = 1./dn(ix,kz)
5733 IF ( an(ix,jy,kz,lnc) > qxmin(lc) )
THEN
5734 anold(ix,jy,kz,lnc) = anold(ix,jy,kz,lnc) + an(ix,jy,kz,lc)/xcms
5741 IF ( an(ix,jy,kz,lni) > qxmin(li) )
THEN
5742 anold(ix,jy,kz,lni) = anold(ix,jy,kz,lni) + an(ix,jy,kz,li)/xims
5749 IF ( an(ix,jy,kz,lr) > qxmin(lr) )
THEN
5751 IF ( .true. .or. (anold(ix,jy,kz,lr) - an(ix,jy,kz,lr)) < qxmin(lr) .or. anold(ix,jy,kz,lnr) < cxmin )
THEN
5755 laminv1 = (dn(ix,kz) * q * zrfac)**(0.25)
5761 anold(ix,jy,kz,lnr) = anold(ix,jy,kz,lnr) + nrx
5765 xmass = anold(ix,jy,kz,lr)/anold(ix,jy,kz,lnr)
5766 anold(ix,jy,kz,lnr) = anold(ix,jy,kz,lnr) + an(ix,jy,kz,lr)/xmass
5770 an(ix,jy,kz,lzr) = 36.*g1r*dn(ix,kz)**2*q**2/(pi**2*xdnr**2*nrx)
5777 IF ( an(ix,jy,kz,ls) > qxmin(ls) )
THEN
5779 IF ( .true. .or. (anold(ix,jy,kz,ls) - an(ix,jy,kz,ls)) < qxmin(ls) .or. anold(ix,jy,kz,lns) < cxmin )
THEN
5785 laminv1 = (dn(ix,kz) * q * zsfac)**(0.25)
5791 anold(ix,jy,kz,lns) = anold(ix,jy,kz,lns) + nrx
5795 xmass = anold(ix,jy,kz,ls)/anold(ix,jy,kz,lns)
5796 anold(ix,jy,kz,lns) = anold(ix,jy,kz,lns) + an(ix,jy,kz,ls)/xmass
5859 END subroutine calcnfromcuten
5867 & (nx,ny,nz,na,jyslab &
5869 & ,t1,t2,t3,t4,t5,t6, f_t4, f_t5,f_t6 &
5870 & ,qcw,qci,qsw,qrw &
5871 & ,ccw,cci,csw,crw &
5876 integer,
parameter :: ng1 = 1
5877 integer :: nx,ny,nz,na
5879 integer :: nor,norz, jyslab
5887 real,
optional :: t1(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5888 real,
optional :: t2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5889 real,
optional :: t3(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5890 real,
optional :: t4(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5891 real,
optional :: t5(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5892 real,
optional :: t6(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5893 logical,
optional :: f_t4, f_t5, f_t6
5895 real,
optional :: an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
5896 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
5897 real,
optional,
dimension(nx,nz) :: qcw,qci,qsw,qrw,ccw,cci,csw,crw
5902 real pb(-norz+ng1:nz+norz)
5903 real pinit(-norz+ng1:nz+norz)
5908 integer nxmpb,nzmpb,nxz
5909 integer mgs,ngs,numgs,inumgs
5911 integer ngscnt,igs(ngs),kgs(ngs)
5914 integer ix,kz,i,n, kp1
5916 integer ixb,ixe,jyb,jye,kzb,kze
5918 integer itile,jtile,ktile
5919 integer ixend,jyend,kzend,kzbeg
5920 integer nxend,nyend,nzend,nzbeg
5922 real :: qx(ngs,lv:lhab)
5923 real :: cx(ngs,lc:lhab)
5924 real :: xv(ngs,lc:lhab)
5925 real :: xmas(ngs,lc:lhab)
5926 real :: xdn(ngs,lc:lhab)
5927 real :: xdia(ngs,lc:lhab,3)
5928 real :: alpha(ngs,lc:lhab)
5930 real :: gamc1,gamc2,gami1,gami2,gams1,gams2, factor_c, factor_i, factor_s
5931 real :: lam_c, lam_i, lam_s, lam_r, lam_h, lam_hl
5932 real :: gamr1,gamr2,gamh1,gamh2,factor_r,factor_h,factor_hl
5935 double precision :: numh, numhl,denomh,denomhl
5937 logical :: flag_t4, flag_t5, flag_t6
5939 real,
parameter :: qmin = 1.e-8
5940 real,
parameter :: volmin = 1.e-30
5960 IF (
present(f_t4) )
THEN
5961 IF (
present(f_t4) )
THEN
5966 IF (
present(f_t5) )
THEN
5967 IF (
present(f_t5) )
THEN
5972 IF (
present(f_t6) )
THEN
5973 IF (
present(f_t6) )
THEN
5982 gamc1 = gamma_sp(2. + cnu)
5984 gami1 = gamma_sp(2. + cinu)
5986 gams1 = gamma_sp(2. + snu)
5987 gams2 = gamma_sp(1. + snu)
5988 gamr1 = gamma_sp(2. + rnu)
5989 gamr2 = gamma_sp(1. + rnu)
5991 factor_c = (1. + cnu)*gamma_sp(1. + cnu)/gamma_sp(5./3. + cnu)
5992 factor_i = (1. + cinu)*gamma_sp(1. + cinu)/gamma_sp(5./3. + cinu)
5993 factor_s = (1. + snu)*gamma_sp(1. + snu)/gamma_sp(5./3. + snu)
5995 IF (
present(t4) )
THEN
5996 IF ( imurain == 3 )
THEN
5997 factor_r = (1. + rnu)*gamma_sp(1. + rnu)/gamma_sp(5./3. + rnu)
5999 factor_r = ((pi*(alphar+3.)*(alphar+1.)*(alphar+1.))/6.)**(1./3.)
6003 factor_h = ((pi*(alphah+3.)*(alphah+1.)*(alphah+1.))/6.)**(1./3.)
6004 factor_hl = ((pi*(alphahl+3.)*(alphahl+1.)*(alphahl+1.))/6.)**(1./3.)
6016 rho0(mgs) = dn(ix,jy,kz)
6017 IF (
present( an ) )
THEN
6019 qx(mgs,il) = max(an(ix,jy,kz,il), 0.0)
6020 cx(mgs,il) = max(an(ix,jy,kz,ln(il)), 0.0)
6025 IF (
present(qcw) ) qx(mgs,lc) = qcw(ix,kz)
6026 IF (
present(qci) ) qx(mgs,li) = qci(ix,kz)
6027 IF (
present(qsw) ) qx(mgs,ls) = qsw(ix,kz)
6028 IF (
present(qrw) ) qx(mgs,lr) = qrw(ix,kz)
6029 IF (
present(ccw) ) cx(mgs,lc) = ccw(ix,kz)*rho0(mgs)
6030 IF (
present(cci) ) cx(mgs,li) = cci(ix,kz)*rho0(mgs)
6031 IF (
present(csw) ) cx(mgs,ls) = csw(ix,kz)*rho0(mgs)
6032 IF (
present(crw) ) cx(mgs,lr) = crw(ix,kz)*rho0(mgs)
6036 IF (
present( t1 ) .and. qx(mgs,lc) > qxmin(lc) .and. cx(mgs,lc) > cxmin )
THEN
6038 lam_c = ((cx(mgs,lc)*(pi/6.)*xdn0(lc)*gamc1)/(qx(mgs,lc)*rho0(mgs)*gamc2))**(1./3.)
6039 t1(ix,jy,kz) = 0.5*factor_c/lam_c
6042 IF (
present( t2 ) .and. qx(mgs,li) > qxmin(li) .and. cx(mgs,li) > cxmin )
THEN
6044 lam_i = ((cx(mgs,li)*(pi/6.)*xdn0(li)*gami1)/(qx(mgs,li)*rho0(mgs)*gami2))**(1./3.)
6045 t2(ix,jy,kz) = 0.5*factor_i/lam_i
6048 IF (
present( t3 ) .and. qx(mgs,ls) > qxmin(ls) .and. cx(mgs,ls) > cxmin )
THEN
6050 lam_s = ((cx(mgs,ls)*(pi/6.)*xdn0(ls)*gams1)/(qx(mgs,ls)*rho0(mgs)*gams2))**(1./3.)
6051 t3(ix,jy,kz) = 0.5*factor_s/lam_s
6054 IF (
present( t4 ) .and.( (
present(qrw) .and.
present(crw) ) .or. flag_t4 ) )
THEN
6055 IF ( qx(mgs,lr) > max(qmin,qxmin(lr)) .and. cx(mgs,lr) > cxmin )
THEN
6056 IF ( imurain == 1 )
THEN
6058 lam_r = factor_r *((xdn0(lr)*cx(mgs,lr))/(qx(mgs,lr)*rho0(mgs)))**(1./3.)
6059 t4(ix,jy,kz) = 0.5*(alphar+3.)/lam_r
6062 lam_r = ((cx(mgs,lr)*(pi/6.)*xdn0(lr)*gamr1)/(qx(mgs,lr)*rho0(mgs)*gamr2))**(1./3.)
6063 t4(ix,jy,kz) = 0.5*factor_r/lam_r
6068 IF (
present(t5) .and. flag_t5 )
THEN
6072 IF ( lhl < 1 .or. flag_t6 )
THEN
6074 IF ( qx(mgs,lh) > max(qmin,qxmin(lh)) )
THEN
6078 IF ( an(ix,jy,kz,lvh) > volmin )
THEN
6079 hwdn = rho0(mgs)*qx(mgs,lh)/an(ix,jy,kz,lvh)
6083 lam_h = factor_h *((hwdn*cx(mgs,lh))/(qx(mgs,lh)*rho0(mgs)))**(1./3.)
6084 t5(ix,jy,kz) = 0.5*(alphah+3.)/lam_h
6089 IF ( qx(mgs,lh) > max(qmin,qxmin(lh)) .and. qx(mgs,lhl) < max(qmin,qxmin(lhl)) )
THEN
6093 IF ( an(ix,jy,kz,lvh) > volmin )
THEN
6094 hwdn = rho0(mgs)*qx(mgs,lh)/an(ix,jy,kz,lvh)
6098 lam_h = factor_h *((hwdn*cx(mgs,lh))/(qx(mgs,lh)*rho0(mgs)))**(1./3.)
6099 t5(ix,jy,kz) = 0.5*(alphah+3.)/lam_h
6101 ELSEIF ( qx(mgs,lh) < max(qmin,qxmin(lh)) .and. qx(mgs,lhl) > max(qmin,qxmin(lhl)) )
THEN
6104 IF ( lvhl > 1 )
THEN
6105 IF ( an(ix,jy,kz,lvhl) > volmin )
THEN
6106 hldn = rho0(mgs)*qx(mgs,lhl)/an(ix,jy,kz,lvhl)
6110 lam_hl = factor_hl *((hldn*cx(mgs,lhl))/(qx(mgs,lhl)*rho0(mgs)))**(1./3.)
6111 t5(ix,jy,kz) = 0.5*(alphahl+3.)/lam_hl
6113 ELSEIF ( qx(mgs,lh) > max(qmin,qxmin(lh)) .and. qx(mgs,lhl) > max(qmin,qxmin(lhl)) )
THEN
6117 IF ( lvhl > 1 )
THEN
6118 IF ( an(ix,jy,kz,lvhl) > volmin )
THEN
6119 hldn = rho0(mgs)*qx(mgs,lhl)/an(ix,jy,kz,lvhl)
6125 IF ( an(ix,jy,kz,lvh) > volmin )
THEN
6126 hwdn = rho0(mgs)*qx(mgs,lh)/an(ix,jy,kz,lvh)
6130 lam_h = factor_h *((hwdn*cx(mgs,lh))/(qx(mgs,lh)*rho0(mgs)))**(1./3.)
6131 lam_hl = factor_hl *((hldn*cx(mgs,lhl))/(qx(mgs,lhl)*rho0(mgs)))**(1./3.)
6133 numh = cx(mgs,lh)*(alphah+3.)*(alphah+2.)*(alphah+1.)/lam_h**3
6134 numhl = cx(mgs,lhl)*(alphahl+3.)*(alphahl+2.)*(alphahl+1.)/lam_hl**3
6136 denomh = cx(mgs,lh)*(alphah+2.)*(alphah+1.)/lam_h**2
6137 denomhl = cx(mgs,lhl)*(alphahl+2.)*(alphahl+1.)/lam_hl**2
6139 t5(ix,jy,kz) = 0.5*(numh + numhl)/(denomh + denomhl)
6148 IF (
present(t6) .and. flag_t6 .and. lhl > 1 )
THEN
6150 IF ( qx(mgs,lhl) > max(qmin,qxmin(lhl)) )
THEN
6153 IF ( lvhl > 1 )
THEN
6154 IF ( an(ix,jy,kz,lvhl) > volmin )
THEN
6155 hldn = rho0(mgs)*qx(mgs,lhl)/an(ix,jy,kz,lvhl)
6159 lam_hl = factor_hl *((hldn*cx(mgs,lhl))/(qx(mgs,lhl)*rho0(mgs)))**(1./3.)
6160 t6(ix,jy,kz) = 0.5*(alphahl+3.)/lam_hl
6179 SUBROUTINE qvexcess(ngs,mgs,qwvp0,qv0,qcw1,pres,thetap0,theta0, &
6180 & qvex,pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ss1,pk,ngscnt)
6188 integer ngs,mgs,ngscnt
6201 real qv0(ngs), qcw1(ngscnt), pres(ngs), qwvp0(mgs)
6202 real thetap0(ngs), theta0(ngs)
6203 real fcqv1(ngs), felvcp(ngs), pi0(ngs)
6214 real theta(ngs), qvap(ngs), pqs(ngs), qcw(ngs), qwv(ngs)
6215 real qcwtmp(ngs), qss(ngs), qvs(ngs), qwvp(ngs)
6216 real dqcw(ngs), dqwv(ngs), dqvcnd(ngs)
6217 real temg(ngs), temcg(ngs), thetap(ngs)
6220 parameter( tfr = 273.15 )
6232 pqs(mgs) = (380.0)/(pres(mgs))
6233 thetap(mgs) = thetap0(mgs)
6234 theta(mgs) = thetap(mgs) + theta0(mgs)
6235 qwvp(mgs) = qwvp0(mgs)
6236 qvap(mgs) = max( (qwvp0(mgs) + qv0(mgs)), 0.0 )
6237 temg(mgs) = theta(mgs)*pk(mgs)
6245 qwv(mgs) = max( 0.0, qvap(mgs) )
6246 qcw(mgs) = max( 0.0, qcw1(mgs) )
6249 qcwtmp(mgs) = qcw(mgs)
6250 temcg(mgs) = temg(mgs) - tfr
6251 ltemq = (temg(mgs)-163.15)/fqsat+1.5
6252 ltemq = min( nqsat, max(1,ltemq) )
6254 IF ( iqvsopt == 0 )
THEN
6255 pqs(mgs) = (380.0)/(pres(mgs))
6256 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
6257 ELSEIF ( iqvsopt == 1 )
THEN
6258 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
6261 qss(mgs) = (0.01*ss1 + 1.0)*qvs(mgs)
6271 dqwv(mgs) = ( qwv(mgs) - qss(mgs) )
6275 if( dqwv(mgs) .lt. 0. )
then
6276 if( qcw(mgs) .gt. -dqwv(mgs) )
then
6277 dqcw(mgs) = dqwv(mgs)
6280 dqcw(mgs) = -qcw(mgs)
6281 dqwv(mgs) = dqwv(mgs) + qcw(mgs)
6284 qwvp(mgs) = qwvp(mgs) - ( dqcw(mgs) )
6286 qcw(mgs) = qcw(mgs) + dqcw(mgs)
6288 thetap(mgs) = thetap(mgs) + &
6290 & (felvcp(mgs)*dqcw(mgs) )
6296 IF ( dqwv(mgs) .ge. 0. )
THEN
6298 dqvcnd(mgs) = dqwv(mgs)/(1. + fcqv1(mgs)*qss(mgs)/ &
6299 & ((temg(mgs)-cbw)**2))
6302 dqcw(mgs) = dqvcnd(mgs)
6304 thetap(mgs) = thetap(mgs) + &
6305 & (felvcp(mgs)*dqcw(mgs) ) &
6307 qwvp(mgs) = qwvp(mgs) - ( dqvcnd(mgs) )
6308 qcw(mgs) = qcw(mgs) + dqcw(mgs)
6312 theta(mgs) = thetap(mgs) + theta0(mgs)
6313 temg(mgs) = theta(mgs)*pk(mgs)
6315 qvap(mgs) = max((qwvp(mgs) + qv0(mgs)), 0.0)
6316 temcg(mgs) = temg(mgs) - tfr
6318 ltemq = (temg(mgs)-163.15)/fqsat+1.5
6319 ltemq = min( nqsat, max(1,ltemq) )
6320 IF ( iqvsopt == 0 )
THEN
6321 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
6322 ELSEIF ( iqvsopt == 1 )
THEN
6323 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
6325 qcw(mgs) = max( 0.0, qcw(mgs) )
6326 qwv(mgs) = max( 0.0, qvap(mgs))
6327 qss(mgs) = (0.01*ss1 + 1.0)*qvs(mgs)
6333 qvex = max(0.0, qcw(mgs) - qcw1(mgs) )
6336 END SUBROUTINE qvexcess
6350 SUBROUTINE setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp, &
6351 & xmas,vtxbar,xdn,xvmn0,xvmx0,xv,cdx,cdxgs, &
6352 & ipconc1,ndebug1,ngs,nz,igs,kgs,fadvisc, &
6353 & cwmasn,cwmasx,cwradn,cnina,cimna,cimxa, &
6354 & itype1a,itype2a,temcg,infdo,alpha,axx,bxx,ildo)
6360 integer ngscnt,ngs0,ngs,nz
6363 real xv(ngs,lc:lhab)
6364 real qx(ngs,lv:lhab)
6365 real qxw(ngs,ls:lhab)
6366 real cx(ngs,lc:lhab)
6367 real vtxbar(ngs,lc:lhab,3)
6368 real xmas(ngs,lc:lhab)
6369 real xdn(ngs,lc:lhab)
6370 real cdxgs(ngs,lc:lhab)
6371 real xdia(ngs,lc:lhab,3)
6372 real xvmn0(lc:lhab), xvmx0(lc:lhab)
6375 real alpha(ngs,lc:lhab)
6377 real rho0(ngs),rhovt(ngs),temcg(ngs)
6381 real cwc1, cimna, cimxa
6383 integer igs(ngs),kgs(ngs)
6390 integer,
intent (in) :: itype1a,itype2a,infdo
6391 integer,
intent (in) :: ildo
6393 real :: axx(ngs,lh:lhab),bxx(ngs,lh:lhab)
6404 real :: cwch(ngscnt), cwchl(ngscnt)
6405 real :: cwchtmp,cwchltmp,xnutmp
6408 real cwmasn,cwmasx,cwradn
6417 real arx,frx,vtrain,fw
6418 real fwlo,fwhi,rfwdiff
6432 parameter( bta1 = 0.6, cnit = 1.0e-02 )
6437 real,
parameter :: rho00 = 1.225
6453 rfwdiff = 1./(fwhi - fwlo)
6468 IF ( ildo == 0 )
THEN
6486 IF ( lh .gt. 1 )
THEN
6487 IF ( dmuh == 1.0 )
THEN
6488 cwchtmp = ((3. + dnu(lh))*(2. + dnu(lh))*(1.0 + dnu(lh)))**(-1./3.)
6490 cwchtmp = 6.0*pii*gamma_sp( (xnu(lh) + 1.)/xmu(lh) )/gamma_sp( (xnu(lh) + 2.)/xmu(lh) )
6493 IF ( lhl .gt. 1 )
THEN
6494 IF ( dmuhl == 1.0 )
THEN
6495 cwchltmp = ((3. + dnu(lhl))*(2. + dnu(lhl))*(1.0 + dnu(lhl)))**(-1./3.)
6497 cwchltmp = 6.0*pii*gamma_sp( (xnu(lhl) + 1)/xmu(lhl) )/gamma_sp( (xnu(lhl) + 2)/xmu(lhl) )
6501 IF ( ipconc .le. 5 )
THEN
6502 IF ( lh .gt. 1 ) cwch(:) = cwchtmp
6503 IF ( lhl .gt. 1 ) cwchl(:) = cwchltmp
6507 IF ( lh .gt. 1 .and. ( ildo == 0 .or. ildo == lh ) )
THEN
6508 IF ( qx(mgs,lh) .gt. qxmin(lh) )
THEN
6509 IF ( dmuh == 1.0 )
THEN
6510 cwch(mgs) = ((3. + alpha(mgs,lh))*(2. + alpha(mgs,lh))*(1.0 + alpha(mgs,lh)))**(-1./3.)
6512 xnutmp = (alpha(mgs,lh) - 2.0)/3.0
6513 cwch(mgs) = 6.0*pii*gamma_sp( (xnutmp + 1.)/xmu(lh) )/gamma_sp( (xnutmp + 2.)/xmu(lh) )
6519 IF ( lhl .gt. 1 .and. ( ildo == 0 .or. ildo == lhl ) )
THEN
6520 IF ( qx(mgs,lhl) .gt. qxmin(lhl) )
THEN
6521 IF ( dmuhl == 1.0 )
THEN
6522 cwchl(mgs) = ((3. + alpha(mgs,lhl))*(2. + alpha(mgs,lhl))*(1.0 + alpha(mgs,lhl)))**(-1./3.)
6524 xnutmp = (alpha(mgs,lhl) - 2.0)/3.0
6525 cwchl(mgs) = 6.0*pii*gamma_sp( (xnutmp + 1)/xmu(lhl) )/gamma_sp( (xnutmp + 2)/xmu(lhl) )
6528 cwchl(mgs) = cwchltmp
6537 cimasn = min( cimas0, 6.88e-13)
6541 cwc1 = 6.0/(pi*1000.)
6543 mwfac = 6.0**(1./3.)
6546 if (ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set scale diameter'
6557 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set cloud water variables'
6559 IF ( ildo == 0 .or. ildo == lc )
THEN
6564 IF ( qx(mgs,lc) .gt. qxmin(lc) )
THEN
6566 IF ( ipconc .ge. 2 )
THEN
6567 IF ( cx(mgs,lc) .gt. cxmin)
THEN
6569 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
6570 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6572 cx(mgs,lc) = max( cxmin, rho0(mgs)*qx(mgs,lc)/cwmasx )
6573 xmas(mgs,lc) = min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
6574 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6578 IF ( ipconc .lt. 2 )
THEN
6579 cx(mgs,lc) = rho0(mgs)*ccn/rho00
6581 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. 0.01 )
THEN
6583 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),xdn(mgs,lc)*xvmn(lc)), &
6584 & xdn(mgs,lc)*xvmx(lc) )
6586 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6587 cx(mgs,lc) = qx(mgs,lc)*rho0(mgs)/xmas(mgs,lc)
6589 ELSEIF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .le. 1.0e-9 )
THEN
6590 cx(mgs,lc) = max( cxmin, rho0(mgs)*qx(mgs,lc)/cwmasx )
6592 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
6593 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6595 ELSEIF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .le. 0.01 )
THEN
6596 xmas(mgs,lc) = xdn(mgs,lc)*4.*pi/3.*(5.0e-6)**3
6597 cx(mgs,lc) = rho0(mgs)*qx(mgs,lc)/xmas(mgs,lc)
6598 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6601 xmas(mgs,lc) = cwmasn
6602 xv(mgs,lc) = xmas(mgs,lc)/1000.
6614 xdia(mgs,lc,1) = (xmas(mgs,lc)*cwc1)**(1./3.)
6615 xdia(mgs,lc,2) = xdia(mgs,lc,1)**2
6616 xdia(mgs,lc,3) = xdia(mgs,lc,1)
6617 cwrad = 0.5*xdia(mgs,lc,1)
6618 IF ( fadvisc(mgs) > 0.0 )
THEN
6619 vtxbar(mgs,lc,1) = &
6620 & (2.0*gr*xdn(mgs,lc) *(cwrad**2)) &
6621 & /(9.0*fadvisc(mgs))
6623 vtxbar(mgs,lc,1) = 0.0
6628 xmas(mgs,lc) = cwmasn
6629 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
6630 IF ( qx(mgs,lc) <= 0.0 ) cx(mgs,lc) = 0.0
6631 IF ( ipconc .le. 1 ) cx(mgs,lc) = 0.01
6632 xdia(mgs,lc,1) = 2.*cwradn
6633 xdia(mgs,lc,2) = 4.*cwradn**2
6634 xdia(mgs,lc,3) = xdia(mgs,lc,1)
6635 vtxbar(mgs,lc,1) = 0.0
6653 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set cip'
6655 IF ( li .gt. 1 .and. ( ildo == 0 .or. ildo == li ) )
THEN
6658 IF ( ipconc .eq. 0 )
THEN
6660 cx(mgs,li) = cnina(mgs)
6661 IF ( cimna .gt. 1.0 )
THEN
6662 cx(mgs,li) = max(cimna,cx(mgs,li))
6664 IF ( cimxa .gt. 1.0 )
THEN
6665 cx(mgs,li) = min(cimxa,cx(mgs,li))
6668 IF ( itype1a .ge. 1 .or. itype2a .ge. 1 )
THEN
6669 cx(mgs,li) = max(cx(mgs,li),qx(mgs,li)*rho0(mgs)/cimasx)
6670 cx(mgs,li) = min(cx(mgs,li),qx(mgs,li)*rho0(mgs)/cimasn)
6673 cx(mgs,li) = max(1.0e-20,cx(mgs,li))
6677 ELSEIF ( ipconc .ge. 1 )
THEN
6678 IF ( qx(mgs,li) .gt. qxmin(li) )
THEN
6679 cx(mgs,li) = max(cx(mgs,li),qx(mgs,li)*rho0(mgs)/cimasx)
6680 cx(mgs,li) = min(cx(mgs,li),qx(mgs,li)*rho0(mgs)/cimasn)
6685 IF ( qx(mgs,li) .gt. qxmin(li) )
THEN
6687 & max( qx(mgs,li)*rho0(mgs)/cx(mgs,li), cimasn )
6693 if ( xmas(mgs,li) .gt. 0.0 )
THEN
6698 IF ( ixtaltype == 1 )
THEN
6699 xdia(mgs,li,1) = 0.1871*(xmas(mgs,li)**(0.3429))
6700 xdia(mgs,li,3) = 0.1871*(xmas(mgs,li)**(0.3429))
6701 ELSEIF ( ixtaltype == 2 )
THEN
6702 xdia(mgs,li,1) = 0.277823*xmas(mgs,li)**0.359971
6703 xdia(mgs,li,3) = 0.277823*xmas(mgs,li)**0.359971
6710 IF ( ipconc .ge. 0 )
THEN
6713 xv(mgs,li) = xmas(mgs,li)/xdn(mgs,li)
6714 IF ( icefallopt == 1 )
THEN
6715 IF ( ixtaltype == 1 )
THEN
6716 tmp = (67056.6300748612*rhovt(mgs))/ &
6717 & (((1.0 + cinu)/xv(mgs,li))**0.4716666666666667*gfcinu1)
6718 vtxbar(mgs,li,2) = tmp*gfcinu1p47
6719 vtxbar(mgs,li,1) = tmp*gfcinu2p47/(1. + cinu)
6720 vtxbar(mgs,li,3) = vtxbar(mgs,li,1)
6721 ELSEIF ( ixtaltype == 2 )
THEN
6722 vtxbar(mgs,li,1) = 11.9495*rhovt(mgs)*(xv(mgs,li))**(0.14)
6723 vtxbar(mgs,li,2) = 7.02909*rhovt(mgs)*(xv(mgs,li))**(0.14)
6724 vtxbar(mgs,li,3) = vtxbar(mgs,li,1)
6728 ELSEIF ( icefallopt == 2 )
THEN
6729 tmp = (82.3166*rhovt(mgs))/ &
6730 & (((1.0 + cinu)/xv(mgs,li))**0.22117*gfcinu1)
6731 vtxbar(mgs,li,2) = tmp*gfcinu1p22
6732 vtxbar(mgs,li,1) = tmp*gfcinu2p22/(1. + cinu)
6733 vtxbar(mgs,li,3) = vtxbar(mgs,li,1)
6735 ELSEIF ( icefallopt == 3 )
THEN
6737 tmp = (47.6273*rhovt(mgs))/ &
6738 & (((1.0 + cinu)/xv(mgs,li))**0.18333*gfcinu1)
6739 vtxbar(mgs,li,2) = tmp*gfcinu1p18
6740 vtxbar(mgs,li,1) = tmp*gfcinu2p18/(1. + cinu)
6741 vtxbar(mgs,li,3) = vtxbar(mgs,li,1)
6747 xdia(mgs,li,2) = xdia(mgs,li,1)**2
6750 xdia(mgs,li,1) = max(xdia(mgs,li,1), 10.e-6)
6751 xdia(mgs,li,1) = min(xdia(mgs,li,1), 1000.e-6)
6752 vtxbar(mgs,li,1) = (4.942e4)*(xdia(mgs,li,1)**(1.4150))
6755 xdia(mgs,li,2) = xdia(mgs,li,1)**2
6756 vtxbar(mgs,li,1) = vtxbar(mgs,li,1)*rhovt(mgs)
6757 xv(mgs,li) = xmas(mgs,li)/xdn(mgs,li)
6760 xmas(mgs,li) = 1.e-13
6761 IF ( qx(mgs,li) <= 0.0 ) cx(mgs,li) = 0.0
6763 xdia(mgs,li,1) = 1.e-7
6764 xdia(mgs,li,2) = (1.e-14)
6765 xdia(mgs,li,3) = 1.e-7
6766 vtxbar(mgs,li,1) = 0.0
6771 IF ( icefallfac /= 1.0 )
THEN
6772 vtxbar(mgs,li,1) = icefallfac*vtxbar(mgs,li,1)
6773 vtxbar(mgs,li,2) = icefallfac*vtxbar(mgs,li,2)
6774 vtxbar(mgs,li,3) = icefallfac*vtxbar(mgs,li,3)
6790 IF ( ildo == 0 .or. ildo == lr )
THEN
6792 if ( qx(mgs,lr) .gt. qxmin(lr) )
then
6797 if ( ipconc .ge. 3 )
then
6798 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
6800 IF ( imaxdiaopt == 1 )
THEN
6802 ELSEIF ( imaxdiaopt == 2 )
THEN
6803 IF ( imurain == 1 )
THEN
6804 xvbarmax = xvmx(lr)/((3. + alpha(mgs,lr))**3/((3. + alpha(mgs,lr))*(2. + alpha(mgs,lr))*(1. + alpha(mgs,lr))))
6805 ELSEIF ( imurain == 3 )
THEN
6808 ELSEIF ( imaxdiaopt == 3 )
THEN
6809 IF ( imurain == 1 )
THEN
6810 xvbarmax = xvmx(lr)/((4. + alpha(mgs,lr))**3/((3. + alpha(mgs,lr))*(2. + alpha(mgs,lr))*(1. + alpha(mgs,lr))))
6811 ELSEIF ( imurain == 3 )
THEN
6816 IF ( xv(mgs,lr) .gt. xvbarmax )
THEN
6817 xv(mgs,lr) = xvbarmax
6818 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvbarmax*xdn(mgs,lr))
6819 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
6820 xv(mgs,lr) = xvmn(lr)
6821 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
6825 xmas(mgs,lr) = xv(mgs,lr)*xdn(mgs,lr)
6826 xdia(mgs,lr,3) = (xmas(mgs,lr)*cwc1)**(1./3.)
6827 IF ( imurain == 3 )
THEN
6829 xdia(mgs,lr,1) = xdia(mgs,lr,3)
6831 xdia(mgs,lr,1) = (6.*pii*xv(mgs,lr)/((alpha(mgs,lr)+3.)*(alpha(mgs,lr)+2.)*(alpha(mgs,lr)+1.)))**(1./3.)
6841 & (qx(mgs,lr)*rho0(mgs)/(pi*xdn(mgs,lr)*cno(lr)))**(0.25)
6842 xmas(mgs,lr) = xdn(mgs,lr)*(pi/6.)*xdia(mgs,lr,1)**3
6843 xdia(mgs,lr,3) = (xmas(mgs,lr)*cwc1)**(1./3.)
6844 cx(mgs,lr) = cno(lr)*xdia(mgs,lr,1)
6845 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
6848 xdia(mgs,lr,1) = 1.e-9
6849 xdia(mgs,lr,3) = 1.e-9
6850 xmas(mgs,lr) = xdn(mgs,lr)*(pi/6.)*xdia(mgs,lr,1)**3
6853 xdia(mgs,lr,2) = xdia(mgs,lr,1)**2
6863 IF ( ls .gt. 1 .and. ( ildo == 0 .or. ildo == ls ) )
THEN
6866 if ( qx(mgs,ls) .gt. qxmin(ls) )
then
6867 if ( ipconc .ge. 4 )
then
6869 xmas(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(max(1.0e-9,cx(mgs,ls)))
6876 IF ( isnowdens == 2 )
THEN
6878 xdn(mgs,ls) = 0.0346159*sqrt(cx(mgs,ls)/(qx(mgs,ls)*rho0(mgs)) )
6879 xdn(mgs,ls) = max( 100.0, xdn(mgs,ls) )
6881 IF ( xdn(mgs,ls) <= 900. )
THEN
6882 dtmp = sqrt( xmas(mgs,ls)/0.069 )
6883 xv(mgs,ls) = 28.8887*xmas(mgs,ls)**(3./2.)
6886 xv(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xdn(mgs,ls)*max(1.0e-9,cx(mgs,ls)))
6887 dtmp = (xv(mgs,ls)*cwc0*6.0)**(1./3.)
6891 xv(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xdn(mgs,ls)*max(1.0e-9,cx(mgs,ls)))
6892 dtmp = (xv(mgs,ls)*cwc0*6.0)**(1./3.)
6895 xdia(mgs,ls,1) = dtmp
6897 IF ( xv(mgs,ls) .lt. xvmn(ls) .and. isnowdens == 1)
THEN
6898 xv(mgs,ls) = max( xvmn(ls),xv(mgs,ls) )
6899 xmas(mgs,ls) = xv(mgs,ls)*xdn(mgs,ls)
6900 cx(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xmas(mgs,ls))
6901 xdia(mgs,ls,1) = (xv(mgs,ls)*cwc0*6.0)**(1./3.)
6904 IF ( xv(mgs,ls) .gt. xvmx(ls)*max(1.,100./min(100.,xdn(mgs,ls))) )
THEN
6905 xv(mgs,ls) = min( xvmx(ls), max( xvmn(ls),xv(mgs,ls) ) )
6906 xmas(mgs,ls) = 0.106214*xv(mgs,ls)**(2./3.)
6907 cx(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xmas(mgs,ls))
6908 xdn(mgs,ls) = 0.0346159*sqrt(cx(mgs,ls)/(qx(mgs,ls)*rho0(mgs)) )
6909 xdia(mgs,ls,1) = sqrt( xmas(mgs,ls)/0.069 )
6912 xdia(mgs,ls,3) = xdia(mgs,ls,1)
6916 & (qx(mgs,ls)*rho0(mgs)/(pi*xdn(mgs,ls)*cnostmp(mgs)))**(0.25)
6917 cx(mgs,ls) = cnostmp(mgs)*xdia(mgs,ls,1)
6918 xv(mgs,ls) = rho0(mgs)*qx(mgs,ls)/(xdn(mgs,ls)*cx(mgs,ls))
6919 xdia(mgs,ls,3) = (xv(mgs,ls)*cwc0*6.0)**(1./3.)
6922 xdia(mgs,ls,1) = 1.e-9
6923 xdia(mgs,ls,3) = 1.e-9
6926 IF ( isnowdens == 2 )
THEN
6931 xdia(mgs,ls,2) = xdia(mgs,ls,1)**2
6944 IF ( lh .gt. 1 .and. ( ildo == 0 .or. ildo == lh ) )
THEN
6947 if ( qx(mgs,lh) .gt. qxmin(lh) )
then
6948 if ( ipconc .ge. 5 )
then
6950 xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*max(1.0e-9,cx(mgs,lh)))
6951 xmas(mgs,lh) = xv(mgs,lh)*xdn(mgs,lh)
6953 IF ( xv(mgs,lh) .lt. xvmn(lh) .or. xv(mgs,lh) .gt. xvmx(lh) )
THEN
6954 xv(mgs,lh) = min( xvmx(lh), max( xvmn(lh),xv(mgs,lh) ) )
6955 xmas(mgs,lh) = xv(mgs,lh)*xdn(mgs,lh)
6956 cx(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xmas(mgs,lh))
6959 xdia(mgs,lh,3) = (xv(mgs,lh)*6.*pii)**(1./3.)
6960 IF ( dmuh == 1.0 )
THEN
6961 xdia(mgs,lh,1) = cwch(mgs)*xdia(mgs,lh,3)
6963 xdia(mgs,lh,1) = (xv(mgs,lh)*cwch(mgs))**(1./3.)
6968 & (qx(mgs,lh)*rho0(mgs)/(pi*xdn(mgs,lh)*cno(lh)))**(0.25)
6969 cx(mgs,lh) = cno(lh)*xdia(mgs,lh,1)
6970 xv(mgs,lh) = max(xvmn(lh), rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh)) )
6971 xdia(mgs,lh,3) = (xv(mgs,lh)*6./pi)**(1./3.)
6974 xdia(mgs,lh,1) = 1.e-9
6975 xdia(mgs,lh,3) = 1.e-9
6977 xdia(mgs,lh,2) = xdia(mgs,lh,1)**2
6990 IF ( lhl .gt. 1 .and. ( ildo == 0 .or. ildo == lhl ) )
THEN
6993 if ( qx(mgs,lhl) .gt. qxmin(lhl) )
then
6994 if ( ipconc .ge. 5 )
then
6996 xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*max(1.0e-9,cx(mgs,lhl)))
6997 xmas(mgs,lhl) = xv(mgs,lhl)*xdn(mgs,lhl)
7000 IF ( xv(mgs,lhl) .lt. xvmn(lhl) .or. xv(mgs,lhl) .gt. xvmx(lhl) )
THEN
7001 xv(mgs,lhl) = min( xvmx(lhl), max( xvmn(lhl),xv(mgs,lhl) ) )
7002 xmas(mgs,lhl) = xv(mgs,lhl)*xdn(mgs,lhl)
7003 cx(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xmas(mgs,lhl))
7006 xdia(mgs,lhl,3) = (xv(mgs,lhl)*6./pi)**(1./3.)
7007 IF ( dmuhl == 1.0 )
THEN
7008 xdia(mgs,lhl,1) = cwchl(mgs)*xdia(mgs,lhl,3)
7010 xdia(mgs,lhl,1) = (xv(mgs,lhl)*cwchl(mgs))**(1./3.)
7016 & (qx(mgs,lhl)*rho0(mgs)/(pi*xdn(mgs,lhl)*cno(lhl)))**(0.25)
7017 cx(mgs,lhl) = cno(lhl)*xdia(mgs,lhl,1)
7018 xv(mgs,lhl) = max(xvmn(lhl), rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl)) )
7019 xdia(mgs,lhl,3) = (xv(mgs,lhl)*6./pi)**(1./3.)
7022 xdia(mgs,lhl,1) = 1.e-9
7023 xdia(mgs,lhl,3) = 1.e-9
7025 xdia(mgs,lhl,2) = xdia(mgs,lhl,1)**2
7046 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set terminal velocities'
7053 IF ( ildo == 0 .or. ildo == lr )
THEN
7055 if ( qx(mgs,lr) .gt. qxmin(lr) )
then
7056 IF ( ipconc .lt. 3 )
THEN
7057 vtxbar(mgs,lr,1) = rainfallfac*(ar*gf4br/6.0)*(xdia(mgs,lr,1)**br)*rhovt(mgs)
7061 IF ( imurain == 1 )
THEN
7070 vtxbar(mgs,lr,1) = rhovt(mgs)*arx*(1.0 - (1.0 + frx*xdia(mgs,lr,1))**(-alp - 4.0) )
7072 IF ( infdo .ge. 1 .and. rssflg == 1 )
THEN
7073 vtxbar(mgs,lr,2) = rhovt(mgs)*arx*(1.0 - (1.0 + frx*xdia(mgs,lr,1))**(-alp - 1.0) )
7075 vtxbar(mgs,lr,2) = vtxbar(mgs,lr,1)
7078 IF ( infdo .ge. 2 .and. rssflg == 1 )
THEN
7079 vtxbar(mgs,lr,3) = rhovt(mgs)*arx*(1.0 - (1.0 + frx*xdia(mgs,lr,1))**(-alp - 7.0) )
7081 vtxbar(mgs,lr,3) = vtxbar(mgs,lr,1)
7086 ELSEIF ( imurain == 3 )
THEN
7089 rwdia = min( xdia(mgs,lr,1), 8.0e-3 )
7091 vtxbar(mgs,lr,1) = rhovt(mgs)*6.0*pii*( 0.04771 + 3788.0*rwdia - &
7092 & 1.105e6*rwdia**2 + 1.412e8*rwdia**3 - 6.527e9*rwdia**4)
7094 IF ( infdo .ge. 1 )
THEN
7095 IF ( rssflg >= 1 )
THEN
7096 vtxbar(mgs,lr,2) = (0.09112 + 2714.0*rwdia - 4.872e5*rwdia**2 + &
7097 & 4.495e7*rwdia**3 - 1.626e9*rwdia**4)*rhovt(mgs)
7099 vtxbar(mgs,lr,2) = vtxbar(mgs,lr,1)
7103 IF ( infdo .ge. 2 )
THEN
7104 vtxbar(mgs,lr,3) = rhovt(mgs)*( &
7106 & 9246.494*(rwdia) - &
7107 & 3.2839926e6*(rwdia**2) + &
7108 & 4.944093e8*(rwdia**3) - &
7109 & 2.631718e10*(rwdia**4) )
7115 rnux = alpha(mgs,lr)
7117 IF ( infdo .ge. 1 .and. rssflg == 1)
THEN
7118 vtxbar(mgs,lr,2) = rhovt(mgs)* &
7119 & (((1. + rnux)/vr)**(-1.333333)* &
7120 & (0.0911229*((1. + rnux)/vr)**1.333333*gamma_sp(1. + rnux) + &
7121 & (5430.3131*(1. + rnux)*gamma_sp(4./3. + rnux))/ &
7122 & vr - 1.0732802e6*((1. + rnux)/vr)**0.6666667* &
7123 & gamma_sp(1.666667 + rnux) + &
7124 & 8.584110982429507e7*((1. + rnux)/vr)**(1./3.)* &
7125 & gamma_sp(2. + rnux) - &
7126 & 2.3303765697228556e9*gamma_sp(7./3. + rnux)))/ &
7127 & gamma_sp(1. + rnux)
7131 vtxbar(mgs,lr,1) = rhovt(mgs)* &
7132 & (0.0911229*(1 + rnux)**1.3333333333333333*gamma_sp(2. + rnux) + &
7133 & 5430.313059683277*(1 + rnux)*vr**0.3333333333333333* &
7134 & gamma_sp(2.333333333333333 + rnux) - &
7135 & 1.0732802065650471e6*(1 + rnux)**0.6666666666666666*vr**0.6666666666666666* &
7136 & gamma_sp(2.6666666666666667 + rnux) + &
7137 & 8.584110982429507e7*(1 + rnux)**0.3333333333333333*vr*gamma_sp(3 + rnux) - &
7138 & 2.3303765697228556e9*vr**1.3333333333333333* &
7139 & gamma_sp(3.333333333333333 + rnux))/ &
7140 & ((1 + rnux)**2.333333333333333*gamma_sp(1 + rnux))
7142 IF(infdo .ge. 1 .and. rssflg == 0)
THEN
7143 vtxbar(mgs,lr,2) = vtxbar(mgs,lr,1)
7146 IF ( infdo .ge. 2 .and. rssflg == 1)
THEN
7147 vtxbar(mgs,lr,3) = rhovt(mgs)* &
7148 & ((1. + rnux)*(0.0911229*(1 + rnux)**1.3333333333333333*gamma_sp(3. + rnux) + &
7149 & 5430.313059683277*(1 + rnux)*vr**0.3333333333333333* &
7150 & gamma_sp(3.3333333333333335 + rnux) - &
7151 & 1.0732802065650471e6*(1 + rnux)**0.6666666666666666* &
7152 & vr**0.6666666666666666*gamma_sp(3.6666666666666665 + rnux) + &
7153 & 8.5841109824295e7*(1 + rnux)**0.3333333333333333*vr*gamma_sp(4. + rnux) - &
7154 & 2.3303765697228556e9*vr**1.3333333333333333* &
7155 & gamma_sp(4.333333333333333 + rnux)))/ &
7156 & ((1 + rnux)**3.3333333333333335*(2 + rnux)*gamma_sp(1 + rnux))
7161 ELSEIF (infdo .ge. 2)
THEN
7162 vtxbar(mgs,lr,3) = vtxbar(mgs,lr,1)
7181 vtxbar(mgs,lr,1) = 0.0
7182 vtxbar(mgs,lr,2) = 0.0
7185 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set rain vt'
7193 IF ( ls .gt. 1 .and. ( ildo == 0 .or. ildo == ls ) )
THEN
7195 if ( qx(mgs,ls) .gt. qxmin(ls) )
then
7196 IF ( ipconc .ge. 4 )
THEN
7197 if ( mixedphase .and. qsvtmod )
then
7199 IF ( isnowfall == 1 )
THEN
7201 vtxbar(mgs,ls,1) = 5.72462*rhovt(mgs)*(xv(mgs,ls))**(1./12.)
7202 ELSEIF ( isnowfall == 2 )
THEN
7204 IF ( isnowdens == 1 )
THEN
7205 vtxbar(mgs,ls,1) = 11.9495*rhovt(mgs)*(xv(mgs,ls))**(0.14)
7207 vtxbar(mgs,ls,1) = 11.9495*rhovt(mgs)*(xv(mgs,ls)*xdn(mgs,ls)/100.)**(0.14)
7209 ELSEIF ( isnowfall == 3 )
THEN
7211 vtxbar(mgs,ls,1) = 50.092*rhovt(mgs)*(xmas(mgs,ls))**(0.2635)
7214 IF(abs(sssflg) >= 1)
THEN
7215 IF ( isnowfall == 1 )
THEN
7216 vtxbar(mgs,ls,2) = 4.04091*rhovt(mgs)*(xv(mgs,ls))**(1./12.)
7217 ELSEIF ( isnowfall == 2 )
THEN
7219 IF ( isnowdens == 1 )
THEN
7220 vtxbar(mgs,ls,2) = 7.02909*rhovt(mgs)*(xv(mgs,ls))**(0.14)
7222 vtxbar(mgs,ls,2) = 7.02909*rhovt(mgs)*(xv(mgs,ls)*xdn(mgs,ls)/100.)**(0.14)
7224 ELSEIF ( isnowfall == 3 )
THEN
7226 vtxbar(mgs,ls,2) = 21.6147*rhovt(mgs)*(xmas(mgs,ls))**(0.2635)
7229 vtxbar(mgs,ls,2) = vtxbar(mgs,ls,1)
7231 IF ( infdo >= 2 )
THEN
7232 IF ( isnowfall == 1 )
THEN
7233 vtxbar(mgs,ls,3) = 6.12217*rhovt(mgs)*(xv(mgs,ls))**(1./12.)
7234 ELSEIF ( isnowfall == 2 )
THEN
7235 vtxbar(mgs,ls,3) = 13.3436*rhovt(mgs)*(xv(mgs,ls))**(0.14)
7236 ELSEIF ( isnowfall == 3 )
THEN
7238 vtxbar(mgs,ls,3) = 61.0914*rhovt(mgs)*(xmas(mgs,ls))**(0.2635)
7242 IF ( sssflg < 0 .and. temcg(mgs) > abs(sssflg) )
THEN
7243 vtxbar(mgs,ls,2) = vtxbar(mgs,ls,1)
7244 vtxbar(mgs,ls,3) = vtxbar(mgs,ls,1)
7249 vtxbar(mgs,ls,1) = (cs*gf4ds/6.0)*(xdia(mgs,ls,1)**ds)*rhovt(mgs)
7250 vtxbar(mgs,ls,2) = vtxbar(mgs,ls,1)
7253 vtxbar(mgs,ls,1) = 0.0
7256 IF ( snowfallfac /= 1.0 )
THEN
7257 vtxbar(mgs,ls,1) = snowfallfac*vtxbar(mgs,ls,1)
7258 vtxbar(mgs,ls,2) = snowfallfac*vtxbar(mgs,ls,2)
7259 vtxbar(mgs,ls,3) = snowfallfac*vtxbar(mgs,ls,3)
7264 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set snow vt'
7273 IF ( lh .gt. 1 .and. ( ildo == 0 .or. ildo == lh ) )
THEN
7276 vtxbar(mgs,lh,1) = 0.0
7277 if ( qx(mgs,lh) .gt. qxmin(lh) )
then
7279 IF ( icdx .eq. 1 )
THEN
7281 ELSEIF ( icdx .eq. 2 )
THEN
7284 cd = max(0.45, min(1.0, 0.45 + 0.35*(800.0 - max( 500., min( 800.0, xdn(mgs,lh) ) ) )/(800. - 500.) ) )
7286 ELSEIF ( icdx .eq. 3 )
THEN
7288 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hdnmn, min( 800.0, xdn(mgs,lh) ) ) )/(800. - 170.0) ) )
7289 ELSEIF ( icdx .eq. 4 )
THEN
7290 cd = max(cdhmin, min(cdhmax, cdhmin + (cdhmax-cdhmin)* &
7291 & (cdhdnmax - max( cdhdnmin, min( cdhdnmax, xdn(mgs,lh) ) ) )/(cdhdnmax - cdhdnmin) ) )
7292 ELSEIF ( icdx .eq. 5 )
THEN
7293 cd = cdx(lh)*(xdn(mgs,lh)/rho_qh)**(2./3.)
7294 ELSEIF ( icdx .eq. 6 )
THEN
7295 indxr = int( (xdn(mgs,lh)-50.)/100. ) + 1
7296 indxr = min( ngdnmm, max(1,indxr) )
7299 delrho = max( 0.0, 0.01*(xdn(mgs,lh) - mmgraupvt(indxr,1)) )
7300 IF ( indxr < ngdnmm )
THEN
7302 axx(mgs,lh) = mmgraupvt(indxr,2) + delrho*(mmgraupvt(indxr+1,2) - mmgraupvt(indxr,2) )
7303 bxx(mgs,lh) = mmgraupvt(indxr,3) + delrho*(mmgraupvt(indxr+1,3) - mmgraupvt(indxr,3) )
7307 axx(mgs,lh) = mmgraupvt(indxr,2)
7308 bxx(mgs,lh) = mmgraupvt(indxr,3)
7314 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hdnmn, min( 800.0, xdn(mgs,lh) ) ) )/(800. - 170.0) ) )
7316 ELSEIF ( icdx <= 0 )
THEN
7319 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hdnmn, min( 800.0, xdn(mgs,lh) ) ) )/(800. - 170.0) ) )
7321 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hdnmn, min( 800.0, xdn(mgs,lh) ) ) )/(800. - 170.0) ) )
7325 IF ( alpha(mgs,lh) .eq. 0.0 .and. icdx > 0 .and. icdx /= 6 )
THEN
7329 axx(mgs,lh) = sqrt(4.0*xdn(mgs,lh)*gr/(3.0*cd*rho00))
7331 vtxbar(mgs,lh,1) = (gf4p5/6.0)* rhovt(mgs)*axx(mgs,lh) * sqrt(xdia(mgs,lh,1))
7336 IF ( icdx /= 6 ) bbx = bx(lh)
7337 tmp = 4. + alpha(mgs,lh) + bbx
7338 i = int(dgami*(tmp))
7340 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7342 tmp = 4. + alpha(mgs,lh)
7343 i = int(dgami*(tmp))
7345 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7350 IF ( icdx > 0 .and. icdx /= 6)
THEN
7351 aax = sqrt(4.0*xdn(mgs,lh)*gr/(3.0*cd*rho00))
7352 vtxbar(mgs,lh,1) = rhovt(mgs)*aax* sqrt(xdia(mgs,lh,1)) * x/y
7355 ELSEIF (icdx == 6 )
THEN
7356 vtxbar(mgs,lh,1) = rhovt(mgs)*aax* xdia(mgs,lh,1)**bbx * x/y
7358 axx(mgs,lh) = ax(lh)
7359 bxx(mgs,lh) = bx(lh)
7360 vtxbar(mgs,lh,1) = rhovt(mgs)*ax(lh)*(xdia(mgs,lh,1)**bx(lh)*x)/y
7366 IF ( lwsm6 .and. ipconc == 0 )
THEN
7368 vtxbar(mgs,lh,1) = (330.*gf4br/6.0)*(xdia(mgs,lh,1)**br)*rhovt(mgs)
7373 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set hail vt'
7382 IF ( lhl .gt. 1 .and. ( ildo == 0 .or. ildo == lhl ) )
THEN
7385 vtxbar(mgs,lhl,1) = 0.0
7386 if ( qx(mgs,lhl) .gt. qxmin(lhl) )
then
7388 IF ( icdxhl .eq. 1 )
THEN
7390 ELSEIF ( icdxhl .eq. 3 )
THEN
7392 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hldnmn, min( 800.0, xdn(mgs,lhl) ) ) )/(800. - 170.0) ) )
7393 ELSEIF ( icdxhl .eq. 4 )
THEN
7394 cd = max(cdhlmin, min(cdhlmax, cdhlmin + (cdhlmax-cdhlmin)* &
7395 & (cdhldnmax - max( cdhldnmin, min( cdhldnmax, xdn(mgs,lhl) ) ) )/(cdhldnmax - cdhldnmin) ) )
7396 ELSEIF ( icdxhl .eq. 5 )
THEN
7397 cd = cdx(lh)*(xdn(mgs,lhl)/rho_qh)**(2./3.)
7398 ELSEIF ( icdxhl .eq. 6 )
THEN
7399 indxr = int( (xdn(mgs,lhl)-50.)/100. ) + 1
7400 indxr = min( ngdnmm, max(1,indxr) )
7403 delrho = max( 0.0, 0.01*(xdn(mgs,lhl) - mmgraupvt(indxr,1)) )
7404 IF ( indxr < ngdnmm )
THEN
7406 axx(mgs,lhl) = mmgraupvt(indxr,2) + delrho*(mmgraupvt(indxr+1,2) - mmgraupvt(indxr,2) )
7407 bxx(mgs,lhl) = mmgraupvt(indxr,3) + delrho*(mmgraupvt(indxr+1,3) - mmgraupvt(indxr,3) )
7411 axx(mgs,lhl) = mmgraupvt(indxr,2)
7412 bxx(mgs,lhl) = mmgraupvt(indxr,3)
7418 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hldnmn, min( 800.0, xdn(mgs,lhl) ) ) )/(800. - 170.0) ) )
7424 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hldnmn, min( 800.0, xdn(mgs,lhl) ) ) )/(800. - 170.0) ) )
7429 IF ( alpha(mgs,lhl) .eq. 0.0 .and. icdxhl > 0 .and. icdxhl /= 6)
THEN
7433 axx(mgs,lhl) = sqrt(4.0*xdn(mgs,lhl)*gr/(3.0*cd*rho00))
7435 vtxbar(mgs,lhl,1) = (gf4p5/6.0)* rhovt(mgs)*axx(mgs,lhl) * sqrt(xdia(mgs,lhl,1))
7437 IF ( icdxhl /= 6 ) bbx = bx(lhl)
7438 tmp = 4. + alpha(mgs,lhl) + bbx
7439 i = int(dgami*(tmp))
7441 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7443 tmp = 4. + alpha(mgs,lhl)
7444 i = int(dgami*(tmp))
7446 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7448 IF ( icdxhl > 0 .and. icdxhl /= 6)
THEN
7449 aax = sqrt(4.0*xdn(mgs,lhl)*gr/(3.0*cd*rho00))
7450 vtxbar(mgs,lhl,1) = rhovt(mgs)*aax* sqrt(xdia(mgs,lhl,1)) * x/y
7453 ELSEIF ( icdxhl == 6 )
THEN
7454 vtxbar(mgs,lhl,1) = rhovt(mgs)*aax* (xdia(mgs,lhl,1))**bbx * x/y
7456 axx(mgs,lhl) = ax(lhl)
7457 bxx(mgs,lhl) = bx(lhl)
7458 vtxbar(mgs,lhl,1) = rhovt(mgs)*(ax(lhl)*xdia(mgs,lhl,1)**bx(lhl)*x)/y
7467 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set hail vt'
7472 IF ( infdo .ge. 1 )
THEN
7477 IF ( ildo == 0 .or. ildo == lc )
THEN
7478 vtxbar(mgs,lc,2) = vtxbar(mgs,lc,1)
7480 IF ( li .gt. 1 )
THEN
7495 IF ( lg .gt. lr )
THEN
7498 IF ( ildo == 0 .or. ildo == il )
THEN
7501 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
7502 IF ( (il .eq. lh .and. hssflg == 1) .or. ( lhl .gt. 1 .and. il .eq. lhl .and. hlssflg == 1) )
THEN
7507 IF ( il .eq. lh )
THEN
7509 IF ( icdx .eq. 1 )
THEN
7511 ELSEIF ( icdx .eq. 2 )
THEN
7514 cd = max(0.45, min(1.0, 0.45 + 0.35*(800.0 - max( 500., min( 800.0, xdn(mgs,lh) ) ) )/(800. - 500.) ) )
7516 ELSEIF ( icdx .eq. 3 )
THEN
7518 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hdnmn, min( 800.0, xdn(mgs,lh) ) ) )/(800. - 170.0) ) )
7519 ELSEIF ( icdx .eq. 4 )
THEN
7520 cd = max(cdhmin, min(cdhmax, cdhmin + (cdhmax-cdhmin)* &
7521 & (cdhdnmax - max( cdhdnmin, min( cdhdnmax, xdn(mgs,lh) ) ) )/(cdhdnmax - cdhdnmin) ) )
7522 ELSEIF ( icdx .eq. 5 )
THEN
7523 cd = cdx(lh)*(xdn(mgs,lh)/rho_qh)**(2./3.)
7524 ELSEIF ( icdx .eq. 6 )
THEN
7527 ELSEIF ( icdx <= 0 )
THEN
7532 ELSEIF ( lhl .gt. 1 .and. il .eq. lhl )
THEN
7534 IF ( icdxhl .eq. 1 )
THEN
7536 ELSEIF ( icdxhl .eq. 3 )
THEN
7538 cd = max(0.45, min(1.2, 0.45 + 0.55*(800.0 - max( hldnmn, min( 800.0, xdn(mgs,lhl) ) ) )/(800. - 170.0) ) )
7539 ELSEIF ( icdxhl .eq. 4 )
THEN
7540 cd = max(cdhlmin, min(cdhlmax, cdhlmin + (cdhlmax-cdhlmin)* &
7541 & (cdhldnmax - max( cdhldnmin, min( cdhldnmax, xdn(mgs,lhl) ) ) )/(cdhldnmax - cdhldnmin) ) )
7542 ELSEIF ( icdxhl == 5 )
THEN
7545 cd = max(0.45, min(0.6, 0.45 + 0.15*(800.0 - max( 500., min( 800.0, xdn(mgs,lhl) ) ) )/(800. - 500.) ) )
7546 ELSEIF ( icdxhl .eq. 6 )
THEN
7549 ELSEIF ( icdxhl <= 0 )
THEN
7556 IF ( alpha(mgs,il) .eq. 0. .and. infdo .lt. 2 .and. &
7557 ( ( il==lh .and. icdx > 0 .and. icdx /= 6) .or. ( il==lhl .and. icdxhl > 0 .and. icdxhl /= 6 ) ) )
THEN
7558 vtxbar(mgs,il,2) = &
7559 & sqrt( (xdn(mgs,il)*xdia(mgs,il,1)*pi*gr) / &
7560 & (3.0*cd*max(0.05,rho0(mgs))) )
7563 IF ( il == lh .and. icdx /= 6 ) bbx = bx(il)
7564 IF ( il == lhl .and. icdxhl /= 6 ) bbx = bx(il)
7565 tmp = 1. + alpha(mgs,il) + bbx
7566 i = int(dgami*(tmp))
7568 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7570 tmp = 1. + alpha(mgs,il)
7571 i = int(dgami*(tmp))
7573 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7575 IF ( il .eq. lh .or. il .eq. lhl)
THEN
7576 IF ( ( il==lh .and. icdx > 0 ) )
THEN
7577 IF ( icdx /= 6 )
THEN
7578 aax = sqrt(4.0*xdn(mgs,il)*gr/(3.0*cd*rho00))
7579 vtxbar(mgs,il,2) = rhovt(mgs)*aax* xdia(mgs,il,1)**bx(il) * x/y
7581 vtxbar(mgs,il,2) = rhovt(mgs)*aax* xdia(mgs,il,1)**bbx * x/y
7584 ELSEIF ( ( il==lhl .and. icdxhl > 0 ) )
THEN
7585 IF ( icdxhl /= 6 )
THEN
7586 aax = sqrt(4.0*xdn(mgs,il)*gr/(3.0*cd*rho00))
7587 vtxbar(mgs,il,2) = rhovt(mgs)*aax* xdia(mgs,il,1)**bx(il) * x/y
7589 vtxbar(mgs,il,2) = rhovt(mgs)*aax* xdia(mgs,il,1)**bbx * x/y
7593 vtxbar(mgs,il,2) = rhovt(mgs)*ax(il)*(xdia(mgs,il,1)**bx(il)*x)/y
7601 IF ( infdo .ge. 2 )
THEN
7603 tmp = 7. + alpha(mgs,il) + bbx
7604 i = int(dgami*(tmp))
7606 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7608 tmp = 7. + alpha(mgs,il)
7609 i = int(dgami*(tmp))
7611 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
7613 vtxbar(mgs,il,3) = rhovt(mgs)* &
7614 & (aax*(xdia(mgs,il,1) )**bbx * &
7617 IF ( .not. (vtxbar(mgs,il,1) > -1. .and. vtxbar(mgs,il,1) < 250. ) .or. &
7618 .not. (vtxbar(mgs,il,3) > -1. .and. vtxbar(mgs,il,3) < 250. ) )
THEN
7619 write(0,*)
'Setvtz: problem with vtxbar1/3: ',il,vtxbar(mgs,il,1),vtxbar(mgs,il,3),aax,bbx,x,y
7620 write(0,*)
'q, number, diam1,3(mm) = ', qx(mgs,il),cx(mgs,il),1000.*xdia(mgs,il,1),1000.*xdia(mgs,il,3)
7627 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set hail vt3'
7630 vtxbar(mgs,il,2) = &
7631 & rhovt(mgs)*(ax(il)*xdia(mgs,il,1)**bx(il)* &
7634 IF ( infdo .ge. 2 )
THEN
7635 vtxbar(mgs,il,3) = rhovt(mgs)* &
7636 & (aax*(1.0/xdia(mgs,il,1) )**(- bbx)* &
7637 & gamma_sp(7.0 + alpha(mgs,il) + bbx))/gamma_sp(7. + alpha(mgs,il))
7642 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set hail vt4'
7657 ELSEIF ( (il .eq. lh .and. hssflg == 0) .or. ( lhl .gt. 1 .and. il .eq. lhl .and. hlssflg == 0) )
THEN
7658 vtxbar(mgs,il,2) = vtxbar(mgs,il,1)
7659 vtxbar(mgs,il,3) = vtxbar(mgs,il,1)
7661 vtxbar(mgs,il,2) = &
7662 & sqrt( (xdn(mgs,il)*xdia(mgs,il,1)*pi*gr) / &
7663 & (3.0*cdx(il)*max(0.05,rho0(mgs))) )
7664 vtxbar(mgs,il,3) = vtxbar(mgs,il,1)
7666 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set graupel vt5'
7671 vtxbar(mgs,il,2) = 0.0
7673 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set graupel vt6'
7678 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set graupel vt7'
7683 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set graupel vt8'
7690 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: Set graupel vt9'
7701 IF ( lh > 0 .and. graupelfallfac /= 1.0 )
THEN
7703 vtxbar(mgs,lh,1) = graupelfallfac*vtxbar(mgs,lh,1)
7704 vtxbar(mgs,lh,2) = graupelfallfac*vtxbar(mgs,lh,2)
7705 vtxbar(mgs,lh,3) = graupelfallfac*vtxbar(mgs,lh,3)
7706 axx(mgs,lh) = graupelfallfac*axx(mgs,lh)
7710 IF ( lhl > 0 .and. hailfallfac /= 1.0 )
THEN
7712 vtxbar(mgs,lhl,1) = hailfallfac*vtxbar(mgs,lhl,1)
7713 vtxbar(mgs,lhl,2) = hailfallfac*vtxbar(mgs,lhl,2)
7714 vtxbar(mgs,lhl,3) = hailfallfac*vtxbar(mgs,lhl,3)
7715 axx(mgs,lhl) = hailfallfac*axx(mgs,lhl)
7719 if ( ndebug1 .gt. 0 )
write(0,*)
'SETVTZ: END OF ROUTINE'
7724 END SUBROUTINE setvtz
7736 subroutine ziegfall1d(nx,ny,nz,nor,norz,na,dtp,jgs,ixcol, &
7738 & an,dn,ipconc0,t0,t7,cwmasn,cwmasx, &
7740 & qxmin,xdnmx,xdnmn,cdx,cno,xdn0,xvmn,xvmx, &
7741 & ngs,qx,qxw,cx,xv,vtxbar,xmas,xdn,xdia,vx,alpha,zx,igs,kgs, &
7742 & rho0,temcg,temg,rhovt,cwnc,cinc,fadvisc,cwdia,cipmas,cnina,cimas, &
7744 & infdo,ildo,timesetvt)
7763 integer,
intent(in) :: ixcol
7764 integer,
intent(in) :: ildo
7766 integer nx,ny,nz,nor,norz,ngt,jgs,na
7767 real an(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor,na)
7768 real dn(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
7769 real t0(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
7770 real t7(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
7773 real :: rhovtzx(nz,nx)
7776 parameter(ndebugzf = 0)
7778 integer ix,jy,kz,i,j,k,il
7782 real xvt(nz+1,nx,3,lc:lhab)
7786 real xvmn(lc:lhab), xvmx(lc:lhab)
7787 double precision,
optional :: timesetvt
7790 integer :: ngscnt,mgs,ipconc0
7793 real :: qx(ngs,lv:lhab)
7794 real :: qxw(ngs,ls:lhab)
7795 real :: cx(ngs,lc:lhab)
7796 real :: xv(ngs,lc:lhab)
7797 real :: vtxbar(ngs,lc:lhab,3)
7798 real :: xmas(ngs,lc:lhab)
7799 real :: xdn(ngs,lc:lhab)
7800 real :: cdxgs(ngs,lc:lhab)
7801 real :: xdia(ngs,lc:lhab,3)
7802 real :: vx(ngs,li:lhab)
7803 real :: alpha(ngs,lc:lhab)
7804 real :: zx(ngs,lr:lhab)
7806 real xdnmx(lc:lhab), xdnmn(lc:lhab)
7807 real :: axx(ngs,lh:lhab), bxx(ngs,lh:lhab)
7819 real cwccn0,cwmasn,cwmasx,cwradn
7822 integer nxmpb,nzmpb,nxz,numgs,inumgs
7826 integer igs(ngs),kgs(ngs)
7828 real rho0(ngs),temcg(ngs)
7834 real cwnc(ngs),cinc(ngs)
7835 real fadvisc(ngs),cwdia(ngs),cipmas(ngs)
7838 real :: cnina(ngs),cimas(ngs)
7840 real :: cnostmp(ngs)
7856 real chw, qr, z, rd, alp, z1, g1, vr, nrx, tmp, tmpc, tmpz
7861 real,
parameter :: c1r=19.0, c2r=0.6, c3r=1.8, c4r=17.0
7862 real,
parameter :: c1h=5.5, c2h=0.7, c3h=4.5, c4h=8.5
7863 real,
parameter :: c1hl=3.7, c2hl=0.3, c3hl=9.0, c4hl=6.5, c5hl=1.0, c6hl=6.5
7867 double precision :: dpt1, dpt2
7873 integer :: ixb, jyb, kzb
7874 integer :: ixe, jye, kze
7876 logical :: debug_mpi = .false.
7879 if (ndebugzf .gt. 0 )
write(0,*)
"ZIEGFALL1D: ENTERED SUBROUTINE"
7890 IF ( ls .gt. 1 )
THEN
7892 ldoliq = ldoliq .or. ( lliq(il) .gt. 1 )
7935 IF ( ildo == 0 )
THEN
7953 flag = flag .or. ( an(ix,jy,kz,il) > 0.0 )
7962 if ( ngscnt .eq. nz )
goto 1100
7972 if ( ngscnt .eq. 0 )
go to 9998
7983 rho0(mgs) = dn(igs(mgs),jy,kgs(mgs))
7984 rhovt(mgs) = rhovtzx(kgs(mgs),ixcol)
7985 temg(mgs) = t0(igs(mgs),jy,kgs(mgs))
7986 temcg(mgs) = temg(mgs) - tfr
7993 IF ( lc .gt. 1 .and. (ildo == 0 .or. ildo == lc ) )
then
7995 fadvisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))* &
7996 & (temg(mgs)/296.0)**(1.5)
8000 IF ( ipconc .eq. 0 )
THEN
8002 cnina(mgs) = t7(igs(mgs),jgs,kgs(mgs))
8007 IF ( ildo > 0 )
THEN
8008 vtxbar(:,ildo,:) = 0.0
8018 qx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),il), 0.0)
8022 cnostmp(:) = cno(ls)
8023 IF ( ipconc < 1 .and. lwsm6 .and. (ildo == 0 .or. ildo == ls ))
THEN
8025 tmp = min( 0.0, temcg(mgs) )
8026 cnostmp(mgs) = min( 2.e8, 2.e6*exp(0.12*tmp) )
8036 if ( ipconc .ge. 1 .and. li .gt. 1 .and. (ildo == 0 .or. ildo == li ) )
then
8038 cx(mgs,li) = max(an(igs(mgs),jy,kgs(mgs),lni), 0.0)
8042 if ( ipconc .ge. 2 .and. lc .gt. 1 .and. (ildo == 0 .or. ildo == lc ) )
then
8044 cx(mgs,lc) = max(an(igs(mgs),jy,kgs(mgs),lnc), 0.0)
8048 if ( ipconc .ge. 3 .and. lr .gt. 1 .and. (ildo == 0 .or. ildo == lr ) )
then
8050 cx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lnr), 0.0)
8054 if ( ipconc .ge. 4 .and. ls .gt. 1 .and. (ildo == 0 .or. ildo == ls ) )
then
8056 cx(mgs,ls) = max(an(igs(mgs),jy,kgs(mgs),lns), 0.0)
8060 if ( ipconc .ge. 5 .and. lh .gt. 1 .and. (ildo == 0 .or. ildo == lh ) )
then
8062 cx(mgs,lh) = max(an(igs(mgs),jy,kgs(mgs),lnh), 0.0)
8066 if ( ipconc .ge. 5 .and. lhl .gt. 1 .and. (ildo == 0 .or. ildo == lhl ) )
then
8068 cx(mgs,lhl) = max(an(igs(mgs),jy,kgs(mgs),lnhl), 0.0)
8074 IF ( lz(il) < 1 .and. ln(il) > 1 )
THEN
8076 IF ( cx(mgs,il) <= cxmin .or. qx(mgs,il) < qxmin(il) )
THEN
8078 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8080 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8081 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8088 xdn(mgs,lc) = xdn0(lc)
8089 xdn(mgs,lr) = xdn0(lr)
8092 IF ( li .gt. 1 ) xdn(mgs,li) = xdn0(li)
8093 IF ( ls .gt. 1 ) xdn(mgs,ls) = xdn0(ls)
8094 IF ( lh .gt. 1 ) xdn(mgs,lh) = xdn0(lh)
8095 IF ( lhl .gt. 1 ) xdn(mgs,lhl) = xdn0(lhl)
8101 IF ( ldovol .and. (ildo == 0 .or. ildo >= li ) )
THEN
8107 IF ( lvol(il) .ge. 1 )
THEN
8110 vx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),lvol(il)), 0.0)
8111 IF ( vx(mgs,il) .gt. rho0(mgs)*qxmin(il)*1.e-3 .and. qx(mgs,il) .gt. qxmin(il) )
THEN
8112 xdn(mgs,il) = min( xdnmx(il), max( xdnmn(il), rho0(mgs)*qx(mgs,il)/vx(mgs,il) ) )
8124 alpha(mgs,il) = dnu(il)
8128 IF ( imurain == 1 )
THEN
8129 alpha(:,lr) = alphar
8130 ELSEIF ( imurain == 3 )
THEN
8131 alpha(:,lr) = xnu(lr)
8135 IF ( ipconc == 5 .and. imydiagalpha > 0 )
THEN
8137 IF ( qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > cxmin )
THEN
8138 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
8139 xdia(mgs,lr,3) = (xv(mgs,lr)*6.0*cwc1)**(1./3.)
8140 alpha(mgs,lr) = min(alphamax, c1r*tanh(c2r*(xdia(mgs,lr,3)*1000. - c3r)) + c4r)
8142 IF ( qx(mgs,lh) .gt. qxmin(lh) .and. cx(mgs,lh) > cxmin )
THEN
8143 xv(mgs,lh) = rho0(mgs)*qx(mgs,lh)/(xdn(mgs,lh)*cx(mgs,lh))
8144 xdia(mgs,lh,3) = (xv(mgs,lh)*6.*piinv)**(1./3.)
8145 alpha(mgs,lh) = min(alphamax, c1h*tanh(c2h*(xdia(mgs,lh,3)*1000. - c3h)) + c4h)
8150 IF ( qx(mgs,lhl) .gt. qxmin(lhl) .and. cx(mgs,lhl) > cxmin )
THEN
8151 xv(mgs,lhl) = rho0(mgs)*qx(mgs,lhl)/(xdn(mgs,lhl)*cx(mgs,lhl))
8152 xdia(mgs,lhl,3) = (xv(mgs,lhl)*6.*piinv)**(1./3.)
8153 IF ( xdia(mgs,lhl,3) < 0.008 )
THEN
8154 alpha(mgs,lhl) = min(alphamax, c1hl*tanh(c2hl*(xdia(mgs,lhl,3)*1000. - c3hl)) + c4hl)
8156 alpha(mgs,lhl) = min(alphamax, c5hl*xdia(mgs,lhl,3)*1000. + c6hl)
8167 IF ( ipconc .ge. 6 .or. lzr > 1)
THEN
8174 IF ( lz(il) .ge. 1 )
THEN
8177 zx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),lz(il)), 0.0)
8194 IF ( lz(lr) > 1 .and. (ildo == 0 .or. ildo == lr ) .and. imurain == 3 )
THEN
8198 IF ( iresetmoments == 1 .or. iresetmoments == il )
THEN
8200 IF ( zx(mgs,lr) <= zxmin )
THEN
8203 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
8204 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
8205 an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
8208 ELSEIF ( cx(mgs,lr) <= cxmin )
THEN
8211 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),lr)
8212 an(igs(mgs),jgs,kgs(mgs),lr) = qx(mgs,lr)
8213 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
8219 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
8221 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
8222 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
8232 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
8233 xv(mgs,lr) = xvmn(lr)
8234 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
8235 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8238 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
8240 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
8244 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
8245 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8247 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin )
THEN
8249 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
8260 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(xdn(mgs,lr)**2*chw)
8261 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8263 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
8267 IF ( qx(mgs,il) < 1.e-8 )
THEN
8269 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8270 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8273 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
8274 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8276 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
8279 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z*1000.*1000)
8280 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8284 IF ( zx(mgs,lr) > 0.0 )
THEN
8285 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(1000.*max(1.0e-9,cx(mgs,lr)))
8296 IF ( z .gt. 0.0 )
THEN
8298 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
8301 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
8302 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
8303 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
8305 alp = max( rnumin, min( rnumax, alp ) )
8311 IF ( xv(mgs,il) .gt. xvmx(il) )
THEN
8313 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
8314 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
8315 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
8316 IF ( tmp < cx(mgs,il) )
THEN
8318 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
8319 zx(mgs,il) = zx(mgs,il) + g1*(rho0(mgs)/xdn(mgs,il))**2*( (qx(mgs,il)/tmp)**2 * (tmp-cx(mgs,il)) )
8320 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8329 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
8331 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
8332 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
8333 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z*pi**2) - 1.
8334 alp = max( rnumin, min( rnumax, alp ) )
8346 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
8348 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
8349 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
8350 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(1./(xdn(mgs,il)))**2
8351 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
8353 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
8355 z = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
8357 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
8369 an(igs(mgs),jgs,kgs(mgs),ln(lr)) = cx(mgs,lr)
8370 an(igs(mgs),jgs,kgs(mgs),lz(lr)) = zx(mgs,lr)
8378 IF ( ipconc .ge. 6 )
THEN
8384 IF ( lz(il) .gt. 1 .and. (ildo == 0 .or. ildo == il ) .and. ( .not. ( il == lr .and. imurain == 3 )) )
THEN
8388 IF ( iresetmoments == 1 .or. iresetmoments == il .or. iresetmoments == -1 )
THEN
8389 IF ( zx(mgs,il) <= zxmin )
THEN
8392 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8393 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8394 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8395 ELSEIF ( iresetmoments == -1 .and. qx(mgs,il) < qxmin(il) )
THEN
8398 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8401 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8402 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8403 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8405 ELSEIF ( cx(mgs,il) <= cxmin .and. iresetmoments /= -1 )
THEN
8409 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8410 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8411 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8415 IF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= cxmin )
THEN
8418 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8420 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8421 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8422 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8425 IF ( qx(mgs,il) .gt. qxmin(il) )
THEN
8427 xv(mgs,il) = rho0(mgs)*qx(mgs,il)/(xdn(mgs,il)*max(1.0e-9,cx(mgs,il)))
8428 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
8430 IF ( xv(mgs,il) .lt. xvmn(il) )
THEN
8432 xv(mgs,il) = min( xvmx(il), max( xvmn(il),xv(mgs,il) ) )
8433 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
8434 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
8444 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
8446 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
8447 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
8450 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z*(pi*xdn(mgs,il))**2)
8451 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8453 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > cxmin )
THEN
8455 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
8456 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
8460 zx(mgs,il) = min(zxmin*1.1, g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(chw*(pi*xdn(mgs,il))**2) )
8461 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8462 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
8468 IF ( qx(mgs,il) < 1.e-8 )
THEN
8470 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
8471 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
8476 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
8477 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8479 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
8480 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
8483 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z*(pi*xdn(mgs,il))**2)
8484 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
8489 IF ( qx(mgs,il) .gt. qxmin(il) .and. cx(mgs,il) .gt. cxmin )
THEN
8494 IF ( zx(mgs,il) .gt. 0. )
THEN
8497 rd = z*(pi/6.*xdn(mgs,il))**2*chw/((dn(igs(mgs),jy,kgs(mgs))*qr)**2)
8499 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
8500 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
8502 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
8503 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
8504 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
8505 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
8507 alp = max( alphamin, min( alphamax, alp ) )
8514 IF ( imaxdiaopt == 1 .or. il /= lr )
THEN
8516 ELSEIF ( imaxdiaopt == 2 )
THEN
8517 xvbarmax = xvmx(il) /((3. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
8518 ELSEIF ( imaxdiaopt == 3 )
THEN
8519 xvbarmax = xvmx(il) /((4. + alpha(mgs,il))**3/((3. + alpha(mgs,il))*(2. + alpha(mgs,il))*(1. + alpha(mgs,il))))
8522 IF ( xv(mgs,il) .gt. xvbarmax )
THEN
8524 xv(mgs,il) = min( xvbarmax, max( xvmn(il),xv(mgs,il) ) )
8525 xmas(mgs,il) = xv(mgs,il)*xdn(mgs,il)
8526 cx(mgs,il) = rho0(mgs)*qx(mgs,il)/(xmas(mgs,il))
8527 IF ( tmp < cx(mgs,il) )
THEN
8528 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
8529 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
8532 tmpz = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/tmp
8533 IF ( tmpz > zx(mgs,il) )
THEN
8535 tmpc = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/zx(mgs,il)
8536 cx(mgs,il) = max(cx(mgs,il), tmpc)
8538 zx(mgs,il) = g1/(pi/6.*xdn(mgs,il))**2 * ((rho0(mgs)*qx(mgs,il))**2)/cx(mgs,il)
8540 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
8546 rd = z*(pi/6.*xdn(mgs,il))**2*chw/((rho0(mgs)*qr)**2)
8547 alp = (6.0+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
8548 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
8550 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
8551 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
8552 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
8553 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd) - 1.0
8554 alp = max( alphamin, min( alphamax, alp ) )
8565 IF ( (rescale_low_alpha .or. rescale_high_alpha ) .and. &
8566 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
8568 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
8569 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
8571 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
8572 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z*(6./(pi*xdn(mgs,il)))**2
8573 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
8575 ELSEIF ( rescale_low_alpha .and. alp <= alphamin .and. .not. (il == lh .and. icvhl2h > 0 ) )
THEN
8578 z1 = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/chw
8579 z = z1*(6./(pi*xdn(mgs,il)))**2
8581 an(igs(mgs),jy,kgs(mgs),lz(il)) = z
8597 IF ( lzhl > 1 )
THEN
8598 IF ( lhl .gt. 1 )
THEN
8608 if (ndebugzf .gt. 0 )
write(0,*)
'ZIEGFALL: call setvtz'
8611 call setvtz(ngscnt,qx,qxmin,qxw,cx,rho0,rhovt,xdia,cno,cnostmp, &
8612 & xmas,vtxbar,xdn,xvmn,xvmx,xv,cdx,cdxgs, &
8613 & ipconc,ndebugzf,ngs,nz,igs,kgs,fadvisc, &
8614 & cwmasn,cwmasx,cwradn,cnina,cimn,cimx, &
8615 & itype1,itype2,temcg,infdo,alpha,axx,bxx,ildo)
8629 IF ( vtxbar(mgs,il,2) .gt. vtxbar(mgs,il,1) .or. &
8630 & ( vtxbar(mgs,il,1) .gt. vtxbar(mgs,il,3) .and. vtxbar(mgs,il,3) > 0.0) )
THEN
8647 vtxbar(mgs,il,1) = max( vtxbar(mgs,il,1), vtxbar(mgs,il,2) )
8648 vtxbar(mgs,il,3) = max( vtxbar(mgs,il,3), vtxbar(mgs,il,1) )
8653 IF ( vtxbar(mgs,il,1) .gt. vtmax .or. vtxbar(mgs,il,2) .gt. vtmax .or. &
8654 & vtxbar(mgs,il,3) .gt. vtmax )
THEN
8668 vtxbar(mgs,il,1) = min(vtmax,vtxbar(mgs,il,1) )
8669 vtxbar(mgs,il,2) = min(vtmax,vtxbar(mgs,il,2) )
8670 vtxbar(mgs,il,3) = min(vtmax,vtxbar(mgs,il,3) )
8676 xvt(kgs(mgs),igs(mgs),1,il) = vtxbar(mgs,il,1)
8677 xvt(kgs(mgs),igs(mgs),2,il) = vtxbar(mgs,il,2)
8678 IF ( infdo .ge. 2 )
THEN
8679 xvt(kgs(mgs),igs(mgs),3,il) = vtxbar(mgs,il,3)
8681 xvt(kgs(mgs),igs(mgs),3,il) = 0.0
8690 if (ndebugzf .gt. 0 )
write(0,*)
'ZIEGFALL: COPIED FALL SPEEDS'
8696 if (ndebugzf .gt. 0 )
write(0,*)
'ZIEGFALL: DONE WITH LOOP'
8698 if ( kz .gt. nz-1 )
then
8704 if (ndebugzf .gt. 0 )
write(0,*)
'ZIEGFALL: SET NZMPB'
8708 if (ndebugzf .gt. 0 )
write(0,*)
'ZIEGFALL: SET NXMPB'
8717 if (ndebugzf .gt. 0 )
write(0,*)
"ZIEGFALL: EXITING SUBROUTINE"
8721 END subroutine ziegfall1d
8733 subroutine radardd02(nx,ny,nz,nor,na,an,temk, &
8734 & dbz,db,nzdbz,cnoh0t,hwdn1t,ipconc,ke_diag, iunit)
8780 character(LEN=15),
parameter :: microp =
'ZVD'
8781 integer nx,ny,nz,nor,na,ngt
8786 integer,
parameter :: printyn = 0
8788 parameter( ng1 = 1 )
8796 integer imapz,mzdist
8799 integer,
parameter :: norz = 3
8800 real an(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor,na)
8801 real db(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
8803 real temk(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
8804 real dbz(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-nor+ng1:nz+nor)
8805 real gz(-nor+1:nz+nor)
8808 real cr1, cr2 , hwdnsq,swdnsq
8809 real rwdnsq, dhmin, qrmin, qsmin, qhmin, qhlmin, tfr, tfrh, zrc
8810 real reflectmin, kw_sq
8811 real const_ki_sn, const_ki_h, ki_sq_sn
8812 real ki_sq_h, dielf_sn, dielf_h
8821 double precision :: dtmps, dtmpr, dtmph, dtmphl, g1, zx, ze, x
8823 integer i,j,k,ix,jy,kz,ihcnt
8825 double precision :: xcnoh, xcnos, dadh, dads, zhdryc, zsdryc, zhwetc,zswetc
8826 double precision :: dadr
8828 parameter( dbzmin = 0 )
8830 real cnow,cnoi,cnoip,cnoir,cnor,cnos
8831 real cnogl,cnogm,cnogh,cnof,cnoh,cnohl
8833 real swdn, rwdn ,hwdn,gldn,gmdn,ghdn,fwdn,hldn
8836 real rwdnmx,cwdnmx,cidnmx,xidnmx,swdnmx,gldnmx,gmdnmx
8837 real ghdnmx,fwdnmx,hwdnmx,hldnmx
8838 real rwdnmn,cwdnmn,cidnmn,xidnmn,swdnmn,gldnmn,gmdnmn
8839 real ghdnmn,fwdnmn,hwdnmn,hldnmn
8841 real gldnsq,gmdnsq,ghdnsq,fwdnsq,hldnsq
8843 real dadgl,dadgm,dadgh,dadhl,dadf
8844 real zgldryc,zglwetc,zgmdryc, zgmwetc,zghdryc,zghwetc
8845 real zhldryc,zhlwetc,zfdryc,zfwetc
8847 real dielf_gl,dielf_gm,dielf_gh,dielf_hl,dielf_fw
8851 real swdia,gldia,gmdia,ghdia,fwdia,hwdia,hldia
8853 real csw,cgl,cgm,cgh,cfw,chw,chl
8854 real xvs,xvgl,xvgm,xvgh,xvf,xvh,xvhl
8860 parameter( rhos = 0.1 )
8866 real,
parameter :: cwmasn = 5.23e-13
8867 real,
parameter :: cwmasx = 5.25e-10
8868 real,
parameter :: cwradn = 5.0e-6
8872 real :: vzsnow, vzrain, vzgraupel, vzhail
8926 IF ( microp(1:4) .eq.
'ZIEG' )
THEN
8940 IF ( lhl .gt. 1 )
THEN
8945 ELSEIF ( microp(1:3) .eq.
'ZVD' )
THEN
8958 IF ( lhl .gt. 1 )
THEN
9070 gldn = (0.5)*(gldnmn+gldnmx)
9071 gmdn = (0.5)*(gmdnmn+gmdnmx)
9072 ghdn = (0.5)*(ghdnmn+ghdnmx)
9073 fwdn = (0.5)*(fwdnmn+fwdnmx)
9074 hldn = (0.5)*(hldnmn+hldnmx)
9107 const_ki_sn = 0.5 - (0.5-0.46)/(917.-220.)*(swdn-220.)
9108 const_ki_h = 0.5 - (0.5-0.46)/(917.-220.)*(hwdn-220.)
9109 ki_sq_sn = (swdnsq/rwdnsq) * const_ki_sn**2
9110 ki_sq_h = (hwdnsq/rwdnsq) * const_ki_h**2
9111 dielf_sn = ki_sq_sn / kw_sq
9112 dielf_h = ki_sq_h / kw_sq
9119 dielf_sn = (swdnsq/rwdnsq)*.21/ kw_sq
9120 dielf_h = (hwdnsq/rwdnsq)*.21/ kw_sq
9122 dielf_gl = (gldnsq/rwdnsq)*.21/ kw_sq
9123 dielf_gm = (gmdnsq/rwdnsq)*.21/ kw_sq
9124 dielf_gh = (ghdnsq/rwdnsq)*.21/ kw_sq
9125 dielf_hl = (hldnsq/rwdnsq)*.21/ kw_sq
9126 dielf_fw = (fwdnsq/rwdnsq)*.21/ kw_sq
9168 dadr = (db(ix,jy,kz)/(pi*rwdn*cnor))**(0.25)
9175 IF ( an(ix,jy,kz,lr) .ge. qrmin )
THEN
9176 IF ( ipconc .le. 2 )
THEN
9177 gtmp(ix,kz) = dadr*an(ix,jy,kz,lr)**(0.25)
9178 dtmp(ix,kz) = zrc*gtmp(ix,kz)**7
9179 ELSEIF ( lzr .gt. 1 )
THEN
9180 dtmp(ix,kz) = 1e18*an(ix,jy,kz,lzr)
9181 ELSEIF ( an(ix,jy,kz,lnr) .gt. 1.e-3 )
THEN
9182 IF ( imurain == 3 )
THEN
9183 vr = db(ix,jy,kz)*an(ix,jy,kz,lr)/(1000.*an(ix,jy,kz,lnr))
9184 dtmp(ix,kz) = 3.6e18*(rnu+2.)*an(ix,jy,kz,lnr)*vr**2/(rnu+1.)
9186 g1 = (6.0 + alphar)*(5.0 + alphar)*(4.0 + alphar)/((3.0 + alphar)*(2.0 + alphar)*(1.0 + alphar))
9187 zx = g1*(db(ix,jy,kz)*an(ix,jy,kz,lr))**2/an(ix,jy,kz,lnr)
9188 ze =1.e18*zx*(6./(pi*1000.))**2
9201 IF( lhab .gt. lr )
THEN
9247 IF ( ls .gt. 1 )
THEN
9249 IF ( lvs .gt. 1 )
THEN
9250 IF ( an(ix,jy,kz,lvs) .gt. 0.0 )
THEN
9251 swdn = db(ix,jy,kz)*an(ix,jy,kz,ls)/an(ix,jy,kz,lvs)
9252 swdn = min( 300., max( 100., swdn ) )
9259 IF ( ipconc .ge. 5 )
THEN
9261 xvs = db(ix,jy,kz)*an(ix,jy,kz,ls)/ &
9262 & (swdn*max(1.0e-3,an(ix,jy,kz,lns)))
9263 IF ( xvs .lt. xvsmn .or. xvs .gt. xvsmx )
THEN
9264 xvs = min( xvsmx, max( xvsmn,xvs ) )
9265 csw = db(ix,jy,kz)*an(ix,jy,kz,ls)/(xvs*swdn)
9268 swdia = (xvs*cwc0)**(1./3.)
9269 xcnos = an(ix,jy,kz,ls)*db(ix,jy,kz)/(xvs*swdn*swdia)
9286 IF ( lh .gt. 1 )
THEN
9288 IF ( lvh .gt. 1 )
THEN
9289 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
9290 hwdn = db(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
9291 hwdn = min( 900., max( hdnmn, hwdn ) )
9299 IF ( ipconc .ge. 5 )
THEN
9301 xvh = db(ix,jy,kz)*an(ix,jy,kz,lh)/ &
9302 & (hwdn*max(1.0e-3,an(ix,jy,kz,lnh)))
9303 IF ( xvh .lt. xvhmn .or. xvh .gt. xvhmx )
THEN
9304 xvh = min( xvhmx, max( xvhmn,xvh ) )
9305 chw = db(ix,jy,kz)*an(ix,jy,kz,lh)/(xvh*hwdn)
9308 hwdia = (xvh*cwc0)**(1./3.)
9309 xcnoh = an(ix,jy,kz,lh)*db(ix,jy,kz)/(xvh*hwdn*hwdia)
9318 IF ( xcnoh .gt. 0.0 )
THEN
9319 dadh = ( db(ix,jy,kz) /(pi*hwdn*xcnoh) )**(.25)
9320 zhdryc = 0.224*cr2*(db(ix,jy,kz)/rwdn)**2/xcnoh
9329 IF ( xcnos .gt. 0.0 )
THEN
9330 dads = ( db(ix,jy,kz) /(pi*swdn*xcnos) )**(.25)
9331 zsdryc = 0.224*cr2*(db(ix,jy,kz)/rwdn)**2/xcnos
9341 IF ( ls .gt. 1 )
THEN
9347 IF ( an(ix,jy,kz,ls) .ge. qsmin )
THEN
9348 IF ( ipconc .ge. 4 )
THEN
9350 if (lsw .gt. 1)
THEN
9351 qxw = an(ix,jy,kz,lsw)
9353 ELSEIF ( ( iusewetsnow == 1 .or. iusewetsnow == 3) .and. temk(ix,jy,kz) .gt. tfr+1. &
9354 & .and. an(ix,jy,kz,ls) > an(ix,jy,kz,lr) .and. an(ix,jy,kz,lr) > qsmin)
THEN
9355 qxw = min(0.5*an(ix,jy,kz,ls), an(ix,jy,kz,lr))
9363 IF ( an(ix,jy,kz,lns) .gt. 1.e-7 )
THEN
9365 IF ( qxw > qsmin .or. iusewetsnow >= 2 )
THEN
9368 gtmp(ix,kz) = 3.6e18*(snu+2.)*( 0.224*(an(ix,jy,kz,ls)+qxw1) + 0.776*qxw)*(an(ix,jy,kz,ls)+qxw1)/ &
9369 & (an(ix,jy,kz,lns)*(snu+1.)*rwdn**2)*db(ix,jy,kz)**2
9373 dnsnow = 0.0346159*sqrt(an(ix,jy,kz,lns)/(an(ix,jy,kz,ls)*db(ix,jy,kz)) )
9374 IF ( .true. .or. dnsnow < 900. )
THEN
9375 gtmp(ix,kz) = 1.e18*323.3226* 0.106214**2*(ksq*an(ix,jy,kz,ls) + &
9376 & (1.-ksq)*qxw)*an(ix,jy,kz,ls)*db(ix,jy,kz)**2*gsnow73/ &
9377 & (an(ix,jy,kz,lns)*(917.)**2* gsnow1*(1.0+snu)**(4./3.))
9379 gtmp(ix,kz) = (36./pi**2) * 1.e18*(snu+2.)*( 0.224*(an(ix,jy,kz,ls)+qxw1) + 0.776*qxw)*(an(ix,jy,kz,ls)+qxw1)/ &
9380 & (an(ix,jy,kz,lns)*(snu+1.)*rwdn**2)*db(ix,jy,kz)**2
9390 dtmp(ix,kz) = dtmp(ix,kz) + gtmp(ix,kz)
9392 gtmp(ix,kz) = dads*an(ix,jy,kz,ls)**(0.25)
9394 IF ( gtmp(ix,kz) .gt. 0.0 )
THEN
9395 dtmps = zsdryc*an(ix,jy,kz,ls)**2/gtmp(ix,kz)
9396 IF ( temk(ix,jy,kz) .lt. tfr )
THEN
9397 dtmp(ix,kz) = dtmp(ix,kz) + &
9398 & zsdryc*an(ix,jy,kz,ls)**2/gtmp(ix,kz)
9400 dtmp(ix,kz) = dtmp(ix,kz) + &
9401 & zswetc*an(ix,jy,kz,ls)**2/gtmp(ix,kz)
9414 IF ( li .gt. 1 .and. idbzci .ne. 0 )
THEN
9416 IF ( idbzci == 1 .and. lni > 0 )
THEN
9418 IF ( an(ix,jy,kz,li) > qxmin(li) .and. an(ix,jy,kz,lni) > 1.0 )
THEN
9419 vr = db(ix,jy,kz)*an(ix,jy,kz,li)/(900.*an(ix,jy,kz,lni))
9420 dtmp(ix,kz) = dtmp(ix,kz) + &
9421 & 0.224*3.6e18*(cinu+2.)*an(ix,jy,kz,lni)*vr**2/(cinu+1.)*(900./1000.)**2
9424 ELSEIF ( idbzci == 2 )
THEN
9429 IF ( an(ix,jy,kz,li) .ge. 0.1e-3 )
THEN
9430 gtmp(ix,kz) = min(1.0,1.e3*(an(ix,jy,kz,li))*db(ix,jy,kz))
9431 dtmp(ix,kz) = dtmp(ix,kz) + 750.0*(gtmp(ix,kz))**1.98
9441 IF ( lh .gt. 1 )
THEN
9446 IF ( izieg .ge. 1 .and. ipconc .ge. 5 )
THEN
9450 IF ( an(ix,jy,kz,lzh) > 0.0 .and. an(ix,jy,kz,lh) > qhmin .and. &
9451 an(ix,jy,kz,lnh) >= cxmin ) ltest = .true.
9454 IF ( ltest .or. (an(ix,jy,kz,lh) .ge. qhmin .and. an(ix,jy,kz,lnh) .ge. cxmin ))
THEN
9456 IF ( lvh .gt. 1 )
THEN
9458 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
9459 hwdn = db(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
9460 hwdn = min( 900., max( 100., hwdn ) )
9467 chw = an(ix,jy,kz,lnh)
9468 IF ( chw .gt. 0.0 )
THEN
9469 xvh = db(ix,jy,kz)*an(ix,jy,kz,lh)/(hwdn*max(1.0e-3,chw))
9470 IF ( xvh .lt. xvhmn .or. xvh .gt. xvhmx )
THEN
9471 xvh = min( xvhmx, max( xvhmn,xvh ) )
9472 chw = db(ix,jy,kz)*an(ix,jy,kz,lh)/(xvh*hwdn)
9475 qh = an(ix,jy,kz,lh)
9477 IF ( lhw .gt. 1 )
THEN
9478 IF ( iusewetgraupel .eq. 1 )
THEN
9479 qxw = an(ix,jy,kz,lhw)
9480 ELSEIF ( iusewetgraupel .eq. 2 )
THEN
9481 IF ( hwdn .lt. 300. )
THEN
9482 qxw = an(ix,jy,kz,lhw)
9485 ELSEIF ( iusewetgraupel .eq. 3 )
THEN
9486 IF ( hwdn .lt. 300. .and. temk(ix,jy,kz) > tfr .and. an(ix,jy,kz,lr) > qhmin )
THEN
9487 qxw = min( an(ix,jy,kz,lh), an(ix,jy,kz,lr))
9490 ELSEIF ( iusewetgraupel == 4 .and. temk(ix,jy,kz) .gt. tfr+0.25 .and. an(ix,jy,kz,lh) > an(ix,jy,kz,lr) &
9491 & .and. an(ix,jy,kz,lr) > qhmin)
THEN
9492 qxw = min(0.5*an(ix,jy,kz,lh), an(ix,jy,kz,lr))
9497 IF ( lzh .gt. 1 )
THEN
9498 x = (0.224*qh + 0.776*qxw)/an(ix,jy,kz,lh)
9499 dtmph = 1.e18*x*an(ix,jy,kz,lzh)*(hwdn/rwdn)**2
9500 dtmp(ix,kz) = dtmp(ix,kz) + dtmph
9502 g1 = (6.0 + alphah)*(5.0 + alphah)*(4.0 + alphah)/((3.0 + alphah)*(2.0 + alphah)*(1.0 + alphah))
9505 zx = g1*db(ix,jy,kz)**2*( 0.224*qh + 0.776*qxw)*qh/chw
9506 ze =1.e18*zx*(6./(pi*1000.))**2
9507 dtmp(ix,kz) = dtmp(ix,kz) + ze
9520 IF ( an(ix,jy,kz,lh) .ge. qhmin )
THEN
9521 gtmp(ix,kz) = dadh*an(ix,jy,kz,lh)**(0.25)
9522 IF ( gtmp(ix,kz) .gt. 0.0 )
THEN
9523 dtmph = zhdryc*an(ix,jy,kz,lh)**2/gtmp(ix,kz)
9524 IF ( temk(ix,jy,kz) .lt. tfr )
THEN
9525 dtmp(ix,kz) = dtmp(ix,kz) + &
9526 & zhdryc*an(ix,jy,kz,lh)**2/gtmp(ix,kz)
9529 dtmp(ix,kz) = dtmp(ix,kz) + &
9530 & zhdryc*an(ix,jy,kz,lh)**2/gtmp(ix,kz)
9550 IF ( izieg .ge. 1 .and. lhl .gt. 1 )
THEN
9558 IF ( lvhl .gt. 1 )
THEN
9559 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
9560 hldn = db(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
9561 hldn = min( 900., max( 300., hldn ) )
9570 IF ( ipconc .ge. 5 )
THEN
9573 IF ( lzhl > 1 )
THEN
9574 IF ( an(ix,jy,kz,lzhl) > 0.0 .and. an(ix,jy,kz,lhl) > qhlmin .and. &
9575 an(ix,jy,kz,lnhl) > 0.0 ) ltest = .true.
9578 IF ( ltest .or. ( an(ix,jy,kz,lhl) .ge. qhlmin .and. an(ix,jy,kz,lnhl) .gt. 0.) )
THEN
9579 chl = an(ix,jy,kz,lnhl)
9580 IF ( chl .gt. 0.0 )
THEN
9581 xvhl = db(ix,jy,kz)*an(ix,jy,kz,lhl)/ &
9582 & (hldn*max(1.0e-9,an(ix,jy,kz,lnhl)))
9583 IF ( xvhl .lt. xvhlmn .or. xvhl .gt. xvhlmx )
THEN
9584 xvhl = min( xvhlmx, max( xvhlmn,xvhl ) )
9585 chl = db(ix,jy,kz)*an(ix,jy,kz,lhl)/(xvhl*hldn)
9589 IF ( lhlw .gt. 1 )
THEN
9590 IF ( iusewethail .eq. 1 )
THEN
9591 qxw = an(ix,jy,kz,lhlw)
9592 ELSEIF ( iusewethail .eq. 2 )
THEN
9593 IF ( hldn .lt. 300. )
THEN
9594 qxw = an(ix,jy,kz,lhlw)
9599 IF ( lzhl .gt. 1 )
THEN
9600 x = (0.224*an(ix,jy,kz,lhl) + 0.776*qxw)/an(ix,jy,kz,lhl)
9601 dtmphl = 1.e18*x*an(ix,jy,kz,lzhl)*(hldn/rwdn)**2
9602 dtmp(ix,kz) = dtmp(ix,kz) + dtmphl
9605 g1 = (6.0 + alphahl)*(5.0 + alphahl)*(4.0 + alphahl)/((3.0 + alphahl)*(2.0 + alphahl)*(1.0 + alphahl))
9606 zx = g1*db(ix,jy,kz)**2*( 0.224*an(ix,jy,kz,lhl) + 0.776*qxw)*an(ix,jy,kz,lhl)/chl
9608 ze = 1.e18*zx*(6./(pi*1000.))**2
9609 dtmp(ix,kz) = dtmp(ix,kz) + ze
9621 IF ( an(ix,jy,kz,lhl) .ge. qhlmin )
THEN
9622 dadhl = ( db(ix,jy,kz) /(pi*hldn*cnohl) )**(.25)
9623 gtmp(ix,kz) = dadhl*an(ix,jy,kz,lhl)**(0.25)
9624 IF ( gtmp(ix,kz) .gt. 0.0 )
THEN
9626 zhldryc = 0.224*cr2*( db(ix,jy,kz)/rwdn)**2/cnohl
9628 dtmphl = zhldryc*an(ix,jy,kz,lhl)**2/gtmp(ix,kz)
9630 IF ( temk(ix,jy,kz) .lt. tfr )
THEN
9631 dtmp(ix,kz) = dtmp(ix,kz) + &
9632 & zhldryc*an(ix,jy,kz,lhl)**2/gtmp(ix,kz)
9635 dtmp(ix,kz) = dtmp(ix,kz) + &
9636 & zhldryc*an(ix,jy,kz,lhl)**2/gtmp(ix,kz)
9654 IF ( dtmp(ix,kz) .gt. 0.0 )
THEN
9655 dbz(ix,jy,kz) = max(dbzmin, 10.0*log10(dtmp(ix,kz)) )
9657 IF ( dbz(ix,jy,kz) .gt. dbzmax )
THEN
9658 dbzmax = max(dbzmax,dbz(ix,jy,kz))
9664 dbz(ix,jy,kz) = dbzmin
9665 IF ( lh > 1 .and. lhl > 1)
THEN
9666 IF ( an(ix,jy,kz,lh) > 1.0e-3 )
THEN
9667 write(0,*)
'radardbz: qr,qh,qhl = ',an(ix,jy,kz,lr), an(ix,jy,kz,lh),an(ix,jy,kz,lhl)
9668 write(0,*)
'radardbz: dtmps,dtmph,dadh,dadhl,dtmphl = ',dtmps,dtmph,dadh,dadhl,dtmphl
9670 IF ( lzh>1 .and. lzhl>1 )
write(0,*)
'radardbz: zh, zhl = ',an(ix,jy,kz,lzh),an(ix,jy,kz,lzhl)
9683 IF ( .not. dtmp(ix,kz) .lt. 1.e30 .or. dbz(ix,jy,kz) > 190.0 )
THEN
9686 write(0,*)
'ix,jy,kz = ',ix,jy,kz
9687 write(0,*)
'dbz = ',dbz(ix,jy,kz)
9688 write(0,*)
'db, zhdryc = ',db(ix,jy,kz),zhdryc
9689 write(0,*)
'Hail intercept: ',xcnoh,ix,kz
9690 write(0,*)
'Hail,snow q: ',an(ix,jy,kz,lh),an(ix,jy,kz,ls)
9691 write(0,*)
'graupel density hwdn = ',hwdn
9692 write(0,*)
'rain q: ',an(ix,jy,kz,lr)
9693 write(0,*)
'ice q: ',an(ix,jy,kz,li)
9694 IF ( lhl .gt. 1 )
write(0,*)
'Hail (lhl): ',an(ix,jy,kz,lhl)
9695 IF (ipconc .ge. 3 )
write(0,*)
'rain c: ',an(ix,jy,kz,lnr)
9696 IF ( lzr > 1 )
write(0,*)
'rain Z: ',an(ix,jy,kz,lzr)
9697 IF ( ipconc .ge. 5 )
THEN
9698 write(0,*)
'Hail,snow c: ',an(ix,jy,kz,lnh),an(ix,jy,kz,lns)
9699 IF ( lhl .gt. 1 )
write(0,*)
'Hail (lnhl): ',an(ix,jy,kz,lnhl)
9700 IF ( lzhl .gt. 1 )
THEN
9701 write(0,*)
'Hail (lzhl): ',an(ix,jy,kz,lzhl)
9702 write(0,*)
'chl,xvhl,dhl = ',chl,xvhl,(xvhl*6./3.14159)**(1./3.)
9703 write(0,*)
'xvhlmn,xvhlmx = ',xvhlmn,xvhlmx
9706 write(0,*)
'chw,xvh = ', chw,xvh
9707 write(0,*)
'dtmps,dtmph,dadh,dadhl,dtmphl = ',dtmps,dtmph,dadh,dadhl,dtmphl
9708 write(0,*)
'dtmpr = ',dtmpr
9709 write(0,*)
'gtmp = ',gtmp(ix,kz),dtmp(ix,kz)
9710 IF ( .not. (dbz(ix,jy,kz) .gt. -100 .and. dbz(ix,jy,kz) .lt. 200 ) )
THEN
9711 write(0,*)
'dbz out of bounds!'
9724 IF ( printyn .eq. 1 )
THEN
9726 write(iunit,*)
'maxdbz,ijk = ',dbzmax,imx,jmx,kmx
9727 write(iunit,*)
'qrw = ',an(imx,jmx,kmx,lr)
9729 IF ( lh .gt. 1 )
THEN
9730 write(iunit,*)
'qi = ',an(imx,jmx,kmx,li)
9731 write(iunit,*)
'qsw = ',an(imx,jmx,kmx,ls)
9732 write(iunit,*)
'qhw = ',an(imx,jmx,kmx,lh)
9733 IF ( lhl .gt. 1 )
write(iunit,*)
'qhl = ',an(imx,jmx,kmx,lhl)
9741 END subroutine radardd02
9758 & (nx,ny,nz,na,jyslab &
9759 & ,nor,norz,dtp,nxi &
9766 & ,ssfilt,t00,t77,flag_qndrop &
9773 integer :: nx,ny,nz,na,nxi
9774 integer :: nor,norz, jyslab
9776 logical :: flag_qndrop
9778 integer,
parameter :: ng1 = 1
9784 real t00(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9785 real t77(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9787 real t0(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9796 real t9(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9799 real p2(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9800 real pn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9801 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
9802 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9804 real w(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9807 real ssfilt(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9810 real pb(-norz+ng1:nz+norz)
9811 real pinit(-norz+ng1:nz+norz)
9813 real dz3d(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
9819 real axtra(-nor+ng1:nx+nor,-nor+ng1:ny+nor,-norz+ng1:nz+norz,nxtra)
9823 real :: ccnefactwo, sstmp, cn1, cnuctmp
9828 real,
parameter :: cwmas30 = 1000.*0.523599*(2.*30.e-6)**3
9829 real,
parameter :: cwmas20 = 1000.*0.523599*(2.*20.e-6)**3
9830 integer nxmpb,nzmpb,nxz
9831 integer mgs,ngs,numgs,inumgs
9832 integer ngscnt,igs(ngs),kgs(ngs)
9833 integer kgsp(ngs),kgsm(ngs)
9836 integer ix,kz,i,n, kp1, km1
9838 integer ixb,ixe,jyb,jye,kzb,kze
9840 integer itile,jtile,ktile
9841 integer ixend,jyend,kzend,kzbeg
9842 integer nxend,nyend,nzend,nzbeg
9849 real ccnc(ngs), ccna(ngs), cnuc(ngs), cwnccn(ngs), ccnaco(ngs), ccnanu(ngs)
9850 real :: ccnc_nu(ngs), ccnc_ac(ngs), ccnc_co(ngs)
9853 parameter( sscb = 2.0 )
9855 parameter( idecss = 1 )
9861 parameter( ifilt = 0 )
9871 real,
parameter :: aa1 = 9.44e15, aa2 = 5.78e3
9877 real ac1,bc, taus, c1,d1,e1,f1,p380,tmp,tmp2
9878 real tmpmx, fw, qctmp
9880 double precision :: vent1,vent2
9884 real d1r, d1i, d1s, e1i
9886 real dtcon,dtcon1,dtcon2
9888 integer ltemq1,ltemq1m
9889 real dqv,qv1,ss1,ss2,qvs1,dqvs,dtemp,dt1
9891 real ssi1, ssi2, dqvi, dqvis, dqvii,qis1
9892 real dqvr, dqc, dqr, dqi, dqs
9893 real qv1m,qvs1m,ss1m,ssi1m,qis1m
9897 real cn(ngs), cnuf(ngs)
9907 real ssf(ngs),ssfkp1(ngs),ssfkm1(ngs),ssat0(ngs)
9908 real,
parameter :: ssfcut = 4.0
9909 real ssfjp1(ngs),ssfjm1(ngs)
9910 real ssfip1(ngs),ssfim1(ngs)
9913 parameter(supcb=0.5,supmx=238.0)
9914 real r2dxm, r2dym, r2dzm
9915 real dssdz, dssdy, dssdx
9918 parameter(epsi = 0.622, d = 0.266)
9921 real vr,nrx,qr,z1,z2,rdi,alp,xnutmp,xnuc
9928 real dqvcnd(ngs),dqwv(ngs),dqcw(ngs),dqci(ngs)
9929 real temp(ngs),tempc(ngs)
9930 real temg(ngs),temcg(ngs),theta(ngs),qvap(ngs)
9931 real temgx(ngs),temcgx(ngs)
9932 real qvs(ngs),qis(ngs),qss(ngs),pqs(ngs)
9933 real felv(ngs),felf(ngs),fels(ngs)
9934 real felvcp(ngs),felvpi(ngs)
9935 real gamw(ngs),gams(ngs)
9936 real tsqr(ngs),ssi(ngs),ssw(ngs)
9937 real cc3(ngs),cqv1(ngs),cqv2(ngs)
9938 real qcwtmp(ngs),qtmp
9941 real fwvdf(ngs),ftka(ngs),fthdf(ngs)
9942 real fadvisc(ngs),fakvisc(ngs)
9943 real fci(ngs),fcw(ngs)
9944 real fschm(ngs),fpndl(ngs)
9946 real pres(ngs),pipert(ngs)
9948 real rho0(ngs),pi0(ngs)
9950 real thetap(ngs),theta0(ngs),qwvp(ngs),qv0(ngs)
9954 real wvel(ngs),wvelkm1(ngs)
9956 real wvdf(ngs),tka(ngs)
9962 real :: qx(ngs,lv:lhab)
9963 real :: cx(ngs,lc:lhab)
9964 real :: xv(ngs,lc:lhab)
9965 real :: xmas(ngs,lc:lhab)
9966 real :: xdn(ngs,lc:lhab)
9967 real :: xdia(ngs,lc:lhab,3)
9968 real :: alpha(ngs,lc:lhab)
9969 real :: zx(ngs,lr:lhab)
9972 logical zerocx(lc:lqmx)
9976 integer,
parameter :: iunit = 0
9978 real :: frac, hwdn, tmpg, xdia1, xdia3, cwch,xvol
9982 real,
parameter :: cpv = 1885.0
9983 real,
parameter :: mair = 0.0284
9991 real,
parameter :: mwwater = 0.01801528
9992 real,
parameter :: rhowater = 997.0
9993 real,
parameter :: gasconst = 8.3144598
9997 real :: alpha_ar, gamma_ar, g_ar, evs, zeta, smax
9998 real :: f_ac, g_ac, eta_ac
9999 real :: f_nu, g_nu, eta_nu
10000 real :: f_co, g_co, eta_co
10002 real :: sm_nu, sm_ac, sm_co, ss_ac, ss_nu, ss_co
10003 real :: uu_nu, uu_ac, uu_co
10005 real :: cn_ac, cn_co, cn_nu
10020 IF ( ac_opt > 0 ) ccnefactwo = (1.63e-3/(cck * beta(3./2., cck/2.)))**(1.0/(cck + 2.0))
10021 f5 = 237.3 * 17.27 * 2.5e6 / cp
10028 IF ( ipconc <= 1 .or. isedonly == 2 )
GOTO 2200
10041 temp1 = an(ix,jy,kz,lt)*t77(ix,jy,kz)
10042 t0(ix,jy,kz) = temp1
10043 ltemq = int( (temp1-163.15)/fqsat+1.5 )
10044 ltemq = min( nqsat, max(1,ltemq) )
10047 IF ( iqvsopt == 0 )
THEN
10048 c1 = t00(ix,jy,kz)*tabqvs(ltemq)
10049 ELSEIF ( iqvsopt == 1 )
THEN
10050 c1 = rdorv*esbolton*tabqvs(ltemq)/(pn(ix,jy,kz) + pb(kz) - esbolton*tabqvs(ltemq))
10053 IF ( c1 > 0. )
THEN
10054 ssfilt(ix,jy,kz) = 100.*(an(ix,jy,kz,lv)/c1 - 1.0)
10056 ssfilt(ix,jy,kz) = -100.
10072 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Gather stage'
10077 numgs = nxz/ngs + 1
10080 do 2000 inumgs = 1,numgs
10095 pres(1) = pn(ix,jy,kz) + pb(kz)
10096 pqs(1) = 380.0/(pn(ix,jy,kz) + pb(kz))
10097 theta(1) = an(ix,jy,kz,lt)
10098 temg(1) = t0(ix,jy,kz)
10100 temcg(1) = temg(1) - tfr
10101 ltemq = (temg(1)-163.15)/fqsat+1.5
10102 ltemq = min( nqsat, max(1,ltemq) )
10104 IF ( iqvsopt == 0 )
THEN
10105 qvs(1) = pqs(1)*tabqvs(ltemq)
10106 ELSEIF ( iqvsopt == 1 )
THEN
10107 qvs(1) = rdorv*esbolton*tabqvs(ltemq)/(pres(1) - esbolton*tabqvs(ltemq))
10109 qis(1) = pqs(1)*tabqis(ltemq)
10114 if ( temg(1) .lt. tfr )
then
10117 if ( (temg(1) .gt. tfrh .or. an(ix,jy,kz,lv)/qvs(1) > maxlowtempss ) .and. &
10118 & ( an(ix,jy,kz,lv) .gt. qss(1) .or. &
10119 & an(ix,jy,kz,lc) .gt. qxmin(lc) .or. &
10120 & ( an(ix,jy,kz,lr) .gt. qxmin(lr) .and. rcond == 2 ) &
10122 ngscnt = ngscnt + 1
10125 if ( ngscnt .eq. ngs )
goto 2100
10135 if ( ngscnt .eq. 0 )
go to 29998
10137 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: dbg = 8'
10149 IF ( imurain == 1 )
THEN
10150 alpha(:,lr) = alphar
10151 ELSEIF ( imurain == 3 )
THEN
10152 alpha(:,lr) = xnu(lr)
10159 qx(mgs,lv) = an(igs(mgs),jy,kgs(mgs),lv)
10161 qx(mgs,il) = max(an(igs(mgs),jy,kgs(mgs),il), 0.0)
10164 qcwtmp(mgs) = qx(mgs,lc)
10167 theta0(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
10169 theta(mgs) = an(igs(mgs),jy,kgs(mgs),lt)
10170 qv0(mgs) = qx(mgs,lv)
10171 qwvp(mgs) = qx(mgs,lv) - qv0(mgs)
10173 pres(mgs) = pn(igs(mgs),jy,kgs(mgs)) + pb(kgs(mgs))
10174 pipert(mgs) = p2(igs(mgs),jy,kgs(mgs))
10175 rho0(mgs) = dn(igs(mgs),jy,kgs(mgs))
10176 rhoinv(mgs) = 1.0/rho0(mgs)
10177 rhovt(mgs) = sqrt(rho00/rho0(mgs))
10178 pi0(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
10179 temg(mgs) = t0(igs(mgs),jy,kgs(mgs))
10181 pk(mgs) = p2(igs(mgs),jy,kgs(mgs)) + pinit(kgs(mgs))
10182 temcg(mgs) = temg(mgs) - tfr
10183 qss0(mgs) = (380.0)/(pres(mgs))
10184 pqs(mgs) = (380.0)/(pres(mgs))
10185 ltemq = (temg(mgs)-163.15)/fqsat+1.5
10186 ltemq = min( nqsat, max(1,ltemq) )
10188 IF ( iqvsopt == 0 )
THEN
10189 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
10190 ELSEIF ( iqvsopt == 1 )
THEN
10191 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
10193 qis(mgs) = pqs(mgs)*tabqis(ltemq)
10195 qvap(mgs) = max( (qwvp(mgs) + qv0(mgs)), 0.0 )
10196 IF ( iqvsopt == 0 )
THEN
10197 es(mgs) = 6.1078e2*tabqvs(ltemq)
10198 ELSEIF ( iqvsopt == 1 )
THEN
10199 es(mgs) = esbolton*tabqvs(ltemq)
10202 qss(mgs) = qvs(mgs)
10205 temgx(mgs) = min(temg(mgs),313.15)
10206 temgx(mgs) = max(temgx(mgs),233.15)
10207 felv(mgs) = 2500837.367 * (273.15/temgx(mgs))**((0.167)+(3.67e-4)*temgx(mgs))
10209 IF ( eqtset <= 1 )
THEN
10210 felvcp(mgs) = felv(mgs)*cpi
10212 tmp = qx(mgs,li)+qx(mgs,ls)+qx(mgs,lh)
10213 IF ( lhl > 1 ) tmp = tmp + qx(mgs,lhl)
10214 IF ( lf > 1 ) tmp = tmp + qx(mgs,lf)
10215 cvm = cv+cvv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
10217 cpm = cp+cpv*qx(mgs,lv)+cpl*(qx(mgs,lc)+qx(mgs,lr)) &
10219 rmm=rd+rw*qx(mgs,lv)
10221 IF ( eqtset == 2 )
THEN
10223 felvcp(mgs) = (felv(mgs)-rw*temg(mgs))/cvm
10226 felvcp(mgs) = (felv(mgs)*cv/(cp) - rw*temg(mgs)*(1.0-rovcp*cpm/rmm))/cvm
10227 felvpi(mgs) = pi0(mgs)*rovcp*(felv(mgs)/(temg(mgs)) - rw*cpm/rmm)/cvm
10232 temcgx(mgs) = min(temg(mgs),273.15)
10233 temcgx(mgs) = max(temcgx(mgs),223.15)
10234 temcgx(mgs) = temcgx(mgs)-273.15
10235 felf(mgs) = 333690.6098 + (2030.61425)*temcgx(mgs) - (10.46708312)*temcgx(mgs)**2
10237 fels(mgs) = felv(mgs) + felf(mgs)
10238 fcqv1(mgs) = 4098.0258*felv(mgs)*cpi
10240 wvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)* &
10241 & (101325.0/(pb(kgs(mgs)) + pn(igs(mgs),jgs,kgs(mgs))))
10242 advisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))* &
10243 & (temg(mgs)/296.0)**(1.5)
10244 tka(mgs) = tka0*advisc(mgs)/advisc1
10254 if ( ipconc .ge. 1 )
then
10256 cx(mgs,li) = max(an(igs(mgs),jy,kgs(mgs),lni), 0.0)
10259 if ( ipconc .ge. 2 )
then
10261 cx(mgs,lc) = max(an(igs(mgs),jy,kgs(mgs),lnc), 0.0)
10262 cwnccn(mgs) = cwccn*rho0(mgs)/rho00
10264 IF ( lss > 1 )
THEN
10265 ssmax(mgs) = an(igs(mgs),jy,kgs(mgs),lss)
10269 IF ( lccn .gt. 1 .and. ac_opt == 0 )
THEN
10270 IF ( lccnuf .gt. 1 .and. i_uf_or_ccn > 0 )
THEN
10271 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn) + an(igs(mgs),jy,kgs(mgs),lccnuf)
10273 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
10274 IF ( lccna > 1 )
THEN
10275 cnuc(mgs) = ccnc(mgs)
10278 IF ( lcn_nu > 1 )
THEN
10279 ccnc_nu(mgs) = an(igs(mgs),jy,kgs(mgs),lcn_nu)
10281 IF ( lcn_co > 1 )
THEN
10282 ccnc_co(mgs) = an(igs(mgs),jy,kgs(mgs),lcn_co)
10284 IF ( lccnaco > 1 )
THEN
10285 ccnaco(mgs) = an(igs(mgs),jy,kgs(mgs),lccnaco)
10289 IF ( lccnanu > 1 )
THEN
10290 ccnanu(mgs) = an(igs(mgs),jy,kgs(mgs),lccnanu)
10294 ELSEIF ( lccn > 1 .and. ( ac_opt == 1 .or. ac_opt == 11 ) )
THEN
10295 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
10297 cnuc(mgs) = ccnc(mgs)
10298 cwnccn(mgs) = cnuc(mgs)
10300 ELSEIF ( lccn > 1 .and. ( ac_opt == 2 .or. ac_opt == 22 ) )
THEN
10301 ccnc_nu(mgs) = an(igs(mgs),jy,kgs(mgs),lcn_nu)
10302 ccnc(mgs) = an(igs(mgs),jy,kgs(mgs),lccn)
10304 ccnc_co(mgs) = an(igs(mgs),jy,kgs(mgs),lcn_co)
10306 ccnc(mgs) = cwnccn(mgs)
10308 IF ( lccnuf .gt. 1 .and. i_uf_or_ccn == 0 )
THEN
10309 ccncuf(mgs) = an(igs(mgs),jy,kgs(mgs),lccnuf)
10314 IF ( lccna > 1 )
THEN
10315 ccna(mgs) = an(igs(mgs),jy,kgs(mgs),lccna)
10316 IF ( ac_opt == 22 )
THEN
10317 IF ( lccnaco > 1 )
THEN
10318 ccnaco(mgs) = an(igs(mgs),jy,kgs(mgs),lccnaco)
10322 IF ( lccnanu > 1 )
THEN
10323 ccnanu(mgs) = an(igs(mgs),jy,kgs(mgs),lccnanu)
10329 IF ( lccn > 1 )
THEN
10332 ccna(mgs) = cx(mgs,lc)
10337 if ( ipconc .ge. 3 )
then
10339 cx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lnr), 0.0)
10346 IF ( irenuc /= 6 )
THEN
10347 IF ( irenuc == 2 )
THEN
10348 cnuc(mgs) = max(ccnc(mgs),cwnccn(mgs))*(1. - renucfrac) + ccnc(mgs)*renucfrac
10350 cnuc(mgs) = ccnc(mgs)*(1. - renucfrac) + ccnc(mgs)*renucfrac
10353 cnuc(mgs) = ccnc(mgs)*(1. - renucfrac) + max(0.0,ccnc(mgs) - ccna(mgs))*renucfrac
10355 IF ( renucfrac >= 0.999 )
THEN
10356 IF ( temg(mgs) < 265. )
THEN
10357 IF ( qx(mgs,lc) > 10.*qxmin(lc) .and. w(igs(mgs),jgs,kgs(mgs)) > 2.0 )
THEN
10360 cnuc(mgs) = 0.1*cnuc(mgs)
10368 if (ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Set density'
10371 xdn(mgs,lc) = xdn0(lc)
10372 xdn(mgs,lr) = xdn0(lr)
10376 ventrxn(:) = ventrn
10381 IF ( lzr > 1 .and. rcond == 2 )
THEN
10383 zx(mgs,lr) = max(an(igs(mgs),jy,kgs(mgs),lzr), 0.0)
10390 IF ( zx(mgs,il) <= zxmin )
THEN
10391 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
10394 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
10395 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
10396 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10397 ELSEIF ( cx(mgs,il) <= 0.0 )
THEN
10398 qx(mgs,lv) = qx(mgs,lv) + qx(mgs,il)
10401 an(igs(mgs),jgs,kgs(mgs),lv) = an(igs(mgs),jgs,kgs(mgs),lv) + an(igs(mgs),jgs,kgs(mgs),il)
10402 an(igs(mgs),jgs,kgs(mgs),il) = qx(mgs,il)
10403 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
10406 IF ( qx(mgs,lr) .gt. qxmin(lr) )
THEN
10408 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-11,cx(mgs,lr)))
10409 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
10410 xv(mgs,lr) = xvmx(lr)
10411 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
10412 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
10413 xv(mgs,lr) = xvmn(lr)
10414 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
10417 IF ( zx(mgs,il) > 0.0 .and. cx(mgs,il) <= 0.0 )
THEN
10419 IF ( imurain == 3 )
THEN
10420 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10423 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10425 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10426 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10429 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10433 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) > 0.0 )
THEN
10435 IF ( imurain == 3 )
THEN
10436 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10439 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
10441 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10442 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10445 zx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(chw*1000.*1000)
10449 ELSEIF ( zx(mgs,il) <= zxmin .and. cx(mgs,il) <= 0.0 )
THEN
10453 zx(mgs,il) = 1.e-19/0.224*(xdn0(lr)/xdn0(il))**2
10454 an(igs(mgs),jgs,kgs(mgs),lz(il)) = zx(mgs,il)
10456 IF ( imurain == 3 )
THEN
10457 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10460 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/(z1*1000.*1000)
10461 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10462 ELSEIF ( imurain == 1 )
THEN
10463 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10464 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
10467 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(6*qr)**2/(z1*(pi*xdn(mgs,il))**2)
10468 an(igs(mgs),jgs,kgs(mgs),ln(il)) = cx(mgs,il)
10473 IF ( zx(mgs,lr) > 0.0 )
THEN
10474 vr = rho0(mgs)*qx(mgs,lr)/(1000.*cx(mgs,lr))
10485 IF ( z1 .gt. 0.0 )
THEN
10487 IF ( imurain == 3 )
THEN
10488 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
10491 IF ( abs(alp - alpha(mgs,lr)) .lt. 0.01 )
EXIT
10492 alpha(mgs,lr) = max( rnumin, min( rnumax, alp ) )
10493 alp = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/(z1*pi**2) - 1.
10495 alp = max( rnumin, min( rnumax, alp ) )
10499 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10500 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
10502 rd1 = z1*(pi/6.*xdn(mgs,il))**2*nrx/(rho0(mgs)*qr)**2
10504 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
10505 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
10508 IF ( abs(alp - alpha(mgs,il)) .lt. 0.01 )
EXIT
10509 alpha(mgs,il) = max( alphamin, min( alphamax, alp ) )
10511 alp = (6.+alpha(mgs,il))*(5.0+alpha(mgs,il))*(4.0+alpha(mgs,il))/ &
10512 & ((3.0+alpha(mgs,il))*(2.0+alpha(mgs,il))*rd1) - 1.0
10514 alp = max( alphamin, min( alphamax, alp ) )
10525 IF ( imurain == 3 )
THEN
10526 IF ( .true. .and. (alpha(mgs,il) <= rnumin .or. alp == rnumin .or. alp == rnumax) )
THEN
10528 IF ( rescale_high_alpha .and. alp >= rnumax - 0.01 )
THEN
10529 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
10530 cx(mgs,il) = g1*dn(igs(mgs),jy,kgs(mgs))**2*(qr)*qr/z1*(1./(xdn(mgs,il)))**2
10531 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
10533 ELSEIF ( rescale_low_alphar .and. alp <= rnumin )
THEN
10535 z1 = 36.*(alpha(mgs,lr)+2.0)*nrx*vr**2/((alpha(mgs,lr)+1.0)*pi**2)
10540 ELSEIF ( imurain == 1 )
THEN
10542 g1 = (6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
10543 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il)))
10545 IF ( (rescale_low_alpha .or. rescale_high_alpha ) .and. &
10546 & ( alpha(mgs,il) <= alphamin .or. alp == alphamin .or. alp == alphamax ) )
THEN
10550 IF ( rescale_high_alpha .and. alp >= alphamax - 0.01 )
THEN
10551 cx(mgs,il) = g1*rho0(mgs)**2*(qr)*qr/zx(mgs,lr)*(6./(pi*xdn(mgs,il)))**2
10552 an(igs(mgs),jy,kgs(mgs),ln(il)) = cx(mgs,il)
10554 ELSEIF ( rescale_low_alpha .and. alp <= alphamin )
THEN
10555 z1 = g1*rho0(mgs)**2*(qr)*qr/nrx
10556 z2 = z1*(6./(pi*xdn(mgs,il)))**2
10558 an(igs(mgs),jy,kgs(mgs),lz(il)) = z2
10564 tmp = alpha(mgs,lr) + 4./3.
10565 i = int(dgami*(tmp))
10567 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10569 tmp = alpha(mgs,lr) + 1.
10570 i = int(dgami*(tmp))
10572 y = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10575 ventrx(mgs) = x/(y*(alpha(mgs,lr) + 1.)**(1./3.))
10577 IF ( imurain == 3 .and. izwisventr == 2 )
THEN
10579 tmp = alpha(mgs,lr) + 1.5 + br/6.
10580 i = int(dgami*(tmp))
10582 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10585 ventrxn(mgs) = x/(y*(alpha(mgs,lr) + 1.)**((1.+br)/6. + 1./3.))
10587 ELSEIF ( imurain == 1 .and. iferwisventr == 2 )
THEN
10589 tmp = alpha(mgs,lr) + 2.5 + br/2.
10590 i = int(dgami*(tmp))
10592 x = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10615 kp1 = min(nz, kgs(mgs)+1 )
10616 wvel(mgs) = (0.5)*(w(igs(mgs),jgs,kp1) &
10617 & +w(igs(mgs),jgs,kgs(mgs)))
10618 wvelkm1(mgs) = (0.5)*(w(igs(mgs),jgs,kgs(mgs)) &
10619 & +w(igs(mgs),jgs,max(1,kgs(mgs)-1)))
10621 ssat0(mgs) = ssfilt(igs(mgs),jgs,kgs(mgs))
10622 ssf(mgs) = ssfilt(igs(mgs),jgs,kgs(mgs))
10626 ssfkp1(mgs) = ssfilt(igs(mgs),jgs,min(nz-1,kgs(mgs)+1))
10627 ssfkm1(mgs) = ssfilt(igs(mgs),jgs,max(1,kgs(mgs)-1))
10640 if ( ndebug .gt. 0 )
write(0,*)
'ICEZVD_DR: Set cloud water variables'
10644 IF ( ipconc .ge. 2 .and. cx(mgs,lc) .gt. 1.0e6 )
THEN
10646 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
10647 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
10649 IF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .gt. cxmin )
THEN
10651 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),xdn(mgs,lc)*xvmn(lc)), &
10652 & xdn(mgs,lc)*xvmx(lc) )
10654 cx(mgs,lc) = qx(mgs,lc)*rho0(mgs)/xmas(mgs,lc)
10656 ELSEIF ( qx(mgs,lc) .gt. qxmin(lc) .and. cx(mgs,lc) .le. cxmin )
THEN
10659 cx(mgs,lc) = max( cxmin, rho0(mgs)*qx(mgs,lc)/cwmasx )
10661 & min( max(qx(mgs,lc)*rho0(mgs)/cx(mgs,lc),cwmasn),cwmasx )
10662 xv(mgs,lc) = xmas(mgs,lc)/xdn(mgs,lc)
10665 xmas(mgs,lc) = cwmasn
10668 xdia(mgs,lc,1) = (xmas(mgs,lc)*cwc1)**c1f3
10676 if ( qx(mgs,lr) .gt. qxmin(lr) )
then
10678 if ( ipconc .ge. 3 )
then
10679 xv(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*max(1.0e-9,cx(mgs,lr)))
10681 IF ( xv(mgs,lr) .gt. xvmx(lr) )
THEN
10682 xv(mgs,lr) = xvmx(lr)
10683 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmx(lr)*xdn(mgs,lr))
10684 ELSEIF ( xv(mgs,lr) .lt. xvmn(lr) )
THEN
10685 xv(mgs,lr) = xvmn(lr)
10686 cx(mgs,lr) = rho0(mgs)*qx(mgs,lr)/(xvmn(lr)*xdn(mgs,lr))
10689 xmas(mgs,lr) = xv(mgs,lr)*xdn(mgs,lr)
10690 xdia(mgs,lr,3) = (xmas(mgs,lr)*cwc1)**(1./3.)
10691 IF ( imurain == 3 )
THEN
10693 xdia(mgs,lr,1) = xdia(mgs,lr,3)
10695 xdia(mgs,lr,1) = (6.*piinv*xv(mgs,lr)/((alpha(mgs,lr)+3.)*(alpha(mgs,lr)+2.)*(alpha(mgs,lr)+1.)))**(1./3.)
10705 & (qx(mgs,lr)*rho0(mgs)/(pi*xdn(mgs,lr)*cno(lr)))**(0.25)
10708 xdia(mgs,lr,1) = 1.e-9
10721 fadvisc(mgs) = advisc0*(416.16/(temg(mgs)+120.0))* &
10722 & (temg(mgs)/296.0)**(1.5)
10724 fakvisc(mgs) = fadvisc(mgs)*rhoinv(mgs)
10726 fwvdf(mgs) = (2.11e-05)*((temg(mgs)/tfr)**1.94)* &
10727 & (101325.0/(pres(mgs)))
10729 fschm(mgs) = (fakvisc(mgs)/fwvdf(mgs))
10731 fvent(mgs) = (fschm(mgs)**(1./3.)) * (fakvisc(mgs)**(-0.5))
10746 IF ( temg(mgs) .le. tfrh .and. qx(mgs,lv)/qvs(mgs) < maxlowtempss )
THEN
10750 IF( ssat0(mgs) .GT. 0. .OR. ssf(mgs) .GT. 0. )
GO TO 620
10756 IF ( qx(mgs,lc) .LE. 0. )
GO TO 631
10759 r1=1./(1. + caw*(273.15 - cbw)*qss(mgs)*felv(mgs)/ &
10760 & (cp*(temg(mgs) - cbw)**2))
10761 qevap= min( qx(mgs,lc), r1*(qss(mgs)-qvap(mgs)) )
10764 IF ( qx(mgs,lc) <= qevap )
THEN
10765 qwvp(mgs) = qwvp(mgs) + qx(mgs,lc)
10766 thetap(mgs) = thetap(mgs) - felvcp(mgs)*qx(mgs,lc)/(pi0(mgs))
10767 IF ( io_flag .and. nxtra > 1 )
THEN
10768 axtra(igs(mgs),jy,kgs(mgs),1) = -qx(mgs,lc)/dtp
10771 IF ( restoreccn )
THEN
10772 IF ( lccna > 1 )
THEN
10773 tmp = restoreccnfrac*cx(mgs,lc)
10774 IF ( lccnaco > 1 .and. lccnanu > 1 )
THEN
10776 tmp2 = ccna(mgs) + ccnaco(mgs) + ccnanu(mgs)
10777 IF ( tmp2 > 0.0 )
THEN
10778 ccna(mgs) = ccna(mgs) - tmp*ccna(mgs)/tmp2
10779 ccnaco(mgs) = ccnaco(mgs) - tmp*ccnaco(mgs)/tmp2
10780 ccnanu(mgs) = ccnanu(mgs) - tmp*ccnanu(mgs)/tmp2
10783 ccna(mgs) = ccna(mgs) - tmp
10785 ELSEIF ( irenuc <= 2 )
THEN
10786 IF ( .not. invertccn )
THEN
10787 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
10789 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
10796 qwvp(mgs) = qwvp(mgs) + qevap
10797 qx(mgs,lc) = qx(mgs,lc) - qevap
10798 IF ( qx(mgs,lc) .le. 0. )
THEN
10799 IF ( restoreccn )
THEN
10800 IF ( lccna > 1 )
THEN
10801 tmp = restoreccnfrac*cx(mgs,lc)
10802 IF ( lccnaco > 1 .and. lccnanu > 1 )
THEN
10804 tmp2 = ccna(mgs) + ccnaco(mgs) + ccnanu(mgs)
10805 IF ( tmp2 > 0.0 )
THEN
10806 ccna(mgs) = ccna(mgs) - tmp*ccna(mgs)/tmp2
10807 ccnaco(mgs) = ccnaco(mgs) - tmp*ccnaco(mgs)/tmp2
10808 ccnanu(mgs) = ccnanu(mgs) - tmp*ccnanu(mgs)/tmp2
10811 ccna(mgs) = ccna(mgs) - tmp
10813 ELSEIF ( irenuc <= 2 )
THEN
10816 IF ( .not. invertccn )
THEN
10817 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*cx(mgs,lc) ) )
10819 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*cx(mgs,lc)
10825 tmp = 0.9*qevap*cx(mgs,lc)/qctmp
10826 IF ( restoreccn )
THEN
10827 IF ( lccna > 1 )
THEN
10828 tmp = restoreccnfrac*tmp
10829 IF ( lccnaco > 1 .and. lccnanu > 1 )
THEN
10831 tmp2 = ccna(mgs) + ccnaco(mgs) + ccnanu(mgs)
10832 IF ( tmp2 > 0.0 )
THEN
10833 ccna(mgs) = ccna(mgs) - tmp*ccna(mgs)/tmp2
10834 ccnaco(mgs) = ccnaco(mgs) - tmp*ccnaco(mgs)/tmp2
10835 ccnanu(mgs) = ccnanu(mgs) - tmp*ccnanu(mgs)/tmp2
10838 ccna(mgs) = ccna(mgs) - tmp
10841 ELSEIF ( irenuc <= 2 )
THEN
10844 IF ( .not. invertccn )
THEN
10845 ccnc(mgs) = max( ccnc(mgs), min( qccn*rho0(mgs), ccnc(mgs) + restoreccnfrac*tmp ) )
10847 ccnc(mgs) = ccnc(mgs) + restoreccnfrac*tmp
10851 cx(mgs,lc) = cx(mgs,lc) - tmp
10853 thetap(mgs) = thetap(mgs) - felvcp(mgs)*qevap/(pi0(mgs))
10854 IF ( io_flag .and. nxtra > 1 )
THEN
10855 axtra(igs(mgs),jy,kgs(mgs),1) = -qevap/dtp
10867 IF ( qx(mgs,lc) .GT. qxmin(lc) .and. cx(mgs,lc) .ge. 1. )
THEN
10874 ac1 = felv(mgs)**2/(tka(mgs)*rw*temg(mgs)**2)
10880 bc = rw*temg(mgs)/(wvdf(mgs)*es(mgs))
10889 IF ( ssf(mgs) .gt. 0.0 .or. ssat0(mgs) .gt. 0.0 )
THEN
10890 IF ( ny .le. 2 )
THEN
10897 IF ( qx(mgs,lc) .gt. qxmin(lc) )
THEN
10899 IF ( xdia(mgs,lc,1) .le. 0.0 )
THEN
10900 xmas(mgs,lc) = cwmasn
10901 xdia(mgs,lc,1) = (xmas(mgs,lc)*cwc1)**c1f3
10903 d1 = (1./(ac1 + bc))*4.0*pi*ventc &
10904 & *0.5*xdia(mgs,lc,1)*cx(mgs,lc)*rhoinv(mgs)
10910 IF ( rcond .eq. 2 .and. qx(mgs,lr) .gt. qxmin(lr) .and. cx(mgs,lr) > 1.e-9 )
THEN
10911 IF ( imurain == 3 )
THEN
10912 IF ( izwisventr == 1 )
THEN
10913 rwvent(mgs) = ventrx(mgs)*(1.6 + 124.9*(1.e-3*rho0(mgs)*qx(mgs,lr))**.2046)
10917 & (0.78*ventrx(mgs) + 0.308*ventrxn(mgs)*fvent(mgs) &
10918 & *sqrt((ar*rhovt(mgs))) &
10919 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
10924 IF ( iferwisventr == 1 )
THEN
10925 alpr = min(alpharmax,alpha(mgs,lr) )
10930 i = int(dgami*(tmp))
10932 g1palp = gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami
10934 tmp = 2.5 + alpr + 0.5*bx(lr)
10935 i = int(dgami*(tmp))
10937 y = (gmoi(i) + (gmoi(i+1) - gmoi(i))*del*dgami)/g1palp
10941 vent1 = dble(xdia(mgs,lr,1))**(0.5 + 0.5*bx(lr))
10942 vent2 = dble(1. + 0.5*fx(lr)*xdia(mgs,lr,1))**dble(2.5+alpr+0.5*bx(lr))
10947 & 0.308*fvent(mgs)*y* &
10948 & sqrt(ax(lr)*rhovt(mgs))*(vent1/vent2)
10950 ELSEIF ( iferwisventr == 2 )
THEN
10953 x = 1. + alpha(mgs,lr)
10956 & (0.78*x + 0.308*ventrxn(mgs)*fvent(mgs) &
10957 & *sqrt((ar*rhovt(mgs))) &
10958 & *(xdia(mgs,lr,1)**((1.0+br)/2.0)) )
10965 d1r = (1./(ac1 + bc))*4.0*pi*rwvent(mgs) &
10966 & *0.5*xdia(mgs,lr,1)*cx(mgs,lr)*rhoinv(mgs)
10972 e1 = felvcp(mgs)/(pi0(mgs))
10978 ltemq = (temg(mgs)-163.15)/fqsat+1.5
10979 ltemq = min( nqsat, max(1,ltemq) )
10982 IF ( iqvsopt == 0 )
THEN
10983 p380 = 380.0/pres(mgs)
10985 p380 = esbolton*rdorv/(pres(mgs) - es(mgs))
10991 ss1 = qx(mgs,lv)/qvs(mgs)
11008 IF ( abs(ss1 - 1.0) .gt. 1.e-5 )
THEN
11009 delta = 0.5*(qv1-qvs1)/(d1*(ss1 - 1.0))
11016 dtcon1 = min(0.05,0.2*delta)
11017 nc = max(5,2*nint( (dtp-4.0*dtcon1)/delta))
11018 dtcon2 = (dtp-4.0*dtcon1)/nc
11030 rk2c:
DO WHILE ( dt1 .lt. dtp )
11032 IF ( n .le. 4 )
THEN
11037 609 dqv = -(ss1 - 1.)*d1*dtcon
11038 dqvr = -(ss1 - 1.)*d1r*dtcon
11039 dtemp = -0.5*e1*f1*(dqv + dqvr)
11045 ltemq1m = (temp1+dtemp-163.15)*fqsati+1.5
11046 ltemq1m = min( nqsat, max(1,ltemq1m) )
11048 IF ( ltemq1m .lt. 1 .or. ltemq1m .gt. nqsat )
THEN
11049 write(0,*)
'STOP in nucond line 1192 '
11050 write(0,*)
' ltemq1m,icond = ',ltemq1m,icond
11051 write(0,*)
' dtemp,e1,f1,dqv,dqvr = ', dtemp,e1,f1,dqv,dqvr
11052 write(0,*)
' d1,d1r,dtcon,ss1 = ',d1,d1r,dtcon,ss1
11053 write(0,*)
' dqc, dqr = ',dqc,dqr
11054 write(0,*)
' qv,qc,qr = ',qx(mgs,lv)*1000.,qx(mgs,lc)*1000.,qx(mgs,lr)*1000.
11055 write(0,*)
' i, j, k = ',igs(mgs),jy,kgs(mgs)
11056 write(0,*)
' dtcon1,dtcon2,delta = ',dtcon1,dtcon2,delta
11057 write(0,*)
' nc,dtp = ',nc,dtp
11058 write(0,*)
' rwvent,xdia,crw,ccw = ', rwvent(mgs),xdia(mgs,lr,1),cx(mgs,lr),cx(mgs,lc)
11059 write(0,*)
' fvent,alphar = ',fvent(mgs),alpha(mgs,lr)
11060 write(0,*)
' xvr,xmasr,xdnr,cwc1 = ',xv(mgs,lr),xmas(mgs,lr),xdn(mgs,lr),cwc1
11062 dqvs = dtemp*p380*dtabqvs(ltemq1m)
11063 qv1m = qv1 + dqv + dqvr
11066 qvs1m = qvs1 + dqvs
11070 IF ( ss1m .lt. 1. .and. (dqvii + dqvis) .eq. 0.0 )
THEN
11071 dtcon = (0.5*dtcon)
11072 IF ( dtcon .ge. dtcon1 )
THEN
11079 dqv = -(ss1m - 1.)*d1*dtcon
11080 dqvr = -(ss1m - 1.)*d1r*dtcon
11084 dtemp = -e1*f1*(dqv + dqvr)
11089 ltemq1 = (temp1+dtemp-163.15)*fqsati+1.5
11090 ltemq1 = min( nqsat, max(1,ltemq1) )
11092 IF ( ltemq1 .lt. 1 .or. ltemq1 .gt. nqsat )
THEN
11093 write(0,*)
'STOP in nucond line 1230 '
11094 write(0,*)
' ltemq1m,icond = ',ltemq1m,icond
11095 write(0,*)
' dtemp,e1,dqv,dqvr = ', dtemp,e1,dqv,dqvr
11097 dqvs = dtemp*p380*dtabqvs(ltemq1)
11099 qv1 = qv1 + dqv + dqvr
11106 temp1 = temp1 + dtemp
11107 IF ( temp2 .eq. temp1 .or. ss2 .eq. ss1 .or. &
11108 & ss1 .eq. 1.00 .or. &
11109 & ( n .gt. 10 .and. ss1 .lt. 1.0005 ) )
THEN
11122 thetap(mgs) = thetap(mgs) + e1*(dcloud + dqr)
11125 IF ( eqtset > 2 )
THEN
11126 pipert(mgs) = pipert(mgs) + felvpi(mgs)*(dcloud + dqr)
11128 IF ( io_flag .and. nxtra > 1 )
THEN
11129 axtra(igs(mgs),jy,kgs(mgs),1) = dcloud/dtp
11130 axtra(igs(mgs),jy,kgs(mgs),2) = axtra(igs(mgs),jy,kgs(mgs),2) + dqr/dtp
11132 qwvp(mgs) = qwvp(mgs) - (dcloud + dqr)
11133 qx(mgs,lc) = qx(mgs,lc) + dcloud
11134 qx(mgs,lr) = qx(mgs,lr) + dqr
11139 IF ( lzr > 1 .and. rcond == 2 .and. qx(mgs,lr) .gt. qxmin(lr) &
11140 & .and. cx(mgs,lr) .gt. 1.e-9 )
THEN
11141 tmp = qx(mgs,lr)/cx(mgs,lr)
11142 IF ( imurain == 3 )
THEN
11143 g1 = 36.*(alpha(mgs,lr)+2.0)/((alpha(mgs,lr)+1.0)*pi**2)
11145 g1 = 36.*(6.0 + alpha(mgs,il))*(5.0 + alpha(mgs,il))*(4.0 + alpha(mgs,il))/ &
11146 & ((3.0 + alpha(mgs,il))*(2.0 + alpha(mgs,il))*(1.0 + alpha(mgs,il))*pi**2)
11149 zx(mgs,lr) = zx(mgs,lr) + g1*(rho0(mgs)/(xdn(mgs,lr)))**2*( 2.*( tmp ) * dqr )
11152 theta(mgs) = thetap(mgs) + theta0(mgs)
11153 temg(mgs) = theta(mgs)*f1
11154 ltemq = (temg(mgs)-163.15)/fqsat+1.5
11155 ltemq = min( nqsat, max(1,ltemq) )
11156 IF ( iqvsopt == 0 )
THEN
11157 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
11158 ELSEIF ( iqvsopt == 1 )
THEN
11159 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
11171 IF ( ssf(mgs) .gt. 0.0 )
THEN
11173 IF ( iqcinit == 1 )
THEN
11175 qvs0 = 380.*exp(17.27*(temg(mgs)-273.)/(temg(mgs)- 36.))/pk(mgs)
11177 dcloud = max(0.0, (qx(mgs,lv)-qvs0) / (1.+qvs0*f5/(temg(mgs)-36.)**2) )
11179 ELSEIF ( iqcinit == 3 )
THEN
11180 r1=1./(1. + caw*(273.15 - cbw)*qss(mgs)*felvcp(mgs)/ &
11181 & ((temg(mgs) - cbw)**2))
11182 dcloud=r1*(qvap(mgs) - qvs(mgs))
11185 ELSEIF ( iqcinit == 2 )
THEN
11197 IF ( ssf(mgs) > ssmx .and. ssf(mgs) < 20.0 .and. &
11198 ( ccnc(mgs) > 0.05*cwnccn(mgs) .or. ( ac_opt > 0 .and. ccnc(mgs) - cx(mgs,lc) > 0.0 ) ) )
THEN
11200 CALL qvexcess(ngs,mgs,qwvp,qv0,qx(1,lc),pres,thetap,theta0,dcloud, &
11201 & pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ssmx,pk,ngscnt)
11210 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11211 qwvp(mgs) = qwvp(mgs) - dcloud
11212 qx(mgs,lc) = qx(mgs,lc) + dcloud
11213 IF ( io_flag .and. nxtra > 1 )
THEN
11214 axtra(igs(mgs),jy,kgs(mgs),1) = dcloud/dtp
11216 theta(mgs) = thetap(mgs) + theta0(mgs)
11217 temg(mgs) = theta(mgs)*pk(mgs)
11219 ltemq = (temg(mgs)-163.15)/fqsat+1.5
11220 ltemq = min( nqsat, max(1,ltemq) )
11222 IF ( iqvsopt == 0 )
THEN
11223 qvs(mgs) = pqs(mgs)*tabqvs(ltemq)
11224 ELSEIF ( iqvsopt == 1 )
THEN
11225 qvs(mgs) = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
11233 IF ( ncdebug .ge. 1 )
THEN
11234 write(iunit,*)
'at 613: ',qx(mgs,lc),cx(mgs,lc),wvel(mgs),ssmax(mgs),kgs(mgs)
11237 IF ( .not. flag_qndrop )
THEN
11240 cnuctmp = cnuc(mgs)
11246 IF ( dcloud .gt. qxmin(lc) .and. wvel(mgs) > 0.0)
THEN
11248 cn(mgs) = ccne0*cnuctmp**(2./(2.+cck))*wvel(mgs)**cnexp
11249 IF ( ny .le. 2 .and. cn(mgs) .gt. 0.0 &
11250 & .and. ncdebug .ge. 1 )
THEN
11251 write(iunit,*)
'CN: ',cn(mgs)*1.e-6, cx(mgs,lc)*1.e-6, qx(mgs,lc)*1.e3, &
11252 & wvel(mgs), dcloud*1.e3
11253 IF ( cn(mgs) .gt. 1.0 )
write(iunit,*)
'cwrad = ', &
11254 & 1.e6*(rho0(mgs)*qx(mgs,lc)/cn(mgs)*cwc1)**c1f3, &
11255 & igs(mgs),kgs(mgs),temcg(mgs), &
11256 & 1.e3*an(igs(mgs),jgs,kgs(mgs)-1,lc)
11258 IF ( iccwflg .eq. 1 )
THEN
11259 cn(mgs) = min(cwccn*rho0(mgs)/rho00, max(cn(mgs), &
11260 & rho0(mgs)*qx(mgs,lc)/(xdn(mgs,lc)*(4.*pi/3.)*(4.e-6)**3)))
11269 IF ( cn(mgs) .gt. 0.0 )
THEN
11270 IF ( ac_opt == 0 )
THEN
11271 IF ( cn(mgs) .gt. ccnc(mgs) )
THEN
11272 cn(mgs) = ccnc(mgs)
11276 cn(mgs) = min( cn(mgs), ccnc(mgs) )
11279 IF ( irenuc <= 2 .and. lccna < 1 ) ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11280 ccna(mgs) = ccna(mgs) + cn(mgs)
11285 IF( cn(mgs) .GT. cx(mgs,lc) ) cx(mgs,lc) = cn(mgs)
11286 IF( cx(mgs,lc) .GT. 0. .AND. qx(mgs,lc) .le. qxmin(lc) )
THEN
11289 cx(mgs,lc) = min(cx(mgs,lc),rho0(mgs)*max(0.0,qx(mgs,lc))/cwmasn)
11305 IF ( wvel(mgs) .le. 0. )
GO TO 616
11306 IF ( cx(mgs,lc) .le. 0. )
GO TO 613
11307 IF ( kzbeg-1+kgs(mgs) .GT. 1 .and. qx(mgs,lc) .le. qxmin(lc))
GO TO 613
11308 IF ( kzbeg-1+kgs(mgs) .eq. 1 .and. wvel(mgs) .gt. 0. )
GO TO 613
11310 616
IF ( ssf(mgs) .LE. supcb .AND. wvel(mgs) .GT. 0. )
GO TO 631
11311 IF ( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 .AND. &
11312 & (ssfkp1(mgs) .GE. supmx .OR. &
11313 & ssf(mgs) .GE. supmx .OR. &
11314 & ssfkm1(mgs) .GE. supmx))
GO TO 631
11315 IF (ssf(mgs) .LT. 1.e-10 .OR. ssf(mgs) .GE. supmx)
GO TO 631
11321 if (ndebug .gt. 0)
write(0,*)
"ICEZVD_DR: Entered Ziegler Cloud Nucleation"
11324 r2dzm=0.50/dz3d(igs(mgs),jy,kgs(mgs))
11326 IF ( irenuc >= 0 .and. ac_opt == 0 .and. .not. flag_qndrop )
THEN
11328 IF ( irenuc < 2 )
THEN
11330 IF ( kzend == nzend )
THEN
11331 t0p3 = t0(igs(mgs),jgs,min(kze,kgs(mgs)+3))
11332 t0p1 = t0(igs(mgs),jgs,min(kze,kgs(mgs)+1))
11334 t0p3 = t0(igs(mgs),jgs,kgs(mgs)+3)
11335 t0p1 = t0(igs(mgs),jgs,kgs(mgs)+1)
11338 IF ( ( ssf(mgs) .gt. ssmax(mgs) .or. irenuc .eq. 1 ) &
11339 & .and. ( ( lccn .lt. 1 .and. &
11340 & cx(mgs,lc) .lt. cwccn*(min(1.0,rho0(mgs)))) .or. &
11341 & ( lccn .gt. 1 .and. ccnc(mgs) .gt. 0. ) ) &
11343 IF( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 &
11344 & .and. ssf(mgs) .gt. 0.0 &
11345 & .and. ssfkp1(mgs) .LT. supmx .and. ssfkp1(mgs) .ge. 0.0 &
11346 & .AND. ssfkm1(mgs) .LT. supmx .AND. ssfkm1(mgs) .ge. 0.0 &
11347 & .AND. ssfkp1(mgs) .gt. ssfkm1(mgs) &
11348 & .and. t0p3 .gt. 233.2)
THEN
11349 dssdz = (ssfkp1(mgs) - ssfkm1(mgs))*r2dzm
11353 ELSEIF( kzbeg-1+kgs(mgs) .GT. 1 .AND. kzbeg-1+kgs(mgs) .LT. nzend-1 &
11355 & .and. ssf(mgs) .gt. 0.0 .and. wvel(mgs) .gt. 0.0 &
11356 & .and. ssfkp1(mgs) .gt. 0.0 &
11357 & .AND. ssfkm1(mgs) .le. 0.0 .and. wvelkm1(mgs) .gt. 0.0 &
11358 & .AND. ssf(mgs) .gt. ssfkm1(mgs) &
11359 & .and. t0p1 .gt. 233.2)
THEN
11360 dssdz = 2.*(ssf(mgs) - ssfkm1(mgs))*r2dzm
11367 c1 = max(0.0, rho0(mgs)*(qx(mgs,lv) - qss(mgs))/ &
11368 & (xdn(mgs,lc)*(4.*pi/3.)*(4.e-6)**3))
11369 IF ( lccn .lt. 1 )
THEN
11370 cn(mgs) = cwccn*rho0(mgs)/rho00*cck*ssf(mgs)**cckm*dtp* &
11372 & (wvel(mgs)*dssdz) )
11375 & min(ccnc(mgs), cnuc(mgs)*cck*ssf(mgs)**cckm*dtp* &
11377 & ( wvel(mgs)*dssdz) ) )
11381 IF ( cn(mgs) .gt. 0.0 )
THEN
11382 IF ( ccnc(mgs) .lt. 5.e7 .and. cn(mgs) .ge. 5.e7 )
THEN
11385 ELSEIF ( cn(mgs) .gt. ccnc(mgs) )
THEN
11386 cn(mgs) = ccnc(mgs)
11389 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11390 ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11393 ELSEIF ( irenuc == 2 )
THEN
11396 cn(mgs) = ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp
11401 cn(mgs) = min(cn(mgs), ccnc(mgs))
11402 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11403 cn(mgs) = min( cn(mgs), max(0.0, (cnuc(mgs) - ccna(mgs) )) )
11405 IF ( .false. .and. ny <= 2 )
THEN
11406 write(0,*)
'i,k, cwmasn = ',igs(mgs),kgs(mgs),cwmasn
11407 write(0,*)
'wvel, cnuc, cn = ',wvel(mgs),cnuc(mgs),cn(mgs)
11408 write(0,*)
'ccne0,cnexp,cck = ',ccne0,cnexp,cck
11409 write(0,*)
'part1, part2 = ',ccne0*cnuc(mgs)**(2./(2.+cck)), max(0.0,wvel(mgs))**cnexp
11410 write(0,*)
'ccnc, dqc, dqc/cwmasn = ',ccnc(mgs), dqc, 0.5*dqc/cwmasn
11413 IF ( icnuclimit > 0 )
THEN
11414 tmp = ccnc(mgs) + cx(mgs,lc)
11415 IF ( tmp < 330.34e6 )
THEN
11416 ccwmax = 1.1173e6 * (1.e-6*tmp)**0.9504
11418 ccwmax = 21.57e6 * (1.e-6*tmp)**0.44
11425 cn(mgs) = max( 0.0, min( cn(mgs), ccwmax - cx(mgs,lc) ) )
11429 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11431 IF ( lccna < 1 ) ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11433 ELSEIF ( irenuc == 3 )
THEN
11439 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11440 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11441 ltemq = min( nqsat, max(1,ltemq) )
11443 c1= pqs(mgs)*tabqvs(ltemq)
11446 IF ( c1 > 0. )
THEN
11447 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11449 cn(mgs) = cnuc(mgs)*min(1.0, (ssf(mgs))**cck )
11451 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11454 cn(mgs) = min(cn(mgs), ccnc(mgs))
11455 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11457 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11461 ccnc(mgs) = max(0.0, ccnc(mgs) - cn(mgs))
11463 ELSEIF ( irenuc == 4 )
THEN
11469 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11470 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11471 ltemq = min( nqsat, max(1,ltemq) )
11473 c1= pqs(mgs)*tabqvs(ltemq)
11474 IF ( c1 > 0. )
THEN
11475 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11479 cn(mgs) = cnuc(mgs)*min(ssf2kmax, ssf(mgs)**cck)
11481 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11485 cn(mgs) = min(cn(mgs), 0.5*dqc/cwmasn)
11487 IF ( cn(mgs) > 0.0 )
THEN
11488 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11493 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11494 qx(mgs,lc) = qx(mgs,lc) + dcloud
11495 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11496 qwvp(mgs) = qwvp(mgs) - dcloud
11504 ELSEIF ( irenuc == 6 )
THEN
11510 IF ( ccna(mgs) < 0.7*cnuc(mgs) )
THEN
11511 cn(mgs) = min( 0.9*cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11514 cn(mgs) = min( cn(mgs), max(0.0, (0.7*cnuc(mgs) - ccna(mgs) )) )
11520 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11522 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11523 ltemq = min( nqsat, max(1,ltemq) )
11526 c1= pqs(mgs)*tabqvs(ltemq)
11527 IF ( c1 > 0. )
THEN
11528 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11534 cn(mgs) = cnuc(mgs)*min(2.0, max(0.0,ssf(mgs))**cck )
11538 cn(mgs) = min(0.01*cnuc(mgs), max( 0.0, cn(mgs) - ccna(mgs) ) )
11548 IF ( cn(mgs) > 0.0 )
THEN
11549 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11555 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11556 qx(mgs,lc) = qx(mgs,lc) + dcloud
11557 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11558 qwvp(mgs) = qwvp(mgs) - dcloud
11561 ELSEIF ( irenuc == 5 )
THEN
11566 cn(mgs) = min( cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11569 IF ( ccna(mgs) >= cnuc(mgs) )
THEN
11570 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11571 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11572 ltemq = min( nqsat, max(1,ltemq) )
11574 IF ( iqvsopt == 0 )
THEN
11575 c1 = pqs(mgs)*tabqvs(ltemq)
11576 ELSEIF ( iqvsopt == 1 )
THEN
11577 c1 = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
11579 IF ( c1 > 0. )
THEN
11580 ssf(mgs) = max(0.0, 100.*((qv0(mgs) + qwvp(mgs))/c1 - 1.0) )
11586 cn(mgs) = max( cn(mgs), cnuc(mgs)*min(ssf2kmax, ssf(mgs)**cck) )
11591 cn(mgs) = max( 0.0, cn(mgs) - ccna(mgs) )
11594 cn(mgs) = min( cn(mgs), cnuc(mgs) - ccna(mgs) )
11601 dcloud = 1000.*dcrit**3*pi/6.
11605 tmp = max(0.0, rho0(mgs)*qx(mgs,lc)/dcloud - cx(mgs,lc))
11606 cn(mgs) = min(tmp, cn(mgs) )
11609 IF ( cn(mgs) > 0.0 )
THEN
11610 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11614 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11615 qx(mgs,lc) = qx(mgs,lc) + dcloud
11616 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11617 qwvp(mgs) = qwvp(mgs) - dcloud
11622 ELSEIF ( irenuc == 7 .or. irenuc == 17 )
THEN
11627 IF ( irenuc == 7 )
THEN
11633 IF ( ccna(mgs) < frac*cnuc(mgs) )
THEN
11634 cn(mgs) = min( (frac+0.01)*cnuc(mgs), ccne0*cnuc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11637 cn(mgs) = min( cn(mgs), max(0.0, (frac*cnuc(mgs) - ccna(mgs) )) )
11650 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11652 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11653 ltemq = min( nqsat, max(1,ltemq) )
11656 IF ( iqvsopt == 0 )
THEN
11657 c1 = pqs(mgs)*tabqvs(ltemq)
11658 ELSEIF ( iqvsopt == 1 )
THEN
11659 c1 = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
11663 IF ( c1 > 0. )
THEN
11664 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11668 IF ( ssf(mgs) <= 1.0 )
THEN
11669 cn(mgs) = cnuc(mgs)*min(1.0, max(0.0,ssf(mgs))**cck )
11671 cn(mgs) = cnuc(mgs)*min(2.0, max(0.0,0.03*(ssf(mgs)-1.0)+1.)**cck )
11679 IF ( ccncuf(mgs) > 0.0 .and. ssf(mgs) > ssmxuf .and. ( ssmax(mgs) > ssmxuf .or. lss < 1 ) )
THEN
11680 cnuf(mgs) = min( ccncuf(mgs), ccne0*ccncuf(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp )
11688 cn(mgs) = min(0.01*cnuc(mgs), max( 0.0, cn(mgs) - ccna(mgs) ) )
11699 IF ( icnuclimit > 0 )
THEN
11701 tmp = ccnc(mgs) - ccna(mgs) + cx(mgs,lc)
11702 IF ( tmp < 330.34e6 )
THEN
11703 ccwmax = 1.1173e6 * (1.e-6*tmp)**0.9504
11705 ccwmax = 21.57e6 * (1.e-6*tmp)**0.44
11708 cn(mgs) = max( 0.0, min( cn(mgs), ccwmax - cx(mgs,lc) ) )
11712 IF ( cn(mgs) + cnuf(mgs) > 0.0 )
THEN
11715 dcloud = 1000.*dcrit**3*pi/6.
11719 tmp = max(0.0, rho0(mgs)*qx(mgs,lc)/dcloud - cx(mgs,lc))
11720 cn(mgs) = min(tmp, cn(mgs) )
11722 cx(mgs,lc) = cx(mgs,lc) + cn(mgs) + cnuf(mgs)
11729 dcloud = 1000.*dcrit**3*pi/6.*(cn(mgs) + cnuf(mgs) )
11730 qx(mgs,lc) = qx(mgs,lc) + dcloud
11731 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11732 qwvp(mgs) = qwvp(mgs) - dcloud
11734 ccncuf(mgs) = max(0.0, ccncuf(mgs) - cnuf(mgs))
11737 ELSEIF ( irenuc == 8 )
THEN
11743 IF ( ccnc(mgs) > 0. )
THEN
11744 cn(mgs) = ccne0*ccnc(mgs)**(2./(2.+cck))*max(0.0,wvel(mgs))**cnexp
11749 cn(mgs) = min(cn(mgs), ccnc(mgs))
11751 ELSEIF ( cx(mgs,lc) < 0.01e9 )
THEN
11755 temp1 = (theta0(mgs)+thetap(mgs))*pk(mgs)
11757 ltemq = int( (temp1-163.15)/fqsat+1.5 )
11758 ltemq = min( nqsat, max(1,ltemq) )
11761 IF ( iqvsopt == 0 )
THEN
11762 c1 = pqs(mgs)*tabqvs(ltemq)
11763 ELSEIF ( iqvsopt == 1 )
THEN
11764 c1 = rdorv*esbolton*tabqvs(ltemq)/(pres(mgs) - esbolton*tabqvs(ltemq))
11768 IF ( c1 > 0. )
THEN
11769 ssf(mgs) = 100.*(qx(mgs,lv)/c1 - 1.0)
11773 IF ( ssf(mgs) <= 1.0 )
THEN
11777 cn(mgs) = 0.01e9*min(2.0, max(0.0,0.03*(ssf(mgs)-1.0)+1.)**cck ) - cx(mgs,lc)
11782 IF ( cn(mgs) > 0.0 )
THEN
11783 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11791 dcloud = 1000.*dcrit**3*pi/6.*cn(mgs)
11792 qx(mgs,lc) = qx(mgs,lc) + dcloud
11793 thetap(mgs) = thetap(mgs) + felvcp(mgs)*dcloud/(pi0(mgs))
11794 qwvp(mgs) = qwvp(mgs) - dcloud
11799 ELSEIF ( irenuc == 9 .or. irenuc == 10 )
THEN
11801 write(0,*)
'irenuc=9 requires nuwrfmods=1'
11804 ELSEIF ( irenuc == 11 )
THEN
11806 write(0,*)
'irenuc=11 requires nuwrfmods=1'
11810 ccna(mgs) = ccna(mgs) + cn(mgs)
11828 qv1 = qv0(mgs) + qwvp(mgs)
11833 IF ( qv1 .gt. (ssmx*qvs1) )
THEN
11839 ssmx = 100.*(ssmx - 1.0)
11843 CALL qvexcess(ngs,mgs,qwvp,qv0,qx(1,lc),pres,thetap,theta0,qvex, &
11844 & pi0,tabqvs,nqsat,fqsat,cbw,fcqv1,felvcp,ssmx,pk,ngscnt)
11848 IF ( qvex .gt. 0.0 )
THEN
11849 thetap(mgs) = thetap(mgs) + felvcp(mgs)*qvex/(pi0(mgs))
11850 IF ( io_flag .and. nxtra > 1 )
THEN
11851 axtra(igs(mgs),jy,kgs(mgs),1) = axtra(igs(mgs),jy,kgs(mgs),1) + qvex/dtp
11853 qwvp(mgs) = qwvp(mgs) - qvex
11854 qx(mgs,lc) = qx(mgs,lc) + qvex
11855 IF ( .not. flag_qndrop)
THEN
11856 IF ( imaxsupopt == 1 )
THEN
11857 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, xmas(mgs,lc) ) )
11858 ELSEIF ( imaxsupopt == 2 )
THEN
11859 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmas30,xmas(mgs,lc)) ) )
11860 ELSEIF ( imaxsupopt == 3 )
THEN
11861 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmasx,xmas(mgs,lc)) ) )
11863 ELSEIF ( imaxsupopt == 4 )
THEN
11864 cn(mgs) = min( max(ccnc(mgs),cwnccn(mgs)), rho0(mgs)*qvex/max( cwmasn5, max(cwmas20,xmas(mgs,lc)) ) )
11867 IF ( lccna > 1 )
THEN
11869 ccna(mgs) = ccna(mgs) + cn(mgs)
11872 ccnc(mgs) = max( 0.0, ccnc(mgs) - cn(mgs) )
11875 cx(mgs,lc) = cx(mgs,lc) + cn(mgs)
11891 IF( cx(mgs,lc) > cxmin .AND. qx(mgs,lc) .GT. qxmin(lc))
THEN
11893 xmas(mgs,lc) = rho0(mgs)*qx(mgs,lc)/(cx(mgs,lc))
11895 IF ( xmas(mgs,lc) < cwmasn .or. xmas(mgs,lc) > cwmasx )
THEN
11897 xmas(mgs,lc) = min( xmas(mgs,lc), cwmasx )
11898 xmas(mgs,lc) = max( xmas(mgs,lc), cwmasn )
11899 cx(mgs,lc) = rho0(mgs)*qx(mgs,lc)/xmas(mgs,lc)
11928 IF ( ipconc .ge. 3 .and. rcond == 2 )
THEN
11931 IF (cx(mgs,lr) .GT. 0. .AND. qx(mgs,lr) .GT. qxmin(lr)) &
11932 & xv(mgs,lr)=rho0(mgs)*qx(mgs,lr)/(xdn(mgs,lr)*cx(mgs,lr))
11933 IF (xv(mgs,lr) .GT. xvmx(lr)) xv(mgs,lr) = xvmx(lr)
11934 IF (xv(mgs,lr) .LT. xvmn(lr)) xv(mgs,lr) = xvmn(lr)
11945 IF ( lss > 1 .and. ssf(mgs) .gt. ssmax(mgs) &
11946 & .and. ( idecss .eq. 0 .or. qx(mgs,lc) .gt. qxmin(lc)) )
THEN
11947 ssmax(mgs) = ssf(mgs)
11953 an(igs(mgs),jy,kgs(mgs),lt) = theta0(mgs) + thetap(mgs)
11954 an(igs(mgs),jy,kgs(mgs),lv) = qv0(mgs) + qwvp(mgs)
11957 IF ( eqtset > 2 )
THEN
11958 p2(igs(mgs),jy,kgs(mgs)) = pipert(mgs)
11961 if ( ido(lc) .eq. 1 )
then
11962 an(igs(mgs),jy,kgs(mgs),lc) = qx(mgs,lc) + &
11963 & min( an(igs(mgs),jy,kgs(mgs),lc), 0.0 )
11968 if ( ido(lr) .eq. 1 .and. rcond == 2 )
then
11969 an(igs(mgs),jy,kgs(mgs),lr) = qx(mgs,lr) + &
11970 & min( an(igs(mgs),jy,kgs(mgs),lr), 0.0 )
11974 IF ( lzr > 1 .and. rcond == 2 )
THEN
11975 an(igs(mgs),jy,kgs(mgs),lzr) = zx(mgs,lr) + &
11976 & min( an(igs(mgs),jy,kgs(mgs),lzr), 0.0 )
11980 IF ( ipconc .ge. 2 )
THEN
11981 an(igs(mgs),jy,kgs(mgs),lnc) = max(cx(mgs,lc) , 0.0)
11986 IF ( lss > 1 ) an(igs(mgs),jy,kgs(mgs),lss) = max( 0.0, ssmax(mgs) )
11987 IF ( ac_opt == 0 )
THEN
11988 IF ( lccn .gt. 1 .and. lccna .lt. 1 )
THEN
11989 an(igs(mgs),jy,kgs(mgs),lccn) = max(0.0, ccnc(mgs) )
11991 ELSEIF ( ac_opt == 1 .and. lccn > 1)
THEN
11992 an(igs(mgs),jy,kgs(mgs),lccn) = max( 0.0, ccnc(mgs) )
11993 ELSEIF ( ac_opt == 11 .and. lccna > 1)
THEN
11995 ELSEIF ( ac_opt == 2 .and. lccn > 1)
THEN
11996 an(igs(mgs),jy,kgs(mgs),lccn) = max( 0.0, ccnc(mgs) )
11997 an(igs(mgs),jy,kgs(mgs),lcn_nu) = max( 0.0, ccnc_nu(mgs) )
11998 an(igs(mgs),jy,kgs(mgs),lcn_co) = max( 0.0, ccnc_co(mgs) )
11999 ELSEIF ( ac_opt == 22 .and. lccna > 1)
THEN
12001 an(igs(mgs),jy,kgs(mgs),lccnanu) = max( 0.0, ccnanu(mgs) )
12002 an(igs(mgs),jy,kgs(mgs),lccnaco) = max( 0.0, ccnaco(mgs) )
12004 IF ( lccnuf .gt. 1 .and. .not. ( lccna .gt. 1 .and. i_uf_or_ccn > 0 ) )
THEN
12005 an(igs(mgs),jy,kgs(mgs),lccnuf) = max(0.0, ccncuf(mgs) )
12007 IF ( lccna .gt. 1 )
THEN
12008 an(igs(mgs),jy,kgs(mgs),lccna) = max(0.0, ccna(mgs) )
12011 IF ( ipconc .ge. 3 .and. rcond == 2 )
THEN
12012 an(igs(mgs),jy,kgs(mgs),lnr) = max(cx(mgs,lr) , 0.0)
12020 if ( kz .gt. nz-1 .and. ix .ge. nxi)
then
12021 if ( ix .ge. nxi )
then
12030 if ( ix .ge. nxi )
then
12054 END SUBROUTINE nucond
12064 subroutine smallvalues &
12065 & (nx,ny,nz,na,jyslab &
12066 & ,nor,norz,dtp,nxi &
12069 & ,t77,flag_qndrop &
12075 integer :: nx,ny,nz,na,nxi
12076 integer :: nor,norz, jyslab
12078 logical,
intent(in) :: flag_qndrop
12083 real t77(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
12084 real t0(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
12085 real an(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz,na)
12086 real dn(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
12087 real w(-nor+1:nx+nor,-nor+1:ny+nor,-norz+1:nz+norz)
12092 logical zerocx(lc:lqmx)
12094 real :: frac, hwdn, tmpg, xdia1, xdia3, cwch,xvol
12096 integer ix,kz,i,n, km1
12099 real :: chw, g1, z1, tmp, tmp2, fw, tmpmx, qr
12110 cwch = ((3. + alphah)*(2. + alphah)*(1.0 + alphah))**(-1./3.)
12120 t0(ix,jy,kz) = an(ix,jy,kz,lt)*t77(ix,jy,kz)
12122 zerocx(:) = .false.
12124 IF ( iresetmoments == 1 .or. iresetmoments == il )
THEN
12125 IF ( ln(il) > 1 ) zerocx(il) = ( an(ix,jy,kz,ln(il)) < cxmin )
12126 IF ( lz(il) > 1 ) zerocx(il) = ( zerocx(il) .or. (an(ix,jy,kz,lz(il)) < zxmin) )
12128 IF ( il == lc )
THEN
12129 IF ( ln(il) > 1 )
THEN
12130 zerocx(il) = ( an(ix,jy,kz,ln(il)) <= 0.0 ) .and. .not. flag_qndrop
12133 IF ( ln(il) > 1 ) zerocx(il) = ( an(ix,jy,kz,ln(il)) <= 0.0 )
12138 IF ( lhl .gt. 1 )
THEN
12140 IF ( lzhl .gt. 1 )
THEN
12142 an(ix,jy,kz,lzhl) = max(0.0, an(ix,jy,kz,lzhl) )
12144 IF ( an(ix,jy,kz,lhl) .ge. frac*qxmin(lhl) .and. rescale_low_alpha )
THEN
12146 IF ( an(ix,jy,kz,lnhl) .gt. 0.0 )
THEN
12148 IF ( lvhl .gt. 1 )
THEN
12149 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
12150 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
12154 hwdn = max( xdnmn(lhl), hwdn )
12159 chw = an(ix,jy,kz,lnhl)
12160 g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/ &
12161 & ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
12162 z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lhl) )*an(ix,jy,kz,lhl)/chw
12163 z1 = z1*(6./(pi*hwdn))**2
12168 an(ix,jy,kz,lzhl) = min( z1, an(ix,jy,kz,lzhl) )
12170 IF ( an(ix,jy,kz,lnhl) .lt. 1.e-5 )
THEN
12177 if ( (an(ix,jy,kz,lhl) .lt. frac*qxmin(lhl)) .or. zerocx(lhl) )
then
12180 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lhl)
12181 an(ix,jy,kz,lhl) = 0.0
12184 IF ( ipconc .ge. 5 )
THEN
12185 an(ix,jy,kz,lnhl) = 0.0
12188 IF ( lvhl .gt. 1 )
THEN
12189 an(ix,jy,kz,lvhl) = 0.0
12192 IF ( lhlw .gt. 1 )
THEN
12193 an(ix,jy,kz,lhlw) = 0.0
12196 IF ( lnhlf .gt. 1 )
THEN
12197 an(ix,jy,kz,lnhlf) = 0.0
12200 IF ( lzhl .gt. 1 )
THEN
12201 an(ix,jy,kz,lzhl) = 0.0
12205 IF ( lvol(lhl) .gt. 1 )
THEN
12206 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
12207 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
12210 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
12213 IF ( tmp .lt. xdnmn(lhl) )
THEN
12214 tmp = max( xdnmn(lhl), tmp )
12215 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
12218 IF ( tmp .gt. xdnmx(lhl) .and. lhlw .le. 0 )
THEN
12219 tmp = min( xdnmx(lhl), tmp )
12220 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
12221 ELSEIF ( tmp .gt. xdnmx(lhl) .and. lhlw .gt. 1 )
THEN
12222 fw = an(ix,jy,kz,lhlw)/an(ix,jy,kz,lhl)
12227 tmpmx = xdnmx(lhl)/( 1. - fw*(1. - xdnmx(lhl)/xdnmx(lr) ))
12229 IF ( tmp .gt. tmpmx )
THEN
12230 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmpmx
12242 IF ( lhlw .gt. 1 )
THEN
12243 IF ( an(ix,jy,kz,lhlw) .gt. 0.98*an(ix,jy,kz,lhl) )
THEN
12245 an(ix,jy,kz,lvhl) = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/tmp
12251 IF ( lvhl .gt. 1 )
THEN
12252 IF ( an(ix,jy,kz,lvhl) .gt. 0.0 )
THEN
12253 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
12257 hwdn = max( xdnmn(lhl), hwdn )
12262 IF ( ipconc >= 5 .and. an(ix,jy,kz,lhl) .gt. qxmin(lhl) )
THEN
12263 qr = an(ix,jy,kz,lhl)
12264 xvol = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/(hwdn*an(ix,jy,kz,lnhl))
12265 chw = an(ix,jy,kz,lnhl)
12267 IF ( xvol .lt. xvmn(lhl) .or. xvol .gt. xvmx(lhl) )
THEN
12268 xvol = min( xvmx(lhl), max( xvmn(lhl),xvol ) )
12269 chw = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/(xvol*hwdn)
12270 an(ix,jy,kz,lnhl) = chw
12275 IF ( ipconc == 5 .and. an(ix,jy,kz,lhl) .gt. qxmin(lhl) .and. alphahl .le. 0.1 .and. lnhl .gt. 1 .and. lzhl == 0 )
THEN
12277 IF ( lvhl .gt. 1 )
THEN
12278 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lhl)/an(ix,jy,kz,lvhl)
12282 tmp = (hwdn*an(ix,jy,kz,lnhl))/(dn(ix,jy,kz)*an(ix,jy,kz,lhl))
12283 tmpg = an(ix,jy,kz,lnhl)*(tmp*pi)**(1./3.)
12284 IF ( tmpg .lt. cnohlmn )
THEN
12285 tmp = ( (hwdn)/(dn(ix,jy,kz)*an(ix,jy,kz,lhl))*pi)**(1./3.)
12286 an(ix,jy,kz,lnhl) = (cnohlmn/tmp)**(3./4.)
12298 IF ( lzh .gt. 1 )
THEN
12300 an(ix,jy,kz,lzh) = max(0.0, an(ix,jy,kz,lzh) )
12302 IF ( .false. .and. an(ix,jy,kz,lh) .ge. frac*qxmin(lh) .and. rescale_low_alpha )
THEN
12304 IF ( an(ix,jy,kz,lnh) .gt. 0.0 )
THEN
12306 IF ( lvh .gt. 1 )
THEN
12307 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
12308 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
12312 hwdn = max( xdnmn(lh), hwdn )
12317 chw = an(ix,jy,kz,lnh)
12318 g1 = (6.0+alphamin)*(5.0+alphamin)*(4.0+alphamin)/ &
12319 & ((3.0+alphamin)*(2.0+alphamin)*(1.0+alphamin))
12320 z1 = g1*dn(ix,jy,kz)**2*( an(ix,jy,kz,lh) )*an(ix,jy,kz,lh)/chw
12321 z1 = z1*(6./(pi*hwdn))**2
12326 an(ix,jy,kz,lzh) = min( z1, an(ix,jy,kz,lzh) )
12328 IF ( an(ix,jy,kz,lnh) .lt. 1.e-5 )
THEN
12335 if ( (an(ix,jy,kz,lh) .lt. frac*qxmin(lh)) .or. zerocx(lh) )
then
12338 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lh)
12339 an(ix,jy,kz,lh) = 0.0
12342 IF ( ipconc .ge. 5 )
THEN
12343 an(ix,jy,kz,lnh) = 0.0
12346 IF ( lvh .gt. 1 )
THEN
12347 an(ix,jy,kz,lvh) = 0.0
12350 IF ( lhw .gt. 1 )
THEN
12351 an(ix,jy,kz,lhw) = 0.0
12354 IF ( lnhf .gt. 1 )
THEN
12355 an(ix,jy,kz,lnhf) = 0.0
12358 IF ( lzh .gt. 1 )
THEN
12359 an(ix,jy,kz,lzh) = 0.0
12363 IF ( lvol(lh) .gt. 1 )
THEN
12364 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
12365 tmp = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
12368 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
12371 IF ( tmp .lt. xdnmn(lh) )
THEN
12372 tmp = max( xdnmn(lh), tmp )
12373 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
12376 IF ( tmp .gt. xdnmx(lh) .and. lhw .le. 0 )
THEN
12377 tmp = min( xdnmx(lh), tmp )
12378 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
12379 ELSEIF ( tmp .gt. xdnmx(lh) .and. lhw .gt. 1 )
THEN
12380 fw = an(ix,jy,kz,lhw)/an(ix,jy,kz,lh)
12384 tmpmx = xdnmx(lh)/( 1. - fw*(1. - xdnmx(lh)/xdnmx(lr) ))
12386 IF ( tmp .gt. tmpmx )
THEN
12387 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmpmx
12400 IF ( lhw .gt. 1 )
THEN
12401 IF ( an(ix,jy,kz,lhw) .gt. 0.98*an(ix,jy,kz,lh) )
THEN
12403 an(ix,jy,kz,lvh) = dn(ix,jy,kz)*an(ix,jy,kz,lh)/tmp
12409 IF ( lvh .gt. 1 )
THEN
12410 IF ( an(ix,jy,kz,lvh) .gt. 0.0 )
THEN
12411 hwdn = dn(ix,jy,kz)*an(ix,jy,kz,lh)/an(ix,jy,kz,lvh)
12415 hwdn = max( xdnmn(lh), hwdn )
12420 IF ( ipconc >= 5 .and. an(ix,jy,kz,lh) .gt. qxmin(lh) )
THEN
12421 qr = an(ix,jy,kz,lh)
12422 xvol = dn(ix,jy,kz)*an(ix,jy,kz,lh)/(hwdn*an(ix,jy,kz,lnh))
12423 chw = an(ix,jy,kz,lnh)
12425 IF ( xvol .lt. xvmn(lh) .or. xvol .gt. xvmx(lh) )
THEN
12426 xvol = min( xvmx(lh), max( xvmn(lh),xvol ) )
12427 chw = dn(ix,jy,kz)*an(ix,jy,kz,lh)/(xvol*hwdn)
12428 an(ix,jy,kz,lnh) = chw
12433 IF ( ipconc == 5 .and. an(ix,jy,kz,lh) .gt. qxmin(lh) .and. alphah .le. 0.1 .and. lnh .gt. 1 .and. lzh == 0 )
THEN
12435 tmp = (hwdn*an(ix,jy,kz,lnh))/(dn(ix,jy,kz)*an(ix,jy,kz,lh))
12436 tmpg = an(ix,jy,kz,lnh)*(tmp*pi)**(1./3.)
12437 IF ( tmpg .lt. cnohmn )
THEN
12440 tmp = ( (hwdn)/(dn(ix,jy,kz)*an(ix,jy,kz,lh))*pi)**(1./3.)
12441 an(ix,jy,kz,lnh) = (cnohmn/tmp)**(3./4.)
12446 IF ( ipconc == 5 .and. imorrgdnglimit == 1 )
THEN
12448 xdia3 = (xvol*6.*piinv)**(1./3.)
12450 IF ( xdia1 > morrdnglimit )
THEN
12451 xdia1 = morrdnglimit
12452 xvol = pi/6.0*(xdia1/cwch)**3
12453 chw = dn(ix,jy,kz)*qr/(xvol*hwdn)
12454 an(ix,jy,kz,lnh) = chw
12455 xdia3 = (xvol*6.*piinv)**(1./3.)
12463 if ( (an(ix,jy,kz,ls) .lt. frac*qxmin(ls)) .or. zerocx(ls) )
then
12464 IF ( t0(ix,jy,kz) .lt. 273.15 )
THEN
12466 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,ls)
12467 an(ix,jy,kz,ls) = 0.0
12470 IF ( ipconc .ge. 4 )
THEN
12472 an(ix,jy,kz,lns) = 0.0
12475 IF ( lvs .gt. 1 )
THEN
12476 an(ix,jy,kz,lvs) = 0.0
12479 IF ( lsw .gt. 1 )
THEN
12480 an(ix,jy,kz,lsw) = 0.0
12485 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,ls)
12486 an(ix,jy,kz,ls) = 0.0
12489 IF ( lvs .gt. 1 )
THEN
12490 an(ix,jy,kz,lvs) = 0.0
12493 IF ( lsw .gt. 1 )
THEN
12494 an(ix,jy,kz,lsw) = 0.0
12497 IF ( ipconc .ge. 4 )
THEN
12499 an(ix,jy,kz,lns) = 0.0
12505 ELSEIF ( lvol(ls) .gt. 1 )
THEN
12506 IF ( an(ix,jy,kz,lvs) .gt. 0.0 )
THEN
12507 tmp = dn(ix,jy,kz)*an(ix,jy,kz,ls)/an(ix,jy,kz,lvs)
12508 IF ( tmp .gt. xdnmx(ls) .or. tmp .lt. xdnmn(ls) )
THEN
12509 tmp = min( xdnmx(ls), max( xdnmn(ls), tmp ) )
12510 an(ix,jy,kz,lvs) = dn(ix,jy,kz)*an(ix,jy,kz,ls)/tmp
12514 an(ix,jy,kz,lvs) = dn(ix,jy,kz)*an(ix,jy,kz,ls)/tmp
12520 IF ( lzr > 1 )
THEN
12521 an(ix,jy,kz,lzr) = max(0.0, an(ix,jy,kz,lzr) )
12524 if ( (an(ix,jy,kz,lr) .lt. frac*qxmin(lr)) .or. zerocx(lr) )
then
12525 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lr)
12526 an(ix,jy,kz,lr) = 0.0
12527 IF ( ipconc .ge. 3 )
THEN
12529 an(ix,jy,kz,lnr) = 0.0
12532 IF ( lzr > 1 )
THEN
12533 an(ix,jy,kz,lzr) = 0.0
12541 IF ( (an(ix,jy,kz,li) .le. frac*qxmin(li)) .or. zerocx(li) )
THEN
12542 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,li)
12543 an(ix,jy,kz,li)= 0.0
12544 IF ( ipconc .ge. 1 )
THEN
12545 an(ix,jy,kz,lni) = 0.0
12553 IF ( (an(ix,jy,kz,lc) .le. frac*qxmin(lc)) .or. zerocx(lc) )
THEN
12554 an(ix,jy,kz,lv) = an(ix,jy,kz,lv) + an(ix,jy,kz,lc)
12555 an(ix,jy,kz,lc)= 0.0
12556 IF ( ipconc .ge. 2 )
THEN
12557 IF ( lccn .gt. 1 .or. ac_opt == 1 )
THEN
12558 IF ( irenuc < 5 .and. lccna <= 1 )
THEN
12559 IF ( ac_opt == 0 )
THEN
12560 an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) + max(0.0,an(ix,jy,kz,lnc))
12561 ELSEIF ( lccn > 1 )
THEN
12562 an(ix,jy,kz,lccn) = an(ix,jy,kz,lccn) + max(0.0,an(ix,jy,kz,lnc))
12564 ELSEIF ( lccna > 1 )
THEN
12565 tmp = max(0.0,an(ix,jy,kz,lnc))
12566 IF ( lccnaco > 1 .and. lccnanu > 1 )
THEN
12568 tmp2 = an(ix,jy,kz,lccna) + an(ix,jy,kz,lccnaco) + an(ix,jy,kz,lccnanu)
12569 IF ( tmp2 > 0.0 .and. tmp > 0.0 )
THEN
12570 an(ix,jy,kz,lccna) = max( 0.0, an(ix,jy,kz,lccna) - tmp*an(ix,jy,kz,lccna)/tmp2 )
12571 an(ix,jy,kz,lccnaco) = max( 0.0, an(ix,jy,kz,lccnaco) - tmp*an(ix,jy,kz,lccnaco)/tmp2 )
12572 an(ix,jy,kz,lccnanu) = max( 0.0, an(ix,jy,kz,lccnanu) - tmp*an(ix,jy,kz,lccnanu)/tmp2 )
12575 an(ix,jy,kz,lccna) = max( 0.0, an(ix,jy,kz,lccna) - tmp )
12579 an(ix,jy,kz,lnc) = 0.0
12580 IF ( lccn > 1 ) an(ix,jy,kz,lccn) = max( 0.0, an(ix,jy,kz,lccn) )
12583 IF ( lccna > 0 )
THEN
12584 IF ( restoreccn )
THEN
12585 tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)
12586 IF ( tmp < qxmin(li) )
THEN
12587 IF ( an(ix,jy,kz,lccna) > 1. .and. tmp < qxmin(li) ) an(ix,jy,kz,lccna) = an(ix,jy,kz,lccna)*exp(-dtp/ccntimeconst)
12588 IF ( lccnaco > 1 ) an(ix,jy,kz,lccnaco) = an(ix,jy,kz,lccnaco)*exp(-dtp/ccntimeconst)
12589 IF ( lccnanu > 1 ) an(ix,jy,kz,lccnanu) = an(ix,jy,kz,lccnanu)*exp(-dtp/ccntimeconst)
12592 ELSEIF ( lccn > 1 .and. restoreccn .and. ac_opt == 0 )
THEN
12594 tmp = an(ix,jy,kz,li) + an(ix,jy,kz,ls)
12599 IF ( an(ix,jy,kz,lccn) > 1. .and. tmp < qxmin(li) .and. &
12600 ( an(ix,jy,kz,lccn) < dn(ix,jy,kz)*qccn .or. .not. invertccn ) )
THEN
12604 an(ix,jy,kz,lccn) = &
12605 dn(ix,jy,kz)*qccn - max(0.0 , dn(ix,jy,kz)*qccn - an(ix,jy,kz,lccn))*exp(-dtp/ccntimeconst)
12619 end subroutine smallvalues
12632 subroutine nssl_2mom_gs &
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
17268 nr = cx(mgs,lr)*gaml02d500( arg )
17269 ELSEIF ( iacrsize .eq. 2 .or. iacrsize .eq. 5 )
THEN
17270 nr = cx(mgs,lr)*gaml02d300( arg )
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 )
20148 x = gaminterp(ratio,alpha(mgs,lh),9,1)
20149 y = gaminterp(ratio,alpha(mgs,lh),3,1)
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
25169 end subroutine nssl_2mom_gs
subroutine, public calcnfromq(nx, ny, nz, an, na, nor, norz, dn, qcw, qci, qsw, qrw, qhw, qhl, ccw, cci, csw, crw, chw, chl, cccn, cccna, vhw, vhl, qv, spechum, invertccn_flag, cwmasin)
Subroutine to calculate number concentrations from initial state that has only mixing ratio.
subroutine, public nssl_2mom_init(ims, ime, jms, jme, kms, kme, nssl_params, ipctmp, mixphase, ihvol, idoniconlytmp, namelist_filename, internal_nml, nssl_graupelfallfac, nssl_hailfallfac, nssl_ehw0, nssl_ehlw0, nssl_icdx, nssl_icdxhl, nssl_icefallfac, nssl_snowfallfac, nssl_cccn, nssl_ufccn, nssl_alphah, nssl_alphahl, nssl_alphar, nssl_density_on, nssl_hail_on, nssl_ccn_on, nssl_icecrystals_on, ccn_is_ccna, nssl_ccn_opt, errmsg, errflg, infileunit, myrank, mpiroot)
NSSL MP setup routine (sets local options and array indices)
subroutine, public nssl_2mom_init_const(con_g, con_rd, con_cp, con_rv, con_t0c, con_cliq, con_csol, con_eps)
NSSL MP subroutine to initialize physical constants provided by host model.
subroutine, public calc_eff_radius(nx, ny, nz, na, jyslab, nor, norz, t1, t2, t3, t4, t5, t6, f_t4, f_t5, f_t6, qcw, qci, qsw, qrw, ccw, cci, csw, crw, an, dn)
Subroutine to calculate effective radii for use by radiation routines.
subroutine, public nssl_2mom_driver(qv, qc, qr, qi, qs, qh, qhl, ccw, crw, cci, csw, chw, chl, cn, vhw, vhl, cna, cni, f_cn, f_cna, f_cina, f_qc, f_qr, f_qi, f_qs, f_qh, f_qhl, cn_nu, cn_co, cinp, f_cnnu, f_cnco, f_cinp, cna_co, cna_nu, f_cnaco, f_cnanu, cnuf, f_cnuf, cn_ac, f_cnac, zrw, zhw, zhl, f_zrw, f_zhw, f_zhl, f_vhw, f_vhl, qsw, qhw, qhlw, tt, th, pii, p, w, dn, dz, dtp, itimestep, is_theta_or_temp, ntmul, ntcnt, lastloop, rainnc, rainncv, dx, dy, axtra, snownc, snowncv, grplnc, grplncv, sr, hailnc, hailncv, hail_maxk1, hail_max2d, nwp_diagnostics, tkediss, re_cloud, re_ice, re_snow, re_rain, re_graup, re_hail, has_reqc, has_reqi, has_reqs, has_reqr, has_reqg, has_reqh, rainncw2, rainnci2, dbz, vzf, compdbz, rscghis_2d, rscghis_2dp, rscghis_2dn, scr, scw, sci, scs, sch, schl, sctot, elec_physics, induc, elecz, scion, sciona, f_scion, f_sciona, noninduc, noninducp, noninducn, ssat3d, ssati, nssl_ssat_output, pcc2, pre2, depsubr, mnucf2, melr2, ctr2, rim1_2, rim2_2, rim3_2, nctr2, nnuccd2, nnucf2, effc2, effr2, effi2, effs2, effg2, fc2, fr2, fi2, fs2, fg2, fnc2, fnr2, fni2, fns2, fng2, ipelectmp, isedonly_in, diagflag, ke_diag, errmsg, errflg, nssl_progn, wetscav_on, rainprod, evapprod, cu_used, qrcuten, qscuten, qicuten, qccuten, ids, ide, jds, jde, kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte)
Driver subroutine that copies state data to local 2D arrays for microphysics calls.
This module contains 1/2/3-moment bulk microphysics scheme based on a combination of Straka and Manse...