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

[snappyHexMesh] Snap Precision to a STL Surface

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By malaboss
  • 1 Post By vasava

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   April 18, 2013, 06:15
Default Snap Precision to a STL Surface
  #1
Member
 
Malik
Join Date: Dec 2012
Location: Austin, USA
Posts: 53
Rep Power: 13
malaboss is on a distinguished road
Hi FOAMers !
I am now studying an airfoil and I would like to create the mesh around it with snappyHexMesh. When I ran some simulations, it gave me a high drag.
Looking at the profile more precisely I saw that the stream line left the profile quite early (at least earlier than they should, which could be the cause of this higher drag. Looking more precisely, I saw that the profile did not respect well the NACA geometry which is normal as snappyHexMesh does not generate curves cells.

I spent several hours looking for the parameters I should change to improve the precision of the snap to the surface and I could not find the solution.


Do you know how can I improve the snapping ?


You can find attached the bad surface I get and my snappyHexMeshDict File.

Castellated
Code:
castellatedMeshControls
{
	allowFreeStandingZoneFaces true;
    // Refinement parameters
    // ~~~~~~~~~~~~~~~~~~~~~

    // While refining maximum number of cells per processor. This is basically
    // the number of cells that fit on a processor. If you choose this too small
    // it will do just more refinement iterations to obtain a similar mesh.
    maxLocalCells 100000000;

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

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

    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 20;   // 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 "surfacemesh.eMesh";
            level 8;
        }
    );



    // 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
    {
        stlSurface
        {
            // Surface-wise min and max refinement level
            level (3 3);  // 5 6
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 30;   // 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
    {
        refinementBox
        {
            mode inside;   // inside;
            levels ((1.0e+15 0));  //1E15 4
        }
    }


    // 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 (-1.39263 1.8424 0.0477);
    //locationInMesh (-3023.55 4000 -103.606); 
	locationInMesh (-3 11 0); 

}
Snap
Code:
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 10;

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 5;

    //- Number of mesh displacement relaxation iterations.
    nSolveIter 30;

    //- Maximum number of snapping relaxation iterations. Should stop
    //  before upon reaching a correct mesh.
    nRelaxIter 10;
}
addLayers
Code:
addLayersControls
{
    relativeSizes true;  //true;   // v 1.6
    // Per final patch (so not geometry!) the layer information
    layers
    {
        //minZ
        //{
        //    nSurfaceLayers 3;
        //}
        stlSurface_patch0   // a_surface_name
        {
            nSurfaceLayers 15;//2;
        } 
    }

    // Expansion factor for layer mesh
    expansionRatio 1.03;   // 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.
    //finalLayerRatio FINALLAYERRATIO;   // 0.3; 
    finalLayerThickness 0.8;   // 0.3;    // v 1.6

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


    // Advanced settings

    //- When not to extrude surface. 0 is flat surface, 90 is when two faces
    //  make straight angle.
    featureAngle 180;   // 30; 

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

    // Number of smoothing iterations of surface normals 
    nSmoothSurfaceNormals 500;//5

    // Number of smoothing iterations of interior mesh movement direction  
    nSmoothNormals 50;//3

    // Smooth layer thickness over surface patches
    nSmoothThickness 100;//10;

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

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

    // Angle used to pick up medial axis points
    minMedianAxisAngle 180;//130;

    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;

    // Overall max number of layer addition iterations   // v 1.6
    nLayerIter 10;//50;   // v 1.6
}

Every help is welcome !
Thanks in advance !
Attached Images
File Type: jpg badprofile.jpg (32.8 KB, 334 views)
File Type: jpg badprofileaftersnap.jpg (79.6 KB, 479 views)
Hermione likes this.
malaboss is offline   Reply With Quote

 


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 16:38
[snappyHexMesh] snappyHexMesh cannot achieve smooth surface from stl alex::cfd OpenFOAM Meshing & Mesh Conversion 2 October 22, 2018 12:39
[snappyHexMesh] 'cracks' in Mesh on surface using STL Fschi OpenFOAM Meshing & Mesh Conversion 5 January 19, 2017 12:24
[snappyHexMesh] snappyHexMesh failure to snap to geometry Yadasol OpenFOAM Meshing & Mesh Conversion 1 November 17, 2014 05:00
what's wrong about my code for 2d burgers equation morxio Main CFD Forum 3 April 27, 2007 10:38


All times are GMT -4. The time now is 07:01.