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

[snappyHexMesh] Boundary layer grid for Wigley hull by snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 30, 2011, 08:28
Default Boundary layer grid for Wigley hull by snappyHexMesh
  #1
New Member
 
nbak skmt
Join Date: Nov 2011
Posts: 5
Rep Power: 14
novak1203 is on a distinguished road
Dear all,

Hello, I'm working on grid generation around Wigley hull using snappyHexMesh.
The code version and working environment is OpenFOAM 2.0.1 under Ubuntu
10.04LTS (64bit). The case I'm trying to modify is:
/tutorials/multiphase/LTSInterFoam/wigleyHull

For the default run (i.e. don't modify anything written in "snappyHexMeshDict" in
the tutorial directory), I have no problem and can view mesh by paraFoam.

When I tried to insert boundary layer mesh by using "addLayers" as well as modifying "addLayersControl" parameters , mesh has been created in 4 steps, i.e.

\0: Mesh by blockMeshDict
\1: Before snap
\2: After snap
\3: After inserting boundary layer mesh

In log.snappyHexMesh, I don't see any error message and checkMesh tool
doesn't show error message neither. Yet the mesh in \2 and \3 looks identical,
in other words, no boundary layer mesh is inserted.

Has anyone encountered such problem? Any comments to figure out this problem will be greatly appreciated. I'm also ready to upload my snappyHexMeshDict as well as relevant files to somewhere if necessary.

Thanks in advance for your help.

Best wishes,
Novak
novak1203 is offline   Reply With Quote

Old   November 30, 2011, 10:51
Default
  #2
Member
 
Martin
Join Date: Nov 2011
Posts: 35
Rep Power: 15
wernsen is on a distinguished road
Hello Novak,

it would be nice to see some pictures or even your SHM dict.

CU
wernsen is offline   Reply With Quote

Old   December 1, 2011, 04:46
Default
  #3
New Member
 
nbak skmt
Join Date: Nov 2011
Posts: 5
Rep Power: 14
novak1203 is on a distinguished road
Hi CU,

Thanks for your offer. In consequence, the problem was resolved.

I appled wrong patch name under "nSurfaceLayers". Once the right patch
name was applied (e.g. in the Wigley hull example in OF2.0.1, it is "hull_wall" and NOT "hull") I managed to insert boudary layer mesh.

Best wishes,
Novak
novak1203 is offline   Reply With Quote

Old   December 3, 2011, 13:49
Default
  #4
Member
 
Ben Vernieres
Join Date: Jul 2011
Location: Valencia, Spain
Posts: 42
Rep Power: 15
bouclette is on a distinguished road
Send a message via Skype™ to bouclette
Hi Novak,

Did you manage to obtain a nice BL mesh all round the hull (especially at body ends)? If yes, I'd be curious to see your sHM.dict file

Regards,

Ben
bouclette is offline   Reply With Quote

Old   December 4, 2011, 20:38
Default
  #5
New Member
 
nbak skmt
Join Date: Nov 2011
Posts: 5
Rep Power: 14
novak1203 is on a distinguished road
Hello Ben,

Thanks for your comment, actually that's currently my next issue to solve.
Attached figure is the example of the boundary layer (at midship yz-plane) I created using the SHMDict as per also attached.

As seen in the figure, the mesh at z-top boundary look collapse even though checkMesh command doesn't give any error message. This is the 1st issue to be resolved, and I'm working on the geometry for double-model flow. In such case, I don't have to put refinement boxes on free-surface.

Second issue is, when I try to create boundary layer mesh with minimum spacing equal to 2e-6 (i.e. for mesh without wall function at Rn=1e6 simulation), SHM does not even insert any boundary layer mesh. The density of background mesh generated by blockMesh seems not a problem.

Anyways, I'll keep working on this problem. Sorry in advance that my progress may be quite slow, but I'll keep checking thread. Thanks.

Best,
Novak
Attached Images
File Type: jpg midship_view.jpg (98.0 KB, 373 views)
Attached Files
File Type: txt snappyHexMeshDict.txt (11.1 KB, 127 views)
novak1203 is offline   Reply With Quote

Old   December 20, 2011, 09:41
Default Interrupted layers
  #6
New Member
 
Join Date: Nov 2010
Posts: 10
Rep Power: 16
Friederike is on a distinguished road
Hey Novak,
you might have discovered the posts in this forum stating that the "collapsing" of layers at the boundary stops if you set the boundary type to empty.
This worked for me.
Unfortunately my layers look fine in the midship area but unaccaptable everywhere else. Do you have a fix for this problem? Or does anybody else?

Regards,
Friederike
Attached Images
File Type: jpg x0.jpg (80.8 KB, 230 views)
File Type: jpg x0164.jpg (87.3 KB, 212 views)
File Type: jpg y0.jpg (68.2 KB, 207 views)
Friederike is offline   Reply With Quote

