51 use vrbls3d, only: zmid, zint, dbz, dbzr, dbzi, dbzc, uh, vh, pmid, t, q, ref_10cm
52 use vrbls2d, only: refd_max, up_heli_max, up_heli_max16, grpl_max, &
53 up_heli_min, up_heli_min16, up_heli_max02, &
54 up_heli_min02, up_heli_max03, up_heli_min03, &
55 rel_vort_max, rel_vort_max01, hail_max2d, hail_maxk1,&
56 hail_maxhailcast,refdm10c_max, rel_vort_maxhy1, &
57 ltg1_max, ltg2_max, ltg3_max, up_heli, up_heli16, &
58 nci_ltg, nca_ltg, nci_wq, nca_wq, nci_refd, nca_refd,&
60 use masks, only: lmh, lmv
62 use ctlblk_mod
, only: spval, lm, modelname, grib, cfld, fld_info, datapd,&
63 ifhr, global, jsta_m, jend_m, mpi_comm_comp, &
64 jsta_2l, jend_2u, im, jm, jsta, jend, imp_physics
65 use rqstfld_mod
, only: iget, lvls, iavblfld, lvlsxml, id
66 use gridspec_mod
, only: gridtype
75 integer,
PARAMETER :: lagl=2,lagl2=1
80 REAL,
dimension(im,jsta_2l:jend_2u) :: grid1
81 REAL,
dimension(im,jsta_2l:jend_2u) :: uagl, vagl, tagl, pagl, qagl
83 INTEGER,
dimension(im,jsta_2l:jend_2u) :: nl1x
84 integer,
dimension(jm) :: ihe, ihw
85 INTEGER lxxx,ierr, maxll, minll
86 INTEGER istart,istop,jstart,jstop
103 REAL,
dimension(im,jsta:jend) :: dbz1, dbzr1, dbzi1, dbzc1, dbz1log
104 real,
dimension(lagl) :: zagl
105 real,
dimension(lagl2) :: zagl2, zagl3
106 real paglu,pagll,taglu,tagll,qaglu,qagll, pv, rho
108 integer i,j,l,ii,jj,lp,ll,llmh,ie,iw,jn,js,iget1,iget2,iget3,iget4
109 real uagll,uaglu,vagll,vaglu,fact,zdum
134 IF (iget(253)>0 .OR. iget(279)>0 .OR. iget(280)>0 .OR. &
144 iget1 = -1 ; iget2 = -1 ; iget3 = -1 ; iget4 = -1
145 if (iget(253) > 0) iget1 = lvls(lp,iget(253))
146 if (iget(279) > 0) iget2 = lvls(lp,iget(279))
147 if (iget(280) > 0) iget3 = lvls(lp,iget(280))
148 if (iget(281) > 0) iget4 = lvls(lp,iget(281))
149 IF (iget1 > 0 .or. iget2 > 0 .or. iget3 > 0 .or. iget4 > 0)
then
151 jj=float(jsta+jend)/2.0
164 llmh = nint(lmh(i,j))
167 zdum = zmid(i,j,l)-zint(i,j,llmh+1)
168 IF(zdum >= zagl(lp))
THEN
179 IF(nl1x(i,j) == (llmh+1) .AND. zagl(lp) > 0.)
THEN
206 llmh = nint(lmh(i,j))
207 IF(nl1x(i,j)<=llmh)
THEN
208 IF(zmid(i,j,ll)<spval.and.zmid(i,j,ll-1)<spval)
THEN
220 zdum=zagl(lp)+zint(i,j,nint(lmh(i,j))+1)
221 fact=(zdum-zmid(i,j,ll))/(zmid(i,j,ll)-zmid(i,j,ll-1))
224 if (imp_physics==8)
then
225 dbz1(i,j)=ref_10cm(i,j,ll)+(ref_10cm(i,j,ll)-ref_10cm(i,j,ll-1))*fact
227 dbz1(i,j)=dbz(i,j,ll)+(dbz(i,j,ll)-dbz(i,j,ll-1))*fact
230 dbzr1(i,j) = dbzr(i,j,ll) + (dbzr(i,j,ll)-dbzr(i,j,ll-1))*fact
231 dbzi1(i,j) = dbzi(i,j,ll) + (dbzi(i,j,ll)-dbzi(i,j,ll-1))*fact
232 dbzc1(i,j) = dbzc(i,j,ll) + (dbzc(i,j,ll)-dbzc(i,j,ll-1))*fact
233 if(modelname==
'RAPR')
then
234 if(dbz1(i,j)>0.)
then
235 dbz1log(i,j)= 10.*log10(dbz1(i,j))
247 if(modelname==
'RAPR')
then
248 dbz1log(i,j)=max(dbz1log(i,j),dbzmin)
250 dbz1(i,j)=max(dbz1(i,j),dbzmin)
252 dbzr1(i,j) = max(dbzr1(i,j),dbzmin)
253 dbzi1(i,j) = max(dbzi1(i,j),dbzmin)
254 dbzc1(i,j) = max(dbzc1(i,j),dbzmin)
262 dbz1log(i,j) = dbzmin
281 IF((iget(253)>0) )
THEN
282 if(modelname==
'RAPR')
then
285 grid1(i,j)=dbz1log(i,j)
295 if(grib==
'grib2')
then
297 fld_info(cfld)%ifld=iavblfld(iget(253))
298 fld_info(cfld)%lvl=lvlsxml(lp,iget(253))
299 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
303 IF((iget(279)>0) )
THEN
306 grid1(i,j)=dbzr1(i,j)
309 if(grib==
'grib2')
then
311 fld_info(cfld)%ifld=iavblfld(iget(279))
312 fld_info(cfld)%lvl=lvlsxml(lp,iget(279))
313 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
317 IF((iget(280)>0) )
THEN
320 grid1(i,j)=dbzi1(i,j)
323 if(grib==
'grib2')
then
325 fld_info(cfld)%ifld=iavblfld(iget(280))
326 fld_info(cfld)%lvl=lvlsxml(lp,iget(280))
327 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
331 IF((iget(281)>0) )
THEN
334 grid1(i,j)=dbzc1(i,j)
337 if(grib==
'grib2')
then
339 fld_info(cfld)%ifld=iavblfld(iget(281))
340 fld_info(cfld)%lvl=lvlsxml(lp,iget(281))
341 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
356 IF((iget(421)>0) )
THEN
359 grid1(i,j)=refd_max(i,j)
362 if(grib==
'grib2')
then
364 fld_info(cfld)%ifld=iavblfld(iget(421))
365 fld_info(cfld)%lvl=lvlsxml(lp,iget(421))
366 fld_info(cfld)%tinvstat=1
368 fld_info(cfld)%tinvstat=1
370 fld_info(cfld)%tinvstat=0
372 fld_info(cfld)%ntrange=1
373 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
378 IF((iget(785)>0) )
THEN
381 grid1(i,j)=refdm10c_max(i,j)
384 if(grib==
'grib2')
then
386 fld_info(cfld)%ifld=iavblfld(iget(785))
387 fld_info(cfld)%lvl=lvlsxml(lp,iget(785))
389 fld_info(cfld)%tinvstat=1
391 fld_info(cfld)%tinvstat=0
393 fld_info(cfld)%ntrange=1
394 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
399 IF((iget(420)>0) )
THEN
402 grid1(i,j)=up_heli_max(i,j)
405 if(grib==
'grib2')
then
407 fld_info(cfld)%ifld=iavblfld(iget(420))
408 fld_info(cfld)%lvl=lvlsxml(lp,iget(420))
410 fld_info(cfld)%tinvstat = 1
412 fld_info(cfld)%tinvstat = 0
414 fld_info(cfld)%ntrange = 1
415 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
420 IF((iget(700)>0) )
THEN
423 grid1(i,j)=up_heli_max16(i,j)
426 if(grib==
'grib2')
then
428 fld_info(cfld)%ifld=iavblfld(iget(700))
429 fld_info(cfld)%lvl=lvlsxml(lp,iget(700))
431 fld_info(cfld)%tinvstat = 0
433 fld_info(cfld)%tinvstat = 1
435 fld_info(cfld)%ntrange = 1
436 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
441 IF((iget(786)>0) )
THEN
444 grid1(i,j)=up_heli_min(i,j)
447 if(grib==
'grib2')
then
449 fld_info(cfld)%ifld=iavblfld(iget(786))
450 fld_info(cfld)%lvl=lvlsxml(lp,iget(786))
452 fld_info(cfld)%tinvstat = 1
454 fld_info(cfld)%tinvstat = 0
456 fld_info(cfld)%ntrange = 1
457 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
462 IF((iget(787)>0) )
THEN
465 grid1(i,j)=up_heli_min16(i,j)
468 if(grib==
'grib2')
then
470 fld_info(cfld)%ifld=iavblfld(iget(787))
471 fld_info(cfld)%lvl=lvlsxml(lp,iget(787))
473 fld_info(cfld)%tinvstat = 0
475 fld_info(cfld)%tinvstat = 1
477 fld_info(cfld)%ntrange = 1
478 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
483 IF((iget(788)>0) )
THEN
486 grid1(i,j)=up_heli_max02(i,j)
489 if(grib==
'grib2')
then
491 fld_info(cfld)%ifld=iavblfld(iget(788))
492 fld_info(cfld)%lvl=lvlsxml(lp,iget(788))
494 fld_info(cfld)%tinvstat = 1
496 fld_info(cfld)%tinvstat = 0
498 fld_info(cfld)%ntrange = 1
499 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
503 IF((iget(789)>0) )
THEN
506 grid1(i,j)=up_heli_min02(i,j)
509 if(grib==
'grib2')
then
511 fld_info(cfld)%ifld=iavblfld(iget(789))
512 fld_info(cfld)%lvl=lvlsxml(lp,iget(789))
514 fld_info(cfld)%tinvstat = 0
516 fld_info(cfld)%tinvstat = 1
518 fld_info(cfld)%ntrange = 1
519 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
524 IF((iget(790)>0) )
THEN
527 grid1(i,j)=up_heli_max03(i,j)
530 if(grib==
'grib2')
then
532 fld_info(cfld)%ifld=iavblfld(iget(790))
533 fld_info(cfld)%lvl=lvlsxml(lp,iget(790))
535 fld_info(cfld)%tinvstat = 1
537 fld_info(cfld)%tinvstat = 0
539 fld_info(cfld)%ntrange = 1
540 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
545 IF((iget(791)>0) )
THEN
548 grid1(i,j)=up_heli_min03(i,j)
551 if(grib==
'grib2')
then
553 fld_info(cfld)%ifld=iavblfld(iget(791))
554 fld_info(cfld)%lvl=lvlsxml(lp,iget(791))
556 fld_info(cfld)%tinvstat = 0
558 fld_info(cfld)%tinvstat = 1
560 fld_info(cfld)%ntrange = 1
561 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
566 IF((iget(792)>0) )
THEN
569 grid1(i,j)=rel_vort_max(i,j)
572 if(grib==
'grib2')
then
574 fld_info(cfld)%ifld=iavblfld(iget(792))
575 fld_info(cfld)%lvl=lvlsxml(lp,iget(792))
577 fld_info(cfld)%tinvstat = 1
579 fld_info(cfld)%tinvstat = 0
581 fld_info(cfld)%ntrange = 1
582 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
587 IF((iget(793)>0) )
THEN
590 grid1(i,j)=rel_vort_max01(i,j)
593 if(grib==
'grib2')
then
595 fld_info(cfld)%ifld=iavblfld(iget(793))
596 fld_info(cfld)%lvl=lvlsxml(lp,iget(793))
598 fld_info(cfld)%tinvstat = 1
600 fld_info(cfld)%tinvstat = 0
602 fld_info(cfld)%ntrange = 1
603 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
607 IF((iget(890)>0) )
THEN
610 grid1(i,j)=rel_vort_maxhy1(i,j)
613 if(grib==
'grib2')
then
615 fld_info(cfld)%ifld=iavblfld(iget(890))
616 fld_info(cfld)%lvl=lvlsxml(lp,iget(890))
618 fld_info(cfld)%tinvstat = 1
620 fld_info(cfld)%tinvstat = 0
622 fld_info(cfld)%ntrange = 1
623 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
628 IF((iget(794)>0) )
THEN
631 grid1(i,j)=hail_max2d(i,j)
634 if(grib==
'grib2')
then
636 fld_info(cfld)%ifld=iavblfld(iget(794))
637 fld_info(cfld)%lvl=lvlsxml(lp,iget(794))
639 fld_info(cfld)%tinvstat = 0
641 fld_info(cfld)%tinvstat = 1
643 fld_info(cfld)%ntrange = 1
644 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
649 IF((iget(795)>0) )
THEN
652 grid1(i,j)=hail_maxk1(i,j)
655 if(grib==
'grib2')
then
657 fld_info(cfld)%ifld=iavblfld(iget(795))
658 fld_info(cfld)%lvl=lvlsxml(lp,iget(795))
660 fld_info(cfld)%tinvstat = 0
662 fld_info(cfld)%tinvstat = 1
664 fld_info(cfld)%ntrange = 1
665 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
672 IF((iget(728)>0) )
THEN
675 grid1(i,j)=hail_maxhailcast(i,j)/1000.0
678 if(grib==
'grib2')
then
680 fld_info(cfld)%ifld=iavblfld(iget(728))
681 fld_info(cfld)%lvl=lvlsxml(lp,iget(728))
683 fld_info(cfld)%tinvstat = 0
685 fld_info(cfld)%tinvstat = 1
687 fld_info(cfld)%ntrange = 1
688 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
693 IF((iget(429)>0) )
THEN
696 grid1(i,j)=grpl_max(i,j)
699 if(grib==
'grib2')
then
701 fld_info(cfld)%ifld=iavblfld(iget(429))
702 fld_info(cfld)%lvl=lvlsxml(lp,iget(429))
704 fld_info(cfld)%tinvstat = 0
706 fld_info(cfld)%tinvstat = 1
708 fld_info(cfld)%ntrange = 1
709 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
714 IF((iget(702)>0) )
THEN
717 grid1(i,j)=ltg1_max(i,j)
720 if(grib==
'grib2')
then
722 fld_info(cfld)%ifld=iavblfld(iget(702))
723 fld_info(cfld)%lvl=lvlsxml(lp,iget(702))
725 fld_info(cfld)%tinvstat = 0
727 fld_info(cfld)%tinvstat = 1
729 fld_info(cfld)%ntrange = 1
730 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
735 IF((iget(703)>0) )
THEN
738 grid1(i,j)=ltg2_max(i,j)
741 if(grib==
'grib2')
then
743 fld_info(cfld)%ifld=iavblfld(iget(703))
744 fld_info(cfld)%lvl=lvlsxml(lp,iget(703))
746 fld_info(cfld)%tinvstat = 0
748 fld_info(cfld)%tinvstat = 1
750 fld_info(cfld)%ntrange = 1
751 datapd(1:im,1:jend-jsta+1,cfld) = grid1(1:im,jsta:jend)
756 IF((iget(704)>0) )
THEN
759 grid1(i,j)=ltg3_max(i,j)
762 if(grib==
'grib2')
then
764 fld_info(cfld)%ifld=iavblfld(iget(704))
765 fld_info(cfld)%lvl=lvlsxml(lp,iget(704))
767 fld_info(cfld)%tinvstat = 0
769 fld_info(cfld)%tinvstat = 1
771 fld_info(cfld)%ntrange = 1
772 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
777 IF((iget(727)>0) )
THEN
780 grid1(i,j)=up_heli(i,j)
783 if(grib==
'grib2')
then
785 fld_info(cfld)%ifld=iavblfld(iget(727))
786 fld_info(cfld)%lvl=lvlsxml(lp,iget(727))
787 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
792 IF((iget(701)>0) )
THEN
795 grid1(i,j)=up_heli16(i,j)
798 if(grib==
'grib2')
then
800 fld_info(cfld)%ifld=iavblfld(iget(701))
801 fld_info(cfld)%lvl=lvlsxml(lp,iget(701))
802 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
807 IF((iget(705)>0) )
THEN
810 grid1(i,j)=nci_ltg(i,j)/60.0
813 if(grib==
'grib2')
then
815 fld_info(cfld)%ifld=iavblfld(iget(705))
816 fld_info(cfld)%lvl=lvlsxml(lp,iget(705))
818 fld_info(cfld)%tinvstat = 0
820 fld_info(cfld)%tinvstat = 1
822 fld_info(cfld)%ntrange = 1
823 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
828 IF((iget(706)>0) )
THEN
831 grid1(i,j)=nca_ltg(i,j)/60.0
834 if(grib==
'grib2')
then
836 fld_info(cfld)%ifld=iavblfld(iget(706))
837 fld_info(cfld)%lvl=lvlsxml(lp,iget(706))
839 fld_info(cfld)%tinvstat = 0
841 fld_info(cfld)%tinvstat = 1
843 fld_info(cfld)%ntrange = 1
844 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
849 IF((iget(707)>0) )
THEN
852 grid1(i,j)=nci_wq(i,j)/60.0
855 if(grib==
'grib2')
then
857 fld_info(cfld)%ifld=iavblfld(iget(707))
858 fld_info(cfld)%lvl=lvlsxml(lp,iget(707))
860 fld_info(cfld)%tinvstat = 0
862 fld_info(cfld)%tinvstat = 1
864 fld_info(cfld)%ntrange = 1
865 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
870 IF((iget(708)>0) )
THEN
873 grid1(i,j)=nca_wq(i,j)/60.0
876 if(grib==
'grib2')
then
878 fld_info(cfld)%ifld=iavblfld(iget(708))
879 fld_info(cfld)%lvl=lvlsxml(lp,iget(708))
881 fld_info(cfld)%tinvstat = 0
883 fld_info(cfld)%tinvstat = 1
885 fld_info(cfld)%ntrange = 1
886 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
891 IF((iget(709)>0) )
THEN
894 grid1(i,j)=nci_refd(i,j)/60.0
897 if(grib==
'grib2')
then
899 fld_info(cfld)%ifld=iavblfld(iget(709))
900 fld_info(cfld)%lvl=lvlsxml(lp,iget(709))
902 fld_info(cfld)%tinvstat = 0
904 fld_info(cfld)%tinvstat = 1
906 fld_info(cfld)%ntrange = 1
907 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
912 IF((iget(710)>0) )
THEN
915 grid1(i,j)=nca_refd(i,j)/60.0
918 if(grib==
'grib2')
then
920 fld_info(cfld)%ifld=iavblfld(iget(710))
921 fld_info(cfld)%lvl=lvlsxml(lp,iget(710))
923 fld_info(cfld)%tinvstat = 0
925 fld_info(cfld)%tinvstat = 1
927 fld_info(cfld)%ntrange = 1
928 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
935 IF((iget(259)>0) )
THEN
944 if (iget(253) > 0 ) iget2 = iavblfld(iget(253))
948 if (iget(259) > 0 ) iget1 = lvls(lp,iget(259))
949 IF(iget1 > 0 .or. iget2 > 0)
THEN
964 zdum=zmid(i,j,l)-zint(i,j,llmh+1)
965 IF(zdum >= zagl2(lp))
THEN
976 IF(nl1x(i,j) == (llmh+1) .AND. zagl2(lp) > 0.)
THEN
994 IF(gridtype==
'A')
THEN
997 ELSE IF(gridtype==
'E')
THEN
1013 IF(gridtype/=
'A')
THEN
1017 CALL mpi_allreduce(minll,lxxx,1,mpi_integer,mpi_min,mpi_comm_comp,ierr)
1021 call exch(uh(1:im,jsta_2l:jend_2u,ll))
1022 call exch(vh(1:im,jsta_2l:jend_2u,ll))
1025 DO 230 j=jstart,jstop
1026 DO 230 i=istart,istop
1034 llmh = nint(lmh(i,j))
1035 IF(nl1x(i,j)<=llmh)
THEN
1046 zdum=zagl2(lp)+zint(i,j,nint(lmh(i,j))+1)
1047 fact=(zdum-zmid(i,j,ll))/(zmid(i,j,ll)-zmid(i,j,ll-1))
1049 IF(gridtype==
'A')
THEN
1055 ELSE IF(gridtype==
'E')
THEN
1056 uaglu=(uh(i+ihe(j),j,ll-1)+uh(i+ihw(j),j,ll-1)+ &
1057 & uh(i,j-1,ll-1)+uh(i,j+1,ll-1))/4.0
1058 uagll=(uh(i+ihe(j),j,ll)+uh(i+ihw(j),j,ll)+ &
1059 & uh(i,j-1,ll)+uh(i,j+1,ll))/4.0
1061 vaglu=(vh(i+ihe(j),j,ll-1)+vh(i+ihw(j),j,ll-1)+ &
1062 & vh(i,j-1,ll-1)+vh(i,j+1,ll-1))/4.0
1063 vagll=(vh(i+ihe(j),j,ll)+vh(i+ihw(j),j,ll)+ &
1064 & vh(i,j-1,ll)+vh(i,j+1,ll))/4.0
1065 ELSE IF(gridtype==
'B')
THEN
1070 uaglu=(uh(ie,j,ll-1)+uh(iw,j,ll-1)+ &
1071 & uh(ie,js,ll-1)+uh(iw,js,ll-1))/4.0
1072 uagll=(uh(ie,j,ll)+uh(iw,j,ll)+ &
1073 & uh(ie,js,ll)+uh(iw,js,ll))/4.0
1075 vaglu=(vh(ie,j,ll-1)+vh(iw,j,ll-1)+ &
1076 & vh(ie,js,ll-1)+vh(iw,js,ll-1))/4.0
1077 vagll=(vh(ie,j,ll)+vh(iw,j,ll)+ &
1078 & vh(ie,js,ll)+vh(iw,js,ll))/4.0
1080 uagl(i,j)=uagll+(uagll-uaglu)*fact
1081 vagl(i,j)=vagll+(vagll-vaglu)*fact
1082 IF(i==ii.AND.j==jj)print*, &
1083 &
'DEBUG LLWS: I,J,NL1X,UU,UL,VU,VL,ZSFC,ZMIDU,ZMIDL,U,V= ' &
1084 &, i,j,ll,uaglu,uagll,vaglu,vagll,zint(i,j,nint(lmh(i,j))+1)&
1085 &, zmid(i,j,ll-1),zmid(i,j,ll),uagl(i,j),vagl(i,j) &
1086 &, u10(i,j),v10(i,j)
1093 IF(gridtype==
'A')
THEN
1094 uagl(i,j)=uh(i,j,nint(lmv(i,j)))
1095 vagl(i,j)=vh(i,j,nint(lmv(i,j)))
1096 ELSE IF(gridtype==
'E')
THEN
1097 uagl(i,j)=(uh(i+ihe(j),j,nint(lmv(i+ihe(j),j))) &
1098 & +uh(i+ihw(j),j,nint(lmv(i+ihw(j),j)))+ &
1099 & uh(i,j-1,nint(lmv(i,j-1)))+uh(i,j+1,nint(lmv(i,j+1))))/4.0
1100 vagl(i,j)=(vh(i+ihe(j),j,nint(lmv(i+ihe(j),j))) &
1101 & +vh(i+ihw(j),j,nint(lmv(i+ihw(j),j)))+ &
1102 & vh(i,j-1,nint(lmv(i,j-1)))+vh(i,j+1,nint(lmv(i,j+1))))/4.0
1103 ELSE IF(gridtype==
'B')
THEN
1108 uagl(i,j)=(uh(ie,j,nint(lmv(ie,j))) &
1109 & +uh(iw,j,nint(lmv(iw,j)))+ &
1110 & uh(ie,js,nint(lmv(ie,js)))+uh(iw,js,nint(lmv(iw,js))))/4.0
1111 vagl(i,j)=(vh(ie,j,nint(lmv(ie,j))) &
1112 & +vh(iw,j,nint(lmv(iw,j)))+ &
1113 & vh(ie,js,nint(lmv(ie,js)))+vh(iw,js,nint(lmv(iw,js))))/4.0
1132 IF(abs(uagl(i,j)-spval)>small .AND. &
1133 abs(vagl(i,j)-spval)>small)
THEN
1134 IF(gridtype==
'B' .OR. gridtype==
'E')
THEN
1135 grid1(i,j)=sqrt((uagl(i,j)-u10h(i,j))**2+ &
1136 (vagl(i,j)-v10h(i,j))**2)*1.943*zagl2(lp)/ &
1139 grid1(i,j)=sqrt((uagl(i,j)-u10(i,j))**2+ &
1140 (vagl(i,j)-v10(i,j))**2)*1.943*zagl2(lp)/ &
1148 if(grib==
"grib2" )
then
1150 fld_info(cfld)%ifld=iavblfld(iget(259))
1151 fld_info(cfld)%lvl=lvlsxml(lp,iget(259))
1152 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1164 IF (iget(411)>0 .OR. iget(412)>0 .OR. iget(413)>0)
THEN
1173 iget1 = -1 ; iget2 = -1 ; iget3 = -1
1174 if (iget(411) > 0) iget1 = lvls(lp,iget(411))
1175 if (iget(412) > 0) iget2 = lvls(lp,iget(412))
1176 if (iget(413) > 0) iget3 = lvls(lp,iget(413))
1177 IF (iget1 > 0 .or. iget2 > 0 .or. iget3 > 0)
then
1180 jj = float(jsta+jend)/2.0
1182 DO j=jsta_2l,jend_2u
1194 llmh = nint(lmh(i,j))
1197 zdum = zmid(i,j,l)-zint(i,j,llmh+1)
1198 IF(zdum >= zagl3(lp))
THEN
1209 IF(nl1x(i,j)==(llmh+1) .AND. zagl3(lp)>0.)
THEN
1226 DO 240 j=jsta_2l,jend_2u
1235 llmh = nint(lmh(i,j))
1236 IF(nl1x(i,j)<=llmh)
THEN
1247 zdum=zagl3(lp)+zint(i,j,nint(lmh(i,j))+1)
1248 fact = (zdum-zmid(i,j,ll)) &
1249 / (zmid(i,j,ll)-zmid(i,j,ll-1))
1251 paglu = log(pmid(i,j,ll-1))
1252 pagll = log(pmid(i,j,ll))
1260 uaglu = uh(i,j,ll-1)
1263 vaglu = vh(i,j,ll-1)
1266 pagl(i,j) = exp(pagll+(pagll-paglu)*fact)
1267 tagl(i,j) = tagll+(tagll-taglu)*fact
1268 qagl(i,j) = qagll+(qagll-qaglu)*fact
1269 uagl(i,j) = uagll+(uagll-uaglu)*fact
1270 vagl(i,j) = vagll+(vagll-vaglu)*fact
1277 pagl(i,j) = pmid(i,j,nint(lmv(i,j)))
1278 tagl(i,j) = t(i,j,nint(lmv(i,j)))
1279 qagl(i,j) = q(i,j,nint(lmv(i,j)))
1280 uagl(i,j) = uh(i,j,nint(lmv(i,j)))
1281 vagl(i,j) = vh(i,j,nint(lmv(i,j)))
1296 IF((iget(411)>0) )
THEN
1299 IF(qagl(i,j)<spval.and.pagl(i,j)<spval.and.tagl(i,j)<spval.and.&
1300 uagl(i,j)<spval.and.vagl(i,j)<spval)
THEN
1301 qagl(i,j)=qagl(i,j)/1000.0
1302 pv=qagl(i,j)*pagl(i,j)/(eps*(1-qagl(i,j)) + qagl(i,j))
1303 rho=(1/tagl(i,j))*(((pagl(i,j)-pv)/rd) + pv/461.495)
1304 grid1(i,j)=0.5*rho*(sqrt(uagl(i,j)**2+vagl(i,j)**2))**3
1310 if(grib==
"grib2" )
then
1312 fld_info(cfld)%ifld=iavblfld(iget(411))
1313 fld_info(cfld)%lvl=lvlsxml(lp,iget(411))
1314 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1318 IF((iget(412)>0) )
THEN
1321 grid1(i,j)=uagl(i,j)
1324 if(grib==
"grib2" )
then
1326 fld_info(cfld)%ifld=iavblfld(iget(412))
1327 fld_info(cfld)%lvl=lvlsxml(lp,iget(412))
1328 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)
1332 IF((iget(413)>0) )
THEN
1335 grid1(i,j)=vagl(i,j)
1338 if(grib==
"grib2" )
then
1340 fld_info(cfld)%ifld=iavblfld(iget(413))
1341 fld_info(cfld)%lvl=lvlsxml(lp,iget(413))
1342 datapd(1:im,1:jend-jsta+1,cfld)=grid1(1:im,jsta:jend)