CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Post-Processing (
-   -   [OpenFOAM] Forces Calculation (

m_f March 8, 2013 05:26

[OpenFOAM] Forces Calculation
Hello everyone,

I am realizing since few days the aerodynamic study of a building, in a flow (wind) at 100 km/h. I realized the same study with CFX. I want to finally compare the two results.

The problem is that finally, with approximate the same mesh, the same turbulence model and same parameters, I don't obtain the same field of pressure on the surface of the building. So, I want to calculate the total pressure force which is on the building surface.

Does a function exist in OpenFOAM which can realize this kind of calculation ?
A kind of "F=sum(CellAera*scalar(p))"

I tried putting "forces" key word and parameters in control dict, but it seemed not working, i don't know how to use it well. . ..

Thanks by advance,
Please ask question if I am not clear.


pechwang March 8, 2013 14:43

Hi m_f,

I'm new to OpenFOAM as well, so I don't know whether this will helps you. But you can try this. I use force library to calculate torque. Just add the following command in the controlDict file.
forces_fixedWall (patch name, in my case is fixedwall)
type forces;
functionObjectLibs ("");
outputControl timeStep;
outputInterval 1; (write torque output, I write every time step)
patches (fixedWall); (patch name)
// pname p;
// Uname U;
rhoName rhoInf;
log true;
rhoInf 798; (798 is the density of the fluid, you need to change it)
CofR (0 0 0);

Again, I'm not sure whether this works, you can try it.


m_f March 9, 2013 01:01

Thanks for your answer. I think I had already try this funtion, but I didn't use the same syntaxe...maybe that explain why it didn't work :D.

Unfortunately, even if your function seems worked (I obtain some results during calculation), there is a big difference between the value given by OpenFOAM (with this function) and the value given CFX.

CFX Forces (X-direction) is around 2.5e+09 N
OpenFOAM Forces (sum pressure + viscous) is around 1.89e+013 N.

Update : My mistake, it was 2.1e+07 N for CFX Forces (X-Direction), that's mean OpenFOAM Forces are 2 times bigger CFX Forces, I really don't understand . . .

It is approximately the same mesh, the same parameters, so i can't explain this difference. Moreover, the two results are totally converged.

So, is there others parameters to give to "forces function" of OpenFOAM, as Area or something else, which can give me betters results ?

Thanks again for your last answer ;)

m_f March 12, 2013 09:26

Nobody has encounter this problem or can help me ? :o

olivierG March 12, 2013 11:01


I don't have encounter this problem before, but something is suspicious:
- You get 2.1e+07 N with CFX.
- You get
1.89e+013 N with openfoam, so there is a 1e6 factor. This is a too nice number for me.
My inclination would be a mistake in the force calculation, with a viscosity factor, or even a mesh not in m, ....


m_f March 13, 2013 04:18


Originally Posted by olivierG (Post 413461)
[...]so there is a 1e6 factor. This is a too nice number for me.
My inclination would be a mistake in the force calculation, with a viscosity factor, or even a mesh not in m, ....

I exactly thought the same thing, but after checking, I use exactly the same geometry file in the two cases...
But you make me in the doubt again, so I checked with another point of view.
blockMeshDict is in meter, right ?
I use CATIAV5R17 to export STL file, but CATIA works with mm. SnappyHexMesh need STL in meters by default ? I will checked with a 0.001 scale of my stl file.
I was pretty sure that was a stupid mistake....!

Edit : Problem solved ! Shame on me -_-, Thanks for your helped. . . I thought STL file was exported in meters by CATIA, not in mm. . . even if CATIA works in mm . . .

EmadTandis January 13, 2015 04:27

I have a same problem with studying lift for NACA0012 airfoil at 4 degree angle of attact. Re=3e6 and C=1 m and span=0.1, then I put this function in controlDict:
type forceCoeffs;
functionObjectLibs ( "" );
outputControl timeStep;
outputInterval 50;

patches ("walls");
pName p;
UName U;
rhoName rhoInf;
log true;

liftDir (-.0349 .9976 0);
dragDir (.9976 .0349 0);
CofR (0 0 0);
pitchAxis (0 1 0);

magUInf 30.00;
rhoInf 1.00;
lRef 1.00;
Aref 0.1;
i used simplefoam to solve the case. and different sizes of mesh has been tested.
and Cl is calculated 0.18. but I expect Cl~0.4 . what's the problem??

All times are GMT -4. The time now is 05:01.