Skip to content

Commit

Permalink
more cleanup, remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Dec 14, 2023
1 parent fd1706c commit 5ce7ead
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 168 deletions.
2 changes: 1 addition & 1 deletion src/Model/ParticleTracking/prt1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ subroutine prt_cq_sto(this)
! refine these conditions as necessary
! (status 8 is permanently unreleased)
if ((istatus > 0) .and. (istatus /= 8)) then
n = packobj%particles%iTrackingDomain(np, 2)
n = packobj%particles%idomain(np, 2)
! -- Each particle currently assigned unit mass
this%masssto(n) = this%masssto(n) + DONE
end if
Expand Down
16 changes: 8 additions & 8 deletions src/Model/ParticleTracking/prt1prp1.f90
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,14 @@ subroutine prp_ad(this)
particle%trelease = trelease
particle%tstop = tstop
particle%ttrack = trelease
particle%iTrackingDomain(0) = 0
particle%iTrackingDomainBoundary(0) = 0
particle%iTrackingDomain(1) = 0
particle%iTrackingDomainBoundary(1) = 0
particle%iTrackingDomain(2) = ic
particle%iTrackingDomainBoundary(2) = 0
particle%iTrackingDomain(3) = 0
particle%iTrackingDomainBoundary(3) = 0
particle%idomain(0) = 0
particle%iboundary(0) = 0
particle%idomain(1) = 0
particle%iboundary(1) = 0
particle%idomain(2) = ic
particle%iboundary(2) = 0
particle%idomain(3) = 0
particle%iboundary(3) = 0

! -- Add particle to particle list
call this%particles%update_from_particle(particle, np)
Expand Down
8 changes: 4 additions & 4 deletions src/Solution/ParticleTracker/Method.f90
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ recursive subroutine track(this, particle, level, tmax)
end subroutine track

!> @brief Try passing the particle to the next subdomain
subroutine try_pass(this, particle, levelNext, advancing)
subroutine try_pass(this, particle, next_level, advancing)
class(MethodType), intent(inout) :: this
type(ParticleType), pointer, intent(inout) :: particle
integer :: levelNext
integer :: next_level
logical :: advancing

! tracking submethod marked tracking complete?
! reset domain boundary flag and don't advance
if (.not. particle%advancing) then
particle%iTrackingDomainBoundary = 0
particle%iboundary = 0
advancing = .false.
else
! otherwise pass particle to next subdomain
! and if it's on a boundary, stop advancing
call this%pass(particle)
if (particle%iTrackingDomainBoundary(levelNext - 1) .ne. 0) &
if (particle%iboundary(next_level - 1) .ne. 0) &
advancing = .false.
end if
end subroutine try_pass
Expand Down
2 changes: 1 addition & 1 deletion src/Solution/ParticleTracker/MethodCellPassToBot.f90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ subroutine apply_ptb(this, particle, tmax)
call this%update(particle, this%defn)
if (.not. particle%advancing) return
particle%z = this%defn%bot
particle%iTrackingDomainBoundary(2) = this%defn%npolyverts + 2
particle%iboundary(2) = this%defn%npolyverts + 2
call this%trackctl%save(particle, kper=kper, &
kstp=kstp, reason=1) ! reason=1: cell transition
end subroutine apply_ptb
Expand Down
13 changes: 6 additions & 7 deletions src/Solution/ParticleTracker/MethodCellPollock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ subroutine load_mcp(this, particle, next_level, submethod)

select type (subcell => this%subcell)
type is (SubcellRectType)
call this%load_subcell(particle, next_level, subcell)
call this%load_subcell(particle, subcell)
end select
call method_subcell_plck%init(subcell=this%subcell, trackctl=this%trackctl)
submethod => method_subcell_plck
particle%idomain(next_level) = 1
end subroutine load_mcp

!> @brief Having exited the lone subcell, pass the particle to the cell face
Expand All @@ -74,7 +75,7 @@ subroutine pass_mcp(this, particle)
! -- local
integer :: exitFace, inface

