I like the forum very much. Here I learned a lot about LBM.So many people are helpful.
NOW I have a question about “ux” in the cylinder.m.
cylinder.m is a example at http://www.lbmethod.org/numerics:codes
(Lattice Boltzmann in various languages)
% INITIAL CONDITION: Poiseuille profile at equilibrium
L = ly-2.0; y_phys = y-1.5;
ux = 4.0 * uMax / (L*L) * (y_phys.*L-y_phys.*y_phys);
uy = zeros(lx,ly);
% MACROSCOPIC (DIRICHLET) BOUNDARY CONDITIONS
% Inlet: Poiseuille profile
y_phys = col-1.5;
ux(:,in,col) = 4 * uMax / (L*L) * (y_phys.*L-y_phys.*y_phys);
uy(:,in,col) = 0;
It’s so hard for me to understand.
when y=(ly+1)/2=>ux=uMax, not in the center.
why isn’t y=(ly)/2=>ux=uMax!
I am not completely sure, but this is most probably due to the implementation of the side walls in the code. Which kind of boundary condition do you have at the side walls? Bounce-back or another type?
What always helps: Take a sheet of quad paper and draw your channel, including the walls, the origin of the coordinate system etc. Maybe this suffices, and you see why there is an additional 1/2 in the equation.
As Timm says: the above example works with full-way bounce-back boundaries (the wall is half-way between two nodes) and with Matlab index numbering (starting with 1).
The following is an example with 4 nodes (ly=4). An “x” stands for a lattice node, and a “o” for the location of the boundary. Then, the distance between the walls is 2 (this explains the ly-2 in the code), and the first wall position is at 1.5 (this explains the -1.5 in the code).