CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   Multi Region Meshing with sHM (

marango September 13, 2011 03:30

Multi Region Meshing with sHM
1 Attachment(s)
Hi everybody,

I'm currently working on a complex geometry with multiple regions. Therefore I decided to use snappyHexMesh to create a mesh of my geometry. Since my results are not useful, I do have some questions about working with sHM. Perhaps somebody can help me, finding the answers.

(1) In my geometry I have two regions that consists of different materials. One region is a pipe with a wall thickness of 2mm and the other one is a cylinder that perfectly fits in that pipe, so that there's no space in between. My question is how sHM works with these two regions. Does it create the mesh for each region one after the other and finally puts them together OR does it uses the regions "in parallel" while creating the mesh?

(2) I tried to to create a mesh for each region and manually merge them with mergeMeshRegions. Since sHM cannot exactly resolve the curvature of the pipe and cylinder, it creates some space between these two parts (see picture below). Does anyone can give me some advice to make them perfectly fit?

(3) In snappyHexMeshDict I have to define an inside point. Do I have to choose a special point or is it indifferent in which region this point lies?

(4) When I use multiple regions with sHM, it doesn't remove the outer cells I don't need. Is there a way to remove them manually?

Many thanks in advance!


Clementhuon September 16, 2011 03:11

Hi marango,

II don't know how you proceed exactly but I think you should try this way. It depends how you created your geometry but I think that if you use SHM you get two .stl files for your two regions.
Put the two.stl file in your trisurface folder. Then constrruct your SHMdict this way


        type "chooseyourtype";
        name "choosethename";

        type ;
        name ;


// 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 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 (with OpenFOAM-2)
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies a level for any cell intersected by its edges.
    // This is a featureEdgeMesh, read from constant/triSurface for now.
            file "pipe.eMesh";
            level 1;
            file "fluid.eMesh";
            level 1;

    // 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 (1 1);

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

Then in your constant and system directory you will have to create a "pipe" and a "fluid" folder to set the different parameters of your two material.

For the location in mesh point, you have just to choose a point in your geometry, whatever is the meterial.

You also can look (maybe you allready did it) the tutorial mesh/snappyHexMesh/snappyMultiRegionHeater

I hope that will help you ....


marango September 16, 2011 08:50

Hi Clementhuon,

thanks for your help.

I've also tried the way you described. But there occur some other problems. Like I wrote in the first post, I'm working on a high complex geometry, where the cylinder and the pipe only represent a small part. When I use the whole geometry with multi regions sHM creates these spaces between the regions too. But there are less of them. I guess it could be a matter of refinement, but when I choose a higher level of refinement, sHM aborts due to lack of memory. That's why I decided to mesh each region and finally merge them.

Perhaps your way is the better one, but I don't know how to avoid the spaces between.:confused:

Even if sHM creates a good mesh, the problem in (4) still remains. I have really no idea.

Have a nice weekend,

danvica March 27, 2012 00:51

Hi marango,
I'm facing the same problem.

Did you already found a solution ?


All times are GMT -4. The time now is 17:35.