# Solving 2D airfoil case using simpleFoam

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

 March 26, 2011, 18:54 Solving 2D airfoil case using simpleFoam #1 New Member   Brad Maeg Join Date: Mar 2011 Posts: 11 Rep Power: 10 Hello everyone, After struggling for some time to create meshing for a 2D airfoil, I finally figured out how to mesh and import to OpenFoam. Now, I am trying to solve the case by using the simpleFoam solution. I have been looking at the posts in the forum, however, I was not able to find any information about how to set p and U in the 0 folder. So I would like to ask you what you guys are using for p and U to solve a simple 2D case. I have a feeling that I could possibly just copy the p and U from airFoil2D tutorial but I want to make sure if that is possible. Also, I have a question about calculating force and force coefficients. I found these posts, http://www.cfd-online.com/Forums/ope...residuals.html and http://www.cfd-online.com/Forums/ope...residuals.html for calculating residuals and forces. However, shown in the latter post, I could not quite understand the term "patches" in the function that has to be added to the controlDict. I am sure it is a very minor term I am not familiar with. Please enlighten me. Thank you in advance for any help! Sincerely, Brad Maeng tareqkh and iafpython like this.

March 28, 2011, 16:26
#2
Member

Usit McCarra
Join Date: Oct 2010
Posts: 51
Blog Entries: 2
Rep Power: 11

Quote:
 I have a feeling that I could possibly just copy the p and U from airFoil2D tutorial but I want to make sure if that is possible.
Yes it is. As long as you have the same patches declared. If you have different patches you have to include them.

Quote:
 I could not quite understand the term "patches"
Look at the airFoil2D tutorial (simpleFoam). Go to constant/polyMesh and open boundary. Here you have the different boundaries of the geometry, 2 declared as patch, 1 as wall and 1 as empty. They all are types of patch (patch is a generic type of patch). The idea is that you usually group surfaces of your geometry to apply on them certain conditions (no need to be a group though, just one surfaces can be declared as a patch). Moreover, the several surfaces declared as a same patch don't need to be physically connected.

For example, the boundary file says that it has a surface declared as a patch named inlet, which is composed of 134 faces.

Hope it helps!
Good luck

March 29, 2011, 16:43
#3
New Member

Join Date: Mar 2011
Posts: 11
Rep Power: 10

Your response helped me a lot to understand the very basics. However, I have another question. So, does it matter how many patches you have around the airfoil? As you can see in the attachment, there are many patches. I did not generate these patches, I found a MATLAB script that generates .geo format used for gmsh program. Then, this was used to generate mesh in gmsh. Then, this is converted to OpenFoam compatible format in OpenFoam.

I will be using this to find force and forcecoefficients (lift and drag), and i want to make sure if having many patches would cause some problems.

