29 subroutine try_pass(this, particle, nextlevel, advancing)
32 integer(I4B) :: nextlevel
33 logical(LGP) :: advancing
35 if (particle%advancing)
then
39 call this%pass(particle)
40 if (particle%iboundary(nextlevel - 1) .ne. 0)
then
42 call this%cellexit(particle)
48 particle%iboundary = 0
59 subroutine assess(this, particle, cell_defn, tmax)
69 real(DP),
intent(in) :: tmax
71 logical(LGP) :: dry_cell, dry_particle, no_exit_face, stop_zone, weak_sink
73 real(DP) :: t, ttrackmax
75 dry_cell = this%fmi%ibdgwfsat0(cell_defn%icell) == 0
76 dry_particle = particle%z > cell_defn%top
77 no_exit_face = cell_defn%inoexitface > 0
78 stop_zone = cell_defn%izone > 0 .and. particle%istopzone == cell_defn%izone
79 weak_sink = cell_defn%iweaksink > 0
81 particle%izone = cell_defn%izone
87 if (no_exit_face .and. .not. dry_cell)
then
93 if (particle%istopweaksink > 0)
then
97 call this%weaksink(particle)
102 if (particle%idrymeth == 0)
then
105 no_exit_face = .false.
106 else if (particle%idrymeth == 1)
then
110 else if (particle%idrymeth == 2)
then
112 particle%advancing = .false.
113 no_exit_face = .false.
125 particle%ttrack =
totim
126 call this%timestep(particle)
129 call this%tracktimes%advance()
130 if (this%tracktimes%any())
then
131 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
132 t = this%tracktimes%times(i)
136 call this%usertime(particle)
137 if (t > ttrackmax) ttrackmax = t
143 particle%ttrack = ttrackmax
148 else if (dry_particle .and. this%name /=
"passtobottom")
then
149 if (particle%idrymeth == 0)
then
151 particle%z = cell_defn%top
152 else if (particle%idrymeth == 1)
then
156 else if (particle%idrymeth == 2)
then
158 particle%advancing = .false.
159 no_exit_face = .false.
171 particle%ttrack =
totim
172 call this%timestep(particle)
175 call this%tracktimes%advance()
176 if (this%tracktimes%any())
then
177 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
178 t = this%tracktimes%times(i)
182 call this%usertime(particle)
183 if (t > ttrackmax) ttrackmax = t
189 if (no_exit_face)
then
190 particle%advancing = .false.
192 call this%terminate(particle)
204 integer(I4B) :: i, nhist
205 class(*),
pointer :: prev
212 call this%events%dispatch(particle, event)
213 if (particle%icycwin == 0)
then
217 if (this%forms_cycle(particle, event))
then
219 print *,
"Cyclic pathline detected"
220 nhist = particle%history%Count()
222 prev => particle%history%GetItem(i)
225 print *,
"Back ", nhist - i + 1,
": ", prev%get_text()
228 print *,
"Current :", event%get_text()
229 call pstop(1,
'Cyclic pathline detected, aborting')
231 call this%store_event(particle, event)
243 logical(LGP) :: found_cycle
245 found_cycle = .false.
248 itr = particle%history%Iterator()
249 do while (itr%has_next())
251 select type (prev => itr%value())
253 if (event%icu == prev%icu .and. &
254 event%ilay == prev%ilay .and. &
255 event%izone == prev%izone .and. &
256 event%exit_face == prev%exit_face .and. &
257 event%exit_face /= 0)
then
275 class(*),
pointer :: p
280 call particle%history%Add(p)
281 if (particle%history%Count() > particle%icycwin) &
282 call particle%history%RemoveNode(1, .true.)
289 integer(I4B) :: level
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.
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.