CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] Collapsing layers

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By john myce

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2017, 10:56
Default Collapsing layers
  #1
New Member
 
Join Date: Mar 2017
Posts: 2
Rep Power: 0
RomCFD is on a distinguished road
Hi everyone !

I am quite new working with SHM and I'm facing issues at adding layers step.
I have tried different combinations of parameters in snappyHexMeshDict, but I can't managed to obtain my surface fully covered by layers, even with simple shapes. Most of the time, I can't go further than 80% and in this case around 60% :
Code:
patch        faces    layers   overall thickness
                               [m]       [%]
-----        -----    ------   ---       ---
wall_fluide  117651   3.53     1.1       64.7    
wall_inlet   9291     2.78     0.727     64.1    
wall_outlet1 8674     2.03     0.574     54.4    
wall_outlet2 7822     2.51     0.654     61      
wall_outlet3 8655     2.05     0.574     54.9
You can see in pictures attached an example of my issue : the 1st one is after snapping, the 2nd one is after addLayers step and the last one is the general shape of my domain.

Has anybody already met this problem with snappy ?

Thank you in advance !

Here is my snappyHexMeshDict :
Code:
/*--------------------------------*- C++ -*----------------------------------*\ 
| =========                 |                                                 | 
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           | 
|  \\    /   O peration     | Version:  4.1                                | 
|   \\  /    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       true; 
 
geometry 
{ 
//CellZones 
    Entree.stl 
    { 
        type triSurfaceMesh; 
        name Entree; 
    } 
    Sortie1.stl 
    { 
        type triSurfaceMesh; 
        name Sortie1; 
    } 
    Sortie2.stl 
    { 
        type triSurfaceMesh; 
        name Sortie2; 
    } 
    Sortie3.stl 
    { 
        type triSurfaceMesh; 
        name Sortie3; 
    } 
    Fluide.stl 
    { 
        type triSurfaceMesh; 
        name Fluide; 
    } 
 
//Conditions limites 
    inlet.stl 
    { 
        type triSurfaceMesh; 
        name  inlet; 
    } 
    outlet1.stl 
    { 
        type triSurfaceMesh; 
        name  outlet1; 
    } 
    outlet2.stl 
    { 
        type triSurfaceMesh; 
        name  outlet2; 
    } 
    outlet3.stl 
    { 
        type triSurfaceMesh; 
        name  outlet3; 
    } 
    wall_fluide.stl 
    { 
        type triSurfaceMesh; 
        name  wall_fluide; 
    } 
    wall_inlet.stl 
    { 
        type triSurfaceMesh; 
        name  wall_inlet; 
    } 
    wall_outlet1.stl 
    { 
        type triSurfaceMesh; 
        name  wall_outlet1; 
    } 
    wall_outlet2.stl 
    { 
        type triSurfaceMesh; 
        name  wall_outlet2; 
    } 
    wall_outlet3.stl 
    { 
        type triSurfaceMesh; 
        name  wall_outlet3; 
    } 
 
}; 
 
castellatedMeshControls 
{ 
    // Refinement parameters 
    // ~~~~~~~~~~~~~~~~~~~~~ 
 
    maxGlobalCells           12000000 ; 
    maxLocalCells           4000000 ; 
    minRefinementCells      10 ; 
    maxLoadUnbalance        0.10 ; 
    nCellsBetweenLevels      2 ; 
 
    // Explicit feature edge refinement 
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 
    features 
    ( 
        { 
            file "inlet.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "outlet1.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "outlet2.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "outlet3.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "wall_fluide.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "wall_inlet.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "wall_outlet1.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "wall_outlet2.eMesh" ; 
            level  3 ; 
        } 
        { 
            file "wall_outlet3.eMesh" ; 
            level  3 ; 
        } 
    ); 
 
    // Surface based refinement 
    // ~~~~~~~~~~~~~~~~~~~~~~~~ 
    refinementSurfaces 
    { 
        inlet 
        { 
            level ( 0  1 ); 
            patchInfo 
            { type patch; } 
        } 
        outlet1 
        { 
            level ( 0  1 ); 
            patchInfo 
            { type patch; } 
        } 
        outlet2 
        { 
            level ( 0  1 ); 
            patchInfo 
            { type patch; } 
        } 
        outlet3 
        { 
            level ( 0  1 ); 
            patchInfo 
            { type patch; } 
        } 
        wall_fluide 
        { 
            level ( 0  2 ); 
            patchInfo 
            { type wall; } 
        } 
        wall_inlet 
        { 
            level ( 0  2 ); 
            patchInfo 
            { type wall; } 
        } 
        wall_outlet1 
        { 
            level ( 0  2 ); 
            patchInfo 
            { type wall; } 
        } 
        wall_outlet2 
        { 
            level ( 0  2 ); 
            patchInfo 
            { type wall; } 
        } 
        wall_outlet3 
        { 
            level ( 0  2 ); 
            patchInfo 
            { type wall; } 
        } 
        Entree 
        { 
            level (0 0); 
            faceZone        Entree; 
            cellZone        Entree; 
            zone inside true; 
        } 
        Sortie1 
        { 
            level (0 0); 
            faceZone        Sortie1; 
            cellZone        Sortie1; 
            zone inside true; 
        } 
        Sortie2 
        { 
            level (0 0); 
            faceZone        Sortie2; 
            cellZone        Sortie2; 
            zone inside true; 
        } 
        Sortie3 
        { 
            level (0 0); 
            faceZone        Sortie3; 
            cellZone        Sortie3; 
            zone inside true; 
        } 
        Fluide 
        { 
            level (0 0); 
            faceZone        Fluide; 
            cellZone        Fluide; 
            zone inside true; 
        } 
 
    } 
 
    // Feature angle: 
    resolveFeatureAngle      30 ; 
 
    //- Optional increment (on top of max level) in small gaps 
    //gapLevelIncrement 2; 
 
    planarAngle 30; 
 
    // Region-wise refinement 
    // ~~~~~~~~~~~~~~~~~~~~~~ 
 
    refinementRegions 
    { 
 
    } 
 
    // Mesh selection 
    // ~~~~~~~~~~~~~~ 
 
    locationInMesh ( 0  0  0 ); 
 
    allowFreeStandingZoneFaces true; 
 
    // Optional: do not remove cells likely to give snapping problems 
    // handleSnapProblems false; 
 
    // Optional: switch off topological test for cells to-be-squashed 
    //           and use geometric test instead 
    //useTopologicalSnapDetection false; 
} 
 
snapControls 
{ 
    nSmoothPatch 3; 
    tolerance 1.0; 
 
    // Number of mesh displacement relaxation iterations. 
    nSolveIter 300; 
 
    // Maximum number of snapping relaxation iterations. Should stop 
    // before upon reaching a correct mesh. 
    nRelaxIter 5; 
 
    // Feature snapping 
        nFeatureSnapIter 10; 
 
        // Detect (geometric only) features by sampling the surface 
        // (default=false). 
        implicitFeatureSnap false;  
 
        // Use castellatedMeshControls::features (default = true) 
        explicitFeatureSnap true; 
 
        // Detect features between multiple surfaces 
        // (only for explicitFeatureSnap, default = false) 
        multiRegionFeatureSnap false; 
 
    // wip: disable snapping to opposite near surfaces (revert to 22x behaviour) 
    // detectNearSurfacesSnap false; 
} 
addLayersControls 
{ 
 
    // Are the thickness parameters below relative to the undistorted 
    // size of the refined cell outside layer (true) or absolute sizes (false). 
    relativeSizes true;
 
        // Expansion factor for layer mesh 
        expansionRatio      1.2; 
 
        // Wanted thickness of the layer furthest away from the wall. 
        // If relativeSizes this is relative to undistorted size of cell 
        // outside layer. 
        //finalLayerThickness 0.5; 
 
        // Wanted thickness of the layer next to the wall. 
        // If relativeSizes this is relative to undistorted size of cell 
        // outside layer. 
        firstLayerThickness 0.1; 
 
        // Wanted overall thickness of layers. 
        // If relativeSizes this is relative to undistorted size of cell 
        // outside layer. 
        //thickness 0.5 
 
    // Minimum overall thickness of total layers. If for any reason layer 
    // cannot be above minThickness do not add layer. 
    // If relativeSizes this is relative to undistorted size of cell 
    // outside layer.. 
    minThickness 1e-30; 
 
    // Per final patch (so not geometry!) the layer information 
    // Note: This behaviour changed after 21x. Any non-mentioned patches 
    //       now slide unless: 
    //          - nSurfaceLayers is explicitly mentioned to be 0. 
    //          - angle to nearest surface < slipFeatureAngle (see below) 
 
    layers 
    { 
        wall_fluide 
        { 
            nSurfaceLayers  5 ; 
            firstLayerThickness 0.1; 
        } 
        wall_inlet 
        { 
            nSurfaceLayers  5 ; 
            firstLayerThickness 0.1; 
        } 
        wall_outlet1 
        { 
            nSurfaceLayers  5 ; 
            firstLayerThickness 0.1; 
        } 
        wall_outlet2 
        { 
            nSurfaceLayers  5 ; 
            firstLayerThickness 0.1; 
        } 
        wall_outlet3 
        { 
            nSurfaceLayers  5 ; 
            firstLayerThickness 0.1; 
        } 
 
    } 
 
    nGrow 0; 
 
    // Advanced settings 
 
    // Static analysis of starting mesh 
 
        // When not to extrude surface. 0 is flat surface, 90 is when two faces 
        // are perpendicular 
        featureAngle  270 ; 
 
        // Stop layer growth on highly warped cells 
        maxFaceThicknessRatio 0.5; 
 
    // Patch displacement 
 
        // 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; 
 
    // Medial axis analysis 
 
        // Angle used to pick up medial axis points 
        // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 
        // in 17x. 
        minMedialAxisAngle 90; 
        minMedianAxisAngle 90; 
 
        // Reduce layer growth where ratio thickness to medial 
        // distance is large 
        maxThicknessToMedialRatio 0.3; 
 
        // Optional: limit the number of steps walking away from the surface. 
        // Default is unlimited. 
        //nMedialAxisIter 10; 
 
        // Optional: smooth displacement after medial axis determination. 
        // default is 0. 
        //nSmoothDisplacement 90; 
 
        // (wip)Optional: do not extrude a point if none of the surrounding points is 
        // not extruded. Default is false. 
        //detectExtrusionIsland true; 
 
    // Mesh shrinking 
 
        // Optional: at non-patched sides allow mesh to slip if extrusion 
        slipFeatureAngle 70; 
 
        // Maximum number of snapping relaxation iterations. Should stop 
        // before upon reaching a correct mesh. 
        nRelaxIter 5; 

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

        //nRelaxedIter 20; 
 
        // Additional reporting: if there are just a few faces where there 
        // are mesh errors (after adding the layers) print their face centres. 
        // This helps in tracking down problematic mesh areas. 
        //additionalReporting true; 
} 
 
// Generic mesh quality settings. At any undoable phase these determine 
// where to undo. 
meshQualityControls 
{ 
    // Specify mesh quality constraints in separate dictionary so can 
    // be reused (e.g. checkMesh -meshQuality) 
    #include "meshQualityDict" 
 
    // 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 70; 
    } 
 
    //minFlatness 0.5; 
 
    // Advanced 
 
        // Number of error distribution iterations 
        nSmoothScale 4; 
        // amount to scale back displacement at error points 
        errorReduction 0.75; 
} 
 
// Merge tolerance. Is fraction of overall bounding box of initial mesh. 
// Note: the write tolerance needs to be higher than this. 
mergeTolerance 1e-6; 
 
 
// ************************************************************************* //
And my meshQualityDict :
Code:
/*--------------------------------*- C++ -*----------------------------------*\ 
| =========                 |                                                 | 
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           | 
|  \\    /   O peration     | Version:  4.1                                 | 
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      | 
|    \\/     M anipulation  |                                                 | 
\*---------------------------------------------------------------------------*/ 
FoamFile 
{ 
    version     2.0; 
    format      ascii; 
    class       dictionary; 
    object      meshQualityDict; 
} 
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 
 
