|
[Sponsors] |
How to calculate the pressure coefficient around an airfoil!? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 9, 2014, 09:15 |
How to calculate the pressure coefficient around an airfoil!?
|
#1 |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
I am trying to calculate the pressure coefficient of an airfoil. I googled it and found some information:
http://www.cfd-online.com/Forums/ope...s-2-2-0-a.html Function objects are defined by additional entries in the $FOAM_CASE/system/controlDict input dictionary. Code:
functions { myFunctionObject // user-defined name of function object entry { type functionObjectType; functionObjectLibs ("libMyFunctionObjectlib.so"); region defaultRegion; enabled yes; timeStart 0; timeEnd 10; outputControl outputTime; outputInterval 1; ... } } Code:
pressureTools1 { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); ... calcTotal no; calcCoeff yes; } Code:
functions { pressureTools1 { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); region defaultRegion; enabled yes; calcTotal no; calcCoeff yes; timeStart 10; timeEnd 10; outputControl outputTime; outputInterval 1; } } Last edited by sisi; December 10, 2014 at 05:16. |
|
December 10, 2014, 12:55 |
|
#2 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
I did some googeling again and found this thread. User aerothermal wrote (#3):
Quote:
|
||
December 10, 2014, 14:19 |
|
#3 |
Senior Member
|
Hi,
"Isn't working. What's wrong!?" is very uninformative. You either want people to create a case and try to check your settings to see the error you're getting (and in this case it's possible to see the answer "It's working.") or you'd like to find a) people reading the forum, b) had exactly the same problem. It seems people found a solution in the thread you're referencing in your first message. Obviously you've tried syntax from message #20, what was the error? |
|
December 10, 2014, 16:40 |
|
#4 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
You're right alexeym, I'm sorry
Quote:
Code:
Create time Create mesh for time = 0 Reading field p Reading field U Reading/calculating face flux field phi Selecting incompressible transport model Newtonian Selecting RAS turbulence model SpalartAllmaras SpalartAllmarasCoeffs { sigmaNut 0.66666; kappa 0.41; Cb1 0.1355; Cb2 0.622; Cw2 0.3; Cw3 2; Cv1 7.1; Cv2 5; } Employing Ashford correction No finite volume options present SIMPLE: convergence criteria field p tolerance 1e-05 field U tolerance 1e-05 field nuTilda tolerance 1e-05 Starting time loop --> FOAM FATAL ERROR: request for objectRegistry defaultRegion from objectRegistry Angle-of-attack-3 failed available objects of type objectRegistry are 1(region0) From function objectRegistry::lookupObject<Type>(const word&) const in file ~/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198. FOAM aborting #0 Foam::error::printStack(Foam::Ostream&) at ??:? #1 Foam::error::abort() at ??:? #2 Foam::objectRegistry const& Foam::objectRegistry::lookupObject<Foam::objectRegistry>(Foam::word const&) const at ??:? #3 Foam::OutputFilterFunctionObject<Foam::pressureTools>::allocateFilter() at ??:? #4 Foam::OutputFilterFunctionObject<Foam::pressureTools>::start() at ??:? #5 Foam::functionObjectList::read() at ??:? #6 Foam::Time::run() const at ??:? #7 Foam::Time::loop() at ??:? #8 Foam::simpleControl::loop() at ??:? #9 at ??:? #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #11 at ??:? Abgebrochen (Speicherabzug geschrieben) Also, I would like to know how to solve this problem with paraview. Is it really that easy? |
||
December 10, 2014, 17:03 |
|
#5 |
Senior Member
|
Hi,
about this error: Code:
--> FOAM FATAL ERROR: request for objectRegistry defaultRegion from objectRegistry Angle-of-attack-3 failed available objects of type objectRegistry are 1(region0) The quote from message 3 you've mentioned in your post is actually an answer to "Also I want to plot Pressure coefficient at various positions along the length of the wing. how to do it paraview.". I.e. pressure coefficient was already calculated and person wanted to plot the values. Also because the post is from 2009, I'm not quite sure the names of the filters in paraview are the same in 2014. In the thread you've mentioned, there is post #5, where you've got the expression for calculation of Cp. In paraview you've got Calculator filter, you can apply the filter to the whole calculation domain and then extract values from desired region. As it's simpleFoam, final solution is steady state, so you can do this paraview operation by hand and skip inventing batch process (well, you can export state from paraview as a python script and run it with slight modifications of other results; this will partly emulate batch processing with sample utility). |
|
December 11, 2014, 11:10 |
|
#6 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Thank you for your detailed response!
Quote:
Code:
functions { pressureTools1 { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); region region0; enabled yes; calcTotal no; calcCoeff yes; timeStart 10; timeEnd 10; outputControl outputTime; outputInterval 1; rhoInf 1.225; // Air at sea level and 15 Celsius pInf 101325; // Average sea-level pressure UInf (26 0 0); } How to visualize static(p)_coeff with paraview? |
||
December 11, 2014, 12:05 |
|
#7 |
Senior Member
|
Hi,
It's seems links from your first post were spoiled by update in docs, so here's a link to new location: http://foam.sourceforge.net/docs/cpp/a01968.html. Maybe it was vaguely written but for coefficient calculation you have to set pInf, rhoInf and UInf. Here's a snippet from pressureTools.H Code:
\heading Function object usage \table Property | Description | Required | Default value type | type name: pressureTools| yes | calcTotal | Calculate total coefficient | yes | pRef | Reference pressure for total pressure | no | 0.0 calcCoeff | Calculate pressure coefficient | yes | pInf | Freestream pressure for coefficient calculation | no | UInf | Freestream velocity for coefficient calculation | no | rhoInf | Freestream density for coefficient calculation | no | \endtable This method is called every time function object is invoked. Code:
void Foam::pressureTools::execute() { if (active_) { ... pResult == convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef()); } } rhoScale look like: Code:
Foam::dimensionedScalar Foam::pressureTools::rhoScale ( const volScalarField& p ) const { if (p.dimensions() == dimPressure) { return dimensionedScalar("1", dimless, 1.0); } else { return dimensionedScalar("rhoRef", dimDensity, rhoInf_); } } pDyn() and pRef() are zero in your case, because you do not calculate total coefficient (I will omit code). returning to convertToCoeff: Code:
Foam::tmp<Foam::volScalarField> Foam::pressureTools::convertToCoeff ( const volScalarField& p ) const { tmp<volScalarField> tCoeff(p); if (calcCoeff_) { tCoeff() -= dimensionedScalar("pInf", dimPressure, pInf_); const dimensionedScalar p0("p0", dimPressure, SMALL); const dimensionedVector U("U", dimVelocity, UInf_); const dimensionedScalar rho("rho", dimDensity, rhoInf_); tCoeff() /= 0.5*rho*magSqr(U) + p0; } return tCoeff; } So basically tCoeff (in your case) is just p/|UInf|^2 if I have not messed up something during code walk-though About paraview visualization: 1. You can just use Calculator filter. 2. Pressure tools function object will write static(p)_coeff volume field for every invocation. So you just select it like you select pressure or velocity. |
|
December 11, 2014, 14:03 |
|
#9 |
Senior Member
|
Guess it's a "feature" of online documentation, in general there are problems with links to source files. You can always find sources in $FOAM_SRC folder. Exact location of pressure tools is $FOAM_SRC/postProcessing/functionObjects/utilities/pressureTools.
|
|
December 11, 2014, 15:34 |
|
#10 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Quote:
Step 1: $paraFOAM Step 2: Selecting "Last Frame (500)" (Time: 500) Step 3: Volume Fields >> static(p)_coeff Step 4: Apply But how to proceed? When choosing "Filter >> Calculator" I can't select anything....!? Content of "ControlDict" file is: Code:
functions { pressureTools1 { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); region region0; enabled yes; calcTotal no; calcCoeff yes; timeStart 500; timeEnd 500; outputControl outputTime; outputInterval 1; rhoInf 1.225; // Air at sea level and 15 Celsius pInf 101325; UInf (26 0 0); } } |
||
December 11, 2014, 17:15 |
|
#11 |
Senior Member
|
At this point it would be great to explain what you're trying to create in paraview, as I usually stop at point 4, obtaining color distribution. Also you either use Calculator filter on pressure volume field (to calculate pressure coefficient), or you just display static(p)_coeff (as the coefficient was already calculated using functionObject).
If you'd like to create print-quality figures from the data on airfoil, you select airfoil patch instead of internal mesh (IIRC paraview should create interpolation of pressure coefficient from internal field onto boundaries), cut it with a plain (Slice), save it as CSV file (File -> Save data) and use Matplotlib/Gnuplot/Scilab/Matlab/SomethingElse to produce PDF. |
|
December 11, 2014, 18:49 |
|
#12 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Quote:
First I would like to plot static(p)_coeff. But how to manage it!? |
||
December 12, 2014, 12:04 |
|
#13 |
Senior Member
|
It would be rather inconvenient to plot data in paraview if you'd like to get picture similar to the one you've posted. So you should just extract values of pressure coefficient around airfoil (or just pressure) using either paraview (using Slice filter and saving data in CSV format) or using sample utility. In both cases you'll get file with 2-3 columns: (x, y, z, value) which you can plot elsewhere.
|
|
December 13, 2014, 08:19 |
|
#14 |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Ok, but I am getting strange results when plotting data using LO Calc. Just want to make sure I'm doing things right:
0. $ paraFoam 1. Last Frame 2. Mesh Parts >> airfoil - patch (only selected!) 3. Volume Fields >> p (only selected!) 4. Apply 5. Slice >> Z Normal 6. Apply 7. File >> Save Data... 8. save as *.csv 9. OK Please find cvs FIle attached. Why do the results look so strange (data range of p)!? What am I doing wrong? P.s.: I finally found a way to visualize cp (Pressure coefficient) with paraview (find attached cp1.png). I will post my solution tonight... I still have some questions left Last edited by sisi; December 13, 2014 at 09:34. |
|
December 13, 2014, 11:40 |
|
#15 |
Senior Member
|
Hi,
As I don't see the results of your simulation, I can't say anything about pressure coefficient distribution. Can you post slice of pressure field? What BC for pressure do you have on airfoil patch? |
|
December 13, 2014, 14:58 |
|
#16 |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
@ alexeym: I followed this step by step guide. Please find attached BC and a slice (z-axis) of p. And this is how I managed to visualized pressure coefficient C_p with paraview 4.1.0:
Code:
functions { pressureTools1 { type pressureTools; functionObjectLibs ("libutilityFunctionObjects.so"); region region0; enabled yes; calcTotal no; calcCoeff yes; timeStart 500; timeEnd 500; outputControl outputTime; outputInterval 1; rhoInf 1.225; // Air at sea level and 15 Celsius pInf 101325; // mean atmospheric pressure at mean sea level UInf (26 0 0); } } Last edited by sisi; December 14, 2014 at 15:40. |
|
December 14, 2014, 14:14 |
|
#17 |
Senior Member
|
Hi,
1. In 3D view you just rotate it with mouse Or use Adjust camera button. In plot view, you press on the button "Edit view options", Left Axis -> Layout -> Specify axis range explicitly, and specify the range upside down. 2. Are you sure the case converged in 500 iterations? What are the values of residuals for pressure and velocity? In general it is better to set convergence criterium in SIMPLE dictionary in fvSolution file (see tutorials/incompressible/simpleFoam/pitzDaily for example). In general residuals around 10e-5 give good agreement with estimations/experimental values. |
|
December 14, 2014, 18:47 |
|
#18 | ||
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Quote:
Quote:
Code:
Time = 500 smoothSolver: Solving for Ux, Initial residual = 0.000469786, Final residual = 3.02492e-05, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 0.000194439, Final residual = 1.46375e-05, No Iterations 4 GAMG: Solving for p, Initial residual = 0.00255599, Final residual = 0.000166693, No Iterations 2 time step continuity errors : sum local = 3.45091e-05, global = 2.284e-15, cumulative = 5.18321e-13 smoothSolver: Solving for nuTilda, Initial residual = 2.69677e-05, Final residual = 1.46057e-06, No Iterations 4 ExecutionTime = 36.45 s ClockTime = 37 s Code:
Time = 1000 smoothSolver: Solving for Ux, Initial residual = 0.000125672, Final residual = 5.32396e-06, No Iterations 4 smoothSolver: Solving for Uy, Initial residual = 3.1746e-05, Final residual = 1.9281e-06, No Iterations 4 GAMG: Solving for p, Initial residual = 0.00166265, Final residual = 0.00011368, No Iterations 3 time step continuity errors : sum local = 2.34977e-05, global = 1.28775e-16, cumulative = 1.02962e-12 smoothSolver: Solving for nuTilda, Initial residual = 7.23825e-06, Final residual = 2.52574e-07, No Iterations 4 ExecutionTime = 70.52 s ClockTime = 71 s |
|||
December 15, 2014, 03:44 |
|
#19 |
Senior Member
|
Hi,
as you can see residual values decreased 4 times with additional 500 iterations. So increase them even further. You can increase number of iterations (endTime) up to 25000. Solver will either converge (and stop iterating with message about convergence) or run till the endTime (in this case you've got problems with mesh, BCs, discretization). I wasn't able to find any information about your boundary conditions. Maybe it is a problem wit interpolation of pressure coefficient onto airfoil patch. According to your pressure distribution values of pressure coefficient should be between -2 and 1 (with your Uinf = 26 m/s). Try calculate pressure coefficient in paraview using pressure distribution, rhoInf, UInf and compare it with the output of pressureTools. |
|
December 16, 2014, 16:43 |
|
#20 | |
Member
Join Date: Mar 2014
Location: Austrian abroad in Germany
Posts: 48
Rep Power: 12 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Negative Pressure Drag Coefficient of main airfoil in Multi-Element rear wing | Masoud.A1 | FLUENT | 4 | April 9, 2015 00:17 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
Constant velocity of the material | Sas | CFX | 15 | July 13, 2010 09:56 |
Does star cd takes reference pressure? | monica | Siemens | 1 | April 19, 2007 12:26 |
what the result is negatif pressure at inlet | chong chee nan | FLUENT | 0 | December 29, 2001 06:13 |