CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Correct pressure distribution but wrong aerodynamics coefficients (https://www.cfd-online.com/Forums/openfoam/81532-correct-pressure-distribution-but-wrong-aerodynamics-coefficients.html)

 Aerospace October 29, 2010 07:35

Correct pressure distribution but wrong aerodynamics coefficients

Hello to everybody.

I have been working with OpenFOAM and I have a strange problem. I have simulated several times a 2D cylinder, with different meshes and solvers and I always obtain a correct pressure and velocity results but a too small drag coefficient. I have calculated it by hand, sampling the pressure over the cylinder, and then the drag coefficient is ok. Where could be the problem?

In literature Cd for a cylinder with our Reynold is about 0.8 but forceCoeffs function calculates 0.3.

This our controlDict file:

---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application simpleFoam;

startFrom latestTime;

startTime 0;

stopAt endTime;

endTime 600;

deltaT 1;

writeControl timeStep;

writeInterval 50;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression uncompressed;

timeFormat general;

timePrecision 6;

runTimeModifiable yes;

functions
(
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
//outputControl outputTime;
//outputInterval 1;
outputControl timeStep;
outputInterval 1;
patches (paredes); //change to your patch name
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 0 1);
dragDir (-1 0 0);
pitchAxis (0 0 0);
magUInf -50;
lRef 1;
Aref 1;
}

forces
{
type forces;
functionObjectLibs ("libforces.so"); // Lib to load
//outputControl outputTime;
//outputInterval 1;
outputControl timeStep;
outputInterval 10;
patches (paredes); // change to your patch name
rhoName rhoInf;
rhoInf 1.225; // Reference density for fluid
CofR (0 0 0); // Origin for moment calculations
}

);

// ************************************************** *********************** //

Any suggestions.

Thank you.

 vkrastev October 29, 2010 07:57

Quote:
 Originally Posted by Aerospace (Post 281355) Hello to everybody. I have been working with OpenFOAM and I have a strange problem. I have simulated several times a 2D cylinder, with different meshes and solvers and I always obtain a correct pressure and velocity results but a too small drag coefficient. I have calculated it by hand, sampling the pressure over the cylinder, and then the drag coefficient is ok. Where could be the problem? In literature Cd for a cylinder with our Reynold is about 0.8 but forceCoeffs function calculates 0.3. This our controlDict file: ---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application simpleFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 600; deltaT 1; writeControl timeStep; writeInterval 50; purgeWrite 0; writeFormat ascii; writePrecision 6; writeCompression uncompressed; timeFormat general; timePrecision 6; runTimeModifiable yes; functions ( forceCoeffs { type forceCoeffs; functionObjectLibs ("libforces.so"); //outputControl outputTime; //outputInterval 1; outputControl timeStep; outputInterval 1; patches (paredes); //change to your patch name rhoInf 1.225; CofR (0 0 0); liftDir (0 0 1); dragDir (-1 0 0); pitchAxis (0 0 0); magUInf -50; lRef 1; Aref 1; } forces { type forces; functionObjectLibs ("libforces.so"); // Lib to load //outputControl outputTime; //outputInterval 1; outputControl timeStep; outputInterval 10; patches (paredes); // change to your patch name rhoName rhoInf; rhoInf 1.225; // Reference density for fluid CofR (0 0 0); // Origin for moment calculations } ); // ************************************************** *********************** // Any suggestions. Thank you.
Are you sure of your Aref and lref values? For a 2D cilinder drag calculation in OpenFOAM lref should be the diameter (or the radius if you are simulating only half of the domain) and Aref should be lref*Zmesh, where Zmesh is cells' dimension in the direction orthogonal to your solution domain.

Hope this helps

V.

 aut_iut October 29, 2010 08:04

I'm not sure. But for me this values seem to be strange!
Check them again.
liftDir (0 0 1);
dragDir (-1 0 0);

You defined -x as the direction for the drag and +z for the lift.

 Aerospace October 29, 2010 10:13

Quote:
 Originally Posted by vkrastev (Post 281361) Are you sure of your Aref and lref values? For a 2D cilinder drag calculation in OpenFOAM lref should be the diameter (or the radius if you are simulating only half of the domain) and Aref should be lref*Zmesh, where Zmesh is cells' dimension in the direction orthogonal to your solution domain. Hope this helps V.
Thankyou very much, i didn't know it so I'm going to try!!

 Aerospace October 29, 2010 10:17

Quote:
 Originally Posted by aut_iut (Post 281362) I'm not sure. But for me this values seem to be strange! Check them again. liftDir (0 0 1); dragDir (-1 0 0); You defined -x as the direction for the drag and +z for the lift. Are you sure about them?
Thank you for your coment aut_iut, lift Dir was wrong because I did not want to know it and dragDir is ok because my magUInf is also negative.

Hi aut_iut and Aerospace
I am new user in openFoam and tried with dsmcFoam solver. i need to have aerodynamic coefficient
and i change the controlDict as above but it don't answer
could you help me ?
tanks a lot

 aut_iut May 21, 2012 03:59

Salam Esmaeil,

Could you let me know what kind of error you've got?

regards,

salam dear Rasoul
In fact I saw fallowing warning in log.dsmcfoam file
FOAM Warning :
in file forces/forces.C at line 277
Could not find U, p in database.
De-activating forces.
best regardes

of course I added the following lines in controlDict file
forceCoeffs1
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
outputControl outputTime;
//outputInterval 1;
//outputControl timeStep;
outputInterval 1;
patches (obstacle); //change to your patch name
pName p;
UNmae U;
log true;
rhoName rhoInf;
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 1 0);
dragDir (1 0 0);
pitchAxis (0 0 0);
magUInf 7600;
lRef 2.5146;
Aref 0.25146;
}

 aut_iut May 21, 2012 10:57

Hi Esmaeil,

It seems that the OpenFOAM can not find U and p files. Be sure that U and p files are available at 0 filder (initial conditions).
Are you using the same name for your patch? I guess you need to change the name of the patch based on your case.
By the way, you should have been added both forcecoeffs and forces at ControlDict file.

functions
(
forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
//outputControl outputTime;
//outputInterval 1;
outputControl timeStep;
outputInterval 1;
patches (paredes); //change to your patch name
rhoInf 1.225;
CofR (0 0 0);
liftDir (0 0 1);
dragDir (-1 0 0);
pitchAxis (0 0 0);
magUInf -50;
lRef 1;
Aref 1;
}

forces
{
type forces;
functionObjectLibs ("libforces.so"); // Lib to load
//outputControl outputTime;
//outputInterval 1;
outputControl timeStep;
outputInterval 10;
patches (paredes); // change to your patch name
rhoName rhoInf;
rhoInf 1.225; // Reference density for fluid
CofR (0 0 0); // Origin for moment calculations
}

If you have some difficulties send me your test case and I will take a look on it.

regards,
Rasoul

Hi dear Rasoul