Abstract
The lattice Boltzmann method (LBM) is an efficient simulation technique for computational fluid mechanics and beyond. It is based on a simple stream-and-collide algorithm on Cartesian grids, which is easily compatible with modern machine learning architectures. While it is becoming increasingly clear that deep learning can provide a decisive stimulus for classical simulation techniques, recent studies have not addressed possible connections between machine learning and LBM. Here, we introduce Lettuce, a PyTorch-based LBM code with a threefold aim. Lettuce enables GPU accelerated calculations with minimal source code, facilitates rapid prototyping of LBM models, and enables integrating LBM simulations with PyTorch’s deep learning and automatic differentiation facility. As a proof of concept for combining machine learning with the LBM, a neural collision model is developed, trained on a doubly periodic shear layer and then transferred to a different flow, a decaying turbulence. We also exemplify the added benefit of PyTorch’s automatic differentiation framework in flow control and optimization. To this end, the spectrum of a forced isotropic turbulence is maintained without further constraining the velocity field. The source code is freely available from https://github.com/lettucecfd/lettuce.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Bauer, M., et al.: waLBerla: a block-structured high-performance framework for multiphysics simulations. Comput. Math. with Appl. 81, 478–501 (2021)
Bhatnagar, P.L., Gross, E.P., Krook, M.: A model for collision processes in gases. I. Small amplitude processes in charged and neutral one-component systems. Phys. Rev. 94(3), 511–525 (1954)
Brachet, M.E., Meiron, D.I., Orszag, S.A., Nickel, B., Morf, R.H., Frisch, U.: Small-scale structure of the Taylor-green vortex. J. Fluid Mech. 130, 411–452 (1983)
Brown, D.L.: Performance of under-resolved two-dimensional incompressible flow simulations. J. Comput. Phys. 122(1), 165–183 (1995)
Chen, T., Wen, X., Wang, L.P., Guo, Z., Wang, J., Chen, S.: Simulation of three-dimensional compressible decaying isotropic turbulence using a redesigned discrete unified gas kinetic scheme. Phys. Fluids 32(12), 125104 (2020)
Coreixas, C., Latt, J.: Compressible lattice Boltzmann methods with adaptive velocity stencils: an interpolation-free formulation. Phys. Fluids 32(11), 116102 (2020)
Dellar, P.J.: Incompressible limits of lattice Boltzmann equations using multiple relaxation times. J. Comput. Phys. 190(2), 351–370 (2003)
Diwan, S.S., Ravichandran, S., Govindarajan, R., Narasimha, R.: Understanding transmission dynamics of Covid-19-type infections by direct numerical simulations of cough/sneeze flows. Trans. Indian Natl. Acad. Eng. 5, 255–261 (2020)
Fabregat, A., Gisbert, F., Vernet, A., Dutta, S., Mittal, K., Pallarès, J.: Direct numerical simulation of the turbulent flow generated during a violent expiratory event. Phys. Fluids 33(3), 035122 (2021)
Font, B., Weymouth, G.D., Nguyen, V.T., Tutty, O.R.: Deep learning of the spanwise-averaged Navier-Stokes equations. J. Comput. Phys. 434, 110199 (2021)
Frapolli, N., Chikatamarla, S.S., Karlin, I.V.: Entropic lattice Boltzmann model for compressible flows. Phys. Rev. E Stat. Nonlinear Soft Matter Phys. 92(6), 061301 (2015)
Geier, M., Pasquali, A., Schönherr, M.: Parametrization of the cumulant lattice Boltzmann method for fourth order accurate diffusion. Part I: Derivation and validation. J. Comput. Phys. 348, 862–888 (2017)
Ginzburg, I., Verhaeghe, F., D’Humières, D.: Two-relaxation-time Lattice Boltzmann scheme: about parametrization, velocity, pressure and mixed boundary conditions. Commun. Comput. Phys. 3(2), 427–478 (2008)
Godenschwager, C., Schornbaum, F., Bauer, M., Köstler, H., Rüde, U.: A framework for hybrid parallel flow simulations with a trillion cells in complex geometries. In: Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis - SC 2013, New York, NY, USA, pp. 1–12. ACM Press (2013)
Hennigh, O.: Lat-Net: compressing lattice Boltzmann flow simulations using deep neural networks. arXiv preprint arXiv:1705.09036 (2017)
Herrera, P.: pyevtk 1.2.0. PyPI (2021). https://pypi.org/project/pyevtk/
Heuveline, V., Krause, M.J.: OpenLB: towards an efficient parallel open source library for lattice Boltzmann fluid flow simulations. In: International Workshop on State-of-the-Art in Scientific and Parallel Computing, PARA, vol. 9 (2010)
Karlin, I.V., Bösch, F., Chikatamarla, S.: Gibbs’ principle for the lattice-kinetic theory of fluid dynamics. Phys. Rev. E Stat. Nonlinear Soft Matter Phys. 90(3), 1–5 (2014)
Kochkov, D., Smith, J.A., Alieva, A., Wang, Q., Brenner, M.P., Hoyer, S.: Machine learning accelerated computational fluid dynamics. Proc. Nat. Acad. Sci. 118(21), e2101784118 (2021).
Krämer, A., Wilde, D., Küllmer, K., Reith, D., Foysi, H.: Pseudoentropic derivation of the regularized lattice Boltzmann method. Phys. Rev. E 100(2), 023302 (2019)
Krüger, T., Kusumaatmaja, H., Kuzmin, A., Shardt, O., Silva, G., Viggen, E.M.: The Lattice Boltzmann Method: Principles and Practice. Springer, Heidelberg (2017)
Lallemand, P., Luo, L.S.: Theory of the lattice Boltzmann method: dispersion, dissipation, isotropy, Galilean invariance, and stability. Phys. Rev. E Stat. Phys. Plasmas Fluids Relat. Interdiscip. Top. 61(6), 6546–6562 (2000)
Latt, J., Chopard, B.: Lattice Boltzmann method with regularized pre-collision distribution functions. Math. Comput. Simul. 72(2–6), 165–168 (2006)
Latt, J., Coreixas, C., Beny, J., Parmigiani, A.: Efficient supersonic flow simulations using lattice Boltzmann methods based on numerical equilibria. Philos. Trans. R. Soc. A Math. Phys. Eng. Sci. 378(2175), 20190559 (2020)
Latt, J., et al.: Palabos: parallel lattice Boltzmann solver. Comput. Math. Appl. 81, 334–350 (2021)
Lenz, S., et al.: Towards real-time simulation of turbulent air flow over a resolved urban canopy using the cumulant lattice Boltzmann method on a GPGPU. J. Wind Eng. Ind. Aerodyn. 189, 151–162 (2019)
McNamara, G.R., Zanetti, G.: Use of the Boltzmann equation to simulate lattice-gas automata. Phys. Rev. Lett. 61(20), 2332–2335 (1988)
Mora, P., Morra, G., Yuen, D.A.: A concise python implementation of the lattice Boltzmann method on HPC for geo-fluid flow. Geophys. J. Int. 220(1), 682–702 (2020)
Obrecht, C., Kuznik, F., Tourancheau, B., Roux, J.J.: Scalable lattice Boltzmann solvers for CUDA GPU clusters. Parallel Comput. 39(6), 259–270 (2013)
Pastewka, L., Greiner, A.: HPC with python: an MPI-parallel implementation of the lattice Boltzmann method. In: Proceedings of the 5th bwHPC Symposium (2019)
Paszke, A., et al.: PyTorch: an imperative style, high-performance deep learning library. In: Wallach, H., Larochelle, H., Beygelzimer, A., D’Alché-Buc, F., Fox, E., Garnett, R. (eds.) Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc. (2019)
Porté-Agel, F., Bastankhah, M., Shamsoddin, S.: Wind-turbine and wind-farm flows: a review. Boundary Layer Meteorol. 174(1), 1–59 (2020)
Rüttgers, M., Koh, S.-R., Jitsev, J., Schröder, W., Lintermann, A.: Prediction of acoustic fields using a lattice-Boltzmann method and deep learning. In: Jagode, H., Anzt, H., Juckeland, G., Ltaief, H. (eds.) ISC High Performance 2020. LNCS, vol. 12321, pp. 81–101. Springer, Cham (2020)
Saadat, M.H., Hosseini, S.A., Dorschner, B., Karlin, I.V.: Extended lattice Boltzmann model for gas dynamics. Phys. Fluids 33(4), 046104 (2021)
Saadat, M.H., Bösch, F., Karlin, I.V.: Lattice Boltzmann model for compressible flows on standard lattices: variable Prandtl number and adiabatic exponent. Phys. Rev. E 99(1), 013306 (2019)
Sagaut, P.: Large Eddy Simulation for Incompressible Flows. An Introduction. Springer, Heidelberg (2006)
Samtaney, R., Pullin, D.I., Kosović, B.: Direct numerical simulation of decaying compressible turbulence and shocklet statistics. Phys. Fluids 13(5), 1415–1430 (2001)
Schmieschek, S., et al.: LB3D: a parallel implementation of the lattice-Boltzmann method for simulation of interacting amphiphilic fluids. Comput. Phys. Commun. 217, 149–161 (2017)
Brunton, S.L., Noack, B.R., Koumoutsakos, P.: Machine learning for fluid mechanics. Annu. Rev. Fluid Mech. 52, 477–508 (2020)
Um, K., Fei, Y.R., Holl, P., Brand, R., Thuerey, N.: Solver-in-the-loop: learning from differentiable physics to interact with iterative PDE-solvers. In: 34th Conference on Neural Information Processing Systems (NeurIPS 2020), Vancouver, Canada, vol. 1, no. c, pp. 1–37 (2020)
Wichmann, K.R., Kronbichler, M., Löhner, R., Wall, W.A.: A runtime based comparison of highly tuned lattice Boltzmann and finite difference solvers. Int. J. High Perform. Comput. Appl. (2021).
Wilcox, D.C.: Turbulence Modeling for CFD. DCW Industries, CA (1993)
Wilde, D., Krämer, A., Bedrunka, M., Reith, D., Foysi, H.: Cubature rules for weakly and fully compressible off-lattice Boltzmann methods. J. Comput. Sci. 51, 101355 (2021)
Wilde, D., Krämer, A., Reith, D., Foysi, H.: Semi-Lagrangian lattice Boltzmann method for compressible flows. Phys. Rev. E 101(5), 53306 (2020)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Bedrunka, M.C., Wilde, D., Kliemank, M., Reith, D., Foysi, H., Krämer, A. (2021). Lettuce: PyTorch-Based Lattice Boltzmann Framework. In: Jagode, H., Anzt, H., Ltaief, H., Luszczek, P. (eds) High Performance Computing. ISC High Performance 2021. Lecture Notes in Computer Science(), vol 12761. Springer, Cham. https://doi.org/10.1007/978-3-030-90539-2_3
Download citation
DOI: https://doi.org/10.1007/978-3-030-90539-2_3
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-90538-5
Online ISBN: 978-3-030-90539-2
eBook Packages: Computer ScienceComputer Science (R0)