89 use vrbls3d, only: pmid, uh, vh, t, zmid, zint, pint, alpint, q, omga
90 use vrbls3d, only: catedr,mwt,gtg
91 use vrbls2d, only: pblh, cprate, fis, t500, t700, z500, z700,&
94 use params_mod, only: d00, d50, h99999, h100, h1, h1m12, pq0, a2, a3, a4, &
95 rhmin, rgamog, tfrz, small, g
96 use ctlblk_mod
, only: grib, cfld, fld_info, datapd, im, jsta, jend, jm, jsta_m, jend_m, &
97 nbnd, nbin_du, lm, htfd, spval, pthresh, nfd, petabnd, me,&
98 jsta_2l, jend_2u, modelname, submodelname
99 use rqstfld_mod
, only: iget, lvls, id, iavblfld, lvlsxml
102 use gridspec_mod
, only: gridtype
109 real,
PARAMETER :: c2k=273.15
110 real,
parameter :: con_rd =2.8705e+2
111 real,
parameter :: con_rv =4.6150e+2
112 real,
parameter :: con_eps =con_rd/con_rv
113 real,
parameter :: con_epsm1 =con_rd/con_rv-1
114 real,
parameter :: cpthresh =0.000004
115 real,
PARAMETER :: d1000=1000
116 real,
PARAMETER :: d1500=1500
117 real,
PARAMETER :: d2000=2000
118 real,
PARAMETER :: hconst=42000000.
119 real,
PARAMETER :: k2c=273.16
120 REAL,
PARAMETER :: dm9999=-9999.0
125 LOGICAL north, field1,field2
126 LOGICAL,
dimension(IM,JSTA:JEND) :: done, done1
128 INTEGER,
allocatable :: lvlbnd(:,:,:),lb2(:,:)
131 real,
dimension(im,jm) :: grid1, grid2
132 real,
dimension(im,jsta:jend) :: p1d, t1d, q1d, u1d, v1d, shr1d, z1d, &
133 rh1d, egrid1, egrid2, egrid3, egrid4, &
134 egrid5, egrid6, egrid7, egrid8, &
135 mlcape,mlcin,mllcl,mucape,mucin,mumixr, &
136 freezelvl,muq1d,slcl,the,maxthe
137 integer,
dimension(im,jsta:jend) :: maxthepos
138 real,
dimension(:,:,:),
allocatable :: omgbnd, pwtbnd, qcnvbnd, &
143 icingfd,gtgfd,catfd,mwtfd
144 real,
dimension(:,:,:,:),
allocatable :: aerfd
146 real,
dimension(:,:),
allocatable :: qm8510, rh4710, rh8498, &
147 rh4796, rh1847, ust, vst, &
148 rh3310, rh6610, rh3366, &
149 pw3310, rh4410, rh7294, &
151 t78483, t89671, p78483, p89671
153 REAL,
dimension(:,:,:),
allocatable :: heli
154 real,
dimension(:,:),
allocatable :: ushr1, vshr1, ushr6, vshr6, &
155 maxwp, maxwz, maxwu, maxwv, &
157 INTEGER,
dimension(:,:),
allocatable :: llow, lupp
158 REAL,
dimension(:,:),
allocatable :: cangle,eshr,uvect,vvect,&
159 effust,effvst,fshr,htsfc,&
162 integer i,j,jj,l,itype,isvalue,lbnd,ilvl,ifd,itypefdlvl(nfd), &
163 iget1, iget2, iget3, llmh,imax,jmax,lmax
164 real dpbnd,pkl1,pku1,fac1,fac2,pl,tl,ql,qsat,rhl,tvrl,tvrblo, &
165 es1,es2,qs1,qs2,rh1,rh2,zsf,depth(2),work1,work2,work3, &
166 scintmp,mucapetmp,mucintmp,mllcltmp,eshrtmp,mlcapetmp,stp,&
167 fshrtmp,mlcintmp,slcltmp,lapse,ship
171 REAL,
allocatable :: htfdctl(:)
172 integer,
allocatable :: itypefdlvlctl(:)
173 integer ie,iw,jn,js,ive(jm),ivw(jm),jvn,jvs
174 integer istart,istop,jstart,jstop,midcal
175 real dummy(im,jsta:jend)
176 integer idummy(im,jsta:jend)
178 INTEGER,
dimension(:,:),
allocatable :: el_base, el_tops
179 LOGICAL,
dimension(:,:),
allocatable :: found_base, found_tops
180 INTEGER,
dimension(:,:),
allocatable :: l_thetae_max
181 INTEGER,
dimension(:,:),
allocatable :: cape9, cins9
182 CHARACTER(LEN=5) :: im_ch, jsta_ch, jend_ch, me_ch
183 CHARACTER(LEN=60) :: effl_fname
184 CHARACTER(LEN=60) :: effl_fname2
185 INTEGER :: irec, iunit
186 INTEGER :: irec2, iunit2
187 LOGICAL :: debugprint
189 INTEGER :: llcl_par, leql_par
190 REAL :: lmask, psfc, cape_par, cins_par, lpar0
191 REAL,
DIMENSION(4) :: parcel0
192 REAL,
DIMENSION(:),
ALLOCATABLE :: tpar_b, tpar_t
193 REAL,
DIMENSION(:),
ALLOCATABLE :: tpar_tmp
194 REAL,
DIMENSION(:),
ALLOCATABLE :: p_amb, t_amb, q_amb, zint_amb
195 REAL,
DIMENSION(:,:,:),
ALLOCATABLE :: tpar_base, tpar_tops
204 allocate(ushr1(im,jsta_2l:jend_2u),vshr1(im,jsta_2l:jend_2u), &
205 ushr6(im,jsta_2l:jend_2u),vshr6(im,jsta_2l:jend_2u))
206 allocate(ust(im,jsta_2l:jend_2u),vst(im,jsta_2l:jend_2u), &
207 heli(im,jsta_2l:jend_2u,2),fshr(im,jsta_2l:jend_2u))
214 iget2 = lvls(1,iget1)
215 iget3 = lvls(2,iget1)
217 IF (iget1 > 0 .OR. iget(163) > 0 .OR. iget(164) > 0)
THEN
220 CALL calhel(depth,ust,vst,heli,ushr1,vshr1,ushr6,vshr6)
225 grid1(i,j) = heli(i,j,1)
228 if(grib==
'grib2')
then
230 fld_info(cfld)%ifld=iavblfld(iget1)
231 fld_info(cfld)%lvl=lvlsxml(1,iget1)
236 datapd(i,j,cfld) = grid1(i,jj)
246 grid1(i,j) = heli(i,j,2)
249 if(grib==
'grib2')
then
251 fld_info(cfld)%ifld=iavblfld(iget1)
252 fld_info(cfld)%lvl=lvlsxml(2,iget1)
257 datapd(i,j,cfld) = grid1(i,jj)
263 IF (iget(163) > 0)
THEN
267 grid1(i,j) = ust(i,j)
270 if(grib==
'grib2')
then
272 fld_info(cfld)%ifld=iavblfld(iget(163))
277 datapd(i,j,cfld) = grid1(i,jj)
282 IF (iget(164) > 0)
THEN
286 grid1(i,j) = vst(i,j)
289 if(grib==
'grib2')
then
291 fld_info(cfld)%ifld=iavblfld(iget(164))
296 datapd(i,j,cfld) = grid1(i,jj)
305 if (iget(427) > 0)
THEN
306 CALL calupdhel(grid1(1,jsta_2l))
307 if(grib==
'grib2')
then
309 fld_info(cfld)%ifld=iavblfld(iget(427))
314 datapd(i,j,cfld) = grid1(i,jj)
323 IF(iget(430) > 0 .OR. iget(431) > 0 .OR. iget(432) > 0 &
324 .OR. iget(433) > 0)
THEN
327 CALL calhel(depth,ust,vst,heli,ushr1,vshr1,ushr6,vshr6)
332 fshr(i,j) = sqrt(ushr6(i,j)**2+vshr6(i,j)**2)
335 IF(iget(430) > 0)
THEN
339 grid1(i,j) = ushr1(i,j)
342 if(grib==
'grib2')
then
344 fld_info(cfld)%ifld=iavblfld(iget(430))
349 datapd(i,j,cfld) = grid1(i,jj)
354 IF(iget(431) > 0)
THEN
358 grid1(i,j) = vshr1(i,j)
361 if(grib==
'grib2')
then
363 fld_info(cfld)%ifld=iavblfld(iget(431))
368 datapd(i,j,cfld) = grid1(i,jj)
373 IF(iget(432) > 0)
THEN
377 grid1(i,j) = ushr6(i,j)
380 if(grib==
'grib2')
then
382 fld_info(cfld)%ifld=iavblfld(iget(432))
387 datapd(i,j,cfld) = grid1(i,jj)
392 IF(iget(433) > 0)
THEN
396 grid1(i,j) = vshr6(i,j)
399 if(grib==
'grib2')
then
401 fld_info(cfld)%ifld=iavblfld(iget(433))
406 datapd(i,j,cfld) = grid1(i,jj)
413 if (
allocated(ushr1))
deallocate(ushr1)
414 if (
allocated(vshr1))
deallocate(vshr1)
415 if (
allocated(ushr6))
deallocate(ushr6)
416 if (
allocated(vshr6))
deallocate(vshr6)
417 if (
allocated(ust))
deallocate(ust)
418 if (
allocated(vst))
deallocate(vst)
419 if (
allocated(heli))
deallocate(heli)
425 IF ((iget(054)>0).OR.(iget(055)>0).OR. &
426 (iget(056)>0).OR.(iget(057)>0).OR. &
428 (iget(058)>0).OR.(iget(108)>0) )
THEN
434 if(pmid(i,j,1)<spval)
then
436 CALL
tpause(lm,pmid(i,j,1:lm),uh(i,j,1:lm) &
438 ,vh(i,j,1:lm),t(i,j,1:lm),zmid(i,j,1:lm) &
440 ,p1d(i,j),u1d(i,j),v1d(i,j),t1d(i,j) &
442 ,z1d(i,j),shr1d(i,j))
456 IF (iget(054) > 0)
THEN
460 grid1(i,j) = p1d(i,j)
463 if(grib==
'grib2')
then
465 fld_info(cfld)%ifld=iavblfld(iget(054))
470 datapd(i,j,cfld) = grid1(i,jj)
477 IF (iget(399)>0)
THEN
478 CALL icaoheight(p1d, grid1(1,jsta))
480 if(grib==
'grib2')
then
482 fld_info(cfld)%ifld=iavblfld(iget(399))
487 datapd(i,j,cfld) = grid1(i,jj)
494 IF (iget(177) > 0)
THEN
498 grid1(i,j) = z1d(i,j)
501 if(grib==
'grib2')
then
503 fld_info(cfld)%ifld=iavblfld(iget(177))
508 datapd(i,j,cfld) = grid1(i,jj)
515 IF (iget(055) > 0)
THEN
519 grid1(i,j) = t1d(i,j)
522 if(grib==
'grib2')
then
524 fld_info(cfld)%ifld=iavblfld(iget(055))
529 datapd(i,j,cfld) = grid1(i,jj)
536 IF (iget(108) > 0)
THEN
537 CALL calpot(p1d,t1d,grid1(1,jsta))
538 if(grib==
'grib2')
then
540 fld_info(cfld)%ifld=iavblfld(iget(108))
545 datapd(i,j,cfld) = grid1(i,jj)
552 IF ((iget(056) > 0).OR.(iget(057) > 0))
THEN
560 if(grib==
'grib2')
then
563 fld_info(cfld)%ifld=iavblfld(iget(056))
568 datapd(i,j,cfld) = grid1(i,jj)
574 fld_info(cfld)%ifld=iavblfld(iget(057))
579 datapd(i,j,cfld) = grid2(i,jj)
587 IF (iget(058) > 0)
THEN
591 grid1(i,j) = shr1d(i,j)
594 if(grib==
'grib2')
then
596 fld_info(cfld)%ifld=iavblfld(iget(058))
601 datapd(i,j,cfld) = grid1(i,jj)
612 IF ((iget(173)>0) .OR. (iget(174)>0) .OR. &
613 (iget(175)>0) .OR. (iget(176)>0))
THEN
615 allocate(maxwp(im,jsta:jend), maxwz(im,jsta:jend), &
616 maxwu(im,jsta:jend), maxwv(im,jsta:jend),maxwt(im,jsta:jend))
633 IF (abs(pmid(i,j,l)-spval)<=small .OR. &
634 abs(uh(i,j,l)-spval)<=small .OR. &
635 abs(uh(i,j,l)-spval)<=small .OR. &
636 abs(vh(i,j,l)-spval)<=small .OR. &
637 abs(t(i,j,l)-spval)<=small .OR. &
638 abs(zmid(i,j,l)-spval)<=small) cycle loopi
641 CALL
mxwind(lm,pmid(i,j,1:lm),uh(i,j,1:lm) &
643 ,vh(i,j,1:lm),t(i,j,1:lm),zmid(i,j,1:lm) &
645 ,maxwp(i,j),maxwu(i,j),maxwv(i,j) &
647 ,maxwt(i,j),maxwz(i,j))
651 IF (iget(173) > 0)
THEN
655 grid1(i,j) = maxwp(i,j)
658 if(grib==
'grib2')
then
660 fld_info(cfld)%ifld=iavblfld(iget(173))
665 datapd(i,j,cfld) = grid1(i,jj)
671 IF (iget(398)>0)
THEN
672 CALL icaoheight(maxwp, grid1(1,jsta))
674 if(grib==
'grib2')
then
676 fld_info(cfld)%ifld=iavblfld(iget(398))
681 datapd(i,j,cfld) = grid1(i,jj)
687 IF (iget(174) > 0)
THEN
691 grid1(i,j) = maxwz(i,j)
694 if(grib==
'grib2')
then
696 fld_info(cfld)%ifld=iavblfld(iget(174))
701 datapd(i,j,cfld) = grid1(i,jj)
708 IF ((iget(175) > 0).OR.(iget(176) > 0))
THEN
712 grid1(i,j) = maxwu(i,j)
713 grid2(i,j) = maxwv(i,j)
716 if(grib==
'grib2')
then
718 fld_info(cfld)%ifld=iavblfld(iget(175))
723 datapd(i,j,cfld) = grid1(i,jj)
727 fld_info(cfld)%ifld=iavblfld(iget(176))
732 datapd(i,j,cfld) = grid2(i,jj)
738 IF (iget(314) > 0)
THEN
742 grid1(i,j)=maxwt(i,j)
745 if(grib==
'grib2')
then
747 fld_info(cfld)%ifld=iavblfld(iget(314))
752 datapd(i,j,cfld) = grid1(i,jj)
757 deallocate(maxwp,maxwz,maxwu,maxwv,maxwt)
763 IF ( (iget(059)>0.or.iget(586)>0).OR.iget(911)>0.OR. &
764 (iget(060)>0.or.iget(576)>0).OR. &
765 (iget(061)>0.or.iget(577)>0).OR. &
766 (iget(601)>0.or.iget(602)>0.or.iget(603)>0).OR. &
767 (iget(604)>0.or.iget(605)>0).OR. &
768 (iget(451)>0.or.iget(578)>0).OR.iget(580)>0 )
THEN
770 ALLOCATE(t7d(im,jsta:jend,nfd), q7d(im,jsta:jend,nfd), &
771 u7d(im,jsta:jend,nfd), v6d(im,jsta:jend,nfd), &
772 p7d(im,jsta:jend,nfd), icingfd(im,jsta:jend,nfd) &
773 ,aerfd(im,jsta:jend,nfd,nbin_du))
780 IF (iget(059)>0)
THEN
781 IF (lvls(ifd,iget(059))>1) itypefdlvl(ifd)=2
783 IF (iget(911)>0)
THEN
784 IF (lvls(ifd,iget(911))>1) itypefdlvl(ifd)=2
787 IF (iget(586)>0)
THEN
788 IF(lvls(ifd,iget(586))>0) itypefdlvl(ifd)=2
790 IF (iget(060)>0)
THEN
791 IF (lvls(ifd,iget(060))>1) itypefdlvl(ifd)=2
793 IF (iget(576)>0)
THEN
794 IF(lvls(ifd,iget(576))>0) itypefdlvl(ifd)=2
796 IF (iget(061)>0)
THEN
797 IF (lvls(ifd,iget(061))>1) itypefdlvl(ifd)=2
799 IF (iget(577)>0)
then
800 if(lvls(ifd,iget(577))>0) itypefdlvl(ifd)=2
802 IF (iget(451)>0)
THEN
803 IF (lvls(ifd,iget(451))>1) itypefdlvl(ifd)=2
805 IF (iget(578)>0)
then
806 if(lvls(ifd,iget(578))>0) itypefdlvl(ifd)=2
809 IF (iget(580)>0)
then
810 if(lvls(ifd,iget(580))>1) itypefdlvl(ifd)=2
812 IF (iget(587)>0)
then
813 if(lvls(ifd,iget(587))>0) itypefdlvl(ifd)=2
816 IF (iget(601)>0)
THEN
817 IF (lvls(ifd,iget(601))>1) itypefdlvl(ifd)=2
819 IF (iget(602)>0)
THEN
820 IF (lvls(ifd,iget(602))>1) itypefdlvl(ifd)=2
822 IF (iget(603)>0)
THEN
823 IF (lvls(ifd,iget(603))>1) itypefdlvl(ifd)=2
825 IF (iget(604)>0)
THEN
826 IF (lvls(ifd,iget(604))>1) itypefdlvl(ifd)=2
828 IF (iget(605)>0)
THEN
829 IF (lvls(ifd,iget(605))>1) itypefdlvl(ifd)=2
836 CALL fdlvl(itypefdlvl,t7d,q7d,u7d,v6d,p7d,icingfd,aerfd)
844 work1 = lvls(ifd,iget1)
849 work2 = lvls(ifd,iget2)
853 IF (iget1 > 0 .or. iget2 > 0)
THEN
854 IF (work1 > 0 .or. work2 > 0)
THEN
859 grid1(i,j) = t7d(i,j,ifd)
863 if(grib ==
'grib2')
then
865 fld_info(cfld)%ifld = iavblfld(iget1)
866 fld_info(cfld)%lvl = lvlsxml(ifd,iget1)
871 datapd(i,j,cfld) = grid1(i,jj)
877 if(grib ==
'grib2')
then
879 fld_info(cfld)%ifld = iavblfld(iget2)
880 fld_info(cfld)%lvl = lvlsxml(ifd,iget2)
885 datapd(i,j,cfld) = grid1(i,jj)
894 IF (iget(911)>0)
THEN
895 IF (lvls(ifd,iget(911))>0)
THEN
898 if ( t7d(i,j,ifd) > 600 )
then
901 grid1(i,j)=t7d(i,j,ifd)*(1.+0.608*q7d(i,j,ifd))
906 IF(lvls(ifd,iget(911))>0)
then
907 if(grib==
'grib2')
then
909 fld_info(cfld)%ifld=iavblfld(iget(911))
910 fld_info(cfld)%lvl=lvlsxml(ifd,iget(911))
911 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
922 work1 = lvls(ifd,iget1)
927 work2 = lvls(ifd,iget2)
931 IF (iget1 > 0 .or. iget2 > 0)
THEN
932 IF (work1 > 0 .or. work2 > 0)
THEN
936 grid1(i,j) = q7d(i,j,ifd)
940 if(grib ==
'grib2')
then
942 fld_info(cfld)%ifld = iavblfld(iget1)
943 fld_info(cfld)%lvl = lvlsxml(ifd,iget1)
948 datapd(i,j,cfld) = grid1(i,jj)
954 if(grib ==
'grib2')
then
956 fld_info(cfld)%ifld = iavblfld(iget2)
957 fld_info(cfld)%lvl = lvlsxml(ifd,iget2)
962 datapd(i,j,cfld) = grid1(i,jj)
974 work1 = lvls(ifd,iget1)
979 work2 = lvls(ifd,iget2)
983 IF (iget1 > 0 .or. iget2 > 0)
THEN
984 IF (work1 > 0 .or. work2 > 0)
THEN
988 grid1(i,j) = p7d(i,j,ifd)
992 if(grib ==
'grib2')
then
994 fld_info(cfld)%ifld = iavblfld(iget1)
995 fld_info(cfld)%lvl = lvlsxml(ifd,iget1)
1000 datapd(i,j,cfld) = grid1(i,jj)
1006 if(grib ==
'grib2')
then
1008 fld_info(cfld)%ifld = iavblfld(iget2)
1009 fld_info(cfld)%lvl = lvlsxml(ifd,iget2)
1014 datapd(i,j,cfld) = grid1(i,jj)
1026 work1 = lvls(ifd,iget1)
1031 work2 = lvls(ifd,iget2)
1035 IF (iget1 > 0 .or. iget2 > 0)
THEN
1036 IF (work1 > 0 .or. work2 > 0)
THEN
1040 grid1(i,j) = icingfd(i,j,ifd)
1044 if(grib ==
'grib2')
then
1046 fld_info(cfld)%ifld = iavblfld(iget1)
1047 fld_info(cfld)%lvl = lvlsxml(ifd,iget1)
1052 datapd(i,j,cfld) = grid1(i,jj)
1058 if(grib ==
'grib2')
then
1060 fld_info(cfld)%ifld = iavblfld(iget2)
1061 fld_info(cfld)%lvl = lvlsxml(ifd,iget2)
1066 datapd(i,j,cfld) = grid1(i,jj)
1076 IF (iget(601)>0)
THEN
1077 IF (lvls(ifd,iget(601))>0)
THEN
1081 grid1(i,j)=aerfd(i,j,ifd,1)
1084 if(iget(601)>0)
then
1085 if(grib==
'grib2')
then
1087 fld_info(cfld)%ifld=iavblfld(iget(601))
1088 fld_info(cfld)%lvl=lvlsxml(ifd,iget(601))
1093 datapd(i,j,cfld) = grid1(i,jj)
1101 IF (iget(602)>0)
THEN
1102 IF (lvls(ifd,iget(602))>0)
THEN
1106 grid1(i,j)=aerfd(i,j,ifd,2)
1109 if(iget(602)>0)
then
1110 if(grib==
'grib2')
then
1112 fld_info(cfld)%ifld=iavblfld(iget(602))
1113 fld_info(cfld)%lvl=lvlsxml(ifd,iget(602))
1118 datapd(i,j,cfld) = grid1(i,jj)
1126 IF (iget(603)>0)
THEN
1127 IF (lvls(ifd,iget(603))>0)
THEN
1131 grid1(i,j)=aerfd(i,j,ifd,3)
1134 if(iget(603)>0)
then
1135 if(grib==
'grib2')
then
1137 fld_info(cfld)%ifld=iavblfld(iget(603))
1138 fld_info(cfld)%lvl=lvlsxml(ifd,iget(603))
1143 datapd(i,j,cfld) = grid1(i,jj)
1151 IF (iget(604)>0)
THEN
1152 IF (lvls(ifd,iget(604))>0)
THEN
1156 grid1(i,j)=aerfd(i,j,ifd,4)
1159 if(iget(604)>0)
then
1160 if(grib==
'grib2')
then
1162 fld_info(cfld)%ifld=iavblfld(iget(604))
1163 fld_info(cfld)%lvl=lvlsxml(ifd,iget(604))
1168 datapd(i,j,cfld) = grid1(i,jj)
1176 IF (iget(605)>0)
THEN
1177 IF (lvls(ifd,iget(605))>0)
THEN
1181 grid1(i,j)=aerfd(i,j,ifd,5)
1184 if(iget(605)>0)
then
1185 if(grib==
'grib2')
then
1187 fld_info(cfld)%ifld=iavblfld(iget(605))
1188 fld_info(cfld)%lvl=lvlsxml(ifd,iget(605))
1193 datapd(i,j,cfld) = grid1(i,jj)
1204 IF ((iget(060)>0).OR.(iget(061)>0))
THEN
1208 grid1(i,j)=u7d(i,j,ifd)
1209 grid2(i,j)=v6d(i,j,ifd)
1212 IF (iget(060)>0)
THEN
1213 IF (lvls(ifd,iget(060))>0)
then
1214 if(grib==
'grib2')
then
1216 fld_info(cfld)%ifld=iavblfld(iget(060))
1217 fld_info(cfld)%lvl=lvlsxml(ifd,iget(060))
1222 datapd(i,j,cfld) = grid1(i,jj)
1228 IF (iget(061)>0)
THEN
1229 IF (lvls(ifd,iget(061))>0)
THEN
1230 if(grib==
'grib2')
then
1232 fld_info(cfld)%ifld=iavblfld(iget(061))
1233 fld_info(cfld)%lvl=lvlsxml(ifd,iget(061))
1238 datapd(i,j,cfld) = grid2(i,jj)
1247 IF ((iget(576)>0).OR.(iget(577)>0))
THEN
1251 grid1(i,j) = u7d(i,j,ifd)
1252 grid2(i,j) = v6d(i,j,ifd)
1255 IF (iget(576)>0)
THEN
1256 IF (lvls(ifd,iget(576))>0)
then
1257 if(grib==
'grib2')
then
1259 fld_info(cfld)%ifld=iavblfld(iget(576))
1260 fld_info(cfld)%lvl=lvlsxml(ifd,iget(576))
1265 datapd(i,j,cfld) = grid1(i,jj)
1271 IF (iget(577)>0)
THEN
1272 IF (lvls(ifd,iget(577))>0)
THEN
1273 if(grib==
'grib2')
then
1275 fld_info(cfld)%ifld=iavblfld(iget(577))
1276 fld_info(cfld)%lvl=lvlsxml(ifd,iget(577))
1281 datapd(i,j,cfld) = grid2(i,jj)
1290 DEALLOCATE(t7d,q7d,u7d,v6d,p7d,icingfd,aerfd)
1296 IF(iget(467)>0.or.iget(468)>0.or.iget(469)>0)
THEN
1297 if(iget(467)>0)
THEN
1298 n=iavblfld(iget(467))
1299 nfdctl=
size(pset%param(n)%level)
1300 if(
allocated(itypefdlvlctl))
deallocate(itypefdlvlctl)
1301 allocate(itypefdlvlctl(nfdctl))
1303 itypefdlvlctl(ifd)=lvls(ifd,iget(467))
1305 if(
allocated(htfdctl))
deallocate(htfdctl)
1306 allocate(htfdctl(nfdctl))
1307 htfdctl=pset%param(n)%level
1309 allocate(gtgfd(im,jsta:jend,nfdctl))
1310 call fdlvl_mass(itypefdlvlctl,nfdctl,htfdctl,gtg,gtgfd)
1313 IF (lvls(ifd,iget(467))>0)
THEN
1317 grid1(i,j)=gtgfd(i,j,ifd)
1320 if(grib==
'grib2')
then
1322 fld_info(cfld)%ifld=iavblfld(iget(467))
1323 fld_info(cfld)%lvl=lvlsxml(ifd,iget(467))
1328 datapd(i,j,cfld) = grid1(i,jj)
1336 if(iget(468)>0)
THEN
1337 n=iavblfld(iget(468))
1338 nfdctl=
size(pset%param(n)%level)
1339 if(
allocated(itypefdlvlctl))
deallocate(itypefdlvlctl)
1340 allocate(itypefdlvlctl(nfdctl))
1342 itypefdlvlctl(ifd)=lvls(ifd,iget(468))
1344 if(
allocated(htfdctl))
deallocate(htfdctl)
1345 allocate(htfdctl(nfdctl))
1346 htfdctl=pset%param(n)%level
1347 allocate(catfd(im,jsta:jend,nfdctl))
1348 call fdlvl_mass(itypefdlvlctl,nfdctl,htfdctl,catedr,catfd)
1350 IF (lvls(ifd,iget(468))>0)
THEN
1354 grid1(i,j)=catfd(i,j,ifd)
1357 if(grib==
'grib2')
then
1359 fld_info(cfld)%ifld=iavblfld(iget(468))
1360 fld_info(cfld)%lvl=lvlsxml(ifd,iget(468))
1365 datapd(i,j,cfld) = grid1(i,jj)
1373 if(iget(469)>0)
THEN
1374 n=iavblfld(iget(469))
1375 nfdctl=
size(pset%param(n)%level)
1376 if(
allocated(itypefdlvlctl))
deallocate(itypefdlvlctl)
1377 allocate(itypefdlvlctl(nfdctl))
1379 itypefdlvlctl(ifd)=lvls(ifd,iget(469))
1381 if(
allocated(htfdctl))
deallocate(htfdctl)
1382 allocate(htfdctl(nfdctl))
1383 htfdctl=pset%param(n)%level
1384 allocate(mwtfd(im,jsta:jend,nfdctl))
1385 call fdlvl_mass(itypefdlvlctl,nfdctl,htfdctl,mwt,mwtfd)
1387 IF (lvls(ifd,iget(469))>0)
THEN
1391 grid1(i,j)=mwtfd(i,j,ifd)
1394 if(grib==
'grib2')
then
1396 fld_info(cfld)%ifld=iavblfld(iget(469))
1397 fld_info(cfld)%lvl=lvlsxml(ifd,iget(469))
1402 datapd(i,j,cfld) = grid1(i,jj)
1410 if(
allocated(gtgfd))
deallocate(gtgfd)
1411 if(
allocated(catfd))
deallocate(catfd)
1412 if(
allocated(mwtfd))
deallocate(mwtfd)
1414 if(
allocated(itypefdlvlctl))
deallocate(itypefdlvlctl)
1415 if(
allocated(htfdctl))
deallocate(htfdctl)
1422 IF ( (iget(062)>0).OR.(iget(063)>0) )
THEN
1423 CALL frzlvl(z1d,rh1d,p1d)
1426 IF (iget(062)>0)
THEN
1431 IF (submodelname ==
'RTMA')
THEN
1432 freezelvl(i,j)=grid1(i,j)
1436 CALL bound(grid1,d00,h99999)
1437 if(grib==
'grib2')
then
1439 fld_info(cfld)%ifld=iavblfld(iget(062))
1444 datapd(i,j,cfld) = grid1(i,jj)
1451 IF (iget(063)>0)
THEN
1455 grid1(i,j) = rh1d(i,j)
1458 CALL sclfld(grid1,h100,im,jm)
1459 CALL bound(grid1,h1,h100)
1460 if(grib==
'grib2')
then
1462 fld_info(cfld)%ifld=iavblfld(iget(063))
1467 datapd(i,j,cfld) = grid1(i,jj)
1474 IF (iget(753)>0)
THEN
1478 grid1(i,j) = p1d(i,j)
1481 if(grib==
'grib2')
then
1483 fld_info(cfld)%ifld=iavblfld(iget(753))
1488 datapd(i,j,cfld) = grid1(i,jj)
1496 IF (iget(165)>0 .OR. iget(350)>0.OR. iget(756)>0)
THEN
1497 CALL frzlvl2(tfrz,z1d,rh1d,p1d)
1500 IF (iget(165)>0)
THEN
1507 CALL bound(grid1,d00,h99999)
1508 if(grib==
'grib2')
then
1510 fld_info(cfld)%ifld=iavblfld(iget(165))
1515 datapd(i,j,cfld) = grid1(i,jj)
1522 IF (iget(350)>0)
THEN
1527 IF(rh1d(i,j) < spval) grid1(i,j)=rh1d(i,j)*100.
1530 CALL bound(grid1,h1,h100)
1531 if(grib==
'grib2')
then
1533 fld_info(cfld)%ifld=iavblfld(iget(350))
1538 datapd(i,j,cfld) = grid1(i,jj)
1545 IF (iget(756)>0)
THEN
1549 grid1(i,j) = p1d(i,j)
1552 if(grib==
'grib2')
then
1554 fld_info(cfld)%ifld=iavblfld(iget(756))
1559 datapd(i,j,cfld) = grid1(i,jj)
1569 IF (iget(776)>0 .OR. iget(777)>0.OR. iget(778)>0)
THEN
1570 CALL frzlvl2(263.15,z1d,rh1d,p1d)
1573 IF (iget(776)>0)
THEN
1580 CALL bound(grid1,d00,h99999)
1581 if(grib==
'grib2')
then
1583 fld_info(cfld)%ifld=iavblfld(iget(776))
1588 datapd(i,j,cfld) = grid1(i,jj)
1595 IF (iget(777)>0)
THEN
1600 IF(rh1d(i,j) < spval) grid1(i,j)=rh1d(i,j)*100.
1603 CALL bound(grid1,h1,h100)
1604 if(grib==
'grib2')
then
1606 fld_info(cfld)%ifld=iavblfld(iget(777))
1611 datapd(i,j,cfld) = grid1(i,jj)
1618 IF (iget(778)>0)
THEN
1625 if(grib==
'grib2')
then
1627 fld_info(cfld)%ifld=iavblfld(iget(778))
1632 datapd(i,j,cfld) = grid1(i,jj)
1642 IF (iget(779)>0 .OR. iget(780)>0.OR. iget(781)>0)
THEN
1643 CALL frzlvl2(253.15,z1d,rh1d,p1d)
1646 IF (iget(779)>0)
THEN
1653 CALL bound(grid1,d00,h99999)
1654 if(grib==
'grib2')
then
1656 fld_info(cfld)%ifld=iavblfld(iget(779))
1661 datapd(i,j,cfld) = grid1(i,jj)
1668 IF (iget(780)>0)
THEN
1673 IF(rh1d(i,j) < spval) grid1(i,j)=rh1d(i,j)*100.
1676 CALL bound(grid1,h1,h100)
1677 if(grib==
'grib2')
then
1679 fld_info(cfld)%ifld=iavblfld(iget(780))
1684 datapd(i,j,cfld) = grid1(i,jj)
1691 IF (iget(781)>0)
THEN
1698 if(grib==
'grib2')
then
1700 fld_info(cfld)%ifld=iavblfld(iget(781))
1705 datapd(i,j,cfld) = grid1(i,jj)
1713 allocate(pbnd(im,jsta:jend,nbnd), tbnd(im,jsta:jend,nbnd), &
1714 qbnd(im,jsta:jend,nbnd), ubnd(im,jsta:jend,nbnd), &
1715 vbnd(im,jsta:jend,nbnd), rhbnd(im,jsta:jend,nbnd), &
1716 wbnd(im,jsta:jend,nbnd))
1721 IF ( (iget(067)>0).OR.(iget(068)>0).OR. &
1722 (iget(069)>0).OR.(iget(070)>0).OR. &
1723 (iget(071)>0).OR.(iget(072)>0).OR. &
1724 (iget(073)>0).OR.(iget(074)>0).OR. &
1725 (iget(088)>0).OR.(iget(089)>0).OR. &
1726 (iget(090)>0).OR.(iget(075)>0).OR. &
1727 (iget(109)>0).OR.(iget(110)>0).OR. &
1728 (iget(031)>0).OR.(iget(032)>0).OR. &
1730 (iget(107)>0).OR.(iget(091)>0).OR. &
1731 (iget(092)>0).OR.(iget(093)>0).OR. &
1732 (iget(094)>0).OR.(iget(095)>0).OR. &
1733 (iget(096)>0).OR.(iget(097)>0).OR. &
1734 (iget(098)>0).OR.(iget(221)>0) )
THEN
1736 allocate(omgbnd(im,jsta:jend,nbnd),pwtbnd(im,jsta:jend,nbnd), &
1737 qcnvbnd(im,jsta:jend,nbnd),lvlbnd(im,jsta:jend,nbnd), &
1741 CALL bndlyr(pbnd,tbnd,qbnd,rhbnd,ubnd,vbnd, &
1742 wbnd,omgbnd,pwtbnd,qcnvbnd,lvlbnd)
1756 IF (iget(067)>0)
THEN
1757 IF (lvls(lbnd,iget(067))>0)
THEN
1761 grid1(i,j) = pbnd(i,j,lbnd)
1764 if(grib==
'grib2')
then
1766 fld_info(cfld)%ifld=iavblfld(iget(067))
1767 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(067))
1772 datapd(i,j,cfld) = grid1(i,jj)
1780 IF (iget(068)>0)
THEN
1781 IF (lvls(lbnd,iget(068))>0)
THEN
1785 grid1(i,j)=tbnd(i,j,lbnd)
1788 if(grib==
'grib2')
then
1790 fld_info(cfld)%ifld=iavblfld(iget(068))
1791 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(068))
1796 datapd(i,j,cfld) = grid1(i,jj)
1804 IF (iget(069)>0)
THEN
1805 IF (lvls(lbnd,iget(069))>0)
THEN
1806 CALL calpot(pbnd(1,jsta,lbnd),tbnd(1,jsta,lbnd),grid1(1,jsta))
1807 if(grib==
'grib2')
then
1809 fld_info(cfld)%ifld=iavblfld(iget(069))
1810 fld_info(cfld)%lvl=lvlsxml(ifd,iget(069))
1815 datapd(i,j,cfld) = grid1(i,jj)
1823 IF (iget(072)>0)
THEN
1824 IF (lvls(lbnd,iget(072))>0)
THEN
1828 grid1(i,j)=rhbnd(i,j,lbnd)
1831 CALL sclfld(grid1,h100,im,jm)
1832 CALL bound(grid1,h1,h100)
1833 if(grib==
'grib2')
then
1835 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(072))
1836 fld_info(cfld)%ifld=iavblfld(iget(072))
1841 datapd(i,j,cfld) = grid1(i,jj)
1849 IF (iget(070)>0)
THEN
1850 IF (lvls(lbnd,iget(070))>0)
THEN
1851 CALL caldwp(pbnd(1,jsta,lbnd), qbnd(1,jsta,lbnd), &
1852 grid1(1,jsta), tbnd(1,jsta,lbnd))
1853 if(grib==
'grib2')
then
1855 fld_info(cfld)%ifld=iavblfld(iget(070))
1856 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(070))
1861 datapd(i,j,cfld) = grid1(i,jj)
1869 IF (iget(071)>0)
THEN
1870 IF (lvls(lbnd,iget(071))>0)
THEN
1874 grid1(i,j)=qbnd(i,j,lbnd)
1877 CALL bound(grid1,h1m12,h99999)
1878 if(grib==
'grib2')
then
1880 fld_info(cfld)%ifld=iavblfld(iget(071))
1881 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(071))
1886 datapd(i,j,cfld) = grid1(i,jj)
1894 IF (iget(088)>0)
THEN
1895 IF (lvls(lbnd,iget(088))>0)
THEN
1899 grid1(i,j) = qcnvbnd(i,j,lbnd)
1902 if(grib==
'grib2')
then
1904 fld_info(cfld)%ifld=iavblfld(iget(088))
1905 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(088))
1910 datapd(i,j,cfld) = grid1(i,jj)
1923 IF(lvls(lbnd,iget(073))>0)field1=.true.
1926 IF(lvls(lbnd,iget(074))>0)field2=.true.
1929 IF(field1.OR.field2)
THEN
1933 grid1(i,j) = ubnd(i,j,lbnd)
1934 grid2(i,j) = vbnd(i,j,lbnd)
1938 IF (iget(073)>0)
THEN
1939 IF (lvls(lbnd,iget(073))>0)
then
1940 if(grib==
'grib2')
then
1942 fld_info(cfld)%ifld=iavblfld(iget(073))
1943 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(073))
1948 datapd(i,j,cfld) = grid1(i,jj)
1954 IF (iget(074)>0)
THEN
1955 IF (lvls(lbnd,iget(074))>0)
THEN
1956 if(grib==
'grib2')
then
1958 fld_info(cfld)%ifld=iavblfld(iget(074))
1959 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(074))
1964 datapd(i,j,cfld) = grid2(i,jj)
1973 IF (iget(090)>0)
THEN
1974 IF (lvls(lbnd,iget(090))>0)
THEN
1978 grid1(i,j) = omgbnd(i,j,lbnd)
1981 if(grib==
'grib2')
then
1983 fld_info(cfld)%ifld=iavblfld(iget(090))
1984 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(090))
1989 datapd(i,j,cfld) = grid1(i,jj)
1997 IF (iget(089)>0)
THEN
1998 IF (lvls(lbnd,iget(089))>0)
THEN
2002 grid1(i,j) = pwtbnd(i,j,lbnd)
2005 CALL bound(grid1,d00,h99999)
2006 if(grib==
'grib2')
then
2008 fld_info(cfld)%ifld=iavblfld(iget(089))
2009 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(089))
2014 datapd(i,j,cfld) = grid1(i,jj)
2022 IF (iget(075)>0 .OR. iget(031)>0 .OR. iget(573)>0)
THEN
2023 CALL otlft(pbnd(1,jsta,lbnd),tbnd(1,jsta,lbnd), &
2024 qbnd(1,jsta,lbnd),grid1(1,jsta))
2026 IF (lvls(lbnd,iget(075))>0)
THEN
2027 if(grib==
'grib2')
then
2029 fld_info(cfld)%ifld=iavblfld(iget(075))
2030 fld_info(cfld)%lvl=lvlsxml(lbnd,iget(075))
2035 datapd(i,j,cfld) = grid1(i,jj)
2041 IF(iget(031)>0 .or. iget(573)>0)
THEN
2045 egrid2(i,j) = min(egrid2(i,j),grid1(i,j))
2053 deallocate(omgbnd,pwtbnd,qcnvbnd)
2057 IF (iget(031)>0 .OR. iget(573)>0 )
THEN
2077 grid1(i,j)=egrid2(i,j)
2082 if (iget(031)>0)
then
2083 if(grib==
'grib2')
then
2085 fld_info(cfld)%ifld=iavblfld(iget(031))
2086 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
2090 if(iget(573)> 0 )
THEN
2091 if(grib==
'grib2')
then
2093 fld_info(cfld)%ifld=iavblfld(iget(573))
2098 datapd(i,j,cfld) = grid1(i,jj)
2112 IF(lvls(2,iget(032))>0)field1=.true.
2115 IF(lvls(2,iget(107))>0)field2=.true.
2130 IF(field1.OR.field2)
THEN
2136 egrid1(i,j) = -h99999
2137 egrid2(i,j) = -h99999
2142 CALL calthte(pbnd(1,jsta,lbnd),tbnd(1,jsta,lbnd), &
2143 qbnd(1,jsta,lbnd),egrid1)
2147 IF (egrid1(i,j) > egrid2(i,j))
THEN
2148 egrid2(i,j) = egrid1(i,j)
2149 lb2(i,j) = lvlbnd(i,j,lbnd)
2150 p1d(i,j) = pbnd(i,j,lbnd)
2151 t1d(i,j) = tbnd(i,j,lbnd)
2152 q1d(i,j) = qbnd(i,j,lbnd)
2159 CALL calcape(itype,dpbnd,p1d,t1d,q1d,lb2,egrid1, &
2160 egrid2,egrid3,egrid4,egrid5)
2162 IF (iget(566)>0)
THEN
2168 IF(t1d(i,j) < spval) grid1(i,j) = egrid1(i,j)
2171 CALL bound(grid1,d00,h99999)
2172 if(grib==
'grib2')
then
2174 fld_info(cfld)%ifld=iavblfld(iget(566))
2175 fld_info(cfld)%lvl=lvlsxml(1,iget(566))
2180 datapd(i,j,cfld) = grid1(i,jj)
2186 IF (iget(567) > 0)
THEN
2192 IF(t1d(i,j) < spval) grid1(i,j) = - egrid2(i,j)
2196 CALL bound(grid1,d00,h99999)
2201 IF(t1d(i,j) < spval) grid1(i,j) = - grid1(i,j)
2205 if(grib==
'grib2')
then
2207 fld_info(cfld)%ifld=iavblfld(iget(567))
2208 fld_info(cfld)%lvl=lvlsxml(1,iget(567))
2213 datapd(i,j,cfld) = grid1(i,jj)
2222 IF(iget(221) > 0)
THEN
2226 grid1(i,j) = pblh(i,j)
2229 if(grib==
'grib2')
then
2231 fld_info(cfld)%ifld=iavblfld(iget(221))
2236 datapd(i,j,cfld) = grid1(i,jj)
2244 IF ( (iget(109)>0).OR.(iget(110)>0) )
THEN
2245 CALL callcl(pbnd(1,jsta,1),tbnd(1,jsta,1), &
2246 qbnd(1,jsta,1),egrid1,egrid2)
2247 IF (iget(109)>0)
THEN
2252 IF(tbnd(i,j,1) < spval) grid1(i,j) = egrid2(i,j)
2255 if(grib==
'grib2')
then
2257 fld_info(cfld)%ifld=iavblfld(iget(109))
2262 datapd(i,j,cfld) = grid1(i,jj)
2267 IF (iget(110)>0)
THEN
2272 IF(tbnd(i,j,1) < spval) grid1(i,j) = egrid1(i,j)
2275 if(grib==
'grib2')
then
2277 fld_info(cfld)%ifld=iavblfld(iget(110))
2282 datapd(i,j,cfld) = grid1(i,jj)
2291 IF ( (iget(091)>0).OR.(iget(092)>0).OR. &
2292 (iget(093)>0).OR.(iget(094)>0).OR. &
2293 (iget(095)>0).OR.(iget(095)>0).OR. &
2294 (iget(096)>0).OR.(iget(097)>0).OR. &
2295 (iget(098)>0) )
THEN
2297 allocate(t78483(im,jsta:jend), t89671(im,jsta:jend), &
2298 p78483(im,jsta:jend), p89671(im,jsta:jend))
2302 IF (iget(097)>0.OR.iget(098)>0)
THEN
2306 p78483(i,j) = log(pint(i,j,nint(lmh(i,j)))*0.78483)
2307 p89671(i,j) = log(pint(i,j,nint(lmh(i,j)))*0.89671)
2316 pkl1=0.5*(alpint(i,j,l)+alpint(i,j,l+1))
2317 pku1=0.5*(alpint(i,j,l)+alpint(i,j,l-1))
2320 IF(p78483(i,j) < pkl1.AND.p78483(i,j) > pku1)
THEN
2321 fac1 = (pkl1-p78483(i,j))/(pkl1-pku1)
2322 fac2 = (p78483(i,j)-pku1)/(pkl1-pku1)
2323 t78483(i,j) = t(i,j,l)*fac2 + t(i,j,l-1)*fac1
2326 IF(p89671(i,j) < pkl1.AND.p89671(i,j) > pku1)
THEN
2327 fac1 = (pkl1-p89671(i,j))/(pkl1-pku1)
2328 fac2 = (p89671(i,j)-pku1)/(pkl1-pku1)
2329 t89671(i,j) = t(i,j,l)*fac2 + t(i,j,l-1)*fac1
2340 IF(.NOT. done(i,j))
THEN
2342 tl = 0.5*(t(i,j,lm-2)+t(i,j,lm-1))
2343 ql = 0.5*(q(i,j,lm-2)+q(i,j,lm-1))
2344 qsat = pq0/pl *exp(a2*(tl-a3)/(tl-a4))
2362 t89671(i,j) = tl * (p89671(i,j)/pl)**rgamog
2375 IF(.NOT. done1(i,j))
THEN
2377 tl = 0.5*(t(i,j,lm-2)+t(i,j,lm-1))
2378 ql = 0.5*(q(i,j,lm-2)+q(i,j,lm-1))
2379 qsat = pq0/pl *exp(a2*(tl-a3)/(tl-a4))
2397 t78483(i,j) = tl * (p78483(i,j)/pl)**rgamog
2405 IF (iget(097) > 0)
THEN
2410 IF(t(i,j,lm) < spval) grid1(i,j) = t89671(i,j)
2415 if(grib==
'grib2')
then
2417 fld_info(cfld)%ifld=iavblfld(iget(097))
2418 fld_info(cfld)%lvl=lvlsxml(1,iget(097))
2423 datapd(i,j,cfld) = grid1(i,jj)
2430 IF (iget(098)>0)
THEN
2435 IF(t(i,j,lm) < spval) grid1(i,j) = t78483(i,j)
2438 if(grib==
'grib2')
then
2440 fld_info(cfld)%ifld=iavblfld(iget(098))
2441 fld_info(cfld)%lvl=lvlsxml(1,iget(098))
2446 datapd(i,j,cfld) = grid1(i,jj)
2451 deallocate(t78483, t89671, p78483, p89671)
2458 IF ( (iget(091)>0).OR.(iget(092)>0).OR. &
2459 (iget(093)>0).OR.(iget(094)>0).OR. &
2460 (iget(095)>0).OR.(iget(095)>0).OR. &
2461 (iget(096)>0) )
THEN
2465 IF (iget(091)>0)
THEN
2469 grid1(i,j) = pbnd(i,j,1)
2472 if(grib==
'grib2')
then
2474 fld_info(cfld)%ifld=iavblfld(iget(091))
2479 datapd(i,j,cfld) = grid1(i,jj)
2486 IF (iget(092)>0)
THEN
2490 grid1(i,j) = tbnd(i,j,1)
2493 if(grib==
'grib2')
then
2495 fld_info(cfld)%ifld=iavblfld(iget(092))
2496 fld_info(cfld)%lvl=lvlsxml(1,iget(092))
2501 datapd(i,j,cfld) = grid1(i,jj)
2508 IF (iget(093)>0)
THEN
2512 grid1(i,j) = qbnd(i,j,1)
2515 CALL bound(grid1,h1m12,h99999)
2516 if(grib==
'grib2')
then
2518 fld_info(cfld)%ifld=iavblfld(iget(093))
2519 fld_info(cfld)%lvl=lvlsxml(1,iget(093))
2524 datapd(i,j,cfld) = grid1(i,jj)
2531 IF (iget(094)>0)
THEN
2535 grid1(i,j) = rhbnd(i,j,1)
2538 CALL sclfld(grid1,h100,im,jm)
2539 CALL bound(grid1,h1,h100)
2540 if(grib==
'grib2')
then
2542 fld_info(cfld)%ifld=iavblfld(iget(094))
2543 fld_info(cfld)%lvl=lvlsxml(1,iget(094))
2548 datapd(i,j,cfld) = grid1(i,jj)
2555 IF ((iget(095)>0).OR.(iget(096)>0))
THEN
2559 grid1(i,j) = ubnd(i,j,1)
2560 grid2(i,j) = vbnd(i,j,1)
2563 IF (iget(095)>0)
then
2564 if(grib==
'grib2')
then
2566 fld_info(cfld)%ifld=iavblfld(iget(095))
2567 fld_info(cfld)%lvl=lvlsxml(1,iget(095))
2572 datapd(i,j,cfld) = grid1(i,jj)
2577 IF (iget(096)>0)
then
2578 if(grib==
'grib2')
then
2580 fld_info(cfld)%ifld=iavblfld(iget(096))
2581 fld_info(cfld)%lvl=lvlsxml(1,iget(096))
2586 datapd(i,j,cfld) = grid2(i,jj)
2602 IF ( (iget(066)>0).OR.(iget(081)>0).OR. &
2603 (iget(082)>0).OR.(iget(104)>0).OR. &
2604 (iget(099)>0).OR.(iget(100)>0).OR. &
2605 (iget(101)>0).OR.(iget(102)>0).OR. &
2606 (iget(103)>0) )
THEN
2610 IF ( (iget(066)>0).OR.(iget(081)>0).OR. &
2611 (iget(082)>0).OR.(iget(104)>0) )
THEN
2612 allocate(rh3310(im,jsta:jend),rh6610(im,jsta:jend), &
2613 rh3366(im,jsta:jend),pw3310(im,jsta:jend))
2614 CALL lfmfld(rh3310,rh6610,rh3366,pw3310)
2617 IF (iget(066)>0)
THEN
2621 grid1(i,j) = rh3310(i,j)
2624 CALL sclfld(grid1,h100,im,jm)
2625 CALL bound(grid1,h1,h100)
2626 if(grib==
'grib2')
then
2628 fld_info(cfld)%ifld=iavblfld(iget(066))
2629 fld_info(cfld)%lvl=lvlsxml(1,iget(066))
2634 datapd(i,j,cfld) = grid1(i,jj)
2643 IF (iget(081)>0)
THEN
2647 grid1(i,j) = rh6610(i,j)
2650 CALL sclfld(grid1,h100,im,jm)
2651 CALL bound(grid1,h1,h100)
2652 if(grib==
'grib2')
then
2654 fld_info(cfld)%ifld=iavblfld(iget(081))
2655 fld_info(cfld)%lvl=lvlsxml(1,iget(081))
2660 datapd(i,j,cfld) = grid1(i,jj)
2667 IF (iget(082)>0)
THEN
2671 grid1(i,j) = rh3366(i,j)
2674 CALL sclfld(grid1,h100,im,jm)
2675 CALL bound(grid1,h1,h100)
2676 if(grib==
'grib2')
then
2678 fld_info(cfld)%ifld=iavblfld(iget(082))
2679 fld_info(cfld)%lvl=lvlsxml(1,iget(082))
2684 datapd(i,j,cfld) = grid1(i,jj)
2691 IF (iget(104)>0)
THEN
2695 grid1(i,j) = pw3310(i,j)
2698 CALL bound(grid1,d00,h99999)
2699 if(grib==
'grib2')
then
2701 fld_info(cfld)%ifld=iavblfld(iget(104))
2702 fld_info(cfld)%lvl=lvlsxml(1,iget(104))
2707 datapd(i,j,cfld) = grid1(i,jj)
2712 deallocate(rh3310,rh6610,rh3366,pw3310)
2717 IF ( (iget(099)>0).OR.(iget(100)>0).OR. &
2718 (iget(101)>0).OR.(iget(102)>0).OR. &
2719 (iget(103)>0) )
THEN
2720 allocate(rh4710(im,jsta_2l:jend_2u),rh4796(im,jsta_2l:jend_2u), &
2721 rh1847(im,jsta_2l:jend_2u))
2722 allocate(rh8498(im,jsta_2l:jend_2u),qm8510(im,jsta_2l:jend_2u))
2724 CALL ngmfld(rh4710,rh4796,rh1847,rh8498,qm8510)
2727 IF (iget(099)>0)
THEN
2731 grid1(i,j) = rh4710(i,j)
2734 CALL sclfld(grid1,h100,im,jm)
2735 CALL bound(grid1,h1,h100)
2736 if(grib==
'grib2')
then
2738 fld_info(cfld)%ifld=iavblfld(iget(099))
2739 fld_info(cfld)%lvl=lvlsxml(1,iget(099))
2744 datapd(i,j,cfld) = grid1(i,jj)
2751 IF (iget(100)>0)
THEN
2755 grid1(i,j) = rh4796(i,j)
2758 CALL sclfld(grid1,h100,im,jm)
2759 CALL bound(grid1,h1,h100)
2760 if(grib==
'grib2')
then
2762 fld_info(cfld)%ifld=iavblfld(iget(100))
2763 fld_info(cfld)%lvl=lvlsxml(1,iget(100))
2768 datapd(i,j,cfld) = grid1(i,jj)
2775 IF (iget(101)>0)
THEN
2779 grid1(i,j) = rh1847(i,j)
2782 CALL sclfld(grid1,h100,im,jm)
2783 CALL bound(grid1,h1,h100)
2784 if(grib==
'grib2')
then
2786 fld_info(cfld)%ifld=iavblfld(iget(101))
2787 fld_info(cfld)%lvl=lvlsxml(1,iget(101))
2792 datapd(i,j,cfld) = grid1(i,jj)
2799 IF (iget(102)>0)
THEN
2803 grid1(i,j) = rh8498(i,j)
2806 CALL sclfld(grid1,h100,im,jm)
2807 CALL bound(grid1,h1,h100)
2808 if(grib==
'grib2')
then
2810 fld_info(cfld)%ifld=iavblfld(iget(102))
2811 fld_info(cfld)%lvl=lvlsxml(1,iget(102))
2816 datapd(i,j,cfld) = grid1(i,jj)
2823 IF (iget(103)>0)
THEN
2829 IF(qm8510(i,j) < spval) grid1(i,j) = -1.0*qm8510(i,j)
2832 if(grib==
'grib2')
then
2834 fld_info(cfld)%ifld=iavblfld(iget(103))
2835 fld_info(cfld)%lvl=lvlsxml(1,iget(103))
2840 datapd(i,j,cfld) = grid1(i,jj)
2845 deallocate(rh4710,rh4796,rh1847)
2846 deallocate(rh8498,qm8510)
2850 IF ( (iget(318)>0).OR.(iget(319)>0).OR. &
2852 allocate(rh4410(im,jsta:jend),rh7294(im,jsta:jend), &
2853 rh4472(im,jsta:jend),rh3310(im,jsta:jend))
2854 CALL lfmfld_gfs(rh4410,rh7294,rh4472,rh3310)
2857 IF (iget(318)>0)
THEN
2862 IF(rh4410(i,j) < spval) grid1(i,j) = rh4410(i,j)*100.
2865 CALL bound(grid1,d00,h100)
2866 if(grib==
'grib2')
then
2868 fld_info(cfld)%ifld=iavblfld(iget(318))
2869 fld_info(cfld)%lvl=lvlsxml(1,iget(318))
2874 datapd(i,j,cfld) = grid1(i,jj)
2881 IF (iget(319)>0)
THEN
2886 IF(rh7294(i,j) < spval) grid1(i,j) = rh7294(i,j)*100.
2889 CALL bound(grid1,d00,h100)
2890 if(grib==
'grib2')
then
2892 fld_info(cfld)%ifld=iavblfld(iget(319))
2893 fld_info(cfld)%lvl=lvlsxml(1,iget(319))
2898 datapd(i,j,cfld) = grid1(i,jj)
2905 IF (iget(320)>0)
THEN
2910 IF(rh4472(i,j) < spval) grid1(i,j)=rh4472(i,j)*100.
2913 CALL bound(grid1,d00,h100)
2914 if(grib==
'grib2')
then
2916 fld_info(cfld)%ifld=iavblfld(iget(320))
2917 fld_info(cfld)%lvl=lvlsxml(1,iget(320))
2922 datapd(i,j,cfld) = grid1(i,jj)
2927 deallocate(rh4410,rh7294,rh4472,rh3310)
2931 IF ( (iget(321)>0).OR.(iget(322)>0).OR. &
2932 (iget(323)>0).OR.(iget(324)>0).OR. &
2933 (iget(325)>0).OR.(iget(326)>0))
THEN
2937 egrid2(i,j) = 0.995*pint(i,j,lm+1)
2938 egrid1(i,j) = log(pmid(i,j,lm)/egrid2(i,j)) &
2939 / log(pmid(i,j,lm)/pmid(i,j,lm-1))
2941 IF (modelname ==
'GFS' .OR. modelname ==
'FV3R')
THEN
2942 egrid1(i,j) = log(pmid(i,j,lm)/egrid2(i,j)) &
2943 / max(1.e-6,log(pmid(i,j,lm)/pmid(i,j,lm-1)))
2944 egrid1(i,j) =max(-10.0,min(egrid1(i,j), 10.0))
2945 IF ( abs(pmid(i,j,lm)-pmid(i,j,lm-1)) < 0.5 )
THEN
2953 IF (iget(321)>0)
THEN
2958 IF(t(i,j,lm)<spval.and.t(i,j,lm-1)<spval.and.egrid1(i,j)<spval)&
2959 grid1(i,j) = t(i,j,lm)+(t(i,j,lm-1)-t(i,j,lm)) &
2963 if(grib==
'grib2')
then
2965 fld_info(cfld)%ifld=iavblfld(iget(321))
2966 fld_info(cfld)%lvl=lvlsxml(1,iget(321))
2971 datapd(i,j,cfld) = grid1(i,jj)
2979 IF (iget(322)>0)
THEN
2984 IF(t(i,j,lm)<spval.and.t(i,j,lm-1)<spval.and.egrid1(i,j)<spval)&
2985 grid2(i,j) = t(i,j,lm)+(t(i,j,lm-1)-t(i,j,lm)) &
2989 CALL calpot(egrid2,grid2(1,jsta),grid1(1,jsta))
2990 if(grib==
'grib2')
then
2992 fld_info(cfld)%ifld=iavblfld(iget(322))
2993 fld_info(cfld)%lvl=lvlsxml(1,iget(322))
2998 datapd(i,j,cfld) = grid1(i,jj)
3004 IF (iget(323)>0)
THEN
3009 IF(pmid(i,j,lm)<spval.and.pmid(i,j,lm-1)<spval.and.&
3010 q(i,j,lm)<spval.and.q(i,j,lm-1)<spval)
THEN
3011 es1 = min(pmid(i,j,lm),
fpvsnew(t(i,j,lm)))
3012 qs1 = con_eps*es1/(pmid(i,j,lm)+con_epsm1*es1)
3014 es2 = min(pmid(i,j,lm-1),
fpvsnew(t(i,j,lm-1)))
3015 qs2 = con_eps*es2/(pmid(i,j,lm-1)+con_epsm1*es2)
3016 rh2 = q(i,j,lm-1)/qs2
3017 grid1(i,j) = (rh1+(rh2-rh1)*egrid1(i,j))*100.
3021 CALL bound(grid1,d00,h100)
3022 if(grib==
'grib2')
then
3024 fld_info(cfld)%ifld=iavblfld(iget(323))
3025 fld_info(cfld)%lvl=lvlsxml(1,iget(323))
3030 datapd(i,j,cfld) = grid1(i,jj)
3036 IF (iget(324)>0)
THEN
3041 IF(uh(i,j,lm)<spval.and.uh(i,j,lm-1)<spval.and.egrid1(i,j)<spval)&
3042 grid1(i,j) = uh(i,j,lm)+(uh(i,j,lm-1)-uh(i,j,lm)) &
3046 if(grib==
'grib2')
then
3048 fld_info(cfld)%ifld=iavblfld(iget(324))
3049 fld_info(cfld)%lvl=lvlsxml(1,iget(324))
3054 datapd(i,j,cfld) = grid1(i,jj)
3060 IF (iget(325)>0)
THEN
3065 IF(vh(i,j,lm)<spval.and.vh(i,j,lm-1)<spval.and.egrid1(i,j)<spval)&
3066 grid1(i,j) = vh(i,j,lm)+(vh(i,j,lm-1)-vh(i,j,lm)) &
3070 if(grib==
'grib2')
then
3072 fld_info(cfld)%ifld=iavblfld(iget(325))
3073 fld_info(cfld)%lvl=lvlsxml(1,iget(325))
3078 datapd(i,j,cfld) = grid1(i,jj)
3084 IF (iget(326)>0)
THEN
3089 IF(omga(i,j,lm)<spval.and.omga(i,j,lm-1)<spval.and.egrid1(i,j)<spval)&
3090 grid1(i,j) = omga(i,j,lm)+(omga(i,j,lm-1)-omga(i,j,lm))&
3094 if(grib==
'grib2')
then
3096 fld_info(cfld)%ifld=iavblfld(iget(326))
3097 fld_info(cfld)%lvl=lvlsxml(1,iget(326))
3102 datapd(i,j,cfld) = grid1(i,jj)
3115 IF(lvls(3,iget(032))>0)field1=.true.
3118 IF(lvls(3,iget(107))>0)field2=.true.
3128 IF(field1.OR.field2)
THEN
3134 egrid1(i,j) = -h99999
3135 egrid2(i,j) = -h99999
3136 lb2(i,j) = (lvlbnd(i,j,1) + lvlbnd(i,j,2) + &
3138 p1d(i,j) = (pbnd(i,j,1) + pbnd(i,j,2) + pbnd(i,j,3))/3
3139 t1d(i,j) = (tbnd(i,j,1) + tbnd(i,j,2) + tbnd(i,j,3))/3
3140 q1d(i,j) = (qbnd(i,j,1) + qbnd(i,j,2) + qbnd(i,j,3))/3
3145 CALL calcape(itype,dpbnd,p1d,t1d,q1d,lb2,egrid1, &
3146 egrid2,egrid3,egrid4,egrid5)
3148 IF (iget(582)>0)
THEN
3154 IF(t1d(i,j) < spval)
THEN
3155 grid1(i,j) = egrid1(i,j)
3156 IF (submodelname ==
'RTMA')mlcape(i,j)=grid1(i,j)
3160 CALL bound(grid1,d00,h99999)
3161 if(grib==
'grib2')
then
3163 fld_info(cfld)%ifld=iavblfld(iget(582))
3164 fld_info(cfld)%lvl=lvlsxml(1,iget(582))
3169 datapd(i,j,cfld) = grid1(i,jj)
3174 IF (iget(583)>0)
THEN
3180 IF(t1d(i,j) < spval) grid1(i,j) = - egrid2(i,j)
3184 CALL bound(grid1,d00,h99999)
3189 IF(t1d(i,j) < spval)
THEN
3190 grid1(i,j) = - grid1(i,j)
3191 IF (submodelname ==
'RTMA') mlcin(i,j)=grid1(i,j)
3196 if(grib==
'grib2')
then
3198 fld_info(cfld)%ifld=iavblfld(iget(583))
3199 fld_info(cfld)%lvl=lvlsxml(1,iget(583))
3204 datapd(i,j,cfld) = grid1(i,jj)
3214 IF ( (iget(109)>0).OR.(iget(110)>0) )
THEN
3215 CALL callcl(p1d,t1d,q1d,egrid1,egrid2)
3216 IF (iget(109)>0)
THEN
3220 IF(t1d(i,j) < spval) grid1(i,j)=egrid2(i,j)
3221 IF (submodelname ==
'RTMA') mllcl(i,j) = grid1(i,j)
3251 IF(lvls(4,iget(032))>0)field1=.true.
3255 IF(lvls(4,iget(107))>0)field2=.true.
3265 IF(field1.OR.field2)
THEN
3271 egrid1(i,j) = -h99999
3272 egrid2(i,j) = -h99999
3277 CALL calcape(itype,dpbnd,p1d,t1d,q1d,lb2,egrid1, &
3278 egrid2,egrid3,egrid4,egrid5)
3279 IF (submodelname ==
'RTMA') mumixr(i,j) = q1d(i,j)
3280 IF (iget(584)>0)
THEN
3286 IF(t1d(i,j) < spval)
THEN
3287 grid1(i,j) = egrid1(i,j)
3288 IF (submodelname ==
'RTMA') mucape(i,j)=grid1(i,j)
3292 CALL bound(grid1,d00,h99999)
3296 if(grib==
'grib2')
then
3298 fld_info(cfld)%ifld=iavblfld(iget(584))
3299 fld_info(cfld)%lvl=lvlsxml(1,iget(584))
3304 datapd(i,j,cfld) = grid1(i,jj)
3311 IF (iget(585)>0)
THEN
3317 IF(t1d(i,j) < spval) grid1(i,j) = - egrid2(i,j)
3320 CALL bound(grid1,d00,h99999)
3323 IF(t1d(i,j) < spval)
THEN
3324 grid1(i,j) = - grid1(i,j)
3325 IF (submodelname ==
'RTMA')
THEN
3326 mucape(i,j) = grid1(i,j)
3327 muq1d(i,j) = q1d(i,j)
3332 if(grib==
'grib2')
then
3334 fld_info(cfld)%ifld=iavblfld(iget(585))
3335 fld_info(cfld)%lvl=lvlsxml(1,iget(585))
3340 datapd(i,j,cfld) = grid1(i,jj)
3348 IF (iget(443)>0)
THEN
3353 IF(t1d(i,j) < spval) grid1(i,j) = egrid4(i,j)
3356 if(grib==
'grib2')
then
3358 fld_info(cfld)%ifld=iavblfld(iget(443))
3359 fld_info(cfld)%lvl=lvlsxml(1,iget(443))
3364 datapd(i,j,cfld) = grid1(i,jj)
3370 IF (iget(982)>0)
THEN
3373 grid1(i,j) = teql(i,j)
3376 if(grib==
'grib2')
then
3378 fld_info(cfld)%ifld=iavblfld(iget(982))
3379 fld_info(cfld)%lvl=lvlsxml(1,iget(982))
3384 datapd(i,j,cfld) = grid1(i,jj)
3393 IF (iget(246)>0)
THEN
3398 IF(t1d(i,j) < spval) grid1(i,j) = egrid3(i,j)
3401 CALL bound(grid1,d00,h99999)
3404 if(grib==
'grib2')
then
3406 fld_info(cfld)%ifld=iavblfld(iget(246))
3407 fld_info(cfld)%lvl=lvlsxml(1,iget(246))
3412 datapd(i,j,cfld) = grid1(i,jj)
3419 IF (iget(444)>0)
THEN
3424 IF(cprate(i,j) < spval)
THEN
3425 IF (cprate(i,j) > pthresh)
THEN
3426 grid1(i,j) = egrid5(i,j)
3433 CALL bound(grid1,d00,h99999)
3434 if(grib==
'grib2')
then
3436 fld_info(cfld)%ifld=iavblfld(iget(444))
3437 fld_info(cfld)%lvl=lvlsxml(1,iget(444))
3442 datapd(i,j,cfld) = grid1(i,jj)
3450 IF (submodelname ==
'RTMA')
THEN
3456 ALLOCATE(el_base(im,jsta_2l:jend_2u))
3457 ALLOCATE(el_tops(im,jsta_2l:jend_2u))
3458 ALLOCATE(found_base(im,jsta_2l:jend_2u))
3459 ALLOCATE(found_tops(im,jsta_2l:jend_2u))
3465 found_base(i,j) = .false.
3466 found_tops(i,j) = .false.
3481 egrid1(i,j) = -h99999
3482 egrid2(i,j) = -h99999
3484 p1d(i,j) = pmid(i,j,l)
3491 IF (debugprint)
WRITE(1000+me,
'(A,I3)') &
3492 ' CALCULATING CAPE/CINS ON LEVEL:',l
3493 CALL calcape(itype,dpbnd,p1d,t1d,q1d,idummy,egrid1, &
3494 egrid2,egrid3,egrid4,egrid5)
3500 IF ( .NOT. found_base(i,j) )
THEN
3501 IF ( egrid1(i,j) >= 100. .AND. egrid2(i,j) >= -250. )
THEN
3503 found_base(i,j) = .true.
3506 found_base(i,j) = .false.
3509 IF ( .NOT. found_tops(i,j) )
THEN
3510 IF ( egrid1(i,j) < 100. .OR. egrid2(i,j) < -250. )
THEN
3511 el_tops(i,j) = l + 1
3512 found_tops(i,j) = .true.
3515 found_tops(i,j) = .false.
3525 IF (
ALLOCATED(found_base))
DEALLOCATE(found_base)
3526 IF (
ALLOCATED(found_tops))
DEALLOCATE(found_tops)
3528 IF (debugprint)
THEN
3529 WRITE(im_ch,
'(I5.5)') im
3530 WRITE(jsta_ch,
'(I5.5)') jsta
3531 WRITE(jend_ch,
'(I5.5)') jend
3532 effl_fname=
"EFFL_NEW_"//im_ch//
"_"//jsta_ch//
"_"//jend_ch &
3534 effl_fname2=
"EFFL_NEW_LVLS_"//im_ch//
"_"//jsta_ch//
"_"//jend_ch &
3540 OPEN(iunit,file=trim(adjustl(effl_fname)),form=
'FORMATTED')
3547 WRITE(iunit,
'(1x,I6,2x,I6,2(2x,I6,2x,F12.3))') i, j, &
3548 el_base(i,j),pmid(i,j,el_base(i,j)), &
3549 el_tops(i,j),pmid(i,j,el_tops(i,j))
3555 IF(
ALLOCATED(tpar_base))
DEALLOCATE(tpar_base)
3556 IF(
ALLOCATED(tpar_tops))
DEALLOCATE(tpar_tops)
3568 IF(lvls(3,iget(032))>0)field1=.true.
3571 IF(lvls(3,iget(107))>0)field2=.true.
3584 IF(field1.OR.field2)
THEN
3591 egrid1(i,j) = -h99999
3592 egrid2(i,j) = -h99999
3593 egrid3(i,j) = -h99999
3594 egrid4(i,j) = -h99999
3595 egrid5(i,j) = -h99999
3596 egrid6(i,j) = -h99999
3597 egrid7(i,j) = -h99999
3598 egrid8(i,j) = -h99999
3603 lb2(i,j) = (lvlbnd(i,j,1) + lvlbnd(i,j,2) + &
3605 p1d(i,j) = (pbnd(i,j,1) + pbnd(i,j,2) + pbnd(i,j,3))/3
3606 t1d(i,j) = (tbnd(i,j,1) + tbnd(i,j,2) + tbnd(i,j,3))/3
3607 q1d(i,j) = (qbnd(i,j,1) + qbnd(i,j,2) + qbnd(i,j,3))/3
3612 CALL calcape2(itype,dpbnd,p1d,t1d,q1d,lb2, &
3613 egrid1,egrid2,egrid3,egrid4,egrid5, &
3614 egrid6,egrid7,egrid8)
3619 IF (iget(950)>0)
THEN
3625 IF(t1d(i,j) < spval) grid1(i,j) = egrid1(i,j)
3628 CALL bound(grid1,d00,h99999)
3629 if(grib==
'grib2')
then
3631 fld_info(cfld)%ifld=iavblfld(iget(950))
3632 fld_info(cfld)%lvl=lvlsxml(1,iget(950))
3637 datapd(i,j,cfld) = grid1(i,jj)
3643 IF (iget(951)>0)
THEN
3649 IF(t1d(i,j) < spval) grid1(i,j) = - egrid2(i,j)
3653 CALL bound(grid1,d00,h99999)
3658 IF(t1d(i,j) < spval) grid1(i,j) = - grid1(i,j)
3662 if(grib==
'grib2')
then
3664 fld_info(cfld)%ifld=iavblfld(iget(951))
3665 fld_info(cfld)%lvl=lvlsxml(1,iget(951))
3670 datapd(i,j,cfld) = grid1(i,jj)
3678 IF (iget(952)>0)
THEN
3683 IF(t1d(i,j) < spval) grid1(i,j) = egrid3(i,j)
3686 CALL bound(grid1,d00,h99999)
3687 if(grib==
'grib2')
then
3689 fld_info(cfld)%ifld=iavblfld(iget(952))
3690 fld_info(cfld)%lvl=lvlsxml(1,iget(952))
3695 datapd(i,j,cfld) = grid1(i,jj)
3704 allocate(ust(im,jsta_2l:jend_2u),vst(im,jsta_2l:jend_2u), &
3705 heli(im,jsta_2l:jend_2u,2))
3706 allocate(llow(im,jsta_2l:jend_2u),lupp(im,jsta_2l:jend_2u), &
3707 cangle(im,jsta_2l:jend_2u))
3713 iget2 = lvls(1,iget1)
3714 iget3 = lvls(2,iget1)
3716 if(me==0)
write(0,*)
'953 ',iget1,iget2,iget3
3717 IF (iget1 > 0 .OR. iget(162) > 0 .OR. iget(953) > 0)
THEN
3720 IF (submodelname ==
'RTMA')
THEN
3726 llow(i,j) = el_base(i,j)
3727 lupp(i,j) = el_tops(i,j)
3734 llow(i,j) = int(egrid4(i,j))
3735 lupp(i,j) = int(egrid5(i,j))
3740 IF (debugprint)
THEN
3741 WRITE(im_ch,
'(I5.5)') im
3742 WRITE(jsta_ch,
'(I5.5)') jsta
3743 WRITE(jend_ch,
'(I5.5)') jend
3744 effl_fname=
"EFFL_OLD_"//im_ch//
"_"//jsta_ch//
"_"//jend_ch &
3748 OPEN(iunit,file=trim(adjustl(effl_fname)),form=
'FORMATTED')
3753 WRITE(iunit,
'(1x,I6,2x,I6,2(2x,I6,2x,F12.3))') i, j, &
3754 llow(i,j),pmid(i,j,llow(i,j)), &
3755 lupp(i,j),pmid(i,j,lupp(i,j))
3763 CALL calhel2(llow,lupp,depth,ust,vst,heli,cangle)
3769 grid1(i,j) = heli(i,j,1)
3773 if(grib==
'grib2')
then
3775 fld_info(cfld)%ifld=iavblfld(iget1)
3776 fld_info(cfld)%lvl=lvlsxml(1,iget1)
3781 datapd(i,j,cfld) = grid1(i,jj)
3790 IF (submodelname ==
'RTMA')
THEN
3794 allocate(eshr(im,jsta_2l:jend_2u),uvect(im,jsta_2l:jend_2u),&
3795 vvect(im,jsta_2l:jend_2u),htsfc(im,jsta_2l:jend_2u))
3796 allocate(effust(im,jsta_2l:jend_2u),effvst(im,jsta_2l:jend_2u),&
3797 esrh(im,jsta_2l:jend_2u))
3812 egrid1(i,j) = -h99999
3813 p1d(i,j)=pmid(i,j,l)
3818 CALL calthte(p1d,t1d,q1d,egrid1)
3821 the(i,j)=egrid1(i,j)
3822 IF(the(i,j)>=maxthe(i,j))
THEN
3823 maxthe(i,j)=the(i,j)
3825 muq1d(i,j) = q(i,j,l)
3834 IF(gridtype ==
'E')
THEN
3845 ELSE IF(gridtype ==
'B')
THEN
3869 IF(gridtype /=
'A') CALL exch(fis(1:im,jsta:jend))
3876 IF (gridtype==
'B')
THEN
3877 htsfc(i,j)=(0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(ie,jn))
3879 htsfc(i,j)=(0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(i,js))
3885 IF (iget(979)>0)
THEN
3889 IF(zint(i,j,llow(i,j))<spval.and.htsfc(i,j)<spval)&
3890 grid1(i,j) = zint(i,j,llow(i,j)) - htsfc(i,j)
3893 if(grib==
'grib2')
then
3895 fld_info(cfld)%ifld=iavblfld(iget(979))
3896 fld_info(cfld)%lvl=lvlsxml(1,iget(979))
3901 datapd(i,j,cfld) = grid1(i,jj)
3907 IF (iget(980)>0)
THEN
3911 IF(zint(i,j,lupp(i,j))<spval.and.htsfc(i,j)<spval)&
3912 grid1(i,j) = zint(i,j,lupp(i,j)) - htsfc(i,j)
3915 if(grib==
'grib2')
then
3917 fld_info(cfld)%ifld=iavblfld(iget(980))
3918 fld_info(cfld)%lvl=lvlsxml(1,iget(980))
3923 datapd(i,j,cfld) = grid1(i,jj)
3931 IF (iget(983)>0)
THEN
3935 IF(llow(i,j)<spval.and.lupp(i,j)<spval)
THEN
3936 midcal=int(llow(i,j)+d50*(lupp(i,j)-llow(i,j)))
3940 uvect(i,j)=uh(i,j,midcal)-uh(i,j,llow(i,j))
3941 grid1(i,j)=uvect(i,j)
3945 if(grib==
'grib2')
then
3947 fld_info(cfld)%ifld=iavblfld(iget(983))
3948 fld_info(cfld)%lvl=lvlsxml(1,iget(983))
3953 datapd(i,j,cfld) = grid1(i,jj)
3960 IF (iget(984)>0)
THEN
3964 IF(llow(i,j)<spval.and.lupp(i,j)<spval.and.&
3965 vh(i,j,midcal)<spval.and.vh(i,j,llow(i,j))<spval)
THEN
3966 midcal=int(llow(i,j)+d50*(ieql(i,j)-llow(i,j)))
3970 vvect(i,j)=vh(i,j,midcal)-vh(i,j,llow(i,j))
3971 grid1(i,j)=vvect(i,j)
3975 if(grib==
'grib2')
then
3977 fld_info(cfld)%ifld=iavblfld(iget(984))
3978 fld_info(cfld)%lvl=lvlsxml(1,iget(984))
3983 datapd(i,j,cfld) = grid1(i,jj)
3990 IF (iget(985)>0)
THEN
3994 IF(uvect(i,j)<spval.and.vvect(i,j)<spval)
THEN
3995 eshr(i,j)=sqrt((uvect(i,j)**2)+(vvect(i,j))**2)
3998 grid1(i,j)=eshr(i,j)
4002 if(grib==
'grib2')
then
4004 fld_info(cfld)%ifld=iavblfld(iget(985))
4005 fld_info(cfld)%lvl=lvlsxml(1,iget(985))
4010 datapd(i,j,cfld) = grid1(i,jj)
4018 CALL calhel3(llow,lupp,effust,effvst,esrh)
4023 IF (iget(986)>0)
THEN
4027 IF(llow(i,j)<spval.and.lupp(i,j)<spval)&
4028 grid1(i,j)=effust(i,j)
4031 if(grib==
'grib2')
then
4033 fld_info(cfld)%ifld=iavblfld(iget(986))
4034 fld_info(cfld)%lvl=lvlsxml(1,iget(986))
4039 datapd(i,j,cfld) = grid1(i,jj)
4046 IF (iget(987)>0)
THEN
4050 IF(llow(i,j)<spval.and.lupp(i,j)<spval)&
4051 grid1(i,j)=effvst(i,j)
4054 if(grib==
'grib2')
then
4056 fld_info(cfld)%ifld=iavblfld(iget(987))
4057 fld_info(cfld)%lvl=lvlsxml(1,iget(987))
4062 datapd(i,j,cfld) = grid1(i,jj)
4069 IF (iget(988)>0)
THEN
4073 IF(llow(i,j)<spval.and.lupp(i,j)<spval)&
4074 grid1(i,j)=esrh(i,j)
4077 if(grib==
'grib2')
then
4079 fld_info(cfld)%ifld=iavblfld(iget(988))
4080 fld_info(cfld)%lvl=lvlsxml(1,iget(988))
4085 datapd(i,j,cfld) = grid1(i,jj)
4092 IF (iget(989)>0)
THEN
4095 IF (mllcl(i,j)>d2000)
THEN
4097 ELSEIF (mllcl(i,j)<d1000)
THEN
4100 mllcltmp=((d2000-mllcl(i,j))/d1000)
4102 IF (eshr(i,j)<12.5)
THEN
4104 ELSEIF (eshr(i,j)>30.0)
THEN
4107 eshrtmp=(eshr(i,j)/20.)
4109 IF (mlcin(i,j)>-50.)
THEN
4111 ELSEIF (mlcin(i,j)<-200.)
THEN
4114 mlcintmp=(200.+mlcin(i,j))/150.
4116 stp=(mlcape(i,j)/d1500)*mllcltmp*(esrh(i,j)/150.)*&
4119 IF(llow(i,j)<spval.and.lupp(i,j)<spval)
THEN
4128 if(grib==
'grib2')
then
4130 fld_info(cfld)%ifld=iavblfld(iget(989))
4131 fld_info(cfld)%lvl=lvlsxml(1,iget(989))
4136 datapd(i,j,cfld) = grid1(i,jj)
4143 IF (iget(990)>0)
THEN
4146 llmh = nint(lmh(i,j))
4147 p1d(i,j) = pmid(i,j,llmh)
4148 t1d(i,j) = t(i,j,llmh)
4149 q1d(i,j) = q(i,j,llmh)
4152 CALL callcl(p1d,t1d,q1d,egrid1,egrid2)
4155 slcl(i,j)=egrid2(i,j)
4162 CALL calcape(itype,dpbnd,dummy,dummy,dummy,&
4163 idummy,egrid1,egrid2,&
4168 IF (slcl(i,j)>d2000)
THEN
4170 ELSEIF (slcl(i,j)<=d1000)
THEN
4173 slcltmp=((d2000-slcl(i,j))/d1000)
4175 IF (fshr(i,j)<12.5)
THEN
4177 ELSEIF (fshr(i,j)>30.0)
THEN
4180 fshrtmp=(fshr(i,j)/20.)
4182 IF (egrid2(i,j)>-50.)
THEN
4184 ELSEIF (egrid2(i,j)<-200.)
THEN
4187 scintmp=((200.+egrid2(i,j)/150.))
4189 stp=(egrid1(i,j)/d1500)*slcltmp*(heli(i,j,2)/150.)*&
4192 IF(t1d(i,j) < spval)
THEN
4201 if(grib==
'grib2')
then
4203 fld_info(cfld)%ifld=iavblfld(iget(990))
4204 fld_info(cfld)%lvl=lvlsxml(1,iget(990))
4209 datapd(i,j,cfld) = grid1(i,jj)
4216 IF (iget(991)>0)
THEN
4219 IF (eshr(i,j)<10.)
THEN
4221 ELSEIF (eshr(i,j)>20.0)
THEN
4224 eshrtmp=(eshr(i,j)/20.)
4226 IF (mucin(i,j)>-40.)
THEN
4229 mucintmp=(-40./mucin(i,j))
4231 stp=(mucape(i,j)/d1000)*(esrh(i,j)/50.)*&
4234 IF(t1d(i,j) < spval)
THEN
4243 if(grib==
'grib2')
then
4245 fld_info(cfld)%ifld=iavblfld(iget(991))
4246 fld_info(cfld)%lvl=lvlsxml(1,iget(991))
4251 datapd(i,j,cfld) = grid1(i,jj)
4259 IF (iget(992)>0)
THEN
4263 egrid1(i,j) = -h99999
4264 egrid2(i,j) = -h99999
4265 egrid3(i,j) = -h99999
4266 egrid4(i,j) = -h99999
4267 egrid5(i,j) = -h99999
4268 egrid6(i,j) = -h99999
4269 egrid7(i,j) = -h99999
4270 egrid8(i,j) = -h99999
4271 lb2(i,j) = (lvlbnd(i,j,1) + lvlbnd(i,j,2) + &
4273 p1d(i,j) = (pbnd(i,j,1) + pbnd(i,j,2) + pbnd(i,j,3))/3
4274 t1d(i,j) = (tvirtual(tbnd(i,j,1),qbnd(i,j,1)) + &
4275 tvirtual(tbnd(i,j,2),qbnd(i,j,2)) + &
4276 tvirtual(tbnd(i,j,3),qbnd(i,j,3)))/3
4277 q1d(i,j) = (qbnd(i,j,1) + qbnd(i,j,2) + qbnd(i,j,3))/3
4284 CALL calcape2(itype,dpbnd,p1d,t1d,q1d,lb2, &
4285 egrid1,egrid2,egrid3,egrid4,egrid5, &
4286 egrid6,egrid7,egrid8)
4291 IF(t1d(i,j) < spval) grid1(i,j) = egrid3(i,j)
4294 CALL bound(grid1,d00,h99999)
4295 if(grib==
'grib2')
then
4297 fld_info(cfld)%ifld=iavblfld(iget(992))
4298 fld_info(cfld)%lvl=lvlsxml(1,iget(992))
4303 datapd(i,j,cfld) = grid1(i,jj)
4310 IF (iget(763)>0)
THEN
4315 grid1(i,j) = q1d(i,j)
4318 if(grib==
'grib2')
then
4320 fld_info(cfld)%ifld=iavblfld(iget(763))
4321 fld_info(cfld)%lvl=lvlsxml(1,iget(763))
4326 datapd(i,j,cfld) = grid1(i,jj)
4333 IF (iget(993)>0)
THEN
4337 lapse=-((t700(i,j)-t500(i,j))/((z700(i,j)-z500(i,j))))
4338 ship=(mucape(i,j)*d1000*muq1d(i,j)*lapse*(t500(i,j)-k2c)*fshr(i,j))/hconst
4339 IF (mucape(i,j)<1300.)
THEN
4340 ship=ship*(mucape(i,j)/1300.)
4342 IF (lapse < 5.8)
THEN
4343 ship=ship*(lapse/5.8)
4345 IF (freezelvl(i,j) < 2400.)
THEN
4346 ship=ship*(freezelvl(i,j)/2400.)
4351 if(grib==
'grib2')
then
4353 fld_info(cfld)%ifld=iavblfld(iget(993))
4354 fld_info(cfld)%lvl=lvlsxml(1,iget(993))
4359 datapd(i,j,cfld) = grid1(i,jj)
4370 IF (iget(957)>0)
THEN
4375 IF(t1d(i,j) < spval ) grid1(i,j) = cangle(i,j)
4381 if(grib==
'grib2')
then
4383 fld_info(cfld)%ifld=iavblfld(iget(957))
4384 fld_info(cfld)%lvl=lvlsxml(1,iget(957))
4389 datapd(i,j,cfld) = grid1(i,jj)
4397 IF (iget(955)>0)
THEN
4402 IF(t1d(i,j) < spval ) grid1(i,j) = egrid7(i,j)
4405 CALL bound(grid1,d00,h99999)
4406 if(grib==
'grib2')
then
4408 fld_info(cfld)%ifld=iavblfld(iget(955))
4409 fld_info(cfld)%lvl=lvlsxml(1,iget(955))
4414 datapd(i,j,cfld) = grid1(i,jj)
4422 IF (iget(956)>0)
THEN
4427 IF(t1d(i,j) < spval ) grid1(i,j) = egrid8(i,j)
4430 CALL bound(grid1,d00,h99999)
4431 if(grib==
'grib2')
then
4433 fld_info(cfld)%ifld=iavblfld(iget(956))
4434 fld_info(cfld)%lvl=lvlsxml(1,iget(956))
4439 datapd(i,j,cfld) = grid1(i,jj)
4463 IF (iget(954)>0)
THEN
4468 IF(t1d(i,j) < spval) grid1(i,j) = -egrid6(i,j)
4471 CALL bound(grid1,d00,h99999)
4472 if(grib==
'grib2')
then
4474 fld_info(cfld)%ifld=iavblfld(iget(954))
4475 fld_info(cfld)%lvl=lvlsxml(1,iget(954))
4480 datapd(i,j,cfld) = grid1(i,jj)
4487 if (
allocated(ushr1))
deallocate(ushr1)
4488 if (
allocated(vshr1))
deallocate(vshr1)
4489 if (
allocated(ushr6))
deallocate(ushr6)
4490 if (
allocated(vshr6))
deallocate(vshr6)
4491 if (
allocated(ust))
deallocate(ust)
4492 if (
allocated(vst))
deallocate(vst)
4493 if (
allocated(heli))
deallocate(heli)
4494 if (
allocated(llow))
deallocate(llow)
4495 if (
allocated(lupp))
deallocate(lupp)
4496 if (
allocated(cangle))
deallocate(cangle)
4497 if (
allocated(effust))
deallocate(effust)
4498 if (
allocated(effvst))
deallocate(effvst)
4499 if (
allocated(eshr))
deallocate(eshr)
4500 if (
allocated(uvect))
deallocate(uvect)
4501 if (
allocated(vvect))
deallocate(vvect)
4502 if (
allocated(esrh))
deallocate(esrh)
4503 if (
allocated(htsfc))
deallocate(htsfc)
4504 if (
allocated(fshr))
deallocate(fshr)
4507 if (
allocated(pbnd))
deallocate(pbnd)
4508 if (
allocated(tbnd))
deallocate(tbnd)
4509 if (
allocated(qbnd))
deallocate(qbnd)
4510 if (
allocated(ubnd))
deallocate(ubnd)
4511 if (
allocated(vbnd))
deallocate(vbnd)
4512 if (
allocated(rhbnd))
deallocate(rhbnd)
4513 if (
allocated(wbnd))
deallocate(wbnd)
4514 if (
allocated(lvlbnd))
deallocate(lvlbnd)
4515 if (
allocated(lb2))
deallocate(lb2)
4519 IF (iget(749)>0)
THEN
4520 CALL calrh_pw(grid1(1,jsta))
4521 if(grib==
'grib2')
then
4523 fld_info(cfld)%ifld=iavblfld(iget(749))
4528 datapd(i,j,cfld) = grid1(i,jj)
subroutine mxwind(km, p, u, v, t, h, pmw, umw, vmw, tmw, hmw)
mxwind() computes maximum wind level fields.
elemental real function, public fpvsnew(t)
subroutine tpause(km, p, u, v, t, h, ptp, utp, vtp, ttp, htp, shrtp)
tpause() computes tropopause level fields.
calcape() computes CAPE/CINS and other storm related variables.