exitFace = particle%iTrackingDomainBoundary(3)
exitFace = particle%iboundary(3)
! -- Map subcell exit face to cell face
select case (exitFace) ! note: exitFace uses Dave's iface convention
case (0)
Expand All @@ -93,7 +94,7 @@ subroutine pass_mcp(this, particle)
inface = 7
end select
if (inface .eq. -1) then
particle%iTrackingDomainBoundary(2) = 0
particle%iboundary(2) = 0
else
if ((inface .ge. 1) .and. (inface .le. 4)) then
! -- Account for local cell rotation
Expand All @@ -103,7 +104,7 @@ subroutine pass_mcp(this, particle)
end select
if (inface .gt. 4) inface = inface - 4
end if
particle%iTrackingDomainBoundary(2) = inface
particle%iboundary(2) = inface
end if
end subroutine pass_mcp

Expand Down Expand Up @@ -160,18 +161,16 @@ end subroutine apply_mcp

!> @brief Loads the lone rectangular subcell from the rectangular cell
!! kluge note: is levelNext needed here and in similar "load" routines???
subroutine load_subcell(this, particle, next_level, subcell) !
subroutine load_subcell(this, particle, subcell) !
! -- dummy
class(MethodCellPollockType), intent(inout) :: this
type(ParticleType), pointer, intent(inout) :: particle
integer, intent(in) :: next_level
type(SubcellRectType), intent(inout) :: subcell

select type (cell => this%cell)
type is (CellRectType)
! -- Set subcell number to 1
subcell%isubcell = 1
particle%iTrackingDomain(next_level) = 1 ! kluge note: is this the place to set this???

! -- Subcell calculations will be done in local subcell coordinates
subcell%dx = cell%dx
Expand Down
51 changes: 25 additions & 26 deletions src/Solution/ParticleTracker/MethodCellPollockQuad.f90
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subroutine load_mcpq(this, particle, next_level, submethod)

select type (subcell => this%subcell)
type is (SubcellRectType)
call this%load_subcell(particle, next_level, subcell)
call this%load_subcell(particle, subcell)
end select
call method_subcell_plck%init(subcell=this%subcell, trackctl=this%trackctl)
submethod => method_subcell_plck
Expand All @@ -75,8 +75,8 @@ subroutine pass_mcpq(this, particle)

select type (cell => this%cell)
type is (CellRectQuadType)
exitFace = particle%iTrackingDomainBoundary(3)
isc = particle%iTrackingDomain(3)
exitFace = particle%iboundary(3)
isc = particle%idomain(3)
npolyverts = cell%defn%npolyverts

