|
[Sponsors] |
[snappyHexMesh] SnappyHexMesh - How to set-up to avoid skewfaces? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 2, 2009, 13:37 |
SnappyHexMesh - How to set-up to avoid skewfaces?
|
#1 |
Member
Pablo Caron
Join Date: Nov 2009
Location: Buenos Aires, Argentina
Posts: 75
Rep Power: 17 |
Hello forum!
I started using snappy a few weeks ago. So I haven't too much experience using it. I'm trying to mesh the air around a body. I changed almost every parameter I think can improve my mesh. No matter what I change I always get some skewfaces. These skewfaces always follow the same patern: It's an hex over the patch in the castellated mesh, in the snap step it become a skewfaces. What I did: I Changed the number of refinement steps in this patch, I changed the tolerance in the snap settings. I attached two screenshots and below there's my snappyHexMeshDict Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 1.6 | | \\ / A nd | Web: http://www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object snappyHexMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Which of the steps to run castellatedMesh true; snap true; addLayers false; // 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 { bodyCompleto.stl { type triSurfaceMesh; regions { body { name body; } anotherPart { name anotherPart; } } } refinementBox { type searchableBox; min ( 0 -2200 -60); max ( 1100 8000 1500); } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters // ~~~~~~~~~~~~~~~~~~~~~ // While refining maximum number of cells per processor. This is basically // the number of cells that fit on a processor. If you choose this too small // it will do just more refinement iterations to obtain a similar mesh. maxLocalCells 1000000; // 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 4000000; // 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; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 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 { bodyCompleto.stl { level (0 0); regions { body { level (5 6); } anotherPart { level (8 8); } } } } // Resolve sharp angles resolveFeatureAngle 20; // 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 2)); } } // 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 (1000 -2000 100); } // Settings for the snapping. snapControls { //- Number of patch smoothing iterations before finding correspondence // to surface nSmoothPatch 5; //- Relative distance for points to be attracted by surface feature point // or edge. True distance is this factor times local // maximum edge length. tolerance 0.25; //- Number of mesh displacement relaxation iterations. nSolveIter 30; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 7; } // Settings for the layer addition. addLayersControls { relativeSizes true; // Per final patch (so not geometry!) the layer information layers { minZ { nSurfaceLayers 1; } motorBike_frt-fairing:001%1 { 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. 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; //- 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 1; // Advanced settings //- When not to extrude surface. 0 is flat surface, 90 is when two faces // make straight angle. featureAngle 30; //- Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 3; // 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 minMedianAxisAngle 130; // Create buffer region for new layer terminations nBufferCellsNoExtrude 0; // Overall max number of layer addition iterations nLayerIter 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 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 projected area v.s. actual area. Set to -1 to disable. minFlatness 0.5; //- Minimum pyramid volume. Is absolute volume of cell pyramid. // Set to very negative number (e.g. -1E30) to disable. minVol 1e-13; //- 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.02; //- minimum normalised cell determinant //- 1 = hex, <= 0 = folded or flattened illegal cell minDeterminant 0.001; //- minFaceWeight (0 -> 0.5) minFaceWeight 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; // ************************************************************************* // Regards Pablo |
|
March 31, 2010, 03:02 |
|
#2 |
New Member
Prashant
Join Date: Mar 2010
Posts: 1
Rep Power: 0 |
Nice illustration
Thanks |
|
March 31, 2010, 09:19 |
|
#3 |
Member
Pablo Caron
Join Date: Nov 2009
Location: Buenos Aires, Argentina
Posts: 75
Rep Power: 17 |
Dear Prashant, Thank you,
Have you had similar problems? I've used snappy a bit more, but I couldn't solve this problem yet. Regards Pablo |
|
April 20, 2010, 11:49 |
|
#4 |
Senior Member
|
I also have issues with skew faces and am not yet able to tell you how to avoid it.
-Louis |
|
April 20, 2010, 12:46 |
|
#5 |
Member
Pablo Caron
Join Date: Nov 2009
Location: Buenos Aires, Argentina
Posts: 75
Rep Power: 17 |
Louis, thanks for your reply. This problem arises when your surface is almost aligned with the mesh. Then some nodes and/or elements are deleted. In my pictures the element is deleted so the surface has a cube inside the mesh, so in the snap stage the nodes are attracted by the stl surface. But, this is the problem, not the solution I don't have a solution either.
Some hints 1) Start with a coarse mesh and add layers. I don't have layer in my pictures. 2) Increase the tolerance in snapControls. In this case the resulting surface has a lot of bumps. These are just some ideas. I think there isn't a unique solution. Regards Pablo |
|
April 20, 2010, 13:07 |
|
#6 |
Senior Member
|
although if you reduce the max skewness setting in the snappyHexMeshDict to something very low (eg. 0.5 for both) it seems to help.
-Louis PS: thanks for your help also EDIT: It seems however that seeting my max skewneww really low makes the mesh really coarse.. perhaps not the best solution..! Last edited by louisgag; April 20, 2010 at 15:28. |
|
April 27, 2010, 10:23 |
|
#7 |
Member
Moritz Wied
Join Date: Mar 2010
Location: suttgart, germany
Posts: 35
Rep Power: 16 |
hi everybody,
may it be that the layer-addition phase is the problem here? i also have problems with "bumps" on my surface at the moment, and if i dont add layers and leave everything else the same, everything is smooth... regards, moritz |
|
April 27, 2010, 11:02 |
|
#8 |
Senior Member
|
Hi Moritz,
for me it seems that layers usually reduce the skewness, however, if I set the skewness tolerance in snappyhexmeshdict to a very low value (ex: below 0.5) that's when I see a very rough surface mesh, even without layers, but, skewness is reduced.. which is useless since my mesh is wrong! |
|
May 1, 2010, 13:28 |
I agree
|
#9 |
Member
Pablo Caron
Join Date: Nov 2009
Location: Buenos Aires, Argentina
Posts: 75
Rep Power: 17 |
Hi Louis and Moritz
I agree with Louis, I test to reduce the skewness option recently. The result is a bumped surface . I solved it with a higher value in maxBoundarySkewness option, say 10. But with a lower value in maxInternalSkewness. I have no tested to add layers yet. So, I haven't experience using that option. Regards Pablo |
|
May 2, 2010, 20:24 |
|
#10 |
Member
Alan Russell
Join Date: Aug 2009
Location: Boise, Idaho USA
Posts: 61
Rep Power: 17 |
I had a lot of strange problems with snappy - not exactly as described above. The source was the fvSolution and fvSchemes files. These files in the motorbike tutorial are not the right ones for mesh generation with snappy (they are for running the wind tunnel simulation part of the motorbike tutorial, not the mesh part). Using the fvSolution and fvSchemes from the moveDynamicMesh tutorial fixed all of my mesh problems. Check both files and make sure they have settings for cellDisplacement, cellMotionU, etc.
Good luck, Alan |
|
May 5, 2010, 17:34 |
|
#11 |
Senior Member
|
Hi Alan,
thanks for pointing this out; however, changing to the fvSchemes and fvSolution files that do contain de CellMotion part does not change anything in the mesh that snappyHexMesh generates for me. My solution so far has been to tolerate the maximum skewness of 5-6 since the results still seem very reasonable and my simulation converges. Best regards, -Louis PS: as for trying a low internalSkew and high boundaryskew, it still does the rough mesh problem. |
|
February 3, 2011, 11:44 |
|
#12 |
New Member
Carl
Join Date: Jan 2011
Location: Bremen /Gothenburg
Posts: 11
Rep Power: 15 |
Hi there,
I have the very same problem with skewed faces on a very complex geometry. ca. 300 SF with the max bound. skewness of 10 and 2. Does anyone have a solution yet for that problem or is it something you have to live with using sHM? How do you set it up the right way without making the mesh to coarse? Open for any answers. Bye cjm |
|
March 2, 2011, 08:30 |
|
#13 |
New Member
Carl
Join Date: Jan 2011
Location: Bremen /Gothenburg
Posts: 11
Rep Power: 15 |
Hej all,
I found the same as Louis. MaxBoundSkew ~5 give the best results by keeping the shape of the grid (at least for the case I am working on). Another important thing is to make the blockMesh cells the way that the edge length in X,Y,Z are more or less the same or times 0.5 of each other, i.e. cube like or semi-cube like. This enables sHM to produce less skewed Faces as well. Bye cjm |
|
June 14, 2013, 13:15 |
|
#14 |
New Member
Peng Zhong
Join Date: Jun 2013
Posts: 12
Rep Power: 13 |
You may need to set surface refinement levels so that min and max are the same number.
|
|
July 9, 2013, 14:01 |
|
#15 |
New Member
Ole Richter
Join Date: Jun 2013
Posts: 11
Rep Power: 13 |
solution for my case
i set up a few cases and raised always another setting. nSmoothPatch killed the skew faces at my case without decreasing the quality of my mesh. |
|
August 14, 2014, 06:03 |
|
#16 |
New Member
Join Date: Mar 2014
Posts: 17
Rep Power: 12 |
Hi everybody!
I have been reading your solutions, but I still have bad cells on surface (see attachement). I am using OpenFoam 2.3.0. I already changed the following parameters: maxNonOrtho maxBoundarySkewness maxInternalSkewness nSmoothPatch tolerance And it did not help. I also tried to run the three snappyHexMesh steps separately, but it did not help. Has anybody experienced such difficulty and could give me a tip? Best regards Benjamin |
|
August 19, 2014, 04:12 |
|
#17 |
New Member
Join Date: Mar 2014
Posts: 17
Rep Power: 12 |
Hi!
I have been changing other parameters in snapControls: nSolveIter nSmoothPatch nRelaxIter nFeatureSnapIter without any success. Has anybody any tip to avoid this kind of cell? Best regards BenJ |
|
September 13, 2014, 16:58 |
|
#18 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128 |
Greetings BenJ,
I've had this thread on my to-do list for a while now and only now did I manage to come look into this. I don't know if you've found an answer for this or not, but if not, the problem is that although I think I might be able to help, there isn't much I can do without a test case to work with and test things myself Therefore, if you could provide a test case where this occurs, I can take a look into it. Best regards, Bruno
__________________
|
|
September 2, 2015, 21:38 |
Folder to solve high Skewness Faces
|
#19 | |||||
Member
Werner
Join Date: Jul 2015
Location: West Lafayette, USA
Posts: 34
Rep Power: 11 |
Dear Forum,
I'm facing this issue as well and I believe it might be the cause why the solver pimpleDyMFoam crashes. Following your recomendations I setted Quote:
Quote:
Quote:
Quote:
So if Bruno ,or anyone, still want like to get the bottom of this, I would be grateful that you help me out. You can find the case in the link: https://drive.google.com/file/d/0Bwm...ew?usp=sharing best regards, Werner ps.By the way, could you check the result when running pimpleDyMFoam ? What might be the origin of it ? Is it really the mesh ? Quote:
|
||||||
September 7, 2015, 05:34 |
|
#20 | |
Senior Member
|
Dear Werner,
The skewFaces are likely not the cause of OF interrupting. Quote:
You can ignore the error by adding a directive such as Code:
AMI4 { type cyclicAMI; inGroups 1(cyclicAMI); nFaces 31968; startFace 11637721; matchTolerance 0.0001; transform noOrdering; neighbourPatch AMI3; lowWeightCorrection 0.2; } Regards, -Louis |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[ICEM] ICEM Scripting Issues | tylerplowright | ANSYS Meshing & Geometry | 33 | September 27, 2021 17:35 |
[snappyHexMesh] On which patches to set BC's for snappyHexMesh ? | Talder | OpenFOAM Meshing & Mesh Conversion | 0 | November 8, 2015 19:25 |
set BC mass-flow-inlet via UDF and via GUI perform different result | sawa25 | FLUENT | 1 | February 25, 2015 01:51 |
[ICEM] Question about the use of ICEM tcl scripting | lnk | ANSYS Meshing & Geometry | 9 | January 16, 2013 10:24 |
How to show the transient case? | H.P.LIU | Phoenics | 7 | July 13, 2010 05:31 |