# For ghassemi

Hi Dear Ghassemi,
First of all thanks a lot for mention to me one good paper. Dear if you don’t mind it i need your kind help, can you send it to me just the subroutine for calculating forces and then the drag and lift coefficient for square cylinder. Your kind help will be able me to complete my code. I hope you will be help me.
Best Regards and bye for now.
Khan

Hi Dear All,
I trying to calculate the drag and lift for square cylinder, but i think i do some mistake and the results are not quite good.
Can any one have a subroutine written in Fortran for calculating drag and lift forces and share with me, it will help me a lot.
Here below one is my one that i develop for calculating drag and lift coefficients (is this one correct or not?).
Regards
Khan

DO i=0,8
forcex(i)=0.0d0
forcey(i)=0.0d0

END DO

``````DO y=y1,y2

forcex(3)=forcex(3)+1.d0*(f(3,x1,y)+f(1,x1-1,y))
forcex(6)=forcex(6)+1.d0*(f(6,x1,y)+f(8,x1-1,y+1))
forcex(7)=forcex(7)+1.d0*(f(7,x1,y)+f(5,x1-1,y-1))
forcex(1)=forcex(1)+1.d0*(f(1,x2,y)+f(3,x2+1,y))
forcex(5)=forcex(5)+1.d0*(f(5,x2,y)+f(7,x2+1,y+1))
forcex(8)=forcex(8)+1.d0*(f(8,x2,y)+f(6,x2+1,y-1))
END DO

DO x=x1,x2
forcey(2)=forcey(2)+1.d0*(f(2,x,y2)+f(4,x,y2+1))
forcey(5)=forcey(5)+1.d0*(f(5,x,y2)+f(7,x+1,y2+1))
forcey(6)=forcey(6)+1.d0*(f(6,x,y2)+f(8,x-1,y2+1))
forcey(4)=forcey(4)+1.d0*(f(4,x,y1)+f(2,x,y1-1))
forcey(7)=forcey(7)+1.d0*(f(7,x,y1)+f(5,x-1,y1-1))
forcey(8)=forcey(8)+1.d0*(f(8,x,y1)+f(6,x+1,y1-1))
END DO
Fx= forcex(3)-forcex(1)+0.7071*(forcex(6)+forcex(7)-forcex(8)-forcex(5))
Fy= forcey(4)-forcey(2)+0.7071*(forcey(7)+forcey(8)-forcey(5)-forcey(6))

CD=-0.5*Fx/Dxy/a/Uw/Uw
CL=-0.5*Fy/Dxy/a/Uw/Uw``````

Hello,
As I know, there are several different approaches for calculating drag forces in LB algorithm. The one I use in my simulations is called “immersed moving boundary conditions” which can also consider moving obstaces in fluid domain. you can refer to the following paper:

Noble, D. and Torczynski, J. (1998), “A lattice Boltzmann method for partially saturated
computational cells”, International Journal of Modern Physics C, Vol. 9 No. 9, pp. 1189-201.

Hi Dear Ghassemi,
Thanks a lot for such a nice reply. Dear Ghassemi i know this is not good to ask some one for code. But some time without any help some works are not possible. Dear i have a kind request if you have such a code for square cylinder calculating drag and lift coefficients and share with me. It will help me a lot to understand bitterly such a coding technique for LBM. I hope you will be help me. Thanks again and best wishes.
Khans

Hi, I am Santhosh I am solving flow over a square cylinder . Could you please help me how to calculate drag force.