circshift in cavity.m

Dear all,
I’m new in the field of LBM and I started looking at the code cavity.m given in lbmethod.
I have a doubt concerning the streaming step. As far as I understand the matlab command circshift seems to impose not only the streaming but also a “periodicity” between the left-right and and top-bottom sides. As matter of fact the results provided by replacing


%STREAMING STEP
for i=1:9 
    fIn(i,:,: ) = circshift(fOut(i,:,: ), [0,cx(i),cy(i)]); 
end

with


%STREAMING STEP
% implementation of the streaming without "periodicity"
fIn(2, 2:lx, : ) = fOut(2, 1:lx-1,: ); 
fIn(3, :, 2:ly) = fOut(3, :, 1:ly-1); 
fIn(4, 1:lx-1, :) = fOut(4,  2:lx , :); 
fIn(6, 2:lx, 2:ly) = fOut(6,  1:lx-1, 1:ly-1); 
fIn(5, :,  1:ly-1 ) = fOut(5,  :,  2:ly); 
fIn(7, 1:lx-1,  2:ly) = fOut(7, 2:lx , 1:ly-1 );
fIn(8, 1:lx-1, 1:ly-1) = fOut(8,  2:lx , 2:ly); 
fIn(9, 2:lx , 1:ly-1) = fOut(9,    1:lx-1, 2:ly);

are not equivalent. I don’t understand why we need this “periodicity” all over the boundaries if we already have already imposed the corresponding boundary conditions. Is this related to the full bounce back condition? How?

Thanks a lot

in the previous code “without periodicity” I forgot one line

fIn(1, :, : ) = fOut(1, :,: );

Hello,

actually the periodicity is not needed. But it simplifies the code. Remember that some populations that are located on the wall have to be streamed and therefore the streaming step has to be applied on all nodes (but node necessarily on all populations).

Orestis

I have the same problem,

Please malaspin tell me the details about it . thanks a lot.

Circshift isnt necesarily required, but it certainly makes the code cleaner. If you have a proper boundary condition imposed at a boundary it will overide the periodicity, there should be no difference in results with or without periodicity if you have an alternate boundary condition applied to all domain bounds.

I saw this code,and I cannot understand the boundary condition.It looks like a heat BC,but in the code it is a velocity BC.If it is a velocity BC,then the cavity will always have earning without losing.Is it?