Two-dimensional Lattice boltzmann with Python, Cython, and OpenCL (GPU)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LB_D2Q9 Added in the better feq...checking if we get different fingers now. Feb 16, 2018
pictures Added a basic wrapper to plot results in realtime with openGL. Curren… Apr 12, 2016
.gitignore About to push my repository onto the main one. Oct 10, 2017 Updated the website. Apr 14, 2017 Things appear to be working now. Good. Oct 14, 2016


Vortex Sheets

An easy-to-read implementation of the D2Q9 Lattice-Boltzmann simulation in Python, Cython, and OpenCL created as a final project for our CS205 class at Harvard. Our pyOpenCL code isn't too slow; we achieve roughly 325 MLUPS on a GTX Titan Black video card!

For more details on the project and the Lattice Boltzmann technique, see our project website at

Table of Contents


To install, just use

python install


pip install .

when you are in the directory with the file. Both should work.

How to use the code

To learn how to use the code, look in the docs folder and run the ipython notebooks there. The CS-205 movie IPython notebook is a particularly fun place to start.

Structure of the Code


Within the LB_D2Q9 package, there are two subpackages: OLD and dimensionless. The LB_D2Q9 package also contains our OpenCL kernels in the file.


The OLD subpackage is, unsurprisingly, old; we make no guarantees that the package will work. We have included it because it does not use dimensionless simulations, which can sometimes be useful.


The dimensionless subpackage is well commented and should work on any computer as long as the requisite packages are installed. This is the code we are submitting for our final project. It creates dimensionless Lattice Boltzmann simulations.


The docs folder contains documents that should help the user see what our program can do and also teach the user how to use our program. The pictures folder contains illustrative pictures of simulation results. The testing folder contains a variety of old IPython notebooks that the authors used to test the software; we make no guarantee that these will work as they are generally outdated.