In April 2017, we added barycentric tracking into the public, development line of OpenFOAM (OpenFOAM-dev), as a complete replacement to the tracking algorithm that existed in OpenFOAM for over 10 years.  Tracking is used primarily for tracking particles, but it is also used in many other areas of OpenFOAM, e.g. processing streamlines and graph data, and meshing with snappyHexMesh.  The new development was funded from the €100 k for OpenFOAM maintenance, raised through the OpenFOAM Foundation in 2017, in which “particles and tracking” was identified as an area in OpenFOAM “requiring significant code refactoring and/or rewriting”.

Bad Meshes

Tracking runs on a mesh of tetrahedral (tet) cells, decomposed internally in OpenFOAM from the underlying mesh of arbitrary shaped cells that are used for computational fluid dynamics (CFD).  Barycentric tracking works on any decomposed tet mesh, irrespective of mesh quality, including poor quality, flat and inverted tetrahedra.   The calculation of particle-face intersections is unambiguous and reproducible, even as a particle approaches a face at a small angles of incidence.  Consequently, particles do not get “lost”, and tracking does not require ad-hoc corrections or “rescues” to function robustly.  The image right demonstrates a successful streamline calculation using barycentric tracking on a mesh with bad quality cells highlighted in purple.  Tracking functions use displacement data rather than end position which helps eliminate floating point error issues, particularly towards the end of a tracking step.

Particle Position

Each particle position is defined by topology (i.e. which decomposed tet cell it is in) and geometry (i.e. where it is in the cell). No search operations are needed on restart or reconstruct, unlike when particle positions are stored in the global coordinate system.  When writing data, the particle positions are described by their topology and local coordinates, rather than the global coordinates.  The format of the resulting output data is not compatible with data from the old tracking algorithm, meaning existing cases with Lagrangian data will not restart, but they will still run from time “zero” without modification.  This change was unavoidable in order to guarantee that each loaded particle is valid, and thus fundamentally prevent failures associated with lost particles and searching, e.g. reported in issues 2517, 2442, 2286, 1836, 1461, 1341, 1097.

Moving Meshes

The barycentric tracking algorithm works for a moving mesh and arbitrary mesh interface (AMI).  Particles can therefore be simulated in a case with a rotating geometry, such as the example below which we included as a tutorial in OpenFOAM.

OpenFOAM Barycentric Tracking