32 subroutine fillz(im, km, nq, q, dp)
33 integer,
intent(in):: im
34 integer,
intent(in):: km
35 integer,
intent(in):: nq
36 real ,
intent(in):: dp(im,km)
37 real ,
intent(inout) :: q(im,km,nq)
42 real qup, qly, dup, dq, sum0, sum1, fac
50 if( q(i,k,ic) < 0. )
then 51 q(i,k1,ic) = q(i,k1,ic) + q(i,k,ic)*dp(i,k)/dp(i,k1)
60 if( q(i,k,ic) < 0. )
then 61 q(i,k1,ic) = q(i,k1,ic) + q(i,k,ic)*dp(i,k)/dp(i,k1)
69 if( q(i,1,ic) < 0. )
then 70 q(i,2,ic) = q(i,2,ic) + q(i,1,ic)*dp(i,1)/dp(i,2)
79 if( q(i,k,ic) < 0. )
then 81 if ( q(i,k-1,ic) > 0. )
then 83 dq =
min( q(i,k-1,ic)*dp(i,k-1), -q(i,k,ic)*dp(i,k) )
84 q(i,k-1,ic) = q(i,k-1,ic) - dq/dp(i,k-1)
85 q(i,k ,ic) = q(i,k ,ic) + dq/dp(i,k )
87 if ( q(i,k,ic)<0.0 .and. q(i,k+1,ic)>0. )
then 89 dq =
min( q(i,k+1,ic)*dp(i,k+1), -q(i,k,ic)*dp(i,k) )
90 q(i,k+1,ic) = q(i,k+1,ic) - dq/dp(i,k+1)
91 q(i,k ,ic) = q(i,k ,ic) + dq/dp(i,k )
100 if( q(i,k,ic)<0. .and. q(i,k-1,ic)>0.)
then 103 qup = q(i,k-1,ic)*dp(i,k-1)
104 qly = -q(i,k ,ic)*dp(i,k )
106 q(i,k-1,ic) = q(i,k-1,ic) - dup/dp(i,k-1)
107 q(i,k, ic) = q(i,k, ic) + dup/dp(i,k )
117 dm(k) = q(i,k,ic)*dp(i,k)
121 if ( sum0 > 0. )
then 124 sum1 = sum1 +
max(0., dm(k))
128 q(i,k,ic) =
max(0., fac*dm(k)/dp(i,k))
139 subroutine fill_gfs(im, km, pe2, q, q_min)
141 integer,
intent(in):: im, km
142 real(kind=kind_phys),
intent(in):: pe2(im,km+1)
143 real(kind=kind_phys),
intent(in):: q_min
144 real(kind=kind_phys),
intent(inout):: q(im,km)
146 real(kind=kind_phys) :: dp(im,km)
151 dp(i,k) = pe2(i,k) - pe2(i,k+1)
159 if ( q(i,k)<q_min )
then 161 q(i,k1) = q(i,k1) + (q(i,k)-q_min)*dp(i,k)/dp(i,k1)
171 if ( q(i,k)<0.0 )
then 173 q(i,k1) = q(i,k1) + q(i,k)*dp(i,k)/dp(i,k1)
182 subroutine fill2d(is, ie, js, je, ng, km, q, delp, area, domain, nested, npx, npy)
184 type(
domain2d),
intent(INOUT) :: domain
185 integer,
intent(in):: is, ie, js, je, ng, km, npx, npy
186 logical,
intent(IN):: nested
187 real,
intent(in):: area(is-ng:ie+ng, js-ng:je+ng)
188 real,
intent(in):: delp(is-ng:ie+ng, js-ng:je+ng, km)
189 real,
intent(inout):: q(is-ng:ie+ng, js-ng:je+ng, km)
191 real,
dimension(is-ng:ie+ng, js-ng:je+ng,km):: qt
192 real,
dimension(is:ie+1, js:je):: fx
193 real,
dimension(is:ie, js:je+1):: fy
194 real,
parameter:: dif = 0.25
196 integer :: is1, ie1, js1, je1
204 if (ie == npx-1)
then 214 if (je == npy-1)
then 230 qt(i,j,k) = q(i,j,k)*delp(i,j,k)*area(i,j)
241 if( qt(i-1,j,k)*qt(i,j,k)<0. ) fx(i,j) = qt(i-1,j,k) - qt(i,j,k)
247 if( qt(i,j-1,k)*qt(i,j,k)<0. ) fy(i,j) = qt(i,j-1,k) - qt(i,j,k)
252 q(i,j,k) = q(i,j,k)+dif*(fx(i,j)-fx(i+1,j)+fy(i,j)-fy(i,j+1))/(delp(i,j,k)*area(i,j))
subroutine, public fillz(im, km, nq, q, dp)
subroutine, public fill_gfs(im, km, pe2, q, q_min)
subroutine, public fill2d(is, ie, js, je, ng, km, q, delp, area, domain, nested, npx, npy)