Skip to content

Commit 9cc3d7a

Browse files
committed
add track file type hierarchy, subscription-based event selection
1 parent d44af13 commit 9cc3d7a

11 files changed

Lines changed: 339 additions & 111 deletions

File tree

-4.59 KB
Binary file not shown.
-4.59 KB
Binary file not shown.

src/Idm/prt-prpidm.f90

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ module PrtPrpInputModule
2525
logical :: trackcsvfr = .false.
2626
logical :: trackcsv = .false.
2727
logical :: trackcsvfile = .false.
28+
logical :: track_release = .false.
29+
logical :: track_exit = .false.
30+
logical :: track_subf_exit = .false.
31+
logical :: track_timestep = .false.
32+
logical :: track_terminate = .false.
33+
logical :: track_weaksink = .false.
34+
logical :: track_usertime = .false.
35+
logical :: track_dropped = .false.
2836
logical :: stoptime = .false.
2937
logical :: stoptraveltime = .false.
3038
logical :: istopweaksink = .false.
@@ -314,6 +322,158 @@ module PrtPrpInputModule
314322
.false. & ! timeseries
315323
)
316324

325+
type(InputParamDefinitionType), parameter :: &
326+
prtprp_track_release = InputParamDefinitionType &
327+
( &
328+
'PRT', & ! component
329+
'PRP', & ! subcomponent
330+
'OPTIONS', & ! block
331+
'TRACK_RELEASE', & ! tag name
332+
'TRACK_RELEASE', & ! fortran variable
333+
'KEYWORD', & ! type
334+
'', & ! shape
335+
'track release events', & ! longname
336+
.false., & ! required
337+
.false., & ! developmode
338+
.false., & ! multi-record
339+
.false., & ! preserve case
340+
.false., & ! layered
341+
.false. & ! timeseries
342+
)
343+
344+
type(InputParamDefinitionType), parameter :: &
345+
prtprp_track_exit = InputParamDefinitionType &
346+
( &
347+
'PRT', & ! component
348+
'PRP', & ! subcomponent
349+
'OPTIONS', & ! block
350+
'TRACK_EXIT', & ! tag name
351+
'TRACK_EXIT', & ! fortran variable
352+
'KEYWORD', & ! type
353+
'', & ! shape
354+
'track grid feature exit events', & ! longname
355+
.false., & ! required
356+
.false., & ! developmode
357+
.false., & ! multi-record
358+
.false., & ! preserve case
359+
.false., & ! layered
360+
.false. & ! timeseries
361+
)
362+
363+
type(InputParamDefinitionType), parameter :: &
364+
prtprp_track_subf_exit = InputParamDefinitionType &
365+
( &
366+
'PRT', & ! component
367+
'PRP', & ! subcomponent
368+
'OPTIONS', & ! block
369+
'TRACK_SUBFEATURE_EXIT', & ! tag name
370+
'TRACK_SUBF_EXIT', & ! fortran variable
371+
'KEYWORD', & ! type
372+
'', & ! shape
373+
'track sub-grid-scale feature exit events', & ! longname
374+
.false., & ! required
375+
.false., & ! developmode
376+
.false., & ! multi-record
377+
.false., & ! preserve case
378+
.false., & ! layered
379+
.false. & ! timeseries
380+
)
381+
382+
type(InputParamDefinitionType), parameter :: &
383+
prtprp_track_timestep = InputParamDefinitionType &
384+
( &
385+
'PRT', & ! component
386+
'PRP', & ! subcomponent
387+
'OPTIONS', & ! block
388+
'TRACK_TIMESTEP', & ! tag name
389+
'TRACK_TIMESTEP', & ! fortran variable
390+
'KEYWORD', & ! type
391+
'', & ! shape
392+
'track timestep end events', & ! longname
393+
.false., & ! required
394+
.false., & ! developmode
395+
.false., & ! multi-record
396+
.false., & ! preserve case
397+
.false., & ! layered
398+
.false. & ! timeseries
399+
)
400+
401+
type(InputParamDefinitionType), parameter :: &
402+
prtprp_track_terminate = InputParamDefinitionType &
403+
( &
404+
'PRT', & ! component
405+
'PRP', & ! subcomponent
406+
'OPTIONS', & ! block
407+
'TRACK_TERMINATE', & ! tag name
408+
'TRACK_TERMINATE', & ! fortran variable
409+
'KEYWORD', & ! type
410+
'', & ! shape
411+
'track termination events', & ! longname
412+
.false., & ! required
413+
.false., & ! developmode
414+
.false., & ! multi-record
415+
.false., & ! preserve case
416+
.false., & ! layered
417+
.false. & ! timeseries
418+
)
419+
420+
type(InputParamDefinitionType), parameter :: &
421+
prtprp_track_weaksink = InputParamDefinitionType &
422+
( &
423+
'PRT', & ! component
424+
'PRP', & ! subcomponent
425+
'OPTIONS', & ! block
426+
'TRACK_WEAKSINK', & ! tag name
427+
'TRACK_WEAKSINK', & ! fortran variable
428+
'KEYWORD', & ! type
429+
'', & ! shape
430+
'track weak sink exit events', & ! longname
431+
.false., & ! required
432+
.false., & ! developmode
433+
.false., & ! multi-record
434+
.false., & ! preserve case
435+
.false., & ! layered
436+
.false. & ! timeseries
437+
)
438+
439+
type(InputParamDefinitionType), parameter :: &
440+
prtprp_track_usertime = InputParamDefinitionType &
441+
( &
442+
'PRT', & ! component
443+
'PRP', & ! subcomponent
444+
'OPTIONS', & ! block
445+
'TRACK_USERTIME', & ! tag name
446+
'TRACK_USERTIME', & ! fortran variable
447+
'KEYWORD', & ! type
448+
'', & ! shape
449+
'track user-specified time events', & ! longname
450+
.false., & ! required
451+
.false., & ! developmode
452+
.false., & ! multi-record
453+
.false., & ! preserve case
454+
.false., & ! layered
455+
.false. & ! timeseries
456+
)
457+
458+
type(InputParamDefinitionType), parameter :: &
459+
prtprp_track_dropped = InputParamDefinitionType &
460+
( &
461+
'PRT', & ! component
462+
'PRP', & ! subcomponent
463+
'OPTIONS', & ! block
464+
'TRACK_DROPPED', & ! tag name
465+
'TRACK_DROPPED', & ! fortran variable
466+
'KEYWORD', & ! type
467+
'', & ! shape
468+
'track water table drop events', & ! longname
469+
.false., & ! required
470+
.false., & ! developmode
471+
.false., & ! multi-record
472+
.false., & ! preserve case
473+
.false., & ! layered
474+
.false. & ! timeseries
475+
)
476+
317477
type(InputParamDefinitionType), parameter :: &
318478
prtprp_stoptime = InputParamDefinitionType &
319479
( &
@@ -938,6 +1098,14 @@ module PrtPrpInputModule
9381098
prtprp_trackcsvfr, &
9391099
prtprp_trackcsv, &
9401100
prtprp_trackcsvfile, &
1101+
prtprp_track_release, &
1102+
prtprp_track_exit, &
1103+
prtprp_track_subf_exit, &
1104+
prtprp_track_timestep, &
1105+
prtprp_track_terminate, &
1106+
prtprp_track_weaksink, &
1107+
prtprp_track_usertime, &
1108+
prtprp_track_dropped, &
9411109
prtprp_stoptime, &
9421110
prtprp_stoptraveltime, &
9431111
prtprp_istopweaksink, &

src/Model/ParticleTracking/prt-prp.f90

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ module PrtPrpModule
1414
use SimVariablesModule, only: errmsg, warnmsg
1515
use ParticleTracksModule, only: ParticleTracksType, &
1616
TRACKHEADER, TRACKDTYPES
17+
use ParticleTrackEventBufferModule, only: ParticleTrackEventSelectionType
1718
use GeomUtilModule, only: point_in_polygon, get_ijk, get_jk
1819
use MemoryManagerModule, only: mem_allocate, mem_deallocate, &
1920
mem_reallocate
21+
use MemoryManagerExtModule, only: mem_set_value
2022
use ParticleReleaseScheduleModule, only: ParticleReleaseScheduleType, &
2123
create_release_schedule
2224
use DisModule, only: DisType
@@ -48,6 +50,8 @@ module PrtPrpModule
4850
integer(I4B), pointer :: itrkout => null() !< binary track file
4951
integer(I4B), pointer :: itrkhdr => null() !< track header file
5052
integer(I4B), pointer :: itrkcsv => null() !< CSV track file
53+
logical(LGP) :: prp_has_selection = .false. !< true if TRACK_* keywords were specified
54+
type(ParticleTrackEventSelectionType) :: prp_selected !< per-PRP event selection
5155
integer(I4B), pointer :: irlstls => null() !< release time file
5256
integer(I4B), pointer :: iexmeth => null() !< method for iterative solution of particle exit location and time in generalized Pollock's method
5357
integer(I4B), pointer :: ichkmeth => null() !< method for checking particle release coordinates are in the specified cells, 0 = none, 1 = eager
@@ -879,6 +883,7 @@ subroutine prp_options(this)
879883
&[character(len=LENVARNAME) :: 'NONE', 'EAGER']
880884
character(len=LINELENGTH) :: trackfile, trackcsvfile, fname
881885
type(PrtPrpParamFoundType) :: found
886+
integer(I4B), pointer :: evinput
882887
character(len=*), parameter :: fmtextolwrn = &
883888
"('WARNING: EXIT_SOLVE_TOLERANCE is set to ',g10.3,' &
884889
&which is much greater than the default value of ',g10.3,'. &
@@ -907,6 +912,60 @@ subroutine prp_options(this)
907912
found%trackfile)
908913
call mem_set_value(trackcsvfile, 'TRACKCSVFILE', this%input_mempath, &
909914
found%trackcsvfile)
915+
916+
! per-PRP event selection keywords (same names as OC)
917+
allocate (evinput)
918+
call mem_set_value(evinput, 'TRACK_RELEASE', this%input_mempath, &
919+
found%track_release)
920+
call mem_set_value(evinput, 'TRACK_EXIT', this%input_mempath, &
921+
found%track_exit)
922+
call mem_set_value(evinput, 'TRACK_SUBF_EXIT', this%input_mempath, &
923+
found%track_subf_exit)
924+
call mem_set_value(evinput, 'TRACK_TIMESTEP', this%input_mempath, &
925+
found%track_timestep)
926+
call mem_set_value(evinput, 'TRACK_TERMINATE', this%input_mempath, &
927+
found%track_terminate)
928+
call mem_set_value(evinput, 'TRACK_WEAKSINK', this%input_mempath, &
929+
found%track_weaksink)
930+
call mem_set_value(evinput, 'TRACK_USERTIME', this%input_mempath, &
931+
found%track_usertime)
932+
call mem_set_value(evinput, 'TRACK_DROPPED', this%input_mempath, &
933+
found%track_dropped)
934+
935+
if (found%track_release) then
936+
this%prp_selected%release = .true.
937+
this%prp_has_selection = .true.
938+
end if
939+
if (found%track_exit) then
940+
this%prp_selected%featexit = .true.
941+
this%prp_has_selection = .true.
942+
end if
943+
if (found%track_subf_exit) then
944+
this%prp_selected%subfexit = .true.
945+
this%prp_has_selection = .true.
946+
end if
947+
if (found%track_timestep) then
948+
this%prp_selected%timestep = .true.
949+
this%prp_has_selection = .true.
950+
end if
951+
if (found%track_terminate) then
952+
this%prp_selected%terminate = .true.
953+
this%prp_has_selection = .true.
954+
end if
955+
if (found%track_weaksink) then
956+
this%prp_selected%weaksink = .true.
957+
this%prp_has_selection = .true.
958+
end if
959+
if (found%track_usertime) then
960+
this%prp_selected%usertime = .true.
961+
this%prp_has_selection = .true.
962+
end if
963+
if (found%track_dropped) then
964+
this%prp_selected%dropped = .true.
965+
this%prp_has_selection = .true.
966+
end if
967+
deallocate (evinput)
968+
910969
call mem_set_value(this%localz, 'LOCALZ', this%input_mempath, &
911970
found%localz)
912971
call mem_set_value(this%extend, 'EXTEND', this%input_mempath, &

src/Model/ParticleTracking/prt.f90

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module PrtModule
2222
use ParticleEventsModule, only: ParticleEventDispatcherType, handle_event
2323
use ParticleTracksModule, only: ParticleTracksType, &
2424
ParticleTrackFileType, &
25+
ParticleTrackEventSelectionType, &
2526
add_particle_event
2627
use SimModule, only: count_errors, store_error, store_error_filename
2728
use MemoryManagerModule, only: mem_allocate
@@ -253,6 +254,7 @@ subroutine prt_ar(this)
253254
integer(I4B) :: ip, nprp
254255
class(BndType), pointer :: packobj
255256
class(*), pointer :: p
257+
type(ParticleTrackEventSelectionType) :: model_sel, prp_sel
256258

257259
! Set up basic packages
258260
call this%fmi%fmi_ar(this%ibound)
@@ -265,16 +267,15 @@ subroutine prt_ar(this)
265267
! Initialize the event buffer (memory or scratch file per OC option)
266268
call this%tracks%init_buffer(this%oc%scratch_buffer)
267269

268-
! Select tracking events
269-
call this%tracks%select_events( &
270-
this%oc%trackrelease, &
271-
this%oc%trackfeatexit, &
272-
this%oc%tracktimestep, &
273-
this%oc%trackterminate, &
274-
this%oc%trackweaksink, &
275-
this%oc%trackusertime, &
276-
this%oc%tracksubfexit, &
277-
this%oc%trackdropped)
270+
! Build event selection from OC for model-level files
271+
model_sel%release = this%oc%trackrelease
272+
model_sel%featexit = this%oc%trackfeatexit
273+
model_sel%subfexit = this%oc%tracksubfexit
274+
model_sel%timestep = this%oc%tracktimestep
275+
model_sel%terminate = this%oc%trackterminate
276+
model_sel%weaksink = this%oc%trackweaksink
277+
model_sel%usertime = this%oc%trackusertime
278+
model_sel%dropped = this%oc%trackdropped
278279

279280
! Set up boundary pkgs and pkg-scoped track files
280281
nprp = 0
@@ -286,16 +287,24 @@ subroutine prt_ar(this)
286287
call packobj%prp_set_pointers(this%ibound, this%mip%izone)
287288
call packobj%bnd_ar()
288289
call packobj%bnd_ar()
290+
! Use per-PRP selection if specified, otherwise inherit OC selection
291+
if (packobj%prp_has_selection) then
292+
prp_sel = packobj%prp_selected
293+
else
294+
prp_sel = model_sel
295+
end if
289296
if (packobj%itrkout > 0) then
290297
call this%tracks%init_file( &
291298
packobj%itrkout, &
292-
iprp=nprp)
299+
iprp=nprp, &
300+
selected=prp_sel)
293301
end if
294302
if (packobj%itrkcsv > 0) then
295303
call this%tracks%init_file( &
296304
packobj%itrkcsv, &
297305
csv=.true., &
298-
iprp=nprp)
306+
iprp=nprp, &
307+
selected=prp_sel)
299308
end if
300309
class default
301310
call packobj%bnd_ar()
@@ -304,9 +313,10 @@ subroutine prt_ar(this)
304313

