Hi

I am new in the world of LBM and want a detailed documentation, as implement the code, the operator of collision, and propagation

Hi

I am new in the world of LBM and want a detailed documentation, as implement the code, the operator of collision, and propagation

Thanks

Hi and welcome in the wonderful world of LBM

I think there is no real documentation about LBM in the literature. You can find some useful papers in the articles section of lbmethod.org, and some information about the method in the site itself. Furthermore, the documentation of openLB can give you hints about the implementation. You can also find sources (different languages are available for these codes) on the openlb part of the website. I think the best way to learn is to code something easy by yourself completely. You will be then aware of the different problems that can arise for an LB code. Of course once you did that you should only use OpenLB

Try the book by Dieter A. Wolf-Gladrow (2000), it is a good way to get started with LBM. If you want I can send you a simple program I wrote in python. Just let me know.

think you Mr MartinThomas

it s nice from you

this is my email vilop6@gmail.com

and think so mache for your help

@vilop6: You’ve got mail

If anybody else is interested in a very simple program, I put it online here:

http://rapidshare.com/files/102775290/2DLidDrivenCavity_LBM_BGK.py.html

You need to install the following to be able to execute it:

python (2.5 or higher): http://www.python.org/download/

numpy: http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103

matplotlib: http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474

It can probably help to understand the basic principles of LBM since everything is in one file and no optimization for execution speed has been applied.

thanks

hi

im begginer like vilop6 and i am really looking for a simple (very simple:D) cod with matlab format .i dont know how to start

good luck;)

Here’s the address for the sample programs on the OpenLB web page. The page includes a one-page Matlab script:

hi jlatt and so thanks for your help.it’s exactlly what i need>:D<

Good morning

I’m a beginner in LBM (very beginner) I have some trivial questions so apologize my ignorance

1)I can’t see where appear the equation witch we like to solve in lattice Boltzmann method?

2)I see this figure many times can someone explain me what’s represent?

to get an answer, you need to give more information. (1) what are you talking about? some code? (2) where does this picture come from?

Thank you for your answer sir

I’m speaking about poiseuille flow, I find this code in matlab:poiseuille and I don’t understand where is the equation which we want resolving.

For the picture i find it in this document:building lbm model

in this document g=0.00001 so how we transform g from 9.81 to 0.00001

thank you another time.

Help me please

Hi Kimmo,

I am also new in this field. You know g_real=9.81 m/s^2 and want to find g_lb=??( in ur case g_lb=0.00001). Suppose you know delx (lattice space), and delt( lattice time) in your simulation then u can easily find g_lb.

g_lb=g_real*delt*delt/delx.

If anybody find any wrong,post here plz.

Thanks

M.Matadu

Thank you for your answer

for g , I thinked in this solution but when I see the code below I didn’t find neither deltat or deltax so I think that there another explication

also if someone can explain me what is the difference between finit difference (where the equation to solve are descritisised)

and the LBM I mean where appear the equation in LBM

Thank you

i have read a memory stage or but in french

HI all am sorry for my english

and i have edit the code proposed in this cite for rayleigh benart “natural convection” to simulate the window problem ‘DE VAL DEVIS and Le Quéré’

