Lettuce: PyTorch-based Lattice Boltzmann Framework

Mario Christopher Bedrunka, Dominik Wilde, Martin Kliemank, Dirk Reith, Holger Foysi +1 more
6/24/2021
28 citations
physics.comp-phcs.LGphysics.flu-dyn

Official code: lettucecfd/lettuce (298 stars, Python, MIT, PyTorch, last commit 2026-04-13).

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

lettucecfd/lettuceOfficial100%
PyTorchMIT

Computational Fluid Dynamics based on PyTorch and the Lattice Boltzmann Method

29859PythonMay 7, 20197 months agoMIT
cfdlattice-boltzmannmachine-learningphysics-simulationpytorch+1 more

Similar Papers

Cite this paper

@article{bedrunka2021lettuce,
  title  = {Lettuce: PyTorch-based Lattice Boltzmann Framework},
  author = {Mario Christopher Bedrunka and Dominik Wilde and Martin Kliemank and Dirk Reith and Holger Foysi and Andreas Krämer},
  year   = {2021},
  eprint = {2106.12929},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2106.12929}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2106.12929.svg)](https://codeofpaper.com/paper/2106.12929)

Discussion