Skip to content

Commit 5c12c08

Browse files
committed
wip
1 parent d961a92 commit 5c12c08

File tree

5 files changed

+45
-26
lines changed

5 files changed

+45
-26
lines changed

src/Model/ParticleTracking/prt.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ subroutine prt_solve(this)
962962
! Reset previous cell, subcell, and zone numbers
963963
particle%icp = 0
964964
particle%iscp = 0
965+
particle%iscefp = 0
965966
particle%izp = 0
966967

967968
! Update particle storage

src/Solution/ParticleTracker/Method.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ subroutine check(this, particle, cell_defn)
267267
! dry particle
268268
if (particle%idrymeth == 0) then
269269
! drop to water table
270+
print *, "dropping"
270271
particle%z = cell_defn%top
271272
call this%save(particle, reason=1)
272273
else if (particle%idrymeth == 1) then

src/Solution/ParticleTracker/MethodCellTernary.f90

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module MethodCellTernaryModule
22

3-
use KindModule, only: DP, I4B
3+
use KindModule, only: DP, I4B, LGP
44
use ErrorUtilModule, only: pstop
55
use MethodModule
66
use MethodSubcellPoolModule
@@ -85,18 +85,6 @@ subroutine load_mct(this, particle, next_level, submethod)
8585
select type (subcell => this%subcell)
8686
type is (SubcellTriType)
8787
call this%load_subcell(particle, subcell)
88-
89-
! don't allow a particle to return to the
90-
! subcell it was just in
91-
! if (subcell%isubcell /= 0 .and. subcell%isubcell == particle%iscp) then
92-
! print *, '---', subcell%isubcell
93-
! particle%advancing = .false.
94-
! particle%idomain(3) = particle%iscp
95-
! particle%istatus = 2
96-
! call this%save(particle, reason=3)
97-
! else
98-
! particle%iscp = particle%idomain(3)
99-
! end if
10088
end select
10189

