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

[snappyHexMesh] snappyHexMesh fails adding layers

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree12Likes
  • 2 Post By biscarri
  • 5 Post By Fredvol
  • 5 Post By Fredvol

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 13, 2016, 11:00
Default snappyHexMesh fails adding layers
  #1
New Member
 
Lluís M. Biscarri
Join Date: Nov 2011
Posts: 24
Rep Power: 14
biscarri is on a distinguished road
Hi foamers,

I'm meshing a model with a wall that is a double curvature surface but I don't manage snappyHexMesh to add layers over that surface.

I attach the log file from snappyHexMesh process and the file snappyHexMeshDict.

Can somebody suggest me which parameters to change in snappyHexMeshDict in order to get layers added?

Thank you very much,

Lluis
Attached Files
File Type: gz files.tar.gz (12.5 KB, 55 views)
biscarri is offline   Reply With Quote

Old   July 19, 2016, 15:10
Default
  #2
New Member
 
Lluís M. Biscarri
Join Date: Nov 2011
Posts: 24
Rep Power: 14
biscarri is on a distinguished road
My final objective is to have a mesh with element layers to properly represent the BL of the walls in the model, in order to calculate aerodynamic forces/coefficients as much precisely as possible.

The problem arises trying to use minThickness values small enough to get simulation y+ results below 40, in a case with Re=1E7.

I use relative minThickness between 0.15 and 0.25, combining with different refinementSurfaces levels. I have managed to get meshes with 100% of the wall covered by layers for some combinations of these parameters. But I need a thinner 1st layer and snappy fails to create it if I reduce minThickness.

I keep on investigating why snappyHexMesh is not adding layers at specified surfaces, or doing it partially, in some cases. I've observed the following things:

- the problem gets worse for non-ruled surfaces (double curvature present)
- by increasing refinementSurfaces level (and making the size of the model to grow fast) I hoped to be able to reduce minThickness to my y+ requirements, but it seems not no be allways like that

I'm thinking that the problem might have relation with the worping distortion that some quadrilateral facets show after the snapping phase

I will appreciate any comment in relation with the explained problem.
biscarri is offline   Reply With Quote

Old   August 10, 2016, 04:13
Default
  #3
New Member
 
Qianchaoqun
Join Date: May 2016
Posts: 2
Rep Power: 0
Qianchaoqun is on a distinguished road
Hello biscarri,
Have you found a way out for that problem?
Qianchaoqun is offline   Reply With Quote

Old   March 21, 2018, 07:57
Default
  #4
New Member
 
Lluís M. Biscarri
Join Date: Nov 2011
Posts: 24
Rep Power: 14
biscarri is on a distinguished road
Hello ,

I come back a little late to your question, but here is the answer.

I found a better strategy to mesh boundary layers: to specify only 1 layer in SnappyHexMesh phase, which makes much easier to get a complete 1 element thick layer around de surface, and after subdivide it usig the OF command 'refineWallLayer', which divides elements in contact with surfaces. You may use it as many times you need in order to obtein the required thickness.

Hope this help.

Lluís
belier1988 and salih53 like this.
biscarri is offline   Reply With Quote

Old   August 18, 2018, 19:36
Default
  #5
Member
 
Morteza
Join Date: Jan 2018
Posts: 30
Rep Power: 8
mortezahdr is on a distinguished road
By doing so, the quality of your mesh might be reduced. You need to use checkMesh utility after using refine wall layer.
mortezahdr is offline   Reply With Quote

Old   September 18, 2018, 17:08
Default
  #6
New Member
 
FredPieri
Join Date: Mar 2018
Posts: 16
Rep Power: 8
Fredvol is on a distinguished road
Hello,


Personally I use 2 snappyhexmesh files:


the first one to generated : castellated ans snapping
and the second one with lower mesh quality criteria for the boundary.


one important parameter is : minTetQuality should be 1e-13 for castellated and snappy and -1e30 for layering.


Here my criteria for castellated ans snapping:
Code:
meshQualityControls
{
    maxNonOrtho     65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      75;
    minVol          1e-13;
    minTetQuality   1e-15;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;

    relaxed
    {
        maxNonOrtho             85;
    }
}
here my criteria for layering:


Code:
meshQualityControls
{
    maxNonOrtho     82;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      75;
    minVol          1e-13;
    minTetQuality   -1e+30;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
    relaxed
    {
        maxNonOrtho     85;
    }
}
I hope it help.
Cheers
fred
Fredvol is offline   Reply With Quote

