Cannot understand the code

Hi everybody!

I am the beginner in LBM… I need to understand it for my studying.
I am reading this book [Michael_C._Sukop,_Daniel_T._Thorne]_Lattice_Boltz
and at the page 36 I found this code which is not clear to me.

[code=“cpp-qt”]
// Computing macroscopic density, rho, and velocity, u=(ux,uy).
for( j=0; j<LY; j++)
{
for( i=0; i<LX; i++)
{
u_x[j][i] = 0.0;
u_y[j][i] = 0.0;
rho[j][i] = 0.0;
if( !is_solid_node[j][i]){
for( a=0; a<9; a++){
rho[j][i] +=f[j][i][a];
u_x[j][i] += ex[a]*f[j][i][a];
u_y[j][i] += ey[a]*f[j][i][a];
}

u_x[j][i] /= rho[j][i];
u_y[j][i] /= rho[j][i];
}
}
}



Can someone explain these lines:
 [code="cpp-qt"]
u_x[j][i] += ex[a]*f[j][i][a];
u_y[j][i] += ey[a]*f[j][i][a];

and

[code=“cpp”]
u_x[j][i] /= rho[j][i];
u_y[j][i] /= rho[j][i];



any help will be apreciate!
Thank you in advance!

Hi,
It is well-known that to compute macroscopic velocity in LBM we have the following relation : u=(1/rho) *sum(e_i * f_i)

For the first two lines , they translate the relation u=sum(e_i * f_i) . Line 1 is for x-direction, and line 2 is for y-direction.

For the second lines : the sum is devided by rho in the two directions x and y.

For more details you can view the formula here : http://www.diva-portal.org/smash/get/diva2:279558/FULLTEXT01.pdf page 23.

If you have any question you can ask here in this forum and i will reply at any time.

Good luck

Thank you very much!
That was great you have replied!
Can you give me your contact so I can ask you directly?

Hi,
You’re welcome. bh.dhouha2@gmail.com