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

[snappyHexMesh] Cylinder with snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 18, 2014, 13:03
Default Cylinder with snappyHexMesh
  #1
Senior Member
 
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16
Andrea_85 is on a distinguished road
Hi all,

i am trying to do (apparently) a very simple thing. I need to mesh a cylinder and refine a portion of it (uniformly along the direction of the flow, not just close to the walls).

I followed this guide

https://sites.google.com/site/snappy.../cylinder-case

using an open STL for the cylinder and the "right" blockMesh. The mesh without refinement looks very good and also checkMesh is happy (see meshNoRef.png).

Problems come with the refinement. i used a "searchableCylinder" to refine a particular region of my domain with level set to 1. Here my snappyHexMeshDict


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

// 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
geometry
{
    cylinder.stl
    {
         type triSurfaceMesh;
        name cyl;
    }

    cylinderRef
    {
    type searchableCylinder;
    point1 (0.004 0.004 0.002);
    point2 (0.004 0.004 0.0114);
    radius 0.004;
    }


};

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

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

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



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

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

     }

    // Resolve sharp angles on fridges
    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
    {
         cylinderRef
        {
            mode inside;
            levels ((1 1));
        }
     }

    // 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.00409890809 0.0048098080 0.000031231);

    allowFreeStandingZoneFaces true;

    }



// Settings for the snapping.
snapControls
{
    //- Number of patch smoothing iterations before finding correspondence
    //  to surface
    nSmoothPatch 8;

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

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

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

// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    //- Maximum non-orthogonality allowed. Set to 180 to disable.
    maxNonOrtho 60;  //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-18;

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

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

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

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

    // Advanced

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


// ************************************************************************* //
After the mesh genation, checkMesh (-allGeometry -allTopology) complains about concaveCell and concaveFaces. You can see in the pictures attached that those cells are where there is the connection between coarse and fine grid.


Code:
Create polyMesh for time = 2

Time = 2

Mesh stats
    points:           67451
    faces:            194684
    internal faces:   187488
    cells:            63720
    boundary patches: 4
    point zones:      0
    face zones:       0
    cell zones:       0

Overall number of cells of each type:
    hexahedra:     60884
    prisms:        1992
    wedges:        0
    pyramids:      0
    tet wedges:    0
    tetrahedra:    0
    polyhedra:     844

Checking topology...
    Boundary definition OK.
    Cell to face addressing OK.
    Point usage OK.
    Upper triangular ordering OK.
    Face vertices OK.
    Topological cell zip-up check OK.
    Face-face connectivity OK.
    Number of regions: 1 (OK).

Checking patch topology for multiply connected surfaces ...
    Patch               Faces    Points   Surface topology                   Bounding box
    side                0        0        ok (empty)                        
    inlet               316      333      ok (non-closed singly connected)   (7.12864e-08 7.12864e-08 0.0134) (0.00799993 0.00799993 0.0134)
    outlet              316      333      ok (non-closed singly connected)   (7.12864e-08 7.12864e-08 0) (0.00799993 0.00799993 0)
    cyl_CreatedbyGmsh   6564     6792     ok (non-closed singly connected)   (1.60272e-08 1.59111e-08 0) (0.00799998 0.00799998 0.0134)


Checking geometry...
    Overall domain bounding box (1.60272e-08 1.59111e-08 0) (0.00799998 0.00799998 0.0134)
    Mesh (non-empty, non-wedge) directions (1 1 1)
    Mesh (non-empty) directions (1 1 1)
    Boundary openness (-9.99104e-17 -3.05911e-16 -9.57394e-17) OK.
    Max cell openness = 3.12947e-16 OK.
    Max aspect ratio = 7.851 OK.
    Minumum face area = 7.65872e-09. Maximum face area = 2.35565e-07.  Face area magnitudes OK.
    Min volume = 8.95608e-13. Max volume = 7.73669e-11.  Total volume = 6.72707e-07.  Cell volumes OK.
    Mesh non-orthogonality Max: 53.9685 average: 5.82714
    Non-orthogonality check OK.
    Face pyramids OK.
    Max skewness = 1.61242 OK.
    Coupled point location match (average 0) OK.
    Face tets OK.
    Min/max edge length = 9.12058e-05 0.000604284 OK.
   *There are 16 faces with concave angles between consecutive edges. Max concave angle = 14.3664 degrees.
  <<Writing 16 faces with concave angles to set concaveFaces
    Face flatness (1 = flat, 0 = butterfly) : average = 0.999943  min = 0.915904
    All face flatness OK.
    Cell determinant (wellposedness) : minimum: 0.070727 average: 8.05378
    Cell determinant check OK.
 ***Concave cells (using face planes) found, number of cells: 559
  <<Writing 559 concave cells to set concaveCells

Failed 1 mesh checks.

End
What can i do to fix the problem?

Thanks
Andrea
Attached Images
File Type: png meshNoRef.png (48.8 KB, 323 views)
File Type: jpg mesh1.jpg (66.0 KB, 275 views)
File Type: jpg mesh2.jpg (68.4 KB, 221 views)
File Type: jpg concaveCell1.jpg (51.8 KB, 210 views)
File Type: jpg concaveCell2.jpg (74.0 KB, 218 views)
Andrea_85 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
[snappyHexMesh] snappyHexMesh not snapping to cylinder end wildfire230 OpenFOAM Meshing & Mesh Conversion 0 March 1, 2019 12:09
[snappyHexMesh] Create cylinder around snappyHexMesh for MRF/rotating linnemann OpenFOAM Meshing & Mesh Conversion 6 October 19, 2014 23:19
[snappyHexMesh] snappyHexMesh - 2D Cylinder Problems Logan Page OpenFOAM Meshing & Mesh Conversion 4 May 27, 2013 12:07
SnappyHexMesh cylinder 2D mzweemer OpenFOAM Pre-Processing 6 March 28, 2013 03:34
[snappyHexMesh] SnappyHexMesh Meshing inside a cylinder nammari OpenFOAM Meshing & Mesh Conversion 5 March 11, 2011 19:49


All times are GMT -4. The time now is 12:18.