Welcome! Log In Create A New Profile

# I want a program that calculates the drag and lift force.

 I want a program that calculates the drag and lift force. June 03, 2016 10:10PM Registered: 4 years ago Posts: 20
I want a program that calculates the drag and lift force.
 Re: I want a program that calculates the drag and lift force. June 08, 2016 03:01PM Registered: 6 years ago Posts: 60
Dear sofiane,

If you run a self made code, it is quite simple to determine the vertical and horizontal forces exerted on a body.

You can check the momentum exchange method (MEM) as a good starting point.
you can find many information resources about this algorithm on internet. Briefly, it is an explicit method that sums up all the distribution functions that hit the boundary with a straightforward formula.

I hope that this guides you to the right direction.

Cheers
 Re: I want a program that calculates the drag and lift force. June 16, 2016 08:26AM Registered: 3 years ago Posts: 29
@Puigar : I read about the momentum exchange method and tried to apply it but it didn't work. I think i missed a point . So, just as a verification:
-Should i place the force calculus after collision and before streamin?
-The distribution functions "f" appearing in the force expression are in the same node "x" (x node at the obstacle boundary) or no ?
-The expression of momentum exchange is computed at the same time step no ? Or it uses a previous value ?
Here is the article i used "[www.researchgate.net]; page 336.
 Re: I want a program that calculates the drag and lift force. June 16, 2016 02:01PM Registered: 6 years ago Posts: 60
Quote

-Should i place the force calculus after collision and before streamin?

probably this is the best way to do it properly.

Quote

-The distribution functions "f" appearing in the force expression are in the same node "x" (x node at the obstacle boundary) or no ?

it depends. You should be aware that the name of momentum exchange means that you should have an exchange (of F distributions AT the physical boundary). therefore, it will extremely depend on which algorithm you are using to define the wall, which finally defines at which exact position you have the physical wall.

if you use:
- fullway BB: you sum up all the distributions that are going to hit the boundary wall PLUS all of the distributions that are outgoing right from the obstacle to the fluid.

- half way BB: you then only need sum up the distributions that are bound to hit the obstacle boundary the next time step and multiply each distribution by 2, because as we define the wall at the middle of the 2 nodes (property of the halfway BB), the outgoing F distribution is exactly the same.

- second order BB scheme: then it becomes trickier. Before streaming, you store and sum all the distributions that go to the boundary. After the streaming and BB are applied, you add the modified distributions that face the opposite direction to the stored distributions. (this one is better to do when you completely dominate the other aforementioned two BB algorithms)

Quote

-The expression of momentum exchange is computed at the same time step no ? Or it uses a previous value ?

Computationally depends on the type of bounce back.
- fullway: you can do it in a single operation because you already have all the variables. you can do it both before and after streaming step. the normal thing however is to do it before streaming and after collision
- halfway: you also can do it on a single operation before or after the streaming. Theoretically the MEM is calculated at t+(Dt)/2 on this case. You better do it before streaming because it is also the normal way.
- second order BB: here there are two sum operations. one before and the other right after the streaming step.

cheers!

Edited 3 time(s). Last edit at 06/16/2016 02:04PM by Puigar.
 Re: I want a program that calculates the drag and lift force. June 16, 2016 02:46PM Registered: 3 years ago Posts: 29
Thanks a lot for this detailed answer :) I've been searching for long time for this but didn't find a clear answer.
Just a little question, what do you mean by "second order bounce back"? I thought that the fullway is first order and the halfway is second order. So, the halfway is the second order type, or you mean another ( name? ) type of bounce back?
 Re: I want a program that calculates the drag and lift force. June 17, 2016 06:10AM Registered: 6 years ago Posts: 60
for second order BB I meant the second order BB for curved geometries (Mei-Luo-Shy method, for example), which regards the physical walls in other places than the middle between two nodes.
 THIS PROGRAM CALCULATE force drag and lift fine but in language matlab for curved geometries (Mei-Luo-Shy method, for example) June 19, 2016 01:04PM Registered: 4 years ago Posts: 20
% *************************************** %
% ********** Cd/Cl Computation ********** %
% *************************************** %
% Determination of the drag and lift on the profil

function [Fx, Fy, Cd, Cl] = CdCl(f,ftemp,Nxlimg,Nylims,Nxlimd,Nylimn,Num,R,uref,rhoref,C)

global bin binC

