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

[snappyHexMesh] Snapping issue at cell level change

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AtoHM

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 10, 2023, 10:07
Default Snapping issue at cell level change
  #1
DGT
New Member
 
Damien
Join Date: Jul 2012
Posts: 4
Rep Power: 14
DGT is on a distinguished road
Hello,


I am trying to mesh a table and a beam in an external flow (see first picture below).
My table is thin (chord>2m, span~0.7m, thickness=~30mm, : it requires high splitting levels to castellated it properly in the vicinity of the leading edge/trailing edge/tip. But, in order to avoid a to fine mesh on the whole upper and lower side, I defined surfaces and a refinement level associated to these surfaces.
The second picture shows the stl discretization.

Unfortunately, the mesh projection step is ending badly as can be seen on the last picture below.


If you have already encountered this problem or know how to solve it, please tell me.


Thank you


Damien


-----------------

Here is my blockMeshDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}

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

scale   1;

xmin -4.0;
xmax 8.0;
ymin 4.5;
ymax 5.5;
zmin 1.0;
zmax 12.0;

vertices
(
    ($xmin $ymin $zmin)
    ($xmax $ymin $zmin)
    ($xmax $ymax $zmin)
    ($xmin $ymax $zmin)
    ($xmin $ymin $zmax)
    ($xmax $ymin $zmax)
    ($xmax $ymax $zmax)
    ($xmin $ymax $zmax)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (48 4 44) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    Limit_ysplit_outer
    {
        type patch;
        faces
        (
            (1 5 4 0)
        );
    }
    Limit_ymax
    {
        type patch;
        faces
        (
            (3 7 6 2)
        );
    }
    Inlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
        );
    }
    Outlet
    {
        type patch;
        faces
        (
            (2 6 5 1)
        );
    }
    Ground
    {
        type patch;
        faces
        (
            (0 3 2 1)
        );
    }
    Top
    {
        type patch;
        faces
        (
            (4 5 6 7)
        );
    }
);

// ************************************************************************* //
and here is the snappyHexMeshDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2012                                 |
|   \\  /    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       false;




geometry
{
   Beam_outer.stl
    {
        type triSurfaceMesh;
        name Beam_outer;
        regions
        {
            BEAM_WALL        {name BEAM_WALL;}
            BEAM_YSPLIT      {name BEAM_YSPLIT;}
        }
    };

    Table_outer_splitted.stl
    {
         type triSurfaceMesh;
         name Table_outer;
         regions
         {
             TABLE_UPPER_L4  {name TABLE_UPPER_L4;}
             TABLE_UPPER_L3     {name TABLE_UPPER_L3;}
             TABLE_UPPER_L2     {name TABLE_UPPER_L2;}
             TABLE_UPPER_L1     {name TABLE_UPPER_L1;}
             TABLE_UPPER_L0     {name TABLE_UPPER_L0;}
             TABLE_LOWER_L4     {name TABLE_LOWER_L4;}
             TABLE_LOWER_L3     {name TABLE_LOWER_L3;}
             TABLE_LOWER_L2     {name TABLE_LOWER_L2;}
             TABLE_LOWER_L1     {name TABLE_LOWER_L1;}
             TABLE_LOWER_L0     {name TABLE_LOWER_L0;}
             TABLE_YSPLIT     {name TABLE_YSPLIT;}
             TABLE_YMAX_TIP     {name TABLE_YMAX_TIP;}
             TABLE_TE         {name TABLE_TE;}
             TABLE_LE         {name TABLE_LE;}
         }
    };
};


castellatedMeshControls
{
 
    maxLocalCells 1000000;
    maxGlobalCells 20000000;
    minRefinementCells 20;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 2;
    features (
                {file "Table_outer.eMesh";                     level 4;}
                {file "Beam_outer.eMesh"; level 4;}
          {
            file "Table_ytip_edges.eMesh";
              levels ((0.01 5));
        }
          {
            file "Beam_corner_edges1.eMesh";
              levels ((0.025 5));
        }
        {
            file "Beam_corner_edges2.eMesh";
            levels ((0.028 5));
        }
        {
            file "Beam_corner_edges3.eMesh";
            levels ((0.025 5));
        }
        {
            file "Beam_corner_edges4.eMesh";
            levels ((0.028 5));
        }
              );
    resolveFeatureAngle 30;
    featureAngle 30;
    locationInMesh (0.1233 5.0846797987 3.33);
    allowFreeStandingZoneFaces true;


    refinementSurfaces
    {
        Beam_outer
        {
            level (4 4);
            regions
            {
            }
        }
        Table_outer
        { //Table1_5deg
            level (2 2);
            regions
            {
                TABLE_UPPER_L4           // Named region in the STL file
                {
                    level (6 6);
                    patchInfo {type wall;}
                }
                TABLE_LOWER_L4        // Named region in the STL file
                {
                    level (6 6);
                    patchInfo {type wall;}
                }
                TABLE_UPPER_L3           // Named region in the STL file
                {
                    level (5 5);
                    patchInfo {type wall;}
                }
                TABLE_LOWER_L3        // Named region in the STL file
                {
                    level (5 5);
                    patchInfo {type wall;}
                }
                TABLE_UPPER_L2           // Named region in the STL file
                {
                    level (3 4);
                    patchInfo {type wall;}
                }
                TABLE_LOWER_L2        // Named region in the STL file
                {
                    level (3 4);
                    patchInfo {type wall;}
                }
                TABLE_UPPER_L1           // Named region in the STL file
                {
                    level (2 3);
                    patchInfo {type wall;}
                }
                TABLE_LOWER_L1        // Named region in the STL file
                {
                    level (2 3);
                    patchInfo {type wall;}
                }
                TABLE_UPPER_L0           // Named region in the STL file
                {
                    level (2 3);
                    patchInfo {type wall;}
                }
                TABLE_LOWER_L0        // Named region in the STL file
                {
                    level (2 3);
                    patchInfo {type wall;}
                }

                TABLE_LE            // Named region in the STL file
                {
                    level (6 6);
                    patchInfo {type wall;}
                }
                TABLE_TE            // Named region in the STL file
                {
                    level (6 6);
                    patchInfo {type wall;}
                }
                TABLE_YMAX_TIP            // Named region in the STL file
                {
                    level (6 6);
                    patchInfo {type wall;}
                }
            }//regions
        }//Table1_5deg
    }


    refinementRegions
    {

    }
}