Old   January 12, 2012, 06:24
Default
  #7
Senior Member
 
Ralph Moolenaar
Join Date: Aug 2010
Location: 's-Hertogenbosch, the Netherlands
Posts: 120
Rep Power: 16
Ralph M is on a distinguished road
Hi all,

I found the following things:
-Increase the number between cell refinement layers (control to be found in sHM dict). This increases the general quality of the mesh
-Run sHM for each option seperately
-Setting a patch to empty doesn't always work; especially NOT when the object (hull) is not perpendicular to the patch which is set to empty
-I think that it's also good to consider to run the layers within sHM layer by layer. Still it doesn't give you the most beautiful mesh but I guess it's the best you can get.

Good luck!

Ralph
__________________
CFD for marine applications? Go to http://www.marinecfd.com/ and join the OF Ship Hydromechanics Group: http://www.cfd-online.com/Forums/gro...mechanics.html
Ralph M is offline   Reply With Quote

Old   June 19, 2013, 16:31
Default Possible clue to BL problems
  #8
New Member
 
Claudio
Join Date: May 2010
Location: Boston, MA
Posts: 28
Rep Power: 16
Claudio is on a distinguished road
Hi,

I've been working on the Wigley hull tutorial and have been frustrated by the BL grid. I have first run the tutorial as it came and the grid did not look good at all. I tried several changes hoping to improve things, following advises found here on the forums, and things have improved, until I hit a wall.

In the part of the wigley hull with the vertical sides I can get a beautiful BL grid, and so if I look at a midship section, but at other waterline or sections things don't always look good. I think I tracked down the cause, but don't have a solution.
In my case the BL grid is not grown where the surface grid on the hull has "weird" looking shaped faces that are due to the snapping. These not-four-sided faces are the results of the snapping when it switches from one row in the castellated mesh to the next. It doesn't always happen, as sometimes the snapped face is still topologically a rectangle, but in a lot of cases that's not the case. And those location seem to correspond to the locations where the BL doesn't grow properly. (see the attached pictures).

I thought that maybe it could be because I was using "relativeSizes true" that it was not growing the BL properly, but when I switched to "relativeSizes false" and changed the "finalLayerThickness" from 0.6 to 0.004, things actually got worse.

Does anybody have a suggestion on how to solve this?

snappyHexMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      autoHexMeshDict;
}

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

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       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
{
    wigley-scaled-oriented.stl
    {
        type triSurfaceMesh;
        name hull;

        patchInfo
        {
            type wall;
        }
    }

    box1
    {
        type searchableBox;
        min (-1 -0.6 -0.35);
        max ( 1  0.6  1 );
    }

    box2
    {
        type searchableBox;
        min (-1    -0.4  -0.20);
        max ( 0.75  0.4   1);
    }

    box3
    {
        type searchableBox;
        min (-10    -10  -0.03);
        max ( 10  10   1);
    }
};



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

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

    // 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 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 "wigley-scaled-oriented.eMesh";
             level 3;
         }
    );



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

    resolveFeatureAngle 15;


    // 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
    {
        hull
        {
            mode distance;
            levels ((0.04 3));
        }
//        box1
//        {
//            mode inside;
//            levels ((1e15 1));
//        }
//        box2
//        {
//            mode inside;
//            levels ((1e15 2));
//        }
//        box3
//        {
//            mode inside;
//            levels ((1e15 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.4 0 0);


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

// Feature snapping

    //- Number of feature edge snapping iterations.
    //  Leave out altogether to disable.
    nFeatureSnapIter 10;

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

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

    //- Detect points on multiple surfaces (only for explicitFeatureSnap)
    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 true;
    relativeSizes false;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        hull_wall
        {
            nSurfaceLayers 10;

        }
    }

    // Expansion factor for layer mesh
    expansionRatio 1.40;


    //- Wanted thickness of final added cell layer. If multiple layers
    //  is the thickness of the layer furthest away from the wall.
    //  See relativeSizes parameter.
    // finalLayerThickness 0.6; // when using relativeSizes true;
    finalLayerThickness 0.004; // when using relativeSizes false;

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

    //- 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
    //  make straight angle.
    featureAngle 150;

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

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

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

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

    // 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
{
    //- Maximum non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 65;

    //- Max skewness allowed. Set to <0 to disable.
    maxBoundarySkewness 20;
    maxInternalSkewness 4;

    //- Max concaveness allowed. Is angle (in degrees) below which concavity
    //  is allowed. 0 is straight face, <0 would be convex face.
    //  Set to 180 to disable.
    maxConcave 80;

    //- Minimum pyramid volume. Is absolute volume of cell pyramid.
    //  Set to a sensible fraction of the smallest cell volume expected.
    //  Set to very negative number (e.g. -1E30) to disable.
    minVol 1e-13;

    //- Minimum quality of the tet formed by the face-centre
    //  and variable base point minimum decomposition triangles and
    //  the cell centre.  Set to very negative number (e.g. -1E30) to
    //  disable.
    //     <0 = inside out tet,
    //      0 = flat tet
    //      1 = regular tet
    minTetQuality 1e-30;

    //- Minimum face area. Set to <0 to disable.
    minArea -1;

    //- Minimum face twist. Set to <-1 to disable. dot product of face normal
    //- and face centre triangles normal
    minTwist 0.05;

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

    //- minFaceWeight (0 -> 0.5)
    minFaceWeight 0.05;

    //- minVolRatio (0 -> 1)
    minVolRatio 0.01;

    //must be >0 for Fluent compatibility
    minTriangleTwist -1;

    //- if >0 : preserve single cells with all points on the surface if the
    //  resulting volume after snapping (by approximation) is larger than
    //  minVolCollapseRatio times old volume (i.e. not collapsed to flat cell).
    //  If <0 : delete always.
    //minVolCollapseRatio 0.5;


    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- amount to scale back displacement at error points
    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

// Flags for optional output
// 0 : only write final meshes
// 1 : write intermediate meshes
// 2 : write volScalarField with cellLevel for postprocessing
// 4 : write current intersections as .obj files
debug 0;


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


// ************************************************************************* //
blockMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.1.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

vertices
(
    (-0.50 -0.25 -0.25)
    ( 0.50 -0.25 -0.25)
    ( 0.50  0.25 -0.25)
    (-0.50  0.25 -0.25)
    (-0.50 -0.25  0.03)
    ( 0.50 -0.25  0.03)
    ( 0.50  0.25  0.03)
    (-0.50  0.25  0.03)
);

blocks
(
    hex (0 1 2 3 4 5 6 7) (50 25 14) simpleGrading (1 1 1)
);

edges
(
);

boundary
(
    inlet
    {
        type patch;
        faces
        (
            (0 4 7 3)
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (2 6 5 1)
        );
    }

    atmosphere
    {
        type patch;
        faces
        (
            (4 5 6 7)
        );
    }

    sides
    {
        type symmetryPlane;
        faces
        (
            (1 5 4 0)
            (3 7 6 2)
            (0 3 2 1)
        );
    }
);


// ************************************************************************* //
Attached Images
File Type: jpg CastellatedatWL_detail.jpg (29.7 KB, 101 views)
File Type: jpg GridatWL_detail.jpg (28.3 KB, 82 views)
File Type: jpg BLatWL_detail.jpg (29.6 KB, 83 views)

Last edited by Claudio; June 20, 2013 at 11:36. Reason: typo
Claudio is offline   Reply With Quote

Old   June 27, 2013, 13:03
Default Update
  #9
New Member
 
Claudio
Join Date: May 2010
Location: Boston, MA
Posts: 28
Rep Power: 16
Claudio is on a distinguished road
I wanted to give an update on the addLayer grid issues I have been having.
I had been working in OpenFOAM 2.1.0, so after reading the 2.2.0 improved snappyHexMesh and in particular the addition of layers, I upgraded.
And things did work a little better, but still this operation seems far from reliable. I should say I have not had the time to redo all the tests I had done under 2.1.0, but it seems that the underlying problem is still the same.

The addition of layers fails where the surface grid is at a jump in row or column in the castellated mesh. It doesn't happen every time, but when it does it does happen there.

I'm attaching a picture (BLatWL_detail2.png) that shows the improvement w.r.t. the post above. I used the slipFeatureAngle, and set it first to 30 then to 1, with no appreciable difference.

The midship section where all the surface elements are very close to rectangles ends up having a beautiful BL grid, the bow section does not.

If anybody has any suggestions on how to get a BL grid that looks like the midship one everywhere on the hull, it will be greatly appreciated.

Thanks,
Claudio
Attached Images
File Type: jpg BLatWL_detail_2p2.jpg (35.6 KB, 117 views)
File Type: jpg MIdshipSectionBLgreat.jpg (64.9 KB, 170 views)
File Type: jpg BowSectionBLProblem.jpg (69.3 KB, 168 views)
Claudio is offline   Reply With Quote

Reply


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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Centrifugal fan j0hnny CFX 13 October 1, 2019 14:55
[snappyHexMesh] snappyHexMesh Boundary Layer at Corner panpanzhong OpenFOAM Meshing & Mesh Conversion 5 July 3, 2018 06:53
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 02:44
[snappyHexMesh] Problem airfoil snappyhexmesh add layer bye bye my blue OpenFOAM Meshing & Mesh Conversion 1 May 5, 2017 06:56


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