Skip to main content

No project description provided

Project description

lbm

A simple lattice-Boltzmann code for 2D flow resolutions. All the tools are contained in the lattice.py file, and separate cases are built on top of this library.

Contents

This LBM code includes:

  • D2Q9 lattice
  • TRT collision operator
  • Zou-He on all boundary conditions
  • Drag/lift computation using interpolated bounce-back
  • Core routines are deferred to Numba

Below are some examples ran with the code. The related cases are available in the repository.

Lid-driven cavity

A simple driven cavity in unit square. Launch it by running python3 cavity.py.
Below are the computed time-domain velocity norms and final streamlines at Re=100 (left) and Re=1000 (right).

A comparison of u_x = f(y) at the center of the domain with reference data from "U. Ghia, K. N. Ghia, C. T. Shin, High-Re solutions for incompressible flow using Navier-Stokes equations and multigrid method."

Turek benchmark

The Turek cylinder benchmark CFD case is described in "Schafer, M., Turek, S. Benchmark Computations of Laminar Flow Around a Cylinder". The 2D case consists in a circular cylinder in a channel with top and bottom no-slip conditions, and with a Poiseuille flow at the inlet (these cases are named 2D-1 and 2D-2 in the aforementionned reference). The cylinder is voluntarily not centered to trigger instability at sufficient Reynolds number. Here, we explore the accuracy of the drag and lift computation.

ny 2D-1 (Re=20) Cd 2D-1 (Re=20) Cl 2D-2 (Re=100) Cd 2D-2 (Re=100) Cl
Turek --- 5.5800 0.0107 3.2300 1.0000
lbm 100 5.6300 0.0862 3.0411 0.5834
lbm 200 5.5804 0.0371 3.2582 1.2047
lbm 300 5.5846 0.0261 3.2152 1.0987

Below are videos of the 2D-1 and 2D-2 cases:

Poiseuille with random obstacles

It is possible to run a Poiseuille flow with random obstacles in the domain. Below is an example.

Running

To run a simulation, adjust the parameters in the related python file, then run python3 case.py. A results folder will be generated in ./results/ with the current date and time. The png/ folder will contain outputs of the velocity norm over the domain. To generate a video out of the png files, you can use the convert command as follows:

convert -delay 10 -resize 50% -loop 0 'u_norm_%d.png'[0-100] animation.gif

To optimize and resize gifs, use gifsicle :

gifsicle -i animation.gif --scale 0.6 -O3 --colors 256 -o anim-opt.gif

Project details


Download files

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

Source Distribution

funlbm-1.0.4.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

funlbm-1.0.4-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file funlbm-1.0.4.tar.gz.

File metadata

  • Download URL: funlbm-1.0.4.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Linux/5.15.0-86-generic

File hashes

Hashes for funlbm-1.0.4.tar.gz
Algorithm Hash digest
SHA256 6443a100e6cb3c960019fc385067c1a42d27c5c9301ff48313d91dc93d1b0160
MD5 6909fdac3a7cf4479eac7900e32a69d6
BLAKE2b-256 a9204653ad3fedc4c79f94eb9841a82cd8e932938f01b162b7c3921934b1a4a9

See more details on using hashes here.

File details

Details for the file funlbm-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: funlbm-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Linux/5.15.0-86-generic

File hashes

Hashes for funlbm-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a9bd7bc176e5411759df4cbe93e8342baf17182a8eb8ff16f2ce161964c66e08
MD5 5ec818912938a0a0e2fa40d2ed2ee6ea
BLAKE2b-256 ea76d9109c5ad6d5a80842fe2f8824513ae033cdbd5704e2e8a96df1d5e5059c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page