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

[snappyHexMesh] Trouble with snappy and boundary layers

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By LVDH
  • 1 Post By simrego

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 28, 2009, 12:15
Question Trouble with snappy and boundary layers
  #1
New Member
 
David
Join Date: Apr 2009
Posts: 3
Rep Power: 17
kellard is on a distinguished road
Hi!

I have a problem with boundary layer addition producing strange "blobs" on edges of the geometry. The snapping works well but the "blobs" appear after adding layers.
I'm attaching images from the stl file and from the snapping procedure, both with and without BL.
I have also attached blockMeshDict and snappyHexMeshDict.
We have managed to produce more complicated meshes before with these settings and the .stl file seems to have high quality??

Unfortunately the mesh is quite large (5M cells).

Platform:
linux64

Version:
1.5.x

Thanks
Attached Images
File Type: jpg blob.jpg (53.0 KB, 300 views)
File Type: png stl.png (91.1 KB, 241 views)
File Type: jpg no_BL.jpg (93.8 KB, 260 views)
Attached Files
File Type: gz dicts.tar.gz (4.8 KB, 15 views)
kellard is offline   Reply With Quote

Old   April 30, 2009, 07:05
Default
  #2
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
hi kellard,

yes, this problem is very well known here. there is no chance to "smooth" the surface from those blobs. i think you have to wait till the new OF version comes out and brings the new snappyhexmesh with the featureEdgeLines tool.
wolle1982 is offline   Reply With Quote

Old   April 30, 2009, 08:56
Default
  #3
New Member
 
David
Join Date: Apr 2009
Posts: 3
Rep Power: 17
kellard is on a distinguished road
Thanks Wolfgang for your replay. Do you know why the blobs appear? Can I avoid them?
Thanks again!
kellard is offline   Reply With Quote

Old   April 30, 2009, 10:16
Default
  #4
Senior Member
 
Wolfgang Heydlauff
Join Date: Mar 2009
Location: Germany
Posts: 136
Rep Power: 21
wolle1982 will become famous soon enough
hi kellard,

no sorry, no idea. i have to live with it. actually I am moving on to another (commercial) mesher that meshes geometries mainly automatically with full control influence of me. it also creates a nice boundary layer. It can do hex and prism BL. and it is not that expensive (like gridgen e.g.). its called castnet.
wolle1982 is offline   Reply With Quote

Old   April 30, 2009, 10:25
Default
  #5
New Member
 
David
Join Date: Apr 2009
Posts: 3
Rep Power: 17
kellard is on a distinguished road
Hi Wolfgang
ok, thanks for helping me. Maybe I do the same and take a look at that commercial mesher.
kellard is offline   Reply With Quote

Old   January 12, 2011, 10:27
Default
  #6
New Member
 
Join Date: Nov 2009
Location: Germany
Posts: 8
Rep Power: 17
DanielPT is on a distinguished road
Hi,

I have some strange problems with layer generation in snappyHexMesh. Would be great, when somebody knows how to face the problem.

I attached a photo and my snappyHexMeshDict below.

Thanks in advance!

Daniel
Attached Images
File Type: jpg layer.jpg (100.7 KB, 130 views)
Attached Files
File Type: gz snappyHexMeshDict.tar.gz (3.4 KB, 6 views)

Last edited by DanielPT; January 12, 2011 at 12:14.
DanielPT is offline   Reply With Quote

Old   January 3, 2019, 11:32
Default
  #7
New Member
 
Kevin Habrock
Join Date: Oct 2018
Posts: 22
Rep Power: 8
Kevin.H is on a distinguished road
Hello Guys and happy new year
I try to simulate a simple case of a chtMultiRegion with two cylinders (Glocke, Magnet). Itīs my first simulation which combines chtMultiregion and so maybe I made a bad mistake.

I have the proplem, that snappyHexMesh doesnīt create my Prismlayers on one specific face (Magnet_outerface) and I have no idea where the Problem is. Maybe somebody can help me.?