Old   November 8, 2018, 10:38
Default trailing edge snapping and layering I
  #7
New Member
 
Clément_G's Avatar
 
Clément Gouriou
Join Date: Jun 2013
Location: Paris, France
Posts: 13
Rep Power: 12
Clément_G is on a distinguished road
Hello dear openfoamers,


I would like to better understand how does snappyhexMesh work and especially the 2d (snapping) step of this powerful utility.


In one case the SHM snapping process modifies the wall of the airfoil trailing edge (see pdf) and it provokes a very bad layering just after (picture 2). I added the first step (castellation cf. figure 1) to picture the problem.



Which parameter of the snappyHexMeshDict could be changed to avoid this wall modification and its bad consequences (picture 2)? Do I only need to put more than 3 cells in the trailing edge thickness to avoid this problem as I did it in figure 3?


Here is also my snappyHexMeshDict file for the problem illustrated by the figures 1,2 3:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.x                                   |
|   \\  /    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. Definition of all surfaces. All surfaces are of class
// searchableSurface.
// Surfaces are used
// - to specify refinement for any mesh cell intersecting it
// - to specify refinement for any mesh cell inside/outside/near
// - to 'snap' the mesh boundary to the surface
geometry
{
    foil.stl
    {
        type triSurfaceMesh;
        name foil;
    }
    sillage.stl
    {
        type triSurfaceMesh;
        name sillage;
    }
};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    // Refinement parameters
    // If local number of cells is >= maxLocalCells on any processor
    // switches from from refinement followed by balancing
    // (current method) to (weighted) balancing before refinement.
    maxLocalCells 200000;

    // Overall cell limit (approximately). Refinement will stop immediately
    // upon reaching this number so a refinement level might not complete.
    // Note that this is the number of cells before removing the part which
    // is not 'visible' from the keepPoint. The final number of cells might
    // actually be a lot less.
    maxGlobalCells 1000000;

    // The surface refinement loop might spend lots of iterations refining just a
    // few cells. This setting will cause refinement to stop if <= minimumRefine
    // are selected for refinement. Note: it will at least do one iteration
    // (unless the number of cells to refine is 0)
    minRefinementCells 5; // JD : on le met perseverant car seulement 2 points difficles

    // Allow a certain level of imbalance during refining
    // (since balancing is quite expensive)
    // Expressed as fraction of perfect balance (= overall number of cells /
    // nProcs). 0=balance always.
    maxLoadUnbalance 0.10;

    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 4;

    // Explicit feature edge refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
    features
    (
        {
            file "foil.eMesh";
            level 0;
        }        
    ); 
    

    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.

    refinementSurfaces
    {
        foil
        {
            // Surface-wise min and max refinement level
            level (6 6); // JD : valeurs etaient 6 et 7 adapte au 3D
            
            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type wall;
                inGroups (foil_g);
            }
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 30;


    // Region-wise refinement
    // ~~~~~~~~~~~~~~~~~~~~~~

    // Specifies refinement level for cells in relation to a surface. One of
    // three modes
    // - distance. 'levels' specifies per distance to the surface the
    //   wanted refinement level. The distances need to be specified in
    //   descending order.
    // - inside. 'levels' is only one entry and only the level is used. All
    //   cells inside the surface get refined up to the level. The surface
    //   needs to be closed for this to be possible.
    // - outside. Same but cells outside.

    refinementRegions
    {

        sillage
        {
            mode inside;
            levels ((1E15 2)); //le 1er chiffre ne sert à rien
        }
        
        foil
        {
           mode distance;
            levels ((1.5 4));    //le 1er chiffre spécifie la distance du raffinement autour de l'object
        }
        
    }


    // Mesh selection
    locationInMesh (40 0 0.000);
    allowFreeStandingZoneFaces true;
}


// Settings for the snapping. 
snapControls
{
    nSmoothPatch 3;
    tolerance 2; // JD : was 2 before
    nSolveIter 10;
    nRelaxIter 20;
        nFeatureSnapIter 30;
        implicitFeatureSnap true;
        explicitFeatureSnap true;
        multiRegionFeatureSnap true;
}

