Check a number of conditions determining whether to continue tracking the particle or terminate it, as well as whether to record any output data as per selected reporting conditions.
79
84
85 class(MethodCellType), intent(inout) :: this
86 type(ParticleType), pointer, intent(inout) :: particle
87 type(CellDefnType), pointer, intent(inout) :: cell_defn
88 real(DP), intent(in) :: tmax
89
90 logical(LGP) :: dry_cell, dry_particle, no_exit_face, stop_zone, weak_sink
91 integer(I4B) :: i
92 real(DP) :: t, ttrackmax
93
94 dry_cell = cell_defn%isatstat == saturation_dry
95 dry_particle = particle%z > cell_defn%top
96 no_exit_face = cell_defn%inoexitface > 0
97 stop_zone = cell_defn%izone > 0 .and. particle%istopzone == cell_defn%izone
98 weak_sink = cell_defn%iweaksink > 0
99
100 particle%izone = cell_defn%izone
101 if (stop_zone) then
103 return
104 end if
105
106 if (no_exit_face .and. .not. dry_cell) then
108 return
109 end if
110
111 if (weak_sink) then
112 if (particle%istopweaksink > 0) then
114 return
115 else
116 call this%weaksink(particle)
117 end if
118 end if
119
120 if (dry_cell) then
121 if (particle%idrymeth == 0) then
122
123
124 no_exit_face = .false.
125 else if (particle%idrymeth == 1) then
126
128 return
129 else if (particle%idrymeth == 2) then
130
131 particle%advancing = .false.
132 no_exit_face = .false.
133
134
135
136
137
138
139
141
142
143
144 particle%ttrack =
totim
145 call this%timestep(particle)
146
147
148 call this%tracktimes%advance()
149 if (this%tracktimes%any()) then
150 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
151 t = this%tracktimes%times(i)
153 if (t > tmax) exit
154 particle%ttrack = t
155 call this%usertime(particle)
156 if (t > ttrackmax) ttrackmax = t
157 end do
158 end if
159
160
162 particle%ttrack = ttrackmax
164 return
165 end if
166 end if
167 else if (dry_particle .and. this%name /= "passtobottom") then
168 if (particle%idrymeth == 0) then
169
170 particle%z = cell_defn%top
171 call this%dropped(particle)
172 else if (particle%idrymeth == 1) then
173
175 return
176 else if (particle%idrymeth == 2) then
177
178 particle%advancing = .false.
179 no_exit_face = .false.
180
181
182
183
184
185
186
188
189
190
191 particle%ttrack =
totim
192 call this%timestep(particle)
193
194
195 call this%tracktimes%advance()
196 if (this%tracktimes%any()) then
197 do i = this%tracktimes%selection(1), this%tracktimes%selection(2)
198 t = this%tracktimes%times(i)
200 if (t > tmax) exit
201 particle%ttrack = t
202 call this%usertime(particle)
203 if (t > ttrackmax) ttrackmax = t
204 end do
205 end if
206 end if
207 end if
208
209 if (no_exit_face) then
210 particle%advancing = .false.
212 call this%terminate(particle)
213 return
214 end if
215
@ usertime
user-specified tracking time
@ terminate
particle terminated
@ timestep
time step ended
@ weaksink
particle entered a weak sink
@ 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
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