305314
! Set up model-scoped track files
306315
if (this%oc%itrkout > 0) &
307-
call this%tracks%init_file(this%oc%itrkout)
316+
call this%tracks%init_file(this%oc%itrkout, selected=model_sel)
308317
if (this%oc%itrkcsv > 0) &
309-
call this%tracks%init_file(this%oc%itrkcsv, csv=.true.)
318+
call this%tracks%init_file(this%oc%itrkcsv, csv=.true., &
319+
selected=model_sel)
310320

311321
! Initialize and select the tracking method based on discretization
312322
select type (dis => this%dis)

src/Solution/ParticleTracker/Particle/Events/ParticleEvent.f90

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module ParticleEventModule
99
public :: ParticleEventType
1010
public :: RELEASE
1111
public :: FEATEXIT
12+
public :: SUBFEXIT
1213
public :: TIMESTEP
1314
public :: TERMINATE
1415
public :: WEAKSINK
@@ -28,6 +29,7 @@ module ParticleEventModule
2829
enumerator :: WEAKSINK = 4 !< particle entered a weak sink
2930
enumerator :: USERTIME = 5 !< user-specified tracking time
3031
enumerator :: DROPPED = 6 !< particle dropped to the water table
32+
enumerator :: SUBFEXIT = 7 !< particle exited a sub-grid-scale feature
3133
end enum
3234

3335
!> @brief Base type for particle events.

src/Solution/ParticleTracker/Particle/Events/SubcellExitEvent.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module SubCellExitEventModule
33
use ConstantsModule, only: LENHUGELINE
44
use ErrorUtilModule, only: pstop
55
use ParticleModule, only: ParticleType
6-
use ParticleEventModule, only: FEATEXIT
6+
use ParticleEventModule, only: SUBFEXIT
77
use FeatExitEventModule, only: FeatExitEventType
88
implicit none
99

@@ -24,7 +24,7 @@ module SubCellExitEventModule
2424
function get_code(this) result(code)
2525
class(SubCellExitEventType), intent(in) :: this
2626
integer(I4B) :: code
27-
code = FEATEXIT
27+
code = SUBFEXIT
2828
end function get_code
2929

3030
function get_verb(this) result(verb)

0 commit comments

Comments
 (0)