addLayersControls
{
    relativeSizes true; // was true
    layers
    {
        "foil_g"
        {
            nSurfaceLayers 15; // initially 4 exp ratio 1.2 thickness 0.7
        }
    }
    expansionRatio 1.2;
    finalLayerThickness 0.6; // was 0.7
    //firstLayerThickness 0.01;
    minThickness 0.01;
    nGrow 0;
    featureAngle 360;
    slipFeatureAngle 40; // 30
    nRelaxIter 3;
    nSmoothSurfaceNormals 10;
    nSmoothNormals 10;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.8;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls     // etait utlise avant modif JD
{
    #include "meshQualityDict"


    // Advanced

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


meshQualityControls
{
    maxNonOrtho     82;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      75;
    minVol          1e-13;
    minTetQuality   -1e+30;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
    relaxed
    {
        maxNonOrtho     85;
    }
}







// 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; // JD : astuce : veine fait 200m et 10cm epaisseur 


// ************************************************************************* //
Thank you very much for your explanations.


Clément
Attached Images
File Type: jpg trailing_edge_castellation.jpg (72.2 KB, 265 views)
File Type: jpg trailing_edge_layering.jpg (103.5 KB, 290 views)
File Type: jpg trailing_edge_layering_good.jpg (129.5 KB, 326 views)
Attached Files
File Type: pdf trailing_edge_snapping_spot.pdf (131.7 KB, 108 views)
Clément_G is offline   Reply With Quote

Old   March 21, 2020, 08:56
Default
  #8
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Quote:
Originally Posted by Fredvol View Post
Hello,


Personally I use 2 snappyhexmesh files:


the first one to generated : castellated ans snapping
and the second one with lower mesh quality criteria for the boundary.


one important parameter is : minTetQuality should be 1e-13 for castellated and snappy and -1e30 for layering.


Here my criteria for castellated ans snapping:
Code:
meshQualityControls
{
    maxNonOrtho     65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      75;
    minVol          1e-13;
    minTetQuality   1e-15;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;

    relaxed
    {
        maxNonOrtho             85;
    }
}
here my criteria for layering:


Code:
meshQualityControls
{
    maxNonOrtho     82;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      75;
    minVol          1e-13;
    minTetQuality   -1e+30;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
    relaxed
    {
        maxNonOrtho     85;
    }
}
I hope it help.
Cheers
fred
Hi!

Nice job! I still have a question. How do you use two MeshQualityControl in one meshing procedure? I mean, to set two varied creterions for 1. castellated and snapping 2. Add layers. How to use two MeshQualityControl in a snappyHexMesh case?

Thanks! I'm looking forward to ur reply!

Best,
Gang
Gang Wang is offline   Reply With Quote

Old   March 21, 2020, 10:12
Default Changing dict between two runs
  #9
New Member
 
FredPieri
Join Date: Mar 2018
Posts: 16
Rep Power: 8
Fredvol is on a distinguished road
Hi Wang Gang,


In my scritpt I change the dict file and rerun snappy.


Code:

  ## LAYERING 
    #change snappy dictionary
    echo ""
    echo " Meshing layers"
    echo "----------"
    echo ""

    echo "changing snappyDict"
    mv system/snappyHexMeshDict system/snappyHexMeshDict.mesh
    mv system/snappyHexMeshDict.layer system/snappyHexMeshDict

    #rerun snappyHexMesh
    echo "Rerun snappyHexMesh for layers"
    mv log.snappyHexMesh log.snappyHexMesh1
    runParallel snappyHexMesh

    #rerun snappyHexMesh
     mv log.checkMesh log.checkMesh1
    runParallel checkMesh -latestTime
Please find attached my script ( remove .txt extension)wich manage all. and my two snappy dict.
My scrip as different option , it ask the user at the begining.


I hope it help!




Allrun.sh.txt

snappyHexMeshDict.layer.txt

snappyHexMeshDict.txt
BenGher, M.W.G., Nidalsb and 2 others like this.
Fredvol is offline   Reply With Quote

Old   March 21, 2020, 10:13
Default
  #10
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Quote:
Originally Posted by Fredvol View Post
Hi Wang Gang,


In my scritpt I change the dict file and rerun snappy.


Code:

  ## LAYERING 
    #change snappy dictionary
    echo ""
    echo " Meshing layers"
    echo "----------"
    echo ""

    echo "changing snappyDict"
    mv system/snappyHexMeshDict system/snappyHexMeshDict.mesh
    mv system/snappyHexMeshDict.layer system/snappyHexMeshDict

    #rerun snappyHexMesh
    echo "Rerun snappyHexMesh for layers"
    mv log.snappyHexMesh log.snappyHexMesh1
    runParallel snappyHexMesh

    #rerun snappyHexMesh
     mv log.checkMesh log.checkMesh1
    runParallel checkMesh -latestTime
Please find attached my script ( remove .txt extension)wich manage all. and my two snappy dict.
My scrip as different option , it ask the user at the begining.


I hope it help!




Attachment 75725

Attachment 75726

Attachment 75727
Hi!

Thanks for your kind reply!

Best regards,
Gang Wang
Gang Wang is offline   Reply With Quote

Old   March 21, 2020, 10:18
Talking
  #11
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Quote:
Originally Posted by Fredvol View Post
Hi Wang Gang,


In my scritpt I change the dict file and rerun snappy.


Code:

  ## LAYERING 
    #change snappy dictionary
    echo ""
    echo " Meshing layers"
    echo "----------"
    echo ""

    echo "changing snappyDict"
    mv system/snappyHexMeshDict system/snappyHexMeshDict.mesh
    mv system/snappyHexMeshDict.layer system/snappyHexMeshDict

    #rerun snappyHexMesh
    echo "Rerun snappyHexMesh for layers"
    mv log.snappyHexMesh log.snappyHexMesh1
    runParallel snappyHexMesh

    #rerun snappyHexMesh
     mv log.checkMesh log.checkMesh1
    runParallel checkMesh -latestTime
Please find attached my script ( remove .txt extension)wich manage all. and my two snappy dict.
My scrip as different option , it ask the user at the begining.


I hope it help!




Attachment 75725

Attachment 75726

Attachment 75727
Hi!

I think we should also revise the starttime in controldict to latestime, right? To make sure the adding layer process would also start after the first two steps: castellate and snap. Right?

Best regards,
Gang
Gang Wang is offline   Reply With Quote

Old   March 21, 2020, 10:19
Default
  #12
New Member
 
FredPieri
Join Date: Mar 2018
Posts: 16
Rep Power: 8
Fredvol is on a distinguished road
In fact maybe you miss the fact that at the begining of each Snappy Dict file you have that (line 16 to 20 on my file) , which allow you to skip some step .


Code:

castellatedMesh false;

snap            false;

addLayers       true;
Fredvol is offline   Reply With Quote

Old   March 21, 2020, 10:21
Talking
  #13
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Quote:
Originally Posted by Fredvol View Post
In fact maybe you miss the fact that at the begining of each Snappy Dict file you have that (line 16 to 20 on my file) , which allow you to skip some step .


Code:

castellatedMesh false;

snap            false;

addLayers       true;
Hi!

Thanks for ur kind reminder! I also revised here.

Best,
Gang
Gang Wang is offline   Reply With Quote

Old   March 21, 2020, 12:40
Default Error in face tets issues remained in boundary layer mesh
  #14
Member
 
Gang Wang
Join Date: Oct 2019
Location: China
Posts: 64
Rep Power: 7
Gang Wang is on a distinguished road
Quote:
Originally Posted by Fredvol View Post
In fact maybe you miss the fact that at the begining of each Snappy Dict file you have that (line 16 to 20 on my file) , which allow you to skip some step .


Code:

castellatedMesh false;

snap            false;

addLayers       true;
Hi!

It seems like your method works fine compared with using the uniform meshQualityControls. But I still cannot solve this problem: Error in face tets: 975 faces with low quality or negative volume decomposition tets. I understand this because we have lower down the criterion for boundary layer mesh: maxTetquality. I think if we submited calculation ,it will crash in a few moments . So how do you deal with this issue?

Best regards,
Gang Wang
Gang Wang is offline   Reply With Quote

Reply

Tags
layers addition, snappyhexmesh 3d

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
multiRegionHeater error ordinary OpenFOAM Running, Solving & CFD 2 June 9, 2020 17:43
[snappyHexMesh] Avoiding wedge cells and folded cells while adding layers - snappyHexMesh Saideep OpenFOAM Meshing & Mesh Conversion 2 March 22, 2018 08:10
conjugateHeatFoam + interFoam farhagim OpenFOAM Programming & Development 15 July 19, 2016 07:55
[snappyHexMesh] Adding layers goes wrong with SnappyHexMesh Elise OpenFOAM Meshing & Mesh Conversion 1 April 22, 2013 02:32
[snappyHexMesh] SnappyHexMesh doesn't succeed in adding several layers eti0123456789 OpenFOAM Meshing & Mesh Conversion 5 April 9, 2013 02:36


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