23 SUBROUTINE rase_b(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, &
24 & cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, &
25 & sige, kcbl, wgt0, wgt1, frland, ts, tho, thob, qho, qhob, uho, uhob, &
26 & vho, vhob, co_auto, ple, clw, clwb, flxd, flxdb, cnv_prc3, cnv_prc3b, &
27 & cnv_updfrc, cnv_updfrcb, rasparams, estblx)
30 INTEGER,
INTENT(IN) :: idim, irun, k0, icmin
31 REAL*8,
DIMENSION(idim, k0 + 1),
INTENT(IN) :: ple
32 REAL*8,
DIMENSION(k0 + 1),
INTENT(IN) :: sige
33 REAL*8,
INTENT(IN) :: dt, cons_cp, cons_alhl, cons_grav, cons_rgas
34 REAL*8,
INTENT(IN) :: cons_h2omw, cons_airmw, cons_vireps
35 INTEGER,
DIMENSION(idim),
INTENT(IN) :: seedras
36 INTEGER,
DIMENSION(idim),
INTENT(IN) :: kcbl
37 REAL*8,
DIMENSION(idim),
INTENT(IN) :: ts, frland
38 REAL*8,
DIMENSION(idim),
INTENT(IN) :: co_auto
39 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: wgt0, wgt1
40 REAL*8,
DIMENSION(:),
INTENT(IN) :: rasparams
41 REAL*8,
DIMENSION(:),
INTENT(IN) :: estblx
43 REAL*8,
DIMENSION(idim, k0) :: clw, flxd
44 REAL*8,
DIMENSION(idim, k0) :: clwb, flxdb
45 REAL*8,
DIMENSION(idim, k0) :: cnv_prc3
46 REAL*8,
DIMENSION(idim, k0) :: cnv_prc3b
47 REAL*8,
DIMENSION(idim, k0) :: cnv_updfrc
48 REAL*8,
DIMENSION(idim, k0) :: cnv_updfrcb
50 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: tho, qho, uho, vho
51 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: thob
53 INTEGER :: i, ic, l, kk, k
55 REAL*8,
PARAMETER :: onepkap=1.+2./7., daylen=86400.0
56 REAL*8,
PARAMETER :: rhmax=0.9999
57 REAL*8,
PARAMETER :: cbl_qpert=0.0, cbl_tpert=1.0
58 REAL*8,
PARAMETER :: cbl_tpert_mxocn=2.0, cbl_tpert_mxlnd=4.0
60 REAL*8 :: grav, cp, alhl, cpbg, alhi, cpi, gravi, ddt, lbcp
62 REAL*8 :: fricfac, cli_crit, rasal1, rasal2
64 REAL*8 :: sdqv2, sdqv3, sdqvt1
65 REAL*8 :: acritfac, pblfrac, autorampb
66 REAL*8 :: maxdallowed, rhmn, rhmx
68 REAL*8 :: tx2, tx3, akm, acr, alm, tth, qqh, dqx
69 REAL*8 :: tx2b, tx3b, akmb, almb
70 REAL*8 :: wfn, tem, trg, trgexp, evp, wlq, qcc
71 REAL*8 :: wfnb, temb, trgb, wlqb, qccb
72 REAL*8 :: cli, te_a, c00_x, cli_crit_x, toki
73 REAL*8 :: clib, te_ab, c00_xb, cli_crit_xb, tokib
74 REAL*8 :: dt_lyr, rate, cvw_x, closs, f2, f3, f4
75 REAL*8 :: dt_lyrb, rateb, cvw_xb, clossb, f2b
76 REAL*8 :: wght0, prcbl, rndu
77 REAL*8 :: lambda_min, lambda_max
78 REAL*8 :: tpert, qpert
82 REAL*8,
DIMENSION(k0) :: poi_sv, qoi_sv, uoi_sv, voi_sv
83 REAL*8,
DIMENSION(k0) :: poi_svb, qoi_svb, uoi_svb, voi_svb
84 REAL*8,
DIMENSION(k0) :: poi, qoi, uoi, voi, dqq, bet, gam, cll
85 REAL*8,
DIMENSION(k0) :: poib, qoib, uoib, voib, dqqb, betb, gamb, &
87 REAL*8,
DIMENSION(k0) :: poi_c, qoi_c
88 REAL*8,
DIMENSION(k0) :: poi_cb, qoi_cb
89 REAL*8,
DIMENSION(k0) :: prh, pri, ght, dpt, dpb, pki
90 REAL*8,
DIMENSION(k0) :: ghtb
91 REAL*8,
DIMENSION(k0) :: ucu, vcu
92 REAL*8,
DIMENSION(k0) :: ucub, vcub
93 REAL*8,
DIMENSION(k0) :: cln, rns, pol
94 REAL*8,
DIMENSION(k0) :: rnsb
95 REAL*8,
DIMENSION(k0) :: qst, ssl, rmf, rnn, rn1, rmfc, rmfp
96 REAL*8,
DIMENSION(k0) :: qstb, sslb, rnnb, rmfpb
97 REAL*8,
DIMENSION(k0) :: gms, eta, gmh, eht, gm1, hcc, rmfd
98 REAL*8,
DIMENSION(k0) :: gmsb, etab, gmhb, ehtb, gm1b, hccb, rmfdb
99 REAL*8,
DIMENSION(k0) :: hol, hst, qol, zol, hcld, cll0, cllx, clli
100 REAL*8,
DIMENSION(k0) :: holb, hstb, qolb, zolb, hcldb, cll0b
101 REAL*8,
DIMENSION(k0) :: bke, cvw, updfrc
102 REAL*8,
DIMENSION(k0) :: cvwb, updfrcb
103 REAL*8,
DIMENSION(k0) :: rasal, updfrp, bk2, dll0, dllx
104 REAL*8,
DIMENSION(k0) :: rasalb, updfrpb, bk2b
105 REAL*8,
DIMENSION(k0) :: wght, massf
106 REAL*8,
DIMENSION(k0) :: qss, dqs, pf, pk, tempf, zlo
107 REAL*8,
DIMENSION(k0) :: qssb, dqsb, tempfb, zlob
108 REAL*8,
DIMENSION(k0 + 1) :: prj, prs, qht, sht, zet, zle, pke
109 REAL*8,
DIMENSION(k0+1) :: qhtb, shtb, zetb, zleb
131 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: vhob
132 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: uhob
133 REAL*8,
DIMENSION(idim, k0),
INTENT(INOUT) :: qhob
235 fricfac = rasparams(1)
237 cli_crit = rasparams(4)
239 rasal1 = rasparams(5)
241 rasal2 = rasparams(6)
243 friclambda = rasparams(11)
245 sdqv2 = rasparams(14)
247 sdqv3 = rasparams(15)
249 sdqvt1 = rasparams(16)
251 acritfac = rasparams(17)
253 pblfrac = rasparams(20)
255 autorampb = rasparams(21)
259 maxdallowed = rasparams(23)
276 pke = (ple(i, :)/1000.)**(cons_rgas/cons_cp)
277 pf = 0.5*(ple(i, 1:k0)+ple(i, 2:k0+1))
278 pk = (pf/1000.)**(cons_rgas/cons_cp)
284 zle(l) = tho(i, l)*(1.+cons_vireps*qho(i, l))
285 zlo(l) = zle(l+1) + cons_cp/cons_grav*(pke(l+1)-pk(l))*zle(l)
286 zle(l) = zlo(l) + cons_cp/cons_grav*(pk(l)-pke(l))*zle(l)
288 tpert = cbl_tpert*(ts(i)-(tempf(k0)+cons_grav*zlo(k0)/cons_cp))
291 IF (tpert .LT. 0.0)
THEN 298 IF (qpert .LT. 0.0)
THEN 303 IF (frland(i) .LT. 0.1)
THEN 304 IF (tpert .GT. cbl_tpert_mxocn)
THEN 305 tpert = cbl_tpert_mxocn
311 ELSE IF (tpert .GT. cbl_tpert_mxlnd)
THEN 312 tpert = cbl_tpert_mxlnd
318 CALL dqsat_ras(dqs, qss, tempf, pf, k0, estblx, cons_h2omw, &
323 prs(icmin:k0+1) = ple(i, icmin:k0+1)
324 poi(icmin:k) = tho(i, icmin:k)
325 qoi(icmin:k) = qho(i, icmin:k)
326 uoi(icmin:k) = uho(i, icmin:k)
327 voi(icmin:k) = vho(i, icmin:k)
328 qst(icmin:k) = qss(icmin:k)
329 dqq(icmin:k) = dqs(icmin:k)
331 massf(:) = wgt0(i, :)
335 prcbl = prcbl + massf(l)*(prs(l+1)-prs(l))
338 prj(k+1) = (prs(k+1)/1000.)**(cons_rgas/cons_cp)
340 pol(l) = 0.5*(prs(l)+prs(l+1))
341 prh(l) = (prs(l+1)*prj(l+1)-prs(l)*prj(l))/(onepkap*(prs(l+1)-prs(&
344 dpt(l) = prh(l) - prj(l)
345 dpb(l) = prj(l+1) - prh(l)
346 pri(l) = .01/(prs(l+1)-prs(l))
357 wght(l) = massf(l)*(ple(i, l+1)-ple(i, l))/(prs(k+1)-prs(k))
360 poi(k) = poi(k) + wght(l)*tho(i, l)
361 qoi(k) = qoi(k) + wght(l)*qho(i, l)
362 uoi(k) = uoi(k) + wght(l)*uho(i, l)
363 voi(k) = voi(k) + wght(l)*vho(i, l)
366 CALL dqsats_ras(dqq(k), qst(k), arg1, pol(k), estblx, cons_h2omw, &
372 IF (seedras(i)/1000000. .LT. 1e-6)
THEN 375 rndu = seedras(i)/1000000.
377 mxdiam = maxdallowed*rndu**(-(1./2.))
380 bet(l) = dqq(l)*pki(l)
382 gam(l) = pki(l)/(1.0+lbcp*dqq(l))
384 ght(l+1) = gam(l)*dpb(l) + gam(l+1)*dpt(l+1)
385 gm1(l+1) = 0.5*lbcp*(dqq(l)/(alhl*(1.0+lbcp*dqq(l)))+dqq(l+1)/(&
386 & alhl*(1.0+lbcp*dqq(l+1))))
397 sht(k+1) = cp*poi(k)*prj(k+1)
399 IF (qst(l)*rhmax .GT. qoi(l))
THEN 403 qol(l) = qst(l)*rhmax
406 IF (0.000 .LT. qol(l))
THEN 413 ssl(l) = cp*prj(l+1)*poi(l) + grav*zet(l+1)
414 hol(l) = ssl(l) + qol(l)*alhl
415 hst(l) = ssl(l) + qst(l)*alhl
416 tem = poi(l)*(prj(l+1)-prj(l))*cpbg
417 zet(l) = zet(l+1) + tem
418 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi(l)*cpbg
423 IF (1. .GT. (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn))
THEN 425 trg = (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn)
432 IF (0.0 .LT. (autorampb-sige(ic))/0.2)
THEN 433 y1 = (autorampb-sige(ic))/0.2
437 IF (1.0 .GT. y1)
THEN 446 IF (trg .LE. 1.0e-5)
THEN 453 poi_c(k) = poi_c(k) + tpert
454 qoi_c(k) = qoi_c(k) + qpert
458 sht(k+1) = cp*poi_c(k)*prj(k+1)
460 IF (qst(l)*rhmax .GT. qoi_c(l))
THEN 466 qol(l) = qst(l)*rhmax
469 IF (0.000 .LT. qol(l))
THEN 477 ssl(l) = cp*prj(l+1)*poi_c(l) + grav*zet(l+1)
479 hol(l) = ssl(l) + qol(l)*alhl
481 hst(l) = ssl(l) + qst(l)*alhl
483 tem = poi_c(l)*(prj(l+1)-prj(l))*cpbg
485 zet(l) = zet(l+1) + tem
487 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi_c(l)*cpbg
493 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
495 sht(l) = ssl(l-1) + tem*(ssl(l)-ssl(l-1))
497 qht(l) = .5*(qol(l)+qol(l-1))
502 lambda_min = .2/mxdiam
504 IF (hol(k) .LE. hst(ic))
THEN 510 tem = (hst(ic)-hol(ic))*(zol(ic)-zet(ic+1))
513 tem = tem + (hst(ic)-hol(l))*(zet(l)-zet(l+1))
516 IF (tem .LE. 0.0)
THEN 521 alm = (hol(k)-hst(ic))/tem
522 IF (alm .GT. lambda_max)
THEN 528 IF (alm .LT. lambda_min)
THEN 529 toki = (alm/lambda_min)**2
538 eta(l) = 1.0 + alm*(zet(l)-zet(k))
542 eta(ic) = 1.0 + alm*(zol(ic)-zet(k))
549 hcc(l) = hcc(l+1) + (eta(l)-eta(l+1))*hol(l)
551 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
553 eht(l) = eta(l+1)*dpb(l) + eta(l)*dpt(l)
554 wfn = wfn + (tem-eht(l)*hst(l))*gam(l)
558 hcc(ic) = hst(ic)*eta(ic)
559 wfn = wfn + (hcc(ic+1)-hst(ic)*eta(ic+1))*gam(ic)*dpb(ic)
566 hcld(l) = (eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l))/&
569 tem = (hcld(l)-hst(l))*(zet(l)-zet(l+1))/(1.0+lbcp*dqq(l&
571 IF (tem .LT. 0.0)
THEN 580 bk2(l) = bk2(l+1) + grav*max1/(cp*prj(l+1)*poi(l))
581 IF (bk2(l) .LT. 0.0)
THEN 591 cvw(l) = sqrt(2.0*max2)
595 IF (zet(ic) .LT. 2000.)
THEN 601 IF (zet(ic) .GE. 2000.)
THEN 602 rasal(ic) = rasal1 + (rasal2-rasal1)*(zet(ic)-2000.)/&
608 IF (rasal(ic) .GT. 1.0e5)
THEN 613 rasal(ic) = rasal(ic)
616 rasal(ic) = dt/rasal(ic)
619 IF (cvw(l) .LT. 1.00)
THEN 631 CALL acritn(pol(ic), prs(k), acr, acritfac)
632 IF (wfn .LE. acr)
THEN 646 tem = eta(l) - eta(l+1)
647 wlq = wlq + tem*qol(l)
648 uht = uht + tem*uoi(l)
649 vht = vht + tem*voi(l)
652 tx2 = 0.5*(qst(l)+qst(l-1))*eta(l)
654 tx3 = 0.5*(hst(l)+hst(l-1))*eta(l)
655 qcc = tx2 + gm1(l)*(hcc(l)-tx3)
661 cll0(l) = wlq - qst(ic)*eta(ic)
664 IF (cll0(l) .LT. 0.00)
THEN 675 CALL sundq3_ice(te_a, sdqv2, sdqv3, sdqvt1, f2, f3)
677 c00_x = co_auto(i)*f2*f3*f4
678 cli_crit_x = cli_crit/(f2*f3)
680 rate = c00_x*(1.0-exp(-(cli**2/cli_crit_x**2)))
681 IF (cvw(l) .LT. 1.00)
THEN 690 dt_lyr = (zet(l)-zet(l+1))/cvw_x
691 closs = cll0(l)*rate*dt_lyr
692 IF (closs .GT. cll0(l))
THEN 699 IF (closs .GT. 0.)
THEN 711 wlq = wlq - qst(ic)*eta(ic)
714 gms(k) = (sht(k)-ssl(k))*pri(k)
716 gmh(k) = gms(k) + (qht(k)-qol(k))*pri(k)*alhl
718 akm = gmh(k)*gam(k-1)*dpb(k-1)
723 gms(l) = (eta(l)*(sht(l)-ssl(l))+eta(l+1)*(ssl(l)-sht(&
726 gmh(l) = gms(l) + (eta(l)*(qht(l)-qol(l))+eta(l+1)*(&
727 & qol(l)-qht(l+1)))*alhl*pri(l)
729 tx2 = tx2 + (eta(l)-eta(l+1))*gmh(l)
730 akm = akm - gms(l)*eht(l)*pki(l) + tx2*ght(l)
734 gms(ic) = eta(ic+1)*(ssl(ic)-sht(ic+1))*pri(ic)
735 akm = akm - gms(ic)*eta(ic+1)*dpb(ic)*pki(ic)
737 gmh(ic) = gms(ic) + (eta(ic+1)*(qol(ic)-qht(ic+1))*alhl+&
738 & eta(ic)*(hst(ic)-hol(ic)))*pri(ic)
740 IF (akm .GE. 0.0 .OR. wlq .LT. 0.0)
THEN 745 wfn = -((wfn-acr)/akm)
746 x1 = rasal(ic)*trg*toki*wfn
747 IF (x1 .GT. (prs(k+1)-prs(k))*(100.*pblfrac))
THEN 749 wfn = (prs(k+1)-prs(k))*(100.*pblfrac)
759 rmf(ic) = rmf(ic) + tem
764 IF (cvw(l) .GT. 0.0)
THEN 779 qoi(l) = qoi(l) + (gmh(l)-gms(l))*alhi
781 poi(l) = poi(l) + gms(l)*pki(l)*cpi
783 qst(l) = qst(l) + gms(l)*bet(l)*cpi
790 IF (fricfac .LE. 0.0)
THEN 795 wfn = wfn*fricfac*exp(-(alm/friclambda))
798 ucu(k) = ucu(k) + tem*(uoi(k-1)-uoi(k))
799 vcu(k) = vcu(k) + tem*(voi(k-1)-voi(k))
803 ucu(l) = ucu(l) + tem*((uoi(l-1)-uoi(l))*eta(l)+(&
804 & uoi(l)-uoi(l+1))*eta(l+1))
805 vcu(l) = vcu(l) + tem*((voi(l-1)-voi(l))*eta(l)+(&
806 & voi(l)-voi(l+1))*eta(l+1))
811 ucu(ic) = ucu(ic) + (2.*(uht-uoi(ic)*(eta(ic)-eta(ic&
812 & +1)))-(uoi(ic)+uoi(ic+1))*eta(ic+1))*tem
813 vcu(ic) = vcu(ic) + (2.*(vht-voi(ic)*(eta(ic)-eta(ic&
814 & +1)))-(voi(ic)+voi(ic+1))*eta(ic+1))*tem
818 uoi(l) = uoi(l) + ucu(l)
820 voi(l) = voi(l) + vcu(l)
833 IF (sum(rmf(icmin:k)) .GT. 0.0)
THEN 843 wght0 = wght0 + wght(l)*(ple(i, l+1)-ple(i, l))
845 wght0 = (prs(k+1)-prs(k))/wght0
848 clwb(i, k:k0) = 0.0_8
849 flxdb(i, k:k0) = 0.0_8
851 clwb(i, 1:icmin-1) = 0.0_8
852 flxdb(i, 1:icmin-1) = 0.0_8
854 cllb(icmin:k) = cllb(icmin:k) + ddt*clwb(i, icmin:k)/daylen
856 rmfdb(icmin:k) = rmfdb(icmin:k) + ddt*flxdb(i, icmin:k)/daylen
866 voib(k) = voib(k) + wght(l)*vhob(i, l)
867 voi_svb(k) = voi_svb(k) - wght(l)*vhob(i, l)
868 uoib(k) = uoib(k) + wght(l)*uhob(i, l)
869 uoi_svb(k) = uoi_svb(k) - wght(l)*uhob(i, l)
870 qoib(k) = qoib(k) + wght(l)*qhob(i, l)
871 qoi_svb(k) = qoi_svb(k) - wght(l)*qhob(i, l)
872 poib(k) = poib(k) + wght(l)*thob(i, l)
873 poi_svb(k) = poi_svb(k) - wght(l)*thob(i, l)
877 updfrcb(icmin:k-1) = updfrcb(icmin:k-1) + cnv_updfrcb(i, icmin:k-1&
879 voib(icmin:k-1) = voib(icmin:k-1) + vhob(i, icmin:k-1)
880 vhob(i, icmin:k-1) = 0.0_8
881 uoib(icmin:k-1) = uoib(icmin:k-1) + uhob(i, icmin:k-1)
882 uhob(i, icmin:k-1) = 0.0_8
883 qoib(icmin:k-1) = qoib(icmin:k-1) + qhob(i, icmin:k-1)
884 qhob(i, icmin:k-1) = 0.0_8
885 poib(icmin:k-1) = poib(icmin:k-1) + thob(i, icmin:k-1)
886 thob(i, icmin:k-1) = 0.0_8
890 rnsb(l) = rnsb(l) + tem*cnv_prc3b(i, l)
891 cnv_prc3b(i, l) = 0.0_8
927 IF (branch .LT. 4)
THEN 928 IF (branch .LT. 2)
THEN 929 IF (branch .EQ. 0)
THEN 945 ELSE IF (branch .EQ. 2)
THEN 956 ELSE IF (branch .LT. 6)
THEN 957 IF (branch .EQ. 4)
THEN 965 ELSE IF (branch .EQ. 6)
THEN 972 vcub(l) = vcub(l) + voib(l)
974 ucub(l) = ucub(l) + uoib(l)
976 tempb35 = tem*vcub(ic)
978 tempb37 = -(eta(ic+1)*tempb35)
980 voib(ic) = voib(ic) + tempb37 - (eta(ic)-eta(ic+1))*tempb36
981 etab(ic) = etab(ic) - voi(ic)*tempb36
982 etab(ic+1) = etab(ic+1) + voi(ic)*tempb36 - (voi(ic)+voi(ic+1))*&
984 voib(ic+1) = voib(ic+1) + tempb37
985 temb = (2.*(uht-uoi(ic)*(eta(ic)-eta(ic+1)))-(uoi(ic)+uoi(ic+1))&
986 & *eta(ic+1))*ucub(ic) + (2.*(vht-voi(ic)*(eta(ic)-eta(ic+1)))-(&
987 & voi(ic)+voi(ic+1))*eta(ic+1))*vcub(ic)
988 tempb38 = tem*ucub(ic)
990 tempb40 = -(eta(ic+1)*tempb38)
992 uoib(ic) = uoib(ic) + tempb40 - (eta(ic)-eta(ic+1))*tempb39
993 etab(ic) = etab(ic) - uoi(ic)*tempb39
994 etab(ic+1) = etab(ic+1) + uoi(ic)*tempb39 - (uoi(ic)+uoi(ic+1))*&
996 uoib(ic+1) = uoib(ic+1) + tempb40
1001 tempb31 = tem*vcub(l)
1002 tempb32 = eta(l+1)*tempb31
1003 temb = ((uoi(l-1)-uoi(l))*eta(l)+(uoi(l)-uoi(l+1))*eta(l+1))*&
1004 & ucub(l) + ((voi(l-1)-voi(l))*eta(l)+(voi(l)-voi(l+1))*eta(l+&
1006 voib(l-1) = voib(l-1) + eta(l)*tempb31
1007 voib(l) = voib(l) + tempb32 - eta(l)*tempb31
1008 etab(l) = etab(l) + (voi(l-1)-voi(l))*tempb31
1009 voib(l+1) = voib(l+1) - tempb32
1010 etab(l+1) = etab(l+1) + (voi(l)-voi(l+1))*tempb31
1011 tempb33 = tem*ucub(l)
1012 tempb34 = eta(l+1)*tempb33
1013 uoib(l-1) = uoib(l-1) + eta(l)*tempb33
1014 uoib(l) = uoib(l) + tempb34 - eta(l)*tempb33
1015 etab(l) = etab(l) + (uoi(l-1)-uoi(l))*tempb33
1016 uoib(l+1) = uoib(l+1) - tempb34
1017 etab(l+1) = etab(l+1) + (uoi(l)-uoi(l+1))*tempb33
1019 wfnb = wfnb + pri(l)*temb
1021 temb = (uoi(k-1)-uoi(k))*ucub(k) + (voi(k-1)-voi(k))*vcub(k)
1022 voib(k-1) = voib(k-1) + tem*vcub(k)
1023 voib(k) = voib(k) - tem*vcub(k)
1024 uoib(k-1) = uoib(k-1) + tem*ucub(k)
1025 uoib(k) = uoib(k) - tem*ucub(k)
1027 wfnb = wfnb + pri(k)*temb
1029 almb = -(exp(-(alm/friclambda))*wfn*fricfac*wfnb/friclambda)
1030 wfnb = fricfac*exp(-(alm/friclambda))*wfnb
1038 gmsb(l) = gmsb(l) + pki(l)*cpi*poib(l) - alhi*qoib(l) + cpi*bet(&
1040 betb(l) = betb(l) + cpi*gms(l)*qstb(l)
1043 gmhb(l) = gmhb(l) + alhi*qoib(l)
1046 wfnb = wfnb + gmh(l)*gmhb(l) + gms(l)*gmsb(l)
1047 gmsb(l) = wfn*gmsb(l)
1048 gmhb(l) = wfn*gmhb(l)
1049 rnnb(l) = rnnb(l) + tem*rnsb(l)
1050 temb = temb + rnn(l)*rnsb(l)
1054 updfrpb(l) = updfrpb(l) + updfrcb(l)
1056 IF (branch .EQ. 0)
THEN 1057 temp9 = daylen*prs(l)*cvw(l)
1058 tempb30 = ddt*1000.*updfrpb(l)/temp9
1059 rmfpb(l) = rmfpb(l) + tempb30
1060 cvwb(l) = cvwb(l) - rmfp(l)*daylen*prs(l)*tempb30/temp9
1066 temb = temb + eta(l)*rmfpb(l)
1067 etab(l) = etab(l) + tem*rmfpb(l)
1070 temb = temb + wlq*cllb(ic) + eta(ic)*rmfdb(ic)
1071 etab(ic) = etab(ic) + tem*rmfdb(ic)
1074 wfnb = wfnb + gravi*temb
1076 IF (branch .EQ. 0)
THEN 1083 tempb28 = trg*toki*x1b
1084 tempb29 = rasal(ic)*wfn*x1b
1085 rasalb(ic) = rasalb(ic) + wfn*tempb28
1086 wfnb = rasal(ic)*tempb28
1090 akmb = (wfn-acr)*wfnb/akm**2
1092 100 tempb26 = -(dpb(ic)*pki(ic)*akmb)
1094 tempb24 = pri(ic)*gmhb(ic)
1095 tempb25 = alhl*eta(ic+1)*tempb24
1096 gmsb(ic) = gmsb(ic) + eta(ic+1)*tempb26 + gmhb(ic)
1097 etab(ic+1) = etab(ic+1) + alhl*(qol(ic)-qht(ic+1))*tempb24
1098 qolb(ic) = qolb(ic) + tempb25
1099 qhtb(ic+1) = qhtb(ic+1) - tempb25
1100 etab(ic) = etab(ic) + (hst(ic)-hol(ic))*tempb24
1101 hstb(ic) = hstb(ic) + eta(ic)*tempb24
1102 holb(ic) = holb(ic) - eta(ic)*tempb24
1104 etab(ic+1) = etab(ic+1) + pri(ic)*(ssl(ic)-sht(ic+1))*gmsb(ic) + &
1107 tempb27 = pri(ic)*eta(ic+1)*gmsb(ic)
1108 sslb(ic) = sslb(ic) + tempb27
1109 shtb(ic+1) = shtb(ic+1) - tempb27
1114 tx2b = tx2b + ght(l)*akmb
1115 gmhb(l) = gmhb(l) + (eta(l)-eta(l+1))*tx2b
1116 gmsb(l) = gmsb(l) + gmhb(l) - pki(l)*eht(l)*akmb
1117 ehtb(l) = ehtb(l) - pki(l)*gms(l)*akmb
1118 ghtb(l) = ghtb(l) + tx2*akmb
1120 etab(l) = etab(l) + gmh(l)*tx2b
1121 etab(l+1) = etab(l+1) - gmh(l)*tx2b
1123 tempb20 = alhl*pri(l)*gmhb(l)
1124 tempb21 = eta(l+1)*tempb20
1125 etab(l) = etab(l) + (qht(l)-qol(l))*tempb20
1126 qhtb(l) = qhtb(l) + eta(l)*tempb20
1127 qolb(l) = qolb(l) + tempb21 - eta(l)*tempb20
1128 etab(l+1) = etab(l+1) + (qol(l)-qht(l+1))*tempb20
1129 qhtb(l+1) = qhtb(l+1) - tempb21
1132 tempb22 = pri(l)*gmsb(l)
1133 tempb23 = eta(l+1)*tempb22
1134 etab(l) = etab(l) + (sht(l)-ssl(l))*tempb22
1135 shtb(l) = shtb(l) + eta(l)*tempb22
1136 sslb(l) = sslb(l) + tempb23 - eta(l)*tempb22
1137 etab(l+1) = etab(l+1) + (ssl(l)-sht(l+1))*tempb22
1138 shtb(l+1) = shtb(l+1) - tempb23
1141 tempb18 = dpb(k-1)*akmb
1143 gmhb(k) = gmhb(k) + gam(k-1)*tempb18 + tx2b
1145 gamb(k-1) = gamb(k-1) + gmh(k)*tempb18
1147 tempb19 = pri(k)*alhl*gmhb(k)
1148 gmsb(k) = gmsb(k) + gmhb(k)
1149 qhtb(k) = qhtb(k) + tempb19
1150 qolb(k) = qolb(k) - tempb19
1153 shtb(k) = shtb(k) + pri(k)*gmsb(k)
1154 sslb(k) = sslb(k) - pri(k)*gmsb(k)
1156 qstb(ic) = qstb(ic) - eta(ic)*wlqb
1157 etab(ic) = etab(ic) - qst(ic)*wlqb
1161 IF (branch .EQ. 0)
THEN 1167 clossb = rnnb(l) - wlqb
1170 clossb = clossb - cll0b(l)
1172 IF (branch .EQ. 0)
THEN 1173 dt_lyr = (zet(l)-zet(l+1))/cvw_x
1174 cll0b(l) = cll0b(l) + clossb
1177 dt_lyr = (zet(l)-zet(l+1))/cvw_x
1179 cll0b(l) = cll0b(l) + rate*dt_lyr*clossb
1180 rateb = cll0(l)*dt_lyr*clossb
1181 dt_lyrb = cll0(l)*rate*clossb
1182 tempb17 = dt_lyrb/cvw_x
1183 zetb(l) = zetb(l) + tempb17
1184 zetb(l+1) = zetb(l+1) - tempb17
1185 cvw_xb = -((zet(l)-zet(l+1))*tempb17/cvw_x)
1187 IF (branch .EQ. 0)
THEN 1191 cvwb(l) = cvwb(l) + cvw_xb
1193 cli_crit_x = cli_crit/(f2*f3)
1194 cli = cll0(l)/eta(l)
1196 temp8 = cli_crit_x**2
1197 temp7 = cli**2/temp8
1198 tempb15 = exp(-temp7)*c00_x*rateb/temp8
1199 c00_xb = (1.0-exp(-temp7))*rateb
1200 clib = 2*cli*tempb15
1201 cli_crit_xb = -(temp7*2*cli_crit_x*tempb15)
1202 f2b = f2b + f3*f4*co_auto(i)*c00_xb - cli_crit*cli_crit_xb/(f3*&
1205 te_a = poi(l)*prh(l)
1208 CALL sundq3_ice_b(te_a, te_ab, sdqv2, sdqv3, sdqvt1, f2, f2b, f3&
1210 poib(l) = poib(l) + prh(l)*te_ab
1211 tempb16 = clib/eta(l)
1212 cll0b(l) = cll0b(l) + tempb16
1213 etab(l) = etab(l) - cll0(l)*tempb16/eta(l)
1215 IF (branch .EQ. 0) cll0b(l) = 0.0_8
1217 IF (branch .EQ. 0)
THEN 1219 wlqb = wlqb + cll0b(l)
1220 qstb(ic) = qstb(ic) - eta(ic)*cll0b(l)
1221 etab(ic) = etab(ic) - qst(ic)*cll0b(l)
1225 wlqb = wlqb + cll0b(l)
1229 gm1b(l) = gm1b(l) + (hcc(l)-tx3)*qccb
1230 hccb(l) = hccb(l) + gm1(l)*qccb
1231 tx3b = -(gm1(l)*qccb)
1233 tempb13 = 0.5*eta(l)*tx3b
1234 hstb(l) = hstb(l) + tempb13
1235 hstb(l-1) = hstb(l-1) + tempb13
1236 etab(l) = etab(l) + 0.5*(qst(l)+qst(l-1))*tx2b + 0.5*(hst(l)+&
1239 tempb14 = 0.5*eta(l)*tx2b
1240 qstb(l) = qstb(l) + tempb14
1241 qstb(l-1) = qstb(l-1) + tempb14
1243 tem = eta(l) - eta(l+1)
1244 temb = uoi(l)*uhtb + qol(l)*wlqb + voi(l)*vhtb
1245 voib(l) = voib(l) + tem*vhtb
1246 uoib(l) = uoib(l) + tem*uhtb
1247 qolb(l) = qolb(l) + tem*wlqb
1249 etab(l) = etab(l) + temb
1250 etab(l+1) = etab(l+1) - temb
1256 voib(k) = voib(k) + vhtb
1258 uoib(k) = uoib(k) + uhtb
1260 qolb(k) = qolb(k) + wlqb
1265 IF (branch .EQ. 0)
THEN 1273 rasalb(ic) = -(dt*rasalb(ic)/rasal(ic)**2)
1275 IF (branch .EQ. 0) rasalb(ic) = 0.0_8
1277 IF (branch .NE. 0)
THEN 1278 zetb(ic) = zetb(ic) + (rasal2-rasal1)*rasalb(ic)/8000.
1282 IF (branch .EQ. 0) rasalb(ic) = 0.0_8
1286 IF (2.0*max2 .EQ. 0.0)
THEN 1289 max2b = cvwb(l)/sqrt(2.0*max2)
1293 IF (branch .EQ. 0)
THEN 1297 bk2b(l) = bk2b(l) + max2b
1300 temp5 = temp6*poi(l)
1301 tempb12 = grav*bk2b(l)/temp5
1302 bk2b(l+1) = bk2b(l+1) + bk2b(l)
1304 poib(l) = poib(l) - max1*temp6*tempb12/temp5
1307 IF (branch .EQ. 0)
THEN 1315 temp4 = lbcp*dqq(l) + 1.0
1316 tempb10 = temb/temp4
1317 temp3 = zet(l) - zet(l+1)
1318 temp2 = hcld(l) - hst(l)
1319 hcldb(l) = hcldb(l) + temp3*tempb10
1320 hstb(l) = hstb(l) - temp3*tempb10
1321 zetb(l) = zetb(l) + temp2*tempb10
1322 zetb(l+1) = zetb(l+1) - temp2*tempb10
1323 dqqb(l) = dqqb(l) - temp2*temp3*lbcp*tempb10/temp4
1325 tempb11 = hcldb(l)/eta(l)
1326 etab(l+1) = etab(l+1) + (hcld(l+1)-hol(l))*tempb11
1327 hcldb(l+1) = hcldb(l+1) + eta(l+1)*tempb11
1328 etab(l) = etab(l) + (hol(l)-(eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1)&
1329 & )*hol(l))/eta(l))*tempb11
1330 holb(l) = holb(l) + (eta(l)-eta(l+1))*tempb11
1334 holb(k) = holb(k) + hcldb(k)
1337 tempb9 = dpb(ic)*gam(ic)*wfnb
1338 hccb(ic+1) = hccb(ic+1) + tempb9
1339 hstb(ic) = hstb(ic) + eta(ic)*hccb(ic) - eta(ic+1)*tempb9
1340 etab(ic+1) = etab(ic+1) - hst(ic)*tempb9
1341 gamb(ic) = gamb(ic) + dpb(ic)*(hcc(ic+1)-hst(ic)*eta(ic+1))*wfnb
1343 etab(ic) = etab(ic) + hst(ic)*hccb(ic)
1347 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
1348 tempb8 = gam(l)*wfnb
1350 ehtb(l) = ehtb(l) - hst(l)*tempb8
1351 hstb(l) = hstb(l) - eht(l)*tempb8
1352 gamb(l) = gamb(l) + (tem-eht(l)*hst(l))*wfnb
1354 etab(l+1) = etab(l+1) + dpb(l)*ehtb(l)
1356 hccb(l+1) = hccb(l+1) + dpb(l)*temb
1357 hccb(l) = hccb(l) + dpt(l)*temb
1359 hccb(l+1) = hccb(l+1) + hccb(l)
1360 etab(l) = etab(l) + hol(l)*hccb(l) + dpt(l)*ehtb(l)
1362 etab(l+1) = etab(l+1) - hol(l)*hccb(l)
1363 holb(l) = holb(l) + (eta(l)-eta(l+1))*hccb(l)
1367 holb(k) = holb(k) + hccb(k)
1370 almb = almb + (zol(ic)-zet(k))*etab(ic)
1371 zolb(ic) = zolb(ic) + alm*etab(ic)
1372 zetb(k) = zetb(k) - alm*etab(ic)
1377 almb = almb + (zet(l)-zet(k))*etab(l)
1378 zetb(l) = zetb(l) + alm*etab(l)
1379 zetb(k) = zetb(k) - alm*etab(l)
1383 IF (branch .NE. 0) almb = almb + 2*alm*tokib/lambda_min**2
1387 holb(k) = holb(k) + tempb7
1388 hstb(ic) = hstb(ic) - tempb7
1389 temb = -((hol(k)-hst(ic))*tempb7/tem)
1391 DO l=k-1,ad_from0,-1
1392 tempb5 = (zet(l)-zet(l+1))*temb
1393 tempb6 = (hst(ic)-hol(l))*temb
1394 hstb(ic) = hstb(ic) + tempb5
1395 holb(l) = holb(l) - tempb5
1396 zetb(l) = zetb(l) + tempb6
1397 zetb(l+1) = zetb(l+1) - tempb6
1400 tempb3 = (zol(ic)-zet(ic+1))*temb
1401 tempb4 = (hst(ic)-hol(ic))*temb
1402 hstb(ic) = hstb(ic) + tempb3
1403 holb(ic) = holb(ic) - tempb3
1404 zolb(ic) = zolb(ic) + tempb4
1405 zetb(ic+1) = zetb(ic+1) - tempb4
1410 qolb(l) = qolb(l) + .5*qhtb(l)
1411 qolb(l-1) = qolb(l-1) + .5*qhtb(l)
1413 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
1415 sslb(l-1) = sslb(l-1) + (1.0_8-tem)*shtb(l)
1416 sslb(l) = sslb(l) + tem*shtb(l)
1424 sslb(l) = sslb(l) + holb(l) + hstb(l)
1426 zetb(l+1) = zetb(l+1) + zetb(l) + zolb(l)
1429 poi_cb(l) = poi_cb(l) + (prj(l+1)-prj(l))*cpbg*temb + prj(l+1)*&
1430 & cp*sslb(l) + (prj(l+1)-prh(l))*cpbg*zolb(l)
1435 qstb(l) = qstb(l) + alhl*hstb(l)
1438 qolb(l) = qolb(l) + alhl*holb(l)
1441 zetb(l+1) = zetb(l+1) + grav*sslb(l)
1444 IF (branch .NE. 0) qolb(l) = 0.0_8
1446 IF (branch .EQ. 0)
THEN 1448 qoi_cb(l) = qoi_cb(l) + qolb(l)
1452 qstb(l) = qstb(l) + rhmax*qolb(l)
1457 poi_cb(k) = poi_cb(k) + prj(k+1)*cp*shtb(k+1)
1461 tpertb = tpertb + poi_cb(k)
1462 qoib = qoib + qoi_cb
1463 poib = poib + poi_cb
1465 IF (branch .EQ. 0)
THEN 1471 IF (branch .EQ. 0)
THEN 1473 tempb2 = trgb/((rhmx-rhmn)*qst(k))
1474 qoib(k) = qoib(k) + tempb2
1475 qstb(k) = qstb(k) - qoi(k)*tempb2/qst(k)
1479 vcub(icmin:k0) = 0.0_8
1480 ucub(icmin:k0) = 0.0_8
1483 sslb(l) = sslb(l) + holb(l) + hstb(l)
1484 zetb(l+1) = zetb(l+1) + zetb(l) + zolb(l)
1486 poib(l) = poib(l) + (prj(l+1)-prj(l))*cpbg*temb + prj(l+1)*cp*sslb&
1487 & (l) + (prj(l+1)-prh(l))*cpbg*zolb(l)
1490 qstb(l) = qstb(l) + alhl*hstb(l)
1492 qolb(l) = qolb(l) + alhl*holb(l)
1494 zetb(l+1) = zetb(l+1) + grav*sslb(l)
1497 IF (branch .NE. 0) qolb(l) = 0.0_8
1499 IF (branch .EQ. 0)
THEN 1500 qoib(l) = qoib(l) + qolb(l)
1503 qstb(l) = qstb(l) + rhmax*qolb(l)
1507 poib(k) = poib(k) + prj(k+1)*cp*shtb(k+1)
1508 voib = voib + voi_svb
1509 uoib = uoib + uoi_svb
1510 qoib = qoib + qoi_svb
1511 poib = poib + poi_svb
1514 IF (branch .NE. 0)
THEN 1515 temp1 = alhl*(lbcp*dqq(l+1)+1.0)
1516 temp0 = alhl*(lbcp*dqq(l)+1.0)
1517 tempb = lbcp*0.5*gm1b(l+1)
1518 tempb0 = tempb/temp0
1519 tempb1 = tempb/temp1
1520 dqqb(l) = dqqb(l) + (1.0_8-alhl*dqq(l)*lbcp/temp0)*tempb0
1521 dqqb(l+1) = dqqb(l+1) + (1.0_8-alhl*dqq(l+1)*lbcp/temp1)*tempb1
1523 gamb(l) = gamb(l) + dpb(l)*ghtb(l+1)
1524 gamb(l+1) = gamb(l+1) + dpt(l+1)*ghtb(l+1)
1527 temp = lbcp*dqq(l) + 1.0
1528 dqqb(l) = dqqb(l) + pki(l)*betb(l) - pki(l)*lbcp*gamb(l)/temp**2
1533 IF (branch .NE. 0)
THEN 1534 CALL dqsats_ras_b(dqq(k), dqqb(k), qst(k), qstb(k), arg1, arg1b, &
1535 & pol(k), estblx, cons_h2omw, cons_airmw)
1538 poib(k) = poib(k) + prh(k)*arg1b
1540 vhob(i, l) = vhob(i, l) + wght(l)*voib(k)
1541 uhob(i, l) = uhob(i, l) + wght(l)*uoib(k)
1542 qhob(i, l) = qhob(i, l) + wght(l)*qoib(k)
1543 thob(i, l) = thob(i, l) + wght(l)*poib(k)
1551 dqsb(icmin:k) = dqsb(icmin:k) + dqqb(icmin:k)
1553 qssb(icmin:k) = qssb(icmin:k) + qstb(icmin:k)
1554 vhob(i, icmin:k) = vhob(i, icmin:k) + voib(icmin:k)
1555 uhob(i, icmin:k) = uhob(i, icmin:k) + uoib(icmin:k)
1556 qhob(i, icmin:k) = qhob(i, icmin:k) + qoib(icmin:k)
1557 thob(i, icmin:k) = thob(i, icmin:k) + poib(icmin:k)
1558 CALL dqsat_ras_b(dqs, dqsb, qss, qssb, tempf, tempfb, pf, k0, estblx&
1559 & , cons_h2omw, cons_airmw)
1561 IF (branch .LT. 2)
THEN 1562 IF (branch .NE. 0) tpertb = 0.0_8
1563 ELSE IF (branch .NE. 2)
THEN 1567 IF (branch .EQ. 0) tpertb = 0.0_8
1569 tempfb(k0) = tempfb(k0) - cbl_tpert*tpertb
1570 zlob(k0) = zlob(k0) - cons_grav*cbl_tpert*tpertb/cons_cp
1573 zlob(l) = zlob(l) + zleb(l)
1574 zleb(l) = cons_cp*(pk(l)-pke(l))*zleb(l)/cons_grav
1575 zleb(l+1) = zleb(l+1) + zlob(l)
1576 zleb(l) = zleb(l) + cons_cp*(pke(l+1)-pk(l))*zlob(l)/cons_grav
1578 thob(i, l) = thob(i, l) + (cons_vireps*qho(i, l)+1.)*zleb(l)
1579 qhob(i, l) = qhob(i, l) + tho(i, l)*cons_vireps*zleb(l)
1582 thob(i, :) = thob(i, :) + pk*tempfb
1607 SUBROUTINE sundq3_ice_b(temp, tempb, rate2, rate3, te1, f2, f2b, f3)
1609 REAL*8,
INTENT(IN) :: temp, rate2, rate3, te1
1614 REAL*8 :: xx, yy, te0, te2, jump1
1618 jump1 = (rate2-1.0)/(te0-te1)**0.333
1620 IF (temp .GE. te0)
THEN 1627 IF (temp .GE. te1 .AND. temp .LT. te0)
THEN 1629 f2 = 1.0 + jump1*(te0-temp)**0.3333
1634 IF (temp .LT. te1)
THEN 1636 f2 = rate2 + (rate3-rate2)*(te1-temp)/(te1-te2)
1641 IF (f2 .GT. 27.0) f2b = 0.0_8
1643 IF (branch .EQ. 0)
THEN 1645 tempb = -((rate3-rate2)*f2b/(te1-te2))
1651 IF (branch .EQ. 0)
THEN 1653 tempb = tempb - 0.3333*(te0-temp)**(-0.6667)*jump1*f2b
1657 IF (branch .EQ. 0)
THEN 1666 SUBROUTINE dqsat_ras_b(dqsi, dqsib, qssi, qssib, temp, tempb, plo, lm, &
1667 & estblx, cons_h2omw, cons_airmw)
1671 REAL*8,
DIMENSION(lm) :: temp, plo
1672 REAL*8,
DIMENSION(lm) :: tempb
1674 REAL*8 :: cons_h2omw, cons_airmw
1676 REAL*8,
DIMENSION(lm) :: dqsi, qssi
1677 REAL*8,
DIMENSION(lm) :: dqsib, qssib
1679 REAL*8,
PARAMETER :: max_mixing_ratio=1.0
1682 REAL*8 :: tl, tt, ti, dqsat, qsat, dqq, qq, pl, pp, dd
1683 REAL*8 :: tlb, ttb, tib, dqsatb, qsatb, qqb, ddb
1685 INTEGER,
PARAMETER :: degsubs=100
1686 REAL*8,
PARAMETER :: tmintbl=150.0, tmaxtbl=333.0
1687 INTEGER,
PARAMETER :: tablesize=nint(tmaxtbl-tmintbl)*degsubs+1
1692 esfac = cons_h2omw/cons_airmw
1697 IF (tl .LE. tmintbl)
THEN 1700 ELSE IF (tl .GE. tmaxtbl - .001)
THEN 1707 tt = (ti-tmintbl)*degsubs + 1
1710 dqq = estblx(it+1) - estblx(it)
1712 qq = (tt-it)*dqq + estblx(it)
1713 IF (pp .LE. qq)
THEN 1726 IF (branch .EQ. 0)
THEN 1731 dd = 1.0/(pp-(1.0-esfac)*qq)
1732 ddb = esfac*qq*qsatb + esfac*degsubs*dqq*pp*2*dd*dqsatb
1733 temp0 = pp - (-esfac+1.0)*qq
1734 qqb = (1.0-esfac)*ddb/temp0**2 + esfac*dd*qsatb
1741 IF (branch .EQ. 0)
THEN 1743 ELSE IF (branch .EQ. 1)
THEN 1748 tempb(k) = tempb(k) + tlb
1755 SUBROUTINE dqsats_ras_b(dqsi, dqsib, qssi, qssib, temp, tempb, plo, &
1756 & estblx, cons_h2omw, cons_airmw)
1762 REAL*8 :: cons_h2omw, cons_airmw
1764 REAL*8 :: dqsi, qssi
1765 REAL*8 :: dqsib, qssib
1767 REAL*8,
PARAMETER :: max_mixing_ratio=1.0
1769 REAL*8 :: tl, tt, ti, dqsat, qsat, dqq, qq, pl, pp, dd
1770 REAL*8 :: tlb, ttb, tib, dqsatb, qsatb, qqb, ddb
1772 INTEGER,
PARAMETER :: degsubs=100
1773 REAL*8,
PARAMETER :: tmintbl=150.0, tmaxtbl=333.0
1774 INTEGER,
PARAMETER :: tablesize=nint(tmaxtbl-tmintbl)*degsubs+1
1779 esfac = cons_h2omw/cons_airmw
1783 IF (tl .LE. tmintbl)
THEN 1786 ELSE IF (tl .GE. tmaxtbl - .001)
THEN 1793 tt = (ti-tmintbl)*degsubs + 1
1795 dqq = estblx(it+1) - estblx(it)
1796 qq = (tt-it)*dqq + estblx(it)
1797 IF (pp .LE. qq)
THEN 1800 dd = 1.0/(pp-(1.0-esfac)*qq)
1806 IF (branch .EQ. 0)
THEN 1809 temp0 = pp - (-esfac+1.0)*qq
1810 ddb = esfac*qq*qsatb + esfac*degsubs*dqq*pp*2*dd*dqsatb
1811 qqb = (1.0-esfac)*ddb/temp0**2 + esfac*dd*qsatb
1816 IF (branch .EQ. 0)
THEN 1818 ELSE IF (branch .EQ. 1)
THEN 1826 SUBROUTINE rase_tracer_b(idim, irun, k0, icmin, dt, cons_cp, cons_alhl, &
1827 & cons_grav, cons_rgas, cons_h2omw, cons_airmw, cons_vireps, seedras, &
1828 & sige, kcbl, wgt0, wgt1, frland, ts, thoin, qhoin, uhoin, vhoin, &
1829 & co_auto, ple, rasparams, estblx, itrcr, xho, xhob, fscav)
1832 INTEGER,
INTENT(IN) :: idim, irun, k0, icmin
1833 REAL*8,
DIMENSION(idim, k0 + 1),
INTENT(IN) :: ple
1834 REAL*8,
DIMENSION(k0 + 1),
INTENT(IN) :: sige
1835 REAL*8,
INTENT(IN) :: dt, cons_cp, cons_alhl, cons_grav, cons_rgas
1836 REAL*8,
INTENT(IN) :: cons_h2omw, cons_airmw, cons_vireps
1837 INTEGER,
DIMENSION(idim),
INTENT(IN) :: seedras
1838 INTEGER,
DIMENSION(idim),
INTENT(IN) :: kcbl
1839 REAL*8,
DIMENSION(idim),
INTENT(IN) :: ts, frland
1840 REAL*8,
DIMENSION(idim),
INTENT(IN) :: co_auto
1841 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: wgt0, wgt1
1842 REAL*8,
DIMENSION(:),
INTENT(IN) :: rasparams
1843 REAL*8,
DIMENSION(:),
INTENT(IN) :: estblx
1844 INTEGER,
INTENT(IN) :: itrcr
1845 REAL*8,
DIMENSION(itrcr),
INTENT(IN) :: fscav
1846 REAL*8,
DIMENSION(idim, k0),
INTENT(IN) :: thoin, qhoin, uhoin, vhoin
1848 REAL*8,
DIMENSION(idim, k0, itrcr),
INTENT(INOUT) :: xho
1849 REAL*8,
DIMENSION(idim, k0, itrcr),
INTENT(INOUT) :: xhob
1851 INTEGER :: i, ic, l, kk, k
1853 REAL*8,
PARAMETER :: onepkap=1.+2./7., daylen=86400.0
1854 REAL*8,
PARAMETER :: rhmax=0.9999
1855 REAL*8,
PARAMETER :: cbl_qpert=0.0, cbl_tpert=1.0
1856 REAL*8,
PARAMETER :: cbl_tpert_mxocn=2.0, cbl_tpert_mxlnd=4.0
1858 REAL*8 :: grav, cp, alhl, cpbg, alhi, cpi, gravi, ddt, lbcp
1860 REAL*8 :: fricfac, cli_crit, rasal1, rasal2
1861 REAL*8 :: friclambda
1862 REAL*8 :: sdqv2, sdqv3, sdqvt1
1863 REAL*8 :: acritfac, pblfrac, autorampb
1864 REAL*8 :: maxdallowed, rhmn, rhmx
1866 REAL*8 :: tx2, tx3, akm, acr, alm, tth, qqh, dqx
1867 REAL*8 :: wfn, tem, trg, trgexp, evp, wlq, qcc
1868 REAL*8 :: cli, te_a, c00_x, cli_crit_x, toki
1869 REAL*8 :: dt_lyr, rate, cvw_x, closs, f2, f3, f4
1870 REAL*8 :: wght0, prcbl, rndu
1871 REAL*8 :: lambda_min, lambda_max
1872 REAL*8 :: tpert, qpert
1874 REAL*8,
DIMENSION(k0) :: poi_sv, qoi_sv, uoi_sv, voi_sv
1875 REAL*8,
DIMENSION(k0) :: poi, qoi, uoi, voi, dqq, bet, gam, cll
1876 REAL*8,
DIMENSION(k0) :: poi_c, qoi_c
1877 REAL*8,
DIMENSION(k0) :: prh, pri, ght, dpt, dpb, pki
1878 REAL*8,
DIMENSION(k0) :: ucu, vcu
1879 REAL*8,
DIMENSION(k0) :: cln, rns, pol
1880 REAL*8,
DIMENSION(k0) :: qst, ssl, rmf, rnn, rn1, rmfc, rmfp
1881 REAL*8,
DIMENSION(k0) :: gms, eta, gmh, eht, gm1, hcc, rmfd
1882 REAL*8,
DIMENSION(k0) :: hol, hst, qol, zol, hcld, cll0, cllx, clli
1883 REAL*8,
DIMENSION(k0) :: bke, cvw, updfrc
1884 REAL*8,
DIMENSION(k0) :: rasal, updfrp, bk2, dll0, dllx
1885 REAL*8,
DIMENSION(k0) :: wght, massf
1886 REAL*8,
DIMENSION(k0) :: qss, dqs, pf, pk, tempf, zlo
1887 REAL*8,
DIMENSION(k0 + 1) :: prj, prs, qht, sht, zet, zle, pke
1888 REAL*8,
DIMENSION(idim, k0) :: tho, qho, uho, vho
1895 REAL*8,
DIMENSION(k0, itrcr) :: xoi, xcu, xoi_sv
1896 REAL*8,
DIMENSION(k0, itrcr) :: xoib, xcub, xoi_svb
1897 REAL*8,
DIMENSION(itrcr) :: xht
1898 REAL*8,
DIMENSION(itrcr) :: xhtb
1963 cli_crit = rasparams(4)
1965 rasal1 = rasparams(5)
1967 rasal2 = rasparams(6)
1970 sdqv2 = rasparams(14)
1972 sdqv3 = rasparams(15)
1974 sdqvt1 = rasparams(16)
1976 acritfac = rasparams(17)
1978 pblfrac = rasparams(20)
1980 autorampb = rasparams(21)
1982 rhmn = rasparams(24)
1984 maxdallowed = rasparams(23)
1986 rhmx = rasparams(25)
2000 pke = (ple(i, :)/1000.)**(cons_rgas/cons_cp)
2001 pf = 0.5*(ple(i, 1:k0)+ple(i, 2:k0+1))
2002 pk = (pf/1000.)**(cons_rgas/cons_cp)
2003 tempf = tho(i, :)*pk
2008 zle(l) = tho(i, l)*(1.+cons_vireps*qho(i, l))
2009 zlo(l) = zle(l+1) + cons_cp/cons_grav*(pke(l+1)-pk(l))*zle(l)
2010 zle(l) = zlo(l) + cons_cp/cons_grav*(pk(l)-pke(l))*zle(l)
2012 tpert = cbl_tpert*(ts(i)-(tempf(k0)+cons_grav*zlo(k0)/cons_cp))
2015 IF (tpert .LT. 0.0)
THEN 2020 IF (qpert .LT. 0.0)
THEN 2025 IF (frland(i) .LT. 0.1)
THEN 2026 IF (tpert .GT. cbl_tpert_mxocn)
THEN 2027 tpert = cbl_tpert_mxocn
2031 ELSE IF (tpert .GT. cbl_tpert_mxlnd)
THEN 2032 tpert = cbl_tpert_mxlnd
2036 CALL dqsat_ras(dqs, qss, tempf, pf, k0, estblx, cons_h2omw, &
2041 prs(icmin:k0+1) = ple(i, icmin:k0+1)
2042 poi(icmin:k) = tho(i, icmin:k)
2043 qoi(icmin:k) = qho(i, icmin:k)
2044 qst(icmin:k) = qss(icmin:k)
2045 dqq(icmin:k) = dqs(icmin:k)
2047 massf(:) = wgt0(i, :)
2051 prcbl = prcbl + massf(l)*(prs(l+1)-prs(l))
2054 prj(k+1) = (prs(k+1)/1000.)**(cons_rgas/cons_cp)
2056 pol(l) = 0.5*(prs(l)+prs(l+1))
2057 prh(l) = (prs(l+1)*prj(l+1)-prs(l)*prj(l))/(onepkap*(prs(l+1)-prs(&
2060 dpt(l) = prh(l) - prj(l)
2061 dpb(l) = prj(l+1) - prh(l)
2062 pri(l) = .01/(prs(l+1)-prs(l))
2071 wght(l) = massf(l)*(ple(i, l+1)-ple(i, l))/(prs(k+1)-prs(k))
2074 poi(k) = poi(k) + wght(l)*tho(i, l)
2075 qoi(k) = qoi(k) + wght(l)*qho(i, l)
2078 arg1 = poi(k)*prh(k)
2079 CALL dqsats_ras(dqq(k), qst(k), arg1, pol(k), estblx, cons_h2omw, &
2084 IF (seedras(i)/1000000. .LT. 1e-6)
THEN 2087 rndu = seedras(i)/1000000.
2089 mxdiam = maxdallowed*rndu**(-(1./2.))
2092 bet(l) = dqq(l)*pki(l)
2094 gam(l) = pki(l)/(1.0+lbcp*dqq(l))
2096 ght(l+1) = gam(l)*dpb(l) + gam(l+1)*dpt(l+1)
2097 gm1(l+1) = 0.5*lbcp*(dqq(l)/(alhl*(1.0+lbcp*dqq(l)))+dqq(l+1)/(&
2098 & alhl*(1.0+lbcp*dqq(l+1))))
2107 sht(k+1) = cp*poi(k)*prj(k+1)
2109 IF (qst(l)*rhmax .GT. qoi(l))
THEN 2112 qol(l) = qst(l)*rhmax
2114 IF (0.000 .LT. qol(l))
THEN 2119 ssl(l) = cp*prj(l+1)*poi(l) + grav*zet(l+1)
2120 hol(l) = ssl(l) + qol(l)*alhl
2121 hst(l) = ssl(l) + qst(l)*alhl
2122 tem = poi(l)*(prj(l+1)-prj(l))*cpbg
2123 zet(l) = zet(l+1) + tem
2124 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi(l)*cpbg
2128 IF (1. .GT. (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn))
THEN 2129 trg = (qoi(k)/qst(k)-rhmn)/(rhmx-rhmn)
2133 IF (0.0 .LT. (autorampb-sige(ic))/0.2)
THEN 2134 y1 = (autorampb-sige(ic))/0.2
2138 IF (1.0 .GT. y1)
THEN 2143 IF (trg .LE. 1.0e-5)
THEN 2150 poi_c(k) = poi_c(k) + tpert
2151 qoi_c(k) = qoi_c(k) + qpert
2153 sht(k+1) = cp*poi_c(k)*prj(k+1)
2155 IF (qst(l)*rhmax .GT. qoi_c(l))
THEN 2158 qol(l) = qst(l)*rhmax
2160 IF (0.000 .LT. qol(l))
THEN 2165 ssl(l) = cp*prj(l+1)*poi_c(l) + grav*zet(l+1)
2166 hol(l) = ssl(l) + qol(l)*alhl
2167 hst(l) = ssl(l) + qst(l)*alhl
2169 tem = poi_c(l)*(prj(l+1)-prj(l))*cpbg
2170 zet(l) = zet(l+1) + tem
2171 zol(l) = zet(l+1) + (prj(l+1)-prh(l))*poi_c(l)*cpbg
2177 tem = (prj(l)-prh(l-1))/(prh(l)-prh(l-1))
2178 sht(l) = ssl(l-1) + tem*(ssl(l)-ssl(l-1))
2179 qht(l) = .5*(qol(l)+qol(l-1))
2183 lambda_min = .2/mxdiam
2184 lambda_max = .2/200.
2185 IF (hol(k) .LE. hst(ic))
THEN 2191 tem = (hst(ic)-hol(ic))*(zol(ic)-zet(ic+1))
2193 tem = tem + (hst(ic)-hol(l))*(zet(l)-zet(l+1))
2195 IF (tem .LE. 0.0)
THEN 2199 alm = (hol(k)-hst(ic))/tem
2200 IF (alm .GT. lambda_max)
THEN 2205 IF (alm .LT. lambda_min) toki = (alm/lambda_min)**2
2210 eta(l) = 1.0 + alm*(zet(l)-zet(k))
2214 eta(ic) = 1.0 + alm*(zol(ic)-zet(k))
2219 hcc(l) = hcc(l+1) + (eta(l)-eta(l+1))*hol(l)
2220 tem = hcc(l+1)*dpb(l) + hcc(l)*dpt(l)
2221 eht(l) = eta(l+1)*dpb(l) + eta(l)*dpt(l)
2222 wfn = wfn + (tem-eht(l)*hst(l))*gam(l)
2224 hcc(ic) = hst(ic)*eta(ic)
2225 wfn = wfn + (hcc(ic+1)-hst(ic)*eta(ic+1))*gam(ic)*dpb(ic)
2230 hcld(l) = (eta(l+1)*hcld(l+1)+(eta(l)-eta(l+1))*hol(l))/&
2232 tem = (hcld(l)-hst(l))*(zet(l)-zet(l+1))/(1.0+lbcp*dqq(l&
2234 IF (tem .LT. 0.0)
THEN 2239 bk2(l) = bk2(l+1) + grav*max1/(cp*prj(l+1)*poi(l))
2240 IF (bk2(l) .LT. 0.0)
THEN 2245 cvw(l) = sqrt(2.0*max2)
2248 IF (zet(ic) .LT. 2000.) rasal(ic) = rasal1
2249 IF (zet(ic) .GE. 2000.) rasal(ic) = rasal1 + (rasal2-&
2250 & rasal1)*(zet(ic)-2000.)/8000.
2251 IF (rasal(ic) .GT. 1.0e5)
THEN 2254 rasal(ic) = rasal(ic)
2256 rasal(ic) = dt/rasal(ic)
2258 IF (cvw(l) .LT. 1.00)
THEN 2264 CALL acritn(pol(ic), prs(k), acr, acritfac)
2265 IF (wfn .LE. acr)
THEN 2272 delzkm = (zet(ic)-zet(k))/1000.
2273 x4 = exp(-(fscav(itr)*delzkm))
2274 IF (x4 .GT. 1.)
THEN 2279 IF (x1 .LT. 0.)
THEN 2292 tem = eta(l) - eta(l+1)
2293 wlq = wlq + tem*qol(l)
2297 delzkm = (zet(ic)-zet(l+1))/1000.
2298 x5 = exp(-(fscav(itr)*delzkm))
2299 IF (x5 .GT. 1.)
THEN 2304 IF (x2 .LT. 0.)
THEN 2315 tx2 = 0.5*(qst(l)+qst(l-1))*eta(l)
2316 tx3 = 0.5*(hst(l)+hst(l-1))*eta(l)
2317 qcc = tx2 + gm1(l)*(hcc(l)-tx3)
2320 cll0(l) = wlq - qst(ic)*eta(ic)
2322 IF (cll0(l) .LT. 0.00)
THEN 2327 cli = cll0(l)/eta(l)
2328 te_a = poi(l)*prh(l)
2329 CALL sundq3_ice(te_a, sdqv2, sdqv3, sdqvt1, f2, f3)
2330 c00_x = co_auto(i)*f2*f3*f4
2331 cli_crit_x = cli_crit/(f2*f3)
2332 rate = c00_x*(1.0-exp(-(cli**2/cli_crit_x**2)))
2333 IF (cvw(l) .LT. 1.00)
THEN 2338 dt_lyr = (zet(l)-zet(l+1))/cvw_x
2339 closs = cll0(l)*rate*dt_lyr
2340 IF (closs .GT. cll0(l))
THEN 2345 IF (closs .GT. 0.) wlq = wlq - closs
2348 wlq = wlq - qst(ic)*eta(ic)
2350 gms(k) = (sht(k)-ssl(k))*pri(k)
2351 gmh(k) = gms(k) + (qht(k)-qol(k))*pri(k)*alhl
2352 akm = gmh(k)*gam(k-1)*dpb(k-1)
2355 gms(l) = (eta(l)*(sht(l)-ssl(l))+eta(l+1)*(ssl(l)-sht(&
2357 gmh(l) = gms(l) + (eta(l)*(qht(l)-qol(l))+eta(l+1)*(&
2358 & qol(l)-qht(l+1)))*alhl*pri(l)
2359 tx2 = tx2 + (eta(l)-eta(l+1))*gmh(l)
2360 akm = akm - gms(l)*eht(l)*pki(l) + tx2*ght(l)
2362 gms(ic) = eta(ic+1)*(ssl(ic)-sht(ic+1))*pri(ic)
2363 akm = akm - gms(ic)*eta(ic+1)*dpb(ic)*pki(ic)
2364 gmh(ic) = gms(ic) + (eta(ic+1)*(qol(ic)-qht(ic+1))*alhl+&
2365 & eta(ic)*(hst(ic)-hol(ic)))*pri(ic)
2367 IF (akm .GE. 0.0 .OR. wlq .LT. 0.0)
THEN 2371 wfn = -((wfn-acr)/akm)
2372 x3 = rasal(ic)*trg*toki*wfn
2373 IF (x3 .GT. (prs(k+1)-prs(k))*(100.*pblfrac))
THEN 2374 wfn = (prs(k+1)-prs(k))*(100.*pblfrac)
2381 rmf(ic) = rmf(ic) + tem
2386 qoi(l) = qoi(l) + (gmh(l)-gms(l))*alhi
2387 poi(l) = poi(l) + gms(l)*pki(l)*cpi
2388 qst(l) = qst(l) + gms(l)*bet(l)*cpi
2416 IF (sum(rmf(icmin:k)) .GT. 0.0)
THEN 2423 wght0 = wght0 + wght(l)*(ple(i, l+1)-ple(i, l))
2425 wght0 = (prs(k+1)-prs(k))/wght0
2431 xoib(k, itr) = xoib(k, itr) + wght(l)*xhob(i, l, itr)
2432 xoi_svb(k, itr) = xoi_svb(k, itr) - wght(l)*xhob(i, l, itr)
2435 xoib(icmin:k-1, :) = xoib(icmin:k-1, :) + xhob(i, icmin:k-1, :)
2436 xhob(i, icmin:k-1, :) = 0.0_8
2446 IF (branch .LT. 3)
THEN 2447 IF (branch .NE. 0)
THEN 2448 IF (branch .EQ. 1)
THEN 2454 ELSE IF (branch .LT. 5)
THEN 2455 IF (branch .EQ. 3)
THEN 2460 ELSE IF (branch .EQ. 5)
THEN 2466 xcub(l, itr) = xcub(l, itr) + xoib(l, itr)
2470 tempb1 = tem*xcub(ic, itr)
2471 tempb2 = -(eta(ic+1)*tempb1)
2472 xhtb(itr) = xhtb(itr) + 2.*tempb1
2473 xoib(ic, itr) = xoib(ic, itr) + tempb2 - 2.*(eta(ic)-eta(ic+1)&
2475 xoib(ic+1, itr) = xoib(ic+1, itr) + tempb2
2481 tempb = tem*xcub(l, itr)
2482 tempb0 = eta(l+1)*tempb
2483 xoib(l-1, itr) = xoib(l-1, itr) + eta(l)*tempb
2484 xoib(l, itr) = xoib(l, itr) + tempb0 - eta(l)*tempb
2485 xoib(l+1, itr) = xoib(l+1, itr) - tempb0
2490 xoib(k-1, itr) = xoib(k-1, itr) + tem*xcub(k, itr)
2491 xoib(k, itr) = xoib(k, itr) - tem*xcub(k, itr)
2498 xoib(l, itr) = xoib(l, itr) + tem*fnoscav*xhtb(itr)
2500 IF (branch .EQ. 0)
THEN 2509 xoib(k, itr) = xoib(k, itr) + fnoscav*xhtb(itr)
2512 IF (branch .EQ. 0)
THEN 2532 130 xcub(icmin:k0, :) = 0.0_8
2534 xoib = xoib + xoi_svb
2536 IF (branch .NE. 0)
THEN 2539 xhob(i, l, itr) = xhob(i, l, itr) + wght(l)*xoib(k, itr)
2545 xhob(i, icmin:k, itr) = xhob(i, icmin:k, itr) + xoib(icmin:k, itr)
2546 xoib(icmin:k, itr) = 0.0_8
subroutine, public acritn(PL, PLB, ACR, ACRITFAC)
subroutine popinteger4(x)
subroutine, public rase_tracer_b(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, xhob, fscav)
subroutine popcontrol2b(cc)
subroutine, public dqsat_ras(DQSi, QSSi, TEMP, PLO, lm, ESTBLX, CONS_H2OMW, CONS_AIRMW)
void popreal8array(double *x, int n)
subroutine, public dqsats_ras(DQSi, QSSi, TEMP, PLO, ESTBLX, CONS_H2OMW, CONS_AIRMW)
subroutine dqsats_ras_b(dqsi, dqsib, qssi, qssib, temp, tempb, plo, estblx, cons_h2omw, cons_airmw)
subroutine pushcontrol1b(cc)
subroutine sundq3_ice_b(temp, tempb, rate2, rate3, te1, f2, f2b, f3)
subroutine dqsat_ras_b(dqsi, dqsib, qssi, qssib, temp, tempb, plo, lm, estblx, cons_h2omw, cons_airmw)
subroutine pushcontrol2b(cc)
void pushreal8array(double *x, int n)
subroutine, public rase_b(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, thob, qho, qhob, uho, uhob, vho, vhob, co_auto, ple, clw, clwb, flxd, flxdb, cnv_prc3, cnv_prc3b, cnv_updfrc, cnv_updfrcb, rasparams, estblx)
subroutine, public sundq3_ice(TEMP, RATE2, RATE3, TE1, F2, F3)
subroutine popcontrol3b(cc)
subroutine popcontrol1b(cc)
subroutine pushcontrol3b(cc)
subroutine pushinteger4(x)