Faces:
Magnet.stl:
Magnet_outerface -> here I would like to implement some prismlayers
Magnet_interface

Glocke.stl
Glocke_inlet
Glocke_interface

Code:
 
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  5                                     |
|   \\  /    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
{
    Glocke.stl
    {
    type triSurfaceMesh; name Glocke;
    }
    Magnet.stl
    {
    type triSurfaceMesh; name Magnet;  
    }
//Cylinder {
//type searchableCylinder;
//point1 (0 0 -0.2);
//point2 (0 0 0.2);
//radius 0.2;
//}
   
};
 
// 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 100000;
    // 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 2000000;
    // 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 10;
    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 2;
 
    // 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 "Glocke.eMesh";
            level 2;
        }
        {
            file "Magnet.eMesh";
            level 2;
        }
       
    );
 
    // 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
    {
        Glocke
        {
            // Surface-wise min and max refinement level
            level (2 2);
            faceZone Glocke;
            cellZone Glocke;
            cellZoneInside inside;
        }
        Magnet
        {
            // Surface-wise min and max refinement level
            level (2 2);
            faceZone Magnet;
            cellZone Magnet;
            cellZoneInside inside;
        }

    
    }
    // Resolve sharp angles
    resolveFeatureAngle 10;

    // 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
    {
//        Cylinder
//        {
//            mode inside;
//            levels ((1 1));
//        }
    }

    // Mesh selection
    // ~~~~~~~~~~~~~~
    // After refinement patches get added for all refinementSurfaces and
    // all cells intersecting the surfaces get put into these patches. The
    // section reachable from the locationInMesh is kept.
    // NOTE: This point should never be on a face, always inside a cell, even
    // after refinement.
    locationInMesh (0.1 0.1 0.01);

    // Whether any faceZones (as specified in the refinementSurfaces)
    // are only on the boundary of corresponding cellZones or also allow
    // free-standing zone faces. Not used if there are no faceZones.
    allowFreeStandingZoneFaces false;
}
 
// Settings for the snapping.
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 3;
    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 1.0;
    //- Number of mesh displacement relaxation iterations.
    nSolveIter 30;
    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 5;
    //- Highly experimental and wip: number of feature edge snapping
    //  iterations. Leave out altogether to disable.
    //  Of limited use in this case since faceZone faces not handled.
    nFeatureSnapIter 10;
}
 
// Settings for the layer addition.
addLayersControls
{
    relativeSizes true;
    // Per final patch (so not geometry!) the layer information
    layers
    {
        Glocke.stl_Glocke_outerface
        {
            nSurfaceLayers 3;
        }
    }
    // Expansion factor for layer mesh
    expansionRatio 1.3;
    // Wanted thickness of final added cell layer. If multiple layers
    // is the thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // See relativeSizes parameter.
    finalLayerThickness 1;
    // 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.1;
    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
    nGrow 0;
    // Advanced settings
    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 90;
    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 3;
    // 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 2;
    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;
    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 1;
    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
    minMedianAxisAngle 90;
    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;
    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 50;
}
 
// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
     #include "meshQualityDict"
    maxNonOrtho 65;
    minVol 1e-13;
    minDeterminant 0.001;
    minFaceWeight 0.05; 
    minVolRatio 0.01;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minArea 1e-13
    minTetQuality 1e-30;
    minTwist 0.05;
    minTriangleTwist -1;
    // Advanced
    //- Number of error distribution iterations
    nSmoothScale 4;
    //- Amount to scale back displacement at error points
    errorReduction 0.75;
}

// Advanced
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;

// ************************************************************************* //
I have tried also:
Code:
   
 layers
       {
        "(Glocke_outerface|Glocke_.*)"   
       {
       nSurfaceLayers 3;
       }
       }
 
(...)
When I look at my Picture 2, I can see a yellow and a blue cirqule around my regions. So maybe I have to combine them ?!

