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

[snappyHexMesh] How to create layer that is normal to the surface of the geometry?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By hokhay

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 27, 2019, 08:52
Default How to create layer that is normal to the surface of the geometry?
  #1
Member
 
Joe lee
Join Date: Nov 2018
Posts: 59
Rep Power: 8
Jinjolee is on a distinguished road
I was trying to create a layer that is normal to the geometry edge/surface, which looks like this:


However, what I got is something like this:


Can the layer mesh be refined to something like the first figure by adjusting parameters in snappyHexMeshDict? Thanks.
Jinjolee is offline   Reply With Quote

Old   April 27, 2019, 14:35
Default
  #2
Member
 
Join Date: Nov 2014
Posts: 92
Rep Power: 12
hokhay is on a distinguished road
I cannot see any layer mesh is created on the bike. Can you check or show how many percentage of surface is covering with layer mesh from the mesh log?
hokhay is offline   Reply With Quote

Old   April 28, 2019, 03:45
Default
  #3
Member
 
Joe lee
Join Date: Nov 2018
Posts: 59
Rep Power: 8
Jinjolee is on a distinguished road
Quote:
Originally Posted by hokhay View Post
I cannot see any layer mesh is created on the bike. Can you check or show how many percentage of surface is covering with layer mesh from the mesh log?
EDIT:Please see the latest reply.

You are absolute right. I used to think those near surface mesh are the boundary layer.
I checked the log, it seems the layer mesh could not generate successfully. Could you help me to take a look in it? I will attached the mesh log file, and the below is the snappyHexMeshDict:

Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    figure
    {
        type triSurfaceMesh;
        file "figure.stl";
    }

    refinementBox
    {
        type searchableBox;
        min ( 30 180 90);
        max ( 700 1760 1850);
    }
    
};

castellatedMeshControls
{
    maxLocalCells 100000;
    maxGlobalCells 10000000;
    minRefinementCells 10;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 3;

    features
    (
        {
            file "figure.eMesh";
            level 6;
        }
    );

    refinementSurfaces
    {
        figure
        {
            level (5 6);
            patchInfo
            {
                type wall;
                inGroups (figureGroup);
            }
        }
    }

    resolveFeatureAngle 30;

    refinementRegions
    {
        refinementBox
        {
            mode inside;
            levels ((1E15 4));
        }
    }
    locationInMesh (402 1802 1002) ;
    allowFreeStandingZoneFaces true;
}



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

addLayersControls
{
    relativeSizes true;

    layers
    {
        //"(lowerWall|figure).*"
	"figure.*"
        {
            nSurfaceLayers 5;
        }
    }

    expansionRatio 1.2;
    firstLayerThickness 0.001;
    minThickness 0.0005;
    nGrow 0;
    // Advanced settings
    featureAngle 60;
    slipFeatureAngle 30;.
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 15;
}

meshQualityControls
{
    #include "meshQualityDict"
}

// Advanced
// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields     // write volScalarField for layer coverage
);

mergeTolerance 1e-6;


// ************************************************************************* //
Thank you very much!!
Attached Files
File Type: gz log.snappyHexMesh.gz (12.6 KB, 1 views)

Last edited by Jinjolee; April 28, 2019 at 11:04. Reason: This comment is no longer updated
Jinjolee is offline   Reply With Quote

Old   April 28, 2019, 04:19
Default
  #4
Member
 
Joe lee
Join Date: Nov 2018
Posts: 59
Rep Power: 8
Jinjolee is on a distinguished road
Quote:
Originally Posted by hokhay View Post
I cannot see any layer mesh is created on the bike. Can you check or show how many percentage of surface is covering with layer mesh from the mesh log?
In case you need the geometry, I will put it here. It is too big to be uploaded, so I put it to google drive:
https://drive.google.com/open?id=13G...7ODyiq2taBjuOU
Jinjolee is offline   Reply With Quote

Old   April 28, 2019, 11:04
Default
  #5
Member
 
Joe lee
Join Date: Nov 2018
Posts: 59
Rep Power: 8
Jinjolee is on a distinguished road
Fun fact: I didnt know that when relativeSizes is on, the thickness would not be absolute value anymore. Now I changed firstLayerThickness to 0.3, and now there is 83% of layers generated. Is it possible to enhance the layer %? Since there are some places did not have layer generated properly. It is shown in the image below (notice the layers on the top-left region):


