35 'kper,kstp,imdl,iprp,irpt,ilay,icell,izone,&
36 &istatus,ireason,trelease,t,x,y,z,name'
39 '<i4,<i4,<i4,<i4,<i4,<i4,<i4,<i4,&
40 &<i4,<i4,<f8,<f8,<f8,<f8,<f8,|S40'
49 integer(I4B),
public :: iun = 0
50 logical(LGP),
public :: csv = .false.
51 integer(I4B),
public :: iprp = -1
56 logical(LGP) :: release
57 logical(LGP) :: cellexit
58 logical(LGP) :: timestep
59 logical(LGP) :: terminate
60 logical(LGP) :: weaksink
61 logical(LGP) :: usertime
71 integer(I4B),
public :: iout = -1
72 integer(I4B),
public :: ntrackfiles
92 integer(I4B),
intent(in) :: iun
93 logical(LGP),
intent(in),
optional :: csv
94 integer(I4B),
intent(in),
optional :: iprp
98 if (.not.
allocated(this%files))
then
99 allocate (this%files(1))
101 call this%expand_files(increment=1)
106 if (
present(csv)) file%csv = csv
107 if (
present(iprp)) file%iprp = iprp
108 this%ntrackfiles =
size(this%files)
109 this%files(this%ntrackfiles) = file
114 if (
allocated(this%files))
deallocate (this%files)
121 integer(I4B),
optional,
intent(in) :: increment
123 integer(I4B) :: inclocal
124 integer(I4B) :: isize
125 integer(I4B) :: newsize
128 if (
present(increment))
then
134 if (
allocated(this%files))
then
135 isize =
size(this%files)
136 newsize = isize + inclocal
137 allocate (temp(newsize))
138 temp(1:isize) = this%files
139 deallocate (this%files)
140 call move_alloc(temp, this%files)
142 allocate (this%files(inclocal))
155 logical(LGP),
intent(in) :: release
156 logical(LGP),
intent(in) :: cellexit
157 logical(LGP),
intent(in) :: timestep
158 logical(LGP),
intent(in) :: terminate
159 logical(LGP),
intent(in) :: weaksink
160 logical(LGP),
intent(in) :: usertime
161 this%selected%release = release
162 this%selected%cellexit = cellexit
163 this%selected%timestep = timestep
164 this%selected%terminate = terminate
165 this%selected%weaksink = weaksink
166 this%selected%usertime = usertime
172 integer(I4B),
intent(in) :: event_code
174 selected = (this%selected%release .and. event_code == 0) .or. &
175 (this%selected%cellexit .and. event_code == 1) .or. &
176 (this%selected%timestep .and. event_code == 2) .or. &
177 (this%selected%terminate .and. event_code == 3) .or. &
178 (this%selected%weaksink .and. event_code == 4) .or. &
179 (this%selected%usertime .and. event_code == 5)
188 save = (file%iun > 0 .and. &
189 (file%iprp == -1 .or. file%iprp == particle%iprp))
195 integer(I4B),
intent(in) :: iun
198 logical(LGP),
intent(in) :: csv
201 integer(I4B) :: status
204 call particle%get_model_coords(x, y, z)
207 if (particle%istatus .lt. 0)
then
210 status = particle%istatus
214 write (iun,
'(*(G0,:,","))') &
230 trim(adjustl(particle%name))
260 integer(I4B),
intent(in) :: iun
264 character(len=:),
allocatable :: particlename
266 particlename = trim(adjustl(particle%name))
267 if (len_trim(particlename) == 0) particlename =
'anonymous'
270 write (iun,
'(*(G0))') &
271 'Particle (Model: ', particle%imdl, &
272 ', Package: ', particle%iprp, &
273 ', Point: ', particle%irpt,
' [', particlename,
']', &
274 ', Time: ', particle%trelease, &
275 ') ', event%get_str(), &
276 ' in (Layer: ', particle%ilay, &
277 ', Cell: ', particle%icu, &
278 ', Zone: ', particle%izone, &
279 ') at (X: ', particle%x, &
280 ', Y: ', particle%y, &
281 ', Z: ', particle%z, &
282 ', Time: ', particle%ttrack, &
283 ', Period: ', event%kper, &
284 ', Timestep: ', event%kstp, &
285 ') with (Status: ', particle%istatus,
')'
298 if (this%should_log()) &
299 call log_event(this%iout, particle, event)
301 if (this%is_selected(event%get_code()))
then
302 do i = 1, this%ntrackfiles
304 if (this%should_save(particle, file)) &
305 call save_event(file%iun, particle, event, csv=file%csv)
This module contains simulation constants.
real(dp), parameter dpio180
real constant
real(dp), parameter dzero
real constant zero
real(dp), parameter done
real constant 1
subroutine, public transform(xin, yin, zin, xout, yout, zout, xorigin, yorigin, zorigin, sinrot, cosrot, invert)
Apply a 3D translation and optional 2D rotation to coordinates.
This module defines variable data types.
Particle track output module.
subroutine init_file(this, iun, csv, iprp)
Initialize a binary or CSV file.
subroutine select_events(this, release, cellexit, timestep, terminate, weaksink, usertime)
Pick events to track.
character(len= *), parameter, public trackheader
subroutine expand_files(this, increment)
Grow the array of track files.
logical function is_selected(this, event_code)
Check if a given event code is selected for tracking.
subroutine, private log_event(iun, particle, event)
Print a particle event summary.
subroutine, private save_event(iun, particle, event, csv)
Save an event to a binary or CSV file.
logical function should_log(this)
Log output unit valid?
character(len= *), parameter, public trackdtypes
logical function should_save(this, particle, file)
Check whether a particle belongs in a given file i.e. if the file is enabled and its group matches th...
Base type for particle events.
Particle tracked by the PRT model.
Selection of particle events.
Output file containing all or some particle pathlines.
Manages particle track output (logging/writing).