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

[snappyHexMesh] sHM refinement away from surface

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

Like Tree1Likes
  • 1 Post By nholt

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 3, 2015, 11:55
Default sHM refinement away from surface
  #1
New Member
 
Nick Holt
Join Date: Jun 2015
Posts: 2
Rep Power: 0
nholt is on a distinguished road
I'm using OpenFOAM 2.3.1 to solve aerodynamics problems, and I'm having trouble using snappyHexMesh to refine my mesh away from the surface. There are two main reasons I want to do this: refinement of the wake region, and refinement of an area where the source term is active for an actuator disk model of a propeller.

There are various refinement options within sHM. I'm using explicit edge refinement, surface based refinement, and refinement regions (searchableSphere surrounding the geometry). I've tried adding a refinement region to enclose the wake region or actuator disk region to improve mesh resolution in those areas specifically by using either searchableCylinder or searchableBox with no success.

Do refinement regions need to intersect with a geometry to work properly?

Castelled mesh portion of sHM settings below:

Nick

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

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       true;


// 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
{
    stl_name.stl
    {
        type triSurfaceMesh;
        name aircraft;
    }

    refinementSphere
    {
        type searchableSphere;
        centre (0 0 0);
        radius 10.0;
    }

    // used to refine region near actuator disk
    refinementCylinder
    {
        type searchableCylinder;
        point1 (0 0 0);
        point2 (0 0 1.0);
        radius 1.0;
    }
};



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

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

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

    // Allow a certain level of imbalance during refining
    // (since balancing is quite expensive)
    // Expressed as fraction of perfect balance (= overall number of cells /
    // nProcs). 0=balance always.
    maxLoadUnbalance 0.10;


    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 3;



    // 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 "stl_name.eMesh";
            level 7;
        }
    );



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

            //- Optional increment (on top of max level) in small gaps
            gapLevelIncrement 2;

            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type wall;
                inGroups (aircraftGroup);
            }
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 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
    {
        refinementSphere
        {
            mode inside;
            levels ((1E15 7));
        }

        refinementCylinder
        {
            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.
    locationInMesh (-0.0001 10.0001 0.0001);


    // 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;
}
nholt is offline   Reply With Quote

Old   June 14, 2016, 15:36
Default
  #2
New Member
 
Nick Holt
Join Date: Jun 2015
Posts: 2
Rep Power: 0
nholt is on a distinguished road
It's been quite a while since I initially posted this question, and I've learned some lessons about snappyHexMesh along the way. This applies to OF v2.3.1.

The main issue here was sHM was reaching the refinement limit within the castellated mesh phase. I had the limit set to 3M cells and refinement regions (sphere and cylinder regions) set to refine to level 7. A better solution is to first increase the cell limit (I like to set it excessively large to prevent sHM from stopping refinement). If sHM crashes then you should reduce your refinement level in any of the categories to reduce memory requirements. I've also found that the refinement level of 7 within the refinement regions is excessive. I prefer to set the refinement level to 4 in the refinement regions and surface/edge refinement level to 7 and set nCellsBetweenLevels to 4 so that the transition from fine to coarse is more gradual.
pavlossemelides likes this.
nholt is offline   Reply With Quote

Reply

Tags
refinement regions, 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
[snappyHexMesh] Removing further cells after SHM zonda OpenFOAM Meshing & Mesh Conversion 14 September 15, 2017 08:50
[snappyHexMesh] Bad meshing result on corrugated metal sheet UebertreibeR OpenFOAM Meshing & Mesh Conversion 1 August 19, 2016 05:55
[snappyHexMesh] SnappyHexMesh no layers and no decent mesh for complex geometry pizzaspinate OpenFOAM Meshing & Mesh Conversion 1 February 25, 2015 08:05
[snappyHexMesh] Problem with Sanpper, surface still Rough Zephiro88 OpenFOAM Meshing & Mesh Conversion 7 November 5, 2014 13:05
killed "snappyHexMesh" parkh32 OpenFOAM Pre-Processing 2 April 8, 2012 18:12


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