68 class(MethodSubcellTernaryType),
intent(inout) :: this
69 class(SubcellTriType),
intent(in) :: subcell
70 type(ParticleType),
pointer,
intent(inout) :: particle
71 real(DP),
intent(in) :: tmax
73 integer(I4B) :: exitFace
101 real(DP) :: rot(2, 2), res(2), loc(2)
126 integer(I4B) :: izstatus
127 integer(I4B) :: itopbotexit
128 integer(I4B) :: ntmax
129 integer(I4B) :: nsave
130 integer(I4B) :: isolv
131 integer(I4B) :: itrifaceenter
132 integer(I4B) :: itrifaceexit
138 integer(I4B) :: ntdebug
139 integer(I4B) :: reason
141 integer(I4B) :: tslice(2)
146 isolv = this%zeromethod
170 vzbot = subcell%vzbot
171 vztop = subcell%vztop
174 call canonical(x0, y0, x1, y1, x2, y2, &
175 v0x, v0y, v1x, v1y, v2x, v2y, &
177 rxx, rxy, ryx, ryy, &
179 alp0, bet0, alp1, bet1, alp2, bet2, alpi, beti, &
186 zirel = (zi - zbot) / dz
187 call calculate_dt(vzbot, vztop, dz, zirel, vzi, &
188 az, dtexitz, izstatus, &
194 itrifaceenter = particle%iboundary(3) - 1
195 if (itrifaceenter .eq. -1) itrifaceenter = 999
200 call traverse_triangle(isolv, tol, step, &
201 dtexitxy, alpexit, betexit, &
202 itrifaceenter, itrifaceexit, &
203 rxx, rxy, ryx, ryy, &
204 alp0, bet0, alp1, bet1, alp2, bet2, alpi, beti, &
208 if ((itopbotexit .eq. 0) .and. (itrifaceexit .eq. 0))
then
215 print *,
"Subcell with no exit face: particle", get_particle_id(particle), &
216 "cell", particle%idomain(2)
221 if (itopbotexit .eq. 0)
then
223 exitface = itrifaceexit
225 else if (itrifaceexit .eq. 0)
then
229 else if (dtexitz .lt. dtexitxy)
then
235 exitface = itrifaceexit
238 if (exitface .eq. 45)
then
239 if (itopbotexit .eq. -1)
then
247 texit = particle%ttrack + dtexit
254 call this%tracktimes%try_advance()
255 tslice = this%tracktimes%selection
256 if (all(tslice > 0))
then
257 do i = tslice(1), tslice(2)
258 t = this%tracktimes%times(i)
259 if (t < particle%ttrack .or. t >= texit .or. t >= tmax) cycle
261 call step_analytical(dt, alp, bet)
263 if (lbary) loc = skew(loc, (/sxx, sxy, syy/), invert=.true.)
264 rot = reshape((/rxx, rxy, ryx, ryy/), shape(rot))
265 res = matmul(rot, loc)
269 if (izstatus .eq. 2)
then
272 else if (izstatus .eq. 1)
then
277 z = zbot + (vzi * dexp(az * dt) - vzbot) / az
284 call this%save(particle, reason=5)
288 if (texit .gt. tmax)
then
295 particle%advancing = .false.
308 call step_analytical(dt, alp, bet)
309 if (exitface .eq. 1)
then
311 else if (exitface .eq. 2)
then
313 else if (exitface .eq. 3)
then
317 if (lbary) loc = skew(loc, (/sxx, sxy, syy/), invert=.true.)
318 rot = reshape((/rxx, rxy, ryx, ryy/), shape(rot))
319 res = matmul(rot, loc)
322 if (exitface .eq. 4)
then
324 else if (exitface .eq. 5)
then
327 if (izstatus .eq. 2)
then
330 else if (izstatus .eq. 1)
then
335 z = zbot + (vzi * dexp(az * dt) - vzbot) / az
345 particle%iboundary(3) = exitface
349 call this%save(particle, reason=reason)