Home

Awesome

License GitHub star chart

<p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/logo-transparent.png" alt="" width="300"> </p>

XLB: A Differentiable Massively Parallel Lattice Boltzmann Library in Python for Physics-Based Machine Learning

🎉 Exciting News! 🎉 XLB version 0.2.0 has been released, featuring a complete rewrite of the library and introducing support for the NVIDIA Warp backend! XLB can now be installed via pip: pip install xlb.

XLB is a fully differentiable 2D/3D Lattice Boltzmann Method (LBM) library that leverages hardware acceleration. It supports JAX and NVIDIA Warp backends, and is specifically designed to solve fluid dynamics problems in a computationally efficient and differentiable manner. Its unique combination of features positions it as an exceptionally suitable tool for applications in physics-based machine learning. With the new Warp backend, XLB now offers state-of-the-art performance for even faster simulations.

Getting Started

To get started with XLB, you can install it using pip. There are different installation options depending on your hardware and needs:

Basic Installation (CPU-only)

pip install xlb

Installation with CUDA support (for NVIDIA GPUs)

This installation is for the JAX backend with CUDA support:

pip install "xlb[cuda]"

Installation with TPU support

This installation is for the JAX backend with TPU support:

pip install "xlb[tpu]"

Notes:

To install the latest development version from source:

pip install git+https://github.com/Autodesk/XLB.git

The changelog for the releases can be found here.

For examples to get you started please refer to the examples folder.

Accompanying Paper

Please refer to the accompanying paper for benchmarks, validation, and more details about the library.

Citing XLB

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

@article{ataei2024xlb,
  title={{XLB}: A differentiable massively parallel lattice {Boltzmann} library in {Python}},
  author={Ataei, Mohammadmehdi and Salehipour, Hesam},
  journal={Computer Physics Communications},
  volume={300},
  pages={109187},
  year={2024},
  publisher={Elsevier}
}

Key Features

Showcase

<p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/airfoil.gif" width="800"> </p> <p align="center"> On GPU in-situ rendering using <a href="https://github.com/loliverhennigh/PhantomGaze">PhantomGaze</a> library (no I/O). Flow over a NACA airfoil using KBC Lattice Boltzmann Simulation with ~10 million cells. </p> <p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/car.png" alt="" width="500"> </p> <p align="center"> <a href=https://www.epc.ed.tum.de/en/aer/research-groups/automotive/drivaer > DrivAer model </a> in a wind-tunnel using KBC Lattice Boltzmann Simulation with approx. 317 million cells </p> <p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/building.png" alt="" width="700"> </p> <p align="center"> Airflow in to, out of, and within a building (~400 million cells) </p> <p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/XLB_diff.png" alt="" width="900"> </p> <p align="center"> The stages of a fluid density field from an initial state to the emergence of the "XLB" pattern through deep learning optimization at timestep 200 (see paper for details) </p> <br> <p align="center"> <img src="https://raw.githubusercontent.com/autodesk/xlb/main/assets/cavity.gif" alt="" width="500"> </p> <p align="center"> Lid-driven Cavity flow at Re=100,000 (~25 million cells) </p>

Capabilities

LBM

Machine Learning

Lattice Models

Compute Capabilities

Output

Boundary conditions

Roadmap

Work in Progress (WIP)

Note: Some of the work-in-progress features can be found in the branches of the XLB repository. For contributions to these features, please reach out.

Wishlist

Contributions to these features are welcome. Please submit PRs for the Wishlist items.