CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Problem in simpleFoam airFoil2D forceCoeffs (https://www.cfd-online.com/Forums/openfoam-solving/102863-problem-simplefoam-airfoil2d-forcecoeffs.html)

junkie71189 June 4, 2012 20:33

Problem in simpleFoam airFoil2D forceCoeffs
 
Hey guys,

I'm new to OpenFOAM and I started out with trying to run the pre-existing airFoil2D case using simpleFoam.

I've also added the necessary changes to my controlDict to print out the force coefficients but I've not changed any of the control variables from their default values.


The output after 341 iterations is as follows,

SIMPLE solution converged in 341 iterations

forceCoeffs output:
Cd = -0.231573
Cl = 1.85513
Cm = -15.2647
Cl(f) = 16.1922
Cl(r) = -14.3371

End

The coeffs have converged as per plots of forceCoeffs, but is of wrong value

My controlDict (which I'm not able to upload for some reason) is,

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

application simpleFoam;

startFrom startTime;

startTime 0;

stopAt endTime;

endTime 500;

deltaT 1;

writeControl timeStep;

writeInterval 50;

purgeWrite 0;

writeFormat ascii;

writePrecision 6;

writeCompression off;

timeFormat general;

timePrecision 6;

runTimeModifiable true;

functions
{
forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches
(
wall
);
pName p;
UName U;
rhoName rhoInf; // Indicates incompressible
log true;
rhoInf 1; // Redundant for incompressible
liftDir (0 1 0);
dragDir (1 0 0);
// CofR (0 0 0); // Axle midpoint on ground
pitchAxis (0 0 1);
magUInf 26;
lRef 1; // Wheelbase length
Aref 1; // Estimated
}
}



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

I'll be really grateful if someone could help me out.


Thanks,
venkat

ebah6 June 6, 2012 17:04

I did run this case and obtain almost the same results.
I also did it the forces instead of the forceCoefs. and the drag was still negative.
It would be great if someone has some expertise on this matter.


Best regards.

lovecraft22 June 6, 2012 19:13

First of all, I'm not sure whether 341 iterations are enough.
Secondly, you should average the forces among 500 iterations or something, not just look at a single iteration values.

Eren10 June 7, 2012 05:08

lref and Aref are unknown, so you should not try to get the right coefficients.

If the simulation (p, velocity) goes well than it is oke.

junkie71189 June 11, 2012 18:47

Persisting problems
 
Thank you lovecraft22 and eren10 for your replies.

But my problems are apparently more deep rooted. :(

Problem 1:
The default case does not proceed any further than 341 iterations.
The value of Cd = -0.231 and Cl = 1.855 are the values after convergence as well as averaging a given number of terms. The flow field looks to be right as well.

The main purpose behind me trying to run the default case was to make sure the additional lines added to controlDict to get the force coefficients would also work in a different case.

Problem 2:
I set up a case using an O-grid (using Pointwise) for flow over an airfoil with parameters the same as the tutorial case (26 m/s, 8 degree AoA) and ran it till 10,000 steps. I used the same controlDict as before to print out the force coefficients.
Cd = -6e-05
Cl = 0.00078

Is there an alternate way to get Cl and Cd or is there a glaring mistake in the way that I've set up the problem?

If you could send me a case of '2D flow over airfoil' that works with OpenFOAM with good results, it would help me a lot.


Please help!:(

Thanks again,
Venkat

Eren10 June 12, 2012 06:53

First check if the residuals are decreasing for the tutorial case.

Than check for your own simulation also the residuals. Apparantly, there is something wrong in the boundary conditions.

GregorS June 12, 2012 07:46

What is your angle of attack? If it is not 0, you need to change liftDir and dragDir in controlDict file. Direction of liftDir must be perpendicular to airflow direction and dragDir must point in opposite direction than airflow.

junkie71189 June 13, 2012 11:59

Change in controlDict
 
Quote:

What is your angle of attack? If it is not 0, you need to change liftDir and dragDir in controlDict file. Direction of liftDir must be perpendicular to airflow direction and dragDir must point in opposite direction than airflow.
I modified the controlDict file of the tutorial case to fit the general expression, for flow from left to right (to leading edge) as,

liftDir ( sin(alpha) cos(alpha) 0);
dragDir ( cos(alpha) -sin(alpha) 0);

I tried running it with this, but the results didn't change much.

Also, for the tutorial case, the residuals dropped to low levels. So the problem is only in the way that the force coefficient values get printed out

Thanks,
Venkat

Rafael_Coelho July 8, 2012 16:08

I am facing the same problem. Any news of how to get the right Cl Cd?

junkie71189 July 12, 2012 01:22

Suggestion
 
Hey Rafael,

A suggestion would be to plot the Cp along x/c and integrate.

tcarrigan July 12, 2012 09:50

Quote:

Originally Posted by junkie71189 (Post 366277)
I modified the controlDict file of the tutorial case to fit the general expression, for flow from left to right (to leading edge) as,

liftDir ( sin(alpha) cos(alpha) 0);
dragDir ( cos(alpha) -sin(alpha) 0);

I tried running it with this, but the results didn't change much.

Also, for the tutorial case, the residuals dropped to low levels. So the problem is only in the way that the force coefficient values get printed out

Thanks,
Venkat

You have the x-component of the lift direction backwards, should be -sin(alpha). And the y-component of drag should be sin(alpha).

For the airfoil2D example I get the following results:
Cd = 0.0288648
Cl = 1.86931

Rafael_Coelho July 12, 2012 15:42

junkie71189 thanks for your reply. I think the force is given for the whole surface, so the Cd and Cl are already integrated, right?

tcarrigan, How are you getting these values? Could you please please your controlDict?


Thank you!

junkie71189 July 12, 2012 15:58

Quote:

Originally Posted by Rafael_Coelho (Post 371183)
junkie71189 thanks for your reply. I think the force is given for the whole surface, so the Cd and Cl are already integrated, right?

tcarrigan, How are you getting these values? Could you please please your controlDict?


Thank you!

Yes. But what I tried was for getting Cl, extracting the Cp values along the upper and lower surface of the airfoil as a file. Then, add all (Cp_upper - Cp_lower) times (dx / chord length) from 0 to 1. The sum gives the lift. I'm having problems getting the drag coefficient though.


tcarrigan, thank you for your correction. Can you shed some light on the lref and Aref used for the default case?

tcarrigan July 12, 2012 16:33

lRef is a reference length and Aref is a reference area. These values are used to compute the coefficients of lift, drag, and pitching moment. Because this is a 2D case and the airfoil has a unit length, therefore, lRef=1 and Aref=1. If this were a 3D calculation, lRef would be something like the mean chord length and Aref could be wing area.

To get Cl there is no need to extract Cp and sum them up for a total lift coefficient. By setting up the appropriate reference values in the forceCoeffs (like below), OpenFOAM will compute Cl for you.

I believe the AOA for the airfoil2D exampel is 8deg. Here are the reference values I used:

forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches ( wall );
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.225;
liftDir (-0.139173 0.990268 0);
dragDir (0.990268 0.139173 0);
pitchAxis (0 0 1);
magUInf 26;
lRef 1;
Aref 1;
}

Rafael_Coelho July 15, 2012 07:19

Thank you tcarrigan.

It makes sense now. I am using the same code on the wigley tutorial. But the values are very wrong. Do you know if Aref should be the total area or only the wetted (water portion) area?

Besr regards,

Rafael

tcarrigan July 15, 2012 16:21

For ship resistance prediction I believe you should use the wetted area, the area below the water line.

Rophys October 28, 2012 19:17

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 perpendicular 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 values is just valid for a parallel flow, isn't it ?

Anybody knows how to change this vectors according to a certain angle of attack ? I just need to use : liftDir ( sin(alpha) cos(alpha) 0);
dragDir ( cos(alpha) -sin(alpha) 0); ??

Thank you very much.

Rophys

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

forceCoeffs
{
type forceCoeffs;
functionObjectLibs ("libforces.so");
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;
}

flyingd April 27, 2013 02:34

drag and lift calculation
 
Hi everyone! Hi Rafael_Coelho.

I have know you have done more work about calculation of drag and lift coeffs. I am very interested in them. I would like to ask you some questions. How to define wall function?

s.m May 7, 2013 10:03

lRef and ARef for 3 element airfoils
 
Quote:

Originally Posted by tcarrigan (Post 371189)
lRef is a reference length and Aref is a reference area. These values are used to compute the coefficients of lift, drag, and pitching moment. Because this is a 2D case and the airfoil has a unit length, therefore, lRef=1 and Aref=1. If this were a 3D calculation, lRef would be something like the mean chord length and Aref could be wing area.

To get Cl there is no need to extract Cp and sum them up for a total lift coefficient. By setting up the appropriate reference values in the forceCoeffs (like below), OpenFOAM will compute Cl for you.

I believe the AOA for the airfoil2D exampel is 8deg. Here are the reference values I used:

forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches ( wall );
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.225;
liftDir (-0.139173 0.990268 0);
dragDir (0.990268 0.139173 0);
pitchAxis (0 0 1);
magUInf 26;
lRef 1;
Aref 1;
}

hi Travis;
whould you please tell me, how does "lRef" and "ARef" define for a 3 elemet airfoil?

s.m May 31, 2013 04:05

Quote:

Originally Posted by lovecraft22 (Post 365138)
First of all, I'm not sure whether 341 iterations are enough.
Secondly, you should average the forces among 500 iterations or something, not just look at a single iteration values.

hi lore,
would you please explain more, that how should we get the "forcCoeffs" "cd & cl" from the force.dat file that is gained after finishing the analysis?
thank you very much.

reza1111 July 10, 2013 08:24

Hi.
I'am going to simulate a flow around NACA0009 at 5 degree AOA. I used simpleFoam solver and my setup is same as the airfoil2D tutorial. when i get the result, the forces and forceCoeffs are too less than I expected. the ratio of the forces compare with Fluent results are 1:25. I know this is weird. and I guess I did something wrong. I have done the case using Fluent and the results were good.
Please give me some hints.
Thanks

Rafael_Coelho July 22, 2013 17:28

I just re-installed Openfoam and will run the airfoil case as a benchmark. Will post some results late this week.

Rafael_Coelho July 28, 2013 04:33

I just ran the airFoil2D case and I got the following results:

forceCoeffs output:
Cm = -15.2719
Cd = -0.231827
Cl = 1.85603
Cl(f) = -14.3439
Cl(r) = 16.2

After 350 interactions.

Rafael_Coelho July 28, 2013 04:52

Changing the liftDir and dragDir as suggested by tcarrigan:

functions
{
forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches ( wall );
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.225;
liftDir (-0.139173 0.990268 0);
dragDir (0.990268 0.139173 0);
pitchAxis (0 0 1);
magUInf 26;
lRef 1;
Aref 1;
}
}


