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
123 integer(I4B) :: izstatus
124 integer(I4B) :: itopbotexit
125 integer(I4B) :: ntmax
126 integer(I4B) :: isolv
127 integer(I4B) :: itrifaceenter
128 integer(I4B) :: itrifaceexit
133 integer(I4B) :: reason
137 if (particle%iexmeth == 0)
then
140 isolv = particle%iexmeth
166 vzbot = subcell%vzbot
167 vztop = subcell%vztop
179 call canonical(x0, y0, x1, y1, x2, y2, &
180 v0x, v0y, v1x, v1y, v2x, v2y, &
182 rxx, rxy, ryx, ryy, &
184 alp0, bet0, alp1, bet1, alp2, bet2, alpi, beti)
188 call clamp_bary(alpi, beti, gami, pad=dsame * dep3)
193 zirel = (zi - zbot) / dz
194 if (zirel > done)
then
196 else if (zirel < dzero)
then
199 call calculate_dt(vzbot, vztop, dz, zirel, vzi, &
200 az, dtexitz, izstatus, &
205 itrifaceenter = particle%iboundary(3) - 1
206 if (itrifaceenter == -1) itrifaceenter = 999
207 call traverse_triangle(isolv, tol, &
208 dtexitxy, alpexit, betexit, &
209 itrifaceenter, itrifaceexit, &
210 alp1, bet1, alp2, bet2, alpi, beti)
214 if (itopbotexit == 0 .and. itrifaceexit == 0)
then
216 particle%advancing = .false.
217 call this%save(particle, reason=3)
222 if (itopbotexit == 0)
then
224 exitface = itrifaceexit
226 else if (itrifaceexit == 0 .or. dtexitz < dtexitxy)
then
232 exitface = itrifaceexit
235 if (exitface == 45)
then
236 if (itopbotexit == -1)
then
244 if (dtexit < dzero)
then
246 particle%advancing = .false.
247 call this%save(particle, reason=3)
251 texit = particle%ttrack + dtexit
258 call this%tracktimes%advance()
259 if (this%tracktimes%any())
then
260 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
261 t = this%tracktimes%times(i)
262 if (t < particle%ttrack) cycle
263 if (t >= texit .or. t >= tmax)
exit
265 call calculate_xyz_position(dt, rxx, rxy, ryx, ryy, sxx, sxy, syy, &
266 izstatus, x0, y0, az, vzi, vzbot, &
267 ztop, zbot, zi, x, y, z)
273 call this%save(particle, reason=5)
280 if (texit .gt. tmax)
then
287 particle%advancing = .false.
296 call calculate_xyz_position(dt, rxx, rxy, ryx, ryy, sxx, sxy, syy, &
297 izstatus, x0, y0, az, vzi, vzbot, &
298 ztop, zbot, zi, x, y, z, exitface)
303 particle%iboundary(3) = exitface
305 call this%save(particle, reason=reason)
@ term_no_exits_sub
terminated in a subcell with no exit face