Attached Images
 0.jpg (95.0 KB, 329 views) 1.png (28.6 KB, 217 views) 3.jpg (96.0 KB, 229 views)

 March 29, 2011, 17:25 #4 Member   Usit McCarra Join Date: Oct 2010 Posts: 51 Blog Entries: 2 Rep Power: 11 I would say that the number of patches does not matter as long as they are part of a boundary or the complete boundary. However, I must say that the images attached are a bit strange to me. Since the simulation is 2D, the front and back boundaries are normally one patch of type empty and you have multiple patches on the front. You should have a boundary file in constant/polyMesh. What does it say?

 March 31, 2011, 23:03 #5 New Member   Brad Maeg Join Date: Mar 2011 Posts: 11 Rep Power: 10 Thank you for your response and sorry for kind of late reply. It has been a hectic week. Finally, some time for OpenFoam. I went to the folder and looked at the boundary file, here is what is says, There are 6 total patches. There are total 10 sections, at least the ones I could tell, in the gmsh picture I posted earlier. And I can't tell which ones correspond to what.... symmetry { type patch; nFaces 160000; startFace 159350; } airfoil { type patch; nFaces 200; startFace 319350; } walls { type patch; nFaces 600; startFace 319550; } inlet { type patch; nFaces 200; startFace 320150; } outlet { type patch; nFaces 300; startFace 320350; } defaultFaces { type patch; nFaces 0; startFace 320650; } Thanks in advance for any help!

 April 1, 2011, 06:14 #6 Member   Usit McCarra Join Date: Oct 2010 Posts: 51 Blog Entries: 2 Rep Power: 11 I would say that each color doesn't represent a patch in the figures above. I find a bit strange the fact that inlet and outlet have different amounts of faces. Anyway, try to run the case and see what happens. sometimes the error messages are a good source of information to know what's wrong. PD: In case you want to check the mesh graphically, I think the best way to check these patches is by looking them in paraView. Run paraFoam (from terminal) in the folder of the case. Then, on the left there is a section called mesh parts with all the patches listed. Select which one do you want to see and click Apply. This will allow you to check if the complete geometry is has its corresponding patch. See you!

 April 1, 2011, 18:24 #7 New Member   Brad Maeg Join Date: Mar 2011 Posts: 11 Rep Power: 10 Hi again, You know what I just found out? I was comparing my mesh to the one in tutorial, aifFoil2D, and found out that my mesh is 3D while the other one is 2D. In other words, airFoil2D mesh is only drawn in x and y directions and my mesh goes x,y and z. The thickness is small, but it is still there. I thought that what I had was a 2D mesh, but apparently not.. I tried to mesh it in 2D and import it to Foam, but was not successful with some errors. Strangely, when I import 3D mesh, there is no error. I am starting to think that this is causing the problem. So, I am trying to find a way to generate 2D c-mesh, a proper one now..

 April 1, 2011, 19:03 #8 Member   Usit McCarra Join Date: Oct 2010 Posts: 51 Blog Entries: 2 Rep Power: 11 Every mesh in OpenFOAM is 3D. All x, y and z directions are included. To indicate that the mesh is 2D the front and back patches are declared empty, but when you visualize the mesh it is actually a 3D geometry. So the mesh in the tutorial is 3D but is treated as a 2D problem. Look at the constant/polyMesh/boundary in the airfoil2D tutorial and you'll see that a patch frontAndBack is of type empty. That is what I refer to. It is very common and can be found in many other tutorials too. Mc

 April 6, 2011, 21:52 #9 New Member   Brad Maeg Join Date: Mar 2011 Posts: 11 Rep Power: 10 Finally, I am able to run simpleFoam, at lease for NACA0012 AOA = 0. I am getting quite reasonable values for cl and cd. But I am still a bit skeptical of the results, mainly due to this reason: When I import a 5 degree angle of attack geometry/mesh with the same boundary conditions as AOA = 0, the solution does not converge any more. The boundary conditions are follows. airfoil --> U = 0, p = zerogradient inlet --> U = 203,0,0, p = zerogradient outlet --> U = zerogradient, p = 0 Top and bottom --> U = 203,0,0, p = freestream. I have played with the different types of U and p for inlet outlet, however, it seems like the changes do nothing to prevent the divergence. Also want to mention that I am using RAS turbulence model, which was supplied with the sample SimpleFoam Airfoil2D example. Any suggestion to why the solution does not converge? Thanks in advance.

 April 7, 2011, 04:44 #10 Member   Usit McCarra Join Date: Oct 2010 Posts: 51 Blog Entries: 2 Rep Power: 11 I would try to reduce the time step or decrease nu in constant/transportProperties (which has the effect of an increased Reynolds number) Mc

 April 20, 2011, 10:27 #11 Member   The True Join Date: Dec 2010 Posts: 80 Rep Power: 11 hi, I want also simulate the flow around an airfoil, turbulent flow. Which solver should I choose, simpleFoam or pisoFoam ? The boundary conditions will remain the same after a while,. I was concerned with the term "steady state" and turbulent flow in the description of the simpleFoam, can these terms be present on the same time. Which solver will yield better results for cl,cd.. Thanks.

 April 20, 2011, 23:51 #12 New Member   Brad Maeg Join Date: Mar 2011 Posts: 11 Rep Power: 10 As far as I know, SimpleFoam is a steady state solver, where as PisoFoam is for transient solver. I have never used PisoFoam for airfoil Cd and Cl calculations. So far, using SimpleFoam, I get more or less realistic Cl and Cd. My suggestion is to use SimpleFoam to look at the steady state solution. Good luck

 April 25, 2011, 13:38 2D running conditions #13 New Member   anonymous Join Date: Apr 2011 Posts: 1 Rep Power: 0 Hi: Can you provide the following information about your 2D airfoil run using Openfoam? 1. what is the Mach and Re number? 2. do you run Openfoam modelling flow as incompressible or compressible? 3. what is the turbulence model used? 4. do you think transition model is available if you do not use it in your run? 5. Do you use multi-grid and how it performs? 6. Do you use parallel computing and how it performs? 7. How is cl vs aoa curve compared with WT data and how is Clmax? 8. How is drag polar comparing to WT test data If possible, can you email me at yusun@vestas.com so we can have a small talk. Thank you.

 November 2, 2011, 07:49 question big one #14 New Member   André Gama Join Date: Oct 2011 Posts: 3 Rep Power: 10 hello i´m trying work with tutorial AirFoil2D simplefoam my question is how can i modify the position of the air foil, can anyone give something where can i find text to support me? and how can i make a 2D of something to use in openfoam? thanks for any help

 November 3, 2011, 09:12 #15 Senior Member   David Boger Join Date: Mar 2009 Location: Penn State Applied Research Laboratory Posts: 146 Rep Power: 12 In what way do you want to modify the airfoil's position? To translate, rotate, or scale the airfoil, you can use the transformPoints utility. Running "transformPoints -help" gives some decent documentation on usage. __________________ David A. Boger

 November 11, 2011, 19:15 bad drag coefficient #16 New Member   Join Date: Oct 2011 Posts: 4 Rep Power: 10 hello I'm trying to calculate the polar for some 2d airfoil and I create a test case with a NACA 0012 airfoil I used the simpleFoam system and my case folder is like the 2d airfoil tutorial I run the solution for a angle of attack of 3° and for 6° to verify that all the numerical setup give a correct resolution for p and U and for the lift, drag and moment coefficient after some test i used a very fine mesh and I found p and U correct, and Cl, Cd and Cm correct for 3° (Cl=0.324; Cd=0.0071; Cm=0.0015) but for 6° (Cl=0.66; Cm=0029 I found some problem with the drag coefficient that very far from the correct one Cd=0.06 anyone have the same problem? I want to know which is the best turbolence model for this test (I chose Spalart-Allmaras) and how select the correct wall function, because I suppose that the error depends from that. Also I want to know how I can can create a structurated mesh with gmesh near my airfoil? thanks for every good information (sorry for my bad english)

 November 18, 2011, 08:12 #17 New Member   Join Date: Oct 2011 Posts: 4 Rep Power: 10 I think the problem may be due to the fact that I consider the fully turbulent flow! someone can tell me how to solve this type of analysis by considering the flow as laminar inlet and then become turbulent once the trasitione due to the profile? I also read in somewhere tread that before using simplefoam would be useful to use the potentialfoam, you could tell me what it is like and if I should proceed? thanks for any information Andrea

 November 28, 2011, 11:18 Create Airfoil2d mesh - URGENT #18 New Member   André Gama Join Date: Oct 2011 Posts: 3 Rep Power: 10 I´m trying to study a 2D airfoil NACA0012 (a classic) in OpenFoam, but i´m having problems with the mesh, i did the tutorial in simplefoam but the mesh is already done, and do no have a blockMeshDit, how can i create a mesh like the one in SimpleFoam tutorial? How was created the airfoilmesh in simplefoam tutorial??? please help

 Tags 2d airfoil, force, forcecoefficient, simplefoam