//- Maximum non-orthogonality allowed. Set to 180 to disable. 
maxNonOrtho 65; 
 
//- Max skewness allowed. Set to <0 to disable. 
maxBoundarySkewness 4; 
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-15; 
 
//- 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. This is the determinant of all 
//  the areas of internal faces. It is a measure of how much of the 
//  outside area of the cell is to other cells. The idea is that if all 
//  outside faces of the cell are 'floating' (zeroGradient) the 
//  'fixedness' of the cell is determined by the area of the internal faces. 
//  1 = hex, <= 0 = folded or flattened illegal cell 
minDeterminant 0.001; 
 
//- Relative position of face in relation to cell centres (0.5 for orthogonal 
//  mesh) (0 -> 0.5) 
minFaceWeight 0.05; 
 
//- Volume ratio of neighbouring cells (0 -> 1) 
minVolRatio 0.01; 
 
//- Per triangle normal compared to average normal. Like face twist 
//  but now per (face-centre decomposition) triangle. Must be >0 for Fluent 
//  compatibility 
minTriangleTwist -1; 
 
//- if >0 : preserve cells with all points on the surface if the 
//  resulting volume after snapping (by approximation) is larger than 
//  minVolCollapseRatio times old volume (i.e. not collapsed to flat cell). 
//  If <0 : delete always. 
//minVolCollapseRatio 0.1; 
 
