3.5

3.5 | 4 ratings Rate this file 68 downloads (last 30 days) File Size: 15.58 KB File ID: #6904

Basic Lattice-Boltzmann (LB) MATLAB Code

by gianni schena

 

10 Feb 2005 (Updated 14 Nov 2005)

No BSD License  

Implements LB BGK D2Q9.

Download Now | 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  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
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));

24 May 2005 houat samir  
02 May 2006 gianni schena

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

25 Oct 2006 mehr ashwin

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

03 Dec 2007 cao xudong

there is some mistake in the boundery condition and initialization
 

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

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

01 Sep 2008 sung yi

nothing

Please login to add a comment or rating.
Updates
14 Nov 2005

improves an earlier code and allows simulation of porous systems in 2D

Tag Activity for this File
Tag Applied By Date/Time
application gianni schena 22 Oct 2008 07:41:04
latticeboltzmann poiseuille gianni schena 22 Oct 2008 07:41:04
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com