LBM Sample code for diffusion

Hi,

I am new user on the LBM modeling. I got the sample code of flow past cylinder online and I am familiar with the code now.

I need solve diffusion problem using LBM model. Does anyone know where I can find the sample LBM code for diffusion phenomena? (Matlab or Fortran version)

thanks a lot!
Liang

Actually, here’s a funny fact about lattice Boltzmann: you can use just any LB code which was written for fluid dynamics and use it to solve a diffusion equation (or, an advection-diffusion equation if you want).

Here’s the procedure: take for example the Matlab code for the lid-driven cavity. Then, take the density rho as your diffused scalar, erase all terms in which the velocity u appears, and re-interpret the viscosity nu as being the diffusivity constant D. That’s it.

For example, the computation of the equilibrium


cu = 3*(cx(i)*ux+cy(i)*uy);
fEq(i,:,:) = rho .* t(i) .* ... 
               ( 1 + cu + 1/2*(cu.*cu) - 3/2*(ux.^2+uy.^2) );


is simply replaced by


fEq(i,:,:) = rho .* t(i);

Once your code works, you can make it more efficient by switching from a 9-neighbor lattice to a 4-neighbor lattice.

You can find more information in this thesis.

hi
for a cavity cod with lid driven and size 100*100 and nu=0.05 and vilocity of lid driven is uw=0.05 and itteriton is (timestep=15000)
how much reynolds number ( RE=?)

with changing of uw how changing RE number ?
how relation between RE , NU , UW ,SIZE OF CAVITY , TIME STEP?

PLEASE HELP ME .

Hello Jonas,

With the equilibrium distribution function in your reply, we cannot recover the macroscopic velocities. So, I believed the equilibrium distribution function will be:

fEq(i,:,:slight_smile: = rho .* t(i).*(1+cu);

I am writing it from my very naive understanding so please correct me if I am wrong and please explain on this issue.

Sincere gratitude for creating this forum!

Regards,

Nitesh

Hello,

it depends on what macroscopic equation one wants to simulate.

If one wants pure diffusion : d/dt rho = kappa * Laplacian(rho)
or advection-diffusion : d/dt rho + u*grad rho = kappa Laplacian(rho).

In the first case feq = t(i)*rho in the other feq=t(i)rho(1+c_i * u/cs^2).

Hello Orestis,

Thanks for the reply.

Completely agree with you and Jonas. I understood the point.

Regards,

Nitesh

alireza378 Wrote:

hi
for a cavity cod with lid driven and size 100*100
and nu=0.05 and vilocity of lid driven is
uw=0.05 and itteriton is (timestep=15000)
how much reynolds number ( RE=?)

with changing of uw how changing RE number ?
how relation between RE , NU , UW ,SIZE OF CAVITY
, TIME STEP?

PLEASE HELP ME .

hi
I am new lbm user.
I need simple code by lbm for start.

hello
for the cavity code there is maxT=40000
what this number of iterations physically means ? and how it is chosen?
thanks