// ************************************************************************* //
Attached Images
File Type: jpg before_addLayers.jpg (129.5 KB, 375 views)
File Type: jpg after_addLayers.jpg (131.2 KB, 385 views)
File Type: jpg overview.jpg (122.5 KB, 256 views)
RomCFD is offline   Reply With Quote

Old   March 29, 2017, 13:01
Default
  #2
Senior Member
 
Join Date: Nov 2010
Location: USA
Posts: 1,232
Rep Power: 25
me3840 is on a distinguished road
I find turning off the min tet quality metric helps a lot.

Also consider putting a single prism layer over that face you have with none in your images, it can help keep them from collapsing in the corner.

Obviously you also have some snapping issues there. Can you remove some of the edge refinement? Try turning up the number of feature snap iterations and a lower mesh displacement relaxation amount.
me3840 is offline   Reply With Quote

Old   March 31, 2017, 11:23
Default
  #3
New Member
 
Join Date: Mar 2017
Posts: 2
Rep Power: 0
RomCFD is on a distinguished road
Hello !

Thank you for your answer. Indeed, I had obvious snapping issues in this case and they have been solved by increasing snap feature iterations and disabling the minTetQuality as you suggested.
Else I tried your other advices but they didn't solve completely the layering issue. I managed to have perfect layers on top and bottom cylinders which are aligned with the coordinate system (see img 1), but on the side cylinders the layering process seems to remove some cells (img 2 & 3). The checkMesh says it is ok but it will certainly have an impact on the simulation next.

