uniGasFoam+: Accelerating large-scale rarefied gas flow simulations

Rarefied gas flows play a critical role in many technological applications spanning from spacecraft reentry and electric propulsion to vacuum systems and micro-electro-mechanical systems [1,2]. Across these seemingly disparate applications, a common challenge is emerging: the need to simulate increasingly large and complex systems at unprecedented scales. Industrially relevant studies demand simulations of complete vehicles and devices, pushing computational requirements to the forefront. At such scales, it is no longer the fidelity of the physical model, but the computational cost of resolving the flow, that fundamentally constrains the questions that can be addressed.

The Direct Simulation Monte Carlo (DSMC) method [3] reproduces the physics of the Boltzmann equation by tracking the motion and the collisions of a large number of computational particles representing the real gas molecules. Its cost is proportional to the number of simulated particles, which grows rapidly as the gas becomes denser, since both the molecular mean free path and the mean collision time must be resolved. Multiscale solvers such as uniGasFoam [2] relax this constraint by adopting a stochastic particle Bhatnagar-Gross-Krook description [4] in the near-continuum regions of the flow, where DSMC is most expensive. The cost per particle nevertheless remains, and in a large simulation it is that cost, repeated over millions of particles and thousands of time steps, which decides whether a use case runs overnight or over a month.

At FLOW Matters Consultancy, we recently completed an optimization campaign on uniGasFoam [2], the open-source multiscale rarefied gas flow solver built on OpenFOAM [5], aimed at reducing that cost without touching the physics.

The first of two main developments concerns particle tracking. OpenFOAM advances particles barycentrically, decomposing every cell into tetrahedra and moving the particle from one tetrahedron to the next while carrying barycentric coordinates and tetrahedron indices alongside its position. The scheme is general and robust, but for the typical static meshes used in DSMC it is more robust than the problem requires. In our optimized version, uniGasFoam+, particles are tracked in Cartesian space: the trajectory is intersected with the planes of the faces of the cell occupied by the particle, and the nearest forward crossing identifies the exit face. Fewer operations are performed at each face crossing and far less mesh connectivity is needed.

The second development concerns memory. Every phase of a time step pairs a particle with the cell it occupies, whether to read mesh connectivity, to accumulate macroscopic fields, or to gather the particles of a cell for the collision routine. Particles are created in a cell ascending order when a simulation is initialized, so initially particle order in memory follows cell order and these accesses are sequential. Free particle motion then progressively decorrelates the two orderings, over a characteristic time of a few tens of time steps, and the same accesses degrade into random ones. At constant particle number, with identical work performed at every step, the wall time of the original uniGasFoam solver increases threefold before saturating. uniGasFoam+ therefore reorders the particle population back into ascending cell order periodically, at an interval which is dynamically determined by weighing the measured cost of the reordering operation against the performance loss accumulated since the previous reorder. The ordering within each cell is preserved, so collision pairing, the sequence of random numbers and therefore the results are unaffected.

To quantify the benefit of the optimization campaign, we simulated the reentry of the SpaceX Dragon capsule at an altitude of 100 km with both solvers. The wall-time per time step is reported in the figure above: the original solver rises from approximately 0.7 s to approximately 2.1 s over the first 150 time steps before saturating, whereas uniGasFoam+ remains flat at approximately 0.3 s. The small periodic peaks seen in uniGasFoam+ correspond to the reordering of the particle population, which accounts for 3.4% of the step. The breakdown per algorithmic phase is reported in the table above: particle tracking falls from 1.310 s to 0.153 s per time step, the indexing pass which assigns particles to cells is absorbed into the tracking loop, and the accumulation of the macroscopic quantities, restructured so that each particle writes into contiguous memory, falls from 0.427 s to 0.029 s. Collisions, which were not modified, are twice as fast simply because the particles they operate on are now memory adjacent. Overall, uniGasFoam+ is more than 7 times faster for this case compared to the original solver.
 
This project highlights our commitment to delivering cutting-edge simulation tools that bridge the gap between fundamental research and real-world applications. At FLOW Matters, we develop, extend and optimize high-fidelity simulation methods so that the size of a design study is set by the engineering question rather than by the available computational budget. From MEMS and vacuum systems to spacecraft reentry, we help our clients simulate larger and more demanding problems, with the same confidence in the underlying physics.

[1] N. Vasileiadis, C. White, “hybridDCFoam: A coupled DSMC/Navier-Stokes-Fourier solver for steady-state multiscale rarefied gas flows”, Adv. Eng. Softw., vol. 193, 2024.

[2] N. Vasileiadis, G. Tatsios, C. White, D. A. Lockerby, M. K. Borg, L. Gibelli, “uniGasFoam: A particle-based OpenFOAM solver for multiscale rarefied gas flows”, Comput. Phys. Commun., vol. 310, 2025.

[3] G. A. Bird, “Molecular Gas Dynamics and the Direct Simulation of Gas Flows”, Clarendon, 1994.

[4] F. Fei, J. Zhang, J. Li, Z. Liu, “A unified stochastic particle Bhatnagar-Gross-Krook method for multiscale gas flows”, J. Comput. Phys., vol. 400, 2020.

[5] H. G. Weller, G. Tabor, H. Jasak, C. Fureby, “A tensorial approach to computational continuum mechanics using object-oriented techniques”, Comput. Phys., vol. 12, 1998.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *