|
[Sponsors] |
[snappyHexMesh] Meshing NACA airFoil with snappy |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 25, 2013, 05:30 |
Meshing NACA airFoil with snappy
|
#1 |
New Member
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13 |
Hi everyone!
I'm trying to study the airflow around a NACA0010 in 3D as part of my thesis. At the beginning I had a few troubles because I'm new to OF and CFD. I draw the foil in Catia and than I meshed it using snappyHexMesh, starting from a blockMesh. These are my BlockMeshDict and snappyHexMeshDict files, I hope they can be useful for the very beginners who has to mesh a NACA: BlockMeshDict: /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object blockMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Xleft -2000; Xright 2000; dX 40; Yin -3000; Yout 7000; dY 100; Ztop 4000; Zbottom -4000; dZ 80; convertToMeters 1; vertices ( ($Xleft $Yin $Zbottom) // 0 7 ($Xright $Yin $Zbottom) // 1 6 ($Xright $Yout $Zbottom) // 2 2 ($Xleft $Yout $Zbottom) // 3 3 ($Xleft $Yin $Ztop) // 4 4 ($Xright $Yin $Ztop) // 5 5 ($Xright $Yout $Ztop) // 6 1 ($Xleft $Yout $Ztop) // 7 0 ); blocks ( hex (0 1 2 3 4 5 6 7) // vertex numbers ($dX $dZ $dY) // cells in each direction simpleGrading (1 1 1) ); edges ( ); patches ( patch inlet // patch name ( (0 1 5 4) // inlet // (1 2 6 5) // outlet ) patch outlet // patch name ( // (0 4 7 3) // inlet (3 7 6 2) // outlet ) symmetryPlane left ( (0 4 7 3) // left //(4 5 6 7) // right ) symmetryPlane right ( //(0 3 2 1) // left (2 6 5 1) // right ) symmetryPlane top ( (4 5 6 7) ) simmetryPlane bottom ( (0 3 2 1) ) ); mergePatchPairs ( ); // ************************************************** *********************** // SnappyHexMeshDict: /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.7.1 | | \\ / A nd | Web: www.OpenFOAM.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh false; snap false; addLayers true; // Geometry. Definition of all surfaces. All surfaces are of class // searchableSurface. // Surfaces are used // - to specify refinement for any mesh cell intersecting it // - to specify refinement for any mesh cell inside/outside/near // - to 'snap' the mesh boundary to the surface geometry { //galleria.stl //{ // type triSurfaceMesh; // name galleria; //} NACA0010-2Lmm.stl { type triSurfaceMesh; name NACA; } //inlet.stl // { // type triSurfaceMesh; // name inlet; // } //outlet.stl // { // type triSurfaceMesh; // name outlet; // } //ground.stl // { // type triSurfaceMesh; // name ground; // } /* refinementBox { type searchableBox; min (-550 -150 -250); max ( 550 1150 250); } */ }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters // ~~~~~~~~~~~~~~~~~~~~~ // If local number of cells is >= maxLocalCells on any processor // switches from from refinement followed by balancing // (current method) to (weighted) balancing before refinement. maxLocalCells 1000000000; // Overall cell limit (approximately). Refinement will stop immediately // upon reaching this number so a refinement level might not complete. // Note that this is the number of cells before removing the part which // is not 'visible' from the keepPoint. The final number of cells might // actually be a lot less. maxGlobalCells 2000000000; // The surface refinement loop might spend lots of iterations refining just a // few cells. This setting will cause refinement to stop if <= minimumRefine // are selected for refinement. Note: it will at least do one iteration // (unless the number of cells to refine is 0) minRefinementCells 10; // Allow a certain level of imbalance during refining // (since balancing is quite expensive) // Expressed as fraction of perfect balance (= overall number of cells / // nProcs). 0=balance always. maxLoadUnbalance 0.2; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 2:1;//3 // Explicit feature edge refinement // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies a level for any cell intersected by its edges. // This is a featureEdgeMesh, read from constant/triSurface for now. features ( //{ // file "someLine.eMesh"; // level 2; //} ); // Surface based refinement // ~~~~~~~~~~~~~~~~~~~~~~~~ // Specifies two levels for every surface. The first is the minimum level, // every cell intersecting a surface gets refined up to the minimum level. // The second level is the maximum level. Cells that 'see' multiple // intersections where the intersections make an // angle > resolveFeatureAngle get refined up to the maximum level. refinementSurfaces { NACA { // Surface-wise min and max refinement level level (4 4); } //galleria //{ // Surface-wise min and max refinement level // level (1 2); //} //ground //{ // Surface-wise min and max refinement level // level (1 2); //} //inlet //{ // Surface-wise min and max refinement level // level (1 2); //} //outlet //{ // Surface-wise min and max refinement level // level (1 2); //} } // Resolve sharp angles resolveFeatureAngle 30;//30 // Region-wise refinement // ~~~~~~~~~~~~~~~~~~~~~~ // Specifies refinement level for cells in relation to a surface. One of // three modes // - distance. 'levels' specifies per distance to the surface the // wanted refinement level. The distances need to be specified in // descending order. // - inside. 'levels' is only one entry and only the level is used. All // cells inside the surface get refined up to the level. The surface // needs to be closed for this to be possible. // - outside. Same but cells outside. refinementRegions { /* refinementBox { mode inside; levels ((1E15 3));//1E15 3 } */ } // Mesh selection // ~~~~~~~~~~~~~~ // After refinement patches get added for all refinementSurfaces and // all cells intersecting the surfaces get put into these patches. The // section reachable from the locationInMesh is kept. // NOTE: This point should never be on a face, always inside a cell, even // after refinement. locationInMesh (-1900 -2900 -900);// punto all'esterno dell'stl per avere mesh attorno;dentro stl per mesharlo allowFreeStandingZoneFaces false; } // Settings for the snapping. snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 3;//3 //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 1.0;//4 //- Number of mesh displacement relaxation iterations. nSolveIter 100;//30 //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 6; //10 nFeatureSnapIter 10; } // Settings for the layer addition. addLayersControls { // Are the thickness parameters below relative to the undistorted // size of the refined cell outside layer (true) or absolute sizes (false). relativeSizes false;// con true non viene // Per final patch (so not geometry!) the layer information layers { NACA { nSurfaceLayers 6;// due in meno di quelli che ci starebbero teoricamente...se di pił non viene } } // Expansion factor for layer mesh expansionRatio 1.2; //- Wanted thickness of final added cell layer. If multiple layers // is the thickness of the layer furthest away from the wall. // See relativeSizes parameter. finalLayerThickness 5.25;// //- Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // Relative to undistorted size of cell outside layer. minThickness 0.05;//0.1 //- If points get not extruded do nGrow layers of connected faces that are // also not grown. This helps convergence of the layer addition process // close to features. nGrow 0; // // Advanced settings //- When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 30;//90,180 con 30 fa meglio il bordo di attacco che con altri angoli non fa proprio //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 3 ;//3 // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 3; // Number of smoothing iterations of interior mesh movement direction nSmoothNormals 3;//3 // Smooth layer thickness over surface patches nSmoothThickness 10;//5,10 // Stop layer growth on highly warped cells maxFaceThicknessRatio 0.5;//0.2 // Reduce layer growth where ratio thickness to medial // distance is large maxThicknessToMedialRatio 0.3;//0.2 // Angle used to pick up medial axis points minMedianAxisAngle 80;//80 // Create buffer region for new layer terminations nBufferCellsNoExtrude 0;//10 // Overall max number of layer addition iterations nLayerIter 35;//50 } // Generic mesh quality settings. At any undoable phase these determine // where to undo. meshQualityControls { //- Maximum non-orthogonality allowed. Set to 180 to disable. maxNonOrtho 90;//90 //- Max skewness allowed. Set to <0 to disable. maxBoundarySkewness -1;//-1 maxInternalSkewness -1;//-1 //- Max concaveness allowed. Is angle (in degrees) below which concavity // is allowed. 0 is straight face, <0 would be convex face. // Set to 180 to disable. maxConcave 180;//180 //- Minimum projected area v.s. actual area. Set to -1 to disable. minFlatness -1; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to a sensible fraction of the smallest cell volume expected. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-17; minTetQuality 1e-30; //- Minimum face area. Set to <0 to disable. minArea -1;//-1 //- Minimum face twist. Set to <-1 to disable. dot product of face normal //- and face centre triangles normal minTwist -2;//-2 //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; //- minFaceWeight (0 -> 0.5) minFaceWeight 0.02;//0.02 //- minVolRatio (0 -> 1) minVolRatio 0.01; //must be >0 for Fluent compatibility minTriangleTwist -1; // Advanced //- Number of error distribution iterations nSmoothScale 4; //- amount to scale back displacement at error points errorReduction 0.75; } // Advanced // Flags for optional output // 0 : only write final meshes // 1 : write intermediate meshes // 2 : write volScalarField with cellLevel for postprocessing // 4 : write current intersections as .obj files debug 0; // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1E-6; // ************************************************** *********************** // At the moment the mesh is not refined enough to obtain good results (compared with the sperimentals ones available here: http://airfoiltools.com/airfoil/deta...il=naca0010-il ), especially near the end of the foil, where I can't put layers. Does anyone has any suggestion to refine it? Thanks! Paolo |
|
October 1, 2013, 18:04 |
|
#2 |
Member
Miro
Join Date: Jan 2013
Location: Europe
Posts: 51
Rep Power: 13 |
Hello Paolo,
those results are obtained from xfoil, and it's not strange that results differ. xfoil calculates flow around a 2d foil, while you're running a 3d CFD simulation. If you're interested in CFD you should check out wiki on this site. You should post your code in a Code:
code so it's easier to read cheerse |
|
October 2, 2013, 09:56 |
|
#3 |
New Member
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13 |
Hey Miro!
Thanks for your hints! At the moment i'm trying to set a 2D simulation to see if I get better results. I found out that using a refinementBox near the tail is helping me obtaining better layers! cheerse |
|
October 7, 2013, 04:50 |
snappyHexMesh: what happens to the initial mesh generated by blockMesh?
|
#4 |
New Member
Albert Pinto
Join Date: May 2013
Posts: 16
Rep Power: 13 |
Hello All,
I have a rather simple question: lets say I have the stl file of a geometry (object) on which I'd like to generate a mesh. The steps are: a) define a bounding box that contains the object and use blockMesh to generate the mesh for the bounding box. b) use snappyHexMesh to generate the surface mesh on the object. At the the end of the snappyHexMesh process, I am left with a surface mesh on the object. Question: what happens to the bounding box? Since the solver requires bcs like inlet, outlet etc, that are defined on the bounding box, I am a bit puzzled by the fact that I do not see a mesh that contains the outer bounding box _and_ the object? Any suggestions as to what I am missing? Thanks, Albert |
|
October 7, 2013, 04:56 |
|
#5 |
Member
Miro
Join Date: Jan 2013
Location: Europe
Posts: 51
Rep Power: 13 |
Hmm, are you sure you defined "outside" correctly? Maybe your mesh is inside the object?
|
|
October 7, 2013, 18:48 |
snappyHexMesh question ...
|
#6 |
New Member
Albert Pinto
Join Date: May 2013
Posts: 16
Rep Power: 13 |
I am attaching the picture of the mesh that snappyHexMesh generated on the ahmed body (from an ahmed.stl file).
All dimensions are in meters. I generated a blockMesh, boundary mesh in a [-5.0,5.0]x[-5.0, 5.0]x[0,3.0] boundary (outer) box in the x,y,z directions. I then modeled my snapphHexMesDict file after the incompressible/pisoFoam/les/motorBike/motorBike/system/snappyHexMeshDict file in the OpenFOAM-2.2.x tutorials. Here are the changes I made to the example snappyHexMeshDict file: geometry { ahmed.stl { type triSurfaceMesh; name ahmed; } refinementBox { type searchableBox; min (-5.0 -5.0 0); max ( 5.0 5.0 3.0); } }; // Mesh selection // ~~~~~~~~~~~~~~ // After refinement patches get added for all refinementSurfaces and // all cells intersecting the surfaces get put into these patches. The // section reachable from the locationInMesh is kept. // NOTE: This point should never be on a face, always inside a cell, even // after refinement. locationInMesh (-0.7 0.0 0.15); snappyHexMesh preserved the outer box in the motorbike example. However, it does not for my case. I'd appreciate any help ... Thanks, Albert |
|
October 8, 2013, 05:52 |
|
#7 |
New Member
PaoloFariselli
Join Date: Aug 2013
Location: Milan, Italy
Posts: 28
Rep Power: 13 |
If you want to mesh outside the object, you have to set the : LocationInMesh parameter (in snappyHexMeshDict) with the coordinate of a point that is inside your block, BUT outside your geometry (stl file)
try this point: -4.98;-4.98;0.01 in this way you should be very near to the end of the block but still inside it, and away from your stl geometry. cheerse |
|
Tags |
layers, naca, snappy hex mesh |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
NACA 0012 Airfoil, simpleFoam, Spalart Allmaras | badwalgurpreet | OpenFOAM Running, Solving & CFD | 12 | October 28, 2024 04:03 |
[ANSYS Meshing] Meshing an airfoil with thickness (span) | Synchronous | ANSYS Meshing & Geometry | 6 | May 21, 2018 03:44 |
2way fsi over naca 0012 airfoil | drooleybob | FLUENT | 3 | June 27, 2016 22:42 |
[ANSYS Meshing] Meshing 3 Element Airfoil | mr.rushikumar | ANSYS Meshing & Geometry | 0 | March 1, 2014 23:57 |
Drag prediction for Naca 23012 airfoil | Ravel Bogatec | CFX | 17 | February 15, 2008 01:21 |