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] SnappyHexMesh do not add layers (https://www.cfd-online.com/Forums/openfoam-meshing/253167-snappyhexmesh-do-not-add-layers.html)

Ryôzanpaku Tiger November 28, 2023 09:16

SnappyHexMesh do not add layers
 
1 Attachment(s)
Dear all,

I would like to add layers around a small cylindrical hole in a very thin plate (width = 1 mm), but the layers are not added with the log "no layers to generate".

Here is the snappyHexMeshDict:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v2306                                |
|  \\  /    A nd          | Website:  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      true;

geometry
{
    pipe.stl    { type triSurfaceMesh; name pipe;  }
    inlet.stl    { type triSurfaceMesh; name inlet;  }
    outlet.stl  { type triSurfaceMesh; name outlet; }
    plane.stl    { type triSurfaceMesh; name plane;
        regions
        {
            plane_back  {name plane_back;  }
            plane_bottom {name plane_bottom;}
            plane_front  {name plane_front; }
            plane_hole1  {name plane_hole1; }
            plane_hole2  {name plane_hole2; }
            plane_hole3  {name plane_hole3; }
            plane_hole4  {name plane_hole4; }
            plane_hole5  {name plane_hole5; }
            plane_hole6  {name plane_hole6; }
            plane_left  {name plane_left;  }
            plane_right  {name plane_right; }
            plane_top    {name plane_top;  }
        }
    }
}


// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    maxGlobalCells 15000000;
    maxLocalCells  5000000;
    maxLoadUnbalance 0.1;
    minRefinementCells 0;
    nCellsBetweenLevels 3;

    features
    (
        { file "pipe.extendedFeatureEdgeMesh";  level 2; }
        { file "plane.extendedFeatureEdgeMesh";  level 2; }
    );

    refinementSurfaces
    {
        pipe  { level (2 2); patchInfo { type patch; } }
        inlet    { level (2 2); patchInfo { type patch; } }
        outlet  { level (2 2); patchInfo { type patch; } }
        plane
        {
            level (2 2);
            patchInfo { type patch; }
            regions
            {
                plane_hole1 { level (4 5); }
                plane_hole2 { level (4 5); }
                plane_hole3 { level (4 5); }
                plane_hole4 { level (4 5); }
                plane_hole5 { level (4 5); }
                plane_hole6 { level (4 5); }
            }
        }
    }

    resolveFeatureAngle 30;
    refinementRegions { }
    locationsInMesh
    (
        ( (0.0081 0.0001 0.0049) fluid    )
        ( (0.0139 0.0001 0.0001) pipe  )
        ( (0.0001 0.0001 0.0001) plane )
    );
    allowFreeStandingZoneFaces false;
}

// Settings for the snapping.
snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 100;
    nRelaxIter 5;
    nFeatureSnapIter 10;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}

addLayersControls
{
    layers
    {
        plane_hole1  { nSurfaceLayers 3; }
        plane_hole2  { nSurfaceLayers 3; }
        plane_hole3  { nSurfaceLayers 3; }
        plane_hole4  { nSurfaceLayers 3; }
        plane_hole5  { nSurfaceLayers 3; }
        plane_hole6  { nSurfaceLayers 3; }
    }

    relativeSizes yes;
    expansionRatio 1.1;
//    firstLayerThickness 0.3;
    finalLayerThickness 0.3;
    minThickness 0.05;
    nGrow 0;
    featureAngle 150;

    maxFaceThicknessRatio 0.5;
    nSmoothSurfaceNormals 1;
    nSmoothThickness 10;

    minMedialAxisAngle 90;
    maxThicknessToMedialRatio 0.3;
    nSmoothNormals 3;

    nRelaxIter 5;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 75;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minFlatness 0.5;
    minVol 1e-30;
    minTetQuality 1e-30;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

mergeTolerance 1e-6;

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

I also tried to use absolute values, like
Code:

    relativeSizes no;
    expansionRatio 1.1;
    firstLayerThickness 0.00005;
 //  finalLayerThickness 0.3;
    minThickness 0.00005;

but it didn't work either.

I would very appreciate any hint on how to get the layers to work. Thank you!

AtoHM November 28, 2023 09:38

Hi,
on first look I would think it should work, I hope not to miss something obvious. It could be beneficial if you provided the log file.


What can stop the layers from growing is a clash with any of the quality metrics. I see you are not completely using the default values, or, at least I spotted "minFlatness" which is not in the ESI 2112 version: https://www.openfoam.com/documentati...shquality.html it might be "minFaceFlatness" but its inactive by default. You can try with the default setting, maybe it helps.

Ryôzanpaku Tiger November 28, 2023 10:19

1 Attachment(s)
Dear AtoHM,

thank you very much for the reply and for the hint! I will try to use the default quality metrics.

Meanwhile, I attach the log file. I would very appreciate if you could take a look.

Thanks again for the help!

Ryôzanpaku Tiger November 28, 2023 10:43

UPDATE: I tried the following quality metrics:
Code:

    maxNonOrtho 75;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-30;
    minTetQuality -1e+30;
//    minVolCollapseRation 0.5;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minFaceFlatness -1;
    minVolRatio 0.01;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;

but unfortunately, there is still "No layers generated".

I would very appreciate further help!

Yann November 28, 2023 10:48

Hello folks,

It seems you are meshing a multiregion case, according to the use of locationsInMesh.

For such case, snappy creates interfaces during the meshing process, as you can see in your log file :

Code:

Adding patches for face zones
-----------------------------

Patch Type                Name                          FaceZone                      FaceType 
----- ----                ----                          --------                      -------- 
24    wall                fluid_to_plane            fluid_to_plane            internal 
25    wall                plane_to_fluid            fluid_to_plane            internal 
26    wall                fluid_to_pipe              fluid_to_pipe              internal 
27    wall                pipe_to_fluid              fluid_to_pipe              internal

This is very handy on multiregion cases because it allows to add layers only on one side of the interface. (typically you want to add layers on the fluid side, not on the solid side).
To do so, you will have to use these names in your layer definition. (for instance fluid_to_plane)

I hope I didn't say anything stupid because it's been a while I didn't run a multiregion case.

Regards,
Yann

Ryôzanpaku Tiger November 28, 2023 10:55

Dear Yann,

thank you for the help! Yes, I do mesh a multi-region case. At first, I didn't want to create the layers over the whole plane, but over the holes only. I thought it was possible. But may be not in the multi-region case?

However, eventually I will need to have the layers over the whole plane, therefore, I will try to use the patch names as you suggest.

Thank you very much for the help!

Ryôzanpaku Tiger November 28, 2023 15:32

Dear Yann,

thank you for the hint! I tried using the interface patches and it worked. Now I am getting the layers at all interfaces: fluid-pipe, fluid-plane.

Thank you again for the help!


All times are GMT -4. The time now is 12:32.