select case (exitFace) ! kluge note: exitFace uses Dave's iface convention
Expand All @@ -87,13 +87,13 @@ subroutine pass_mcpq(this, particle)
select case (isc)
case (1)
! -- W face, subcell 1 --> E face, subcell 4 (cell interior)
particle%iTrackingDomain(3) = 4
particle%iTrackingDomainBoundary(3) = 2
particle%idomain(3) = 4
particle%iboundary(3) = 2
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (2)
! -- W face, subcell 2 --> E face, subcell 3 (cell interior)
particle%iTrackingDomain(3) = 3
particle%iTrackingDomainBoundary(3) = 2
particle%idomain(3) = 3
particle%iboundary(3) = 2
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (3)
! -- W face, subcell 3 (cell face)
Expand All @@ -116,21 +116,21 @@ subroutine pass_mcpq(this, particle)
infaceoff = -1
case (3)
! -- E face, subcell 3 --> W face, subcell 2 (cell interior)
particle%iTrackingDomain(3) = 2
particle%iTrackingDomainBoundary(3) = 1
particle%idomain(3) = 2
particle%iboundary(3) = 1
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (4)
! -- E face, subcell 4 --> W face subcell 1 (cell interior)
particle%iTrackingDomain(3) = 1
particle%iTrackingDomainBoundary(3) = 1
particle%idomain(3) = 1
particle%iboundary(3) = 1
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
end select
case (3)
select case (isc)
case (1)
! -- S face, subcell 1 --> N face, subcell 2 (cell interior)
particle%iTrackingDomain(3) = 2
particle%iTrackingDomainBoundary(3) = 4
particle%idomain(3) = 2
particle%iboundary(3) = 4
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (2)
! -- S face, subcell 2 (cell face)
Expand All @@ -142,8 +142,8 @@ subroutine pass_mcpq(this, particle)
infaceoff = -1
case (4)
! -- S face, subcell 4 --> N face, subcell 3 (cell interior)
particle%iTrackingDomain(3) = 3
particle%iTrackingDomainBoundary(3) = 4
particle%idomain(3) = 3
particle%iboundary(3) = 4
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
end select
case (4)
Expand All @@ -154,13 +154,13 @@ subroutine pass_mcpq(this, particle)
infaceoff = -1
case (2)
! -- N face, subcell 2 --> S face, subcell 1 (cell interior)
particle%iTrackingDomain(3) = 1
particle%iTrackingDomainBoundary(3) = 3
particle%idomain(3) = 1
particle%iboundary(3) = 3
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (3)
! -- N face, subcell 3 --> S face, subcell 4 (cell interior)
particle%iTrackingDomain(3) = 4
particle%iTrackingDomainBoundary(3) = 3
particle%idomain(3) = 4
particle%iboundary(3) = 3
inface = 0 ! kluge note: want Domain(2) unchanged; Boundary(2) = 0
case (4)
! -- N face, subcell 4 (cell face)
Expand All @@ -175,9 +175,9 @@ subroutine pass_mcpq(this, particle)
inface = npolyverts + 3 ! kluge note: want Domain(2) = -Domain(2); Boundary(2) = inface
end select
if (inface .eq. -1) then
particle%iTrackingDomainBoundary(2) = 0
particle%iboundary(2) = 0
else if (inface .eq. 0) then
particle%iTrackingDomainBoundary(2) = 0
particle%iboundary(2) = 0
else
if ((inface .ge. 1) .and. (inface .le. 4)) then
! -- Account for local cell rotation
Expand All @@ -186,7 +186,7 @@ subroutine pass_mcpq(this, particle)
inface = cell%irectvert(inface) + infaceoff
if (inface .lt. 1) inface = inface + npolyverts
end if
particle%iTrackingDomainBoundary(2) = inface
particle%iboundary(2) = inface
end if
end select
end subroutine pass_mcpq
Expand Down Expand Up @@ -236,11 +236,10 @@ subroutine apply_mcpq(this, particle, tmax)
end subroutine apply_mcpq

!> @brief Load the rectangular subcell from the rectangular cell
subroutine load_subcell(this, particle, next_level, subcell)
subroutine load_subcell(this, particle, subcell)
! -- dummy
class(MethodCellPollockQuadType), intent(inout) :: this
type(ParticleType), pointer, intent(inout) :: particle
integer, intent(in) :: next_level
class(SubcellRectType), intent(inout) :: subcell
! -- local
double precision :: dx, dy, dz, areax, areay, areaz
Expand All @@ -255,7 +254,7 @@ subroutine load_subcell(this, particle, next_level, subcell)
factor = factor / cell%defn%porosity
npolyverts = cell%defn%npolyverts

isc = particle%iTrackingDomain(3)
isc = particle%idomain(3)
! -- Subcells 1, 2, 3, and 4 are Pollock's subcells A, B, C, and D,
! -- respectively

Expand Down Expand Up @@ -290,7 +289,7 @@ subroutine load_subcell(this, particle, next_level, subcell)
subcell%isubcell = isc
! kluge note: as a matter of form, do we want to allow
! this subroutine to modify the particle???
particle%iTrackingDomain(3) = isc
particle%idomain(3) = isc
! kluge note: initial insubface is not currently being determined
end if
dx = 5d-1 * dx
Expand Down
33 changes: 15 additions & 18 deletions src/Solution/ParticleTracker/MethodCellTernary.f90
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ subroutine load_mct(this, particle, next_level, submethod)

