48 use masks,
only: dx, dy, hbm2
49 use params_mod,
only: d00, d25
50 use ctlblk_mod,
only: jsta_2l, jend_2u, spval, jsta_m, jend_m, &
51 jsta_m2, jend_m2, im, jm, &
52 ista_2l, iend_2u, ista_m, iend_m, ista_m2, iend_m2
53 use gridspec_mod,
only: gridtype
59 REAL,
dimension(ista_2l:iend_2u,jsta_2l:jend_2u),
intent(in) :: Q1D, U1D, V1D
60 REAL,
dimension(ista_2l:iend_2u,jsta_2l:jend_2u),
intent(inout) :: QCNVG
63 REAL,
dimension(ista_2l:iend_2u,jsta_2l:jend_2u) :: UWND, VWND, QV
64 INTEGER IHE(JM),IHW(JM),IVE(JM),IVW(JM)
65 integer I,J,ISTA2,IEND2
82 IF(u1d(i,j)<spval)
THEN
89 IF (uwnd(i,j) == spval) uwnd(i,j) = d00
90 IF (vwnd(i,j) == spval) vwnd(i,j) = d00
94 IF(gridtype ==
'A')
THEN
99 IF(q1d(i,j+1)<spval.AND.q1d(i,j-1)<spval.AND. &
100 q1d(i+1,j)<spval.AND.q1d(i-1,j)<spval.AND. &
102 r2dx = 1./(2.*dx(i,j))
103 r2dy = 1./(2.*dy(i,j))
104 qudx = (q1d(i+1,j)*uwnd(i+1,j)-q1d(i-1,j)*uwnd(i-1,j))*r2dx
105 qvdy = (q1d(i,j+1)*vwnd(i,j+1)-q1d(i,j-1)*vwnd(i,j-1))*r2dy
106 qcnvg(i,j) = -(qudx + qvdy)
112 ELSE IF(gridtype ==
'E')
THEN
127 IF(q1d(i,j-1)<spval.AND.q1d(i+ivw(j),j)<spval.AND.&
128 q1d(i+ive(j),j)<spval.AND.q1d(i,j+1)<spval)
THEN
129 qv(i,j) = d25*(q1d(i,j-1)+q1d(i+ivw(j),j) &
130 +q1d(i+ive(j),j)+q1d(i,j+1))
145 DO i=ista_m,iend_m-mod(j,2)
146 IF(qv(i+ihe(j),j)<spval.AND.uwnd(i+ihe(j),j)<spval.AND.&
147 qv(i+ihw(j),j)<spval.AND.uwnd(i+ihw(j),j)<spval.AND.&
148 qv(i,j)<spval.AND.qv(i,j-1)<spval.AND.qv(i,j+1)<spval)
THEN
149 r2dx = 1./(2.*dx(i,j))
150 r2dy = 1./(2.*dy(i,j))
151 qudx = (qv(i+ihe(j),j)*uwnd(i+ihe(j),j) &
152 -qv(i+ihw(j),j)*uwnd(i+ihw(j),j))*r2dx
153 qvdy = (qv(i,j+1)*vwnd(i,j+1)-qv(i,j-1)*vwnd(i,j-1))*r2dy
155 qcnvg(i,j) = -(qudx + qvdy) * hbm2(i,j)
161 ELSE IF(gridtype==
'B')
THEN
169 IF(uwnd(i,j)<spval.AND.uwnd(i,j-1)<spval.AND.&
170 uwnd(i-1,j)<spval.AND.uwnd(i-1,j-1)<spval.AND.&
171 q1d(i,j)<spval.AND.q1d(i+1,j)<spval.AND.q1d(i-1,j)<spval.AND.&
172 vwnd(i,j)<spval.AND.vwnd(i-1,j)<spval.AND.&
173 vwnd(i,j-1)<spval.AND.vwnd(i-1,j-1)<spval.AND.&
174 q1d(i,j+1)<spval.AND.q1d(i,j-1)<spval)
THEN
177 qudx=(0.5*(uwnd(i,j)+uwnd(i,j-1))*0.5*(q1d(i,j)+q1d(i+1,j)) &
178 -0.5*(uwnd(i-1,j)+uwnd(i-1,j-1))*0.5*(q1d(i,j)+q1d(i-1,j)))*r2dx
179 qvdy=(0.5*(vwnd(i,j)+vwnd(i-1,j))*0.5*(q1d(i,j)+q1d(i,j+1)) &
180 -0.5*(vwnd(i,j-1)+vwnd(i-1,j-1))*0.5*(q1d(i,j)+q1d(i,j-1)))*r2dy
182 qcnvg(i,j) = -(qudx + qvdy)