pylbm is an all-in-one package for numerical simulations using Lattice Boltzmann solvers.

This package gives all the tools to describe your lattice Boltzmann scheme in 1D, 2D and 3D problems.

We choose the D’Humières formalism (multiple relaxation times lattice Boltzmann method) to describe the problem. You can have complex geometry with a set of simple shape like circle, sphere, …

pylbm performs the numerical scheme using Cython, NumPy or Loo.py from the scheme and the domain given by the user. Pythran and Numba will be available soon. pylbm has MPI support with mpi4py.

News

Installation

You can install pylbm in several ways

With mamba or conda

mamba install pylbm -c conda-forge
conda install pylbm -c conda-forge

With PyPI

uv pip install pylbm

or, without uv

pip install pylbm

The PyPI package of mpi4py, a dependency of pylbm, needs an MPI library. Install one with your system package manager (for example Open MPI or MPICH), or from PyPI with pip install mpich. The conda package installs it for you.

From source

You can also clone the project and work on the latest version with uv

git clone https://github.com/pylbm/pylbm
cd pylbm
uv sync

uv sync creates the environment .venv with pylbm and the tools to test it. Then run the tests, or any script, through uv

cd tests
uv run pytest --mpl --h5diff -m "not gpu and not slow"

Add --extra gpu to uv sync for the Loopy (OpenCL) backend, and --group docs for the documentation.

Getting started

pylbm can be a simple way to make numerical simulations by using the Lattice Boltzmann method.

Once the package is installed you just have to understand how to build a dictionary that will be understood by pylbm to perform the simulation. The dictionary should contain all the needed informations as

  • the geometry (see here for documentation)

  • the scheme (see here for documentation)

  • another informations like the space step, the scheme velocity, the generator of the functions…

To understand how to use pylbm, you have a lot of Python notebooks in the tutorial.

Documentation for users

Documentation of the code

The most important classes

Geometry(dico[, need_validation])

Create a geometry that defines the fluid part and the solid part.

Domain(dico[, need_validation])

Create a domain that defines the fluid part and the solid part and computes the distances between these two states.

Scheme(dico[, check_inverse, need_validation])

Create the class with all the needed informations for each elementary scheme.

Simulation(dico[, sorder, dtype, ...])

create a class simulation

The modules

References

[dH92]

D. D’HUMIERES, Generalized Lattice-Boltzmann Equations, Rarefied Gas Dynamics: Theory and Simulations, 159, pp. 450-458, AIAA Progress in astronomics and aeronautics (1992).

[D08]

F. DUBOIS, Equivalent partial differential equations of a lattice Boltzmann scheme, Computers and Mathematics with Applications, 55, pp. 1441-1449 (2008).

[G14]

B. GRAILLE, Approximation of mono-dimensional hyperbolic systems: a lattice Boltzmann scheme as a relaxation method, Journal of Computational Physics, 266 (3179757), pp. 74-88 (2014).

[QdHL92]

Y.H. QIAN, D. D’HUMIERES, and P. LALLEMAND, Lattice BGK Models for Navier-Stokes Equation, Europhys. Lett., 17 (6), pp. 479-484 (1992).

Indices and tables