# Airfoil 3D simulation using OpenFoam

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

 January 5, 2017, 06:43 Airfoil 3D simulation using OpenFoam #1 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 Hello guys.Happy new year!.In my diploma thesis i have to simulate corrotating vortex which is created by two wings of opposite aoa.I create my geometry on Inventor Autocad and my mesh on Salome.I would like to ask 1)if my geometry and boundary patches are correct.I have inlet outlet wings and walls(bottom,up,front,back) boundary patches.It would more correct if i had separated the front and back with the bottom and up?.2)Also where i can see if my mesh is 3D?. 3)Furthermore, in OPenfoam in boundary folder i put inlet,outlet and walls as patches and wings as walls.Is it correct? 4)The type of boundaries conditions for p and u are zerogradient and fixedvalue.Should it be more correct if i used freestream boundary conditions?. Thank you very much in advance and excuse for so many questions.

 January 12, 2017, 10:06 #2 Member   Ioannis Tsavlidis Join Date: Nov 2016 Location: Greece Posts: 30 Rep Power: 5 Dear teodm Happy new year kali xronia! I ll try to answer to some of your questions. I have no experience with Salome so I ll skip questions regarding this software. A sketch of your domain along with the wings could help a lot but I will try to explain how I would do it. I assume that you are simulating two wings in free air conditions (so not a wind tunnel). In this case the inlet (front) and outlet (back) should be defined as patches (patch). All the other sides (top, bottom, left, right) should be defined as symmetries (symmetry). The wings should be defined as walls (wall). Defining the boundaries like above, would mean that in case you want to change the angle of attack of the wings you have to perform manual changes on the CAD and rotate the wing geometries and then rebuild the mesh. There is an alternative. You can define multiple inlets (front and bottom) and outlets (top and back) so that you can change the velocity vector to match the angle of attack of your preference. As far as I can remember, there are some posts through this forum where this method is explained. For velocity you should use fixedvalue at inlet and zeroGradient at outlet while for pressure you should use zeroGradient at inlet and fixedValue at outlet. I have no experience with freestream bcs so I would suggest sticking to the standards. Hope I helped a bit Kind regards Giannis

 January 12, 2017, 17:55 Airfoil 3D simulation using OpenFoam #3 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 Kali xronia sumpatriwth mou! Thanks a lot for your reply.This is my boundary file. wings { type wall; nFaces 25510; startFace 1051391; } inlet { type patch; nFaces 856; startFace 1076901; } outlet { type patch; nFaces 858; startFace 1077757; } walls { type patch; nFaces 32938; startFace 1078615; } Where as wall i have defined the top bottom front and back.I think that i can't use the symmetry because my two wings are in different angles so they aren't symmetrical(i could send my geometry to your email address if you would like).Furthermore my nut,p,u files are as show below: FoamFile { version 2.0; format ascii; class volScalarField; object p; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField uniform 0; boundaryField { wings { type zeroGradient; } inlet { type freestreamPressure; } outlet { type freestreamPressure; } walls { type freestreamPressure; } } // ************************************************** *********************** // oamFile { version 2.0; format ascii; class volVectorField; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0); boundaryField { wings { type fixedValue; value uniform (0 0 0); } inlet { type freestream; freestreamValue uniform (20 0 0); } outlet { type freestream; freestreamValue uniform (20 0 0); } walls { type freestream; freestreamValue uniform (20 0 0); } } // ************************************************** *********************** // FoamFile { version 2.0; format ascii; class volScalarField; location "0"; object nut; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -1 0 0 0 0]; internalField uniform 0.015; boundaryField { wings { type nutUSpaldingWallFunction; value uniform 0; } inlet { type freestream; freestreamValue uniform 0.015; } outlet { type freestream; freestreamValue uniform 0.015; } walls { type freestream; freestreamValue uniform 0.015; } } // ************************************************** *********************** // I have done the simulation with both pimple and simple solver but i haven't got the solutions i expect yet.Thank you very much and i am looking forward for your reply.

 January 13, 2017, 04:27 #4 Member   Ioannis Tsavlidis Join Date: Nov 2016 Location: Greece Posts: 30 Rep Power: 5 Dear teodm It would be a lot better if you could attach a screenshot of your geometry + domain here in the forum so that someone else could also help you or be helped. Anyway in case you are not willing to share the screenshot publicly, find my e-mail address in your inbox. Kind regards

January 13, 2017, 05:51
Airfoil 3D simulation using OpenFoam
#5
New Member

Thodoris
Join Date: Apr 2016
Location: Greece
Posts: 22
Rep Power: 5
Dear John,
I attached my geometry.
Thank you very much in advance.
Attached Images
 airfoils.png (14.8 KB, 140 views) airfoils2.png (8.3 KB, 113 views)

