Particle Tracing

This post describes how to use particle tracing in HydroGeoSphere, introduced with the release of HGS revision 2385 (April 2022). This new capability allows users to track the movement of massless particles through the subsurface domain, providing valuable insights into flow patterns and transport processes. Conceptually, particle tracing helps visualize how water moves through the system, making it a powerful tool for analyzing groundwater flow and solute transport. We find this feature particularly useful for understanding complex flow dynamics.


We’re really pleased to announce the introduction of particle tracing capabilities with the release of HGS revision 2385 (April 2022 release). In this post we’ll explore some of the new commands associated with this new feature and see how you can incorporate particle tracing into your own models.

Note: particle tracing is based on advective transport of a massless particle through the subsurface domain. The particle tracing implementation here does not account for retardation, dispersion or diffusion processes, and is not a suitable alternative to a full ADRE solute transport model.

Of course, to use particle tracing you will need to install the April 2022 version (or newer) to your computer. Visit our ‘Download Page’ (https://www.aquanty.com/hgs-download) to access the installers.

Figure 1: In-element tracing of a particle with known starting position and elemental velocity field.

If you would like to review the commands presented here and reproduce the images below you can download the example project ‘R5_particles’. This example is based on the ‘Intro to HGS’ tutorial that we review in our monthly training sessions, with some modifications.

  • Hydraulic conductivities have been increased to promote faster travel times

  • Pumping rates have been increased, and no longer cycle on/off (they just stay on)

  • Evapotranspiration has been deactivated (to reduce model runtime)

  • Overall simulation duration has been increased, and fewer output times are included

  • Some modifications to timestep controls and numerical solution criteria

And of course, we have included all the necessary particle tracing commands at the end of the *.grok file for you to review and adapt to your own models.

Click here to download example model: r5_particles.zip

Figure 2: Determining the particle exit point

Before we jump into the practical aspects of particle tracing with HydroGeoSphere, let’s briefly explore the way it has been implemented. Particle tracing tracks the position of an idealized massless particle as it moves through the subsurface domain following the flow field until it either exits the model via a boundary condition or exits to the surface. Each particle is released from an initial location within the subsurface domain at an initial release time. The initial location of particles and the initial release time are both user-specified.

The path that a particle travels within any given element is based on a linear interpolation of the velocity field at the given element (Figure 1). The travel time to intersection with each face associated with the element is then calculated, and the exit point of the particle is determined on the intersection point with the shortest travel time (Figure 2).

Figure 3: Particle reflection and the exit criterion

Particles may ‘reflect’ within an element if a certain exit criterion is not satisfied (Figure 3). At a potential exit point the velocity vector of the target element is multiplied by a unit vector perpendicular to the shared face, If the result is not positive then the particle will be reflected within the original element. The particle will then follow the direction of the velocity vector of the neighboring element, until it encounters another face. The total travel time of the particle within the original element is equal to the sum of travel times until the exit criterion is satisfied (Figure 4). Sometimes an element has no faces which meet the exit criterion, in which case the element is classified as a ‘dead-end element’. In these cases the faces of the dead-end element are treated as reflection walls, and particles will not travel into them (Figure 5).

Figure 4: Particle travel time

Particles will travel throughout the model domain until they encounter boundary nodes with negative fluxes, which are termed ‘sink nodes’. If all nodes associated with a particular face are classified as sink nodes, then a particle may exit the model at any point in the face (Figure 6). If only one or two nodes in the exit face are classified as sink nodes then the particle may exit through the nearest sink node or segment (Figure 7).

Now that we have a basic understanding of how particle tracing works in HydroGeoSphere, let’s take a closer look at how apply this feature in a model. We have introduced nine new commands that can be used for particle tracing (see section 2.11 of the Reference Manual for more info). Here is a brief description of each new command:

Figure 5: Dead-end elements

Figure 6: Particle exiting elements via faces

  • trace particle causes HGS to activate particle tracing.

  • trace particle logging causes HGS to write detailed information for each particle to an ASCII file.

  • initial particle location file causes HGS to specify the initial location, group ID and release time for particles using an ASCII input file.

  • initial particle location by layer from file causes HGS to specify the initial location by layer, group ID and release time for particles using an ASCII input file. Particles will be placed at the vertical mid-point of the assigned layer.

  • output times for particle locations causes HGS to record particle locations at specified times.

  • maximum trace time causes HGS to specify the maximum time at which particle traces are updated. Tracing effectively stops after this time.

  • maximum trace count causes HGS to limit the maximum number of locations allowed in a particle trace path (can be used to limit memory consumption).

  • maximum trace output causes HGS to limit the maximum number of particles to record in the particle trace and particle location output files.

  • maximum particle reflection count causes HGS to limit the number of particle reflections that are permitted over a trace step when updating a particle's location. This command allows HGS to deactivate particles that are unable to move from one element to a neighboring element.

Figure 7: Particle exiting elements via nodes and segments

Eight of these new commands are demonstrated in the associated ‘R5_particles’ example model (download link above). If you scroll to the bottom of the *.grok file you will see the following commands (the inline comments from the *.grok file have been removed for clarity):

trace particle     
Trace particle logging      
Initial particle location by layer from file    
R5_5m_pts2.txt                           
 !Note: a similar command 'initial particle location from file' can be used, except instead of a layer # you would provide a Z-coordinate. 
Output times for particle locations     
    86400        !24 hours
    2.592e+6    !30 days
    3.156e+7     !1 year
end
maximum trace time      
3.156e+8               
Maximum trace count     
50000                    
!Maximum trace output   
!1000                  
maximum particle reflection count  
50   

Figure 8: Initial particle distribution

In this model we have seeded the first layer of the model domain with particles at 5m spacings (Figure 8).

Running this model will generate the following "extra" output files (i.e. extra with respect to a project without particle tracing):

  • R5_particleso.particle_travel_time.csv

  • R5_particleso.particle_location.dat

  • R5_particleso.particle_trace.0001.dat

  • R5_particleso.particle_trace.0002.dat

  • R5_particleso.particle_trace.0003.dat

Let’s take a closer look at these files and the data contained in them.

First, the particle_travel_time output file records the status, exit type, exit name, travel time [T], and travel length [L] of each particle (Figure 9). There are six possible ‘status’ values for individual particles, including:

Figure 9: The ‘particle_travel_time’ output file

  • Moving (Status =0) – the particle is moving through the model domain.

  • Normal exit (Status =1) – the particle has exited the model domain via either a boundary condition or to the surface.

  • Unreleased (Status =2) – the particle has not been released yet (release time is user defined)

  • Max trace time (Status =3) – the maximum trace time for the particle was reached (as defined by the maximum trace time command).

  • Max trace count (Status =4) – the maximum trace count for the particle was reached (as defined by the maximum trace count command).

  • Abnormal exit (Status =5) – this status is triggered for a particle when the maximum reflection count is repeatedly exceeded (as defined by the ‘maximum particle reflection’ command). In this case the particle is not able to make any progress!

  • Bad intersection (Status =6) – this status indicates that an error has occurred when computing the intersection point between the particle’s trajectory and the face of the element that currently contains the particle. This status is not common and indicates a breakdown in the particle tracing numerics (and should be further investigated!).

In our example, the ‘R5_particleso.particle_travel_time.dat` file should indicate that all particles are either still moving, or they have encountered a normal exit. For each particle with a normal exit we can also take a closer look at the “Exit Type” (i.e. the type of boundary condition through which the particle exited, for example “Flux Nodal”) and the “Exit Name” (i.e. the user specified or HGS default name of the individual boundary condition). The vast majority of particles in this example have exited through the flux nodal boundary condition, representing the pumping wells throughout our model domain (i.e. 'Fnodal_5').

Figure 10: The ‘particle location’ output file

Next, the ‘particle_location’ output file is an ASCII Tecplot file that records the location (X/Y/Z coordinates), group ID, and status of each particle through time (Figure 10). The locations/status of particles are recorded for all output times specified in the output times for particle locations command. The status listed here corresponds to the statuses mentioned above for the ‘particle travel time’ output files.

Finally, a ‘particle_trace’ file is generated for each of the specified particle output times (as defined by the output times for particle locations command). These are ASCII Tecplot files that record the trace path for each particle from its initial release time up to the current trace output time. We can use these files to visualize particle trace pathlines and initial particle locations in Tecplot.

To display particle traces in Tecplot we recommend using the mesh to tecplot command to generate a simple Tecplot formatted output file for your model mesh (i.e. the “R5mesh.dat” file generated by grok.exe in this example problem). You can load the model mesh file into Tecplot easily enough (drag and drop) and then use the ‘Load Data’ workflow to import any of the “R5_particleso.particle_trace.XXXX.dat” files.

Note: Make sure to “append data” instead of overwriting the R5mesh.dat file when importing particle traces.

Figure 11: Particle trace path lines for the ‘R5_particles’ model after 30 days (black lines indicate particle traces; red spheres indicate the location of pumping wells (Fnodal_5))

Once the particle trace data has been imported you can activate the ‘edge’ data layer to display particle traces, and the ‘scatter’ data layer to display particle locations recorded at each timestep. Figure 11 illustrates particle traces after 30 days (i.e. the ‘R5_particleso.particle_trace.0002.dat’ output file).

Notes on visualization:

  • It is also possible to show particle traces in the context of hsplot.exe output files (e.g. the prefixo.pm.dat file). In this case output times for the particle tracing feature should align with the overall output times for the flow simulation. Furthermore, it is necessary to delete the first zone in the hsplot output file to display the particle traces alongside the prefixo.pm.dat file.

    • First load the prefixo.pm.dat file.

    • Next delete the first zone by clicking: Data -> Delete -> zone- > 1:pm

    • Then load the particle trace file as described above.

  • Each individual particle/trace can be assigned it’s own unique visualization settings. However, if you have some sense beforehand where different groups of particles will ‘exit’ the model then you are encouraged to classify these into different particle groups (i.e. using the GroupID assigned in the initial particle location from file command).

  • You can also use ‘Value blanking’ in Tecplot to turn on/off the visualization of particle traces based on the Group ID.

Adding Particle Tracing to an Existing Model:

  • Many users will be interested in adapting existing models to include particle tracing. In this case please note that the particle tracing feature can be used in conjunction with the defined flow command. With this command you can use the existing flow results from your model, avoiding the need to run the full flow simulation again.

We hope you like this new feature! As always, if you have any comments or recommendations on how this feature (or any other) can be improved feel free to reach out to the Aquanty team by emailing support@aquanty.com.

Previous
Previous

HGS RESEARCH HIGHLIGHT – Transit-Time and Temperature Control the Spatial Patterns of Aerobic Respiration and Denitrification in the Riparian Zone

Next
Next

NEW version of HGS (April 2022 - Revision 2385)