Hello,
I am trying to simulate Poisuille flow by LBM. I coded Streaming and Collision by SWAP algorithm but getting the results (X-velocity, Y-velocity, and Velocity Magnitude) like that (attached as picture).
Velocity-Y
Velocity-X
Velocity-Magnitude
[code=“cpp”]
int fStreamingSwap() {
const int half = (Q - 1) / 2;
for (int ix = 1; ix <= Nx - 1; ++ix) {
for (int iy = 1; iy <= Ny - 1; ++iy) {
for (int iq = 1; iq <= half; ++iq) {
int nextX = ix - (int)c[iq][0];
int nextY = iy - (int)c[iq][1];
if (nextX >= 1 && nextY >= 1 && nextX <= Nx-1 && nextY <= Ny-1 ) {
std::swap(fpop[ix][iy][iq+half], fpop[nextX][nextY][iq]);
}
}
}
}
return 0;
}
[code="cpp"]
int fBgkCollisionSwap() {
const int half = (Q - 1) / 2;
fMacroscopicVariables();
fComputeEquilibrium();
for (int ix = 1; ix <= Nx - 1; ++ix) {
for (int iy = 1; iy <= Ny - 1; ++iy) {
for (int iq = 0; iq < Q; ++iq) {
fpop[ix][iy][iq] *= (1.0 - omega);
fpop[ix][iy][iq] += omega*fEq[ix][iy][iq];
}
for (int iq = 1; iq <= half; ++iq) {
std::swap(fpop[ix][iy][iq], fpop[ix][iy][iq+half]);
}
}
}
return 0;
}
Kindly suggest what happened.
Best Regards
Ali