Thank you for your help!
Attached Images
File Type: png Assembly.png (31.0 KB, 44 views)
File Type: jpg Simulation.JPG (25.4 KB, 32 views)
File Type: jpg Mesh.jpg (200.4 KB, 53 views)
Kevin.H is offline   Reply With Quote

Old   January 9, 2019, 07:59
Default
  #8
New Member
 
Kevin Habrock
Join Date: Oct 2018
Posts: 22
Rep Power: 8
Kevin.H is on a distinguished road
Or maybe I should ask on a other way.
how can I implement faces of an STL Document in snappyHexMesh to generate some Layers?
Is there any special thing which I have to do when I use chtmultiRegion?

Iīve read about those two ways:
Code:
    layers
    {
        Glocke.stl_Glocke_outerface
        {
            nSurfaceLayers 3;
        }
    }
Code:
    {
        "(Glocke_outerface|Glocke_.*)" 
    
     
        {
            nSurfaceLayers 3;
        }
    }
Best regards

Edit: Has somebody maybe an easy case with with multiRegion snappyHexMesh and prismlayer?
I found some cases in the Internet, but all without the prismlayers.

Last edited by Kevin.H; January 9, 2019 at 10:34.
Kevin.H is offline   Reply With Quote

Old   February 7, 2019, 06:24
Default
  #9
Member
 
LVDH's Avatar
 
Andre Z
Join Date: Dec 2009
Posts: 75
Rep Power: 17
LVDH is on a distinguished road
I think you have to use a ".com" version of OpenFOAM. I used v1806:
Code:
/*-----------------------------------------------------------------------------




 __  __                                         ______   ____ _      __
|  \/  |   _    _   _ _____ ___ _   _ __  __   / __/ /  / __ \ | /| / /
| \  / |  / \  | \ | |_   _|_ _| | | |  \/  | / _// /__/ /_/ / |/ |/ /
| |\/| | / _ \ |  \| | | |  | || | | | |\/| |/_/ /____/\____/|__/|__/
| |  | |/ ___ \| |\  | | |  | || |_| | |  | |
|_|  |_/_/   \_\_| \_| |_| |___|\___/|_|  |_|             Version 0319

By MantiumCAE, for support please visit 
            www.MantiumFlow.com/mantiumflow-cfd-software-support
www.MantiumCAE.com


------------------------------------------------------------------------------*/

FoamFile
{
version     2.0;
format      ascii;
class       dictionary;
object      snappyHexMeshDict;
}


castellatedMesh true;
snap            true;
addLayers       true;

geometry
{

outer_cyl.stl
{
type triSurfaceMesh;
name outer_cyl;
}

inner_cyl.stl
{
type triSurfaceMesh;
name inner_cyl;
}
};

castellatedMeshControls
{
maxLocalCells 5000000;
maxGlobalCells 200000000;
minRefinementCells 10;
maxLoadUnbalance 0.10;
nCellsBetweenLevels 3;
features
(
);

refinementSurfaces
{
"outer_cyl.*"
{
level (4 4);
}

"inner_cyl.*"
{
level (4 4);
}

}
resolveFeatureAngle 30;
refinementRegions
{
}

locationsInMesh
(
((0.1 0.1 0.6) air)
((1.9 0.1 0.6) air)
((1.3 0.1 0.6) magnet)
((1.7 0.1 0.6) glocke)
);
allowFreeStandingZoneFaces true;
}


snapControls
{
#include "~/Documents/Projects/MWFlow/MantiumFlow_0319/MantiumFlow_default_settings/snapControls"
}

addLayersControls
{
layers
{
"outer_cyl.*"
{
nSurfaceLayers 5;
}

"inner_cyl.*"
{
nSurfaceLayers 5;
}

"magnet_to_.*"
{
nSurfaceLayers 5;
}

"glocke_to_.*"
{
nSurfaceLayers 5;
}

"air_to_.*"
{
nSurfaceLayers 5;
}


}
#include "~/Documents/Projects/MWFlow/MantiumFlow_0319/MantiumFlow_default_settings/layerControls"
}

