3. Kernels

3.1. Macro Variables

3.1.1. Formula for Density (array named m0)

The density \(m0[idx]\) is computed as the sum of the distribution function values over all directions (from 0 to \(Q-1\)):

\[m0[idx] = \rho = \sum_{i=0}^{Q-1} s_i\]

Where:

  • \(s_i = pf(idx, i)\) is the distribution function for lattice direction \(i\).

3.1.2. Formula for Velocity (array of 3D Vector named m1)

The velocity components \(u_x\), \(u_y\), and \(u_z\) are calculated as the weighted sum of the distribution functions and the corresponding lattice velocity components \(e_{x,i}\), \(e_{y,i}\), and \(e_{z,i}\):

\[u_x = \sum_{i=0}^{Q-1} s_i \cdot e_{x,i}, \quad u_y = \sum_{i=0}^{Q-1} s_i \cdot e_{y,i}, \quad u_z = \sum_{i=0}^{Q-1} s_i \cdot e_{z,i}\]

Where:

  • \(s_i = pf(idx, i)\) is the distribution function for lattice direction \(i\).

  • \(e_{x,i}, e_{y,i}, e_{z,i}\) are the components of the lattice velocities for direction \(i\).

After computing the velocity components, they are normalized by the density \(\rho\) (if \(\rho \neq 0\)):

\[u_x = \frac{u_x}{\rho}, \quad u_y = \frac{u_y}{\rho}, \quad u_z = \frac{u_z}{\rho}\]

Finally, the velocity vector \(m1[idx]\) is stored as:

\[m1[idx] = \text{Vec3d}(u_x, u_y, u_z)\]

Where Vec3d represents the 3D velocity vector.

  • Operator name: macro_variables

  • Description: A functor for computing macroscopic variables (densities and flux) for lattice Boltzmann method.

  • Parameters: No parameters but you need to define lbm_parameters.

Yaml example:

- macro_variables

3.2. Collision BGK

  • Operator name: bgk

  • Description: This operator implements the Bhatnagar-Gross-Krook (BGK) collision model for the Lattice Boltzmann Method (LBM). This model assumes a single relaxation time approach to approximate the collision process, driving the distribution functions toward equilibrium.

  • Parameters: No parameters but you need to define lbm_parameters.

  • Formula:

\[f_i(\mathbf{x} + \mathbf{e}_i, t + 1) = f_i(\mathbf{x}, t) - \frac{1}{\tau} \left( f_i(\mathbf{x}, t) - f_i^{\text{eq}}(\mathbf{x}, t) \right)\]

With:

  • \(f_i(\mathbf{x}, t)\) is the distribution function in the i-th direction at position x and time t,

  • \(f_i^{\text{eq}}(\mathbf{x}, t)\) is the equilibrium distribution function for the i-th direction at position x and time t,

  • \(\tau\) is the relaxation time parameter (LBMParameters).

Yaml example:

- bgk

3.3. Collision MRT

  • Operator name: mrt

  • Description: This operator implements the MRT collision model for the Lattice Boltzmann Method (LBM). This model assumes a single relaxation time approach to approximate the collision process, driving the distribution functions toward equilibrium.

  • Parameters: No parameters but you need to define lbm_parameters.

Yaml example:

- mrt

3.4. Streaming

The streaming step is divided into two parts (step1 and step2), and synchronization is required between these two steps to correctly update the ghost halos.”

  • Operator name: streaming

  • Description: TO DO

  • Parameters:

    • asynchrone: The asynchrone option controls the execution style: when true, it allows asynchronous operations with overlapping computation and communication, improving parallel performance. When false, it runs synchronously, ensuring sequential execution of operations and data updates.

Yaml example:

- streaming:
   asynchrone: false

Note

asynchrone option is disabled.