33 public :: calcape, calcape2
35 public :: calrh_gfs, calrh_gsd, calrh_nam
44 SUBROUTINE calrh(P1,T1,Q1,RH)
46 use ctlblk_mod
, only: im, jsta, jend, modelname
49 REAL,
dimension(IM,jsta:jend),
intent(in) :: p1,t1
50 REAL,
dimension(IM,jsta:jend),
intent(inout) :: q1
51 REAL,
dimension(IM,jsta:jend),
intent(out) :: rh
53 IF(modelname ==
'RAPR')
THEN
54 CALL calrh_gsd(p1,t1,q1,rh)
56 CALL calrh_nam(p1,t1,q1,rh)
91 SUBROUTINE calrh_nam(P1,T1,Q1,RH)
93 use ctlblk_mod
, only: jsta, jend, spval, im
101 REAL,
dimension(IM,jsta:jend),
intent(in) :: p1,t1
102 REAL,
dimension(IM,jsta:jend),
intent(inout) :: q1
103 REAL,
dimension(IM,jsta:jend),
intent(out) :: rh
112 IF (t1(i,j) < spval)
THEN
113 IF (abs(p1(i,j)) >= 1)
THEN
114 qc = pq0/p1(i,j)*exp(a2*(t1(i,j)-a3)/(t1(i,j)-a4))
120 IF (rh(i,j) > 1.0)
THEN
124 IF (rh(i,j) < rhmin)
THEN
138 END SUBROUTINE calrh_nam
171 SUBROUTINE calrh_gfs(P1,T1,Q1,RH)
173 use ctlblk_mod
, only: jsta, jend, spval, im
177 real,
parameter:: con_rd =2.8705e+2
178 real,
parameter:: con_rv =4.6150e+2
179 real,
parameter:: con_eps =con_rd/con_rv
180 real,
parameter:: con_epsm1 =con_rd/con_rv-1
190 REAL,
dimension(IM,jsta:jend),
intent(in) :: p1,t1
191 REAL,
dimension(IM,jsta:jend),
intent(inout):: q1,rh
201 IF (t1(i,j) < spval .AND. p1(i,j) < spval.AND.q1(i,j)/=spval)
THEN
204 IF (p1(i,j) >= 1.0)
THEN
205 es = min(
fpvsnew(t1(i,j)),p1(i,j))
206 qc = con_eps*es/(p1(i,j)+con_epsm1*es)
210 rh(i,j) = min(1.0,max(q1(i,j)/qc,rhmin))
230 END SUBROUTINE calrh_gfs
234 SUBROUTINE calrh_gsd(P1,T1,Q1,RHB)
240 use ctlblk_mod
, only: jsta, jend, im, spval
245 real :: tx, pol, esx, es, e
246 real,
dimension(im,jsta:jend) :: p1, t1, q1, rhb
251 IF (t1(i,j) < spval .AND. p1(i,j) < spval .AND. q1(i,j) < spval)
THEN
254 pol = 0.99999683 + tx*(-0.90826951e-02 + &
255 tx*(0.78736169e-04 + tx*(-0.61117958e-06 + &
256 tx*(0.43884187e-08 + tx*(-0.29883885e-10 + &
257 tx*(0.21874425e-12 + tx*(-0.17892321e-14 + &
258 tx*(0.11112018e-16 + tx*(-0.30994571e-19)))))))))
262 e = p1(i,j)/100.*q1(i,j)/(0.62197+q1(i,j)*0.37803)
263 rhb(i,j) = min(1.,e/es)
270 END SUBROUTINE calrh_gsd
274 SUBROUTINE calrh_pw(RHPW)
282 use ctlblk_mod
, only: lm, jsta, jend, lm, im, spval
286 real,
PARAMETER :: svp1=6.1153,svp2=17.67,svp3=29.65
288 REAL,
dimension(im,jsta:jend):: pw, pw_sat, rhpw
289 REAL deltp,sh,qv,temp,es,qs,qv_sat
290 integer i,j,l,k,ka,kb
301 if(t(i,j,k)<spval.and.q(i,j,k)<spval)
then
308 deltp = 0.5*(pmid(i,j,kb)-pmid(i,j,ka))
309 pw(i,j) = pw(i,j) + sh *deltp/g
316 es = svp1*exp(svp2*(temp-273.15)/(temp-svp3))
318 qs = 0.62198*es/(pmid(i,j,k)*1.e-2-0.37802*es)
322 pw_sat(i,j) = pw_sat(i,j) + max(sh,qs)*deltp/g
324 if (i==120 .and. j==120 ) &
325 write (6,*)
'pw-sat', temp, sh, qs, pmid(i,j,kb) &
326 ,pmid(i,j,ka),pw(i,j),pw_sat(i,j)
329 rhpw(i,j) = min(1.,pw(i,j) / pw_sat(i,j)) * 100.
337 END SUBROUTINE calrh_pw
365 integer,
parameter:: nxpvs=7501
366 real,
parameter:: con_ttp =2.7316e+2
367 real,
parameter:: con_psat =6.1078e+2
368 real,
parameter:: con_cvap =1.8460e+3
369 real,
parameter:: con_cliq =4.1855e+3
370 real,
parameter:: con_hvap =2.5000e+6
371 real,
parameter:: con_rv =4.6150e+2
372 real,
parameter:: con_csol =2.1060e+3
373 real,
parameter:: con_hfus =3.3358e+5
374 real,
parameter:: tliq=con_ttp
375 real,
parameter:: tice=con_ttp-20.0
376 real,
parameter:: dldtl=con_cvap-con_cliq
377 real,
parameter:: heatl=con_hvap
378 real,
parameter:: xponal=-dldtl/con_rv
379 real,
parameter:: xponbl=-dldtl/con_rv+heatl/(con_rv*con_ttp)
380 real,
parameter:: dldti=con_cvap-con_csol
381 real,
parameter:: heati=con_hvap+con_hfus
382 real,
parameter:: xponai=-dldti/con_rv
383 real,
parameter:: xponbi=-dldti/con_rv+heati/(con_rv*con_ttp)
388 real xj,x,tbpvs(nxpvs),xp1
389 real xmin,xmax,xinc,c2xpvs,c1xpvs
393 xinc=(xmax-xmin)/(nxpvs-1)
396 c1xpvs=1.-xmin*c2xpvs
398 xj=min(max(c1xpvs+c2xpvs*t,1.0),float(nxpvs))
399 jx=min(xj,float(nxpvs)-1.0)
404 tbpvs(jx)=con_psat*(tr**xponal)*exp(xponbl*(1.-tr))
406 tbpvs(jx)=con_psat*(tr**xponai)*exp(xponbi*(1.-tr))
408 w=(t-tice)/(tliq-tice)
409 pvl=con_psat*(tr**xponal)*exp(xponbl*(1.-tr))
410 pvi=con_psat*(tr**xponai)*exp(xponbi*(1.-tr))
411 tbpvs(jx)=w*pvl+(1.-w)*pvi
414 xp1=xmin+(jx-1+1)*xinc
418 tbpvs(jx+1)=con_psat*(tr**xponal)*exp(xponbl*(1.-tr))
419 elseif(xp1<tice)
then
420 tbpvs(jx+1)=con_psat*(tr**xponai)*exp(xponbi*(1.-tr))
422 w=(t-tice)/(tliq-tice)
423 pvl=con_psat*(tr**xponal)*exp(xponbl*(1.-tr))
424 pvi=con_psat*(tr**xponai)*exp(xponbi*(1.-tr))
425 tbpvs(jx+1)=w*pvl+(1.-w)*pvi
428 fpvsnew=tbpvs(jx)+(xj-jx)*(tbpvs(jx+1)-tbpvs(jx))
523 SUBROUTINE calcape(ITYPE,DPBND,P1D,T1D,Q1D,L1D,CAPE, &
524 cins,pparc,zeql,thund)
525 use vrbls3d, only: pmid, t, q, zint
528 use params_mod, only: d00, h1m12, h99999, h10e5, capa, elocp, eps, &
530 use lookup_mod, only: thl, rdth, jtb, qs0, sqs, rdq, itb, ptbl, &
531 plq, ttbl, pl, rdp, the0, sthe, rdthe, ttblq, &
532 itbq, jtbq, rdpq, the0q, stheq, rdtheq
533 use ctlblk_mod
, only: jsta_2l, jend_2u, lm, jsta, jend, im, me, spval
539 real,
PARAMETER :: ismthp=2,ismtht=2,ismthq=2
543 integer,
intent(in) :: itype
544 real,
intent(in) :: dpbnd
545 integer,
dimension(IM,Jsta:jend),
intent(in) :: l1d
546 real,
dimension(IM,Jsta:jend),
intent(in) :: p1d,t1d
547 real,
dimension(IM,jsta:jend),
intent(inout) :: q1d,cape,cins,pparc,zeql
549 integer,
dimension(im,jsta:jend) :: iptb, ithtb, parcel, klres, khres, lcl, idx
551 real,
dimension(im,jsta:jend) :: thesp, psp, cape20, qq, pp, thund
552 REAL,
ALLOCATABLE :: tpar(:,:,:)
554 LOGICAL thunder(im,jsta:jend), needthun
555 real psfck,pkl,tbtk,qbtk,apebtk,tthbtk,tthk,apespk,tpspk, &
556 bqs00k,sqs00k,bqs10k,sqs10k,bqk,sqk,tqk,presk,gdzkl,thetap, &
557 thetaa,p00k,p10k,p01k,p11k,tthesk,esatp,qsatp,tvp,tv
559 integer i,j,l,knuml,knumh,lbeg,lend,iq, kb,ittbk
566 ALLOCATE(tpar(im,jsta_2l:jend_2u,lm))
600 thunder(i,j) = .true.
621 q1d(i,j) = min(max(h1m12,q1d(i,j)),h99999)
631 IF (itype == 1 .OR. (itype == 2 .AND. kb == 1))
THEN
638 psfck = pmid(i,j,nint(lmh(i,j)))
640 IF(psfck<spval.and.pkl<spval)
THEN
644 (itype == 1 .AND. (pkl >= psfck-dpbnd .AND. pkl <= psfck)))
THEN
647 qbtk = max(0.0, q(i,j,kb))
648 apebtk = (h10e5/pkl)**capa
652 qbtk = max(0.0, q1d(i,j))
653 apebtk = (h10e5/pkl)**capa
664 tthk = (tthbtk-thl)*rdth
665 qq(i,j) = tthk - aint(tthk)
666 ittbk = int(tthk) + 1
672 IF(ittbk >= jtb)
THEN
679 bqs10k = qs0(ittbk+1)
680 sqs10k = sqs(ittbk+1)
682 bqk = (bqs10k-bqs00k)*qq(i,j) + bqs00k
683 sqk = (sqs10k-sqs00k)*qq(i,j) + sqs00k
684 tqk = (qbtk-bqk)/sqk*rdq
685 pp(i,j) = tqk-aint(tqk)
697 p00k = ptbl(iq ,ittbk )
698 p10k = ptbl(iq+1,ittbk )
699 p01k = ptbl(iq ,ittbk+1)
700 p11k = ptbl(iq+1,ittbk+1)
702 tpspk = p00k + (p10k-p00k)*pp(i,j) + (p01k-p00k)*qq(i,j) &
703 + (p00k-p10k-p01k+p11k)*pp(i,j)*qq(i,j)
706 if (tpspk > 1.0e-3)
then
707 apespk = (max(0.,h10e5/ tpspk))**capa
712 tthesk = tthbtk * exp(elocp*qbtk*apespk/tthbtk)
714 IF(tthesk > thesp(i,j))
THEN
730 pparc(i,j) = pmid(i,j,parcel(i,j))
741 IF (pmid(i,j,l) < psp(i,j)) lcl(i,j) = l+1
748 IF (lcl(i,j) > nint(lmh(i,j))) lcl(i,j) = nint(lmh(i,j))
750 IF (t(i,j,lcl(i,j)) < 263.15)
THEN
751 thunder(i,j) = .false.
768 IF(l <= lcl(i,j))
THEN
769 IF(pmid(i,j,l) < plq)
THEN
783 CALL ttblex(tpar(1,jsta_2l,l),ttbl,itb,jtb,klres &
784 , pmid(1,jsta_2l,l),pl,qq,pp,rdp,the0,sthe &
785 , rdthe,thesp,iptb,ithtb)
791 CALL ttblex(tpar(1,jsta_2l,l),ttblq,itbq,jtbq,khres &
792 , pmid(1,jsta_2l,l),plq,qq,pp,rdpq &
793 ,the0q,stheq,rdtheq,thesp,iptb,ithtb)
800 IF(khres(i,j) > 0)
THEN
801 IF(tpar(i,j,l) > t(i,j,l)) ieql(i,j) = l
809 IF(klres(i,j) > 0)
THEN
810 IF(tpar(i,j,l) > t(i,j,l) .AND. &
811 pmid(i,j,l)>100.) ieql(i,j) = l
822 lbeg = min(ieql(i,j),lbeg)
823 lend = max(lcl(i,j),lend)
830 IF(t(i,j,ieql(i,j)) > 255.65)
THEN
831 thunder(i,j) = .false.
842 IF(l >= ieql(i,j).AND.l <= lcl(i,j))
THEN
851 IF(idx(i,j) > 0)
THEN
853 gdzkl = (zint(i,j,l)-zint(i,j,l+1)) * g
854 esatp = min(
fpvsnew(tpar(i,j,l)),presk)
855 qsatp = eps*esatp/(presk-esatp*oneps)
857 tvp = tvirtual(tpar(i,j,l),qsatp)
858 thetap = tvp*(h10e5/presk)**capa
860 tv = tvirtual(t(i,j,l),q(i,j,l))
861 thetaa = tv*(h10e5/presk)**capa
862 IF(thetap < thetaa)
THEN
863 cins(i,j) = cins(i,j) + (log(thetap)-log(thetaa))*gdzkl
864 ELSEIF(thetap > thetaa)
THEN
865 cape(i,j) = cape(i,j) + (log(thetap)-log(thetaa))*gdzkl
866 IF (thunder(i,j) .AND. t(i,j,l) < 273.15 &
867 .AND. t(i,j,l) > 253.15)
THEN
868 cape20(i,j) = cape20(i,j) + (log(thetap)-log(thetaa))*gdzkl
882 cape(i,j) = max(d00,cape(i,j))
883 cins(i,j) = min(cins(i,j),d00)
885 zeql(i,j) = zint(i,j,ieql(i,j))
886 teql(i,j) = t(i,j,ieql(i,j))
887 IF (cape20(i,j) < 75.)
THEN
888 thunder(i,j) = .false.
890 IF (thunder(i,j))
THEN
900 END SUBROUTINE calcape
998 SUBROUTINE calcape2(ITYPE,DPBND,P1D,T1D,Q1D,L1D, &
999 cape,cins,lfc,esrhl,esrhh, &
1001 use vrbls3d, only: pmid, t, q, zint
1003 use gridspec_mod
, only: gridtype
1004 use masks, only: lmh
1005 use params_mod, only: d00, h1m12, h99999, h10e5, capa, elocp, eps, &
1007 use lookup_mod, only: thl, rdth, jtb, qs0, sqs, rdq, itb, ptbl, &
1008 plq, ttbl, pl, rdp, the0, sthe, rdthe, ttblq, &
1009 itbq, jtbq, rdpq, the0q, stheq, rdtheq
1010 use ctlblk_mod
, only: jsta_2l, jend_2u, lm, jsta, jend, im, jm, me, jsta_m, jend_m, spval
1016 real,
PARAMETER :: ismthp=2,ismtht=2,ismthq=2
1020 integer,
intent(in) :: itype
1021 real,
intent(in) :: dpbnd
1022 integer,
dimension(IM,Jsta:jend),
intent(in) :: l1d
1023 real,
dimension(IM,Jsta:jend),
intent(in) :: p1d,t1d
1025 real,
dimension(IM,jsta:jend),
intent(inout) :: q1d,cape,cins
1026 real,
dimension(IM,jsta:jend) :: pparc,zeql
1027 real,
dimension(IM,jsta:jend),
intent(inout) :: lfc,esrhl,esrhh
1028 real,
dimension(IM,jsta:jend),
intent(inout) :: dcape,dgld,esp
1029 integer,
dimension(im,jsta:jend) ::l12,l17,l3km
1031 integer,
dimension(im,jsta:jend) :: iptb, ithtb, parcel, klres, khres, lcl, idx
1033 real,
dimension(im,jsta:jend) :: thesp, psp, cape20, qq, pp, thund
1034 integer,
dimension(im,jsta:jend) :: parcel2
1035 real,
dimension(im,jsta:jend) :: thesp2,psp2
1036 real,
dimension(im,jsta:jend) :: cape4,cins4
1037 REAL,
ALLOCATABLE :: tpar(:,:,:)
1038 REAL,
ALLOCATABLE :: tpar2(:,:,:)
1040 LOGICAL thunder(im,jsta:jend), needthun
1041 real psfck,pkl,tbtk,qbtk,apebtk,tthbtk,tthk,apespk,tpspk, &
1042 bqs00k,sqs00k,bqs10k,sqs10k,bqk,sqk,tqk,presk,gdzkl,thetap, &
1043 thetaa,p00k,p10k,p01k,p11k,tthesk,esatp,qsatp,tvp,tv
1044 real presk2, esatp2, qsatp2, tvp2, thetap2, tv2, thetaa2
1046 integer i,j,l,knuml,knumh,lbeg,lend,iq, kb,ittbk
1047 integer ie,iw,jn,js,ive(jm),ivw(jm),jvn,jvs
1048 integer istart,istop,jstart,jstop
1049 real,
dimension(IM,jsta:jend) :: htsfc
1056 ALLOCATE(tpar(im,jsta_2l:jend_2u,lm))
1057 ALLOCATE(tpar2(im,jsta_2l:jend_2u,lm))
1093 thunder(i,j) = .true.
1118 IF(gridtype ==
'E')
THEN
1129 ELSE IF(gridtype ==
'B')
THEN
1153 IF(gridtype /=
'A') CALL exch(fis(1:im,jsta:jend))
1163 IF (gridtype==
'B')
THEN
1164 htsfc(i,j) = (0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(ie,jn))
1166 htsfc(i,j) = (0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(i,js))
1175 IF (itype == 2)
THEN
1179 q1d(i,j) = min(max(h1m12,q1d(i,j)),h99999)
1189 IF (itype == 1 .OR. (itype == 2 .AND. kb == 1))
THEN
1196 psfck = pmid(i,j,nint(lmh(i,j)))
1200 IF (itype ==2 .OR. &
1201 (itype == 1 .AND. (pkl >= psfck-dpbnd .AND. pkl <= psfck)))
THEN
1202 IF (itype == 1)
THEN
1204 qbtk = max(0.0, q(i,j,kb))
1205 apebtk = (h10e5/pkl)**capa
1209 qbtk = max(0.0, q1d(i,j))
1210 apebtk = (h10e5/pkl)**capa
1220 tthbtk = tbtk*apebtk
1221 tthk = (tthbtk-thl)*rdth
1222 qq(i,j) = tthk - aint(tthk)
1223 ittbk = int(tthk) + 1
1229 IF(ittbk >= jtb)
THEN
1236 bqs10k = qs0(ittbk+1)
1237 sqs10k = sqs(ittbk+1)
1239 bqk = (bqs10k-bqs00k)*qq(i,j) + bqs00k
1240 sqk = (sqs10k-sqs00k)*qq(i,j) + sqs00k
1241 tqk = (qbtk-bqk)/sqk*rdq
1242 pp(i,j) = tqk-aint(tqk)
1254 p00k = ptbl(iq ,ittbk )
1255 p10k = ptbl(iq+1,ittbk )
1256 p01k = ptbl(iq ,ittbk+1)
1257 p11k = ptbl(iq+1,ittbk+1)
1259 tpspk = p00k + (p10k-p00k)*pp(i,j) + (p01k-p00k)*qq(i,j) &
1260 + (p00k-p10k-p01k+p11k)*pp(i,j)*qq(i,j)
1263 if (tpspk > 1.0e-3)
then
1264 apespk = (max(0.,h10e5/ tpspk))**capa
1269 tthesk = tthbtk * exp(elocp*qbtk*apespk/tthbtk)
1271 IF(tthesk > thesp(i,j))
THEN
1277 IF(tthesk < thesp2(i,j))
THEN
1279 thesp2(i,j) = tthesk
1292 pparc(i,j) = pmid(i,j,parcel(i,j))
1303 IF (pmid(i,j,l) < psp(i,j)) lcl(i,j) = l+1
1310 IF (lcl(i,j) > nint(lmh(i,j))) lcl(i,j) = nint(lmh(i,j))
1312 IF (t(i,j,lcl(i,j)) < 263.15)
THEN
1313 thunder(i,j) = .false.
1329 IF(l <= lcl(i,j))
THEN
1330 IF(pmid(i,j,l) < plq)
THEN
1344 CALL ttblex(tpar(1,jsta_2l,l),ttbl,itb,jtb,klres &
1345 , pmid(1,jsta_2l,l),pl,qq,pp,rdp,the0,sthe &
1346 , rdthe,thesp,iptb,ithtb)
1352 CALL ttblex(tpar(1,jsta_2l,l),ttblq,itbq,jtbq,khres &
1353 , pmid(1,jsta_2l,l),plq,qq,pp,rdpq &
1354 ,the0q,stheq,rdtheq,thesp,iptb,ithtb)
1361 IF(khres(i,j) > 0)
THEN
1362 IF(tpar(i,j,l) > t(i,j,l)) ieql(i,j) = l
1370 IF(klres(i,j) > 0)
THEN
1371 IF(tpar(i,j,l) > t(i,j,l)) ieql(i,j) = l
1382 lbeg = min(ieql(i,j),lbeg)
1383 lend = max(lcl(i,j),lend)
1390 IF(t(i,j,ieql(i,j)) > 255.65)
THEN
1391 thunder(i,j) = .false.
1407 IF(l >= ieql(i,j).AND.l <= lcl(i,j))
THEN
1417 IF(idx(i,j) > 0)
THEN
1419 gdzkl = (zint(i,j,l)-zint(i,j,l+1)) * g
1420 esatp = min(
fpvsnew(tpar(i,j,l)),presk)
1421 qsatp = eps*esatp/(presk-esatp*oneps)
1423 tvp = tvirtual(tpar(i,j,l),qsatp)
1424 thetap = tvp*(h10e5/presk)**capa
1426 tv = tvirtual(t(i,j,l),q(i,j,l))
1427 thetaa = tv*(h10e5/presk)**capa
1428 IF(thetap < thetaa)
THEN
1429 cins4(i,j) = cins4(i,j) + (log(thetap)-log(thetaa))*gdzkl
1430 IF(zint(i,j,l)-htsfc(i,j) <= 3000.)
THEN
1431 cins(i,j) = cins(i,j) + (log(thetap)-log(thetaa))*gdzkl
1433 ELSEIF(thetap > thetaa)
THEN
1434 cape4(i,j) = cape4(i,j) + (log(thetap)-log(thetaa))*gdzkl
1435 IF(zint(i,j,l)-htsfc(i,j) <= 3000.)
THEN
1436 cape(i,j) = cape(i,j) + (log(thetap)-log(thetaa))*gdzkl
1438 IF (thunder(i,j) .AND. t(i,j,l) < 273.15 &
1439 .AND. t(i,j,l) > 253.15)
THEN
1440 cape20(i,j) = cape20(i,j) + (log(thetap)-log(thetaa))*gdzkl
1445 IF (itype /= 1)
THEN
1446 presk2 = pmid(i,j,l+1)
1447 esatp2 = min(
fpvsnew(tpar(i,j,l+1)),presk2)
1448 qsatp2 = eps*esatp2/(presk2-esatp2*oneps)
1450 tvp2 = tvirtual(tpar(i,j,l+1),qsatp2)
1451 thetap2 = tvp2*(h10e5/presk2)**capa
1453 tv2 = tvirtual(t(i,j,l+1),q(i,j,l+1))
1454 thetaa2 = tv2*(h10e5/presk2)**capa
1455 IF(thetap >= thetaa .AND. thetap2 <= thetaa2)
THEN
1456 IF(lfc(i,j) == d00)
THEN
1457 lfc(i,j) = zint(i,j,l)
1463 IF(zint(i,j,l)-htsfc(i,j) <= 3000.)
THEN
1464 IF(cape4(i,j) >= 100. .AND. cins4(i,j) >= -250.)
THEN
1465 IF(esrhl(i,j) == lcl(i,j)) esrhl(i,j)=l
1478 IF(esrhh(i,j) > esrhl(i,j)) esrhh(i,j)=ieql(i,j)
1489 cape(i,j) = max(d00,cape(i,j))
1490 cins(i,j) = min(cins(i,j),d00)
1492 zeql(i,j) = zint(i,j,ieql(i,j))
1493 lfc(i,j) = min(lfc(i,j),zint(i,j,ieql(i,j)))
1494 lfc(i,j) = max(zint(i,j, lcl(i,j)),lfc(i,j))
1495 IF (cape20(i,j) < 75.)
THEN
1496 thunder(i,j) = .false.
1498 IF (thunder(i,j))
THEN
1509 IF (itype == 1)
THEN
1519 psfck = pmid(i,j,nint(lmh(i,j)))
1521 IF(pkl >= psfck-dpbnd)
THEN
1522 IF(pmid(i,j,l) < plq)
THEN
1536 CALL ttblex(tpar2(1,jsta_2l,l),ttbl,itb,jtb,klres &
1537 , pmid(1,jsta_2l,l),pl,qq,pp,rdp,the0,sthe &
1538 , rdthe,thesp2,iptb,ithtb)
1544 CALL ttblex(tpar2(1,jsta_2l,l),ttblq,itbq,jtbq,khres &
1545 , pmid(1,jsta_2l,l),plq,qq,pp,rdpq &
1546 , the0q,stheq,rdtheq,thesp2,iptb,ithtb)
1558 IF(l >= parcel2(i,j).AND.l < nint(lmh(i,j)))
THEN
1567 IF(idx(i,j) > 0)
THEN
1569 gdzkl = (zint(i,j,l)-zint(i,j,l+1)) * g
1570 esatp = min(
fpvsnew(tpar2(i,j,l)),presk)
1571 qsatp = eps*esatp/(presk-esatp*oneps)
1573 tvp = tvirtual(tpar2(i,j,l),qsatp)
1574 thetap = tvp*(h10e5/presk)**capa
1576 tv = tvirtual(t(i,j,l),q(i,j,l))
1577 thetaa = tv*(h10e5/presk)**capa
1579 dcape(i,j) = dcape(i,j) + (log(thetap)-log(thetaa))*gdzkl
1589 dcape(i,j) = min(d00,dcape(i,j))
1605 IF(t(i,j,l) <= tfrz-12. .AND. l12(i,j)==lm) l12(i,j)=l
1606 IF(t(i,j,l) <= tfrz-17. .AND. l17(i,j)==lm) l17(i,j)=l
1613 IF(l12(i,j)/=lm .AND. l17(i,j)/=lm)
THEN
1614 dgld(i,j)=zint(i,j,l17(i,j))-zint(i,j,l12(i,j))
1615 dgld(i,j)=max(dgld(i,j),0.)
1629 IF(zint(i,j,l)-htsfc(i,j) <= 3000.) l3km(i,j)=l
1636 esp(i,j) = (cape(i,j) / 50.) * (t(i,j,lm) - t(i,j,l3km(i,j)) - 7.0)
1637 IF((t(i,j,lm) - t(i,j,l3km(i,j))) < 7.0) esp(i,j) = 0.
1645 END SUBROUTINE calcape2
1652 elemental function tvirtual(T,Q)
1658 REAL,
INTENT(IN) :: t, q
1660 tvirtual = t*(1+0.608*q)
1662 end function tvirtual
elemental real function, public fpvsnew(t)
calcape() computes CAPE/CINS and other storm related variables.