meshQualityControls
{
#include "~/Documents/Projects/MWFlow/MantiumFlow_0319/MantiumFlow_default_settings/meshQualityControls"
}

writeFlags
(
scalarLevels
layerSets
layerFields
);
mergeTolerance 1e-6;
The tricks are here:
Code:
locationsInMesh
(
((0.1 0.1 0.6) air)
((1.9 0.1 0.6) air)
((1.3 0.1 0.6) magnet)
((1.7 0.1 0.6) glocke)
);
and here:
Code:
"magnet_to_.*"
{
nSurfaceLayers 5;
}

"glocke_to_.*"
{
nSurfaceLayers 5;
}

"air_to_.*"
{
nSurfaceLayers 5;
}
Attached Images
File Type: jpg cht_mesh_mantiumcae_openfoam.jpg (186.1 KB, 66 views)
Kevin.H and NAIROLF like this.
__________________
www.MantiumCAE.com
LVDH is offline   Reply With Quote

Old   February 10, 2019, 04:13
Default
  #10
New Member
 
Kevin Habrock
Join Date: Oct 2018
Posts: 22
Rep Power: 8
Kevin.H is on a distinguished road
Thank you!!
Thats helps me a lot.
I will try it out tomorrrow.
Kevin.H is offline   Reply With Quote

Old   February 12, 2019, 05:20
Default
  #11
New Member
 
Kevin Habrock
Join Date: Oct 2018
Posts: 22
Rep Power: 8
Kevin.H is on a distinguished road
I get an Error because auf the locationInMesh
now. I use OFv1806.


Code:
locationInMesh
(
((0 0.035 0.01) Glocke)    //212
((0 0.03 0.01) Magnet)
((0 0.01 0.01) Air)
((0.1 0.1 -0.01) Air)
);
 
allowFreeStandingZoneFaces true;
}
Code:
--> FOAM FATAL IO ERROR: 
wrong token type - expected Scalar, found on line 212 the punctuation token '('
file: /mnt/Storage/CFD-Archiv/Studenten/OFtutorials_4.1/v1806/Rotor/MultiRegion_Rotor_CellZone/system/snappyHexMeshDict.castellatedMeshControls.locationInMesh at line 212.
    From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::doubleScalar&)
    in file lnInclude/Scalar.C at line 93.
FOAM exiting
Do I have to change the code or is this only a Usermistake?
The code seems to expect directly the coordinates here.

Best regards
Kevin.H is offline   Reply With Quote

Old   February 12, 2019, 05:55
Default
  #12
Senior Member
 
anonymous
Join Date: Jan 2016
Posts: 416
Rep Power: 14
simrego is on a distinguished road
Hi!


You use locationInMesh. You can use it only for 1 region. If you have multiple regions, you have to use locationsInMesh. There is an extra s after the location since you define multiple locationS.
Kevin.H likes this.
simrego is offline   Reply With Quote

Old   February 12, 2019, 06:12
Default
  #13
New Member
 
Kevin Habrock
Join Date: Oct 2018
Posts: 22
Rep Power: 8
Kevin.H is on a distinguished road
Ohh dear, thank u for your quick response
Kevin.H is offline   Reply With Quote

Reply

Tags
layers, 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] Snappy add layers failed mqsim OpenFOAM Meshing & Mesh Conversion 1 January 24, 2021 16:02
[snappyHexMesh] Snappy creates strange cells far away from boundary vainilreb OpenFOAM Meshing & Mesh Conversion 3 December 16, 2020 06:11
[snappyHexMesh] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 2 September 23, 2020 09:26
[snappyHexMesh] Layers in snappy collapse in some places of my solid Yuby OpenFOAM Meshing & Mesh Conversion 0 March 8, 2015 16:44
[snappyHexMesh] Solution Snappy Hex 2D Msh with Surface Layers and cyclic bc for symmetric geometry flexi182 OpenFOAM Meshing & Mesh Conversion 0 May 24, 2013 09:38


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