CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

Coefficient of Pressure (Cp) for NACA 0012

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 31, 2019, 02:24
Post Coefficient of Pressure (Cp) for NACA 0012
  #1
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
Hi OpenFOAM Users,

I was trying to validate my NACA 0012 simulation case using OpenFOAM (Version 5.0x). I created Mesh on Pointwise and successfully run this simulation and compared results of (Coefficient of Lift and Drag ) with experimental results that I got from NAS Technical Report: NAS-2016-01.

The Inputs parameters were as follow:

(1): Free Stream Velocity = 45 m/s
(2): Mach Number = 0.13
(3): Free Stream Pressure ( (101325 pa) and Temperature (300 k )
(4): Density of air = 1.225
(5): Kinematic Viscosity = 1.4607*10^-5
(6): Reynolds Number = 3.0807 *10^6
(7): Turbulence model used: Spalart-Allmaras
(8): Solver : simpleFoam

I was trying to calculate the Coefficient of Pressure (Cp) by adding a function in the controlDict file. The solver runs perfectly without any error. But when I plot the results for Cp, I am getting this type of graph (Attached here.). The Cp values do not look correct. I tried it in many ways but the Cp results are same.

Can anybody give me their valuable suggestion where I am doing a mistake?

(2): Second thing I would like to find that when I use a function that I placed in the controlDict file to find Cl and Cd and the solver runs and putting all the values of Lift and Drag coefficients in the postProcess Folder. But in this case when I am adding lines in the controlDict file to calculate Cp. It is only putting a new text file in each time directory having name static(p)_coeff, meaning that it's not creating any postProcess folder as I have before for calculating the Cl and Cd.


I am attaching here the controlDict, Boundary conditions, and Residual graph.

I will be very thankful to you.



Cp.jpg

Residuals.png

p and u Boundary Conditions.tar.gz

controlDict.tar.gz
badwalgurpreet is offline   Reply With Quote

Old   February 1, 2019, 00:05
Default
  #2
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
Can anybody give their valuable suggestion on this topic. I will really appreciate you as I am still learning OpenFOAM.
badwalgurpreet is offline   Reply With Quote

Old   February 1, 2019, 08:14
Default
  #3
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 556
Rep Power: 22
tomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

For next time, please put the contents of P U and controlDict between CODE tags, than people do not have to download and unzip files. Takes much less time.

I copied your functions part here:

Code:
 functions
   {
       pressure1
       {
       	 type 	pressure;
       	 functionObjectLibs ("libfieldFunctionObjects.so");
       	 //source		wall;
       	 //sourceName	airfoil;
       	 patch      ("airfoil")
       	 log		yes; 
       	 
       	 outputControl	outputTime;
       	 outputInterval	1; 
       	 
       	 enabled	yes; 
       	 calcTotal	no;
       	 calcCoeff	yes;
       	 pRef		0;
       	 rhoInf		1.125;
       	 pInf		101325;
       	 UInf		(52 0 0);		
       }
   }


// ************************************************************************* //
In your p file you correctly used 0 kinematic pressure. You also need that for the pressure functionObject. For details look at the c++ guide online, which states that you need a Freestream density, pressure and velocity for coefficient computation. I would think that this should be the magnitude of the velocity and the pressure at the outlet as used in the simulation.

I think this may work to get reasonable results:
Code:
 functions
   {
       pressure1
       {
       	 type 	pressure;
       	 functionObjectLibs ("libfieldFunctionObjects.so");
       	 log		yes; 
       	 
       	 outputControl	outputTime;
       	 outputInterval	1; 
       	 
       	 enabled	yes; 
       	 calcTotal	no;
       	 calcCoeff	yes;
       	 pRef		0;
       	 rhoInf		1.125;
       	 pInf		0;
       	 UInf		52;		
       }
   }


// ************************************************************************* //
The reason you have no result in postProcessing is that this functionObject writes out a field in every time folder (as you found out).
tomf is offline   Reply With Quote

Old   February 3, 2019, 01:33
Default
  #4
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
Thanks a lot, Tom for your quick reply. I will keep your suggestions in mind when I will ask any question so that it will take less time to read and respond.

I inserted this function and it works. I still have few doubts about using this function that you corrected in the last message.

(1) : As you told me that the function will not create any postProcess Folder as it will create the new file name "static(p)_coeff" in each time directory. This "static(p)_coeff" file has Cp for all the boundaries that I defined in the p and U files. I need Cp values only for the Airfoil patch, though this file has the Cp values for the airfoil. Is there any way I can define the patch over which I want to find out the Cp values lets say Airfoil.

(2) : Why did we define (pInf = 0 ) insted of (pInf = 101325) ?

(3): How can I plot the data from the last time directory for the Cp values for the AirfoilUpper and AirfoilLower patch?

(4) : Is it possible to add more than one functionObject in the controlDict file as I was trying to calculate the Cp and (Cl, Cd). But I was only getting the values of the Cp not for Cl and Cd.

I am attching my P, U and controlDict files here.
badwalgurpreet is offline   Reply With Quote

Old   February 3, 2019, 01:36
Default
  #5
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
functions
{
pressure1
{
type pressure;
functionObjectLibs ("libfieldFunctionObjects.so");
log yes;

writeControl timeStep;
writeInterval 50;
//outputControl outputTime;
//outputInterval 1;

enabled yes;
calcTotal no;
calcCoeff yes;
pRef 0;
rhoInf 1.125;
pInf 0;
UInf (52 0 0);
}

forces
{
type forceCoeffs;
libs ("libforces.so");
writeControl timeStep;
writeInterval 1;

patches ("airfoil");
rho rhoInf;
log true;
rhoInf 1.225;
liftDir (-0.1736 0.9848 0);
dragDir (0.9848 0.1736 0);
CofR (0.25 0 0);
pitchAxis (0 0 1);
magUInf 52;
lRef 1;
Aref 1;

}

}
badwalgurpreet is offline   Reply With Quote

Old   February 3, 2019, 01:37
Default
  #6
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
airfoilLower
{
type zeroGradient;
}
airfoilUpper
{
type zeroGradient;
}
farfield
{
type freestreamPressure;
value uniform 0;
}
frontAndback
{
type empty;
}
}


