Hi Dear All,
I want to write the code using LBM. I not find the lift coefficient data for even Re=100 and convergence meet very quickly. I put here the boudary conditions and forces. Can any body suggest me that’s it’s right or wrong or i need to do some changes.
// symmetric bc: j=1 and NY-2 is the symmetry lines.
void bc_symmetry()
{
int i;
for(i=0;i<=NX-1;i++){
f[i][0][2] = f[i][2][4];
f[i][0][5] = f[i][2][8];
f[i][0][6] = f[i][2][7];
f[i][NY-1][4] = f[i][NY-3][2];
f[i][NY-1][7] = f[i][NY-3][6];
f[i][NY-1][8] = f[i][NY-3][5];
}
}
//periodic boundary condition
void bc_periodic()
{
int i;
for(i=0;i<=NX-1;i++){
f[i][0][2] = f[i][NY-2][2];
f[i][0][5] = f[i][NY-2][5];
f[i][0][6] = f[i][NY-2][6];
f[i][NY-1][4] = f[i][1][4];
f[i][NY-1][7] = f[i][1][7];
f[i][NY-1][8] = f[i][1][8];
}
}
//bounce-back boundary condition for wall(channel) between 0 and 1 or between NY-2 and NY-1
void bc_bounceback()
{
int i;
for(i=0;i<=NX-2;i++){
f[i][0][5] = f[i+1][1][7];
f[i][NY-1][8] = f[i+1][NY-2][6];
}
for(i=1;i<=NX-2;i++){
f[i][0][2] = f[i][1][4];
f[i][NY-1][4] = f[i][NY-2][2];
}
for(i=2;i<=NX-1;i++){
f[i][0][6] = f[i-1][1][8];
f[i][NY-1][7] = f[i-1][NY-2][5];
}
}
// calculate force on body
void get_force(int wall[NX][NY], int wb[NX][NY], double *fx, double *fy)
{
int i,j;
*fx = 0.0;
*fy = 0.0;
for(i=1;i<=NX-2;i++){
int ip = i+1;
int im = i-1;
for(j=1;j<=NY-2;j++){
int jp = j+1;
int jm = j-1;
if(wb[i][j]==1){ //need to check for if(wb[i][j]==0)
*fx = *fx - (f[im][j][3]+f[i][j][1])* (1-wall[im][j])
+ (f[ip][j][1]+f[i][j][3])* (1-wall[ip][j])
- (f[im][jm][7]+f[i][j][5])*(1-wall[im][jm])
+ (f[ip][jp][5]+f[i][j][7])*(1-wall[ip][jp])
+ (f[ip][jm][8]+f[i][j][6])*(1-wall[ip][jm])
- (f[im][jp][6]+f[i][j][8])*(1-wall[im][jp]);
*fy = *fy - (f[i][jm][4]+f[i][j][2])*(1-wall[i][jm])
+ (f[i][jp][2]+f[i][j][4])*(1-wall[i][jp])
- (f[im][jm][7]+f[i][j][5])*(1-wall[im][jm])
+ (f[ip][jp][5]+f[i][j][7])*(1-wall[ip][jp])
- (f[ip][jm][8]+f[i][j][6])*(1-wall[ip][jm])
+ (f[im][jp][6]+f[i][j][8])*(1-wall[im][jp]);
}
}
}
}
Thanks in advance any suggestions will be highly appreticated.
Khan