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