# How to calculate the forces

Hi Dear All,
Can any body help me. I try to calculate the forces using the momentum exchange method for drag and lift. Once i run the code for Re=100 the drag value is very perfect but no data for lift. I used the D2Q9 model, can any body please tell me what’s wrong in the code for forces along y-direction. Any suggestions and corrections will be higly appreticated.
/* lattice direction
x y
{ 0 0 } rest
{ + 0 } dir 1
{ - 0 } dir 3
{ 0 + } dir 2
{ 0 - } dir 4
{ + + } dir 5
{ - - } dir 7
{ + - } dir 8
{ - + } dir 6
*/

The below is the code i write for calculating forces along x- and y-direction

// calculate force on body using the momentum exchange method
void force(int wall[NX][NY], int wb[NX][NY], double *fx, double *fy) // wb[NX][NY] for the surface of the cylinder and wall[NX][NY] for wall boundary
{
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){

fx = fx - (f[im][j]+f[i][j]) (1-wall[im][j]) + (f[ip][j]+f[i][j]) (1-wall[ip][j]) - (f[im][jm]+f[i][j])*(1-wall[im][jm])

• (f[ip][jp]+f[i][j])(1-wall[ip][jp])+ (f[ip][jm]+f[i][j])(1-wall[ip][jm])- (f[im][jp]+f[i][j])*(1-wall[im][jp]);

fy = fy - (f[i][jm]+f[i][j])(1-wall[i][jm])+ (f[i][jp]+f[i][j])(1-wall[i][jp])- (f[im][jm]+f[i][j])*(1-wall[im][jm])

• (f[ip][jp]+f[i][j])(1-wall[ip][jp]) - (f[ip][jm]+f[i][j])(1-wall[ip][jm])+ (f[im][jp]+f[i][j])*(1-wall[im][jp]);
} } }}

Then i calculate the drag and lift

Thanks
Khan

did you find the algorithm for the moment exchange method in a paper? which one?