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

[snappyHexMesh] SHM doesn't snap the boundary between two surfaces on same plane

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

Like Tree2Likes
  • 2 Post By decanter

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 17, 2020, 12:42
Question SHM doesn't snap the boundary between two surfaces on same plane
  #1
New Member
 
Join Date: Aug 2020
Posts: 16
Rep Power: 3
decanter is on a distinguished road
Hi everyone,

I have found out that some other people experienced the same issue years ago but there weren't any proper answers in the forum so I open this thread.

As you can see in my mesh (see pic), there are two circular faces on the same plane. I see that the boundary between them is not snapped well and the result lookes like a stair I tried to refine the edges and surface more but this resulted in smaller steps of the stair and the problem wasn't really solved. Does someone have an idea how to correct it? I have the same issue on all surfaces intersections which are on the same plane or don't have high angle at the itersection.


Here is my snappyHexMeshDict. The outer circular surface is "wall_weir" and the inner is "outlet_liquid".
Code:
castellatedMesh true;
snap            true;
addLayers       false;


// 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
{
   outletLiquidMeters.stl
    {
        type triSurfaceMesh;
        name outlet_liquid;
    }
    outletConusMeters.stl
    {
        type triSurfaceMesh;
        name outlet_conus;
    }
    inletSlurryMeters.stl
    {
        type triSurfaceMesh;
        name inlet_slurry;
    }
    bowlCylinderMeters.stl
    {
        type triSurfaceMesh;
        name wall_bowlCylinder;
    }
    bowlConusMeters.stl
    {
        type triSurfaceMesh;
        name wall_bowlConus;
    }
    weirMeters.stl
    {
        type triSurfaceMesh;
        name wall_weir;
    }
    screwBodyModifiedMeters.stl
    {
        type triSurfaceMesh;
        name wall_screwBody;
    }
    screwFlightsModifiedMeters.stl
    {
        type triSurfaceMesh;
        name wall_screwFlights;
    }
};

// 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 1000000;

    // 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 10000000;

    // 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) Zero means no bad cells are 
    // allowd during refinement stages
    minRefinementCells 10; //wieder auf null stellen!

    //maxLoadUnbalance 0.10;

    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement. In Summary, this paramter controls the transition
    // between cell refinement cells
    nCellsBetweenLevels 1;



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

    // Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
    // The file is automatically created when you use the utility
    // surfaceFeatures.
    features
    (
        {file "outletLiquidMeters.eMesh"; level 2;}
        {file "outletConusMeters.eMesh"; level 0;}
        {file "weirMeters.eMesh"; level 0;}
        {file "bowlConusMeters.eMesh"; level 1;}
        {file "bowlCylinderMeters.eMesh"; level 1;}
        {file "screwBodyModifiedMeters.eMesh"; level 1;}
        {file "screwFlightsModifiedMeters.eMesh"; level 1;}
        {file "inletSlurryMeters.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. The surfaces were defined in the 
    // geometry section.

    refinementSurfaces
    {
     
     //cellZone fluid
     //cellZoneInside inside
     outlet_liquid
     {
     patchInfo
     {
     type patch;
     }
     level (1 1);
     }
     outlet_conus
     {
     patchInfo
     {
     type patch;
     }
     level (1 1);
     }
     wall_screwBody
     {
     patchInfo
     {
     type wall;
     }
     level (1 1);
     }
     wall_screwFlights
     {
     patchInfo
     {
     type wall;
     }
     level (1 1);
     }
     wall_bowlCylinder
     {
     patchInfo
     {
     type wall;
     }
     level (1 1);
     }
     wall_bowlConus
     {
     patchInfo
     {
     type wall;
     }
     level (1 1);
     }
     inlet_slurry
     {
     patchInfo
     {
     type patch;
     }
     level (1 1);
     }
     wall_weir
     {
     patchInfo
     {
     type wall;
     }
     level (1 1);
     }
    }


    // Cells that 'see' multiple intersections where the intersections make an 
    // angle > resolveFeatureAngle get refined up to the maximum level.
    // The resolvedFeatureAngel controls the local curvature refinement. The
    // higher the value, the less features it captures. For example if you use 
    // 100, it will not add refinement in high curvature areas. It also controls 
    // edge feature snapping, high values will not resolve sharp angles in 
    // surface intersections.


    resolveFeatureAngle 5; // Default 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
    {
       /*box
       {
        mode inside;
            levels ((2 2));
    }*/
    }


    // 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.128 0.032 0); // to decide which side of mesh to keep

    // 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 true;
}



// 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 4.0;

    //- Number of mesh displacement relaxation iterations: The higher the value 
    //  the better the body fitted mesh. The default value is 30. If you are 
    //  having problems with the mesh quality (related to the snapping step), 
    //  try to increase this value to 300. Have in mind that this will increase 
    //  the meshing time.
    nSolveIter 100;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh. Increase this value to 
    //  improve the quality of the body fitted mesh.
    nRelaxIter 5;

    // Feature snapping

        //- Number of feature edge snapping iterations.
        //  Leave out altogether to disable. Increase this 
    //  value to improve the quality of the edge features.
        nFeatureSnapIter 10;

        //- Detect (geometric) features by sampling the surface
    //  (default = false)
        implicitFeatureSnap false;

        //- Use castellatedMeshControls::features
    //  (default = true)
        explicitFeatureSnap true;

        //- Detect features between multiple surfaces
        //  (only for explicitFeatureSnap, default = false)
        multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes false;

    // Per final patch (so not geometry!) the layer information. 
    // In this section we select the patches where we want to add 
    // the layers.  We can add multiple patches (if they exist).
    layers
    {
        // This patches were created in the geometry section.  
    inlet_slurry {nSurfaceLayers 3;}
    outlet_liquid {nSurfaceLayers 3;}
    outlet_liquidConus {nSurfaceLayers 3;}
    wall_screw{nSurfaceLayers 3;}
    wall_bowl{nSurfaceLayers 3;}
    }

    // Expansion factor for layer mesh
    expansionRatio 1.0;


    // 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 0.3;

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // See relativeSizes parameter.
    minThickness 0.25;

    // 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.
    nGrow 0;


    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 30;

    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 5;

    // 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 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    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;

    // Max number of iterations after which relaxed meshQuality controls
    // get used. Up to nRelaxIter it uses the settings in meshQualityControls,
    // after nRelaxIter it uses the values in meshQualityControls::relaxed.
    nRelaxedIter 20;
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1.00E-13;
    minTetQuality  1e-9;
    //minTetQuality -1e30;
    minArea -1;
    minTwist 0.02;
    minDeterminant 0.001;
    minFaceWeight 0.02;
    minVolRatio 0.01;
    minTriangleTwist -1;
    minFlatness 0.5;
    nSmoothScale 4;
    errorReduction 0.75;

    /*// Optional : some meshing phases allow usage of relaxed rules.
    // See e.g. addLayersControls::nRelaxedIter.
    relaxed
    {
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 75;
    }*/
}