I got the following Cl and Cd:

forceCoeffs output:
Cm = -15.2719
Cd = 0.0287385
Cl = 1.87023
Cl(f) = -14.3368
Cl(r) = 16.2071

My question now is: How did you (tcarrigan) get those values for liftDir and dragDir?????

wes1204 October 14, 2013 03:46

hi all
 
hi all

I am also facing to same problem.

my case is 2d wind flow around bridge deck.

experimental data is
Cd = 0.245
Cl = 0.028

but my openfoam results were calculated as 0.002, 0.001...
the order of coefficients is quite different to experimental data.

so I did it myself using pressure field.

I extracted pressure value from paraview after slicing mesh to obtain 2d value.
then, I got Force components,generating Normal component of surface and integrating.

this values are almost similar to experimental data
Cd : 0.224
Cl : 0.001

but to do this, I should waste my time and large storage since Values should be 1000Hz.

I dont know why openfoam output is wrong.

my code is same to yours.

functions
{
forces
{
type forces;
functionObjectLibs ( "libforces.so" ); // lib to load
outputControl timeStep;
outputInterval 1;
patches
( bridge ); // change to your patch name

// name of fields
pName p;
UName U;
log true; // dump to file
rhoName rhoInf;
rhoInf 1.25;
CofR ( 2.3 0.7569 0 );
log on;
}
forcesCoeffs
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;
patches
(
bridge );

pName p;
UName U;
log true;
rhoName rhoInf;
rhoInf 1.25;
CofR ( 2.3 0.7569 0 );
liftDir ( 0 1 0 );
dragDir ( 1 0 0 );
pitchAxis ( 0 0 1 );
magUInf 10;
lRef 0.353;
Aref 0.353;
}
}

