Automatic Code Generation for the Cumulant Lattice Boltzmann Method

Hennig F, Holzer M, Rüde U (2021)

Publication Language: English

Publication Type: Conference contribution, Abstract of a poster

Publication year: 2021

Event location: Online


We present a fully automatic code generation pipeline for the rapid development of cumulant-based lattice Boltzmann methods, as an extension of the Python-based open-source code generation framework lbmpy. In this pipeline, a given cumulant-based method is first described by the cumulants spanning its collision space, their associated relaxation rates and their values at equilibrium. Based on this abstract method definition, the collision rule is derived in symbolic form as a sequence of equations. From those, a kernel implementation in C, CUDA or OpenCL can be generated automatically. The emphasis of this work lies on the automatic derivation process of the collision equations. These comprise the mapping of the discrete particle distributions to cumulant space, the cumulant relaxation process, and the backward transform to the post-collision distributions. Both transformations use central moments as intermediate values. Equations relating cumulants to central moments are obtained by differentiating identities of their respective generating functions. For the mapping between particle distributions and central moments, multiple derivation procedures are available, which lead to equations with different numerical properties. To further reduce the number of arithmetic operations, a series of simplifications can be applied to the collision equations. The degree of simplification, along with other parameters of this pipeline, can be controlled through its Python interface. This way, both easily readable educational codes and highly optimized implementations can be obtained. When used in an interactive environment, such as Jupyter notebooks, this enables a rapid development process on the symbolic level. Furthermore, the integration of lbmpy with the distributed-memory simulation framework waLBerla allows a seamless inclusion of generated kernels into large-scale parallel simulations.

Authors with CRIS profile

How to cite


Hennig, F., Holzer, M., & Rüde, U. (2021, July). Automatic Code Generation for the Cumulant Lattice Boltzmann Method. Poster presentation at Conference: ICMMES 2021, Online.


Hennig, Federik, Markus Holzer, and Ulrich Rüde. "Automatic Code Generation for the Cumulant Lattice Boltzmann Method." Presented at Conference: ICMMES 2021, Online 2021.

BibTeX: Download