CFD Online URL
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

Meshing Naca0012 with snappyHexMesh

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 15, 2012, 07:05
Default Meshing Naca0012 with snappyHexMesh
  #1
New Member
 
Join Date: Nov 2011
Posts: 6
Rep Power: 5
kasimirXV is on a distinguished road
Hello,

i'm new in using OpenFoam. The Version I use is OF 2.0. My Problem is: I try to mesh an Naca0012 in 3D with snappyHexMesh. I also used the Feature EdgeMesh. Now my mesh don't look too bad, but the edges are not clearly meshed. Also the edges at the back aren't good. Furthermore, the right side is meshed o.k., but the left side of the profile isn't as good as the right side. I attached some pictures of that.
What can I do to improve this? Maybe anybody can help me?


Thanks


Naca0012_left.jpg

Naca0012_rigth.jpg
kasimirXV is offline   Reply With Quote

Old   January 22, 2012, 14:54
Default
  #2
Member
 
wided
Join Date: Jul 2010
Posts: 54
Rep Power: 6
wiedangel is on a distinguished road
can you post the snappy dictionary? so one can have an idea what snappy is doing?
wiedangel is offline   Reply With Quote

Old   January 24, 2012, 14:00
Default
  #3
New Member
 
Join Date: Nov 2011
Posts: 6
Rep Power: 5
kasimirXV is on a distinguished road
Hello wiedangel,

you're right. It would be good to see what snappy is doing. So I attached the snappyHexMeshDict. Meanwhile I have managed to improve the mesh a little bit but if you have a closer look you can see that the edges still aren't correctly meshed. Especially the back corners. I have also attached some photos of that. Furthermore i have many nonOrthoFaces and skewFaces when i run checkMesh and the simpleFoam analysis repeats very high values for y+. Maybe you have an idea why!?
This is my snappyHexMeshDict:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.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 true;
snap true;
addLayers false; //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
{
n0012.stl
{
type triSurfaceMesh;
name Naca0012;
}

refinementBox
{
type searchableBox;
min (-3000 2000 -3000); //(-3000 -600 -3000);
max (6000 2000 3000);
}
};



// 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 10000000; //100000;

// 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 50000000; //500000;

// 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; //4;

// 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.10;


// Number of buffer layers between different levels.
// 1 means normal 2:1 refinement restriction, larger means slower
// refinement.
nCellsBetweenLevels 1;



// 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 "n0012.eMesh";
level 3; //3; war ganz gut
}
);



// 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
{
Naca0012
{
// Surface-wise min and max refinement level
level (8 8); //(8 8);so funktionierts ganz gut
}
}

// Resolve sharp angles
resolveFeatureAngle 90; //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 outside; //inside; mit inside und level (8 8) und im blockMesh simple grading (20 1 20) wars ganz gut
levels ((1E15 4));//((1E15 4));
}
}


// 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 (-5.23 5.24 5.22);


// Whether any faceZones (as specified in the refinementSurfaces)
// are only on the boundary of corresponding cellZones or also allow
// free-standing zone faces. Not used if there are no faceZones.
allowFreeStandingZoneFaces true;
}