If you guys solved this problem, please help me

Rafael_Coelho October 14, 2013 04:10

Check your liftdir and dragdir axis. It depends on your geometry.

wes1204 October 14, 2013 05:50

thanks
 
Quote:

Originally Posted by Rafael_Coelho (Post 456762)
Check your liftdir and dragdir axis. It depends on your geometry.

Rafael Coelho
thank you for reply

in my case, inlet is left side, outlet is right side and top and bottom is wall,
of course, front and back is empty for 2d.

the object is a deck of bridge so I think directions of drag and lift is right.

I don't know what the problem is.....

anyway thank you for your reply

reza1111 October 14, 2013 14:51

Hi Baek

with using checkMesh check the depth of your geometry.
using with fluent in 2d cases the depth be considered a unite. while in OF cases it depends on the depth of your 3d geometry . so the length of the cell in z direction will affect the reference values.

good luck!

wes1204 October 17, 2013 08:03

Thanks
 
Quote:

Originally Posted by reza1111 (Post 456913)
Hi Baek

with using checkMesh check the depth of your geometry.
using with fluent in 2d cases the depth be considered a unite. while in OF cases it depends on the depth of your 3d geometry . so the length of the cell in z direction will affect the reference values.

good luck!

Hi reza

Thank you for your advise.