% Computation of the forces applied to the profil
k = 1;
Fx=0;
Fy=0;
FX=zeros(Nxlimd+2,Nylimn+2);
FY=zeros(Nxlimd+2,Nylimn+2);
Balayage=0;
for i = Nxlimg:Nxlimd
for j = Nylims:Nylimn
if bin(i,j,Num)==1
if bin(i+1,j,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j,1)+ftemp(i+1,j,3));
Balayage=Balayage+1;
end
if bin(i+1,j+1,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j+1,5)+ftemp(i+1,j+1,7));
FY(i,j)=FY(i,j)+(f(i+1,j+1,5)+ftemp(i+1,j+1,7));
Balayage=Balayage+1;
end
if bin(i,j+1,Num)==0
FY(i,j)=FY(i,j)+(f(i,j+1,2)+ftemp(i,j+1,4));
Balayage=Balayage+1;
end
if bin(i-1,j+1,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j+1,6)+ftemp(i-1,j+1,8));
FY(i,j)=FY(i,j)+(f(i-1,j+1,6)+ftemp(i-1,j+1,8));
Balayage=Balayage+1;
end
if bin(i-1,j,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j,3)+ftemp(i-1,j,1));
Balayage=Balayage+1;
end
if bin(i-1,j-1,Num)==0
FX(i,j)=FX(i,j)-(f(i-1,j-1,7)+ftemp(i-1,j-1,5));
FY(i,j)=FY(i,j)-(f(i-1,j-1,7)+ftemp(i-1,j-1,5));
Balayage=Balayage+1;
end
if bin(i,j-1,Num)==0
FY(i,j)=FY(i,j)-(f(i,j-1,4)+ftemp(i,j-1,2));
Balayage=Balayage+1;
end
if bin(i+1,j-1,Num)==0
FX(i,j)=FX(i,j)+(f(i+1,j-1,8)+ftemp(i+1,j-1,6));
FY(i,j)=FY(i,j)-(f(i+1,j-1,8)+ftemp(i+1,j-1,6));
Balayage=Balayage+1;
end
end
end
end

alpha=0;

Fx=sum(sum(FX));
Fy=sum(sum(FY));
Fx=-Fx;
Fy=-Fy;

% Rotation of the referential
F=sqrt(Fx*Fx+Fy*Fy);
Ang1=acosd(Fx/F);
Ang2=asind(Fy/F);
Fx=F*cosd(Ang1+alpha);
Fy=F*sind(Ang2+alpha);

% --------- %
% - Cd/Cl - %
% --------- %

Cd=2*abs(Fx)/uref/uref/R/rhoref;
Cl=2*Fy/uref/uref/R/rhoref;
-----------------------------------------------------------------------------------------------------------------------------

cd= drag coefficient
cl = lift coefficient
 Re: THIS PROGRAM CALCULATE force drag and lift fine but in language matlab for curved geometries (Mei-Luo-Shy method, for example) June 20, 2016 08:06AM Registered: 3 years ago Posts: 29
@sofiane: Thanks i will test this code after modifications because i worked with fullway bounce back .
 are you used this method bounce back. dhouha June 20, 2016 03:53PM Registered: 4 years ago Posts: 20
I used this method bounce back.
is there possibility to modify this program.
that already sent to bounce back.

can you send me your email for many information

i have program in matlab in lattice boltzmann but is difucult
 Re: are you used this method bounce back. dhouha June 27, 2016 10:44AM Registered: 3 years ago Posts: 2
Hi sofiane,
I have a code which uses the geometry exterior to generate Cd, Cl in matlab......and its pretty easy to understand with just 5 lines of code..If you are interested just reply.
 Re: are you used this method bounce back. dhouha June 30, 2016 05:56PM Registered: 3 years ago Posts: 1
Hello sidneni,

I am interested in your code, could you please share it with me?
 can you send me code pleese July 07, 2016 05:13PM Registered: 4 years ago Posts: 20
I have a code which uses the geometry exterior to generate Cd, Cl in matlab......and its pretty easy to understand with just 5 lines of code..If you are interested just reply.
 Re: I want a program that calculates the drag and lift force. July 20, 2016 10:18PM Registered: 3 years ago Posts: 4
Hi I read your explanation about drag force. it was very informative. i am trying to use Lallemand interpolation method in order to calculate drag force over cylinder Re=100. unfortunately my Cd is always higher than literature. to calculate drag force i sum up all f's toward the boundary before streaming and add it to the inverse direction after streaming on fluid node next to the solid node. i am not sure where is my problem. i would be grateful if you help me thanks

Lallemand, Pierre, and Li-Shi Luo. "Lattice Boltzmann method for moving boundaries." Journal of Computational Physics 184.2 (2003): 406-421.
 Re: are you used this method bounce back. dhouha July 11, 2018 04:47PM Registered: 1 year ago Posts: 1
Dear sofiane,
Currently, I have some troubles in using the momentum exchange method to calculate the drag and lift force, could you
please send me some relevant codes as you said?
Thanks you in advance,
kind regards,
zhilin
Sorry, you do not have permission to post/reply in this forum.