CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] How to generate Layers at the corner (https://www.cfd-online.com/Forums/openfoam-meshing/220423-how-generate-layers-corner.html)

amin.nbkh September 6, 2019 12:17

How to generate Layers at the corner
 
3 Attachment(s)
Dear Foamers,


I've been trying for quite some time to generate a decent Mesh in a wind tunnel using helyxHexMesh (Engys version) and snappyHexMesh but the problem is that they both fail to grow layers at the corners of the duct (Image attached).
I tried with many modifications and different parameters (including featureAngle= 180 which Engys suggested for such cases) but non of them worked.
My ultimate goal is to bound y+ between 30 to 300 but the coarse grid at the corner is causing trouble particularly through the nozzle (flow of high velocity).
Is there any chance to improve it using snappy/helyxHM ?


Any Help would be highly appreciated.


Code:





/*--------------------------------*- C++ -*----------------------------------*\
|      o          |                                                          |
|    o    o      | OpenFOAM (Engys Edition):                                |
|  o  O  o      | Version: 2.1_engysEdition-1.0                            |
|    o    o      | Web:    http://www.engys.com                            |
|      o          |                                                          |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;

debug 1;

snap            true;

addLayers      true;

autoBlockMesh  false;

crackDetection  false;

geometry
{
    inlet.stl
    {
        type            triSurfaceMesh;
        name            inlet;
    }

    outlet.stl
    {
        type            triSurfaceMesh;

        name            outlet;
    }

    walls.stl
    {
        type            triSurfaceMesh;
        name            walls;
    }

}

castellatedMeshControls
{
    features
    (
        {
        file    "walls.eMesh";
        level  4;
        refineFeatureEdgeOnly  false;
        }
    );

    nCellsBetweenLevels 3;
    refinementSurfaces
    {
        walls
        {

          level          (4  6);
          refineSurfaceBoundary true;
          featureRefineAngle 20;
        }

        inlet
        {
                level          (0  0);
                patchInfo
                {
                        type    patch;
                }
        }

        outlet
        {
                level          (0  0);
                patchInfo
                {
                        type    patch;
                }
        }
    }

    refinementRegions
    {

        walls
        {
                mode            distance;
                levels          ( ( 0.015 4 ) );
        }

    }

    locationInMesh ( 0.0  0.0  0.0 );
    maxLocalCells  100000000;
    maxGlobalCells  1000000000;
    minRefinementCells 100;
    maxLoadUnbalance 0.1;
    resolveFeatureAngle -60;
    featureRefineAngle 20;
    refineSurfaceBoundary true;
    allowFreeStandingZoneFaces false;
    balanceThenRefine true;
    nGapRefinements 0;
    minZoneRegionSize 0;

}

snapControls
{
    featureEdges
    {
    }
    nOuterIter      2;
    nPreFeatureIter 0;
    nSolveIter      10;
    nFeatureIter    50;
    globalFeatureEdges true;
    globalRegionSnap false;
    nSmoothPatch    2;
    tolerance      4;
    nRelaxIter      5;
    zoneFeatureSnapping true;
    directFeatureSnapping true;
    regionFeatureLines false;
    geometryFeatureLines true;
    snapSurfBoundary true;
//    collapseTol    0.25;
}

addLayersControls
{
    layers
    {
        "walls.*"
        {
            nSurfaceLayers  8;
            fch            0.001;
            expansionRatio 1.1;
        }

    }


    relativeSizes true;
    expansionRatio 1.2;
    finalLayerThickness 0.8;



    //- 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.2;
    nGrow 0;

    // Advanced settings

    featureAngle 180;

    //- What feature angle to try merge two faces
//    featureAngleMerge 45;

    // Terminate layers at feature edges specified with this angle (0 to disable)
    featureAngleTerminate 180;

    // At non-patched sides allow mesh to slip if extrusion direction makes
    // angle larger than slipFeatureAngle.
    slipFeatureAngle 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 2.0;

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

    // Angle used to pick up medial axis points
    //minMedialAxisAngle 90;
    minMedianAxisAngle 90;

    // Maximum number of layer generation iterations
    maxLayerIter  30;

    // Try and grow around convex edges
    growConvexEdge true;

    // Try and grow around concave edges
    growConcaveEdge true;

    // Try to grow layers up non grown planar surfaces (inlets, symmetry etc)
    growUpPatches true;

    // Whether to re-balance based on predicted number of layer cells
    preBalance false;

    // Where layers collapse recover layers by this increment
    layerRecovery 1;

    nBufferCellsNoExtrude 0;
    nLayerIter 50;

}

meshQualityControls
{
    maxNonOrtho    65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      80;
    minFlatness    0.5;
    minVol          1e-14;
    minTetQuality  -1e+30;
    minArea        1e-13;
    minTwist        0.05;
    minDeterminant  0.0001;
    minFaceWeight  0.08;
    minVolRatio    0.025;
    minTriangleTwist -0.99;
    nSmoothScale    10;
    errorReduction  0.75;
}

debug          0;

mergeTolerance  1e-06;


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


boundary93 September 8, 2019 07:43

Change the featureAngle in snappyHexMesh to a value higher than 90

virengos September 9, 2019 03:03

Hi Amin,
snappyHexMesh is really a good Mesher, but the learning curve is steep. You could also mesh this simple geometry with the Salome Meca Software in just 1 run and within seconds. Let me know if you need some support to do it!
best,
Damian


All times are GMT -4. The time now is 19:05.