CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] Weird 90° corners after castellatedMesh (https://www.cfd-online.com/Forums/openfoam-meshing/254654-weird-90-corners-after-castellatedmesh.html)

Jahir February 22, 2024 20:35

Weird 90° corners after castellatedMesh
 
2 Attachment(s)
Hello.

This is my first post in this forum (lurking for a couple of months) and I hope it's not something trivial.

I'm working with an internal mesh using blockMesh + snappyHexMesh (I just started using sHM) and after some reading I've reached a decent mesh (at least after using castellatedMesh). What's worrying me is that there's a wierd corner on a fairly simple part of my geometry which I believe shouldn't have much problem. This is my sHMDict:



Code:

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

// Which of the steps to run
castellatedMesh true;
snap            false;
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
{
    inlet.stl
    {
        type triSurfaceMesh;
        name inlet;
    }
    outlet.stl
    {
        type triSurfaceMesh;
        name outlet;
    }
    atmosphere.stl
    {
        type triSurfaceMesh;
        name atmosphere;
    }
    walls1.stl
    {
        type triSurfaceMesh;
        name walls1;
    }
    walls2.stl
    {
        type triSurfaceMesh;
        name walls2;
    }
/*
    refinementBox
    {
        type box;
        min  (-1.0 -0.7 0.0);
        max  ( 8.0  0.7 2.5);
    }
*/
}

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

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

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

    // 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 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.
    features
    (
        /*{
            file "tanque.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.

    refinementSurfaces
    {
        inlet
        {
            // Surface-wise min and max refinement level
            level (0 0);
            patchInfo
            {
                type patch;
            }
        }
        outlet
        {
            // Surface-wise min and max refinement level
            level (0 0);
            patchInfo
            {
                type patch;
            }
        }
        atmosphere
        {
            // Surface-wise min and max refinement level
            level (0 0);
            patchInfo
            {
                type patch;
            }
        }
        walls1
        {
            // Surface-wise min and max refinement level
            level (0 0);
        }
        walls2
        {
            // Surface-wise min and max refinement level
            level (1 1);
        }
    }

    // Resolve sharp angles
    resolveFeatureAngle 5;


    // 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
    {
        /*tanque.stl
        {
            mode inside;
            levels ((0 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 (1 1 1);


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

The boundary walls2 is the floor which is being refined nicely for most of the geometry. walls1 contain the vertical and top walls and a bottom wall that I don't need to refine. I've used (0 1) refinement for walls1 but I just need the bottom cells refined. I've also tried many different resolveFeatureAngle values with no succes.

After moving up to the next step, what would be your advice to have a nice refinement? :confused:


EDIT: Turned out to be something trivial, the gap was formed because the element size 0 was larger than the length of that part of the geometry.


All times are GMT -4. The time now is 19:49.