This paper presents a program developed for simulating fluidfluid flow and temperature fields flow and temperature fields ussing 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 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).
This paper presents a program developed for simulating fluidfluid flow and temperature fields flow and temperature fields ussing 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 graphicsgraphics processing units (GPUs) 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 datadata representation and analysis representation and analysis[4][5].
The program is implemented in Java and uses the OpenCLOpenCL standard standard for parallel execution. This architecture ensures both software and hardware independence, and provides significantsignificant speed-ups speed-ups compared to sequential execution on CPU cores, as demonstrated in previous work [7].
The LatticeLattice Boltzmann equation 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 macroscopicmacroscopic density 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 temperaturetemperature field 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 macroscopicmacroscopic temperature temperature is defined as:
T=∑igiT = \sum_i g_i
The kinematickinematic viscosity viscosity and thermalthermal diffusivity 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 naturalnatural convection in a square cavity 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 dimensionlessdimensionless flow 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 distributiondistribution functions functions in n two steps: the collisioncollision step 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].
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 JOCLJOCL library 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 flowflow and temperature distribution functions and temperature distribution functions are see set. Two kernels are used:
Flow kernel: computes boundary conditions, macroscopic quantities, equilibrium distributions, collision, and streaming for the flow field.
Temperature kernel: computes the same steps for the temperature field.
After computation, a method in the host part writes the results to .vti files files compatible with ParaView, enabling post-processing and data representation.
The benchmark problem is naturalnatural convection in a square cavity convection in a square cavity of height HH, filled with air (Prandtl number 0.71). The upperupper and lower walls and lower walls are adiabatic, the leftleft wall wall is uniformly heated, and the rightright wall 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 temperaturetemperature fields fields (Figures 4–6) and flowflow fields / streamlines fields / streamlines (Figures 7–9) in ParaView.
The program successfully demonstrates the parallelparallel simulation of fluid flow and temperature fields simulation of fluid flow and temperature fields ussing the Lattice Boltzmann Method, achieving platformplatform independence independence and high computational efficiency. Parallel execution on multi-core CPUs and GPUs provides significantsignificant speed-ups 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 completecomplete and efficient workflow and efficient workflow foror 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-timereal-time visualization or interactive animation 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 comparisoncomparison of ParaView’s capabilities 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-fluidthermo-fluid interactions 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.