37 subroutine try_pass(this, particle, nextlevel, advancing)
40 logical(LGP) :: advancing
41 integer(I4B) :: nextlevel
43 integer(I4B) :: ic, iboundary, icellface
45 if (.not. particle%advancing)
then
47 particle%iboundary = 0
51 call this%pass(particle)
54 icellface = this%iboundary_to_icellface(iboundary)
55 if (icellface <= 0)
return
59 call this%cellexit(particle)
63 if (this%fmi%is_net_out_boundary_face(ic, icellface))
then
77 subroutine assess(this, particle, cell_defn, tmax)
87 real(DP),
intent(in) :: tmax
89 logical(LGP) :: dry_cell, dry_particle, no_exit_face, stop_zone, weak_sink
91 real(DP) :: t, ttrackmax
94 dry_particle = particle%z > cell_defn%top
95 no_exit_face = cell_defn%inoexitface > 0
96 stop_zone = cell_defn%izone > 0 .and. particle%istopzone == cell_defn%izone
97 weak_sink = cell_defn%iweaksink > 0
99 particle%izone = cell_defn%izone
105 if (no_exit_face .and. .not. dry_cell)
then
111 if (particle%istopweaksink > 0)
then
115 call this%weaksink(particle)
120 if (particle%idrymeth == 0)
then
123 no_exit_face = .false.
124 else if (particle%idrymeth == 1)
then
128 else if (particle%idrymeth == 2)
then
130 particle%advancing = .false.
131 no_exit_face = .false.
143 particle%ttrack =
totim
144 call this%timestep(particle)
147 call this%tracktimes%advance()
148 if (this%tracktimes%any())
then
149 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
150 t = this%tracktimes%times(i)
154 call this%usertime(particle)
155 if (t > ttrackmax) ttrackmax = t
161 particle%ttrack = ttrackmax
166 else if (dry_particle .and. this%name /=
"passtobottom")
then
167 if (particle%idrymeth == 0)
then
169 particle%z = cell_defn%top
170 call this%dropped(particle)
171 else if (particle%idrymeth == 1)
then
175 else if (particle%idrymeth == 2)
then
177 particle%advancing = .false.
178 no_exit_face = .false.
190 particle%ttrack =
totim
191 call this%timestep(particle)
194 call this%tracktimes%advance()
195 if (this%tracktimes%any())
then
196 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
197 t = this%tracktimes%times(i)
201 call this%usertime(particle)
202 if (t > ttrackmax) ttrackmax = t
208 if (no_exit_face)
then
209 particle%advancing = .false.
211 call this%terminate(particle)
223 integer(I4B) :: i, nhist
224 class(*),
pointer :: prev
231 call this%events%dispatch(particle, event)
232 if (particle%icycwin == 0)
then
236 if (this%forms_cycle(particle, event))
then
238 print *,
"Cyclic pathline detected"
239 nhist = particle%history%Count()
241 prev => particle%history%GetItem(i)
244 print *,
"Back ", nhist - i + 1,
": ", prev%get_text()
247 print *,
"Current :", event%get_text()
248 call pstop(1,
'Cyclic pathline detected, aborting')
250 call this%store_event(particle, event)
262 logical(LGP) :: found_cycle
264 found_cycle = .false.
267 itr = particle%history%Iterator()
268 do while (itr%has_next())
270 select type (prev => itr%value())
272 if (event%icu == prev%icu .and. &
273 event%ilay == prev%ilay .and. &
274 event%izone == prev%izone .and. &
275 event%exit_face == prev%exit_face .and. &
276 event%exit_face /= 0)
then
294 class(*),
pointer :: p
299 call particle%history%Add(p)
300 if (particle%history%Count() > particle%icycwin) &
301 call particle%history%RemoveNode(1, .true.)
308 integer(I4B) :: level
315 integer(I4B),
intent(in) :: iboundary
316 integer(I4B) :: iface
317 integer(I4B) :: nfaces
320 nfaces = this%cell%defn%npolyverts + 2
321 if (iface >= nfaces) &
323 iface = iface + (this%fmi%max_faces - nfaces) - 1
This module contains simulation constants.
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
This module defines variable data types.
logical(lgp) function forms_cycle(this, particle, event)
Check if the event forms a cycle in the particle path.
subroutine try_pass(this, particle, nextlevel, advancing)
Try passing the particle to the next subdomain. or to a boundary of this method's tracking domain.
integer(i4b) function iboundary_to_icellface(this, iboundary)
Convert an iboundary number to an iface number.
subroutine store_event(this, particle, event)
Save the event in the particle's history. Acts like a queue, the oldest event is removed when the eve...
subroutine cellexit(this, particle)
Particle exits a cell.
integer(i4b) function get_level(this)
Get the cell method's level.
Particle tracking strategies.
@, public weaksink
particle entered a weak sink
@, public usertime
user-specified tracking time
@, public terminate
particle terminated
@, public timestep
time step ended
@ term_weaksink
terminated in a weak sink cell
@ term_inactive
terminated in an inactive cell
@ term_no_exits
terminated in a cell with no exit face
@ term_stopzone
terminated in a cell with a stop zone number
@ term_boundary
terminated at a boundary face
logical(lgp), pointer, public endofsimulation
flag indicating end of simulation
real(dp), pointer, public totim
time relative to start of simulation
real(dp), pointer, public totimc
simulation time at start of time step
Base grid cell definition.
Base type for particle tracking methods.
Base type for particle events.
Particle tracked by the PRT model.