150 class(MethodCellTernaryType),
intent(inout) :: this
151 type(ParticleType),
pointer,
intent(inout) :: particle
152 real(DP),
intent(in) :: tmax
154 integer(I4B) :: npolyverts
158 real(DP) :: retfactor
181 select type (cell => this%cell)
182 type is (cellpolytype)
185 call this%update(particle, cell%defn)
188 if (.not. particle%advancing)
return
193 if (particle%z > cell%defn%top)
then
194 particle%z = cell%defn%top
195 call this%save(particle, reason=1)
198 npolyverts = cell%defn%npolyverts
199 if (
allocated(this%x_vert))
then
200 deallocate (this%x_vert)
201 deallocate (this%y_vert)
202 deallocate (this%vx_vert_polygon)
203 deallocate (this%vy_vert_polygon)
205 allocate (this%x_vert(npolyverts))
206 allocate (this%y_vert(npolyverts))
207 allocate (this%vx_vert_polygon(npolyverts))
208 allocate (this%vy_vert_polygon(npolyverts))
215 this%ztop = cell%defn%top
216 this%zbot = cell%defn%bot
217 this%dz = this%ztop - this%zbot
218 do iv = 1, npolyverts
220 if (ivp1 .gt. npolyverts) ivp1 = 1
222 if (ivm1 .lt. 1) ivm1 = npolyverts
223 x0 = cell%defn%polyvert(1, iv)
224 y0 = cell%defn%polyvert(2, iv)
225 x2 = cell%defn%polyvert(1, ivp1)
226 y2 = cell%defn%polyvert(2, ivp1)
227 x1 = cell%defn%polyvert(1, ivm1)
228 y1 = cell%defn%polyvert(2, ivm1)
229 term =
done / (cell%defn%porosity * this%dz)
230 flow0 = cell%defn%faceflow(iv) * term
231 flow1 = cell%defn%faceflow(ivm1) * term
242 det = d01y * d02x - d02y * d01x
243 retfactor = cell%defn%retfactor
247 term =
done / (retfactor * det)
249 v0x = -term * (d02x * flow1 + d01x * flow0)
251 v0y = -term * (d02y * flow1 + d01y * flow0)
252 this%vx_vert_polygon(iv) = v0x
253 this%vy_vert_polygon(iv) = v0y
260 area = area + x0 * y1 - x1 * y0
263 term =
done / (retfactor * cell%defn%porosity * area)
264 this%vzbot = cell%defn%faceflow(npolyverts + 2) * term
265 this%vztop = -cell%defn%faceflow(npolyverts + 3) * term
266 this%xctr = xsum / dble(npolyverts)
267 this%yctr = ysum / dble(npolyverts)
268 this%vxctr = vxsum / dble(npolyverts)
269 this%vyctr = vysum / dble(npolyverts)
272 call this%track(particle, 2, tmax)
This module contains simulation constants.
real(dp), parameter dhalf
real constant 1/2
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1