UPP  001
 All Data Structures Files Functions Pages
LFMFLD.f
Go to the documentation of this file.
1 
43  SUBROUTINE lfmfld(RH3310,RH6610,RH3366,PW3310)
44 
45 !
46 !
47  use vrbls3d, only: pint, alpint, zint, t, q, cwm
48  use masks, only: lmh
49  use params_mod, only: d00, d50, pq0, a2, a3, a4, h1, d01, gi
50  use ctlblk_mod, only: jsta, jend, modelname, spval, im
51  use physcons_post, only: con_rd, con_rv, con_eps, con_epsm1
52  use upp_physics, only: fpvsnew
53 
54  implicit none
55 
56 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57 !
58  real,PARAMETER :: rhowat=1.e3
59 !
60 ! DECLARE VARIABLES.
61 !
62  REAL alpm, dz, es, pm, pwsum, qm, qs, tm, dp, rh
63  REAL,dimension(IM,jsta:jend),intent(inout) :: rh3310, rh6610, rh3366
64  REAL,dimension(IM,jsta:jend),intent(inout) :: pw3310
65  real z3310,z6610,z3366,p10,p33,p66
66  integer i,j,l,llmh
67 !
68 !***********************************************************************
69 ! START LFMFLD HERE
70 !
71 !
72 ! LOOP OVER HORIZONTAL GRID.
73 !
74  DO 30 j=jsta,jend
75  DO 30 i=1,im
76 !
77 ! ZERO VARIABLES.
78  rh3310(i,j) = d00
79  pw3310(i,j) = d00
80  rh6610(i,j) = d00
81  rh3366(i,j) = d00
82  z3310 = d00
83  z6610 = d00
84  z3366 = d00
85 !
86 ! SET BOUNDS FOR PRESSURES AND SURFACE L.
87  p10 = pint(i,j,nint(lmh(i,j)))
88  p66 = 0.75*p10
89  p33 = 0.50*p10
90  llmh = nint(lmh(i,j))
91 !
92 ! ACCULMULATE RELATIVE HUMIDITIES AND PRECIPITABLE WATER.
93 !
94  DO 10 l = llmh,1,-1
95 !
96 ! GET P, Z, T, AND Q AT MIDPOINT OF ETA LAYER.
97  alpm = d50*(alpint(i,j,l)+alpint(i,j,l+1))
98  dz = zint(i,j,l)-zint(i,j,l+1)
99  dp = pint(i,j,l+1)-pint(i,j,l)
100  pm = exp(alpm)
101  tm = t(i,j,l)
102  qm = q(i,j,l)
103  qm = amax1(qm,d00)
104 !
105 ! QS=PQ0/PM*EXP(A2*(TM-A3)/(TM-A4))
106  IF(modelname == 'GFS')THEN
107  es = min(fpvsnew(tm),pm)
108  qs = con_eps*es/(pm+con_epsm1*es)
109  ELSE
110  qs=pq0/pm*exp(a2*(tm-a3)/(tm-a4))
111  END IF
112  rh = qm/qs
113  IF (rh>h1) THEN
114  rh = h1
115  qm = rh*qs
116  ENDIF
117  IF (rh<d01) THEN
118  rh = d01
119  qm = rh*qs
120  ENDIF
121 !
122 ! JUMP OUT OF THIS LOOP IF WE ARE ABOVE THE HIGHEST TARGET PRESSURE.
123  IF (pm<=p33) exit
124 !
125 ! 0.66-1.00 RELATIVE HUMIDITY.
126  IF ((pm<=p10).AND.(pm>=p66)) THEN
127  z6610 = z6610 + dz
128  rh6610(i,j) = rh6610(i,j) + rh*dz
129  ENDIF
130 !
131 ! 0.33-1.00 RELATIVE HUMIDITY AND PRECIPITABLE WATER.
132  IF ((pm<=p10).AND.(pm>=p33)) THEN
133  z3310 = z3310 + dz
134  rh3310(i,j)= rh3310(i,j)+rh*dz
135  pw3310(i,j)= pw3310(i,j)+(q(i,j,l)+cwm(i,j,l))*dp*gi
136  ENDIF
137 !
138 ! 0.33-0.66 RELATIVE HUMIDITY.
139  IF ((pm<=p66).AND.(pm>=p33)) THEN
140  z3366 = z3366 + dz
141  rh3366(i,j) = rh3366(i,j) + rh*dz
142  ENDIF
143 !
144  10 CONTINUE
145 !
146 ! NORMALIZE TO GET MEAN RELATIVE HUMIDITIES. AT
147 ! ONE TIME WE DIVIDED PRECIPITABLE WATER BY DENSITY
148 ! TO GET THE EQUIVALENT WATER DEPTH IN METERS. NO MORE.
149  IF (z6610>d00) THEN
150  rh6610(i,j) = rh6610(i,j)/z6610
151  ELSE
152  rh6610(i,j) = spval
153  ENDIF
154 !
155  IF (z3310>d00) THEN
156  rh3310(i,j) = rh3310(i,j)/z3310
157  ELSE
158  rh3310(i,j) = spval
159  ENDIF
160 !
161  IF (z3366>d00) THEN
162  rh3366(i,j) = rh3366(i,j)/z3366
163  ELSE
164  rh3366(i,j) = spval
165  ENDIF
166  30 CONTINUE
167 !
168 !
169 ! END OF ROUTINE.
170 !
171  RETURN
172  END
Definition: MASKS_mod.f:1
Definition: physcons.f:1
elemental real function, public fpvsnew(t)
Definition: UPP_PHYSICS.f:341
calcape() computes CAPE/CINS and other storm related variables.
Definition: UPP_PHYSICS.f:27