I think that this problem is almost sloved.

my case is 2D on x-y plane and z direction has 0.01 length. (5x1.5x0.01)

first, I divided force by z length(0.01).
after that, I calculated Cd,Cl directly using F/(1/2)*rho*U^2*L
finally I got
Cd : 0.29
Cl : 0.1853

observation data in experiment is
Cd: 0.21
Cl: 0.028

Cd is almost similar to observation data but Cl is quite differnt.
I guess that the reason why Cl is quite diffent is due to geometry.

My geometry was simplified quite much.

Thank you for your advise
and I appreciate for Rafael_Coelho's advise

giammy92 March 18, 2016 08:01

Quote:

Originally Posted by tcarrigan (Post 371121)
You have the x-component of the lift direction backwards, should be -sin(alpha). And the y-component of drag should be sin(alpha).

For the airfoil2D example I get the following results:
Cd = 0.0288648
Cl = 1.86931


Sorry but for airfoil2D example I have U (25.75 3.62 0) and therfore an angle of attack of 8°. So, i have liftdir (-sin8 cos8 0) but because the direction of drag is the opposite of flux i think that dragdir (-cos8 -sin8 0). What do you think about?

giammy92 March 18, 2016 08:04

Quote:

Originally Posted by tcarrigan (Post 371189)
lRef is a reference length and Aref is a reference area. These values are used to compute the coefficients of lift, drag, and pitching moment. Because this is a 2D case and the airfoil has a unit length, therefore, lRef=1 and Aref=1. If this were a 3D calculation, lRef would be something like the mean chord length and Aref could be wing area.

To get Cl there is no need to extract Cp and sum them up for a total lift coefficient. By setting up the appropriate reference values in the forceCoeffs (like below), OpenFOAM will compute Cl for you.

I believe the AOA for the airfoil2D exampel is 8deg. Here are the reference values I used:

forces
{
type forceCoeffs;
functionObjectLibs ( "libforces.so" );
outputControl timeStep;
outputInterval 1;

patches ( wall );
pName p;
UName U;
rhoName rhoInf;
log true;
rhoInf 1.225;
liftDir (-0.139173 0.990268 0);
dragDir (0.990268 0.139173 0);
pitchAxis (0 0 1);
magUInf 26;
lRef 1;
Aref 1;
}

Sorry but for airfoil2D example I have U (25.75 3.62 0) and therfore an angle of attack of 8°. So, i have liftdir (-sin8 cos8 0) but because the direction of drag is the opposite of flux i think that dragdir (-cos8 -sin8 0). What do you think about?

mhd_mrt March 11, 2017 21:56

Quote:

Originally Posted by giammy92 (Post 590429)
Sorry but for airfoil2D example I have U (25.75 3.62 0) and therfore an angle of attack of 8°. So, i have liftdir (-sin8 cos8 0) but because the direction of drag is the opposite of flux i think that dragdir (-cos8 -sin8 0). What do you think about?

Hi giammy92,

That is not true. If you refer to the famous textbook of Fundamentals of Aerodynamics by Anderson, in chapter 1 you will see that
LiftDir: [-sin(a) cos(a) 0]
DragDir: [cos(a) sin(a) 0]

Also, I agree with Reza, in OpenFOAM it does matter the depth in z-direction(unlike in Fluent), as the forces are essentially divided by lRef. For the Airfoil2D case I get the following results for cm, cd, cl respectively:
iter:350
Cm:-1.528235e+01
CD:2.858215e-02
CL:1.871433e+00


All times are GMT -4. The time now is 09:55.