22 SUBROUTINE rase_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, &
23 & cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, &
24 & sige, kcbl, wgt0, wgt1, frland, ts, tho, thod, qho, qhod, uho, uhod, &
25 & vho, vhod, co_auto, ple, clw, clwd, flxd, flxdd, cnv_prc3, cnv_prc3d, &
26 & cnv_updfrc, cnv_updfrcd, rasparams, estblx)
29 INTEGER,
INTENT(IN) :: idim, irun, k0, icmin
30 REAL*8,
DIMENSION(idim, k0 + 1),
INTENT(IN) :: ple
31 REAL*8,
DIMENSION(k0 + 1),
INTENT(IN) :: sige
32 REAL*8,
INTENT(IN) :: dt, cons_cp, cons_alhl, cons_grav, cons_rgas
33 REAL*8,
INTENT(IN) :: cons_h2omw, cons_airmw, cons_vireps
34 INTEGER,
DIMENSION(idim),
INTENT(IN) :: seedras
35 INTEGER,
DIMENSION(idim),
INTENT(IN) :: kcbl
36 REAL*8,
DIMENSION(idim),
INTENT(IN) :: ts, frland
37 REAL*8,
DIMENSION(idim),
INTENT(IN) :: co_auto
38 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: wgt0, wgt1
39 REAL*8,
DIMENSION(:),
INTENT(IN) :: rasparams
40 REAL*8,
DIMENSION(:),
INTENT(IN) :: estblx
42 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: clw, flxd
43 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: clwd, flxdd
44 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: cnv_prc3
45 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: cnv_prc3d
46 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: cnv_updfrc
47 REAL*8,
DIMENSION(idim, k0),
INTENT(OUT) :: cnv_updfrcd
49 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: tho, qho, uho, vho
50 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: thod, qhod, uhod, vhod
52 INTEGER :: i, ic, l, kk, k
54 REAL*8,
PARAMETER :: onepkap=1.+2./7., daylen=86400.0
55 REAL*8,
PARAMETER :: rhmax=0.9999
56 REAL*8,
PARAMETER :: cbl_qpert=0.0, cbl_tpert=1.0
57 REAL*8,
PARAMETER :: cbl_tpert_mxocn=2.0, cbl_tpert_mxlnd=4.0
59 REAL*8 :: grav, cp, alhl, cpbg, alhi, cpi, gravi, ddt, lbcp
61 REAL*8 :: fricfac, cli_crit, rasal1, rasal2
63 REAL*8 :: sdqv2, sdqv3, sdqvt1
64 REAL*8 :: acritfac, pblfrac, autorampb
65 REAL*8 :: maxdallowed, rhmn, rhmx
67 REAL*8 :: tx2, tx3, akm, acr, alm, tth, qqh, dqx
68 REAL*8 :: tx2d, tx3d, akmd, almd
69 REAL*8 :: wfn, tem, trg, trgexp, evp, wlq, qcc
70 REAL*8 :: wfnd, temd, trgd, wlqd, qccd
71 REAL*8 :: cli, te_a, c00_x, cli_crit_x, toki
72 REAL*8 :: clid, te_ad, c00_xd, cli_crit_xd, tokid
73 REAL*8 :: dt_lyr, rate, cvw_x, closs, f2, f3, f4
74 REAL*8 :: dt_lyrd, rated, cvw_xd, clossd, f2d
75 REAL*8 :: wght0, prcbl, rndu
76 REAL*8 :: lambda_min, lambda_max
77 REAL*8 :: tpert, qpert
81 REAL*8,
DIMENSION(k0) :: poi_sv, qoi_sv, uoi_sv, voi_sv
82 REAL*8,
DIMENSION(k0) :: poi_svd, qoi_svd, uoi_svd, voi_svd
83 REAL*8,
DIMENSION(k0) :: poi, qoi, uoi, voi, dqq, bet, gam, cll
84 REAL*8,
DIMENSION(k0) :: poid, qoid, uoid, void0, dqqd, betd, gamd, &
86 REAL*8,
DIMENSION(k0) :: poi_c, qoi_c
87 REAL*8,
DIMENSION(k0) :: poi_cd, qoi_cd
88 REAL*8,
DIMENSION(k0) :: prh, pri, ght, dpt, dpb, pki
89 REAL*8,
DIMENSION(k0) :: prhd, prid, ghtd, dptd, dpbd, pkid
90 REAL*8,
DIMENSION(k0) :: ucu, vcu
91 REAL*8,
DIMENSION(k0) :: ucud, vcud
92 REAL*8,
DIMENSION(k0) :: cln, rns, pol
93 REAL*8,
DIMENSION(k0) :: rnsd, pold
94 REAL*8,
DIMENSION(k0) :: qst, ssl, rmf, rnn, rn1, rmfc, rmfp
95 REAL*8,
DIMENSION(k0) :: qstd, ssld, rnnd, rmfpd
96 REAL*8,
DIMENSION(k0) :: gms, eta, gmh, eht, gm1, hcc, rmfd
97 REAL*8,
DIMENSION(k0) :: gmsd, etad, gmhd, ehtd, gm1d, hccd, rmfdd
98 REAL*8,
DIMENSION(k0) :: hol, hst, qol, zol, hcld, cll0, cllx, clli
99 REAL*8,
DIMENSION(k0) :: hold, hstd, qold, zold, hcldd, cll0d
100 REAL*8,
DIMENSION(k0) :: bke, cvw, updfrc
101 REAL*8,
DIMENSION(k0) :: cvwd, updfrcd
102 REAL*8,
DIMENSION(k0) :: rasal, updfrp, bk2, dll0, dllx
103 REAL*8,
DIMENSION(k0) :: rasald, updfrpd, bk2d
104 REAL*8,
DIMENSION(k0) :: wght, massf
105 REAL*8,
DIMENSION(k0) :: wghtd
106 REAL*8,
DIMENSION(k0) :: qss, dqs, pf, pk, tempf, zlo
107 REAL*8,
DIMENSION(k0) :: qssd, dqsd, tempfd, zlod
108 REAL*8,
DIMENSION(k0 + 1) :: prj, prs, qht, sht, zet, zle, pke
109 REAL*8,
DIMENSION(k0+1) :: prjd, prsd, qhtd, shtd, zetd, zled
115 REAL*8,
DIMENSION(k0+1) :: pwx1
117 REAL*8,
DIMENSION(k0) :: pwx10
192 fricfac = rasparams(1)
194 cli_crit = rasparams(4)
196 rasal1 = rasparams(5)
198 rasal2 = rasparams(6)
200 friclambda = rasparams(11)
202 sdqv2 = rasparams(14)
204 sdqv3 = rasparams(15)
206 sdqvt1 = rasparams(16)
208 acritfac = rasparams(17)
210 pblfrac = rasparams(20)
212 autorampb = rasparams(21)
216 maxdallowed = rasparams(23)
233 pwx1 = ple(i, :)/1000.
234 pwy1 = cons_rgas/cons_cp
236 pf = 0.5*(ple(i, 1:k0)+ple(i, 2:k0+1))
238 pwy1 = cons_rgas/cons_cp
240 tempfd = pk*thod(i, :)
249 zled(l) = thod(i, l)*(1.+cons_vireps*qho(i, l)) + tho(i, l)*&
250 & cons_vireps*qhod(i, l)
251 zle(l) = tho(i, l)*(1.+cons_vireps*qho(i, l))
252 zlod(l) = zled(l+1) + cons_cp*(pke(l+1)-pk(l))*zled(l)/cons_grav
253 zlo(l) = zle(l+1) + cons_cp/cons_grav*(pke(l+1)-pk(l))*zle(l)
254 zled(l) = zlod(l) + cons_cp*(pk(l)-pke(l))*zled(l)/cons_grav
255 zle(l) = zlo(l) + cons_cp/cons_grav*(pk(l)-pke(l))*zle(l)
257 tpertd = cbl_tpert*(-tempfd(k0)-cons_grav*zlod(k0)/cons_cp)
258 tpert = cbl_tpert*(ts(i)-(tempf(k0)+cons_grav*zlo(k0)/cons_cp))
261 IF (tpert .LT. 0.0)
THEN 267 IF (qpert .LT. 0.0)
THEN 272 IF (frland(i) .LT. 0.1)
THEN 273 IF (tpert .GT. cbl_tpert_mxocn)
THEN 274 tpert = cbl_tpert_mxocn
279 ELSE IF (tpert .GT. cbl_tpert_mxlnd)
THEN 280 tpert = cbl_tpert_mxlnd
285 CALL dqsat_ras_d(dqs, dqsd, qss, qssd, tempf, tempfd, pf, k0, estblx&
286 & , cons_h2omw, cons_airmw)
291 prsd(icmin:k0+1) = 0.0_8
292 prs(icmin:k0+1) = ple(i, icmin:k0+1)
294 poid(icmin:k) = thod(i, icmin:k)
295 poi(icmin:k) = tho(i, icmin:k)
297 qoid(icmin:k) = qhod(i, icmin:k)
298 qoi(icmin:k) = qho(i, icmin:k)
300 uoid(icmin:k) = uhod(i, icmin:k)
301 uoi(icmin:k) = uho(i, icmin:k)
303 void0(icmin:k) = vhod(i, icmin:k)
304 voi(icmin:k) = vho(i, icmin:k)
306 qstd(icmin:k) = qssd(icmin:k)
307 qst(icmin:k) = qss(icmin:k)
309 dqqd(icmin:k) = dqsd(icmin:k)
310 dqq(icmin:k) = dqs(icmin:k)
312 massf(:) = wgt0(i, :)
316 prcbl = prcbl + massf(l)*(prs(l+1)-prs(l))
320 pwx11 = prs(k+1)/1000.
321 pwy1 = cons_rgas/cons_cp
323 prj(k+1) = pwx11**pwy1
326 pol(l) = 0.5*(prs(l)+prs(l+1))
328 prh(l) = (prs(l+1)*prj(l+1)-prs(l)*prj(l))/(onepkap*(prs(l+1)-prs(&
333 dpt(l) = prh(l) - prj(l)
335 dpb(l) = prj(l+1) - prh(l)
337 pri(l) = .01/(prs(l+1)-prs(l))
353 wght(l) = massf(l)*(ple(i, l+1)-ple(i, l))/(prs(k+1)-prs(k))
356 poid(k) = poid(k) + wght(l)*thod(i, l)
357 poi(k) = poi(k) + wght(l)*tho(i, l)
358 qoid(k) = qoid(k) + wght(l)*qhod(i, l)
359 qoi(k) = qoi(k) + wght(l)*qho(i, l)
360 uoid(k) = uoid(k) + wght(l)*uhod(i, l)
361 uoi(k) = uoi(k) + wght(l)*uho(i, l)
362 void0(k) = void0(k) + wght(l)*vhod(i, l)
363 voi(k) = voi(k) + wght(l)*vho(i, l)
365 CALL dqsats_ras_d(dqq(k), dqqd(k), qst(k), qstd(k), poi(k)*prh(k)&
366 & , prh(k)*poid(k), pol(k), estblx, cons_h2omw, &
369 IF (seedras(i)/1000000. .LT. 1e-6)
THEN 372 rndu = seedras(i)/1000000.
374 pwr1 = rndu**(-(1./2.))
375 mxdiam = maxdallowed*pwr1
382 betd(l) = pki(l)*dqqd(l)
383 bet(l) = dqq(l)*pki(l)
385 gamd(l) = -(pki(l)*lbcp*dqqd(l)/(1.0+lbcp*dqq(l))**2)
386 gam(l) = pki(l)/(1.0+lbcp*dqq(l))
388 ghtd(l+1) = dpb(l)*gamd(l) + dpt(l+1)*gamd(l+1)
389 ght(l+1) = gam(l)*dpb(l) + gam(l+1)*dpt(l+1)
390 gm1d(l+1) = 0.5*lbcp*((dqqd(l)*alhl*(1.0+lbcp*dqq(l))-dqq(l)*&
391 & alhl*lbcp*dqqd(l))/(alhl*(1.0+lbcp*dqq(l)))**2+(dqqd(l+1)*alhl&
392 & *(1.0+lbcp*dqq(l+1))-dqq(l+1)*alhl*lbcp*dqqd(l+1))/(alhl*(1.0+&
393 & lbcp*dqq(l+1)))**2)
394 gm1(l+1) = 0.5*lbcp*(dqq(l)/(alhl*(1.0+lbcp*dqq(l)))+dqq(l+1)/(&
395 & alhl*(1.0+lbcp*dqq(l+1))))
425 shtd(k+1) = cp*prj(k+1)*poid(k)
426 sht(k+1) = cp*poi(k)*prj(k+1)
434 IF (qst(l)*rhmax .GT. qoi(l))
THEN 438 qold(l) = rhmax*qstd(l)
439 qol(l) = qst(l)*rhmax
441 IF (0.000 .LT. qol(l))
THEN 447 ssld(l) = cp*prj(l+1)*poid(l) + grav*zetd(l+1)
448 ssl(l) = cp*prj(l+1)*poi(l) + grav*zet(l+1)
449 hold(l) = ssld(l) + alhl*qold(l)
450 hol(l) = ssl(l) + qol(l)*alhl
451 hstd(l) = ssld(l) + alhl*qstd(l)
452 hst(l) = ssl(l) + qst(l)*alhl
453 temd = (prj(l+1)-prj(l))*cpbg*poid(l)
454 tem = poi(l)*(prj(l+1)-prj(l))*cpbg
455 zetd(l) = zetd(l+1) + temd
456 zet(l) = zet(l+1) + tem
457 zold(l) = zetd(l+1) + (prj(l+1)-prh(l))*cpbg*poid(l)
458 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi(l)*cpbg
487 IF (1. .GT. (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn))
THEN 488 trgd = (qoid(k)*qst(k)-qoi(k)*qstd(k))/qst(k)**2/(rhmx-rhmn)
489 trg = (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn)
494 IF (0.0 .LT. (autorampb-sige(ic))/0.2)
THEN 495 y1 = (autorampb-sige(ic))/0.2
499 IF (1.0 .GT. y1)
THEN 504 IF (trg .GT. 1.0e-5)
THEN 511 poi_cd(k) = poi_cd(k) + tpertd
512 poi_c(k) = poi_c(k) + tpert
513 qoi_c(k) = qoi_c(k) + qpert
516 shtd(k+1) = cp*prj(k+1)*poi_cd(k)
517 sht(k+1) = cp*poi_c(k)*prj(k+1)
519 IF (qst(l)*rhmax .GT. qoi_c(l))
THEN 523 qold(l) = rhmax*qstd(l)
524 qol(l) = qst(l)*rhmax
526 IF (0.000 .LT. qol(l))
THEN 532 ssld(l) = cp*prj(l+1)*poi_cd(l) + grav*zetd(l+1)
533 ssl(l) = cp*prj(l+1)*poi_c(l) + grav*zet(l+1)
534 hold(l) = ssld(l) + alhl*qold(l)
535 hol(l) = ssl(l) + qol(l)*alhl
536 hstd(l) = ssld(l) + alhl*qstd(l)
537 hst(l) = ssl(l) + qst(l)*alhl
538 temd = (prj(l+1)-prj(l))*cpbg*poi_cd(l)
539 tem = poi_c(l)*(prj(l+1)-prj(l))*cpbg
540 zetd(l) = zetd(l+1) + temd
541 zet(l) = zet(l+1) + tem
542 zold(l) = zetd(l+1) + (prj(l+1)-prh(l))*cpbg*poi_cd(l)
543 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi_c(l)*cpbg
546 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
547 shtd(l) = ssld(l-1) + tem*(ssld(l)-ssld(l-1))
548 sht(l) = ssl(l-1) + tem*(ssl(l)-ssl(l-1))
549 qhtd(l) = .5*(qold(l)+qold(l-1))
550 qht(l) = .5*(qol(l)+qol(l-1))
553 lambda_min = .2/mxdiam
555 IF (hol(k) .GT. hst(ic))
THEN 558 temd = (hstd(ic)-hold(ic))*(zol(ic)-zet(ic+1)) + (hst(ic)-hol(&
559 & ic))*(zold(ic)-zetd(ic+1))
560 tem = (hst(ic)-hol(ic))*(zol(ic)-zet(ic+1))
562 temd = temd + (hstd(ic)-hold(l))*(zet(l)-zet(l+1)) + (hst(ic&
563 & )-hol(l))*(zetd(l)-zetd(l+1))
564 tem = tem + (hst(ic)-hol(l))*(zet(l)-zet(l+1))
566 IF (tem .GT. 0.0)
THEN 568 almd = ((hold(k)-hstd(ic))*tem-(hol(k)-hst(ic))*temd)/tem**2
569 alm = (hol(k)-hst(ic))/tem
570 IF (alm .LE. lambda_max)
THEN 573 IF (alm .LT. lambda_min)
THEN 574 tokid = 2*alm*almd/lambda_min**2
575 toki = (alm/lambda_min)**2
581 etad(l) = almd*(zet(l)-zet(k)) + alm*(zetd(l)-zetd(k))
582 eta(l) = 1.0 + alm*(zet(l)-zet(k))
584 etad(ic) = almd*(zol(ic)-zet(k)) + alm*(zold(ic)-zetd(k))
585 eta(ic) = 1.0 + alm*(zol(ic)-zet(k))
592 hccd(l) = hccd(l+1) + (etad(l)-etad(l+1))*hol(l) + (eta(&
593 & l)-eta(l+1))*hold(l)
594 hcc(l) = hcc(l+1) + (eta(l)-eta(l+1))*hol(l)
595 temd = dpb(l)*hccd(l+1) + dpt(l)*hccd(l)
596 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
597 ehtd(l) = dpb(l)*etad(l+1) + dpt(l)*etad(l)
598 eht(l) = eta(l+1)*dpb(l) + eta(l)*dpt(l)
599 wfnd = wfnd + (temd-ehtd(l)*hst(l)-eht(l)*hstd(l))*gam(l&
600 & ) + (tem-eht(l)*hst(l))*gamd(l)
601 wfn = wfn + (tem-eht(l)*hst(l))*gam(l)
603 hccd(ic) = hstd(ic)*eta(ic) + hst(ic)*etad(ic)
604 hcc(ic) = hst(ic)*eta(ic)
605 wfnd = wfnd + dpb(ic)*((hccd(ic+1)-hstd(ic)*eta(ic+1)-hst(&
606 & ic)*etad(ic+1))*gam(ic)+(hcc(ic+1)-hst(ic)*eta(ic+1))*&
608 wfn = wfn + (hcc(ic+1)-hst(ic)*eta(ic+1))*gam(ic)*dpb(ic)
616 hcldd(l) = ((etad(l+1)*hcld(l+1)+eta(l+1)*hcldd(l+1)+(&
617 & etad(l)-etad(l+1))*hol(l)+(eta(l)-eta(l+1))*hold(l))*&
618 & eta(l)-(eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l))*&
620 hcld(l) = (eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l))/&
622 temd = (((hcldd(l)-hstd(l))*(zet(l)-zet(l+1))+(hcld(l)-&
623 & hst(l))*(zetd(l)-zetd(l+1)))*(1.0+lbcp*dqq(l))-(hcld(l&
624 & )-hst(l))*(zet(l)-zet(l+1))*lbcp*dqqd(l))/(1.0+lbcp*&
626 tem = (hcld(l)-hst(l))*(zet(l)-zet(l+1))/(1.0+lbcp*dqq(l&
628 bke(l) = bke(l+1) + grav*tem/(cp*prj(l+1)*poi(l))
629 IF (tem .LT. 0.0)
THEN 636 bk2d(l) = bk2d(l+1) + (grav*max1d*cp*prj(l+1)*poi(l)-&
637 & grav*max1*cp*prj(l+1)*poid(l))/(cp*prj(l+1)*poi(l))**2
638 bk2(l) = bk2(l+1) + grav*max1/(cp*prj(l+1)*poi(l))
639 IF (bk2(l) .LT. 0.0)
THEN 646 IF (2.0*max2 .EQ. 0.0)
THEN 649 cvwd(l) = max2d/sqrt(2.0*max2)
651 cvw(l) = sqrt(2.0*max2)
654 IF (zet(ic) .LT. 2000.)
THEN 658 IF (zet(ic) .GE. 2000.)
THEN 659 rasald(ic) = (rasal2-rasal1)*zetd(ic)/8000.
660 rasal(ic) = rasal1 + (rasal2-rasal1)*(zet(ic)-2000.)/&
663 IF (rasal(ic) .GT. 1.0e5)
THEN 667 rasal(ic) = rasal(ic)
669 rasald(ic) = -(dt*rasald(ic)/rasal(ic)**2)
670 rasal(ic) = dt/rasal(ic)
672 IF (cvw(l) .LT. 1.00)
THEN 679 CALL acritn(pol(ic), prs(k), acr, acritfac)
680 IF (wfn .GT. acr)
THEN 693 temd = etad(l) - etad(l+1)
694 tem = eta(l) - eta(l+1)
695 wlqd = wlqd + temd*qol(l) + tem*qold(l)
696 wlq = wlq + tem*qol(l)
697 uhtd = uhtd + temd*uoi(l) + tem*uoid(l)
698 uht = uht + tem*uoi(l)
699 vhtd = vhtd + temd*voi(l) + tem*void0(l)
700 vht = vht + tem*voi(l)
702 tx2d = 0.5*((qstd(l)+qstd(l-1))*eta(l)+(qst(l)+qst(l&
704 tx2 = 0.5*(qst(l)+qst(l-1))*eta(l)
705 tx3d = 0.5*((hstd(l)+hstd(l-1))*eta(l)+(hst(l)+hst(l&
707 tx3 = 0.5*(hst(l)+hst(l-1))*eta(l)
708 qccd = tx2d + gm1d(l)*(hcc(l)-tx3) + gm1(l)*(hccd(l)&
710 qcc = tx2 + gm1(l)*(hcc(l)-tx3)
711 cll0d(l) = wlqd - qccd
714 cll0d(l) = wlqd - qstd(ic)*eta(ic) - qst(ic)*etad(ic&
716 cll0(l) = wlq - qst(ic)*eta(ic)
718 IF (cll0(l) .LT. 0.00)
THEN 724 clid = (cll0d(l)*eta(l)-cll0(l)*etad(l))/eta(l)**2
726 te_ad = prh(l)*poid(l)
730 c00_xd = co_auto(i)*f3*f4*f2d
731 c00_x = co_auto(i)*f2*f3*f4
732 cli_crit_xd = -(cli_crit*f3*f2d/(f2*f3)**2)
733 cli_crit_x = cli_crit/(f2*f3)
734 arg1d = -((2*cli*clid*cli_crit_x**2-cli**2*2*&
735 & cli_crit_x*cli_crit_xd)/(cli_crit_x**2)**2)
736 arg1 = -(cli**2/cli_crit_x**2)
737 rated = c00_xd*(1.0-exp(arg1)) - c00_x*arg1d*exp(arg1)
738 rate = c00_x*(1.0-exp(arg1))
739 IF (cvw(l) .LT. 1.00)
THEN 746 dt_lyrd = ((zetd(l)-zetd(l+1))*cvw_x-(zet(l)-zet(l+1))&
748 dt_lyr = (zet(l)-zet(l+1))/cvw_x
749 clossd = cll0d(l)*rate*dt_lyr + cll0(l)*(rated*dt_lyr+&
751 closs = cll0(l)*rate*dt_lyr
752 IF (closs .GT. cll0(l))
THEN 758 cll0d(l) = cll0d(l) - clossd
759 cll0(l) = cll0(l) - closs
761 IF (closs .GT. 0.)
THEN 771 wlqd = wlqd - qstd(ic)*eta(ic) - qst(ic)*etad(ic)
772 wlq = wlq - qst(ic)*eta(ic)
774 gmsd(k) = pri(k)*(shtd(k)-ssld(k))
775 gms(k) = (sht(k)-ssl(k))*pri(k)
776 gmhd(k) = gmsd(k) + pri(k)*alhl*(qhtd(k)-qold(k))
777 gmh(k) = gms(k) + (qht(k)-qol(k))*pri(k)*alhl
778 akmd = dpb(k-1)*(gmhd(k)*gam(k-1)+gmh(k)*gamd(k-1))
779 akm = gmh(k)*gam(k-1)*dpb(k-1)
783 gmsd(l) = pri(l)*(etad(l)*(sht(l)-ssl(l))+eta(l)*(shtd&
784 & (l)-ssld(l))+etad(l+1)*(ssl(l)-sht(l+1))+eta(l+1)*(&
785 & ssld(l)-shtd(l+1)))
786 gms(l) = (eta(l)*(sht(l)-ssl(l))+eta(l+1)*(ssl(l)-sht(&
788 gmhd(l) = gmsd(l) + alhl*pri(l)*(etad(l)*(qht(l)-qol(l&
789 & ))+eta(l)*(qhtd(l)-qold(l))+etad(l+1)*(qol(l)-qht(l+&
790 & 1))+eta(l+1)*(qold(l)-qhtd(l+1)))
791 gmh(l) = gms(l) + (eta(l)*(qht(l)-qol(l))+eta(l+1)*(&
792 & qol(l)-qht(l+1)))*alhl*pri(l)
793 tx2d = tx2d + (etad(l)-etad(l+1))*gmh(l) + (eta(l)-eta&
795 tx2 = tx2 + (eta(l)-eta(l+1))*gmh(l)
796 akmd = akmd - pki(l)*(gmsd(l)*eht(l)+gms(l)*ehtd(l)) +&
797 & tx2d*ght(l) + tx2*ghtd(l)
798 akm = akm - gms(l)*eht(l)*pki(l) + tx2*ght(l)
800 gmsd(ic) = pri(ic)*(etad(ic+1)*(ssl(ic)-sht(ic+1))+eta(&
801 & ic+1)*(ssld(ic)-shtd(ic+1)))
802 gms(ic) = eta(ic+1)*(ssl(ic)-sht(ic+1))*pri(ic)
803 akmd = akmd - dpb(ic)*pki(ic)*(gmsd(ic)*eta(ic+1)+gms(ic&
805 akm = akm - gms(ic)*eta(ic+1)*dpb(ic)*pki(ic)
806 gmhd(ic) = gmsd(ic) + pri(ic)*(alhl*(etad(ic+1)*(qol(ic)&
807 & -qht(ic+1))+eta(ic+1)*(qold(ic)-qhtd(ic+1)))+etad(ic)*&
808 & (hst(ic)-hol(ic))+eta(ic)*(hstd(ic)-hold(ic)))
809 gmh(ic) = gms(ic) + (eta(ic+1)*(qol(ic)-qht(ic+1))*alhl+&
810 & eta(ic)*(hst(ic)-hol(ic)))*pri(ic)
812 IF (.NOT.(akm .GE. 0.0 .OR. wlq .LT. 0.0))
THEN 814 wfnd = -((wfnd*akm-(wfn-acr)*akmd)/akm**2)
815 wfn = -((wfn-acr)/akm)
816 x1d = (rasald(ic)*wfn+rasal(ic)*wfnd)*trg*toki + rasal&
817 & (ic)*wfn*(trgd*toki+trg*tokid)
818 x1 = rasal(ic)*trg*toki*wfn
819 IF (x1 .GT. (prs(k+1)-prs(k))*(100.*pblfrac))
THEN 820 wfn = (prs(k+1)-prs(k))*(100.*pblfrac)
829 clld(ic) = clld(ic) + wlqd*tem + wlq*temd
830 cll(ic) = cll(ic) + wlq*tem
831 rmf(ic) = rmf(ic) + tem
832 rmfdd(ic) = rmfdd(ic) + temd*eta(ic) + tem*etad(ic)
833 rmfd(ic) = rmfd(ic) + tem*eta(ic)
835 rmfpd(l) = temd*eta(l) + tem*etad(l)
837 rmfc(l) = rmfc(l) + rmfp(l)
838 dllx(l) = dllx(l) + tem*dll0(l)
839 IF (cvw(l) .GT. 0.0)
THEN 840 updfrpd(l) = (ddt*1000.*rmfpd(l)*cvw(l)*prs(l)/&
841 & daylen-rmfp(l)*ddt*1000.*prs(l)*cvwd(l)/daylen)/&
843 updfrp(l) = rmfp(l)*(ddt/daylen)*1000./(cvw(l)*prs&
849 clli(l) = cll0(l)/eta(l)
850 updfrcd(l) = updfrcd(l) + updfrpd(l)
851 updfrc(l) = updfrc(l) + updfrp(l)
855 rnsd(l) = rnsd(l) + rnnd(l)*tem + rnn(l)*temd
856 rns(l) = rns(l) + rnn(l)*tem
857 gmhd(l) = gmhd(l)*wfn + gmh(l)*wfnd
859 gmsd(l) = gmsd(l)*wfn + gms(l)*wfnd
861 qoid(l) = qoid(l) + alhi*(gmhd(l)-gmsd(l))
862 qoi(l) = qoi(l) + (gmh(l)-gms(l))*alhi
863 poid(l) = poid(l) + pki(l)*cpi*gmsd(l)
864 poi(l) = poi(l) + gms(l)*pki(l)*cpi
865 qstd(l) = qstd(l) + cpi*(gmsd(l)*bet(l)+gms(l)*betd(&
867 qst(l) = qst(l) + gms(l)*bet(l)*cpi
873 IF (fricfac .GT. 0.0)
THEN 875 wfnd = fricfac*(wfnd*exp(-(alm/friclambda))-wfn*almd&
876 & *exp(-(alm/friclambda))/friclambda)
877 wfn = wfn*fricfac*exp(-(alm/friclambda))
880 ucud(k) = ucud(k) + temd*(uoi(k-1)-uoi(k)) + tem*(&
882 ucu(k) = ucu(k) + tem*(uoi(k-1)-uoi(k))
883 vcud(k) = vcud(k) + temd*(voi(k-1)-voi(k)) + tem*(&
884 & void0(k-1)-void0(k))
885 vcu(k) = vcu(k) + tem*(voi(k-1)-voi(k))
889 ucud(l) = ucud(l) + temd*((uoi(l-1)-uoi(l))*eta(l)&
890 & +(uoi(l)-uoi(l+1))*eta(l+1)) + tem*((uoid(l-1)-&
891 & uoid(l))*eta(l)+(uoi(l-1)-uoi(l))*etad(l)+(uoid(&
892 & l)-uoid(l+1))*eta(l+1)+(uoi(l)-uoi(l+1))*etad(l+&
894 ucu(l) = ucu(l) + tem*((uoi(l-1)-uoi(l))*eta(l)+(&
895 & uoi(l)-uoi(l+1))*eta(l+1))
896 vcud(l) = vcud(l) + temd*((voi(l-1)-voi(l))*eta(l)&
897 & +(voi(l)-voi(l+1))*eta(l+1)) + tem*((void0(l-1)-&
898 & void0(l))*eta(l)+(voi(l-1)-voi(l))*etad(l)+(&
899 & void0(l)-void0(l+1))*eta(l+1)+(voi(l)-voi(l+1))*&
901 vcu(l) = vcu(l) + tem*((voi(l-1)-voi(l))*eta(l)+(&
902 & voi(l)-voi(l+1))*eta(l+1))
906 ucud(ic) = ucud(ic) + (2.*(uhtd-uoid(ic)*(eta(ic)-&
907 & eta(ic+1))-uoi(ic)*(etad(ic)-etad(ic+1)))-(uoid(ic&
908 & )+uoid(ic+1))*eta(ic+1)-(uoi(ic)+uoi(ic+1))*etad(&
909 & ic+1))*tem + (2.*(uht-uoi(ic)*(eta(ic)-eta(ic+1)))&
910 & -(uoi(ic)+uoi(ic+1))*eta(ic+1))*temd
911 ucu(ic) = ucu(ic) + (2.*(uht-uoi(ic)*(eta(ic)-eta(ic&
912 & +1)))-(uoi(ic)+uoi(ic+1))*eta(ic+1))*tem
913 vcud(ic) = vcud(ic) + (2.*(vhtd-void0(ic)*(eta(ic)-&
914 & eta(ic+1))-voi(ic)*(etad(ic)-etad(ic+1)))-(void0(&
915 & ic)+void0(ic+1))*eta(ic+1)-(voi(ic)+voi(ic+1))*&
916 & etad(ic+1))*tem + (2.*(vht-voi(ic)*(eta(ic)-eta(ic&
917 & +1)))-(voi(ic)+voi(ic+1))*eta(ic+1))*temd
918 vcu(ic) = vcu(ic) + (2.*(vht-voi(ic)*(eta(ic)-eta(ic&
919 & +1)))-(voi(ic)+voi(ic+1))*eta(ic+1))*tem
921 uoid(l) = uoid(l) + ucud(l)
922 uoi(l) = uoi(l) + ucu(l)
923 void0(l) = void0(l) + vcud(l)
924 voi(l) = voi(l) + vcu(l)
935 IF (sum(rmf(icmin:k)) .GT. 0.0)
THEN 939 cnv_prc3d(i, l) = tem*rnsd(l)
940 cnv_prc3(i, l) = rns(l)*tem
942 thod(i, icmin:k-1) = poid(icmin:k-1)
943 tho(i, icmin:k-1) = poi(icmin:k-1)
944 qhod(i, icmin:k-1) = qoid(icmin:k-1)
945 qho(i, icmin:k-1) = qoi(icmin:k-1)
946 uhod(i, icmin:k-1) = uoid(icmin:k-1)
947 uho(i, icmin:k-1) = uoi(icmin:k-1)
948 vhod(i, icmin:k-1) = void0(icmin:k-1)
949 vho(i, icmin:k-1) = voi(icmin:k-1)
951 cnv_updfrcd(i, icmin:k-1) = updfrcd(icmin:k-1)
952 cnv_updfrc(i, icmin:k-1) = updfrc(icmin:k-1)
958 wght0 = wght0 + wght(l)*(ple(i, l+1)-ple(i, l))
960 wght0 = (prs(k+1)-prs(k))/wght0
963 thod(i, l) = thod(i, l) + wght(l)*(poid(k)-poi_svd(k))
964 tho(i, l) = tho(i, l) + wght(l)*(poi(k)-poi_sv(k))
965 qhod(i, l) = qhod(i, l) + wght(l)*(qoid(k)-qoi_svd(k))
966 qho(i, l) = qho(i, l) + wght(l)*(qoi(k)-qoi_sv(k))
967 uhod(i, l) = uhod(i, l) + wght(l)*(uoid(k)-uoi_svd(k))
968 uho(i, l) = uho(i, l) + wght(l)*(uoi(k)-uoi_sv(k))
969 vhod(i, l) = vhod(i, l) + wght(l)*(void0(k)-voi_svd(k))
970 vho(i, l) = vho(i, l) + wght(l)*(voi(k)-voi_sv(k))
973 flxdd(i, icmin:k) = ddt*rmfdd(icmin:k)/daylen
974 flxd(i, icmin:k) = rmfd(icmin:k)*ddt/daylen
976 clwd(i, icmin:k) = ddt*clld(icmin:k)/daylen
977 clw(i, icmin:k) = cll(icmin:k)*ddt/daylen
978 flxdd(i, 1:icmin-1) = 0.0_8
979 flxd(i, 1:icmin-1) = 0.
980 clwd(i, 1:icmin-1) = 0.0_8
981 clw(i, 1:icmin-1) = 0.
983 flxdd(i, k:k0) = 0.0_8
985 clwd(i, k:k0) = 0.0_8
1013 SUBROUTINE sundq3_ice_d(temp, tempd, rate2, rate3, te1, f2, f2d, f3)
1015 REAL*8,
INTENT(IN) :: temp, rate2, rate3, te1
1016 REAL*8,
INTENT(IN) :: tempd
1017 REAL*8,
INTENT(OUT) :: f2, f3
1018 REAL*8,
INTENT(OUT) :: f2d
1020 REAL*8 :: xx, yy, te0, te2, jump1
1023 jump1 = (rate2-1.0)/(te0-te1)**0.333
1025 IF (temp .GE. te0)
THEN 1030 IF (temp .GE. te1 .AND. temp .LT. te0)
THEN 1031 f2d = -(jump1*0.3333*(te0-temp)**(-0.6667)*tempd)
1032 f2 = 1.0 + jump1*(te0-temp)**0.3333
1035 IF (temp .LT. te1)
THEN 1036 f2d = (-((rate3-rate2)*tempd))/(te1-te2)
1037 f2 = rate2 + (rate3-rate2)*(te1-temp)/(te1-te2)
1040 IF (f2 .GT. 27.0)
THEN 1049 SUBROUTINE dqsat_ras_d(dqsi, dqsid, qssi, qssid, temp, tempd, plo, lm, &
1050 & estblx, cons_h2omw, cons_airmw)
1054 REAL*8,
DIMENSION(lm) :: temp, plo
1055 REAL*8,
DIMENSION(lm) :: tempd
1057 REAL*8 :: cons_h2omw, cons_airmw
1059 REAL*8,
DIMENSION(lm) :: dqsi, qssi
1060 REAL*8,
DIMENSION(lm) :: dqsid, qssid
1062 REAL*8,
PARAMETER :: max_mixing_ratio=1.0
1065 REAL*8 :: tl, tt, ti, dqsat, qsat, dqq, qq, pl, pp, dd
1066 REAL*8 :: tld, ttd, tid, dqsatd, qsatd, qqd, ddd
1068 INTEGER,
PARAMETER :: degsubs=100
1069 REAL*8,
PARAMETER :: tmintbl=150.0, tmaxtbl=333.0
1070 INTEGER,
PARAMETER :: tablesize=nint(tmaxtbl-tmintbl)*degsubs+1
1073 esfac = cons_h2omw/cons_airmw
1081 IF (tl .LE. tmintbl)
THEN 1084 ELSE IF (tl .GE. tmaxtbl - .001)
THEN 1092 tt = (ti-tmintbl)*degsubs + 1
1094 dqq = estblx(it+1) - estblx(it)
1096 qq = (tt-it)*dqq + estblx(it)
1097 IF (pp .LE. qq)
THEN 1098 qsat = max_mixing_ratio
1103 ddd = -((-((1.0-esfac)*qqd))/(pp-(1.0-esfac)*qq)**2)
1104 dd = 1.0/(pp-(1.0-esfac)*qq)
1105 qsatd = esfac*(qqd*dd+qq*ddd)
1107 dqsatd = esfac*degsubs*dqq*pp*(ddd*dd+dd*ddd)
1108 dqsat = esfac*degsubs*dqq*pp*(dd*dd)
1120 SUBROUTINE dqsats_ras_d(dqsi, dqsid, qssi, qssid, temp, tempd, plo, &
1121 & estblx, cons_h2omw, cons_airmw)
1127 REAL*8 :: cons_h2omw, cons_airmw
1129 REAL*8 :: dqsi, qssi
1130 REAL*8 :: dqsid, qssid
1132 REAL*8,
PARAMETER :: max_mixing_ratio=1.0
1134 REAL*8 :: tl, tt, ti, dqsat, qsat, dqq, qq, pl, pp, dd
1135 REAL*8 :: tld, ttd, tid, dqsatd, qsatd, qqd, ddd
1137 INTEGER,
PARAMETER :: degsubs=100
1138 REAL*8,
PARAMETER :: tmintbl=150.0, tmaxtbl=333.0
1139 INTEGER,
PARAMETER :: tablesize=nint(tmaxtbl-tmintbl)*degsubs+1
1142 esfac = cons_h2omw/cons_airmw
1147 IF (tl .LE. tmintbl)
THEN 1150 ELSE IF (tl .GE. tmaxtbl - .001)
THEN 1158 tt = (ti-tmintbl)*degsubs + 1
1160 dqq = estblx(it+1) - estblx(it)
1162 qq = (tt-it)*dqq + estblx(it)
1163 IF (pp .LE. qq)
THEN 1164 qsat = max_mixing_ratio
1169 ddd = -((-((1.0-esfac)*qqd))/(pp-(1.0-esfac)*qq)**2)
1170 dd = 1.0/(pp-(1.0-esfac)*qq)
1171 qsatd = esfac*(qqd*dd+qq*ddd)
1173 dqsatd = esfac*degsubs*dqq*pp*(ddd*dd+dd*ddd)
1174 dqsat = esfac*degsubs*dqq*pp*(dd*dd)
1183 SUBROUTINE rase0_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, &
1184 & cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, &
1185 & sige, kcbl, wgt0, wgt1, frland, ts, tho, thod, qho, qhod, co_auto, ple&
1186 & , rasparams, estblx)
1189 INTEGER,
INTENT(IN) :: idim, irun, k0, icmin
1190 REAL*8,
DIMENSION(idim, k0 + 1),
INTENT(IN) :: ple
1191 REAL*8,
DIMENSION(k0 + 1),
INTENT(IN) :: sige
1192 REAL*8,
INTENT(IN) :: dt, cons_cp, cons_alhl, cons_grav, cons_rgas
1193 REAL*8,
INTENT(IN) :: cons_h2omw, cons_airmw, cons_vireps
1194 INTEGER,
DIMENSION(idim),
INTENT(IN) :: seedras
1195 INTEGER,
DIMENSION(idim),
INTENT(IN) :: kcbl
1196 REAL*8,
DIMENSION(idim),
INTENT(IN) :: ts, frland
1197 REAL*8,
DIMENSION(idim),
INTENT(IN) :: co_auto
1198 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: wgt0, wgt1
1199 REAL*8,
DIMENSION(:),
INTENT(IN) :: rasparams
1200 REAL*8,
DIMENSION(:),
INTENT(IN) :: estblx
1202 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: tho, qho
1203 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: thod, qhod
1205 INTEGER :: i, ic, l, kk, k
1207 REAL*8,
PARAMETER :: onepkap=1.+2./7., daylen=86400.0
1208 REAL*8,
PARAMETER :: rhmax=0.9999
1209 REAL*8,
PARAMETER :: cbl_qpert=0.0, cbl_tpert=1.0
1210 REAL*8,
PARAMETER :: cbl_tpert_mxocn=2.0, cbl_tpert_mxlnd=4.0
1212 REAL*8 :: grav, cp, alhl, cpbg, alhi, cpi, gravi, ddt, lbcp
1214 REAL*8 :: fricfac, cli_crit, rasal1, rasal2
1215 REAL*8 :: friclambda
1216 REAL*8 :: sdqv2, sdqv3, sdqvt1
1217 REAL*8 :: acritfac, pblfrac, autorampb
1218 REAL*8 :: maxdallowed, rhmn, rhmx
1220 REAL*8 :: tx2, tx3, akm, acr, alm, tth, qqh, dqx
1221 REAL*8 :: tx2d, akmd, almd
1222 REAL*8 :: wfn, tem, trg, trgexp, evp, wlq, qcc
1223 REAL*8 :: wfnd, temd, trgd
1224 REAL*8 :: cli, te_a, c00_x, cli_crit_x, toki
1226 REAL*8 :: dt_lyr, rate, cvw_x, closs, f2, f3, f4
1227 REAL*8 :: wght0, prcbl, rndu
1228 REAL*8 :: lambda_min, lambda_max
1229 REAL*8 :: tpert, qpert
1231 REAL*8,
DIMENSION(k0) :: poi_sv, qoi_sv
1232 REAL*8,
DIMENSION(k0) :: poi_svd, qoi_svd
1233 REAL*8,
DIMENSION(k0) :: poi, qoi, dqq, bet, gam, cll
1234 REAL*8,
DIMENSION(k0) :: poid, qoid, dqqd, betd, gamd
1235 REAL*8,
DIMENSION(k0) :: poi_c, qoi_c
1236 REAL*8,
DIMENSION(k0) :: poi_cd, qoi_cd
1237 REAL*8,
DIMENSION(k0) :: prh, pri, ght, dpt, dpb, pki
1238 REAL*8,
DIMENSION(k0) :: prhd, prid, ghtd, dptd, dpbd, pkid
1239 REAL*8,
DIMENSION(k0) :: cln, rns, pol, dm
1240 REAL*8,
DIMENSION(k0) :: pold
1241 REAL*8,
DIMENSION(k0) :: qst, ssl, rmf, rnn, rn1, rmfc, rmfp
1242 REAL*8,
DIMENSION(k0) :: qstd, ssld
1243 REAL*8,
DIMENSION(k0) :: gms, eta, gmh, eht, gm1, hcc, rmfd
1244 REAL*8,
DIMENSION(k0) :: gmsd, etad, gmhd, ehtd, hccd
1245 REAL*8,
DIMENSION(k0) :: hol, hst, qol, zol, hcld, cll0, cllx, clli
1246 REAL*8,
DIMENSION(k0) :: hold, hstd, qold, zold
1247 REAL*8,
DIMENSION(k0) :: bke, cvw, updfrc
1248 REAL*8,
DIMENSION(k0) :: rasal, updfrp, bk2, dll0, dllx
1249 REAL*8,
DIMENSION(k0) :: rasald
1250 REAL*8,
DIMENSION(k0) :: wght, massf
1251 REAL*8,
DIMENSION(k0) :: wghtd
1252 REAL*8,
DIMENSION(k0) :: qss, dqs, pf, pk, tempf, zlo
1253 REAL*8,
DIMENSION(k0) :: qssd, dqsd, tempfd, zlod
1254 REAL*8,
DIMENSION(k0 + 1) :: prj, prs, qht, sht, zet, zle, pke
1255 REAL*8,
DIMENSION(k0+1) :: prjd, prsd, qhtd, shtd, zetd, zled
1261 REAL*8,
DIMENSION(k0+1) :: pwx1
1263 REAL*8,
DIMENSION(k0) :: pwx10
1273 fricfac = rasparams(1)
1275 cli_crit = rasparams(4)
1277 rasal1 = rasparams(5)
1279 rasal2 = rasparams(6)
1281 friclambda = rasparams(11)
1283 sdqv2 = rasparams(14)
1285 sdqv3 = rasparams(15)
1287 sdqvt1 = rasparams(16)
1289 acritfac = rasparams(17)
1291 pblfrac = rasparams(20)
1293 autorampb = rasparams(21)
1295 rhmn = rasparams(24)
1297 maxdallowed = rasparams(23)
1299 rhmx = rasparams(25)
1334 pwx1 = ple(i, :)/1000.
1335 pwy1 = cons_rgas/cons_cp
1337 pf = 0.5*(ple(i, 1:k0)+ple(i, 2:k0+1))
1339 pwy1 = cons_rgas/cons_cp
1341 tempfd = pk*thod(i, :)
1342 tempf = tho(i, :)*pk
1350 zled(l) = thod(i, l)*(1.+cons_vireps*qho(i, l)) + tho(i, l)*&
1351 & cons_vireps*qhod(i, l)
1352 zle(l) = tho(i, l)*(1.+cons_vireps*qho(i, l))
1353 zlod(l) = zled(l+1) + cons_cp*(pke(l+1)-pk(l))*zled(l)/cons_grav
1354 zlo(l) = zle(l+1) + cons_cp/cons_grav*(pke(l+1)-pk(l))*zle(l)
1355 zled(l) = zlod(l) + cons_cp*(pk(l)-pke(l))*zled(l)/cons_grav
1356 zle(l) = zlo(l) + cons_cp/cons_grav*(pk(l)-pke(l))*zle(l)
1358 tpertd = cbl_tpert*(-tempfd(k0)-cons_grav*zlod(k0)/cons_cp)
1359 tpert = cbl_tpert*(ts(i)-(tempf(k0)+cons_grav*zlo(k0)/cons_cp))
1362 IF (tpert .LT. 0.0)
THEN 1368 IF (qpert .LT. 0.0)
THEN 1373 IF (frland(i) .LT. 0.1)
THEN 1374 IF (tpert .GT. cbl_tpert_mxocn)
THEN 1375 tpert = cbl_tpert_mxocn
1380 ELSE IF (tpert .GT. cbl_tpert_mxlnd)
THEN 1381 tpert = cbl_tpert_mxlnd
1386 CALL dqsat_ras_d(dqs, dqsd, qss, qssd, tempf, tempfd, pf, k0, &
1387 & estblx, cons_h2omw, cons_airmw)
1396 prsd(icmin:k0+1) = 0.0_8
1397 prs(icmin:k0+1) = ple(i, icmin:k0+1)
1399 poid(icmin:k) = thod(i, icmin:k)
1400 poi(icmin:k) = tho(i, icmin:k)
1402 qoid(icmin:k) = qhod(i, icmin:k)
1403 qoi(icmin:k) = qho(i, icmin:k)
1404 qstd(icmin:k) = qssd(icmin:k)
1405 qst(icmin:k) = qss(icmin:k)
1406 dqqd(icmin:k) = dqsd(icmin:k)
1407 dqq(icmin:k) = dqs(icmin:k)
1409 massf(:) = wgt0(i, :)
1413 prcbl = prcbl + massf(l)*(prs(l+1)-prs(l))
1417 pwx11 = prs(k+1)/1000.
1418 pwy1 = cons_rgas/cons_cp
1420 prj(k+1) = pwx11**pwy1
1423 pol(l) = 0.5*(prs(l)+prs(l+1))
1425 prh(l) = (prs(l+1)*prj(l+1)-prs(l)*prj(l))/(onepkap*(prs(l+1)-&
1430 dpt(l) = prh(l) - prj(l)
1432 dpb(l) = prj(l+1) - prh(l)
1434 pri(l) = .01/(prs(l+1)-prs(l))
1446 wght(l) = massf(l)*(ple(i, l+1)-ple(i, l))/(prs(k+1)-prs(k))
1449 poid(k) = poid(k) + wght(l)*thod(i, l)
1450 poi(k) = poi(k) + wght(l)*tho(i, l)
1451 qoid(k) = qoid(k) + wght(l)*qhod(i, l)
1452 qoi(k) = qoi(k) + wght(l)*qho(i, l)
1454 CALL dqsats_ras_d(dqq(k), dqqd(k), qst(k), qstd(k), poi(k)*prh(k&
1455 & ), prh(k)*poid(k), pol(k), estblx, cons_h2omw, &
1458 IF (seedras(i)/1000000. .LT. 1e-6)
THEN 1461 rndu = seedras(i)/1000000.
1463 pwr1 = rndu**(-(1./2.))
1464 mxdiam = maxdallowed*pwr1
1467 betd(l) = pki(l)*dqqd(l)
1468 bet(l) = dqq(l)*pki(l)
1470 gamd(l) = -(pki(l)*lbcp*dqqd(l)/(1.0+lbcp*dqq(l))**2)
1471 gam(l) = pki(l)/(1.0+lbcp*dqq(l))
1473 ghtd(l+1) = dpb(l)*gamd(l) + dpt(l+1)*gamd(l+1)
1474 ght(l+1) = gam(l)*dpb(l) + gam(l+1)*dpt(l+1)
1475 gm1(l+1) = 0.5*lbcp*(dqq(l)/(alhl*(1.0+lbcp*dqq(l)))+dqq(l+1)/&
1476 & (alhl*(1.0+lbcp*dqq(l+1))))
1501 shtd(k+1) = cp*prj(k+1)*poid(k)
1502 sht(k+1) = cp*poi(k)*prj(k+1)
1505 IF (qst(l)*rhmax .GT. qoi(l))
THEN 1509 qold(l) = rhmax*qstd(l)
1510 qol(l) = qst(l)*rhmax
1512 IF (0.000 .LT. qol(l))
THEN 1518 ssld(l) = cp*prj(l+1)*poid(l) + grav*zetd(l+1)
1519 ssl(l) = cp*prj(l+1)*poi(l) + grav*zet(l+1)
1520 hold(l) = ssld(l) + alhl*qold(l)
1521 hol(l) = ssl(l) + qol(l)*alhl
1522 hstd(l) = ssld(l) + alhl*qstd(l)
1523 hst(l) = ssl(l) + qst(l)*alhl
1524 temd = (prj(l+1)-prj(l))*cpbg*poid(l)
1525 tem = poi(l)*(prj(l+1)-prj(l))*cpbg
1526 zetd(l) = zetd(l+1) + temd
1527 zet(l) = zet(l+1) + tem
1528 zold(l) = zetd(l+1) + (prj(l+1)-prh(l))*cpbg*poid(l)
1529 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi(l)*cpbg
1533 IF (1. .GT. (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn))
THEN 1534 trgd = (qoid(k)*qst(k)-qoi(k)*qstd(k))/qst(k)**2/(rhmx-rhmn)
1535 trg = (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn)
1540 IF (0.0 .LT. (autorampb-sige(ic))/0.2)
THEN 1541 y1 = (autorampb-sige(ic))/0.2
1545 IF (1.0 .GT. y1)
THEN 1550 IF (trg .GT. 1.0e-5)
THEN 1557 poi_cd(k) = poi_cd(k) + tpertd
1558 poi_c(k) = poi_c(k) + tpert
1559 qoi_c(k) = qoi_c(k) + qpert
1562 shtd(k+1) = cp*prj(k+1)*poi_cd(k)
1563 sht(k+1) = cp*poi_c(k)*prj(k+1)
1565 IF (qst(l)*rhmax .GT. qoi_c(l))
THEN 1569 qold(l) = rhmax*qstd(l)
1570 qol(l) = qst(l)*rhmax
1572 IF (0.000 .LT. qol(l))
THEN 1578 ssld(l) = cp*prj(l+1)*poi_cd(l) + grav*zetd(l+1)
1579 ssl(l) = cp*prj(l+1)*poi_c(l) + grav*zet(l+1)
1580 hold(l) = ssld(l) + alhl*qold(l)
1581 hol(l) = ssl(l) + qol(l)*alhl
1582 hstd(l) = ssld(l) + alhl*qstd(l)
1583 hst(l) = ssl(l) + qst(l)*alhl
1584 temd = (prj(l+1)-prj(l))*cpbg*poi_cd(l)
1585 tem = poi_c(l)*(prj(l+1)-prj(l))*cpbg
1586 zetd(l) = zetd(l+1) + temd
1587 zet(l) = zet(l+1) + tem
1588 zold(l) = zetd(l+1) + (prj(l+1)-prh(l))*cpbg*poi_cd(l)
1589 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi_c(l)*cpbg
1592 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
1593 shtd(l) = ssld(l-1) + tem*(ssld(l)-ssld(l-1))
1594 sht(l) = ssl(l-1) + tem*(ssl(l)-ssl(l-1))
1595 qhtd(l) = .5*(qold(l)+qold(l-1))
1596 qht(l) = .5*(qol(l)+qol(l-1))
1599 lambda_min = .2/mxdiam
1600 lambda_max = .2/200.
1601 IF (hol(k) .GT. hst(ic))
THEN 1604 temd = (hstd(ic)-hold(ic))*(zol(ic)-zet(ic+1)) + (hst(ic)-&
1605 & hol(ic))*(zold(ic)-zetd(ic+1))
1606 tem = (hst(ic)-hol(ic))*(zol(ic)-zet(ic+1))
1608 temd = temd + (hstd(ic)-hold(l))*(zet(l)-zet(l+1)) + (hst(&
1609 & ic)-hol(l))*(zetd(l)-zetd(l+1))
1610 tem = tem + (hst(ic)-hol(l))*(zet(l)-zet(l+1))
1612 IF (tem .GT. 0.0)
THEN 1614 almd = ((hold(k)-hstd(ic))*tem-(hol(k)-hst(ic))*temd)/tem&
1616 alm = (hol(k)-hst(ic))/tem
1617 IF (alm .LE. lambda_max)
THEN 1620 IF (alm .LT. lambda_min)
THEN 1621 tokid = 2*alm*almd/lambda_min**2
1622 toki = (alm/lambda_min)**2
1628 etad(l) = almd*(zet(l)-zet(k)) + alm*(zetd(l)-zetd(k))
1629 eta(l) = 1.0 + alm*(zet(l)-zet(k))
1631 etad(ic) = almd*(zol(ic)-zet(k)) + alm*(zold(ic)-zetd(k)&
1633 eta(ic) = 1.0 + alm*(zol(ic)-zet(k))
1640 hccd(l) = hccd(l+1) + (etad(l)-etad(l+1))*hol(l) + (&
1641 & eta(l)-eta(l+1))*hold(l)
1642 hcc(l) = hcc(l+1) + (eta(l)-eta(l+1))*hol(l)
1643 temd = dpb(l)*hccd(l+1) + dpt(l)*hccd(l)
1644 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
1645 ehtd(l) = dpb(l)*etad(l+1) + dpt(l)*etad(l)
1646 eht(l) = eta(l+1)*dpb(l) + eta(l)*dpt(l)
1647 wfnd = wfnd + (temd-ehtd(l)*hst(l)-eht(l)*hstd(l))*gam&
1648 & (l) + (tem-eht(l)*hst(l))*gamd(l)
1649 wfn = wfn + (tem-eht(l)*hst(l))*gam(l)
1651 hccd(ic) = hstd(ic)*eta(ic) + hst(ic)*etad(ic)
1652 hcc(ic) = hst(ic)*eta(ic)
1653 wfnd = wfnd + dpb(ic)*((hccd(ic+1)-hstd(ic)*eta(ic+1)-&
1654 & hst(ic)*etad(ic+1))*gam(ic)+(hcc(ic+1)-hst(ic)*eta(ic+&
1656 wfn = wfn + (hcc(ic+1)-hst(ic)*eta(ic+1))*gam(ic)*dpb(ic&
1663 hcld(l) = (eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l)&
1665 tem = (hcld(l)-hst(l))*(zet(l)-zet(l+1))/(1.0+lbcp*dqq&
1667 bke(l) = bke(l+1) + grav*tem/(cp*prj(l+1)*poi(l))
1668 IF (tem .LT. 0.0)
THEN 1673 bk2(l) = bk2(l+1) + grav*max1/(cp*prj(l+1)*poi(l))
1674 IF (bk2(l) .LT. 0.0)
THEN 1679 cvw(l) = sqrt(2.0*max2)
1682 IF (zet(ic) .LT. 2000.)
THEN 1686 IF (zet(ic) .GE. 2000.)
THEN 1687 rasald(ic) = (rasal2-rasal1)*zetd(ic)/8000.
1688 rasal(ic) = rasal1 + (rasal2-rasal1)*(zet(ic)-2000.)/&
1691 IF (rasal(ic) .GT. 1.0e5)
THEN 1695 rasal(ic) = rasal(ic)
1697 rasald(ic) = -(dt*rasald(ic)/rasal(ic)**2)
1698 rasal(ic) = dt/rasal(ic)
1699 WHERE (cvw(ic:k) .LT. 1.00)
1702 cvw(ic:k) = cvw(ic:k)
1704 CALL acritn(pol(ic), prs(k), acr, acritfac)
1705 IF (wfn .GT. acr)
THEN 1711 tem = eta(l) - eta(l+1)
1712 wlq = wlq + tem*qol(l)
1714 tx2 = 0.5*(qst(l)+qst(l-1))*eta(l)
1715 tx3 = 0.5*(hst(l)+hst(l-1))*eta(l)
1716 qcc = tx2 + gm1(l)*(hcc(l)-tx3)
1719 cll0(l) = wlq - qst(ic)*eta(ic)
1721 IF (cll0(l) .LT. 0.00)
THEN 1726 cli = cll0(l)/eta(l)
1727 te_a = poi(l)*prh(l)
1728 CALL sundq3_ice(te_a, sdqv2, sdqv3, sdqvt1, f2, f3)
1729 c00_x = co_auto(i)*f2*f3*f4
1730 cli_crit_x = cli_crit/(f2*f3)
1731 arg1 = -(cli**2/cli_crit_x**2)
1732 rate = c00_x*(1.0-exp(arg1))
1733 IF (cvw(l) .LT. 1.00)
THEN 1738 dt_lyr = (zet(l)-zet(l+1))/cvw_x
1739 closs = cll0(l)*rate*dt_lyr
1740 IF (closs .GT. cll0(l))
THEN 1745 cll0(l) = cll0(l) - closs
1747 IF (closs .GT. 0.)
THEN 1754 wlq = wlq - qst(ic)*eta(ic)
1756 gmsd(k) = pri(k)*(shtd(k)-ssld(k))
1757 gms(k) = (sht(k)-ssl(k))*pri(k)
1758 gmhd(k) = gmsd(k) + pri(k)*alhl*(qhtd(k)-qold(k))
1759 gmh(k) = gms(k) + (qht(k)-qol(k))*pri(k)*alhl
1760 akmd = dpb(k-1)*(gmhd(k)*gam(k-1)+gmh(k)*gamd(k-1))
1761 akm = gmh(k)*gam(k-1)*dpb(k-1)
1765 gmsd(l) = pri(l)*(etad(l)*(sht(l)-ssl(l))+eta(l)*(&
1766 & shtd(l)-ssld(l))+etad(l+1)*(ssl(l)-sht(l+1))+eta(l&
1767 & +1)*(ssld(l)-shtd(l+1)))
1768 gms(l) = (eta(l)*(sht(l)-ssl(l))+eta(l+1)*(ssl(l)-&
1770 gmhd(l) = gmsd(l) + alhl*pri(l)*(etad(l)*(qht(l)-qol&
1771 & (l))+eta(l)*(qhtd(l)-qold(l))+etad(l+1)*(qol(l)-&
1772 & qht(l+1))+eta(l+1)*(qold(l)-qhtd(l+1)))
1773 gmh(l) = gms(l) + (eta(l)*(qht(l)-qol(l))+eta(l+1)*(&
1774 & qol(l)-qht(l+1)))*alhl*pri(l)
1775 tx2d = tx2d + (etad(l)-etad(l+1))*gmh(l) + (eta(l)-&
1777 tx2 = tx2 + (eta(l)-eta(l+1))*gmh(l)
1778 akmd = akmd - pki(l)*(gmsd(l)*eht(l)+gms(l)*ehtd(l))&
1779 & + tx2d*ght(l) + tx2*ghtd(l)
1780 akm = akm - gms(l)*eht(l)*pki(l) + tx2*ght(l)
1782 gmsd(ic) = pri(ic)*(etad(ic+1)*(ssl(ic)-sht(ic+1))+eta&
1783 & (ic+1)*(ssld(ic)-shtd(ic+1)))
1784 gms(ic) = eta(ic+1)*(ssl(ic)-sht(ic+1))*pri(ic)
1785 akmd = akmd - dpb(ic)*pki(ic)*(gmsd(ic)*eta(ic+1)+gms(&
1787 akm = akm - gms(ic)*eta(ic+1)*dpb(ic)*pki(ic)
1788 gmhd(ic) = gmsd(ic) + pri(ic)*(alhl*(etad(ic+1)*(qol(&
1789 & ic)-qht(ic+1))+eta(ic+1)*(qold(ic)-qhtd(ic+1)))+etad&
1790 & (ic)*(hst(ic)-hol(ic))+eta(ic)*(hstd(ic)-hold(ic)))
1791 gmh(ic) = gms(ic) + (eta(ic+1)*(qol(ic)-qht(ic+1))*&
1792 & alhl+eta(ic)*(hst(ic)-hol(ic)))*pri(ic)
1794 IF (.NOT.(akm .GE. 0.0 .OR. wlq .LT. 0.0))
THEN 1796 wfnd = -((wfnd*akm-(wfn-acr)*akmd)/akm**2)
1797 wfn = -((wfn-acr)/akm)
1798 x1d = (rasald(ic)*wfn+rasal(ic)*wfnd)*trg*toki + &
1799 & rasal(ic)*wfn*(trgd*toki+trg*tokid)
1800 x1 = rasal(ic)*trg*toki*wfn
1801 IF (x1 .GT. (prs(k+1)-prs(k))*(100.*pblfrac))
THEN 1802 wfn = (prs(k+1)-prs(k))*(100.*pblfrac)
1810 cll(ic) = cll(ic) + wlq*tem
1811 rmf(ic) = rmf(ic) + tem
1812 rmfd(ic) = rmfd(ic) + tem*eta(ic)
1814 rmfp(l) = tem*eta(l)
1815 rmfc(l) = rmfc(l) + rmfp(l)
1816 dllx(l) = dllx(l) + tem*dll0(l)
1817 IF (cvw(l) .GT. 0.0)
THEN 1818 updfrp(l) = rmfp(l)*(ddt/daylen)*1000./(cvw(l)*&
1823 clli(l) = cll0(l)/eta(l)
1824 updfrc(l) = updfrc(l) + updfrp(l)
1828 rns(l) = rns(l) + rnn(l)*tem
1829 gmhd(l) = gmhd(l)*wfn + gmh(l)*wfnd
1831 gmsd(l) = gmsd(l)*wfn + gms(l)*wfnd
1833 qoid(l) = qoid(l) + alhi*(gmhd(l)-gmsd(l))
1834 qoi(l) = qoi(l) + (gmh(l)-gms(l))*alhi
1835 poid(l) = poid(l) + pki(l)*cpi*gmsd(l)
1836 poi(l) = poi(l) + gms(l)*pki(l)*cpi
1837 qstd(l) = qstd(l) + cpi*(gmsd(l)*bet(l)+gms(l)*&
1839 qst(l) = qst(l) + gms(l)*bet(l)*cpi
1849 IF (sum(rmf(icmin:k)) .GT. 0.0)
THEN 1850 thod(i, icmin:k-1) = poid(icmin:k-1)
1851 tho(i, icmin:k-1) = poi(icmin:k-1)
1852 qhod(i, icmin:k-1) = qoid(icmin:k-1)
1853 qho(i, icmin:k-1) = qoi(icmin:k-1)
1859 wght0 = wght0 + wght(l)*(ple(i, l+1)-ple(i, l))
1861 wght0 = (prs(k+1)-prs(k))/wght0
1864 thod(i, l) = thod(i, l) + wght(l)*(poid(k)-poi_svd(k))
1865 tho(i, l) = tho(i, l) + wght(l)*(poi(k)-poi_sv(k))
1866 qhod(i, l) = qhod(i, l) + wght(l)*(qoid(k)-qoi_svd(k))
1867 qho(i, l) = qho(i, l) + wght(l)*(qoi(k)-qoi_sv(k))
1874 SUBROUTINE rase_tracer_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, &
1875 & cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, &
1876 & sige, kcbl, wgt0, wgt1, frland, ts, thoin, qhoin, uhoin, vhoin, &
1877 & co_auto, ple, rasparams, estblx, itrcr, xho, xhod, fscav)
1880 INTEGER,
INTENT(IN) :: idim, irun, k0, icmin
1881 REAL*8,
DIMENSION(idim, k0 + 1),
INTENT(IN) :: ple
1882 REAL*8,
DIMENSION(k0 + 1),
INTENT(IN) :: sige
1883 REAL*8,
INTENT(IN) :: dt, cons_cp, cons_alhl, cons_grav, cons_rgas
1884 REAL*8,
INTENT(IN) :: cons_h2omw, cons_airmw, cons_vireps
1885 INTEGER,
DIMENSION(idim),
INTENT(IN) :: seedras
1886 INTEGER,
DIMENSION(idim),
INTENT(IN) :: kcbl
1887 REAL*8,
DIMENSION(idim),
INTENT(IN) :: ts, frland
1888 REAL*8,
DIMENSION(idim),
INTENT(IN) :: co_auto
1889 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: wgt0, wgt1
1890 REAL*8,
DIMENSION(:),
INTENT(IN) :: rasparams
1891 REAL*8,
DIMENSION(:),
INTENT(IN) :: estblx
1892 INTEGER,
INTENT(IN) :: itrcr
1893 REAL*8,
DIMENSION(itrcr),
INTENT(IN) :: fscav
1894 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: thoin, qhoin, uhoin, vhoin
1896 REAL*8,
DIMENSION(idim, k0, itrcr),
INTENT(INOUT) :: xho
1897 REAL*8,
DIMENSION(idim, k0, itrcr),
INTENT(INOUT) :: xhod
1899 INTEGER :: i, ic, l, kk, k
1901 REAL*8,
PARAMETER :: onepkap=1.+2./7., daylen=86400.0
1902 REAL*8,
PARAMETER :: rhmax=0.9999
1903 REAL*8,
PARAMETER :: cbl_qpert=0.0, cbl_tpert=1.0
1904 REAL*8,
PARAMETER :: cbl_tpert_mxocn=2.0, cbl_tpert_mxlnd=4.0
1906 REAL*8 :: grav, cp, alhl, cpbg, alhi, cpi, gravi, ddt, lbcp
1908 REAL*8 :: fricfac, cli_crit, rasal1, rasal2
1909 REAL*8 :: friclambda
1910 REAL*8 :: sdqv2, sdqv3, sdqvt1
1911 REAL*8 :: acritfac, pblfrac, autorampb
1912 REAL*8 :: maxdallowed, rhmn, rhmx
1914 REAL*8 :: tx2, tx3, akm, acr, alm, tth, qqh, dqx
1915 REAL*8 :: wfn, tem, trg, trgexp, evp, wlq, qcc
1916 REAL*8 :: cli, te_a, c00_x, cli_crit_x, toki
1917 REAL*8 :: dt_lyr, rate, cvw_x, closs, f2, f3, f4
1918 REAL*8 :: wght0, prcbl, rndu
1919 REAL*8 :: lambda_min, lambda_max
1920 REAL*8 :: tpert, qpert
1922 REAL*8,
DIMENSION(k0) :: poi_sv, qoi_sv, uoi_sv, voi_sv
1923 REAL*8,
DIMENSION(k0) :: poi, qoi, uoi, voi, dqq, bet, gam, cll
1924 REAL*8,
DIMENSION(k0) :: poid, qoid, dqqd, betd, gamd
1925 REAL*8,
DIMENSION(k0) :: poi_c, qoi_c
1926 REAL*8,
DIMENSION(k0) :: poi_cd, qoi_cd
1927 REAL*8,
DIMENSION(k0) :: prh, pri, ght, dpt, dpb, pki
1928 REAL*8,
DIMENSION(k0) :: prhd, prid, ghtd, dptd, dpbd, pkid
1929 REAL*8,
DIMENSION(k0) :: ucu, vcu
1930 REAL*8,
DIMENSION(k0) :: cln, rns, pol
1931 REAL*8,
DIMENSION(k0) :: pold
1932 REAL*8,
DIMENSION(k0) :: qst, ssl, rmf, rnn, rn1, rmfc, rmfp
1933 REAL*8,
DIMENSION(k0) :: qstd, ssld
1934 REAL*8,
DIMENSION(k0) :: gms, eta, gmh, eht, gm1, hcc, rmfd
1935 REAL*8,
DIMENSION(k0) :: gmsd, etad, gmhd, ehtd, hccd
1936 REAL*8,
DIMENSION(k0) :: hol, hst, qol, zol, hcld, cll0, cllx, clli
1937 REAL*8,
DIMENSION(k0) :: hold, hstd, qold, zold
1938 REAL*8,
DIMENSION(k0) :: bke, cvw, updfrc
1939 REAL*8,
DIMENSION(k0) :: rasal, updfrp, bk2, dll0, dllx
1940 REAL*8,
DIMENSION(k0) :: rasald
1941 REAL*8,
DIMENSION(k0) :: wght, massf
1942 REAL*8,
DIMENSION(k0) :: wghtd
1943 REAL*8,
DIMENSION(k0) :: qss, dqs, pf, pk, tempf, zlo
1944 REAL*8,
DIMENSION(k0) :: zlod
1945 REAL*8,
DIMENSION(k0 + 1) :: prj, prs, qht, sht, zet, zle, pke
1946 REAL*8,
DIMENSION(k0+1) :: prjd, prsd, qhtd, shtd, zetd, zled
1947 REAL*8,
DIMENSION(idim, k0) :: tho, qho, uho, vho
1954 REAL*8,
DIMENSION(k0, itrcr) :: xoi, xcu, xoi_sv
1955 REAL*8,
DIMENSION(k0, itrcr) :: xoid, xcud, xoi_svd
1956 REAL*8,
DIMENSION(itrcr) :: xht
1957 REAL*8,
DIMENSION(itrcr) :: xhtd
1963 REAL*8,
DIMENSION(k0+1) :: pwx1
1965 REAL*8,
DIMENSION(k0) :: pwx10
2040 fricfac = rasparams(1)
2042 cli_crit = rasparams(4)
2044 rasal1 = rasparams(5)
2046 rasal2 = rasparams(6)
2048 friclambda = rasparams(11)
2050 sdqv2 = rasparams(14)
2052 sdqv3 = rasparams(15)
2054 sdqvt1 = rasparams(16)
2056 acritfac = rasparams(17)
2058 pblfrac = rasparams(20)
2060 autorampb = rasparams(21)
2062 rhmn = rasparams(24)
2064 maxdallowed = rasparams(23)
2066 rhmx = rasparams(25)
2081 pwx1 = ple(i, :)/1000.
2082 pwy1 = cons_rgas/cons_cp
2084 pf = 0.5*(ple(i, 1:k0)+ple(i, 2:k0+1))
2086 pwy1 = cons_rgas/cons_cp
2088 tempf = tho(i, :)*pk
2095 zle(l) = tho(i, l)*(1.+cons_vireps*qho(i, l))
2097 zlo(l) = zle(l+1) + cons_cp/cons_grav*(pke(l+1)-pk(l))*zle(l)
2099 zle(l) = zlo(l) + cons_cp/cons_grav*(pk(l)-pke(l))*zle(l)
2101 tpert = cbl_tpert*(ts(i)-(tempf(k0)+cons_grav*zlo(k0)/cons_cp))
2104 IF (tpert .LT. 0.0)
THEN 2109 IF (qpert .LT. 0.0)
THEN 2114 IF (frland(i) .LT. 0.1)
THEN 2115 IF (tpert .GT. cbl_tpert_mxocn)
THEN 2116 tpert = cbl_tpert_mxocn
2120 ELSE IF (tpert .GT. cbl_tpert_mxlnd)
THEN 2121 tpert = cbl_tpert_mxlnd
2125 CALL dqsat_ras(dqs, qss, tempf, pf, k0, estblx, cons_h2omw, &
2131 prsd(icmin:k0+1) = 0.0_8
2132 prs(icmin:k0+1) = ple(i, icmin:k0+1)
2133 poid(icmin:k) = 0.0_8
2134 poi(icmin:k) = tho(i, icmin:k)
2135 qoid(icmin:k) = 0.0_8
2136 qoi(icmin:k) = qho(i, icmin:k)
2137 uoi(icmin:k) = uho(i, icmin:k)
2138 voi(icmin:k) = vho(i, icmin:k)
2139 qstd(icmin:k) = 0.0_8
2140 qst(icmin:k) = qss(icmin:k)
2141 dqqd(icmin:k) = 0.0_8
2142 dqq(icmin:k) = dqs(icmin:k)
2146 xoid(icmin:k, itr) = xhod(i, icmin:k, itr)
2147 xoi(icmin:k, itr) = xho(i, icmin:k, itr)
2150 massf(:) = wgt0(i, :)
2154 prcbl = prcbl + massf(l)*(prs(l+1)-prs(l))
2158 pwx11 = prs(k+1)/1000.
2159 pwy1 = cons_rgas/cons_cp
2161 prj(k+1) = pwx11**pwy1
2164 pol(l) = 0.5*(prs(l)+prs(l+1))
2166 prh(l) = (prs(l+1)*prj(l+1)-prs(l)*prj(l))/(onepkap*(prs(l+1)-prs(&
2171 dpt(l) = prh(l) - prj(l)
2173 dpb(l) = prj(l+1) - prh(l)
2175 pri(l) = .01/(prs(l+1)-prs(l))
2189 wght(l) = massf(l)*(ple(i, l+1)-ple(i, l))/(prs(k+1)-prs(k))
2193 poi(k) = poi(k) + wght(l)*tho(i, l)
2195 qoi(k) = qoi(k) + wght(l)*qho(i, l)
2196 uoi(k) = uoi(k) + wght(l)*uho(i, l)
2197 voi(k) = voi(k) + wght(l)*vho(i, l)
2204 xoid(k, itr) = xoid(k, itr) + wght(l)*xhod(i, l, itr)
2205 xoi(k, itr) = xoi(k, itr) + wght(l)*xho(i, l, itr)
2208 CALL dqsats_ras(dqq(k), qst(k), poi(k)*prh(k), pol(k), estblx, &
2209 & cons_h2omw, cons_airmw)
2211 IF (seedras(i)/1000000. .LT. 1e-6)
THEN 2214 rndu = seedras(i)/1000000.
2216 pwr1 = rndu**(-(1./2.))
2217 mxdiam = maxdallowed*pwr1
2221 bet(l) = dqq(l)*pki(l)
2224 gam(l) = pki(l)/(1.0+lbcp*dqq(l))
2227 ght(l+1) = gam(l)*dpb(l) + gam(l+1)*dpt(l+1)
2228 gm1(l+1) = 0.5*lbcp*(dqq(l)/(alhl*(1.0+lbcp*dqq(l)))+dqq(l+1)/(&
2229 & alhl*(1.0+lbcp*dqq(l+1))))
2258 sht(k+1) = cp*poi(k)*prj(k+1)
2260 IF (qst(l)*rhmax .GT. qoi(l))
THEN 2265 qol(l) = qst(l)*rhmax
2267 IF (0.000 .LT. qol(l))
THEN 2275 ssl(l) = cp*prj(l+1)*poi(l) + grav*zet(l+1)
2277 hol(l) = ssl(l) + qol(l)*alhl
2279 hst(l) = ssl(l) + qst(l)*alhl
2280 tem = poi(l)*(prj(l+1)-prj(l))*cpbg
2282 zet(l) = zet(l+1) + tem
2284 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi(l)*cpbg
2290 xcud(icmin:, :) = 0.0_8
2295 IF (1. .GT. (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn))
THEN 2296 trg = (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn)
2300 IF (0.0 .LT. (autorampb-sige(ic))/0.2)
THEN 2301 y1 = (autorampb-sige(ic))/0.2
2305 IF (1.0 .GT. y1)
THEN 2310 IF (trg .GT. 1.0e-5)
THEN 2316 poi_c(k) = poi_c(k) + tpert
2318 qoi_c(k) = qoi_c(k) + qpert
2322 sht(k+1) = cp*poi_c(k)*prj(k+1)
2324 IF (qst(l)*rhmax .GT. qoi_c(l))
THEN 2329 qol(l) = qst(l)*rhmax
2331 IF (0.000 .LT. qol(l))
THEN 2339 ssl(l) = cp*prj(l+1)*poi_c(l) + grav*zet(l+1)
2341 hol(l) = ssl(l) + qol(l)*alhl
2343 hst(l) = ssl(l) + qst(l)*alhl
2344 tem = poi_c(l)*(prj(l+1)-prj(l))*cpbg
2346 zet(l) = zet(l+1) + tem
2348 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi_c(l)*cpbg
2351 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
2353 sht(l) = ssl(l-1) + tem*(ssl(l)-ssl(l-1))
2355 qht(l) = .5*(qol(l)+qol(l-1))
2358 lambda_min = .2/mxdiam
2359 lambda_max = .2/200.
2360 IF (hol(k) .GT. hst(ic))
THEN 2363 tem = (hst(ic)-hol(ic))*(zol(ic)-zet(ic+1))
2365 tem = tem + (hst(ic)-hol(l))*(zet(l)-zet(l+1))
2367 IF (tem .GT. 0.0)
THEN 2369 alm = (hol(k)-hst(ic))/tem
2370 IF (alm .LE. lambda_max)
THEN 2373 IF (alm .LT. lambda_min) toki = (alm/lambda_min)**2
2377 eta(l) = 1.0 + alm*(zet(l)-zet(k))
2380 eta(ic) = 1.0 + alm*(zol(ic)-zet(k))
2387 hcc(l) = hcc(l+1) + (eta(l)-eta(l+1))*hol(l)
2388 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
2390 eht(l) = eta(l+1)*dpb(l) + eta(l)*dpt(l)
2391 wfn = wfn + (tem-eht(l)*hst(l))*gam(l)
2394 hcc(ic) = hst(ic)*eta(ic)
2395 wfn = wfn + (hcc(ic+1)-hst(ic)*eta(ic+1))*gam(ic)*dpb(ic)
2401 hcld(l) = (eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l))/&
2403 tem = (hcld(l)-hst(l))*(zet(l)-zet(l+1))/(1.0+lbcp*dqq(l&
2405 bke(l) = bke(l+1) + grav*tem/(cp*prj(l+1)*poi(l))
2406 IF (tem .LT. 0.0)
THEN 2411 bk2(l) = bk2(l+1) + grav*max1/(cp*prj(l+1)*poi(l))
2412 IF (bk2(l) .LT. 0.0)
THEN 2417 cvw(l) = sqrt(2.0*max2)
2420 IF (zet(ic) .LT. 2000.)
THEN 2424 IF (zet(ic) .GE. 2000.)
THEN 2426 rasal(ic) = rasal1 + (rasal2-rasal1)*(zet(ic)-2000.)/&
2429 IF (rasal(ic) .GT. 1.0e5)
THEN 2434 rasal(ic) = rasal(ic)
2437 rasal(ic) = dt/rasal(ic)
2439 IF (cvw(l) .LT. 1.00)
THEN 2445 CALL acritn(pol(ic), prs(k), acr, acritfac)
2446 IF (wfn .GT. acr)
THEN 2451 delzkm = (zet(ic)-zet(k))/1000.
2452 x4 = exp(-(fscav(itr)*delzkm))
2453 IF (x4 .GT. 1.)
THEN 2458 IF (x1 .LT. 0.)
THEN 2463 xhtd(itr) = fnoscav*xoid(k, itr)
2464 xht(itr) = xoi(k, itr)*fnoscav
2472 tem = eta(l) - eta(l+1)
2473 wlq = wlq + tem*qol(l)
2474 uht = uht + tem*uoi(l)
2475 vht = vht + tem*voi(l)
2479 delzkm = (zet(ic)-zet(l+1))/1000.
2480 x5 = exp(-(fscav(itr)*delzkm))
2481 IF (x5 .GT. 1.)
THEN 2486 IF (x2 .LT. 0.)
THEN 2491 xhtd(itr) = xhtd(itr) + tem*fnoscav*xoid(l, itr)
2492 xht(itr) = xht(itr) + tem*xoi(l, itr)*fnoscav
2495 tx2 = 0.5*(qst(l)+qst(l-1))*eta(l)
2496 tx3 = 0.5*(hst(l)+hst(l-1))*eta(l)
2497 qcc = tx2 + gm1(l)*(hcc(l)-tx3)
2500 cll0(l) = wlq - qst(ic)*eta(ic)
2502 IF (cll0(l) .LT. 0.00)
THEN 2507 cli = cll0(l)/eta(l)
2508 te_a = poi(l)*prh(l)
2509 CALL sundq3_ice(te_a, sdqv2, sdqv3, sdqvt1, f2, f3)
2510 c00_x = co_auto(i)*f2*f3*f4
2511 cli_crit_x = cli_crit/(f2*f3)
2512 arg1 = -(cli**2/cli_crit_x**2)
2513 rate = c00_x*(1.0-exp(arg1))
2514 IF (cvw(l) .LT. 1.00)
THEN 2519 dt_lyr = (zet(l)-zet(l+1))/cvw_x
2520 closs = cll0(l)*rate*dt_lyr
2521 IF (closs .GT. cll0(l))
THEN 2526 cll0(l) = cll0(l) - closs
2528 IF (closs .GT. 0.)
THEN 2535 wlq = wlq - qst(ic)*eta(ic)
2538 gms(k) = (sht(k)-ssl(k))*pri(k)
2540 gmh(k) = gms(k) + (qht(k)-qol(k))*pri(k)*alhl
2541 akm = gmh(k)*gam(k-1)*dpb(k-1)
2545 gms(l) = (eta(l)*(sht(l)-ssl(l))+eta(l+1)*(ssl(l)-sht(&
2548 gmh(l) = gms(l) + (eta(l)*(qht(l)-qol(l))+eta(l+1)*(&
2549 & qol(l)-qht(l+1)))*alhl*pri(l)
2550 tx2 = tx2 + (eta(l)-eta(l+1))*gmh(l)
2551 akm = akm - gms(l)*eht(l)*pki(l) + tx2*ght(l)
2554 gms(ic) = eta(ic+1)*(ssl(ic)-sht(ic+1))*pri(ic)
2555 akm = akm - gms(ic)*eta(ic+1)*dpb(ic)*pki(ic)
2557 gmh(ic) = gms(ic) + (eta(ic+1)*(qol(ic)-qht(ic+1))*alhl+&
2558 & eta(ic)*(hst(ic)-hol(ic)))*pri(ic)
2560 IF (.NOT.(akm .GE. 0.0 .OR. wlq .LT. 0.0))
THEN 2562 wfn = -((wfn-acr)/akm)
2563 x3 = rasal(ic)*trg*toki*wfn
2564 IF (x3 .GT. (prs(k+1)-prs(k))*(100.*pblfrac))
THEN 2565 wfn = (prs(k+1)-prs(k))*(100.*pblfrac)
2571 cll(ic) = cll(ic) + wlq*tem
2572 rmf(ic) = rmf(ic) + tem
2573 rmfd(ic) = rmfd(ic) + tem*eta(ic)
2575 rmfp(l) = tem*eta(l)
2576 rmfc(l) = rmfc(l) + rmfp(l)
2577 dllx(l) = dllx(l) + tem*dll0(l)
2578 IF (cvw(l) .GT. 0.0)
THEN 2579 updfrp(l) = rmfp(l)*(ddt/daylen)*1000./(cvw(l)*prs&
2584 clli(l) = cll0(l)/eta(l)
2585 updfrc(l) = updfrc(l) + updfrp(l)
2589 rns(l) = rns(l) + rnn(l)*tem
2595 qoi(l) = qoi(l) + (gmh(l)-gms(l))*alhi
2597 poi(l) = poi(l) + gms(l)*pki(l)*cpi
2599 qst(l) = qst(l) + gms(l)*bet(l)*cpi
2606 xcud(k, itr) = xcud(k, itr) + tem*(xoid(k-1, itr)-&
2608 xcu(k, itr) = xcu(k, itr) + tem*(xoi(k-1, itr)-xoi(k&
2614 xcud(l, itr) = xcud(l, itr) + tem*(eta(l)*(xoid(l-&
2615 & 1, itr)-xoid(l, itr))+eta(l+1)*(xoid(l, itr)-&
2617 xcu(l, itr) = xcu(l, itr) + tem*((xoi(l-1, itr)-&
2618 & xoi(l, itr))*eta(l)+(xoi(l, itr)-xoi(l+1, itr))*&
2624 xcud(ic, itr) = xcud(ic, itr) + tem*(2.*(xhtd(itr)-(&
2625 & eta(ic)-eta(ic+1))*xoid(ic, itr))-eta(ic+1)*(xoid(&
2626 & ic, itr)+xoid(ic+1, itr)))
2627 xcu(ic, itr) = xcu(ic, itr) + (2.*(xht(itr)-xoi(ic, &
2628 & itr)*(eta(ic)-eta(ic+1)))-(xoi(ic, itr)+xoi(ic+1, &
2629 & itr))*eta(ic+1))*tem
2633 xoid(l, itr) = xoid(l, itr) + xcud(l, itr)
2634 xoi(l, itr) = xoi(l, itr) + xcu(l, itr)
2639 IF (fricfac .GT. 0.0)
THEN 2641 wfn = wfn*fricfac*exp(-(alm/friclambda))
2643 ucu(k) = ucu(k) + tem*(uoi(k-1)-uoi(k))
2644 vcu(k) = vcu(k) + tem*(voi(k-1)-voi(k))
2647 ucu(l) = ucu(l) + tem*((uoi(l-1)-uoi(l))*eta(l)+(&
2648 & uoi(l)-uoi(l+1))*eta(l+1))
2649 vcu(l) = vcu(l) + tem*((voi(l-1)-voi(l))*eta(l)+(&
2650 & voi(l)-voi(l+1))*eta(l+1))
2653 ucu(ic) = ucu(ic) + (2.*(uht-uoi(ic)*(eta(ic)-eta(ic&
2654 & +1)))-(uoi(ic)+uoi(ic+1))*eta(ic+1))*tem
2655 vcu(ic) = vcu(ic) + (2.*(vht-voi(ic)*(eta(ic)-eta(ic&
2656 & +1)))-(voi(ic)+voi(ic+1))*eta(ic+1))*tem
2658 uoi(l) = uoi(l) + ucu(l)
2659 voi(l) = voi(l) + vcu(l)
2670 IF (sum(rmf(icmin:k)) .GT. 0.0)
THEN 2671 tho(i, icmin:k-1) = poi(icmin:k-1)
2672 qho(i, icmin:k-1) = qoi(icmin:k-1)
2673 uho(i, icmin:k-1) = uoi(icmin:k-1)
2674 vho(i, icmin:k-1) = voi(icmin:k-1)
2680 wght0 = wght0 + wght(l)*(ple(i, l+1)-ple(i, l))
2682 wght0 = (prs(k+1)-prs(k))/wght0
2685 tho(i, l) = tho(i, l) + wght(l)*(poi(k)-poi_sv(k))
2686 qho(i, l) = qho(i, l) + wght(l)*(qoi(k)-qoi_sv(k))
2687 uho(i, l) = uho(i, l) + wght(l)*(uoi(k)-uoi_sv(k))
2688 vho(i, l) = vho(i, l) + wght(l)*(voi(k)-voi_sv(k))
2691 xhod(i, icmin:k-1, :) = xoid(icmin:k-1, :)
2692 xho(i, icmin:k-1, :) = xoi(icmin:k-1, :)
2695 xhod(i, l, itr) = xhod(i, l, itr) + wght(l)*(xoid(k, itr)-&
2697 xho(i, l, itr) = xho(i, l, itr) + wght(l)*(xoi(k, itr)-xoi_sv(&
subroutine, public acritn(PL, PLB, ACR, ACRITFAC)
subroutine, public dqsat_ras(DQSi, QSSi, TEMP, PLO, lm, ESTBLX, CONS_H2OMW, CONS_AIRMW)
subroutine, public rase0_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, sige, kcbl, wgt0, wgt1, frland, ts, tho, thod, qho, qhod, co_auto, ple, rasparams, estblx)
subroutine, public dqsats_ras(DQSi, QSSi, TEMP, PLO, ESTBLX, CONS_H2OMW, CONS_AIRMW)
subroutine, public rase_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, sige, kcbl, wgt0, wgt1, frland, ts, tho, thod, qho, qhod, uho, uhod, vho, vhod, co_auto, ple, clw, clwd, flxd, flxdd, cnv_prc3, cnv_prc3d, cnv_updfrc, cnv_updfrcd, rasparams, estblx)
subroutine dqsats_ras_d(dqsi, dqsid, qssi, qssid, temp, tempd, plo, estblx, cons_h2omw, cons_airmw)
subroutine dqsat_ras_d(dqsi, dqsid, qssi, qssid, temp, tempd, plo, lm, estblx, cons_h2omw, cons_airmw)
subroutine, public sundq3_ice(TEMP, RATE2, RATE3, TE1, F2, F3)
subroutine sundq3_ice_d(temp, tempd, rate2, rate3, te1, f2, f2d, f3)
subroutine, public rase_tracer_d(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, sige, kcbl, wgt0, wgt1, frland, ts, thoin, qhoin, uhoin, vhoin, co_auto, ple, rasparams, estblx, itrcr, xho, xhod, fscav)