Also, it's a bit out of the subject but I discovered that snappy didn't create my cellZones(Entree, Sortie.. and Fluide ) as I wanted :
Code:
Time:constant  cells:522769  faces:1616293  points:575123  patches:9   bb:(-330.706645193 -5 -304) (330.707619973 205 304.000000914)
cellZones:
    Entree    size:0
    Sortie1    size:16739
    Sortie2    size:0
    Sortie3    size:0
    Fluide    size:453633
Yet, I have imported the 5 cellZones as stl (closed surfaces) in the geometry part and declared them in castellated part. Is this the good method to add directly cellZones with SHM ?
Attached Images
File Type: jpg BL_up100.jpg (192.7 KB, 233 views)
File Type: jpg BL_side_before.jpg (193.9 KB, 200 views)
File Type: jpg BL_side.jpg (193.3 KB, 209 views)
__________________
OpenFoam 4.1
RomCFD is offline   Reply With Quote

Old   November 29, 2019, 11:02
Default
  #4
Member
 
Join Date: Feb 2018
Posts: 58
Rep Power: 8
Kahnbein.Kai is on a distinguished road
Hello,
i know its an old post, but i got the same problem.

These are my option at SnappyHexMesh
Code:
Solver iterations: 150
Relax iterations: 30
Max mesh conformation iterations: 30
Feature angle: 270°
Slip feature angle: 75°
I got these collapsing Layers at the edges, like in the pictur.


Does someone got any suggestions to avoid this ?



Best regards
Kai
Attached Images
File Type: jpg layer.jpg (174.7 KB, 237 views)
Kahnbein.Kai is offline   Reply With Quote

Old   January 17, 2020, 04:42
Default
  #5
Member
 
Join Date: Sep 2018
Location: France
Posts: 62
Rep Power: 8
john myce is on a distinguished road
Hello Kai,

I don't know if you have solved your problem since November. I'm trying to investigate how snappyHexMesh is working and I've found that if you increase your nSmoothSurfaceNormals iteration from 10 to 50, it can help to have a better distribution of prism layers over a surface.

Furthermore, having a feature angle (for the addlayer controls) more than 180 degrees even 150 degrees does not change so much the quality of the mesh. On the contrary it can produce the opposite effect on the mesh quality.

And finally I don't know if you have decreased the resolvefeatureangle (around 15 degrees for the castellated mesh) which can help to add layer on sharp surface.

Cheers,
belier1988 and Kahnbein.Kai like this.
john myce is offline   Reply With Quote

Old   January 18, 2020, 02:39
Default
  #6
Member
 
Join Date: Feb 2018
Posts: 58
Rep Power: 8
Kahnbein.Kai is on a distinguished road
Hey John,
yes i solve this problem, i use cfMesh, to create the boundary layers.


I will try your suggestions, it has to be possibly to create a proper mesh with SHM.


Best regards
Kai
Kahnbein.Kai is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] Layers collapsing max.pow OpenFOAM Meshing & Mesh Conversion 6 October 15, 2021 06:54
[snappyHexMesh] Collapsing layers michi.ka OpenFOAM Meshing & Mesh Conversion 6 September 22, 2018 10:20
[snappyHexMesh] Layers collapsing problem Manideep Reddy OpenFOAM Meshing & Mesh Conversion 2 March 12, 2018 08:09
[snappyHexMesh] SHM addLayers problem: boundary layers collapsing on a patch DOFuser OpenFOAM Meshing & Mesh Conversion 1 October 22, 2015 09:09
[snappyHexMesh] Collapsing Layers Tim_Simon OpenFOAM Meshing & Mesh Conversion 5 August 2, 2015 23:51


All times are GMT -4. The time now is 00:50.