1 MODULE module_compute_geop
4 SUBROUTINE compute_500mb_height ( ph, phb, p, pb, &
6 ids, ide, jds, jde, kds, kde, &
7 ims, ime, jms, jme, kms, kme, &
8 its, ite, jts, jte, kts, kte )
15 INTEGER , INTENT(IN ) :: ids, ide, jds, jde, kds, kde, &
16 ims, ime, jms, jme, kms, kme, &
17 its, ite, jts, jte, kts, kte
19 REAL , DIMENSION( ims:ime , kms:kme, jms:jme ) , &
26 REAL , DIMENSION( ims:ime , jms:jme ) , INTENT( OUT) :: height
28 INTEGER , INTENT(IN) :: track_level
33 real, dimension(kms:kme) :: pressure,geopotential
37 ! slow version of code, we'll call interp routine for each column
39 track_level_p = float(track_level)
41 do j = jts, min(jde-1,jte)
42 do i = its, min(ide-1,ite)
45 pressure(k) = p(i,k,j) + pb(i,k,j)
46 geopotential(k) = 0.5*( ph(i,k ,j)+phb(i,k ,j) &
47 +ph(i,k+1,j)+phb(i,k+1,j) )
50 ! call interp_p( geopotential, pressure, 70000., interp_output, &
51 call interp_p( geopotential, pressure, track_level_p, interp_output, &
52 kds,kde-1,kms,kme, i,j )
54 height(i,j) = interp_output/9.81 ! 500 mb height in meters
59 end subroutine compute_500mb_height
63 subroutine interp_p(a,p,p_loc,a_interp,ks,ke,kms,kme,i,j)
66 integer, intent(in) :: ks,ke,kms,kme,i,j
67 real, dimension(kms:kme), intent(in) :: a,p
68 real, intent(in) :: p_loc
69 real, intent(out) :: a_interp
74 real :: wght1, wght2, dp, pressure
77 !cys_change: set high value at below-ground point
78 if (p(ks).lt.p_loc) then
85 do while( pk .gt. pressure )
90 write(mess,*) ' interp too high: pressure, p(ke), i, j = ',pressure,p(ke),i,j
91 call wrf_message ( mess )
93 call wrf_error_fatal( mess )
101 wght2 = (p(kp-1)-pressure)/dp
104 a_interp = wght1*a(kp-1) + wght2*a(kp)
108 end subroutine interp_p
110 END MODULE module_compute_geop