
[Sponsors] 
[snappyHexMesh] snappyHexMesh stuck when snap is turned on 

LinkBack  Thread Tools  Search this Thread  Display Modes 
April 25, 2020, 21:41 
snappyHexMesh stuck when snap is turned on

#1  
New Member
Brian
Join Date: Feb 2020
Posts: 4
Rep Power: 6 
Hello,
My simulation is about flow over NACA 0015 airfoil. I made a blockMesh and it works well. Then I use snappyHexMesh for the airoil. If only "castellatedMesh" is turned on, it works pretty well (attached a picture of it). However, when I turn on "snap", it gets stuck with the following warning: Quote:
Code:
/** C++ **\  =========    \\ / F ield  OpenFOAM: The Open Source CFD Toolbox   \\ / O peration  Version: 2.4.0   \\ / A nd  Web: 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 { NACA0015_finiteTE.stl { type triSurfaceMesh; name naca; } // Refine a bit extra around the small centre hole refineCylinder { type searchableCylinder; point1 (0 0 0); point2 (0 0 0.1); radius 0.1; } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // allowFreeStandingZoneFaces true; // 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; // 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 90000000; // 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 100; // Number of buffer layers between different levels. // 1 means normal 2:1 refinement restriction, larger means slower // refinement. nCellsBetweenLevels 10; // 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 ( ); // 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 { // Surfacewise min and max refinement level level (0 0); } } resolveFeatureAngle 30; // Regionwise 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 { refineCylinder { mode inside; levels ((1E15 5)); } } // 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. // This is an outside point locationInMesh (0.033 0.033 0.0033); locationInMesh (0.51 0.51 0.005); // Inside point // Whether any faceZones (as specified in the refinementSurfaces) // are only on the boundary of corresponding cellZones or also allow // freestanding 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 4; // 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; // Number of mesh displacement relaxation iterations. nSolveIter 100; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // Feature snapping // Number of feature edge snapping iterations. // Leave out altogether to disable. nFeatureSnapIter 10; // Detect (geometric) features by sampling the surface implicitFeatureSnap true; // Use castellatedMeshControls::features explicitFeatureSnap false; // Detect features between multiple surfaces // (only for explicitFeatureSnap, default = false) multiRegionFeatureSnap true; } // 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 { naca { nSurfaceLayers 6; } } // Expansion factor for layer mesh expansionRatio 1.05; // 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. // See relativeSizes parameter. firstLayerThickness 0.3; // Minimum thickness of cell layer. If for any reason layer // cannot be above minThickness do not add layer. // See relativeSizes parameter. minThickness 0.0005; // 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 // are perpendicular featureAngle 180; // Maximum number of snapping relaxation iterations. Should stop // before upon reaching a correct mesh. nRelaxIter 5; // Number of smoothing iterations of surface normals nSmoothSurfaceNormals 2; // 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 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 { #include "meshQualityDict" // Optional : some meshing phases allow usage of relaxed rules. // See e.g. addLayersControls::nRelaxedIter. relaxed { // Maximum nonorthogonality allowed. Set to 180 to disable. maxNonOrtho 70; } // Advanced // Number of error distribution iterations nSmoothScale 4; // amount to scale back displacement at error points errorReduction 0.75; } // Advanced // Write flags writeFlags ( scalarLevels // write volScalarField with cellLevel for postprocessing layerSets // write cellSets, faceSets of faces in layer layerFields // write volScalarField for layer coverage ); // Merge tolerance. Is fraction of overall bounding box of initial mesh. // Note: the write tolerance needs to be higher than this. mergeTolerance 1E6; // ************************************************************************* // Thanks 

October 9, 2020, 09:28 

#2 
New Member
Lucie Recurt
Join Date: Jun 2020
Posts: 17
Rep Power: 6 
I got the exact same problem... I thought it was because my geometry was complex but yours seems pretty simple. Did you figure out what was going wrong?


February 1, 2021, 14:24 

#3 
New Member
Jorge Gadelho
Join Date: Feb 2013
Posts: 22
Rep Power: 13 
Hello all,
I have the same problem using SnappyHexMesh on OpenFOAM v2012. But if I use SnappyHexMesh on OF240, it will do the snap but it will give errors in the end. Also the checkMesh gives errors. Any ideas? Thank you. My log file of the SHM until it gets stuck is this one. Code:
Create time Create mesh for time = 0 Read mesh in = 28.16 s Overall mesh bounding box : (0 0 0.384) (13 0.5 1.116) Relative tolerance : 1e06 Absolute matching distance : 1.30958e05 Reading refinement surfaces. Read refinement surfaces in = 0 s Reading refinement shells. Read refinement shells in = 0 s Setting refinement level of surface to be consistent with shells. For geometry geometry.stl detected 0 uncached triangles out of 380 Checked shell refinement in = 0 s Reading features. Read features in = 0 s Determining initial surface intersections  Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 0 Number of intersected edges : 0 Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 17021873 Number of intersected edges : 71820 Calculated surface intersections in = 27.06 s Initial mesh : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Adding patches for surface regions  Patch Type Region    geometry.stl: 5 wall geometry.stl Added patches in = 0.01 s Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 126612 Number of intersected edges : 126060 Selecting decompositionMethod none [1] Refinement phase  Found point (5 0 0) in cell 948120 on processor 0 Surface refinement iteration 0  No cells marked for refinement since reached limit 2000000. Determined cells to refine in = 3.22 s Selected for refinement : 0 cells (out of 5513454) Stopping refining since too few cells selected. Removing mesh beyond surface intersections  Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Keeping all cells containing inside points Selected for keeping : 5513454 cells. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 0 Number of intersected edges : 126060 Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Keeping all cells containing inside points Selected for keeping : 5513454 cells. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 0 Number of intersected edges : 126060 Shell refinement iteration 0  No cells marked for refinement since reached limit 2000000. Determined cells to refine in = 28.94 s Selected for internal refinement : 0 cells (out of 5513454) Stopping refining since too few cells selected. Dangling coarse cells refinement iteration 0  Determined cells to refine in = 0.16 s Selected for refinement : 0 cells (out of 5513454) Stopping refining since too few cells selected. Dangling coarse cells refinement iteration 0  Determined cells to refine in = 0.13 s Selected for refinement : 0 cells (out of 5513454) Stopping refining since too few cells selected. Refinement transition refinement iteration 0  Determined cells to refine in = 0.18 s Selected for refinement : 0 cells (out of 5513454) Stopping refining since too few cells selected. Splitting mesh at surface intersections  Introducing baffles for 126060 faces that are intersected by the surface. Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 493532 Number of intersected edges : 126060 Created baffles in = 14.92 s After introducing baffles : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Introducing baffles to block off problem cells  markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles. Analyzed problem cells in = 10 s Introducing baffles to delete problem cells. Created baffles in = 1.8 s After introducing baffles : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 493532 Number of intersected edges : 126060 Remove unreachable sections of mesh  Split mesh in = 20.46 s After subsetting : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Introducing zones for interfaces  Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Setting faceZones according to neighbouring cellZones: Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 0 Number of intersected edges : 126060 Handling cells with snap problems  Introducing baffles for 126060 faces that are intersected by the surface. Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 493532 Number of intersected edges : 126060 Created baffles in = 25.77 s After introducing baffles : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Introducing baffles to block off problem cells  markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles. Analyzed problem cells in = 9.4 s Introducing baffles to delete problem cells. Created baffles in = 1.59 s After introducing baffles : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Setting cellZones according to locationsInMesh: Location : (5 0 0) cellZone : none For cellZone none found point (5 0 0) in global region 0 out of 1 regions. Edge intersection testing: Number of edges : 17021873 Number of edges to retest : 493532 Number of intersected edges : 126060 Remove unreachable sections of mesh  Split mesh in = 20.32 s After subsetting : cells:5513454 faces:17021873 points:5997573 Cells per refinement level: 0 5513454 Merge freestanding baffles  freeStandingBaffles : detected 0 freestanding baffles out of 0 Detected freestanding baffles : 0 Merged freestanding baffles in = 3.04 s dupNonManifoldPoints : Found : 0 nonmanifold points (out of 5997573) Detected unsplittable baffles : 0 Merge refined boundary faces  Merging 100 sets of faces. Edge intersection testing: Number of edges : 17021773 Number of edges to retest : 796 Number of intersected edges : 125960 Undo iteration 0  Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with facedecomposition tet quality < 1e15 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.02 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.02 : 0 faces on cells with determinant < 0.001 : 0 Merging all points on surface that  are used by only two boundary faces and  make an angle with a cosine of more than 0.707107. Removing 100 straight edge points ... Edge intersection testing: Number of edges : 17021773 Number of edges to retest : 796 Number of intersected edges : 125960 Undo iteration 0  Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with facedecomposition tet quality < 1e15 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.02 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.02 : 0 faces on cells with determinant < 0.001 : 0 Refined mesh : cells:5513454 faces:17021773 points:5997473 Cells per refinement level: 0 5513454 Writing mesh to time 0.01 Wrote mesh in = 118.82 s. Mesh refined in = 258.68 s. Morphing phase  Duplicating 0 points on faceZones of type boundary Snapping to features in 10 iterations ... Constructing mesh displacer ... Using mesh parameters { maxNonOrtho 65; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minVol 1e13; minTetQuality 1e15; minArea 1; minTwist 0.02; minDeterminant 0.001; minFaceWeight 0.02; minVolRatio 0.01; minTriangleTwist 1; nSmoothScale 4; errorReduction 0.75; } Checking initial mesh ... Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with facedecomposition tet quality < 1e15 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0.02 : 0 faces with volume ratio of neighbour cells < 0.01 : 0 faces with face twist < 0.02 : 0 faces on cells with determinant < 0.001 : 0 Detected 0 illegal faces (concave, zero area or negative cell pyramid volume) Checked initial mesh in = 19.48 s Smoothing patch points ... Smoothing iteration 0 Found 0 nonmanifold point(s). Scaling iteration 0 Moving mesh using displacement scaling : min:1 max:1 Correcting 2D mesh motion> FOAM Warning : From void Foam::twoDPointCorrector::calcAddressing() const in file twoDPointCorrector/twoDPointCorrector.C at line 154 the number of vertices in the geometry is odd  this should not be the case for a 2D case. Please check the geometry. > FOAM Warning : From void Foam::twoDPointCorrector::calcAddressing() const in file twoDPointCorrector/twoDPointCorrector.C at line 163 The number of points in the mesh is not equal to twice the number of edges normal to the plane  this may be OK only for wedge geometries. Please check the geometry or adjust the orthogonality tolerance. Number of normal edges: 5560474 number of points: 5997473 Code:
Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with facedecomposition tet quality < 1e30 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0 : 0 faces with volume ratio of neighbour cells < 0.1 : 0 faces with face twist < 0.5 : 204 faces on cells with determinant < 0 : 0 Detected 0 error faces on boundaries that have been merged. These will be restored to their original faces. Detected 204 error faces in mesh. Restoring neighbours of faces in error. Edge intersection testing: Number of edges : 17021713 Number of edges to retest : 3180 Number of intersected edges : 125513 Snapped mesh : cells:5513454 faces:17021713 points:5997405 Cells per refinement level: 0 5513454 Writing mesh to time 0.02 Wrote mesh in = 156.13 s. Mesh snapped in = 465.99 s. Checking final mesh ... Checking faces in error : nonorthogonality > 65 degrees : 0 faces with face pyramid volume < 1e13 : 0 faces with facedecomposition tet quality < 1e30 : 0 faces with concavity > 80 degrees : 0 faces with skewness > 4 (internal) or 20 (boundary) : 0 faces with interpolation weights (0..1) < 0 : 0 faces with volume ratio of neighbour cells < 0.1 : 0 faces with face twist < 0.5 : 204 faces on cells with determinant < 0 : 0 Finished meshing with 204 illegal faces (concave, zero area or negative cell pyramid volume) Finished meshing in = 776.74 s. End Code:
Create time Create polyMesh for time = 0 Time = 0 Mesh stats points: 5997405 faces: 17021713 internal faces: 16080469 cells: 5513454 faces per cell: 6.00389 boundary patches: 6 point zones: 0 face zones: 0 cell zones: 0 Overall number of cells of each type: hexahedra: 5497975 prisms: 160 wedges: 0 pyramids: 0 tet wedges: 0 tetrahedra: 0 polyhedra: 15319 Breakdown of polyhedra by number of faces: faces number of cells 6 907 7 11304 9 2605 10 160 11 219 12 104 13 20 Checking topology... Boundary definition OK. ***Total number of faces on empty patches is not divisible by the number of cells in the mesh. Hence this mesh is not 1D or 2D. 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 inlet 3000 3311 ok (nonclosed singly connected) outlet 2360 2460 ok (nonclosed singly connected) ground 12220 13447 ok (nonclosed singly connected) top 22780 24339 ok (nonclosed singly connected) sides 774432 778070 ok (nonclosed singly connected) geometry.stl 126452 127454 ok (nonclosed singly connected) Checking geometry... Overall domain bounding box (0 0 0.384) (13 0.5 1.116) Mesh (nonempty, nonwedge) directions (1 0 1) Mesh (nonempty) directions (1 0 1) ***Number of edges not aligned with or perpendicular to nonempty directions: 59150 <<Writing 85705 points on nonaligned edges to set nonAlignedEdges Boundary openness (7.47784e16 2.83666e15 7.02473e15) OK. Max cell openness = 2.626e16 OK. Max aspect ratio = 12.0725 OK. Minimum face area = 1.393e06. Maximum face area = 0.0005. Face area magnitudes OK. Min volume = 1.193e08. Max volume = 2.5e06. Total volume = 9.61677. Cell volumes OK. Mesh nonorthogonality Max: 59.6837 average: 1.95819 Nonorthogonality check OK. Face pyramids OK. Max skewness = 2.51322 OK. Coupled point location match (average 0) OK. Failed 1 mesh checks. End 

February 2, 2021, 13:05 

#4 
New Member
Jorge Gadelho
Join Date: Feb 2013
Posts: 22
Rep Power: 13 
Hello all,
after a long trial and error strategy, finally I solved my problem. It turns out that in my case it was a problem of the boundaries. I picked an original 2D wave flume case and transformed it into a 3D. So instead of using empty boundaries in the front and back, I am using no slip, and finally I could do the SHM without errors! I hope this helps! 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[snappyHexMesh] Run snappyHexMesh steps (castellated, snap, addlayer) separately  Glc  OpenFOAM Meshing & Mesh Conversion  6  October 8, 2021 02:50 
[snappyHexMesh] SnappyHexMesh won't snap to geometry (external flow)  JTDN  OpenFOAM Meshing & Mesh Conversion  4  July 1, 2019 07:17 
[snappyHexMesh] snappyHexMesh doesnt snap  staustrahltriebwerk  OpenFOAM Meshing & Mesh Conversion  47  March 18, 2018 14:19 
[snappyHexMesh] SnappyHexMesh refine but does not snap  malaboss  OpenFOAM Meshing & Mesh Conversion  6  December 10, 2014 05:31 
[snappyHexMesh] snappyHexMesh failure to snap to geometry  Yadasol  OpenFOAM Meshing & Mesh Conversion  1  November 17, 2014 05:00 