CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Solving 2D airfoil case using simpleFoam (http://www.cfd-online.com/Forums/openfoam-solving/86574-solving-2d-airfoil-case-using-simplefoam.html)

 boongsin12 March 26, 2011 18:54

Solving 2D airfoil case using simpleFoam

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,

 McCarra March 28, 2011 15:26

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

 boongsin12 March 29, 2011 15:43

3 Attachment(s)

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.

 McCarra March 29, 2011 16:25

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?

 boongsin12 March 31, 2011 22:03

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!

 McCarra April 1, 2011 05:14

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!

 boongsin12 April 1, 2011 17:24

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..

 McCarra April 1, 2011 18:03

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

 boongsin12 April 6, 2011 20:52

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?

 McCarra April 7, 2011 03:44

I would try to reduce the time step or decrease nu in constant/transportProperties (which has the effect of an increased Reynolds number)

Mc

 Eren10 April 20, 2011 09:27

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.

 boongsin12 April 20, 2011 22:51

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

 yusunVH April 25, 2011 12:38

2D running conditions

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.

 AndreGama November 2, 2011 07:49

question big one

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

 boger November 3, 2011 09: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.

 thinkagain November 11, 2011 19:15

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

 thinkagain November 18, 2011 08:12

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

 AndreGama November 28, 2011 11:18

Create Airfoil2d mesh - URGENT

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???