Your browser does not fully support modern features. Please upgrade for a smoother experience.
Representation of Flow and Temperature Fields Using LBM: History
Please note this is an old version of this entry, which may differ significantly from the current revision.
Contributor: Predrag M. Tekic

This paper presents a program developed for simulating fluid flow and temperature fields using the Lattice Boltzmann Method (LBM). The solver, which forms the core of the program, implements LBM to numerically calculate fluid motion.

The method is highly suitable for parallel computation, and the program is therefore designed to execute on multi-core architectures, utilizing the computational power of modern graphics processing units (GPUs) and/or multi-core central processing units (CPUs).

  • OpenCL
  • Java
  • ParaView

1. Introduction

This paper presents a program developed for simulating fluid flow and temperature fields using the Lattice Boltzmann Method (LBM). The solver, which forms the core of the program, implements LBM to numerically calculate fluid motion.

The method is highly suitable for parallel computation, and the program is therefore designed to execute on multi-core architectures, utilizing the computational power of modern graphics processing units (GPUs) and/or multi-core central processing units (CPUs).

The software belongs to the field of Computational Fluid Dynamics (CFD). Programs in this domain require not only the solver for performing simulations, but also tools for pre-processing and post-processing. For post-processing, the open-source software ParaView is used, which provides powerful capabilities for data representation and analysis.

The program is implemented in Java and uses the OpenCL standard for parallel execution. This architecture ensures both software and hardware independence, and provides significant speed-ups compared to sequential execution on CPU cores, as demonstrated in previous work.

 

2. Mathematical Model and Simulation Method

The Lattice Boltzmann equation for fluid flow under external forces, using the BGK approximation, can be expressed as:

fi(x⃗+c⃗iΔt,t+Δt)−fi(x⃗,t)=−1τ[fi(x⃗,t)−fieq(x⃗,t)]+Fif_i(\vec{x} + \vec{c}_i \Delta t, t + \Delta t) - f_i(\vec{x},t) = -\frac{1}{\tau} \left[f_i(\vec{x},t) - f_i^{eq}(\vec{x},t)\right] + F_i

where fi(x⃗,t)f_i(\vec{x},t) is the particle density distribution function, fieq(x⃗,t)f_i^{eq}(\vec{x},t) is the equilibrium distribution function, c⃗i\vec{c}_i is the velocity vector, τ\tau is the relaxation time, and FiF_i represents the force acting on the fluid.

The macroscopic density and velocity are given by:

ρ=∑ifi,ρu⃗=∑ic⃗ifi\rho = \sum_i f_i, \quad \rho \vec{u} = \sum_i \vec{c}_i f_i

For the two-dimensional D2Q9 model, the equilibrium distribution function is defined to satisfy conservation of mass and momentum.

The temperature field is modeled using the Lattice Boltzmann equation for the energy distribution function, neglecting viscous dissipation:

gi(x⃗+c⃗iΔt,t+Δt)−gi(x⃗,t)=−1τT[gi(x⃗,t)−gieq(x⃗,t)]g_i(\vec{x} + \vec{c}_i \Delta t, t + \Delta t) - g_i(\vec{x},t) = -\frac{1}{\tau_T} \left[g_i(\vec{x},t) - g_i^{eq}(\vec{x},t)\right]

where gig_i is the energy distribution function, gieqg_i^{eq} its equilibrium state, and τT\tau_T the relaxation time for energy.

The macroscopic temperature is defined as:

T=∑igiT = \sum_i g_i

The kinematic viscosity and thermal diffusivity are related to the relaxation times:

ν=(2τ−1)6,α=(2τT−1)6\nu = \frac{(2\tau - 1)}{6}, \quad \alpha = \frac{(2\tau_T - 1)}{6}

For natural convection in a square cavity (Figure 2), using the Boussinesq approximation, the force term is:

F⃗=ρβ(T−T0)g⃗\vec{F} = \rho \beta (T - T_0) \vec{g}

where β\beta is the thermal expansion coefficient, g⃗\vec{g} is gravitational acceleration, and T0T_0 is the reference temperature. The dimensionless flow is characterized by the Rayleigh number:

Ra=gβΔTH3να,ΔT=Th−TcRa = \frac{g \beta \Delta T H^3}{\nu \alpha}, \quad \Delta T = T_h - T_c

The simulation solves the distribution functions in two steps: the collision step and the streaming step. Only the first two terms of the right-hand side of the energy equilibrium function are used in computations .

 

3. Program Structure

The program is implemented in Java and OpenCL. It consists of a host part, executed in Java, and OpenCL kernels, executed on devices supporting OpenCL (e.g., GPUs). The JOCL library serves as an interface between Java and OpenCL, avoiding direct calls to JNI methods [8].

In the host part, macroscopic variables are initialized, and the flow and temperature distribution functions are set. Two kernels are used:

  1. Flow kernel: computes boundary conditions, macroscopic quantities, equilibrium distributions, collision, and streaming for the flow field.

  2. Temperature kernel: computes the same steps for the temperature field.

After computation, a method in the host part writes the results to .vti files compatible with ParaView, enabling post-processing and data representation.

 

4. Case Study and Representation in ParaView

The benchmark problem is natural convection in a square cavity of height HH, filled with air (Prandtl number 0.71). The upper and lower walls are adiabatic, the left wall is uniformly heated, and the right wall is kept cold. Simulations are performed for Rayleigh numbers from 10310^3 to 10510^5.

Simulation results are stored in VTK XML .vti files, which support structured datasets. Each file contains the following hierarchy:

  • Document-level metadata: file type (ImageData), version, and byte order.

  • ImageData element: image dimensions, origin, and spacing.

  • Piece element: portion of the data to display.

  • PointData element: contains DataArray elements for scalars (temperature) and vectors (velocity).

Separate files are created for each simulation step, allowing representation of temperature fields (Figures 4–6) and flow fields / streamlines (Figures 7–9) in ParaView.

 

5. Conclusion

The program successfully demonstrates the parallel simulation of fluid flow and temperature fields using the Lattice Boltzmann Method, achieving platform independence and high computational efficiency. Parallel execution on multi-core CPUs and GPUs provides significant speed-ups compared to sequential computation, enabling simulations of larger and more complex problems within a reasonable timeframe.

The use of ParaView for post-processing has been shown to be highly effective for data representation, offering versatile visualization tools that are compatible with multiple platforms. The integration of this solver with ParaView provides a complete and efficient workflow for CFD simulations, from computation to analysis, without dependency on commercial software.

This work also lays the foundation for several future research directions. One direction is the development of real-time visualization or interactive animation of simulation results, which would require a dedicated post-processing module capable of dynamically updating representations as simulations progress. Another potential direction is the comparison of ParaView’s capabilities for post-processing LBM simulations with other commercially available software, such as MATLAB or ANSYS, to evaluate performance, flexibility, and ease of use.

Additionally, the program architecture could be extended to three-dimensional simulations, multi-phase flows, or thermo-fluid interactions in more complex geometries, further demonstrating the scalability and versatility of the combined Java + OpenCL + ParaView approach. Overall, the developed program and its post-processing workflow provide a robust, platform-independent toolset for both research and educational purposes in computational fluid dynamics.

This entry is offline, you can click here to edit this entry!
Academic Video Service