// Advanced


// Write flags
writeFlags
(
    scalarLevels    // write volScalarField with cellLevel for postprocessing
    layerSets       // write cellSets, faceSets of faces in layer
    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;


// ************************************************************************* //
Thank you in advance!
Attached Images
File Type: jpg SnappingProblem.jpg (56.0 KB, 51 views)
decanter is offline   Reply With Quote

Old   November 17, 2020, 13:57
Default
  #2
Senior Member
 
Charles
Join Date: Aug 2016
Location: Vancouver, Canada
Posts: 127
Rep Power: 7
Marpole is on a distinguished road
In the followings, which defines the boundary line between the two faces? Can you increase its level of resolution?

Quote:
Originally Posted by decanter View Post
Code:
    features
    (
        {file "outletLiquidMeters.eMesh"; level 2;}
        {file "outletConusMeters.eMesh"; level 0;}
        {file "weirMeters.eMesh"; level 0;}
        {file "bowlConusMeters.eMesh"; level 1;}
        {file "bowlCylinderMeters.eMesh"; level 1;}
        {file "screwBodyModifiedMeters.eMesh"; level 1;}
        {file "screwFlightsModifiedMeters.eMesh"; level 1;}
        {file "inletSlurryMeters.eMesh"; level 0;}
     );
__________________
Charles L.
Marpole is offline   Reply With Quote

Old   November 17, 2020, 15:36
Default
  #3
New Member
 
Join Date: Aug 2020
Posts: 16
Rep Power: 3
decanter is on a distinguished road
Quote:
Originally Posted by Marpole View Post
In the followings, which defines the boundary line between the two faces? Can you increase its level of resolution?
Thank you for your reply Charles! I tried to increase the level of the edge features. It results in smaller rectangles along the intersection line but the rectangles don't disappear. For this I increased the level of "outletLiquidMeters" which defines the edges of the inner surface. Hmm but I didn't try to increase the edge level of both surfaces, I will give it a try now.
decanter is offline   Reply With Quote

Old   November 17, 2020, 15:56
Default
  #4
New Member
 
Join Date: Aug 2020
Posts: 16
Rep Power: 3
decanter is on a distinguished road
Quote:
Originally Posted by decanter View Post
Thank you for your reply Charles! I tried to increase the level of the edge features. It results in smaller rectangles along the intersection line but the rectangles don't disappear. For this I increased the level of "outletLiquidMeters" which defines the edges of the inner surface. Hmm but I didn't try to increase the edge level of both surfaces, I will give it a try now.
Okes so I increased the edgefutures level of both surfaces to 4 and as I also previously observed the rectangles are getting smaller but it is stil not snapped correctl. Look at the outher edges of my cylinder, there I don't have any problem. Whenever there are neighbouring surfaces and the angle between the surfaces is 0 or close to the zero I face the same problem.
Attached Images
File Type: jpg SnappingProblem2.jpg (134.8 KB, 36 views)
decanter is offline   Reply With Quote

Old   November 17, 2020, 16:32
Default
  #5
New Member
 
Join Date: Aug 2020
Posts: 16
Rep Power: 3
decanter is on a distinguished road
Hi!

I solved the issue! I hope that it will other people because I have never thought changing this setting before.

Code:
multiRegionFeatureSnap false
I changed multiRegionFeeatureSnap to true and now I have a clear line at the intersection without higher refinement levels.
Attached Images
File Type: jpg SnappingProblemSolved.jpg (61.9 KB, 40 views)
nimrod and Marpole like this.
decanter is offline   Reply With Quote

Reply

Tags
meshing, snapedge, snapping, snappyhexmesh

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
Velocity vector in impeller passage ngoc_tran_bao CFX 24 May 3, 2016 22:16
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
Waterwheel shaped turbine inside a pipe simulation problem mshahed91 CFX 3 January 10, 2015 12:19
Question about heat transfer coefficient setting for CFX Anna Tian CFX 1 June 16, 2013 07:28
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05


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