Abstract.

The scientific code generation package lbmpy supports the automated design and the efficient implementation of lattice Boltzmann method (LBM) through metaprogramming. It is based on a new, concise calculus for describing multiple relaxation-time LBMs, including techniques that enable the numerically advantageous subtraction of the constant background component from the populations. These techniques are generalized to a wide range of collision spaces and equilibrium distributions. The article contains an overview of lbmpy’s frontend and its code generation pipeline, which implements the new LBM calculus by means of symbolic formula manipulation tools and object-oriented programming. The generated codes have only a minimal number of arithmetic operations. Their automatic derivation rests on two novel chimera transforms that have been specifically developed for efficiently computing raw and central moments. Information contained in the symbolic representation of the methods is further exploited in a customized sequence of algebraic simplifications, further reducing computational cost. When combined, these algebraic transformations lead to concise and compact numerical kernels. Specifically, with these optimizations, the advanced central moment- and cumulant-based methods can be realized with only little additional cost as when compared with the simple Bhatnagar–Gross–Krook method. The effectiveness and flexibility of the new lbmpy code generation system is demonstrated in simulating Taylor–Green vortex decay and the automatic derivation of an LBM algorithm to solve the shallow water equations.

Keywords

  1. Lattice Boltzmann method
  2. metaprogramming
  3. code generation

MSC codes

  1. 65Y20
  2. 82C40

Get full access to this article

View all available purchase options and get full access to this article.

References