10290
call method_subcell_tern%init( &
@@ -150,6 +138,19 @@ subroutine pass_mct(this, particle)
150138
! Subcell top (cell top)
151139
inface = this%nverts + 3
152140
end select
141+
142+
print *, "--------", isc, particle%iscp, exitFace, particle%iscefp
143+
! if (inface /= exitFace .and. isc == particle%iscp .and. exitFace == particle%iscefp) then
144+
! print *, 'subcell cycle, terminating'
145+
! particle%advancing = .false.
146+
! particle%idomain(3) = particle%iscp
147+
! particle%istatus = 2
148+
! call this%save(particle, reason=3)
149+
! else
150+
! particle%iscp = particle%idomain(3)
151+
! particle%iscefp = exitFace
152+
! end if
153+
153154
if (inface .eq. -1) then
154155
particle%iboundary(2) = 0
155156
else if (inface .eq. 0) then

src/Solution/ParticleTracker/MethodSubcellTernary.f90

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,13 @@ subroutine track_subcell(this, subcell, particle, tmax)
215215
! considering only the velocity component in the direction of
216216
! the face. Then compute the particle's exit time.
217217
if (itrifaceexit /= 0) then
218+
print *, "exit thru side"
218219
! Exit through lateral subcell face
219220
exitFace = itrifaceexit
220221
dtexit = dtexitxy
221222
else if (dtexitz < dtexitxy) then
222223
! Exit through top or bottom
224+
print *, "exit thru top or bottom"
223225
if (itopbotexit == -1) then
224226
exitFace = 4
225227
else
@@ -230,6 +232,16 @@ subroutine track_subcell(this, subcell, particle, tmax)
230232
texit = particle%ttrack + dtexit
231233
t0 = particle%ttrack
232234

235+
! ! don't allow a particle to return to the subcell was just in
236+
! if (particle%idomain(2) == particle%icp .and. particle%idomain(3) == particle%iscp) then
237+
! print *, "isc: ", particle%idomain(3)
238+
! particle%idomain(3) = particle%iscp
239+
! particle%istatus = 5
240+
! particle%advancing = .false.
241+
! call this%save(particle, reason=3)
242+
! return
243+
! end if
244+
233245
! Select user tracking times to solve. If this is the first time step
234246
! of the simulation, include all times before it begins; if it is the
235247
! last time step include all times after it ends only if the 'extend'
@@ -253,6 +265,12 @@ subroutine track_subcell(this, subcell, particle, tmax)
253265
end do
254266
end if
255267

268+
! if (izstatus > 1) then
269+
! particle%istatus = izstatus
270+
! particle%advancing = .false.
271+
! reason = 3
272+
! end if
273+
256274
! Compute exit time and face and update the particle's coordinates
257275
! (local, unscaled) and other properties. The particle may at this
258276
! point lie on a boundary of the subcell or may still be within it.
@@ -265,7 +283,6 @@ subroutine track_subcell(this, subcell, particle, tmax)
265283
particle%istatus = 1
266284
particle%advancing = .false.
267285
reason = 2 ! timestep end
268-
print *, "end of time step"
269286
else
270287
! -- The computed exit time is less than or equal to the maximum time,
271288
! -- so set final time for particle trajectory equal to exit time.
@@ -281,6 +298,13 @@ subroutine track_subcell(this, subcell, particle, tmax)
281298
particle%z = z
282299
particle%ttrack = t
283300
particle%iboundary(3) = exitFace
301+
302+
! save previous subcell id and exit face
303+
particle%iscp = particle%idomain(3)
304+
particle%iscefp = particle%iboundary(3)
305+
print *, "exit face: ", particle%iboundary(3)
306+
print *, "subcell: ", particle%idomain(3)
307+
284308
call this%save(particle, reason=reason)
285309
end subroutine track_subcell
286310

src/Solution/ParticleTracker/Particle.f90

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ module ParticleModule
4646
integer(I4B), allocatable, public :: iboundary(:) !< tracking domain boundaries
4747
integer(I4B), public :: icp !< previous cell number (reduced)
4848
integer(I4B), public :: iscp !< previous subcell number
49+
integer(I4B), public :: iscefp !< previous subcell exit face
4950
integer(I4B), public :: icu !< user cell number
5051
integer(I4B), public :: ilay !< grid layer
5152
integer(I4B), public :: izone !< current zone number
@@ -90,8 +91,6 @@ module ParticleModule
9091
! state
9192
integer(I4B), dimension(:, :), pointer, public, contiguous :: idomain !< array of indices for domains in the tracking domain hierarchy
9293
integer(I4B), dimension(:, :), pointer, public, contiguous :: iboundary !< array of indices for tracking domain boundaries
93-
integer(I4B), dimension(:), pointer, public, contiguous :: icp !< previous cell number (reduced)
94-
integer(I4B), dimension(:), pointer, public, contiguous :: iscp !< previous subcell number
9594
integer(I4B), dimension(:), pointer, public, contiguous :: icu !< cell number (user)
9695
integer(I4B), dimension(:), pointer, public, contiguous :: ilay !< layer
9796
integer(I4B), dimension(:), pointer, public, contiguous :: izone !< current zone number
@@ -135,8 +134,6 @@ subroutine allocate_particle_store(this, np, mempath)
135134
call mem_allocate(this%irpt, np, 'PLIRPT', mempath)
136135
call mem_allocate(this%iprp, np, 'PLIPRP', mempath)
137136
call mem_allocate(this%name, LENBOUNDNAME, np, 'PLNAME', mempath)
138-
call mem_allocate(this%icp, np, 'PLICP', mempath)
139-
call mem_allocate(this%iscp, np, 'PLISCP', mempath)
140137
call mem_allocate(this%icu, np, 'PLICU', mempath)
141138
call mem_allocate(this%ilay, np, 'PLILAY', mempath)
142139
call mem_allocate(this%izone, np, 'PLIZONE', mempath)
@@ -168,8 +165,6 @@ subroutine deallocate (this, mempath)
168165
call mem_deallocate(this%iprp, 'PLIPRP', mempath)
169166
call mem_deallocate(this%irpt, 'PLIRPT', mempath)
170167
call mem_deallocate(this%name, 'PLNAME', mempath)
171-
call mem_deallocate(this%icp, 'PLICP', mempath)
172-
call mem_deallocate(this%iscp, 'PLISCP', mempath)
173168
call mem_deallocate(this%icu, 'PLICU', mempath)
174169
call mem_deallocate(this%ilay, 'PLILAY', mempath)
175170
call mem_deallocate(this%izone, 'PLIZONE', mempath)
@@ -204,8 +199,6 @@ subroutine resize(this, np, mempath)
204199
call mem_reallocate(this%iprp, np, 'PLIPRP', mempath)
205200
call mem_reallocate(this%irpt, np, 'PLIRPT', mempath)
206201
call mem_reallocate(this%name, LENBOUNDNAME, np, 'PLNAME', mempath)
207-
call mem_reallocate(this%icp, np, 'PLICP', mempath)
208-
call mem_reallocate(this%iscp, np, 'PLISCP', mempath)
209202
call mem_reallocate(this%icu, np, 'PLICU', mempath)
210203
call mem_reallocate(this%ilay, np, 'PLILAY', mempath)
211204
call mem_reallocate(this%izone, np, 'PLIZONE', mempath)
@@ -249,8 +242,9 @@ subroutine load_particle(this, store, imdl, iprp, ip)
249242
this%istopweaksink = store%istopweaksink(ip)
250243
this%istopzone = store%istopzone(ip)
251244
this%idrymeth = store%idrymeth(ip)
252-
this%icp = store%icp(ip)
253-
this%iscp = store%iscp(ip)
245+
this%icp = 0
246+
this%iscp = 0
247+
this%iscefp = 0
254248
this%icu = store%icu(ip)
255249
this%ilay = store%ilay(ip)
256250
this%izone = store%izone(ip)
@@ -287,8 +281,6 @@ subroutine save_particle(this, particle, ip)
287281
this%istopweaksink(ip) = particle%istopweaksink
288282
this%istopzone(ip) = particle%istopzone
289283
this%idrymeth(ip) = particle%idrymeth
290-
this%icp(ip) = particle%icp
291-
this%iscp(ip) = particle%iscp
292284
this%icu(ip) = particle%icu
293285
this%ilay(ip) = particle%ilay
294286
this%izone(ip) = particle%izone

0 commit comments

Comments
 (0)