January 13, 2017, 06:26
#6
Member

Ioannis Tsavlidis
Join Date: Nov 2016
Location: Greece
Posts: 30
Rep Power: 5
When using a symmetry type boundary it means that on both sides of the boundary the same conditions exists. It is not related to whether the model is symmetrical or not.

So in my opinion, you should go ahead and change the walls boundary to type symmetry, as well as all the u, p e.t.c.

I have no experience with the freestream type of boundary condition so I am not sure whether it will work well or not. I would suggest to use the boundaries you initially had and I had also mentioned in post #2

Quote:
 For velocity you should use fixedvalue uniform (20 0 0) at inlet and zeroGradient at outlet while for pressure you should use zeroGradient at inlet and fixedValue 0 at outlet.
What turbulence model are you using? Maybe you should first try to run the case without turbulence i.e. laminar, to check if everything works fine.

Let me know what you ve done, and if it worked out!

Kind regards

 January 13, 2017, 06:52 Airfoil 3D simulation using OpenFoam #7 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 I have been using SpalartAlmarasDDES turbulence model.At first i was going to use fixedValue and zeroGradient but then i used freeStream boundary condition because i saw the airfoil2d tutorial which is using freestream boundary conditions.I will try to do it the way you told me and i will inform you with the results. Thank you very much in advance

 January 13, 2017, 14:13 Airfoil 3D simulation using OpenFoam #8 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 Dear John, While running the case with simpleFoam and pimpleFoam everything is ok,running the case with icoFoam(as you suggested) for some reason the courant number become very big and the below error appears: Courant Number mean: 0.0239956 max: 286.208 #0 Foam::error:rintStack(Foam::Ostream&) at ??:? #1 Foam::sigFpe::sigHandler(int) at ??:? #2 ? in "/lib/x86_64-linux-gnu/libc.so.6" #3 Foam::lduMatrix::residual(Foam::Field&, Foam::Field const&, Foam::Field const&, Foam::FieldField const&, Foam::UPtrList const&, unsigned char) const at ??:? #4 Foam::lduMatrix::residual(Foam::Field const&, Foam::Field const&, Foam::FieldField const&, Foam::UPtrList const&, unsigned char) const at ??:? #5 Foam::smoothSolver::solve(Foam::Field&, Foam::Field const&, unsigned char) const at ??:? #6 ? at ??:? #7 ? at ??:? #8 ? at ??:? #9 ? at ??:? #10 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6" #11 ? at ??:? Floating point exception (core dumped) Do you have any idea why is this happening and if it means that my case isn't built well somewhere? Thank you very much. With respect, Thodoris

 January 14, 2017, 08:57 #9 Member   Ioannis Tsavlidis Join Date: Nov 2016 Location: Greece Posts: 30 Rep Power: 5 Dear Thodori Unfortunately I have no experience with icoFoam. It is not necessary to use icoFoam in order to simulate laminar flow. Try using simpleFoam and modifying the turbulence properties in order the solver not to take into account the turbulence model. You can do this by changing the keyword simulationType to laminar, into the /constant/turbulenceProperties file. See more info here Maybe you can also try re-running icoFoam now to see what happens, maybe that fixes the problem. Let me know if it works out. I read that icoFoam is meant for laminar flow, so maybe it is more correct to use this solver, but in your case you are not interested in laminar flow itself, but you just want be sure that the case is first working without turbulence and then move on with the implementation of the turbulence model. This is what I was trying to suggest. Kind regards

 February 3, 2017, 10:09 #10 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 Dear John, I have successfully run my simulation with 1.7 mil cells (it converged after 960 iterations) but when i create a new mesh with 2.5mil cell it doesnt converge even after 9000 iterations (but the residuals are very small about 2e-5).Do you know why is probably this happening? Thank you very much in advance you are my only hope to finish my diploma thesis. With respect, Thodoris

 February 3, 2017, 10:31 #11 Member   Ioannis Tsavlidis Join Date: Nov 2016 Location: Greece Posts: 30 Rep Power: 5 Hey What are your convergence criteria ? Residuals of e-5 sound really nice to me in order to have convergence. You should visually check whether there is convergence or not. Some indications are, the low residuals (which you already have) and the stability of the force coefficients (Cl and Cd). With stability I mean, whether or not the values are changing. You can also notice a small oscillation around a certain value. This oscillation is acceptable, and in order to have a better result you should use the average of the last few iterations. Do you log the residuals and the force coefficients at each iteration? Could you please post the residuals and the force coefficients of both cases so that I can have a better look about the convergence? Kind regards

 February 3, 2017, 19:01 #12 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 By convergence criteria you mean residual control? SIMPLE { nNonOrthogonalCorrectors 0; pRefCell 0; pRefValue 0; residualControl { p 1e-5; U 1e-5; nuTilda 1e-5; } } I found out that i had computed wrong the initial conditions for nutilda and nut.I changed them and it seems that is going to converge.I will inform you as soon as i get results!

