Skip to content

Commit d1ea165

Browse files
authored
refactor(prt): consolidate cell exit event raising logic (#2458)
Override try_pass in the cell-level method and raise a cell exit event there instead of separately in the various cell-level methods. Fix a recently introduced issue where cell exits weren't raised by the quad pollock method.
1 parent f516f1b commit d1ea165

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

src/Solution/ParticleTracker/Method/MethodCell.f90

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module MethodCellModule
44
use ErrorUtilModule, only: pstop
55
use ConstantsModule, only: DONE, DZERO
66
use MethodModule, only: MethodType, LEVEL_FEATURE
7-
use ParticleModule, only: ParticleType, TERM_NO_EXITS, TERM_BOUNDARY
7+
use ParticleModule, only: ParticleType, ACTIVE, TERM_NO_EXITS, TERM_BOUNDARY
88
use ParticleEventModule, only: ParticleEventType
99
use CellExitEventModule, only: CellExitEventType
1010
use CellDefnModule, only: CellDefnType
@@ -21,9 +21,33 @@ module MethodCellModule
2121
procedure, public :: forms_cycle
2222
procedure, public :: store_event
2323
procedure, public :: get_level
24+
procedure, public :: try_pass
2425
end type MethodCellType
2526

2627
contains
28+
!> @brief Try passing the particle to the next subdomain.
29+
subroutine try_pass(this, particle, nextlevel, advancing)
30+
class(MethodCellType), intent(inout) :: this
31+
type(ParticleType), pointer, intent(inout) :: particle
32+
integer(I4B) :: nextlevel
33+
logical(LGP) :: advancing
34+
35+
if (particle%advancing) then
36+
! if still advancing, pass to the next subdomain.
37+
! if that puts us on a boundary, then we're done.
38+
! raise a cell exit event.
39+
call this%pass(particle)
40+
if (particle%iboundary(nextlevel - 1) .ne. 0) then
41+
advancing = .false.
42+
call this%cellexit(particle)
43+
end if
44+
else
45+
! otherwise we're already done so
46+
! reset the domain boundary value.
47+
advancing = .false.
48+
particle%iboundary = 0
49+
end if
50+
end subroutine try_pass
2751

2852
!> @brief Check reporting/terminating conditions before tracking
2953
!! the particle across the cell.

src/Solution/ParticleTracker/Method/MethodCellPollock.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ subroutine apply_mcp(this, particle, tmax)
151151
sinrot, cosrot, invert=.true.)
152152
call particle%reset_transform()
153153
end select
154-
155-
if (particle%iboundary(LEVEL_FEATURE) > 0) call this%cellexit(particle)
156154
end subroutine apply_mcp
157155

158156
!> @brief Loads the lone rectangular subcell from the rectangular cell

src/Solution/ParticleTracker/Method/MethodCellTernary.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ subroutine apply_mct(this, particle, tmax)
242242
call particle%transform(xO, yO, invert=.true.)
243243
call particle%reset_transform()
244244
end select
245-
246-
if (particle%iboundary(LEVEL_FEATURE) > 0) call this%cellexit(particle)
247245
end subroutine apply_mct
248246

249247
!> @brief Loads a triangular subcell from the polygonal cell

0 commit comments

Comments
 (0)