44 SUBROUTINE calhel2(LLOW,LUPP,DEPTH,UST,VST,HELI,CANGLE)
47 use vrbls3d, only: zmid, uh, vh, u, v, zint
48 use vrbls2d, only: fis, u10, v10
52 use ctlblk_mod
, only: jsta, jend, jsta_m, jend_m, jsta_2l, jend_2u, &
54 use gridspec_mod
, only: gridtype
58 real,
PARAMETER :: p150=15000.0,p300=30000.0,s15=15.0
59 real,
PARAMETER :: d3000=3000.0,pi6=0.5235987756,pi9=0.34906585
60 real,
PARAMETER :: d5500=5500.0,d6000=6000.0,d7000=7000.0
61 real,
PARAMETER :: d500=500.0
63 real,
PARAMETER :: d1000=1000.0
64 real,
PARAMETER :: d1500=1500.0
66 REAL,
PARAMETER :: pi = 3.1415927
71 integer,
dimension(IM,jsta_2l:jend_2u),
intent(in) :: llow, lupp
72 real,
intent(in) :: depth(2)
73 REAL,
dimension(IM,jsta_2l:jend_2u),
intent(out) :: ust,vst
74 REAL,
dimension(IM,jsta_2l:jend_2u,2),
intent(out) :: heli
75 REAL,
dimension(IM,jsta_2l:jend_2u),
intent(out) :: cangle
77 real,
dimension(im,jsta_2l:jend_2u) :: htsfc, ust6, vst6, ust5, vst5, &
78 ust1, vst1, ushr1, vshr1, &
79 ushr6, vshr6, u1, v1, u2, v2, &
80 hgt1, hgt2, umean, vmean
81 real,
dimension(im,jsta_2l:jend_2u) :: ushr05,vshr05
94 integer,
dimension(im,jsta_2l:jend_2u) :: count6, count5, count1, l1, l2
100 INTEGER ive(jm),ivw(jm)
101 integer i,j,iw,ie,js,jn,jvn,jvs,l,n,lv
102 integer istart,istop,jstart,jstop
103 real z2,dzabv,umean5,vmean5,umean1,vmean1,umean6,vmean6, &
104 denom,z1,z3,dz,dz1,dz2,du1,du2,dv1,dv2
149 IF(gridtype ==
'E')
THEN
160 ELSE IF(gridtype ==
'B')
THEN
194 IF(gridtype /=
'A') CALL exch(fis(1:im,jsta_2l:jend_2u))
196 IF(gridtype /=
'A') CALL exch(zmid(1:im,jsta_2l:jend_2u,l))
206 IF (gridtype==
'B')
THEN
207 htsfc(i,j) = (0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(ie,jn))
212 z2 = 0.25*(zmid(iw,j,l)+zmid(ie,j,l)+zmid(i,jn,l)+zmid(ie,jn,l))
214 htsfc(i,j) = (0.25/g)*(fis(iw,j)+fis(ie,j)+fis(i,jn)+fis(i,js))
219 z2 = 0.25*(zmid(iw,j,l)+zmid(ie,j,l)+zmid(i,jn,l)+zmid(i,js,l))
221 dzabv = z2-htsfc(i,j)
224 IF (dzabv <= d6000 .AND. l <= lv)
THEN
225 ust6(i,j) = ust6(i,j) + uh(i,j,l)
226 vst6(i,j) = vst6(i,j) + vh(i,j,l)
227 count6(i,j) = count6(i,j) + 1
230 IF (dzabv < d6000 .AND. dzabv >= d5500 .AND. l <= lv)
THEN
231 ust5(i,j) = ust5(i,j) + uh(i,j,l)
232 vst5(i,j) = vst5(i,j) + vh(i,j,l)
233 count5(i,j) = count5(i,j) + 1
236 IF (dzabv < d500 .AND. l <= lv)
THEN
237 ust1(i,j) = ust1(i,j) + uh(i,j,l)
238 vst1(i,j) = vst1(i,j) + vh(i,j,l)
239 count1(i,j) = count1(i,j) + 1
242 IF (dzabv >= d1000 .AND. dzabv <= d1500 .AND. l <= lv)
THEN
249 IF (dzabv >= d500 .AND. dzabv < d1000 .AND. &
250 l <= lv .AND. l1(i,j) <= l2(i,j))
THEN
266 IF (count5(i,j) == 0)
THEN
272 IF (gridtype==
'B')
THEN
273 z2 = 0.25*(zmid(iw,j,l)+zmid(ie,j,l)+zmid(i,jn,l)+zmid(ie,jn,l))
275 z2 = 0.25*(zmid(iw,j,l)+zmid(ie,j,l)+zmid(i,jn,l)+zmid(i,js,l))
279 IF (dzabv < d7000 .AND. dzabv >= d6000)
THEN
280 ust5(i,j) = ust5(i,j) + uh(i,j,l)
281 vst5(i,j) = vst5(i,j) + vh(i,j,l)
296 IF (count6(i,j) > 0 .AND. count1(i,j) > 0 .AND. count5(i,j) > 0)
THEN
297 umean5 = ust5(i,j) / count5(i,j)
298 vmean5 = vst5(i,j) / count5(i,j)
299 umean1 = ust1(i,j) / count1(i,j)
300 vmean1 = vst1(i,j) / count1(i,j)
301 umean6 = ust6(i,j) / count6(i,j)
302 vmean6 = vst6(i,j) / count6(i,j)
315 ushr6(i,j) = umean5 - umean1
316 vshr6(i,j) = vmean5 - vmean1
318 denom = ushr6(i,j)*ushr6(i,j)+vshr6(i,j)*vshr6(i,j)
319 IF (denom /= 0.0)
THEN
320 ust(i,j) = umean6 + (7.5*vshr6(i,j)/sqrt(denom))
321 vst(i,j) = vmean6 - (7.5*ushr6(i,j)/sqrt(denom))
333 IF(l1(i,j) > 0 .AND. l2(i,j) > 0)
THEN
334 umean(i,j) = u1(i,j) + (d1000 - hgt1(i,j))*(u2(i,j) - &
335 u1(i,j))/(hgt2(i,j) - hgt1(i,j))
336 vmean(i,j) = v1(i,j) + (d1000 - hgt1(i,j))*(v2(i,j) - &
337 v1(i,j))/(hgt2(i,j) - hgt1(i,j))
338 ELSE IF(l1(i,j) > 0 .AND. l2(i,j) == 0)
THEN
341 ELSE IF(l1(i,j) == 0 .AND. l2(i,j) > 0)
THEN
349 IF(l1(i,j) > 0 .OR. l2(i,j) > 0)
THEN
350 ushr05(i,j) = umean1 - u10(i,j)
351 vshr05(i,j) = vmean1 - v10(i,j)
352 ushr1(i,j) = umean(i,j) - u10(i,j)
353 vshr1(i,j) = vmean(i,j) - v10(i,j)
380 if(gridtype /=
'A')
then
381 call exch(zint(1,jsta_2l,l))
382 call exch(zint(1,jsta_2l,l+1))
390 IF (gridtype==
'B')
THEN
391 z2=0.25*(zmid(iw,j,l)+zmid(ie,j,l)+ &
392 zmid(i,jn,l)+zmid(ie,jn,l))
394 z2=0.25*(zmid(iw,j,l)+zmid(ie,j,l)+ &
395 zmid(i,jn,l)+zmid(i,js,l))
399 IF(dzabv < depth(n) .AND. l <= nint(lmv(i,j)))
THEN
400 IF (gridtype==
'B')
THEN
401 z1 = 0.25*(zmid(iw,j,l+1)+zmid(ie,j,l+1)+ &
402 zmid(i,jn,l+1)+zmid(ie,jn,l+1))
403 z3 = 0.25*(zmid(iw,j,l-1)+zmid(ie,j,l-1)+ &
404 zmid(i,jn,l-1)+zmid(ie,jn,l-1))
405 dz = 0.25*((zint(iw,j,l)+zint(ie,j,l)+ &
406 zint(i,jn,l)+zint(ie,jn,l))- &
407 (zint(iw,j,l+1)+zint(ie,j,l+1)+ &
408 zint(i,jn,l+1)+zint(ie,jn,l+1)))
410 z1 = 0.25*(zmid(iw,j,l+1)+zmid(ie,j,l+1)+ &
411 zmid(i,jn,l+1)+zmid(i,js,l+1))
412 z3 = 0.25*(zmid(iw,j,l-1)+zmid(ie,j,l-1)+ &
413 zmid(i,jn,l-1)+zmid(i,js,l-1))
414 dz = 0.25*((zint(iw,j,l)+zint(ie,j,l)+ &
415 zint(i,js,l)+zint(i,jn,l))- &
416 (zint(iw,j,l+1)+zint(ie,j,l+1)+ &
417 zint(i,js,l+1)+zint(i,jn,l+1)))
421 du1 = uh(i,j,l+1)-uh(i,j,l)
422 du2 = uh(i,j,l)-uh(i,j,l-1)
423 dv1 = vh(i,j,l+1)-vh(i,j,l)
424 dv2 = vh(i,j,l)-vh(i,j,l-1)
425 IF( l >= lupp(i,j) .AND. l <= llow(i,j) )
THEN
426 IF( vh(i,j,l) <spval.and.uh(i,j,l) <spval.and. &
427 vh(i,j,l+1)<spval.and.uh(i,j,l+1)<spval.and. &
428 vh(i,j,l-1)<spval.and.uh(i,j,l-1)<spval.and. &
429 vst(i,j) <spval.and.ust(i,j) <spval) &
430 heli(i,j,n) = ((vh(i,j,l)-vst(i,j))* &
431 (dz2*(du1/dz1)+dz1*(du2/dz2)) &
432 - (uh(i,j,l)-ust(i,j))* &
433 (dz2*(dv1/dz1)+dz1*(dv2/dz2))) &
434 *dz/(dz1+dz2)+heli(i,j,n)
436 IF(lupp(i,j) == llow(i,j)) heli(i,j,n) = 0.
453 IF(vshr05(i,j)<spval.and.ushr05(i,j)<spval.and. &
454 vst(i,j)<spval.and.ust(i,j)<spval)
THEN
455 cangle(i,j)=atan2(vshr05(i,j),ushr05(i,j))-atan2(vst(i,j),ust(i,j))
456 cangle(i,j)=(cangle(i,j)/pi)*180.
457 IF(cangle(i,j) > 180.) cangle(i,j)=360.-cangle(i,j)
458 IF(cangle(i,j) < 0. .AND. cangle(i,j) >= -180.) cangle(i,j)=-cangle(i,j)
459 IF(cangle(i,j) < -180.) cangle(i,j)=360.+cangle(i,j)