UPP  001
 All Data Structures Files Functions Pages
NGMFLD.f
Go to the documentation of this file.
1 
45  SUBROUTINE ngmfld(RH4710,RH4796,RH1847,RH8498,QM8510)
46 
47 !
48 !
49 ! INCLUDE PARAMETERS
50  use vrbls3d, only: q, uh, vh, pint, alpint, zint, t
51  use masks, only: lmh
52  use params_mod, only: d00, d50, h1m12, pq0, a2, a3, a4, h1, d01, small
53  use ctlblk_mod, only: jsta, jend, lm, jsta_2l, jend_2u, jsta_m2, jend_m2,&
54  spval, im
55 !
56 !- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57  implicit none
58 !
59  real,PARAMETER :: sig100=1.00000, sig98=0.98230, sig96=0.96470
60  real,PARAMETER :: sig89 =0.89671, sig85=0.85000, sig84=0.84368
61  real,PARAMETER :: sig78 =0.78483, sig47=0.47191, sig18=0.18018
62 !
63 ! DECLARE VARIABLES.
64  LOGICAL got8510,got4710,got4796,got1847,got8498
65  REAL,dimension(IM,jsta_2l:jend_2u),intent(out) :: qm8510,rh4710,rh8498, &
66  rh4796,rh1847
67  REAL,dimension(im,jsta_2l:jend_2u) :: z8510,z4710,z8498,z4796,z1847
68  real,dimension(im,jsta_2l:jend_2u) :: q1d, u1d, v1d, qcnvg
69 !
70  integer i,j,l
71  real p100,p85,p98,p96,p84,p47,p18,alpm,de,pm,tm,qm, &
72  qmcvg,qs,rh,dz
73 !********************************************************************
74 ! START NGMFLD HERE.
75 !
76 ! INITIALIZE ARRAYS.
77 !$omp parallel do private(i,j)
78  DO j=jsta,jend
79  DO i=1,im
80  qm8510(i,j) = d00
81  rh4710(i,j) = d00
82  rh8498(i,j) = d00
83  rh4796(i,j) = d00
84  rh1847(i,j) = d00
85  z8510(i,j) = d00
86  z8498(i,j) = d00
87  z4710(i,j) = d00
88  z4796(i,j) = d00
89  z1847(i,j) = d00
90  ENDDO
91  ENDDO
92 !
93 ! LOOP OVER HORIZONTAL GRID.
94 !
95 !!$omp parallel do &
96 ! & private(dz,p100,p18,p47,p84,p85, &
97 ! & p96,p98,pm,qdiv,qk,qkhn,qkhs,qkm1,qm,qm8510, &
98 ! & qmcvg,qs,qudx,qvdy,r2dx,r2dy,rh,rh1847,rh4710, &
99 ! & rh4796,rh8498,tm,tmt0,tmt15,z1847,z4710,z4796, &
100 ! & z8498,z8510,q1d,u1d,v1d,qcnvg)
101 
102  DO l=1,lm
103 ! COMPUTE MOISTURE CONVERGENCE
104 !$omp parallel do private(i,j)
105  DO j=jsta_2l,jend_2u
106  DO i=1,im
107  q1d(i,j) = q(i,j,l)
108  u1d(i,j) = uh(i,j,l)
109  v1d(i,j) = vh(i,j,l)
110  ENDDO
111  ENDDO
112  CALL calmcvg(q1d,u1d,v1d,qcnvg)
113 ! COMPUTE MOISTURE CONVERGENCE
114  DO j=jsta_m2,jend_m2
115  DO i=2,im-1
116 !
117 ! SET TARGET PRESSURES.
118 
119  p100 = pint(i,j,nint(lmh(i,j)))
120  p98 = sig98*p100
121  p96 = sig96*p100
122  p85 = sig85*p100
123  p84 = sig84*p100
124  p47 = sig47*p100
125  p18 = sig18*p100
126 !
127 !
128 ! COMPUTE LAYER MEAN FIELDS AT THE GIVEN K.
129 !
130 ! COMPUTE P, Z, T, AND Q AT THE MIDPOINT OF THE CURRENT ETA LAYER.
131  alpm = d50*(alpint(i,j,l)+alpint(i,j,l+1))
132  dz = zint(i,j,l)-zint(i,j,l+1)
133  pm = exp(alpm)
134  tm = t(i,j,l)
135  qm = q(i,j,l)
136  qm = amax1(qm,h1m12)
137  qmcvg= qcnvg(i,j)
138 !
139 !
140 ! COMPUTE RELATIVE HUMIDITY.
141 !
142  qs=pq0/pm*exp(a2*(tm-a3)/(tm-a4))
143 !
144  rh = qm/qs
145  IF (rh>h1) THEN
146  rh = h1
147  qm = rh*qs
148  ENDIF
149  IF (rh<d01) THEN
150  rh = d01
151  qm = rh*qs
152  ENDIF
153 !
154 ! SIGMA 0.85-1.00 MOISTURE CONVERGENCE.
155  IF ((pm<=p100).AND.(pm>=p85)) THEN
156  z8510(i,j) = z8510(i,j) + dz
157  qm8510(i,j) = qm8510(i,j) + qmcvg*dz
158  ENDIF
159 !
160 ! SIGMA 0.47-1.00 RELATIVE HUMIDITY.
161  IF ((pm<=p100).AND.(pm>=p47)) THEN
162  z4710(i,j) = z4710(i,j) + dz
163  rh4710(i,j) = rh4710(i,j) + rh*dz
164  ENDIF
165 !
166 ! SIGMA 0.84-0.98 RELATIVE HUMIDITY.
167  IF ((pm<=p98).AND.(pm>=p84)) THEN
168  z8498(i,j) = z8498(i,j) + dz
169  rh8498(i,j) = rh8498(i,j) + rh*dz
170  ENDIF
171 !
172 ! SIGMA 0.47-0.96 RELATIVE HUMIDITY.
173  IF ((pm<=p96).AND.(pm>=p47)) THEN
174  z4796(i,j) = z4796(i,j) + dz
175  rh4796(i,j) = rh4796(i,j) + rh*dz
176  ENDIF
177 !
178 ! SIGMA 0.18-0.47 RELATIVE HUMIDITY.
179  IF ((pm<=p47).AND.(pm>=p18)) THEN
180  z1847(i,j) = z1847(i,j) + dz
181  rh1847(i,j) = rh1847(i,j) + rh*dz
182  ENDIF
183 !
184  ENDDO
185  ENDDO
186  ENDDO
187 !
188  DO j=jsta_m2,jend_m2
189  DO i=2,im-1
190 ! NORMALIZE TO GET LAYER MEAN VALUES.
191  IF (z8510(i,j)>0) THEN
192  qm8510(i,j) = qm8510(i,j)/z8510(i,j)
193  ELSE
194  qm8510(i,j) = spval
195  ENDIF
196  IF (abs(qm8510(i,j)-spval)<small)qm8510(i,j)=h1m12
197 !
198  IF (z4710(i,j)>0) THEN
199  rh4710(i,j) = rh4710(i,j)/z4710(i,j)
200  ELSE
201  rh4710(i,j) = spval
202  ENDIF
203 !
204  IF (z8498(i,j)>0) THEN
205  rh8498(i,j) = rh8498(i,j)/z8498(i,j)
206  ELSE
207  rh8498(i,j) = spval
208  ENDIF
209 !
210  IF (z4796(i,j)>0) THEN
211  rh4796(i,j) = rh4796(i,j)/z4796(i,j)
212  ELSE
213  rh4796(i,j) = spval
214  ENDIF
215 !
216  IF (z1847(i,j)>0) THEN
217  rh1847(i,j) = rh1847(i,j)/z1847(i,j)
218  ELSE
219  rh1847(i,j) = spval
220  ENDIF
221  ENDDO
222  ENDDO
223 !
224 !
225 ! END OF ROUTINE.
226 !
227  RETURN
228  END
229 
Definition: MASKS_mod.f:1