Skip to content
Projekte

lettucecfd/lettuce has 298 GitHub stars and 58 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 21:58 UTC. Last push 2026-10-06.

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
Aktualisierung verzögert
in 15 days
Aktualisierung verzögert
in 1 month
Aktualisierung verzögert

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

Über uns

Computational Fluid Dynamics based on PyTorch and the Lattice Boltzmann Method

Maschinelles Lernen

README.md

Original

lettuce

CI Status Documentation Status DOI

GPU-accelerated Lattice Boltzmann Simulations in Python

Lettuce is a Computational Fluid Dynamics framework based on the lattice Boltzmann method (LBM).

  • GPU-Accelerated Computation: Utilizes PyTorch for high performance and efficient GPU utilization.
  • Rapid Prototyping: Supports both 2D and 3D simulations for quick and reliable analysis.
  • Advanced Techniques: Integrates neural networks and automatic differentiation to enhance LBM.
  • Optimized Performance: Includes custom PyTorch extensions for native CUDA kernels.

Resources

Getting Started

To find some very simple examples of how to use lettuce, please have a look at the examples. These will guide you through lettuce's main features. Please ensure you have Jupyter installed to run the Jupyter notebooks.

Installation

Lettuce is published on PyPI as lettucecfd; the import name and the command line tool stay lettuce. Python 3.12 or newer is required.

pip install lettucecfd

or, in a project managed with uv:

uv add lettucecfd

This installs the default PyTorch build from PyPI. To select a specific build (CPU only, or a particular CUDA version), see the section Depending on lettuce from another project below.

Check the installation by computing the convergence order on the CPU:

lettuce --no-cuda convergence

For a CUDA-driven simulation on one GPU, omit --no-cuda, e.g. to measure the performance:

lettuce benchmark

If CUDA is not found, make sure that CUDA-capable GPU drivers are installed and compatible with the CUDA version of the installed PyTorch build.

Installing from source

To work on lettuce itself, install the uv package manager, clone the repository and let uv set up the environment, choosing one of the hardware extras cpu, cu124, cu126, cu128 or cu130:

git clone https://github.com/lettucecfd/lettuce
cd lettuce
uv sync --extra cpu    # or cu124, cu126, cu128, cu130

This installs lettuce in editable mode together with the development tools, so code changes take effect immediately. Run the test suite with:

uv run --extra cpu pytest tests

We successfully tested CUDA 12.4, 12.6, 12.8 and 13.0. See CONTRIBUTING.md for details on the development setup.

Depending on lettuce from another project

The distribution is published as lettucecfd; the import name stays lettuce. Note that the extras (cpu, cu124, cu126, cu128, cu130) only constrain the PyTorch version — uv's index configuration is not carried in the published package metadata, so uv add lettucecfd[cu128] on its own installs the default PyTorch build from PyPI. To get a specific CUDA build, copy the index configuration into your own pyproject.toml:

[project]
dependencies = ["lettucecfd[cu128]"]

[tool.uv.sources]
torch = [{ index = "pytorch-cu128" }]

[[tool.uv.index]]
name = "pytorch-cu128"
url = "https://download.pytorch.org/whl/cu128"
explicit = true

Substitute cu124, cu126, cu130 or cpu as needed — the extra and the index URL have to name the same variant.

Citation

If you use Lettuce in your research, please cite the following paper:

@inproceedings{bedrunka2021lettuce,
  title={Lettuce: PyTorch-Based Lattice Boltzmann Framework},
  author={Bedrunka, Mario Christopher and Wilde, Dominik and Kliemank, Martin and Reith, Dirk and Foysi, Holger and Kr{\"a}mer, Andreas},
  booktitle={High Performance Computing: ISC High Performance Digital 2021 International Workshops, Frankfurt am Main, Germany, June 24--July 2, 2021, Revised Selected Papers},
  pages={40},
  organization={Springer Nature}
}

Credits

We use the following third-party packages:

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

License

  • Free software: MIT license, as found in the LICENSE file.