// ************************************************** *********************** //
badwalgurpreet is offline   Reply With Quote

Old   February 3, 2019, 01:39
Default
  #7
Member
 
Gurpreet Singh
Join Date: Jan 2017
Posts: 36
Rep Power: 5
badwalgurpreet is on a distinguished road
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volVectorField;
location "0";
object U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

dimensions [0 1 -1 0 0 0 0];

internalField uniform (51.21 9.0297 0);

boundaryField
{
airfoilLower
{
type noSlip;
}
airfoilUpper
{
type noSlip;
}
farfield
{
type freestream;
freestreamValue uniform (51.21 9.0297 0);
value uniform (51.21 9.0297 0);
}
frontAndback
{
type empty;
}
}


// ************************************************** *********************** //
badwalgurpreet is offline   Reply With Quote

Old   February 4, 2019, 11:07
Default
  #8
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 556
Rep Power: 22
tomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hi,

Next time please also use CODE TAGS (the # symbol in the toolbar when editing) and put everything in one message so we do not need to scroll through everything.

Please re-read my original answer as some of the questions you give are already answered there.

Quote:
(1) : As you told me that the function will not create any postProcess Folder as it will create the new file name "static(p)_coeff" in each time directory. This "static(p)_coeff" file has Cp for all the boundaries that I defined in the p and U files. I need Cp values only for the Airfoil patch, though this file has the Cp values for the airfoil. Is there any way I can define the patch over which I want to find out the Cp values lets say Airfoil.
Not without programming your own functionObject.

Quote:
(2) : Why did we define (pInf = 0 ) insted of (pInf = 101325) ?
Because this is what you put in the boundary conditions (see my original reply)

Quote:
(3): How can I plot the data from the last time directory for the Cp values for the AirfoilUpper and AirfoilLower patch?
Use Extract Block and plot On Intersection Curve filters in ParaView.

Quote:
(4) : Is it possible to add more than one functionObject in the controlDict file as I was trying to calculate the Cp and (Cl, Cd). But I was only getting the values of the Cp not for Cl and Cd.
Yes:
Code:
Functions
{
    object1
    {
        type X;
    }    
    object2
    {
        type Y;
    }
}
As before, see: c++ documentation
tomf is offline   Reply With Quote

Reply

Tags
coefficient of pressure, naca0012, openfoam, pressure, simplefoam

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Domain Reference Pressure and mass flow inlet boundary AdidaKK CFX 75 August 20, 2018 05:37
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 30 December 12, 2017 05:35
Pressure coefficient Giuseppe FLUENT 2 July 26, 2015 03:19
error message cuteapathy CFX 14 March 20, 2012 06:45
lid-driven cavity in matlab using BiCGStab Don456 Main CFD Forum 1 January 19, 2012 15:00


All times are GMT -4. The time now is 15:51.