No BSD License  

Highlights from
Basic Lattice-Boltzmann (LB) MATLAB Code

3.6

3.6 | 5 ratings Rate this file 50 Downloads (last 30 days) File Size: 15.6 KB File ID: #6904

Basic Lattice-Boltzmann (LB) MATLAB Code

by

 

10 Feb 2005 (Updated )

Implements LB BGK D2Q9.

| Watch this File

File Information
Description

Simple, yet simplistic, Lattice Boltzmann (LB) MATLAB implementation. D2H9, BGK, omega = 1, laminar flow in a 2D channel used as benchmark. Requires Image Processing Toolbox.

The code is not optimized for memory nor for speed, i.e. not efficient at all. However, it is better than almost nothing (i.e. the present MATLAB situation at Feb 2005 ? as far as I know)
Optimization for memory should consider only dry locations.

Other free LB (FORTRAN, C, and Cpp) codes are available:

See the anb.f code at http://www.ccrl-nece.de/lba/ or the S.Succi code available from www.physics.buffalo.edu/phy516/Files/Topic6/lbe.f
See also D2Q9poi.f from Dieter Wolf-Gladrow and
http://www.lstm.uni-erlangen.de/lbm2001/download/ written by Kraft and Schultz t tu.muenchen.de

See also the translation into C of the original Succi FORTAN code
www.physics.buffalo.edu/phy516/Files/Topic6/lbe.c

See also lb2d.m (by Youngseuk Keehm) at
http://srb.stanford.edu/GP200/PDFs/Hw02_solution.pdf

For LB benchmarking see:
http://staff.science.uva.nl/~sloot/CSS/BGK_handin.PDF
and page 190-192 in: Lattice-gas cellular automata and lattice Boltzmann models: an introduction / Dieter A. Wolf-Gladrow. -. ISBN: 3540669736.

This code is written to be readable by the most, optimisation makes it less readable. It is mean to be of some help to students tackling LB for the first time. As usual no guarantee of bug free or proper functioning. in the hope that some of the many LB developers will make soon something better available to the MATLAB community? possibly 3D, possibly multi-phase / multi-component.

Suggestions: Rather than rating, please- makes available a better code than this, it is an easier task. The user should not be surprise by encountering instability by changing the parameters without a precise rational. I suggest reading the references that benchmark the LB BKG and follow the given examples in order to get a feeling of the sensitivity of the code to the different variables.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements none
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
08 Jul 2014 Arash

I try to submit my own code when it's ready, and thanks for your effort and contribution :)

16 Aug 2011 mohammad pourtousi

hi
please tell me how can i use b.c FOR INLET AND OUT LET for pipe

28 Feb 2011 emn

i have a problem with convection diffusion code i must vary the peclet number from 0.1 to 10^5 and i cant find a solution to this using LBM.
Please how can I do this or if there is any code available for that

01 Jul 2010 rahul sharma

hiii..plz tell me how to write a code for sound propagation using cellular automata.... i want to simulate longitudinal waves and transverse waves....

01 Sep 2008 sung yi

nothing

31 Dec 2007 vinu varghese

please let me know how can i simualate efficiently the Couette flow using LBM.Or if there is any code available for that

18 Dec 2007 gianni schena

mr cao xudong (caoxd04@mails.tsinghua.edu.cn)
generic notices of possible mistakes are of little help for the matlab community
if you point out precisely the problem we will be most than happy to tackle the problem (if any) and correct the contribution if necessary . Thank you for the cooperation

03 Dec 2007 cao xudong

there is some mistake in the boundery condition and initialization

25 Oct 2006 mehr ashwin

Please make code for "multiple relaxation time LBE model (Humieres,2002)" available.

02 May 2006 gianni schena

see also this new (2006) http
http://www.dur.ac.uk/i.w.haslam/Misc/Code/lbm.html

24 May 2005 houat samir  
21 Feb 2005 gianni schena

% SPEED UP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ux=ux./rho; uy=uy./rho; uxsq=ux.^2; uysq=uy.^2; usq=uxsq+uysq; %

% BKG Equilibrium distribution
NxM=Nr*Mc;
% smart way to avoid the for loop .. eg. ic=5
f(ija+NxM*(5-1))= rt2(ija) .*(1 +f1*(+ux(ija)+uy(ija)) +f2*(+ux(ija)+uy(ija)).^2 -f3.*usq(ija));
%and the alike for the other values of ic up to ic=9
f(ija+NxM*(9-1))= rt0(ija) .*(1 - f3*usq(ija));

Contact us