1.
IEEE standard for floating-point arithmetic, IEEE Std 754-2019 (Revision of IEEE 754-2008), (2019), pp. 1–84, https://doi.org/10.1109/IEEESTD.2019.8766229.
2.
P. Bailey, J. Myre, S. Walsh, D. Lilja, and M. Saar, Accelerating lattice Boltzmann fluid flow simulations using graphics processors, in Proceedings of the 2009 International Conference on Parallel Processing, IEEE, 2009, https://doi.org/10.1109/icpp.2009.38.
3.
M. Bauer, S. Eibl, C. Godenschwager, N. Kohl, M. Kuron, C. Rettinger, F. Schornbaum, C. Schwarzmeier, D. Thönnes, H. Köstler, and U. Rüde, waLBerla: A block-structured high-performance framework for multiphysics simulations, Comput. Math. Appl., 81 (2021), pp. 478–501, https://doi.org/10.1016/j.camwa.2020.01.007.
4.
M. Bauer, J. Hötzer, D. Ernst, J. Hammer, M. Seiz, H. Hierl, J. Hönig, H. Köstler, G. Wellein, B. Nestler, and U. Rüde, Code generation for massively parallel phase-field simulations, in Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis, ACM, 2019, pp. 1–32, https://doi.org/10.1145/3295500.3356186.
5.
M. Bauer, H. Köstler, and U. Rüde, lbmpy: Automatic code generation for efficient parallel lattice Boltzmann methods, J. Comput. Sci., 49 (2021), 101269, https://doi.org/10.1016/j.jocs.2020.101269.
6.
P. L. Bhatnagar, E. P. Gross, and M. Krook, A model for collision processes in gases. I. small amplitude processes in charged and neutral one-component systems, Phys. Rev., 94 (1954), pp. 511–525, https://doi.org/10.1103/physrev.94.511.
7.
H. Chen, S. Chen, and W. H. Matthaeus, Recovery of the Navier-Stokes equations using a lattice-gas Boltzmann method, Phys. Rev. A, 45 (1992), pp. R5339–R5342, https://doi.org/10.1103/PhysRevA.45.R5339.
8.
C. Coreixas, B. Chopard, and J. Latt, Comprehensive comparison of collision models in the lattice Boltzmann framework: Theoretical investigations, Phys. Rev. E, 100 (2019), 033305, https://doi.org/10.1103/physreve.100.033305.
9.
D. d’Humières, Multiple-relaxation–time lattice Boltzmann models in three dimensions, Philos. Trans. Roy. Soc. A, 360 (2002), pp. 437–451, https://doi.org/10.1098/rsta.2001.0955.
10.
B. Dünweg, U. D. Schiller, and A. J. C. Ladd, Statistical mechanics of the fluctuating lattice Boltzmann equation, Phys. Rev. E, 76 (2007), 036704, https://doi.org/10.1103/physreve.76.036704.
11.
L. Fei and K. H. Luo, Consistent forcing scheme in the cascaded lattice Boltzmann method, Phys. Rev. E, 96 (2017), 053307, https://doi.org/10.1103/physreve.96.053307.
12.
L. Fei, K. H. Luo, and Q. Li, Three-dimensional cascaded lattice Boltzmann method: Improved implementation and consistent forcing scheme, Phys. Rev. E, 97 (2018), 053309, https://doi.org/10.1103/physreve.97.053309.
13.
M. Geier, Ab initio Derivation of the Cascaded Lattice Boltzmann Automaton, Ph.D. thesis, University of Freiburg, Germany, 2006.
14.
M. Geier, A. Fakhari, and T. Lee, Conservative phase-field lattice Boltzmann model for interface tracking equation, Phys. Rev. E, 91 (2015), 063309, https://doi.org/10.1103/physreve.91.063309.
15.
M. Geier, A. Greiner, and J. G. Korvink, Cascaded digital lattice Boltzmann automata for high reynolds number flow, Phys. Rev. E, 73 (2006), 066705, https://doi.org/10.1103/physreve.73.066705.
16.
M. Geier, S. Lenz, M. Schönherr, and M. Krafczyk, Under-resolved and large eddy simulations of a decaying Taylor-Green vortex with the cumulant lattice Boltzmann method, Theor. Comput. Fluid Dyn., 35 (2020), pp. 169–208, https://doi.org/10.1007/s00162-020-00555-7.
17.
M. Geier, A. Pasquali, and M. Schönherr, Parametrization of the cumulant lattice Boltzmann method for fourth order accurate diffusion part I: Derivation and validation, J. Comput. Phys., 348 (2017), pp. 862–888, https://doi.org/10.1016/j.jcp.2017.05.040.
18.
M. Geier and M. Schönherr, Esoteric twist: An efficient in-place streaming algorithmus for the lattice Boltzmann method on massively parallel hardware, Computation, 5 (2017), p. 19, https://doi.org/10.3390/computation5020019.
19.
M. Geier, M. Schönherr, A. Pasquali, and M. Krafczyk, The cumulant lattice Boltzmann equation in three dimensions: Theory and validation, Comput. Math. Appl., 70 (2015), pp. 507–547, https://doi.org/10.1016/j.camwa.2015.05.001.
20.
I. Ginzburg, F. Verhaeghe, and D. D’Humières, Two-relaxation-time lattice Boltzmann scheme: About parametrization, velocity, pressure and mixed boundary conditions, Commun. Comput. Phys., 3 (2008), pp. 427–478.
21.
G. Gruszczyński, T. Mitchell, C. Leonardi, Ł. Łaniewski-Wołłk, and T. Barber, A cascaded phase-field lattice Boltzmann model for the simulation of incompressible, immiscible fluids with high density contrast, Comput. Math. Appl., 79 (2020), pp. 1049–1071, https://doi.org/10.1016/j.camwa.2019.08.018.
22.
Z. Guo, C. Zheng, and B. Shi, Discrete lattice effects on the forcing term in the lattice Boltzmann method, Phys. Rev. E, 65 (2002), 046308, https://doi.org/10.1103/physreve.65.046308.
23.
T. Gysi, T. Grosser, and T. Hoefler, MODESTO: Data-centric analytic optimization of complex stencil programs on heterogeneous architectures, in Proceedings of the 29th ACM on International Conference on Supercomputing, ICS ’15, Association for Computing Machinery, New York, NY, 2015, pp. 177–186, https://doi.org/10.1145/2751205.2751223.
24.
X. He and L.-S. Luo, Lattice Boltzmann model for the incompressible Navier-Stokes equation, J. Stat. Phys., 88 (1997), pp. 927–944, https://doi.org/10.1023/b:joss.0000015179.12689.e4.
25.
X. He, X. Shan, and G. D. Doolen, Discrete Boltzmann equation model for nonideal gases, Phys. Rev. E, 57 (1998), pp. R13–R16, https://doi.org/10.1103/physreve.57.r13.
26.
M. Holzer, M. Bauer, H. Köstler, and U. Rüde, Highly efficient lattice Boltzmann multiphase simulations of immiscible fluids at high-density ratios on CPUs and GPUs through code generation, Int. J. High Perform. Comput. Appl., 35 (2021), pp. 413–427, https://doi.org/10.1177/10943420211016525.
27.
M. J. Krause, A. Kummerländer, S. J. Avis, H. Kusumaatmaja, D. Dapelo, F. Klemens, M. Gaedtke, N. Hafen, A. Mink, R. Trunk, J. E. Marquardt, M.-L. Maier, M. Haussmann, and S. Simonis, OpenLB—open source lattice Boltzmann code, Comput. Math. Appl., 81 (2021), pp. 258–288, https://doi.org/10.1016/j.camwa.2020.04.033.
28.
T. Krüger, H. Kusumaatmaja, A. Kuzmin, O. Shardt, G. Silva, and E. M. Viggen, The Lattice Boltzmann Method, Springer International Publishing, Switzerland, 2017, https://doi.org/10.1007/978-3-319-44649-3.
29.
Ł. Łaniewski-Wołłk and J. Rokicki, Adjoint lattice Boltzmann for topology optimization on multi-GPU architecture, Comput. Math. Appl., 71 (2016), pp. 833–848, https://doi.org/10.1016/j.camwa.2015.12.043.
30.
J. Latt and B. Chopard, Lattice Boltzmann Method with Regularized Non-Equilibrium Distribution Functions, https://arxiv.org/abs/physics/0506157, 2005.
31.
J. Latt, O. Malaspinas, D. Kontaxakis, A. Parmigiani, D. Lagrava, F. Brogi, M. B. Belgacem, Y. Thorimbert, S. Leclaire, S. Li, F. Marson, J. Lemus, C. Kotsalos, R. Conradin, C. Coreixas, R. Petkantchin, F. Raynaud, J. Beny, and B. Chopard, Palabos: Parallel lattice Boltzmann solver, Comput. Math. Appl., 81 (2021), pp. 334–350, https://doi.org/10.1016/j.camwa.2020.03.022.
32.
M. Lehmann, Esoteric pull and esoteric push: Two simple in-place streaming schemes for the lattice Boltzmann method on GPUs, Computation, 10 (2022), p. 92, https://doi.org/10.3390/computation10060092.
33.
M. Lehmann, M. J. Krause, G. Amati, M. Sega, J. Harting, and S. Gekle, Accuracy and performance of the lattice Boltzmann method with 64-bit, 32-bit, and customized 16-bit number formats, Phys. Rev. E, 106 (2022), 015308, https://doi.org/10.1103/physreve.106.015308.
34.
C. Lengauer, S. Apel, M. Bolten, S. Chiba, U. Rüde, J. Teich, A. Größlinger, F. Hannig, H. Köstler, L. Claus, A. Grebhahn, S. Groth, S. Kronawitter, S. Kuckuk, H. Rittich, C. Schmitt, and J. Schmitt, Exastencils: Advanced multigrid solver generation, in Software for Exascale Computing - SPPEXA 2016-2019, H.-J. Bungartz, S. Reiz, B. Uekermann, P. Neumann, and W. E. Nagel, eds., Lect. Notes Comput. Sci. Engrg. 136, Springer International Publishing, Cham, 2020, pp. 405–452.
35.
A. Logg and G. N. Wells, Dolfin: Automated finite element computing, ACM Trans. Math. Softw., 37 (2010), pp. 1–28, https://doi.org/10.1145/1731022.1731030.
36.
N. Maruyama, T. Nomura, K. Sato, and S. Matsuoka, Physis: An implicitly parallel programming model for stencil computations on large-scale gpu-accelerated supercomputers, in Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’11, Association for Computing Machinery, New York, NY, 2011, https://doi.org/10.1145/2063384.2063398.
37.
A. Meurer, C. P. Smith, M. Paprocki, O. Čertík, S. B. Kirpichev, M. Rocklin, A. Kumar, S. Ivanov, J. K. Moore, S. Singh, T. Rathnayake, S. Vig, B. E. Granger, R. P. Muller, F. Bonazzi, H. Gupta, S. Vats, F. Johansson, F. Pedregosa, M. J. Curry, A. R. Terrel, S. Roučka, A. Saboo, I. Fernando, S. Kulal, R. Cimrman, and A. Scopatz, Sympy: Symbolic computing in python, PeerJ Comput. Sci., 3 (2017), e103, https://doi.org/10.7717/peerj-cs.103.
38.
OpenMP Architecture Review Board, OpenMP Application Programming Interface Version 5.2, 2021.
39.
K. N. Premnath and S. Banerjee, On the three-dimensional central moment lattice Boltzmann method, J. Stat. Phys., 143 (2011), pp. 747–794, https://doi.org/10.1007/s10955-011-0208-9.
40.
F. Rathgeber, D. A. Ham, L. Mitchell, M. Lange, F. Luporini, A. T. T. Mcrae, G.-T. Bercea, G. R. Markall, and P. H. J. Kelly, Firedrake: Automating the finite element method by composing abstractions, ACM Trans. Math. Softw., 43 (2016), pp. 1–27, https://doi.org/10.1145/2998441.
41.
P. Rawat, M. Kong, T. Henretty, J. Holewinski, K. Stock, L.-N. Pouchet, J. Ramanujam, A. Rountev, and P. Sadayappan, SDSLc: A Multi-target Domain-specific Compiler for Stencil Computations, WOLFHPC ’15, Association for Computing Machinery, New York, NY, 2015, https://doi.org/10.1145/2830018.2830025.
42.
A. D. Rosis, Non-orthogonal central moments relaxing to a discrete equilibrium: A D2Q9 lattice Boltzmann model, Europhys. Lett., 116 (2016), 44003, https://doi.org/10.1209/0295-5075/116/44003.
43.
A. D. Rosis, A central moments-based lattice Boltzmann scheme for shallow water equations, Comput. Methods Appl. Mech. Engrg., 319 (2017), pp. 379–392, https://doi.org/10.1016/j.cma.2017.03.001.
44.
A. D. Rosis, Nonorthogonal central-moments-based lattice Boltzmann scheme in three dimensions, Phys. Rev. E, 95 (2017), 013310, https://doi.org/10.1103/physreve.95.013310.
45.
F. Schornbaum and U. Rüde, Massively parallel algorithms for the lattice Boltzmann method on NonUniform grids, SIAM J. Sci. Comput., 38 (2016), pp. C96–C126, https://doi.org/10.1137/15m1035240.
46.
F. Schornbaum and U. Rüde, Extreme-scale block-structured adaptive mesh refinement, SIAM J. Sci. Comput., 40 (2018), pp. C358–C387, https://doi.org/10.1137/17m1128411.
47.
Y. P. Sitompul and T. Aoki, A filtered cumulant lattice Boltzmann method for violent two-phase flows, J. Comput. Phys., 390 (2019), pp. 93–120, https://doi.org/10.1016/j.jcp.2019.04.019.
48.
P. A. Skordos, Initial and boundary conditions for the lattice Boltzmann method, Phys. Rev. E, 48 (1993), pp. 4823–4842, https://doi.org/10.1103/physreve.48.4823.
49.
S. Venturi, S. D. Francesco, M. Geier, and P. Manciola, Forcing for a cascaded lattice Boltzmann shallow water model, Water, 12 (2020), p. 439, https://doi.org/10.3390/w12020439.
50.
S. Venturi, S. D. Francesco, M. Geier, and P. Manciola, Modelling flood events with a cumulant CO lattice Boltzmann shallow water model, Nat. Hazards, 105 (2020), pp. 1815–1834, https://doi.org/10.1007/s11069-020-04378-x.
51.
S. Venturi, S. D. Francesco, M. Geier, and P. Manciola, A new collision operator for lattice Boltzmann shallow water model: A convergence and stability study, Adv. Water Resour., 135 (2020), 103474, https://doi.org/10.1016/j.advwatres.2019.103474.
52.
G. Wellein, T. Zeiser, G. Hager, and S. Donath, On the single processor performance of simple lattice Boltzmann kernels, Comput. Fluids, 35 (2006), pp. 910–919, https://doi.org/10.1016/j.compfluid.2005.02.008.
53.
M. Wittmann, T. Zeiser, G. Hager, and G. Wellein, Comparison of different propagation steps for lattice Boltzmann methods, Comput. Math. Appl., 65 (2013), pp. 924–935, https://doi.org/10.1016/j.camwa.2012.05.002.
54.
J. Zhou, A lattice Boltzmann model for the shallow water equations, Comput. Methods Appl. Mech. Engrg., 191 (2002), pp. 3527–3539, https://doi.org/10.1016/s0045-7825(02)00291-8.

