unsteady sloution

Dear all freind
I am solving unsteady problem means flow in channel with a cylinder on it with dependent with time and I have used parabolic velocity boundary at inlet and zero gradient at outlet and Zou and He for walls and other characteristics of my problem is same of cylinder.m that exist in open LBmetod .org. but during our simulation after the flow arrive at end of my grid, a back flow starts and will be dominated. if we want to consider my investigation in steady state, it is seen good result but I want to consider unsteady problem and see vortex shedding. What should I do for solving my problem?
I have another question about code cylinder.m. I am confused about boundary condition that used in the code (microscopic boundary condition).please tell me some detail about it and also mass flow in this code in inlet and outlet is not same .do you any suggestion about it.I really need to find my question.
my mail is :e.gorakifard@me.iut.ac.ir
Best regard

In general, a zero velocity gradient yields good results on the outlet of a channel. It’s difficult to say why it doesn’t work in your case.

The boundary condition in cylinder.m is Zou/He, as mentioned in the code.

Dear all
"The boundary condition in cylinder.m is Zou/He, as mentioned in the code. ".you mean it is mentioned in matlab code however it is used equilibrium distribution function for inlet and outlet .if it is a really Zou/He boundary condition please give me your source. in forteran code , Zou/He condition is used but if you want to see vortex shedding you must increase your grid because Re must be increased but if we increase the grid ,an error is accrued(stack over).please help me.
Best regard

I wonder if we are speaking of the same program. I am referring to the code on lbmethod.org:


The code is pretty explicit, and it obviously implements a Zou/He boundary condition for both the inlet and the outlet.

Thanks for your answer, It is really useful for me. I didn’t pay attention to new version of code but I am interested why distribution equilibrium function uses for microscopic boundary condition inlet and outlet and has it good accuracy or not?.

The Zou/He boundary condition, like many others, splits the particle populations into equilibrium and off-equilibrium part. That’s why the equilibrium explicitly appears in the formula.

More details are described in this reference. The paper also compares Zou/He with other boundary conditions and shows that it is in general an accurate boundary condition.

Dear all
in general we have to compute collision operation for fluid and 'solid 'node ,is it correct? If not ,why you do it for cylinder.m code.
i mean that whether we have to compute collision operation solid node or not?
Also Zou/He boundary condition is used for wall boundary ;what is the order of accuracy ,is it like a half boundary condition
Best regard

You should not perform a collision on bounce back node. It is not done in “cylinder.m” either.

   % Code from cylinder.m

    for i=1:9
       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) );
       fOut(i,:,:) = fIn(i,:,:) - omega .* (fIn(i,:,:)-fEq(i,:,:));

    for i=1:9
         fOut(i,bbRegion) = fIn(opp(i),bbRegion);

Once the collision is done, the obstacle bounce back is performed. That is the bounce back replaces the collision on solid nodes. (be it cylinder or walls).

In cylinder.m, bounce back is used for walls and cylinder solid nodes, zou-he is used only for inlet velocity and outlet constant pressure condition.

Hope it is clear.