snapControls
{   
    nSmoothPatch 10;
    tolerance 30.0;
    nSolveIter 10;
    nRelaxIter 7;
    nFeatureSnapIter 30;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}
addLayersControls
{
    relativeSizes false;
    expansionRatio 1.2;
    firstLayerThickness 0.0005;
    minThickness 0.00005;
    nGrow 0;
    featureAngle 130;
    slipFeatureAngle 30;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedialAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 15;
    layers
    {
        Beam_5deg_mesh
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.001;
        }
        Table1_lower_wall            // Named region in the STL file
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.0005;
        }

        Table1_upper_wall            // Named region in the STL file
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.0005;
        }

        Table1_te_wall            // Named region in the STL file
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.0005;
        }
        Table1_le_wall            // Named region in the STL file
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.0005;
        }
        Table1_tip_wall            // Named region in the STL file
        {
            nSurfaceLayers 12;
            firstLayerThickness 0.001;
        }
    }
}  

meshQualityControls
{
    #include "meshQualityDict"


    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 1;
    //- Amount to scale back displacement at error points
    errorReduction 0.75;
    maxConcave 30.0;
}

// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    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 1e-6;


// ************************************************************************* //
Attached Images
File Type: jpg snapping.jpg (110.5 KB, 27 views)
DGT is offline   Reply With Quote

Old   March 13, 2023, 03:09
Default
  #2
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Hello Damien,


unfortunately, it is well known, that the output quality of sHM meshes can be compromised when using an anisotropic blockMesh to start with. This appears to be a good example. The more flat the cells are, the more artifacts start to occur e.g. at level changes, snapped edges, ... .
My best recommendation would be to add more splits in blockMesh to have more cube-shaped cells at the beginning. Sure, you will end up with more cells, but aa higher quality mesh ultimately.


Good Luck.
Yann likes this.
AtoHM is offline   Reply With Quote

Old   March 13, 2023, 12:06
Default
  #3
DGT
New Member
 
Damien
Join Date: Jul 2012
Posts: 4
Rep Power: 14
DGT is on a distinguished road
Hello Atohm,


Thank you for your answer but I am not sure to understand it when you write
Quote:
My best recommendation would be to add more splits in blockMesh to have more cube-shaped cells at the beginning
As you can see in the blockMeshDict, initials cells are already istotropic (dx=dy=dz=0.25) so it is not clear for me.


Thank you,


Damien

Last edited by DGT; March 14, 2023 at 02:18.
DGT is offline   Reply With Quote

Old   March 14, 2023, 08:13
Default
  #4
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Hello Damien,


well, I did not calculate the cell spacing initially, because I thought its what I see in the picture. This appears to be not the case, I calculated it now and it is 0.25 in all directions indeed.

However, in the picture we can see the cells are flat and not cubic. I do not see you using any entry in snappyHexMeshDict that would cause anisotropic refinement.

Maybe you ran on an (old?) blockMesh with another spacing setup? Run blockMesh alone to check the spacing in indeed resulting in cubes and work from there.
AtoHM 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] Celllevel does not satisfy 2:1 constraint zippy OpenFOAM Meshing & Mesh Conversion 1 July 30, 2024 06:58
[snappyHexMesh] SHM Bad quality snapping/terracing ryan55510 OpenFOAM Meshing & Mesh Conversion 0 April 20, 2022 21:20
Parallel computing error using multiple nodes Jingxue Wang OpenFOAM Running, Solving & CFD 11 January 14, 2018 11:51
[snappyHexMesh] Edge Refinement fracasce OpenFOAM Meshing & Mesh Conversion 3 December 2, 2017 14:30
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


All times are GMT -4. The time now is 22:49.