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

[snappyHexMesh] Bad looking cells with CastelledMesh

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

Like Tree1Likes
  • 1 Post By AndreasPe

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 7, 2020, 07:17
Default Bad looking cells with CastelledMesh
  #1
New Member
 
Join Date: Dec 2019
Posts: 4
Rep Power: 2
juvima is on a distinguished road
Hello everybody, I'm struggling with some bad looking cells generated by the CastellatedMesh step of my snappyHexMeshDict file, cf. pictures. As you can see, some cells are extremely plane/crushed. I tried changing several parameters of my snappyHexMeshDict file, but the output doesn't change. This is my code:
Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

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

#include "include/inputVariables" //definition of input values
offset 1; //offset

x_positive #calc "3*$offset + $n_panel_x_dir*$x_panel";
x_negative #calc "-1*$offset";
y_positive #calc "0.5*$y_panel + $offset";
y_negative #calc "-1*$y_positive";
z_positive #calc "1.5*$offset";

// 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
{
    Panel_0
    {
        type triSurfaceMesh;
        file "Panel_0.stl";
    }
    Panel_1
    {
        type triSurfaceMesh;
        file "Panel_1.stl";
    }
    Panel_2
    {
        type triSurfaceMesh;
        file "Panel_2.stl";
    }
    Panel_3
    {
        type triSurfaceMesh;
        file "Panel_3.stl";
    }

    Panel_4
    {
        type triSurfaceMesh;
        file "Panel_4.stl";
    }
    Panel_5
    {
        type triSurfaceMesh;
        file "Panel_5.stl";
    }
    
   
    refinementBox
    {
        type searchableBox;
        min ($x_negative $y_negative 0);
        max ($x_positive $y_positive $z_positive);
    }
};



// 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 2000000;
    maxGlobalCells 4000000;

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

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



    // 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 "Panel_0.eMesh" "Panel_1.eMesh" "Panel_2.eMesh" "Panel_3.eMesh" "Panel_4.eMesh" "Panel_5.eMesh" ;
            level 2;
        }

    );



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

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

        Panel_1
        {
            level (2 4);

            patchInfo
            {
                type wall;
                inGroups (Panel_PV);
            }
        }
        Panel_2
        {
            level (2 4);

            patchInfo
            {
                type wall;
                inGroups (Panel_PV);
            }
        }
        Panel_3
        {
            level (2 4);

            patchInfo
            {
                type wall;
                inGroups (Panel_PV);
            }
        }
        Panel_4
        {
            level (2 4);

            patchInfo
            {
                type wall;
                inGroups (Panel_PV);
            }
        }
        Panel_5
        {
            level (2 4);

            patchInfo
            {
                type wall;
                inGroups (Panel_PV);
            }
        }

    }

    }

    // Resolve sharp angles
    resolveFeatureAngle 30;
    // resolveFeatureAngle 0;
    

    // 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
    {
        refinementBox
        {
            mode inside;
            //levels ((1E15 2));
        levels ((1E15 4));
        }
    }


    // 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.1 0.1 0.9);


    // 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;
}
Surprisingly though, snappyHexMesh seems to believe that this mesh is satisfactory, as the log indicates (showing only the last iterations):
Code:
Merging all points on surface that
- are used by only two boundary faces and
- make an angle with a cosine of more than 0.707107.

Removing 2618 straight edge points ...

Edge intersection testing:
    Number of edges             : 22173899
    Number of edges to retest   : 17447
    Number of intersected edges : 1085167

Undo iteration 0
----------------
Checking faces in error :
    non-orthogonality > 65  degrees                        : 0
    faces with face pyramid volume < 1e-13                 : 0
    faces with face-decomposition tet quality < 1e-15      : 0
    faces with concavity > 80  degrees                     : 0
    faces with skewness > 4   (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 0
Refined mesh : cells:7083129  faces:22173899  points:8009619
Cells per refinement level:
    0   42210
    1   42270
    2   158288
    3   838978
    4   6001383
Writing mesh to time constant
Wrote mesh in = 245.06 s.
Mesh refined in = 2480.19 s.
Checking final mesh ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 0
    faces with face pyramid volume < 1e-13                 : 0
    faces with face-decomposition tet quality < 1e-15      : 0
    faces with concavity > 80  degrees                     : 0
    faces with skewness > 4   (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 0
Finished meshing without any errors
Finished meshing in = 2530.9 s.
End

Is there anything that I am missing? Which meshing parameters should I modify in order to solver this problem? Or should I change completely my approach?



Thank you a lot in advance!
Attached Images
File Type: jpg y-0-00.jpg (205.4 KB, 18 views)
File Type: jpg y-0-05.jpg (207.1 KB, 13 views)
File Type: png y-0-10.png (186.4 KB, 14 views)
juvima is offline   Reply With Quote

Old   January 7, 2020, 07:53
Default
  #2
New Member
 
Andreas P.
Join Date: May 2017
Posts: 29
Rep Power: 5
AndreasPe is on a distinguished road
I think these are visualization issues of paraview. Do not check the checkbox "Decompose polyhedra" in the properties of the foam-file that you load with paraview and check the crinkle slice checkbox in the slice properties in order to properly show a slice that just consists "complete" cells.
ingraban likes this.
AndreasPe is offline   Reply With Quote

Old   January 7, 2020, 09:40
Default
  #3
New Member
 
Join Date: Dec 2019
Posts: 4
Rep Power: 2
juvima is on a distinguished road
Thank you very much! You were right, checking "Use VTK Polyhedron" (in Paraview 5.4.0) in the properties of the foam-file and checking "Crinkle Slice" in the slice properties I have a nice visualization.


Have a nice day and thank you again for your kind help.
Attached Images
File Type: png vtk_polyhedon.png (63.9 KB, 16 views)
juvima is offline   Reply With Quote

Reply

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] snappyHexMesh sticking point natty_king OpenFOAM Meshing & Mesh Conversion 10 August 5, 2019 19:18
[blockMesh] Create internal faces as patch in blockMesh m.delta68 OpenFOAM Meshing & Mesh Conversion 14 July 12, 2018 14:43
snappyHexMesh in parallel - FOAM Fatal IO Error mturcios777 OpenFOAM Running, Solving & CFD 4 August 10, 2012 19:18
how to deal with bad quality cells? phsieh2005 OpenFOAM 3 July 20, 2011 09:35
Problems of Duns Codes! Martin J Main CFD Forum 8 August 14, 2003 23:19


All times are GMT -4. The time now is 02:27.