February 4, 2017, 10:18
#13
New Member

Thodoris
Join Date: Apr 2016
Location: Greece
Posts: 22
Rep Power: 5
Dear John,
This is my new simulation with the corrected initial conditions.After 2000 iterations residuals are oscillating.Do you have an idea why is this happening.
With respect,
Thodoris
Attached Images
 residuals.jpg (47.9 KB, 72 views)

February 6, 2017, 12:46
#14
Member

Joshua
Join Date: Dec 2016
Location: St. Louis, Missouri
Posts: 91
Rep Power: 4
Quote:
 Originally Posted by teodm Dear John, This is my new simulation with the corrected initial conditions.After 2000 iterations residuals are oscillating.Do you have an idea why is this happening. Thank you in advance. With respect, Thodoris
The oscillations are due to the unsteadiness of the flow generated by the airfoil. This is to be expected.

Joshua

 February 7, 2017, 05:02 #15 New Member   Thodoris Join Date: Apr 2016 Location: Greece Posts: 22 Rep Power: 5 Joshua than you very much for your reply but i would like to ask you why the residuals don't get lower values.I am starting to believe that is due to the mesh.Here is my checkMesh.I think i have to use nonorthogonal correctors.What do you think? Create polyMesh for time = 0 Time = 0 Mesh stats points: 361772 faces: 4260836 internal faces: 4103600 cells: 2091109 faces per cell: 4 boundary patches: 4 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 0 prisms: 0 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 2091109 polyhedra: 0 Checking topology... Boundary definition OK. Cell to face addressing OK. Point usage OK. Upper triangular ordering OK. Face vertices OK. Number of regions: 1 (OK). Checking patch topology for multiply connected surfaces... Patch Faces Points Surface topology walls 74281 37388 ok (non-closed singly connected) outlet 2010 1067 ok (non-closed singly connected) inlet 2100 1112 ok (non-closed singly connected) wings 78845 39550 ok (non-closed singly connected) Checking geometry... Overall domain bounding box (-0.3 -0.15 -0.245) (3 0.15 0.255) Mesh has 3 geometric (non-empty/wedge) directions (1 1 1) Mesh has 3 solution (non-empty) directions (1 1 1) Boundary openness (1.04529e-16 -1.18714e-14 4.97349e-15) OK. Max cell openness = 7.79721e-16 OK. Max aspect ratio = 19.5697 OK. Minimum face area = 3.34129e-08. Maximum face area = 0.000302238. Face area magnitudes OK. Min volume = 4.89505e-12. Max volume = 1.62475e-06. Total volume = 0.494001. Cell volumes OK. Mesh non-orthogonality Max: 86.8914 average: 25.0285 *Number of severely non-orthogonal (> 70 degrees) faces: 743. Non-orthogonality check OK. <

 February 7, 2017, 10:24 #16 Member   Joshua Join Date: Dec 2016 Location: St. Louis, Missouri Posts: 91 Rep Power: 4 teodm, It could be a few things. It could be your mesh, Reynolds number, or if you are doing a steady simulation instead of an unsteady simulation. As you are simulating airfoils, check that you are not getting any kind of wall effect and that you have enough refinement around the wing to capture any BL development. Joshua

February 7, 2017, 11:25
#17
New Member

Thodoris
Join Date: Apr 2016
Location: Greece
Posts: 22
Rep Power: 5
I used Gauss limited 0.33 in my fvschemes and my residuals decreased but still not less than 1e-5.
ddtSchemes
{
}

{
default Gauss linear;
grad ( p ) Gauss linear ;

}

divSchemes
{
default none;
}

laplacianSchemes
{
default Gauss linear limited 0.333;
}

interpolationSchemes
{
default linear;
}

{
default limited 0.333;;
}

wallDist
{
method meshWave;
}
Thank you very much for your reply.This further reduction with gauss limited 0,33 is making me believe that the problem is the mesh
Attached Images
 residualsnew2.jpg (52.2 KB, 38 views)

 February 7, 2017, 13:00 #18 Member   Joshua Join Date: Dec 2016 Location: St. Louis, Missouri Posts: 91 Rep Power: 4 teodm, While this was not in OpenFOAM, when I did 3D wing simulations in Star-CCM+ I had 7-8 million cells. It looks like you have 2 million cells currently. Adding refinement around the wings or decreasing the base mesh size could be enough. Joshua

 Tags airfoil 3d, geometry, mesh 3d, openfoam