select type (subcell => this%subcell)
type is (SubcellTriType)
call this%load_subcell(particle, next_level, subcell)
call this%load_subcell(particle, subcell)
end select
call method_subcell_tern%init(subcell=this%subcell, trackctl=this%trackctl)
submethod => method_subcell_tern
Expand All @@ -81,8 +81,8 @@ subroutine pass_mct(this, particle)
! local
integer :: isc, exitFace, inface, npolyverts

exitFace = particle%iTrackingDomainBoundary(3)
isc = particle%iTrackingDomain(3)
exitFace = particle%iboundary(3)
isc = particle%idomain(3)
select type (cell => this%cell)
type is (CellPolyType)
npolyverts = cell%defn%npolyverts
Expand All @@ -100,15 +100,15 @@ subroutine pass_mct(this, particle)
! -- Subcell face --> next subcell in "cycle" (cell interior)
isc = isc + 1
if (isc .gt. npolyverts) isc = 1
particle%iTrackingDomain(3) = isc
particle%iTrackingDomainBoundary(3) = 3
particle%idomain(3) = isc
particle%iboundary(3) = 3
inface = 0
case (3)
! -- Subcell face --> preceding subcell in "cycle" (cell interior)
isc = isc - 1
if (isc .lt. 1) isc = npolyverts
particle%iTrackingDomain(3) = isc
particle%iTrackingDomainBoundary(3) = 2
particle%idomain(3) = isc
particle%iboundary(3) = 2
inface = 0
case (4)
! -- Subcell bottom (cell bottom)
Expand All @@ -118,11 +118,11 @@ subroutine pass_mct(this, particle)
inface = npolyverts + 3
end select
if (inface .eq. -1) then
particle%iTrackingDomainBoundary(2) = 0
particle%iboundary(2) = 0
else if (inface .eq. 0) then
particle%iTrackingDomainBoundary(2) = 0
particle%iboundary(2) = 0
else
particle%iTrackingDomainBoundary(2) = inface
particle%iboundary(2) = inface
end if
end subroutine pass_mct

Expand Down Expand Up @@ -228,14 +228,13 @@ subroutine apply_mct(this, particle, tmax)
end select
end subroutine apply_mct

!> @brief Loads the triangular subcell from the polygonal cell
subroutine load_subcell(this, particle, next_level, subcell)
!> @brief Loads a triangular subcell from the polygonal cell
subroutine load_subcell(this, particle, subcell)
! -- modules
use ParticleModule, only: get_particle_id
! -- dummy
class(MethodCellTernaryType), intent(inout) :: this
type(ParticleType), pointer, intent(inout) :: particle
integer, intent(in) :: next_level
class(SubcellTriType), intent(inout) :: subcell
! -- local
integer :: ic, isc, npolyverts
Expand All @@ -249,10 +248,8 @@ subroutine load_subcell(this, particle, next_level, subcell)
type is (CellPolyType)
ic = cell%defn%icell
subcell%icell = ic
isc = particle%iTrackingDomain(3)
isc = particle%idomain(3)
npolyverts = cell%defn%npolyverts

! -- Find subcell if not known ! kluge note: from "find_init_triangle", todo: move there
if (isc .le. 0) then
xi = particle%x
yi = particle%y
Expand All @@ -279,7 +276,7 @@ subroutine load_subcell(this, particle, next_level, subcell)
d01 = x0 * y1rel - y0 * x1rel
alphai = (di2 - d02) / d12
betai = -(di1 - d01) / d12
! kluge note: can iTrackingDomainBoundary(2) be used to identify the subcell?
! kluge note: can iboundary(2) be used to identify the subcell?
betatol = -1e-7 ! kluge
! kluge note: think this handles points on triangle boundaries ok
if ((alphai .ge. 0d0) .and. &
Expand All @@ -297,7 +294,7 @@ subroutine load_subcell(this, particle, next_level, subcell)
! subcellTri%isubcell = isc
! kluge note: as a matter of form, do we want to allow
! this subroutine to modify the particle???
particle%iTrackingDomain(3) = isc
particle%idomain(3) = isc
end if
end if
subcell%isubcell = isc
Expand Down
Loading

0 comments on commit 5ce7ead

Please sign in to comment.