UPP  001
 All Data Structures Files Functions Pages
CALUPDHEL.f
Go to the documentation of this file.
1 
16  SUBROUTINE calupdhel(UPDHEL)
17 
18 !
19 !
20 ! use vrbls2d, only:
21  use vrbls3d, only: wh, uh, vh, zint, zmid
22  use masks, only: lmh, dx, dy
23  use params_mod, only: d00
24  use ctlblk_mod, only: lm, jsta_2l, jend_2u, jsta_m, jend_m, &
25  global, spval, im, jm
26  use gridspec_mod, only: gridtype
27  use upp_math, only: dvdxdudy, ddvdx, ddudy
28 
29  implicit none
30 
31 ! DECLARE VARIABLES.
32 !
33 ! LOGICAL RUN,FIRST,RESTRT,SIGMA,OLDRD,STRD
34  REAL, PARAMETER:: hlower=2000., hupper=5000.
35  REAL zmidloc
36  real :: r2dx, r2dy, dz, dcdx, dudy, dvdx
37  REAL :: htsfc(im,jsta_2l:jend_2u),updhel(im,jsta_2l:jend_2u)
38  integer :: l, j, i
39  INTEGER, dimension(jm) :: ihe,ihw
40 ! INTEGER DXVAL,DYVAL,CENLAT,CENLON,TRUELAT1,TRUELAT2
41 ! INTEGER LATSTART,LONSTART,LATLAST,LONLAST
42 !
43 !***************************************************************************
44 ! START CALUPDHEL HERE.
45 !
46 ! write(6,*) 'min/max WH(:,:,20):: ', minval(WH(:,:,20)), &
47 ! maxval(WH(:,:,20))
48 
49  DO l=1,lm
50  CALL exch(uh(1,jsta_2l,l))
51  END DO
52  IF (gridtype == 'B')THEN
53  DO l=1,lm
54  CALL exch(vh(1,jsta_2l,l))
55  END DO
56  END IF
57 !$omp parallel do private(i,j)
58  DO j=jsta_2l,jend_2u
59  DO i=1,im
60  updhel(i,j) = d00
61  ENDDO
62  ENDDO
63 
64  DO j=jsta_2l,jend_2u
65  ihw(j) = -mod(j,2)
66  ihe(j) = ihw(j)+1
67  ENDDO
68 
69 ! Integrate (w * relative vorticity * dz) over the 2 km to
70 ! 5 km AGL depth.
71 
72 ! initial try without horizontal averaging
73 
74 !$omp parallel do private(i,j)
75  DO j=jsta_m,jend_m
76  DO i=1,im
77  htsfc(i,j) = zint(i,j,nint(lmh(i,j))+1)
78  ENDDO
79  ENDDO
80 
81  DO j=jsta_m,jend_m
82  DO i=2,im-1
83 
84  IF (htsfc(i,j) < spval) THEN
85 
86  r2dx = 1./(2.*dx(i,j))
87  r2dy = 1./(2.*dy(i,j))
88 
89  l_loop: DO l=1,lm
90  zmidloc = zmid(i,j,l)
91  IF (global) then ! will put in global algorithm later
92  updhel(i,j) = spval
93  EXIT l_loop
94  END IF
95 
96  IF ( (zmidloc - htsfc(i,j)) >= hlower .AND. &
97  (zmidloc - htsfc(i,j)) <= hupper ) THEN
98  dz=(zint(i,j,l)-zint(i,j,l+1))
99 
100  IF (wh(i,j,l) < 0) THEN
101 
102 ! ANY DOWNWARD MOTION IN 2-5 km LAYER KILLS COMPUTATION AND
103 ! SETS RESULTANT UPDRAFT HELICTY TO ZERO
104 
105  updhel(i,j) = 0.
106  EXIT l_loop
107 
108  ENDIF
109 
110  CALL dvdxdudy(uh(:,:,l),vh(:,:,l))
111  dvdx = ddvdx(i,j)
112  dudy = ddudy(i,j)
113 
114  updhel(i,j)=updhel(i,j)+(dvdx-dudy)*wh(i,j,l)*dz
115 
116  ENDIF
117  ENDDO l_loop
118 
119  ELSE
120  updhel(i,j) = spval
121  ENDIF
122 
123  ENDDO
124  ENDDO
125 
126 !
127 ! print*,'jsta_m, jend_m in calupdhel= ',jsta_m,jend_m
128 !
129 ! END OF ROUTINE.
130 !
131  RETURN
132  END
Definition: MASKS_mod.f:1
dvdxdudy() computes dudy, dvdx, uwnd
Definition: UPP_MATH.f:17