CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   lift and drag coefficient (

Rophys October 28, 2012 20:00

Drag and lift force using OpenFoam2.1.1
Hi everyone,

I am trying to calculate the drag, lift and pitching-moment coefficients for a flow over a probe. The code structure below works fine when the flow is parallel to the probe. However, when I changed the angle of attack I got a rude difference for lift and pitching-moment when compared with experimental data (the drag values is OK).

I guess, this difference is related to the vectors (liftDir (0 1 0); dragDir (1 0 0); pitchAxis (0 0 1)). I this this vectors is just valid for a parallel flow, isn't it ?

Anybody knows how to change this vectors according to a certain angle of attack ?

Thank you very much.


type forces;
enabled true;
functionObjectLibs ( "" );
outputControl outputTime;
patches (probe);
directForceDensity true;
fDName fDMean;
CofR (0.02 0 0);
log on;

type forceCoeffs;
functionObjectLibs ("");
patches (probe);
outputControl outputTime;
fDName fDMean;
rhoInf 1.73e-5;
CofR (0.02 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 1);
magUInf 1503.1;
lRef 0.05;
Aref 9.817e-4;

Rider October 29, 2012 04:29


We have two cases :
If you change the components of the velocity (and don't rotate the geometry), the lift and drag direction must change.
If you rotate the geometry, the lift and drag direction don't change.

For exemple, if you change your flow direction (angle of attack) like this :
(V*cos(alpha) 0 V*sin(alpha)).

You must have to change the direction like this :
liftDir(-sin(alpha) 0 cos(alpha))
dragDir (cos(alpha) 0 sin(alpha))

I hope that I have answered to your question ;)

Rophys October 29, 2012 05:20

Hi Rider,

Thanks for your response. It was clear enough.

In my case, the mesh still the same and I just rotate the geometry (the liftDir and dragDir remained the same, liftDir (0 1 0); dragDir (1 0 0)). Even doing this the lift and pitching-moment is not matching with experimental results. It is something around 20-30% difference. The drag force is matching quite well, as well the Ca and Cn.

If anybody have some suggestions in how to solve this, I'll appreciate.


Rider October 29, 2012 06:10

Your domain is enough biggest to capture all the tail?

What is your y+ value ?

Rophys October 29, 2012 06:34

I am using the OpenFOAM but I am not using a Navier-Stokes solver. It is called DSMC and for it, I don't have problems with y+ :D

Rider October 29, 2012 06:37

Ok, it's your company solver or a free solver ?

Rophys October 29, 2012 06:46

Yes it is free....DSMC solver is part of the OpenFoam. It is used, for example, to simulate re-entry problems in very high altitudes where the N-S is no long valid (is too rarefied to solve NS equations). It take into account the molecular movement instead to solve differential equation but when used for "low altitude" the results should be quite close to CFD results.

Rider October 29, 2012 07:06



jiujiumin May 18, 2013 08:52

why do you remove Uname and pName ,and add rhoName rhoInf?
i am a new user in openFoam ,I want to know why it do not use the U and p in caculating the forces and forcecoeffs? And i also want to know why it always has the error :From function void forces::read(const dictionary& dict)
in file forces/forces.C at line 277
Could not find U, p or rho in database.
De-activating forces.
Because I have the U and p files in the 0 file,so i am so confused about it .

arashfluid January 3, 2014 04:38

lift and drag coeffs in paraview
How can I calculate lift and drag coefficient in paraview?
I've run an oscillating airfoil with pitching motion.I've calculated lift and drag coefficient through libforces in controlDict, but the values are wrong. I want to calculate them in paraview and plot them over the time or angle.
Please tell me how to do this?

Mahe88 October 31, 2016 17:29

Could not find rho

I want to calculate the drag and lift coefficients of an 2D airfoil. But when I use the force and force coeffs script I always get an error saying "could not find rho".

Without the drag and lift it works fine and rho is defined in transport properties. I am using openfoam 4.1. Anybody have an idea or had a similar problem.


Mahe88 November 3, 2016 08:41

works with OpenFoam 3. Hence there should be a bug in OpenFoam4.

alimea December 11, 2017 03:10

calculating forces
Hi all
I saw in forces code that shear stress is calculated by:

shear stress = - mu*gama

in code:

what is the minus in this formula?
Now I want to calculate forces for viscoelastic fluid. should I write:

total shear stress = -tau - mu*gama

that tau is polymeric stress.


All times are GMT -4. The time now is 14:57.