And there is my snappyHexMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    figure
    {
        type triSurfaceMesh;
        file "figure.stl";
    }

    refinementBox
    {
        type searchableBox;
        min ( 30 180 90);
        max ( 700 1760 1850);
    }
    
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 100000000;
    minRefinementCells 15;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 3;

    features
    (
        {
            file "figure.eMesh";
            level 4;
        }
    );

    refinementSurfaces
    {
        figure
        {
            level (4 5);
            patchInfo
            {
                type wall;
                inGroups (figureGroup);
            }
        }
    }
    resolveFeatureAngle 20;
    refinementRegions
    {
        refinementBox
        {
            mode inside;
            levels ((1E15 4));
        }
    }
    locationInMesh (402 1802 1002) ;
    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 5;
    tolerance 1.5;
    nSolveIter 30;
    nRelaxIter 5;
        nFeatureSnapIter 10;
        implicitFeatureSnap false;
        explicitFeatureSnap true;
        multiRegionFeatureSnap false;
}

addLayersControls
{
    layers
    {
        //"(lowerWall|figure).*"
	"figure.*"
        {
            nSurfaceLayers 3;
        }
    }

    expansionRatio 1.1;
    firstLayerThickness 0.3;
    minThickness 0.05;
    nGrow 0;
    featureAngle 180;
    slipFeatureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 130;
    nBufferCellsNoExtrude 0;
    nLayerIter 15;
}

meshQualityControls
{
    #include "meshQualityDict"
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields     // write volScalarField for layer coverage
);

mergeTolerance 1e-6;


// ************************************************************************* //
Thank you very much!
Jinjolee is offline   Reply With Quote

Old   April 28, 2019, 12:34
Default
  #6
Member
 
Join Date: Nov 2014
Posts: 92
Rep Power: 12
hokhay is on a distinguished road
Quote:
Originally Posted by Jinjolee View Post
Fun fact: I didnt know that when relativeSizes is on, the thickness would not be absolute value anymore. Now I changed firstLayerThickness to 0.3, and now there is 83% of layers generated. Is it possible to enhance the layer %? Since there are some places did not have layer generated properly. It is shown in the image below (notice the layers on the top-left region):


And there is my snappyHexMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

castellatedMesh true;
snap            true;
addLayers       true;

geometry
{
    figure
    {
        type triSurfaceMesh;
        file "figure.stl";
    }

    refinementBox
    {
        type searchableBox;
        min ( 30 180 90);
        max ( 700 1760 1850);
    }
    
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 100000000;
    minRefinementCells 15;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 3;

    features
    (
        {
            file "figure.eMesh";
            level 4;
        }
    );

    refinementSurfaces
    {
        figure
        {
            level (4 5);
            patchInfo
            {
                type wall;
                inGroups (figureGroup);
            }
        }
    }
    resolveFeatureAngle 20;
    refinementRegions
    {
        refinementBox
        {
            mode inside;
            levels ((1E15 4));
        }
    }
    locationInMesh (402 1802 1002) ;
    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 5;
    tolerance 1.5;
    nSolveIter 30;
    nRelaxIter 5;
        nFeatureSnapIter 10;
        implicitFeatureSnap false;
        explicitFeatureSnap true;
        multiRegionFeatureSnap false;
}

addLayersControls
{
    layers
    {
        //"(lowerWall|figure).*"
"figure.*"
        {
            nSurfaceLayers 3;
        }
    }

    expansionRatio 1.1;
    firstLayerThickness 0.3;
    minThickness 0.05;
    nGrow 0;
    featureAngle 180;
    slipFeatureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 130;
    nBufferCellsNoExtrude 0;
    nLayerIter 15;
}

meshQualityControls
{
    #include "meshQualityDict"
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields     // write volScalarField for layer coverage
);

mergeTolerance 1e-6;


// ************************************************************************* //
Thank you very much!
83% is high number. I have found that if you have only one level of surface mesh size, the layer mesh is better. Using absolute layer thickness also help
Jinjolee likes this.
hokhay is offline   Reply With Quote

Old   April 28, 2019, 12:54
Default
  #7
Member
 
Joe lee
Join Date: Nov 2018
Posts: 59
Rep Power: 8
Jinjolee is on a distinguished road
Quote:
Originally Posted by hokhay View Post
83% is high number. I have found that if you have only one level of surface mesh size, the layer mesh is better. Using absolute layer thickness also help
Thanks for your advice, I am going to try it out now
Jinjolee is offline   Reply With Quote

Reply

Tags
layer, normal to edge, snappyhexmesh


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] snappyHexMesh generates not planar surface krzychu111 OpenFOAM Meshing & Mesh Conversion 2 April 23, 2020 17:38
[snappyHexMesh] Problem airfoil snappyhexmesh add layer bye bye my blue OpenFOAM Meshing & Mesh Conversion 1 May 5, 2017 06:56
[snappyHexMesh] SnappyHexMesh: Layer on corners Pj. OpenFOAM Meshing & Mesh Conversion 9 July 17, 2014 05:26
Actuator disk model audrich FLUENT 0 September 21, 2009 08:06
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57


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