Skip to main content

latticebmjax

About

'latticebmjax' is a Python package designed for hardware-accelerated simulation of fluid flows using the Lattice Boltzmann Method (LBM) with JAX as the computational backend. It is capable of:

  • Solving 2D incompressible flows using the D2Q9 BGK-LBM scheme
  • Applying Zou-He and bounce-back boundary conditions
  • Running on CPU with JIT compilation via JAX
  • Validating results against the Ghia et al. (1982) benchmark data
  • Plotting velocity fields, streamlines and centreline profiles

Features

  • D2Q9 lattice with BGK single-relaxation-time collision operator
  • Zou-He velocity boundary condition for the moving lid
  • Bounce-back no-slip boundary conditions for stationary walls
  • JIT-compiled time loop via jax.jit for high performance
  • Lid-driven cavity solver validated against Ghia et al. (1982)
  • Centreline velocity profiles compared to benchmark data (Re=100, 400, 1000)

Installation

Dependencies

Ensure you have the required dependencies installed, which are listed in requirements.txt. You can install them using:

pip install -r requirements.txt

User installation

To install the library, you can use the 'pip' command:

pip install latticebmjax

Folder structure

latticebmjax
├─── README.md
├─── LICENSE
├─── pyproject.toml
├─── requirements.txt
├─── benchmarks
│   ├─── convergence.py
│   └─── ghia_data.py
├─── examples
│   ├─── poiseuille.py
│   └─── lid_cavity.py
├─── latticebmjax
│   ├─── __init__.py
│   ├─── collision.py
│   ├─── equilibrium.py
│   ├─── lattice.py
│   └─── streaming.py
├─── solvers
│   ├─── __init__.py
│   ├─── base_solver.py
│   ├─── boundary.py
│   ├─── lid_cavity.py
│   └─── poiseuille.py
├─── testcase_data
│   ├─── ghia_re100.csv
│   ├─── ghia_re400.csv
│   └─── ghia_re1000.csv
└─── tests
    ├─── test_collision.py
    ├─── test_lid_cavity.py
    └─── test_streaming.py

Examples

Some usage examples of the library can be found in the examples folder

License

This software is distributed under the MIT License and further information about the license can be found in the LICENSE file

Third-party libraries

The library currently uses the following third-party libraries:

  • jax — JIT compilation and GPU acceleration
  • numpy — array utilities and CSV loading
  • matplotlib — velocity field and centreline plots
  • pandas — benchmark data loading
  • pytest — unit and integration testing

Contributing

The project is in the early development phase. Upon completion and delivery, contributions will be welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latticebmjax-1.0.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

latticebmjax-1.0.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file latticebmjax-1.0.0.tar.gz.

File metadata

  • Download URL: latticebmjax-1.0.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for latticebmjax-1.0.0.tar.gz
Algorithm Hash digest
SHA256 307783b7499d61d34ab21530024af25dca8d2486c5c2a2ee376432fa6d8c1cfc
MD5 85d2f6aefd76b3ca0f74352826d1d2cf
BLAKE2b-256 9d2f9d59324ed6950f59fddb90ad7759d11c2b6fae7822ccefff9fc8ff67c531

See more details on using hashes here.

File details

Details for the file latticebmjax-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: latticebmjax-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for latticebmjax-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45a043e08402b655f86da0c39d9e397e8c3cc8ec8be2752bf1509807113ffea8
MD5 6dd0e41e79c5d6cce473a626a9c75945
BLAKE2b-256 5d41af88559db3c0eeb809c5335323dfff2b842477daa7abcfd62af1b44ce78c

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page