Information & Authors

Information

Published In

cover image SIAM Journal on Scientific Computing
SIAM Journal on Scientific Computing
Pages: C233 - C254
ISSN (online): 1095-7197

History

Submitted: 4 November 2022
Accepted: 3 April 2023
Published online: 4 August 2023

Keywords

  1. Lattice Boltzmann method
  2. metaprogramming
  3. code generation

MSC codes

  1. 65Y20
  2. 82C40

Authors

Affiliations

Chair for System Simulation, Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, 91058 Germany.
Chair for System Simulation, Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, 91058 Germany, and CERFACS, 31100 Toulouse, France.
Chair for System Simulation, Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, 91058 Germany, and CERFACS, 31100 Toulouse, France.

Funding Information

Funding: The authors acknowledge funding by the SCALABLE project. SCALABLE has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement 956000. The authors are grateful to the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) for funding projects 408062554 and 433735254. The authors also gratefully acknowledge financial support by the Bavarian State Ministry of Science and the Arts through the Competence Network for Scientific High Performance Computing in Bavaria (KONWIHR).

Metrics & Citations

Metrics

Citations

If you have the appropriate software installed, you can download article citation data to the citation manager of your choice. Simply select your manager software from the list below and click Download.

Cited By

There are no citations for this item

View Options

View options

PDF

View PDF

Full Text

View Full Text

Media

Figures

Other

Tables

Share

Share

Copy the content Link

Share with email

Email a colleague

Share on social media