TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
IJK Data Structures

This page documents the data structures underlying the IJK structured-mesh solver used by the Front-Tracking IJK module (see Front-Tracking IJK). IJK refers to the three indices \((i,j,k)\) of a Cartesian coordinate system: the domain is a parallelepiped discretized on a structured Cartesian grid, which allows a simplified vectorized data layout and significant performance gains.

Note
The core IJK data-structure classes live in the TRUST kernel (src/Kernel/IJK/), not in TrioCFD itself, since they are generic platform infrastructure reused by several modules. This page gives the conceptual model — the mesh geometry, the parallel domain decomposition and the field storage — as seen from a TrioCFD developer's point of view. The authoritative API is the C++ class documentation generated from the TRUST sources.

Mesh geometry

The global mesh geometry is described by the Domaine_IJK class (deriving from Domaine_base). It holds:

  • the number of cells in each direction;
  • the cell sizes — either uniform or non-uniform along each of the three directions;
  • the periodicity flags of the domain (per direction).
A structured IJK mesh and the three Cartesian directions I, J, K.
Note
Historically, the mesh geometry and the parallel partitioning were two separate classes (IJK_Grid_Geometry and IJK_Splitting, in the original Trio_U implementation). They have since been merged into the single Domaine_IJK class; the older names no longer exist in the code.

Numbering of faces

The face of index \((i,j,k)\) in a given direction is located at the "left" (lower-index side) of the element of index \((i,j,k)\). As a consequence a Cartesian element has, in each direction, a "left" face sharing its index and a "right" face whose index is incremented by one.

Face numbering convention: the face (i,j,k) sits on the lower-index side of element (i,j,k), shown here in the I and J directions.

Parallel domain decomposition

The partitioning of the mesh across processors is also carried by Domaine_IJK. Only a structured splitting is supported: the global domain is cut into a given number of slices along the \(i\), \(j\) and \(k\) directions, so that each processor owns a parallelepipedic sub-block.

Structured splitting of the domain into slices along i, j and k. Each sub-block is owned by one processor.

Local indices, offsets and ghost cells

Within each processor, elements, nodes and faces carry local indices. The corresponding global index is recovered by adding the local offset of the sub-block (Domaine_IJK::get_offset_local for a given direction).

  • Negative local indices denote ghost items: cells held (as real cells) by a neighbouring processor and duplicated locally to evaluate stencils across the sub-block boundary.
  • Periodicity is handled through the same ghost mechanism — even when there is a single slice in a periodic direction, the periodic neighbours appear as ghost cells.
Local element numbering on a sub-block: the red block is the owned region, the dashed cells are ghosts, and the global index is the local index plus the offset (here offset_i = offset_j = 4).

Ownership of nodes and faces

Unlike elements, a node or a face is never shared: it belongs to exactly one processor. The convention follows the face numbering above — the "right" face of the rightmost owned element is a ghost face, owned by the processor holding the next block of cells (except at the boundary of a non-periodic global domain, where it is a real boundary face). The number of locally owned faces in a direction is queried through Domaine_IJK::get_nb_faces_local (and get_nb_elem_local / get_nb_items_local for the other localizations).

Real (solid) versus ghost (dashed) faces on a sub-block. The faces on the right edge are ghost faces owned by the neighbouring processor.

Fields

Scalar fields on a split IJK mesh are stored in the IJK_Field_double and IJK_Field_float classes — aliases of the IJK_Field_template<T> class template (so the same storage works in single or double precision). A field is attached to a Domaine_IJK and to a localization that fixes where its values live:

  • ELEM — cell centres;
  • NODES — mesh nodes;
  • FACES_I, FACES_J, FACES_K — faces normal to each direction (the marker-and-cell layout used for velocity components);
  • EDGES_I, EDGES_J, EDGES_K — mesh edges.

On each processor a field item is either real or ghost (never "common"): consistently with the ownership rule above, the node or face on the high-index side of the last owned element is a ghost item locally, and a real item on the processor that owns the next block of cells.

Note
This page was migrated and modernized from the original "IJK structured mesh implementation in Trio_U" presentation by Benoit Mathieu, with the class names updated to the current code (Domaine_IJK, IJK_Field_template).