21 SUBROUTINE mdl2thandpv(kth,kpv,th,pv)
25 use vrbls3d, only: pmid, t, uh, q, vh, zmid, omga, pint
27 use masks, only: gdlat, gdlon, dx, dy
29 use params_mod, only: dtr, small, erad, d608, rhmin
30 use ctlblk_mod
, only: spval, lm, jsta_2l, jend_2u, jsta_2l, grib, cfld, datapd, fld_info,&
31 im, jm, jsta, jend, jsta_m, jend_m, modelname, global,gdsdegr,me
32 use rqstfld_mod
, only: iget, lvls, id, iavblfld, lvlsxml
33 use gridspec_mod
, only: gridtype,dyval
35 use upp_math, only: dvdxdudy, ddvdx, ddudy, uuavg, h2u
41 integer,
intent(in) :: kth, kpv
42 real,
intent(in) :: th(kth), pv(kpv)
43 real,
dimension(im,jsta:jend) :: grid1, grid2
44 real,
dimension(kpv) :: pvpt, pvpb
47 LOGICAL lth(kth), lpv(kpv)
49 REAL,
allocatable:: dum1d1(:), dum1d2(:), dum1d3(:),dum1d4(:) &
50 , dum1d5(:), dum1d6(:), dum1d7(:),dum1d8(:) &
51 , dum1d9(:), dum1d10(:),dum1d11(:) &
52 , dum1d12(:),dum1d13(:),dum1d14(:)
54 real,
dimension(IM,JSTA:JEND,KTH) :: uth, vth, hmth, tth, pvth, &
56 real,
dimension(IM,JSTA:JEND,KPV) :: upv, vpv, hpv, tpv, ppv, spv
58 real,
allocatable :: wrk1(:,:), wrk2(:,:), wrk3(:,:), wrk4(:,:), cosl(:,:)
59 real,
allocatable :: tuv(:,:,:),pmiduv(:,:,:)
61 integer,
dimension(im) :: iw, ie
62 integer i,j,l,k,lp,imb2,ip1,im1,ii,jj,jmt2,ihw,ihe
63 real dvdx,dudy,uavg,tphi, es, qstl, eradi, tem
64 real,
allocatable :: dvdxl(:,:,:), dudyl(:,:,:), uavgl(:,:,:)
80 IF((iget(332) > 0).OR.(iget(333) > 0).OR. &
81 (iget(334) > 0).OR.(iget(335) > 0).OR. &
82 (iget(336) > 0).OR.(iget(337) > 0).OR. &
83 (iget(338) > 0).OR.(iget(339) > 0).OR. &
84 (iget(340) > 0).OR.(iget(341) > 0).OR. &
85 (iget(351) > 0).OR.(iget(352) > 0).OR. &
86 (iget(353) > 0).OR.(iget(378) > 0) )
THEN
107 sigmath(i,j,k) = spval
126 ALLOCATE(dum1d1(lm), dum1d2(lm), dum1d3(lm),dum1d4(lm))
127 ALLOCATE(dum1d5(lm), dum1d6(lm))
128 ALLOCATE(dum1d7(lm), dum1d8(lm), dum1d9(lm),dum1d10(lm))
129 ALLOCATE(dum1d11(lm),dum1d12(lm),dum1d13(lm))
130 ALLOCATE(dum1d14(lm))
133 CALL exch(pmid(1:im,jsta_2l:jend_2u,l))
134 CALL exch(t(1:im,jsta_2l:jend_2u,l))
135 CALL exch(uh(1:im,jsta_2l:jend_2u,l))
137 CALL exch(gdlat(1,jsta_2l))
144 allocate (wrk1(im,jsta:jend), wrk2(im,jsta:jend), &
145 & wrk3(im,jsta:jend), cosl(im,jsta_2l:jend_2u))
146 allocate (wrk4(im,jsta:jend))
151 IF(gridtype ==
'A')
THEN
165 cosl(i,j) = cos(gdlat(i,j)*dtr)
166 IF(cosl(i,j) >= small)
then
167 wrk1(i,j) = eradi / cosl(i,j)
171 if(i == im .or. i == 1)
then
172 wrk2(i,j) = 1.0 / ((360.+gdlon(ip1,j)-gdlon(im1,j))*dtr)
174 wrk2(i,j) = 1.0 / ((gdlon(ip1,j)-gdlon(im1,j))*dtr)
176 wrk4(i,j) = wrk1(i,j) * wrk2(i,j)
187 if (ii > im) ii = ii - im
188 wrk3(i,j) = 1.0 / ((180.-gdlat(i,j+1)-gdlat(ii,j))*dtr)
190 elseif (j == jm)
then
193 if (ii > im) ii = ii - im
194 wrk3(i,j) = 1.0 / ((180.+gdlat(i,j-1)+gdlat(ii,j))*dtr)
197 !print *,
' j=',j,
' GDLATJm1=',gdlat(:,j-1)
198 !print *,
' j=',j,
' GDLATJp1=',gdlat(:,j+1)
200 tem = gdlat(i,j-1) - gdlat(i,j+1)
201 if (abs(tem) > small)
then
202 wrk3(i,j) = 1.0 / (tem*dtr)
215 wrk2(i,j) = 0.5 / dx(i,j)
216 wrk3(i,j) = 0.5 / dy(i,j)
222 IF(gridtype ==
'E')
THEN
223 allocate(tuv(1:im,jsta_2l:jend_2u,lm))
224 allocate(pmiduv(1:im,jsta_2l:jend_2u,lm))
226 call h2u(t(1:im,jsta_2l:jend_2u,l),tuv(1:im,jsta_2l:jend_2u,l))
227 call h2u(pmid(1:im,jsta_2l:jend_2u,l),pmiduv(1:im,jsta_2l:jend_2u,l))
232 IF(gridtype ==
'A')
THEN
233 IF(modelname ==
'GFS' .or. global)
THEN
240 if (ii > im) ii = ii - im
243 IF(cosl(i,j) >= small)
THEN
244 tem = wrk3(i,j) * eradi
247 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
248 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
249 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
250 dum1d1(l) = (pmid(ip1,j,l)- pmid(im1,j,l)) * wrk4(i,j)
251 dum1d3(l) = (t(ip1,j,l) - t(im1,j,l)) * wrk4(i,j)
252 dum1d2(l) = (pmid(ii,j,l) - pmid(i,j+1,l)) * tem
253 dum1d4(l) = (t(ii,j,l) - t(i,j+1,l)) * tem
254 dum1d6(l) = ((vh(ip1,j,l)-vh(im1,j,l))*wrk2(i,j) &
255 & + (uh(ii,j,l)*cosl(ii,j) &
256 & + uh(i,j+1,l)*cosl(i,j+1))*wrk3(i,j))*wrk1(i,j) &
261 tem = wrk3(i,jj) * eradi
264 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
265 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
266 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
267 dum1d1(l) = (pmid(ip1,jj,l)- pmid(im1,jj,l)) * wrk4(i,jj)
268 dum1d3(l) = (t(ip1,jj,l) - t(im1,jj,l)) * wrk4(i,jj)
269 dum1d2(l) = (pmid(i,j,l)-pmid(i,jj+1,l)) * tem
270 dum1d4(l) = (t(i,j,l) - t(i,jj+1,l)) * tem
271 dum1d6(l) = ((vh(ip1,jj,l)-vh(im1,jj,l))*wrk2(i,jj) &
272 & + (uh(i,j,l)*cosl(i,j) &
273 + uh(i,jj+1,l)*cosl(i,jj+1))*wrk3(i,jj))*wrk1(i,jj) &
277 ELSE IF(j == jm)
THEN
278 IF(cosl(i,j) >= small)
THEN
279 tem = wrk3(i,j) * eradi
282 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
283 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
284 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
285 dum1d1(l) = (pmid(ip1,j,l)- pmid(im1,j,l)) * wrk4(i,j)
286 dum1d3(l) = (t(ip1,j,l) - t(im1,j,l)) * wrk4(i,j)
287 dum1d2(l) = (pmid(i,j-1,l)-pmid(ii,j,l)) * tem
288 dum1d4(l) = (t(i,j-1,l)-t(ii,j,l)) * tem
289 dum1d6(l) = ((vh(ip1,j,l)-vh(im1,j,l))* wrk2(i,j) &
290 & + (uh(i,j-1,l)*cosl(i,j-1) &
291 & + uh(ii,j,l)*cosl(ii,j))*wrk3(i,j))*wrk1(i,j) &
296 tem = wrk3(i,jj) * eradi
299 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
300 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
301 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
302 dum1d1(l) = (pmid(ip1,jj,l)- pmid(im1,jj,l)) * wrk4(i,jj)
303 dum1d3(l) = (t(ip1,jj,l) - t(im1,jj,l)) * wrk4(i,jj)
304 dum1d2(l) = (pmid(i,jj-1,l)-pmid(i,j,l)) * tem
305 dum1d4(l) = (t(i,jj-1,l)-t(i,j,l)) * tem
306 dum1d6(l) = ((vh(ip1,jj,l)-vh(im1,jj,l))*wrk2(i,jj) &
307 & + (uh(i,jj-1,l)*cosl(i,jj-1) &
308 & + uh(i,j,l)*cosl(i,j))*wrk3(i,jj))*wrk1(i,jj) &
313 tem = wrk3(i,j) * eradi
316 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
317 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
318 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
319 dum1d1(l) = (pmid(ip1,j,l)- pmid(im1,j,l)) * wrk4(i,j)
320 dum1d3(l) = (t(ip1,j,l) - t(im1,j,l)) * wrk4(i,j)
323 dum1d2(l) = (pmid(i,j-1,l)-pmid(i,j+1,l)) * tem
324 dum1d4(l) = (t(i,j-1,l)-t(i,j+1,l)) * tem
325 dum1d6(l) = ((vh(ip1,j,l)-vh(im1,j,l))* wrk2(i,j) &
326 & - (uh(i,j-1,l)*cosl(i,j-1) &
327 & - uh(i,j+1,l)*cosl(i,j+1))*wrk3(i,j))*wrk1(i,j) &
333 IF(i==im/2 .AND. j==jm/2)
then
334 print*,
'SAMPLE PVETC INPUT ', &
335 'p,dpdx,dpdy,tv,dtdx,dtdy,h,u,v,vort= '
337 print*,pmid(i,j,l),dum1d1(l),dum1d2(l),dum1d5(l) &
338 ,dum1d3(l),dum1d4(l),zmid(i,j,l),uh(i,j,l),vh(i,j,l) &
343 CALL pvetc(lm,pmid(i,j,1:lm),dum1d1,dum1d2 &
344 ,dum1d5,dum1d3,dum1d4,zmid(i,j,1:lm),uh(i,j,1:lm) &
345 ,vh(i,j,1:lm),dum1d6 &
346 ,dum1d7,dum1d8,dum1d9,dum1d10,dum1d11,dum1d12,dum1d13)
348 IF(i==im/2 .AND. j==jm/2)
then
349 print*,
'SAMPLE PVETC OUTPUT ' &
350 ,
'hm,s,bvf2,pvn,theta,sigma,pvu= '
352 print*,dum1d7(l),dum1d8(l),dum1d9(l),dum1d10(l),dum1d11(l) &
353 ,dum1d12(l),dum1d13(l)
357 IF((iget(332) > 0).OR.(iget(333) > 0).OR. &
358 (iget(334) > 0).OR.(iget(335) > 0).OR. &
359 (iget(351) > 0).OR.(iget(352) > 0).OR. &
360 (iget(353) > 0).OR.(iget(378) > 0))
THEN
362 CALL
p2th(lm,dum1d11,uh(i,j,1:lm),vh(i,j,1:lm) &
363 ,dum1d7,t(i,j,1:lm),dum1d13,dum1d12,dum1d14 &
364 ,omga(i,j,1:lm),kth,th &
365 ,lth,uth(i,j,1:kth),vth(i,j,1:kth) &
368 ,tth(i,j,1:kth),pvth(i,j,1:kth) &
369 ,sigmath(i,j,1:kth),rhth(i,j,1:kth) &
373 IF((iget(336) > 0).OR.(iget(337) > 0).OR. &
374 (iget(338) > 0).OR.(iget(339) > 0).OR. &
375 (iget(340) > 0).OR.(iget(341) > 0))
THEN
376 CALL
p2pv(lm,dum1d13,zmid(i,j,1:lm),t(i,j,1:lm),pmid(i,j,1:lm) &
377 ,uh(i,j,1:lm),vh(i,j,1:lm),kpv,pv,pvpt,pvpb*pint(i,j,lm+1)&
378 ,lpv,upv(i,j,1:kpv),vpv(i,j,1:kpv),hpv(i,j,1:kpv) &
380 ,tpv(i,j,1:kpv),ppv(i,j,1:kpv),spv(i,j,1:kpv) )
391 tphi=(j-jmt2)*(dyval/gdsdegr)*dtr
395 tem = wrk3(i,j) * eradi
398 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
399 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
400 dum1d14(l) = q(i,j,l) * (pmid(i,j,l)+con_epsm1*es)/(con_eps*es)
401 dum1d1(l) = (pmid(ip1,j,l)- pmid(im1,j,l)) * wrk4(i,j)
402 dum1d3(l) = (t(ip1,j,l) - t(im1,j,l)) * wrk4(i,j)
403 dum1d2(l) = (pmid(i,j+1,l)-pmid(i,j-1,l)) * tem
404 dum1d4(l) = (t(i,j+1,l)-t(i,j-1,l)) * tem
405 dum1d6(l) = ((vh(ip1,j,l)-vh(im1,j,l))* wrk2(i,j) &
406 & - (uh(i,j+1,l)*cosl(i,j+1) &
407 & - uh(i,j-1,l)*cosl(i,j-1))*wrk3(i,j))*wrk1(i,j) &
411 IF(i==im/2 .AND. j==jm/2)
then
412 print*,
'SAMPLE PVETC INPUT for regional ', &
413 'p,dpdx,dpdy,tv,dtdx,dtdy,h,u,v,vort ', &
416 print*,pmid(i,j,l),dum1d1(l),dum1d2(l),dum1d5(l) &
417 ,dum1d3(l),dum1d4(l),zmid(i,j,l),uh(i,j,l),vh(i,j,l) &
418 ,dum1d6(l),jsta_m,jend_m,l
422 CALL pvetc(lm,pmid(i,j,1:lm),dum1d1,dum1d2 &
423 ,dum1d5,dum1d3,dum1d4,zmid(i,j,1:lm),uh(i,j,1:lm) &
424 ,vh(i,j,1:lm),dum1d6 &
425 ,dum1d7,dum1d8,dum1d9,dum1d10,dum1d11,dum1d12,dum1d13)
427 IF(i==im/2 .AND. j==jm/2)
then
428 print*,
'SAMPLE PVETC OUTPUT ' &
429 ,
'hm,s,bvf2,pvn,theta,sigma,pvu,pvort= '
431 print*,dum1d7(l),dum1d8(l),dum1d9(l),dum1d10(l),dum1d11(l) &
432 ,dum1d12(l),dum1d13(l),dum1d6(l)
436 IF((iget(332) > 0).OR.(iget(333) > 0).OR. &
437 (iget(334) > 0).OR.(iget(335) > 0).OR. &
438 (iget(351) > 0).OR.(iget(352) > 0).OR. &
439 (iget(353) > 0).OR.(iget(378) > 0))
THEN
441 CALL
p2th(lm,dum1d11,uh(i,j,1:lm),vh(i,j,1:lm) &
442 ,dum1d7,t(i,j,1:lm),dum1d13,dum1d12,dum1d14 &
443 ,omga(i,j,1:lm),kth,th &
444 ,lth,uth(i,j,1:kth),vth(i,j,1:kth) &
447 ,tth(i,j,1:kth),pvth(i,j,1:kth) &
448 ,sigmath(i,j,1:kth),rhth(i,j,1:kth) &
452 IF((iget(336) > 0).OR.(iget(337) > 0).OR. &
453 (iget(338) > 0).OR.(iget(339) > 0).OR. &
454 (iget(340) > 0).OR.(iget(341) > 0))
THEN
455 CALL
p2pv(lm,dum1d13,zmid(i,j,1:lm),t(i,j,1:lm),pmid(i,j,1:lm) &
456 ,uh(i,j,1:lm),vh(i,j,1:lm),kpv,pv,pvpt,pvpb*pint(i,j,lm+1)&
457 ,lpv,upv(i,j,1:kpv),vpv(i,j,1:kpv),hpv(i,j,1:kpv) &
459 ,tpv(i,j,1:kpv),ppv(i,j,1:kpv),spv(i,j,1:kpv) )
467 ELSE IF (gridtype ==
'B')
THEN
468 allocate(dvdxl(1:im,jsta_m:jend_m,lm))
469 allocate(dudyl(1:im,jsta_m:jend_m,lm))
470 allocate(uavgl(1:im,jsta_m:jend_m,lm))
472 CALL exch(vh(1:im,jsta_2l:jend_2u,l))
473 CALL dvdxdudy(uh(:,:,l),vh(:,:,l))
476 dvdxl(i,j,l) = ddvdx(i,j)
477 dudyl(i,j,l) = ddudy(i,j)
478 uavgl(i,j,l) = uuavg(i,j)
484 tphi=(j-jmt2)*(dyval/gdsdegr)*dtr
489 dum1d5(l) = t(i,j,l)*(1.+d608*q(i,j,l))
490 es = min(
fpvsnew(t(i,j,l)),pmid(i,j,l))
491 qstl = con_eps*es/(pmid(i,j,l)+con_epsm1*es)
492 dum1d14(l) = q(i,j,l)/qstl
493 dum1d1(l) = (pmid(ip1,j,l)- pmid(im1,j,l)) * wrk2(i,j)
494 dum1d3(l) = (t(ip1,j,l) - t(im1,j,l)) * wrk2(i,j)
495 dum1d2(l) = (pmid(i,j+1,l)-pmid(i,j-1,l)) * wrk3(i,j)
496 dum1d4(l) = (t(i,j+1,l)-t(i,j-1,l)) * wrk3(i,j)
501 dum1d6(l) = dvdx - dudy + f(i,j) + uavg*tan(tphi)/erad
515 CALL pvetc(lm,pmid(i,j,1:lm),dum1d1,dum1d2 &
516 ,dum1d5,dum1d3,dum1d4,zmid(i,j,1:lm),uh(i,j,1:lm) &
517 ,vh(i,j,1:lm),dum1d6 &
518 ,dum1d7,dum1d8,dum1d9,dum1d10,dum1d11,dum1d12,dum1d13)
528 IF((iget(332)>0).OR.(iget(333)>0).OR. &
529 (iget(334)>0).OR.(iget(335)>0).OR. &
530 (iget(351)>0).OR.(iget(352)>0).OR. &
531 (iget(353)>0).OR.(iget(378)>0))
THEN
533 CALL
p2th(lm,dum1d11,uh(i,j,1:lm),vh(i,j,1:lm) &
534 ,dum1d7,t(i,j,1:lm),dum1d13,dum1d12,dum1d14 &
535 ,omga(i,j,1:lm),kth,th &
536 ,lth,uth(i,j,1:kth),vth(i,j,1:kth) &
539 ,tth(i,j,1:kth),pvth(i,j,1:kth) &
540 ,sigmath(i,j,1:kth),rhth(i,j,1:kth) &
544 IF((iget(336)>0).OR.(iget(337)>0).OR. &
545 (iget(338)>0).OR.(iget(339)>0).OR. &
546 (iget(340)>0).OR.(iget(341)>0))
THEN
547 CALL
p2pv(lm,dum1d13,zmid(i,j,1:lm),t(i,j,1:lm),pmid(i,j,1:lm) &
548 ,uh(i,j,1:lm),vh(i,j,1:lm),kpv,pv,pvpt,pvpb*pint(i,j,lm+1) &
549 ,lpv,upv(i,j,1:kpv),vpv(i,j,1:kpv),hpv(i,j,1:kpv) &
551 ,tpv(i,j,1:kpv),ppv(i,j,1:kpv),spv(i,j,1:kpv) )
555 deallocate(dvdxl,dudyl,uavgl)
556 ELSE IF (gridtype ==
'E')
THEN
559 tphi = (j-jmt2)*(dyval/gdsdegr)*dtr
566 dum1d5(l)=t(i,j,l)*(1.+d608*q(i,j,l))
568 es=min(es,pmid(i,j,l))
569 qstl=con_eps*es/(pmid(i,j,l)+con_epsm1*es)
570 dum1d14(l)=q(i,j,l)/qstl
571 dum1d1(l) = (pmiduv(i+ihe,j,l)- pmiduv(i+ihw,j,l))*wrk2(i,j)
572 dum1d3(l) = (tuv(i+ihe,j,l) - tuv(i+ihw,j,l)) * wrk2(i,j)
573 dum1d2(l) = (pmiduv(i,j+1,l)- pmiduv(i,j-1,l))*wrk3(i,j)
574 dum1d4(l)= (tuv(i,j+1,l)- tuv(i,j-1,l))*wrk3(i,j)
575 dvdx=(vh(i+ihe,j,l)-vh(i+ihw,j,l))* wrk2(i,j)
576 dudy=(uh(i,j+1,l)-uh(i,j-1,l))* wrk3(i,j)
577 uavg=0.25*(uh(i+ihe,j,l)+uh(i+ihw,j,l)+uh(i,j-1,l)+uh(i,j+1,l))
579 dum1d6(l)=dvdx-dudy+f(i,j)+uavg*tan(tphi)/erad
582 IF(i==im/2 .AND. j==jm/2)
then
583 print*,
'SAMPLE PVETC INPUT ' &
584 ,
'p,dpdx,dpdy,tv,dtdx,dtdy,h,u,v,vort= '
586 print*,pmid(i,j,l),dum1d1(l),dum1d2(l),dum1d5(l) &
587 ,dum1d3(l),dum1d4(l),zmid(i,j,l),uh(i,j,l),vh(i,j,l) &
592 CALL pvetc(lm,pmid(i,j,1:lm),dum1d1,dum1d2 &
593 ,dum1d5,dum1d3,dum1d4,zmid(i,j,1:lm),uh(i,j,1:lm) &
594 ,vh(i,j,1:lm),dum1d6 &
595 ,dum1d7,dum1d8,dum1d9,dum1d10,dum1d11,dum1d12,dum1d13)
597 IF(i==im/2 .AND. j==jm/2)
then
598 print*,
'SAMPLE PVETC OUTPUT ' &
599 ,
'hm,s,bvf2,pvn,theta,sigma,pvu= '
601 print*,dum1d7(l),dum1d8(l),dum1d9(l),dum1d10(l),dum1d11(l) &
602 ,dum1d12(l),dum1d13(l)
605 IF((iget(332) > 0).OR.(iget(333) > 0).OR. &
606 (iget(334) > 0).OR.(iget(335) > 0).OR. &
607 (iget(351) > 0).OR.(iget(352) > 0).OR. &
608 (iget(353) > 0).OR.(iget(378) > 0))
THEN
610 CALL
p2th(lm,dum1d11,uh(i,j,1:lm),vh(i,j,1:lm) &
611 ,dum1d7,t(i,j,1:lm),dum1d13,dum1d12,dum1d14 &
612 ,omga(i,j,1:lm),kth,th &
613 ,lth,uth(i,j,1:kth),vth(i,j,1:kth) &
616 ,tth(i,j,1:kth),pvth(i,j,1:kth) &
617 ,sigmath(i,j,1:kth),rhth(i,j,1:kth) &
621 IF((iget(336) > 0) .OR. (iget(337) > 0).OR. &
622 (iget(338) > 0) .OR. (iget(339) > 0).OR. &
623 (iget(340) > 0) .OR. (iget(341) > 0))
THEN
624 CALL
p2pv(lm,dum1d13,zmid(i,j,1:lm),t(i,j,1:lm),pmid(i,j,1:lm) &
625 ,uh(i,j,1:lm),vh(i,j,1:lm),kpv,pv,pvpt,pvpb*pint(i,j,lm+1) &
626 ,lpv,upv(i,j,1:kpv),vpv(i,j,1:kpv),hpv(i,j,1:kpv) &
628 ,tpv(i,j,1:kpv),ppv(i,j,1:kpv),spv(i,j,1:kpv) )
651 IF(iget(332) > 0 .OR. iget(333) > 0)
THEN
652 IF(lvls(lp,iget(332)) > 0 .OR. lvls(lp,iget(333)) > 0)
THEN
656 grid1(i,j) = uth(i,j,lp)
657 grid2(i,j) = vth(i,j,lp)
660 if(grib==
'grib2')
then
662 fld_info(cfld)%ifld = iavblfld(iget(332))
663 fld_info(cfld)%lvl = lvlsxml(lp,iget(332))
668 datapd(i,j,cfld) = grid1(i,jj)
672 fld_info(cfld)%ifld = iavblfld(iget(333))
673 fld_info(cfld)%lvl = lvlsxml(lp,iget(333))
678 datapd(i,j,cfld) = grid2(i,jj)
687 IF(iget(334) > 0)
THEN
688 IF(lvls(lp,iget(334)) > 0)
THEN
714 grid1(i,j) = tth(i,j,lp)
717 if(grib==
'grib2')
then
719 fld_info(cfld)%ifld=iavblfld(iget(334))
720 fld_info(cfld)%lvl=lvlsxml(lp,iget(334))
725 datapd(i,j,cfld) = grid1(i,jj)
734 IF(iget(335) > 0)
THEN
735 IF(lvls(lp,iget(335)) > 0)
THEN
736 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
737 ,spval,pvth(1:im,jsta:jend,lp))
738 IF(1>=jsta .and. 1<=jend)print*,
'PVTH at N POLE= ' &
739 ,pvth(1,1,lp),pvth(im/2,1,lp) &
740 ,pvth(10,10,lp),pvth(im/2,10,lp),spval,grib,lp
744 IF(pvth(i,j,lp) /= spval)
THEN
745 grid1(i,j) = pvth(i,j,lp)*1.0e-6
747 grid1(i,j) = pvth(i,j,lp)
751 if(grib==
'grib2')
then
753 fld_info(cfld)%ifld=iavblfld(iget(335))
754 fld_info(cfld)%lvl=lvlsxml(lp,iget(335))
759 datapd(i,j,cfld) = grid1(i,jj)
768 IF(iget(353) > 0)
THEN
769 IF(lvls(lp,iget(353)) > 0)
THEN
773 grid1(i,j) = hmth(i,j,lp)
776 if(grib==
'grib2')
then
778 fld_info(cfld)%ifld=iavblfld(iget(353))
779 fld_info(cfld)%lvl=lvlsxml(lp,iget(353))
784 datapd(i,j,cfld) = grid1(i,jj)
793 IF(iget(351) > 0)
THEN
794 IF(lvls(lp,iget(351)) > 0)
THEN
798 grid1(i,j) = sigmath(i,j,lp)
801 if(grib==
'grib2')
then
803 fld_info(cfld)%ifld=iavblfld(iget(351))
804 fld_info(cfld)%lvl=lvlsxml(lp,iget(351))
809 datapd(i,j,cfld) = grid1(i,jj)
818 IF(iget(352) > 0)
THEN
819 IF(lvls(lp,iget(352)) > 0)
THEN
823 IF(rhth(i,j,lp) /= spval)
THEN
824 grid1(i,j) = 100.0 * min(1.,max(rhmin,rhth(i,j,lp)))
830 if(grib==
'grib2')
then
832 fld_info(cfld)%ifld=iavblfld(iget(352))
833 fld_info(cfld)%lvl=lvlsxml(lp,iget(352))
838 datapd(i,j,cfld) = grid1(i,jj)
847 IF(iget(378) > 0)
THEN
848 IF(lvls(lp,iget(378)) > 0)
THEN
852 grid1(i,j) = oth(i,j,lp)
855 if(grib==
'grib2')
then
857 fld_info(cfld)%ifld=iavblfld(iget(378))
858 fld_info(cfld)%lvl=lvlsxml(lp,iget(378))
863 datapd(i,j,cfld) = grid1(i,jj)
874 IF(iget(336) > 0.OR.iget(337) > 0)
THEN
875 IF(lvls(lp,iget(336)) > 0.OR.lvls(lp,iget(337)) > 0)
THEN
877 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
878 ,spval,vpv(1:im,jsta:jend,lp))
882 grid1(i,j) = upv(i,j,lp)
883 grid2(i,j) = vpv(i,j,lp)
886 if(grib==
'grib2')
then
888 fld_info(cfld)%ifld=iavblfld(iget(336))
889 fld_info(cfld)%lvl=lvlsxml(lp,iget(336))
894 datapd(i,j,cfld) = grid1(i,jj)
898 fld_info(cfld)%ifld=iavblfld(iget(337))
899 fld_info(cfld)%lvl=lvlsxml(lp,iget(337))
904 datapd(i,j,cfld) = grid2(i,jj)
914 IF(iget(338) > 0)
THEN
915 IF(lvls(lp,iget(338)) > 0)
THEN
917 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
918 ,spval,tpv(1:im,jsta:jend,lp))
922 grid1(i,j) = tpv(i,j,lp)
925 if(grib==
'grib2')
then
927 fld_info(cfld)%ifld=iavblfld(iget(338))
928 fld_info(cfld)%lvl=lvlsxml(lp,iget(338))
933 datapd(i,j,cfld) = grid1(i,jj)
942 IF(iget(339) > 0)
THEN
943 IF(lvls(lp,iget(339)) > 0)
THEN
945 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
946 ,spval,hpv(1:im,jsta:jend,lp))
950 grid1(i,j) = hpv(i,j,lp)
953 if(grib==
'grib2')
then
955 fld_info(cfld)%ifld=iavblfld(iget(339))
956 fld_info(cfld)%lvl=lvlsxml(lp,iget(339))
961 datapd(i,j,cfld) = grid1(i,jj)
970 IF(iget(340) > 0)
THEN
971 IF(lvls(lp,iget(340)) > 0)
THEN
973 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
974 ,spval,ppv(1:im,jsta:jend,lp))
978 grid1(i,j) = ppv(i,j,lp)
981 if(grib==
'grib2')
then
983 fld_info(cfld)%ifld=iavblfld(iget(340))
984 fld_info(cfld)%lvl=lvlsxml(lp,iget(340))
989 datapd(i,j,cfld) = grid1(i,jj)
998 IF(iget(341) > 0)
THEN
999 IF(lvls(lp,iget(341)) > 0)
THEN
1001 call poleavg(im,jm,jsta,jend,small,cosl(1:im,jsta:jend) &
1002 ,spval,spv(1:im,jsta:jend,lp))
1006 grid1(i,j) = spv(i,j,lp)
1009 if(grib==
'grib2')
then
1011 fld_info(cfld)%ifld=iavblfld(iget(341))
1012 fld_info(cfld)%lvl=lvlsxml(lp,iget(341))
1017 datapd(i,j,cfld) = grid1(i,jj)
1026 DEALLOCATE(dum1d1,dum1d2,dum1d3,dum1d4,dum1d5,dum1d6,dum1d7, &
1027 dum1d8,dum1d9,dum1d10,dum1d11,dum1d12,dum1d13, &
1028 dum1d14,wrk1, wrk2, wrk3, wrk4, cosl)
1031 if(me==0)print *,
'end of MDL2THandpv'
subroutine p2th(km, theta, u, v, h, t, pvu, sigma, rh, omga, kth, th, lth, uth, vth, hth, tth, zth, sigmath, rhth, oth)
p2th() interpolates to isentropic level.
dvdxdudy() computes dudy, dvdx, uwnd
subroutine p2pv(km, pvu, h, t, p, u, v, kpv, pv, pvpt, pvpb, lpv, upv, vpv, hpv, tpv, ppv, spv)
p2pv() interpolates to potential vorticity level.
elemental real function, public fpvsnew(t)
calcape() computes CAPE/CINS and other storm related variables.