// Settings for the snapping.
snapControls
{
//- Number of patch smoothing iterations before finding correspondence
// to surface
nSmoothPatch 5;//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 5.0;//4.0;

//- Number of mesh displacement relaxation iterations.
nSolveIter 100;

//- Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 5;//5;

//- Highly experimental and wip: number of feature edge snapping
// iterations. Leave out altogether to disable.
// Do not use here since mesh resolution too low and baffles present
nFeatureSnapIter 30; //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 true;

// Per final patch (so not geometry!) the layer information
layers
{
"Naca0012_.*"
{
nSurfaceLayers 1;
}
}

// Expansion factor for layer mesh
expansionRatio 1.0;

//- Wanted thickness of final added cell layer. If multiple layers
// is the
// thickness of the layer furthest away from the wall.
// Relative to undistorted size of cell outside layer.
// is the thickness of the layer furthest away from the wall.
// See relativeSizes parameter.
finalLayerThickness 0.3;

//- 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.1; //0.25

//- 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.
// Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
nGrow 1;

// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.
featureAngle 30; //30

//- Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 5;

// Number of smoothing iterations of surface normals
nSmoothSurfaceNormals 1;

// Number of smoothing iterations of interior mesh movement direction
nSmoothNormals 3;

// Smooth layer thickness over surface patches
nSmoothThickness 10;

// Stop layer growth on highly warped cells
maxFaceThicknessRatio 0.5;

// Reduce layer growth where ratio thickness to medial
// distance is large
maxThicknessToMedialRatio 0.3;

// Angle used to pick up medial axis points
// Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
minMedianAxisAngle 90;


// Create buffer region for new layer terminations
nBufferCellsNoExtrude 0;


// Overall max number of layer addition iterations. The mesher will exit
// if it reaches this number of iterations; possibly with an illegal
// mesh.
nLayerIter 50;

// Max number of iterations after which relaxed meshQuality controls
// get used. Up to nRelaxIter it uses the settings in meshQualityControls,
// after nRelaxIter it uses the values in meshQualityControls::relaxed.
nRelaxedIter 20;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
//- Maximum non-orthogonality allowed. Set to 180 to disable.
maxNonOrtho 179; //65;

//- Max skewness allowed. Set to <0 to disable.
maxBoundarySkewness 20;
maxInternalSkewness 4;

//- 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 80;

//- 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-13;

//- Minimum quality of the tet formed by the face-centre
// and variable base point minimum decomposition triangles and
// the cell centre. This has to be a positive number for tracking
// to work. Set to very negative number (e.g. -1E30) to
// disable.
// <0 = inside out tet,
// 0 = flat tet
// 1 = regular tet
minTetQuality 1e-30;

//- Minimum face area. Set to <0 to disable.
minArea -1;

//- Minimum face twist. Set to <-1 to disable. dot product of face normal
//- and face centre triangles normal
minTwist 0.05;//0.02

//- minimum normalised cell determinant
//- 1 = hex, <= 0 = folded or flattened illegal cell
minDeterminant -1; // 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;

// Optional : some meshing phases allow usage of relaxed rules.
// See e.g. addLayersControls::nRelaxedIter.
//relaxed
//{
// //- Maximum non-orthogonality allowed. Set to 180 to disable.
// maxNonOrtho 30; //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;


// ************************************************** *********************** //

I hope you or anyone else can give me some hints.

Thanks
Attached Images
File Type: jpg Naca0012.jpg (40.8 KB, 75 views)
File Type: jpg Naca0012_back.jpg (58.1 KB, 85 views)
kasimirXV is offline   Reply With Quote

Old   February 21, 2012, 21:13
Default surfaceFeatureExtract
  #4
New Member
 
Travis
Join Date: Oct 2011
Location: seattle
Posts: 7
Rep Power: 5
seadmiral is on a distinguished road
I had a similar problem, and the use of surfaceFeatureExtract fixed it, at least in OF-2.0.1. There is a good thread on this forum linking to the OpenCFD page announcing the utility. Also, the flange tutorial demonstrates the capability @

$FOAM_TUTORIALS/mesh/snappyHexMesh/flange


From the command line, the execution would look like:

surfaceFeatureExtract -includedAngle 150 -writeObj constant/triSurface/flange.stl flange

Read this post for more information regarding necessary changes to snappyHexMeshDict:

http://www.cfd-online.com/Forums/ope...ture-edge.html

Good luck!
seadmiral is offline   Reply With Quote

Old   February 23, 2012, 18:32
Default
  #5
New Member
 
Join Date: Nov 2011
Posts: 6
Rep Power: 5
kasimirXV is on a distinguished road
Hello seadmiral,

thank you very much for your hint. Unfortunately I used the surfaceFeatureExtract already. But in the meantime I improved the mesh. Now it is more consistent. I think I had a wrong definition of the refinement box. But the edges still are not good. As you can see in the attached picture the edgeMesh.obj looks properly (red line). Or am I wrong? So I don't know what i can improve furthermore.

Maybe you can give me some more hints to try!?

Thanks
Attached Images
File Type: jpg n0012_edgeMesh_obj.jpg (73.5 KB, 72 views)
kasimirXV is offline   Reply With Quote

Old   February 23, 2012, 21:39
Default stl file, extrudeMesh and createPatch
  #6
New Member
 
Travis
Join Date: Oct 2011
Location: seattle
Posts: 7
Rep Power: 5
seadmiral is on a distinguished road
I see. Then what you need to do is use an STL geometry that exceeds the depth dimension of your flow domain. Create a new STL file by extruding an airfoil twice as long in span as the depth of your domain of interest. Then run your blockMesh and snappy commands on a mid-span portion of this wing STL geometry.

Finally, after successful snappy execution, use extrudeMesh and createPatch to grab just one face of the flow domain and extrude it to make your domain of interest (in a new directory). Createpatch will finalize the domain.

See the snappyHexMesh and simpleFoam directories of the wingMotion tutorial to see how this is done. Good luck!
seadmiral is offline   Reply With Quote

Old   February 26, 2012, 12:49
Default
  #7
New Member
 
Join Date: Nov 2011
Posts: 6
Rep Power: 5
kasimirXV is on a distinguished road
Hello seadmiral,

thanks again. I don't know if I understand this correctly, but I took a look at the wingMotion Tutorial and I think this way is only possible for a 2D problem. Please correct me if I'm wrong!? I have to do it in 3D.

Thanks
kasimirXV is offline   Reply With Quote

Old   February 26, 2012, 13:07
Default
  #8
New Member
 
Travis
Join Date: Oct 2011
Location: seattle
Posts: 7
Rep Power: 5
seadmiral is on a distinguished road
I see you mentioned 3d earlier. The geometry looks like it would be used on a 2D problem. I suppose you have twist or a tip vortex or something.

If you must run in 3D, my experience is limited, but my approach would be to run the blockMesh and snappy steps on a longer than necessary (in span) STL file. For me, those edge cuts were much improved this way. I realized this trick by visualizing the wingMotion .obj file and the snappy mesh at the same time.

But obviously extrudeMesh a la wingMotion is not best in this case for 3d resolution.

Let me know what you find, I plan to use sHM in 3d ... some day.
seadmiral is offline   Reply With Quote

Old   February 26, 2012, 16:08
Default
  #9
New Member
 
Join Date: Nov 2011
Posts: 6
Rep Power: 5
kasimirXV is on a distinguished road
Thanks a lot. Unfortunately it has to be in 3D. So I will continue trying. I also will try this way you mentioned with the wingMotion principal. For sure, if I find a solution one day I will tell you.

If you or anybody has further ideas, please post...
kasimirXV is offline   Reply With Quote

Old   February 26, 2012, 17:09
Default Use Discretizer for SnappyHexMesh
  #10
New Member
 
Min Thaw Tun
Join Date: Mar 2011
Location: Kaluga, Russia
Posts: 19
Rep Power: 5
Technoyoungman is on a distinguished road
Send a message via Yahoo to Technoyoungman
Quote:
Originally Posted by kasimirXV View Post
Thanks a lot. Unfortunately it has to be in 3D. So I will continue trying. I also will try this way you mentioned with the wingMotion principal. For sure, if I find a solution one day I will tell you.

If you or anybody has further ideas, please post...
kasimirXV
You can use Discretizer for SnappyHexMesh. This is the best and U can control the parameters easily. www.discretizer.org Here is the result I get.

Attached Images
File Type: jpg Untitled.jpg (102.7 KB, 294 views)
Technoyoungman is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Meshing a V-notch Weir with snappyHexMesh kflora OpenFOAM Meshing & Mesh Conversion 11 December 19, 2011 02:58
Meshing a sphere with snappyHexMesh Cyberholmes OpenFOAM 2 July 19, 2011 17:46
SnappyHexMesh Meshing inside a cylinder nammari OpenFOAM 5 March 11, 2011 20:49
[GAMBIT] NACA0012 meshing problem parvez2683 ANSYS Meshing & Geometry 3 June 24, 2009 01:46
NACA0012 meshing problem parvez2683 OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 0 June 18, 2009 23:03


All times are GMT -4. The time now is 01:13.