Skip to content

Reply To: compressibility effects

#5072
duldul
Participant

Hello Mathias.
Thank you for your kind suggestion. This papers is really nice, even I was trying to understand this paper when I saw your reply.
Recently I tried to simulate plane-Poiseuille flow and used tau = 0.53, u0 = 0.05
Boundary conditions that I used are as follows:
void boundary(int count) {
double ftemp[9],fq[9],temp;
int jj;
double t1, t2;

//Right hand Boundary (Outflow)
for ( int j = 1; j < ny-1; j++ ) {
f[nx-1][j][2] = 2.0*f[nx-2][j][2]-f[nx-3][j][2];
f[nx-1][j][5] = 2.0*f[nx-2][j][5]-f[nx-3][j][5];
f[nx-1][j][6] = 2.0*f[nx-2][j][6]-f[nx-3][j][6];
}//Right hand Boundary ends

//Bottom & top boundary -> bounce back
//double temp1[nx];
for ( int i = 1; i < nx-1; i++ ) {
f[i][0][1] = f[i][0][3];
f[i][0][4] = f[i][0][6];
f[i][0][5] = f[i][0][7];
//for y = ny – 1;
f[i][ny-1][3] = f[i][ny-1][1];
f[i][ny-1][6] = f[i][ny-1][4];
f[i][ny-1][7] = f[i][ny-1][5];
}//Bottom and top bounce back ends

//left hand boundary condition (inlet)
for ( int j = 1; j < ny-1; j++ ) {
u[0][j]=u0;v[0][j]=0.0;rho[0][j]=1.0;
t1 = u[0][j] * u[0][j] + v[0][j] * v[0][j];
for ( int k = 0; k < 9; k++ ) {
t2 = u[0][j] * cx[k] + v[0][j] * cy[k];
fq[k]= w[k] * rho[0][j]*(1. + 3. * t2 + 4.5 * t2 * t2 – 1.5 * t1);
}
f[0][j][0]=f[0][j][2]-fq[2]+fq[0];
f[0][j][4]=0.5*(rho[0][j]*u[0][j]+rho[0][j]*v[0][j]-f[0][j][0]-f[0][j][1]+f[0][j][2]+f[0][j][3]+2.0*f[0][j][6]);
f[0][j][7]=0.5*(rho[0][j]*u[0][j]-rho[0][j]*v[0][j]-f[0][j][0]+f[0][j][1]+f[0][j][2]-f[0][j][3]+2.0*f[0][j][5]);
}
f[0][0][0]=f[0][0][2];
f[0][0][1]=f[0][0][3];
f[0][0][4]=f[0][0][6];

f[0][ny-1][0]=f[0][ny-1][2];
f[0][ny-1][3]=f[0][ny-1][1];
f[0][ny-1][7]=f[0][ny-1][5];

f[nx-1][0][2]=f[nx-1][0][0];
f[nx-1][0][5]=f[nx-1][0][7];
f[nx-1][0][1]=f[nx-1][0][3];

f[nx-1][ny-1][2]=f[nx-1][ny-1][0];
f[nx-1][ny-1][6]=f[nx-1][ny-1][4];
f[nx-1][ny-1][3]=f[nx-1][ny-1][1];
}//boundary ends
numbering used for D2Q9 is:
514
280
637

When I run my code with the above boundary conditions after sometime velocity (or total flow rate) starts decreasing and then keeps on decreasing. Can you please guess something where I may be wrong with the conditions?

Regards
Duldul