```
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% windowp.m: window probleme
% using a LB method
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Lattice Boltzmann sample,
% Copyright (C) 2006 Jonas Latt
% Address: Rue General Dufour 24, 1211 Geneva 4, Switzerland
% E-mail: Jonas.Latt@cui.unige.ch
%
% Edited under GNU General Public License by ABDELBER Nabil
%Address: 31 Rue 75 wifakIII, Eloulfa, casablanca, Maroc
%E-mail: vilop6@gmail.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
% You should have received a copy of the GNU General Public
% License along with this program; if not, write to the Free
% Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
% Boston, MA 02110-1301, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
sms=' c finie ';
%clims=[0 0.5];
% GENERAL FLOW CONSTANTS
ly = 51;
aspect_ratio = 2;
lx = 51; %aspect_ratio*ly;
delta_x = 1./(ly-2);
Pr = 10;
Ra = 2000.; % Rayleigh number
gr = 0.001; % Gravity
buoyancy = [0,gr];
Thot = 1; % Heating on bottom wall
Tcold = 0; % Cooling on top wall
T0 = (Thot+Tcold)/2;
delta_t = sqrt(gr*delta_x);
% nu: kinematic viscosity in lattice units
nu = sqrt(Pr/Ra)*delta_t/(delta_x*delta_x);
% k: thermal diffusivity
k = sqrt(1./(Pr*Ra))*delta_t/(delta_x*delta_x);
omegaNS = 1./(3*nu+0.5); % Relaxation parameter for fluid
omegaT = 1./(3.*k+0.5); % Relaxation parameter for temperature
maxT = 40000; % total number of iterations
tPlot = 100; % iterations between successive graphical outputs
tStatistics = 10; % iterations between successive file accesses
% D2Q9 LATTICE CONSTANTS
tNS = [4/9, 1/9,1/9,1/9,1/9, 1/36,1/36,1/36,1/36];
cxNS = [ 0, 1, 0, -1, 0, 1, -1, -1, 1];
cyNS = [ 0, 0, 1, 0, -1, 1, 1, -1, -1];
oppNS = [ 1, 4, 5, 2, 3, 8, 9, 6, 7];
% D2Q5 LATTICE CONSTANTS
tT = [1/3, 1/6, 1/6, 1/6, 1/6];
cxT = [ 0, 1, 0, -1, 0];
cyT = [ 0, 0, 1, 0, -1];
oppT = [ 1, 4, 5, 2, 3];
psy=zeros(lx,ly);
[y,x] = meshgrid(1:ly,1:lx);
% INITIAL CONDITION FOR FLUID: (rho=1, u=0) ==> fIn(i) = t(i)
fIn = reshape( tNS' * ones(1,lx*ly), 9, lx, ly);
% INITIAL CONDITION FOR TEMPERATURE: (T=0) ==> TIn(i) = t(i)
tIn = reshape( tT' *Tcold *ones(1,lx*ly), 5, lx, ly);
% Except for bottom wall, where T=1
tIn(:,:,ly)=Thot*tT'*ones(1,lx);
% We need a small trigger, to break symmetry
%tIn(:,lx/2,ly-1)= tT*(Thot + (Thot/10.));
% Open file for statistics
fid = fopen('psy_ra5000.dat','w');
fid1=fopen('t_ra5000.dat','w');
%fprintf(fid,'Thermal Statistics: time-step --- uy[nx/2,ny/2] --- Nu\n\n\n');
% MAIN LOOP (TIME CYCLES)
for cycle = 1:maxT
if (mod(cycle,1000)==0)
cycle
end
% MACROSCOPIC VARIABLES
rho = sum(fIn);
T = sum(tIn); %temperature
ux = reshape ( (cxNS * reshape(fIn,9,lx*ly)), 1,lx,ly) ./rho;
uy = reshape ( (cyNS * reshape(fIn,9,lx*ly)), 1,lx,ly) ./rho;
% MACROSCOPIC BOUNDARY CONDITIONS
% NO-SLIP for fluid and CONSTANT at lower and upper
% boundary... periodicity wrt. left-right
% COLLISION STEP FLUID
for i=1:9
cuNS = 3*(cxNS(i)*ux+cyNS(i)*uy);
fEq(i,:,:) = rho .* tNS(i) .* ...
( 1 + cuNS + 1/2*(cuNS.*cuNS) - 3/2*(ux.^2+uy.^2) );
force(i,:,:) = 3.*tNS(i) .*rho .* (T-T0) .* ...
(cxNS(i)*buoyancy(1)+cyNS(i)*buoyancy(2))/(Thot-Tcold);
fOut(i,:,:) = fIn(i,:,:) - omegaNS .* (fIn(i,:,:)-fEq(i,:,:)) + force(i,:,:);
end
% COLLISION STEP TEMPERATURE
for i=1:5
cu = 3*(cxT(i)*ux+cyT(i)*uy);
tEq(i,:,:) = T .* tT(i) .* ( 1 + cu );
tOut(i,:,:) = tIn(i,:,:) - omegaT .* (tIn(i,:,:)-tEq(i,:,:));
end
% MICROSCOPIC BOUNDARY CONDITIONS FOR FLUID
for i=1:9
fOut(i,:,1) = fIn(oppNS(i),:,1);
fOut(i,:,ly) = fIn(oppNS(i),:,ly);
fOut(i,1,:) = fIn(oppNS(i),lx,:);
fOut(i,lx,:) = fIn(oppNS(i),lx,:);
end
% STREAMING STEP FLUID
for i=1:9
fIn(i,:,:) = circshift(fOut(i,:,:), [0,cxNS(i),cyNS(i)]);
end
% STREAMING STEP FLUID
for i=1:5
tIn(i,:,:) = circshift(tOut(i,:,:), [0,cxT(i),cyT(i)]);
end
% MICROSCOPIC BOUNDARY CONDITIONS FOR TEMEPERATURE
%
tIn(4,lx,:) = Tcold-tIn(1,lx,:)-tIn(2,lx,:)-tIn(3,lx,:)-tIn(5,lx,:);%
tIn(2,1,:) = Thot-tIn(1,1,:)-tIn(4,1,:)-tIn(3,1,:)-tIn(5,1,:);%
tIn(:,:,1)=(4.*tIn(:,:,2)-tIn(:,:,3))./3;% -(4.*T(2,j)-T(3,j)-3.*T(1,j)) ;
tIn(:,:,lx)=(4.*tIn(:,:,lx-1)-tIn(:,:,lx-2))./3;
I1=2;
I2=lx;
J1=1;
J2=ly;
u1= reshape(ux,lx,ly);
u2= reshape(uy,lx,ly);
for i=I1:I2
for j=J1:J2
SOM=psy(1,j);
for k1=I1:i
SOM=SOM-(u2(k1,j)+u2(k1-1,j))./2*(x(k1,j)-x(k1-1,j));
end
psy(i,j)=SOM;
end
end
% VISUALIZATION
if (mod(cycle,tStatistics)==0)
u = reshape(sqrt(ux.^2+uy.^2),lx,ly);
uy_Nu = reshape(uy,lx,ly); % vertical velocity
T = reshape(T,lx,ly);
% Nu = sum(sum(uy_Nu.*T))/(lx*k*(Thot-Tcold));
% calcule nusselt
for j=1:ly
Nul(j)=-(4.*T(2,j)-T(3,j)-3.*T(1,j))/(2.*delta_x);
end
Nu=delta_x*(Nul(1)+Nul(ly))./3;
for j=1:ly-1
if(mod(j,2)==1)
Nu=Nu+4.*Nul(j).*delta_x./3;
end
end
for j=2:ly-2
if(mod(j,2)==0)
Nu=Nu+2.*Nul(j).*delta_x./3;
end
end
% fprintf(fid,'%8.0f %12.8f %12.8f\n',cycle,u(int8(lx/2),int8(ly/2))^2, Nu);
if(mod(cycle,tPlot)==0)
subplot(2,2,1);
imagesc(psy(:,:)');%u(:,:)');%ly:-1:1)');
title('Fluid velocity');
axis equal off; drawnow
subplot(2,2,2);
imagesc(T(:,ly:-1:1)');%,clims)
title(['Temperature (Nusselt number is ' num2str(Nu) ') ieteration : ' num2str(cycle)]);
axis equal off; drawnow
subplot(2,2,3);
i=1:lx;j=1:ly;
%grid on;
contour(i,j,psy(i,ly-j+1)',15);
title('Lignes de courant ');
xlabel('i');ylabel('j');
subplot(2,2,4);
i=1:lx;j=1:ly;
%grid on;
contour(T(:,:)',15);
title('Lignes isothermes ');
xlabel('i');ylabel('j');
end
end
end
for i=1:lx
for j=1:ly
fprintf(fid1,'%d %d %f \n',i./lx,j./ly,T(i,j));
fprintf(fid,'%d %d %f \n',i./lx,j./ly,psy(i,j));
end
end
fid2=fopen('nusselt.txt','w');
fprintf(fid2,'%f \n',Nu);
Nu
sms
fclose(fid1);
fclose(fid);
fclose(fid2);
```

if the code don’t work plz let me know i will correct it, thanks for all

Regards vilop

Hello Vilop6

could u explain it plz?why not comment those lines?and wat about the error creteria convergence?

Thank you so much

hello everyone,this is my first msg at this site,

i need a simple LBM code in matlab. if any one have then Kindly mail me on this adress "adnan765@yahoo.com",