Fluid Dynamics Simulation using a Lattice Boltzmann Method

Simple 2D fluid flow with viscosity can be simulated via Lattice Boltzmann Methods. These solve for the discrete Boltzmann equation with collision/viscosity models rather than the Navier-Stokes equation (although one can be turned into the other).

LBM models the fluid consisting of fictitious particles, and such particles perform consecutive streaming and collision processes over a discrete lattice mesh. Hence the general algorithm is the following:

  1. From the microscopic properties of the particles at a lattice point, find the macroscopic density and velocities
  2. Use these values to calculate the equilibrium values and update the microscopic values
  3. Stream the particles onto adjacent grid points based on their velocities

For the theory of the method look here, althought many other good resources can be easily found with a google search

Introducing a barrier to a flowing fluid can be simulated, see the two examples below:

2 features of this program that show be mentioned are, firstly the barrier is placed into the flowing fluid so some transient behaviour is expected and secondly it is prone instabilities so simulations must be pick for appropriate parameters (generally by trail and error unfortunately)

Low viscosity on bow shaped barrier

The plot shows the velocity component along the x axis

In [1]:
#NAME: Lattice Boltzmann Method
#DESCRIPTION: Fluid dynamics simulation using a Lattice Boltzmann Method.

import LBM
from pycav import display

animation1 = LBM.run(80,200,0.01,0.1,2200,400)
In [2]:
animation1 = display.create_animation(animation1, temp = True)

High viscosity on bow shaped barrier

In [3]:
animation2 = LBM.run(80,200,0.05,0.1,2200,400)
In [4]:
animation2 = display.create_animation(animation2, temp = True)

Low viscosity flow over an airfoil

In [23]:
animation3 = LBM.run(80,200,0.00275,0.1,2200,400,barrier_file='./airfoil.dat')
In [24]:
animation3 = display.create_animation(animation3, temp = True)