CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   Bumpy Wing with snappyHexMesh (

aeir1976 May 24, 2012 12:07

Bumpy Wing with snappyHexMesh
2 Attachment(s)
I have been trying to mesh a wing in a wind tunnel using snappyHexMesh. I have an issue where I end up with bumps on the wing. Initially I had problems resolving the sharp discontinuities but overcame these using a mixture of edge snapping and mesh refinement.

The resultant leading edge was highly faceted so I added a searchableCylinder along the leading edge with an extra layer of refinement. When doing this bumps appeared on the upper surface (as shown in the figure). The settings for SHM are shown below.

I would prefer not to have a fine mesh over the whole surface as the cell count when we do full aircraft analyses would be too high.

Any ideas or solutions would be welcome.



/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.0.1                                |
|  \\  /    A nd          | Web:                      |
|    \\/    M anipulation  |                                                |
    version    2.0;
    format      ascii;
    class      dictionary;
    object      autoHexMeshDict;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
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
        type triSurfaceMesh;
        name Main;

        type triSurfaceMesh;
        name Tip;

        type triSurfaceMesh;
        name Trailing;

    //- Refine a bit extra around the small centre hole
//    refinementBox
//    {
//        type searchableBox;
//        min (0.6 -0.1 -0.1);
//        max (1.1  1.6  0.1) ;
//    }

        type searchableCylinder;
        point1 (0.026982 0. -0.0000064);
        point2 (0.81033 1.524 0.001);
        radius 0.0275;

        type searchableCylinder;
        point1 (0.64 0. 0.);
        point2 (1.06636 1.524 0.);
        radius 0.006;

// Settings for the castellatedMesh generation.

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

    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    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.
            file "GLC305Wing.eMesh";
            level 6;

    // 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.

            // Surface-wise min and max refinement level
            level (5 6);
            // Surface-wise min and max refinement level
            level (6 6);
            // Surface-wise min and max refinement level
            level (6 6);

    resolveFeatureAngle 20;

    // 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.

//        refinementBox
//        {
//            mode inside;
//            levels ((1E15 7));
//        }

            mode inside;
            levels ((1E15 7));

            mode inside;
            levels ((1E15 7));

    // 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.
    // This is an outside point locationInMesh (-0.033 -0.033 0.0033);
    locationInMesh (-0.1 0.1 0.43); // Inside point

    // 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.
    //- 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 300;

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

SirWombat May 25, 2012 03:00

HI Ian,

I suppose that the quality controls in SHM will filter a few bad cells (unfortunately you didn't post those settings). When iterating, SHM will try to fill those gaps from the filtered cells which leads to your "bumps" on the surface.

Try to switch off all quality controls and see where that gets you.
Be sure to run "checkMesh" after SHM which will create "sets" of the bad cells that you may view in paraview/paraFoam.
Then slowly raise the quality settings until "checkMesh" tells you an "OK".


aeir1976 May 25, 2012 06:22

Hi Jan,

Thanks for the response.

I did a few parametric runs this morning varying quality parameters and the quality controls seem to have little impact on the output.

The area with the bumps seems to occur where the streaks across the surface meet the refined leading edge area (See bumpywing2.jpg not very clear). So I don't know if there is an issue due to it merging an area with a refinement of level 8 coming into an area where the level is lower.


SirWombat May 26, 2012 07:15

Hey Ian,

in your SHMDict you are using feature edges: are any of those possibly running across that part of the surface?
Have you had a look at the SHM output esp. at the snapping iterations? You are using 300 iterations for the moving mesh, but only 5 relaxations during one iteration: see if the mesh snaps correctly during those relaxations after a few iterations (IMHO 300 iterations are quite a lot).


aeir1976 May 26, 2012 14:41

Hi Jan,

The feature edges just define the trailing edges and the tip aerofoil section with nothing on the wing.

I agree that the 300 iterations are a lot but I have been trying different SHMDict files to see if any of them worked. I usually run with about 20 to 30. I will check the log files on Monday to see if it snaps correctly.

If I run the meshing process without the refined leading edge, I don't get the same effect but I do get a rough leading edge. I wondered if it is possible to run the snap in two sections, first to get a basic mesh then a second iteration that refines the leading edge. When I have tried it, when I run the second snapping run it doesn't seem to refine the leading edge. Another that I might try is to reduce the diameter as it is only really the very leading edge that looks rough therefore it might look better.

Thanks for your input.


aeir1976 May 29, 2012 05:18

Hi Jan

I think that I have solved the problem and your first thoughts on the quality settings seemed to be correct. I had used the quality settings from the tutorial examples.

The change I had to make was to minTetQuality, in the examples this is set to 1E-30. If I increase this number (initially set to 0.5) the surface bumps disappear. I am still having issues regarding mesh quality output in checkMesh but I think that I should be able to overcome these issues.


SirWombat May 29, 2012 11:16

great to hear my note was of help! Happy snapping!

naval June 20, 2012 04:43

similar issue
Hi folks,

I'm experiencing the same kind of bumps when meshing a (non-circular) pipe.
Unfortunately I couldn't fix it by changing the mesh quality settings.

Also, the meshed surface is perfect, if I mesh the outer region, not the inside. Not very useful for an internal flow problem, though...

Any suggestions how to tackle this problem?
Or any ideas for a workaround, like splitting the mesh after meshing inside and outside?

Help would be greatly appreciated!



edit: flipping the stl's surface normals didn't change a thing

aeir1976 June 20, 2012 04:59

Hi Sebastian,

The settings that I used to achieve a good mesh and pass the checkMesh (except for 8 skewed cells) include setting minTetQuality -1.E+30 (not 0.5 as I originally set in my reply the parameter seems to be highly non-linear and avoiding it seems to work okay). I tried to keep the mesh resolution down to about 1 or 2mm then gradually coarsen the resolution until it becomes poor, then I step back a stage. In the end I had up to 12 mesh refinement levels on the surface.

Another area that we found was that the fineness of the underlying stl seemed to impact the resulting mesh so I used an FE preprocessor to put a fine surface triangulation down then exported this.

Another thing to check is that your locationInMesh point is inside the mesh for when you are meshing the inside of the tube.

I hope this helps,

naval June 20, 2012 05:30

Thanks for the quick reply!

It turned out to be the blockMeshDict, though.

I did set inlet and outlet to type empty (to apply wallLayers there as well), that seems to mess up everything.

A little disturbing, though. And a bit of a problem, since that is the only way I know to generate proper wallLayers close to another patch.



All times are GMT -4. The time now is 22:32.