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

[snappyHexMesh] Snappy leaves out one Geometry

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Clau.77

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 30, 2021, 06:20
Default Snappy leaves out one Geometry
  #1
Member
 
Claudia
Join Date: Mar 2021
Posts: 43
Rep Power: 5
Clau.77 is on a distinguished road
Hey guys!


I am using OF version 8. My aim is to mesh a tray filled with chocolate surrounded by air. I am able to mesh the tray with the air but when I try to at a chocolate bar, snappy doesn't find the cell zone for the chocolate, only the face zone (as you can see in the attached picture).



Here the blockMesh:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 1;

xMin -0.42;
xMax 0.42;
yMin -0.12;
yMax 0.1;
zMin -0.22;
zMax 0.14;


vertices
(
    ($xMin    $yMin    $zMin)    //0
    ($xMax    $yMin    $zMin)    //1
    ($xMax    $yMax    $zMin)    //2
    ($xMin    $yMax    $zMin)    //3
    ($xMin    $yMin    $zMax)    //4
    ($xMax    $yMin    $zMax)    //5
    ($xMax    $yMax    $zMax)    //6
    ($xMin    $yMax    $zMax)    //7
);

blocks
(
    hex (0 1 2 3 4 5 6 7)
    (100 40 45)
    simpleGrading (1 1 1)
);

edges
(

);



boundary
(

    inlet
    {
        type patch;
        faces
        (
         (0 4 7 3)       
        );
    }
    outlet
    {
        type patch;
        faces
        (
            (2 6 5 1)
        );
    }
    walls
    {
        type patch;
        faces
        (
            (3 7 6 2)
            (4 5 6 7)
            (0 3 2 1)
            (0 1 5 4)
        );
    }
 
);

mergePatchPairs
(

);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
and here the snappyHexMeshDict:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  8                                     |
|   \\  /    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       false;


geometry
{ 
   Form.stl
    {
        type triSurfaceMesh;
        name Form;
    }

   Luft.stl //=air
     {
       type triSurfaceMesh;
       name Luft;
     }

   Schokolade.stl
     {
       type triSurfaceMesh;
       name Schokolade;
     }
};


castellatedMeshControls
{

    maxLocalCells 10000000;

    maxGlobalCells 20000000;

    minRefinementCells 0;

    nCellsBetweenLevels 1;


    features
    (  
     { file "Form.eMesh"; level 2; }
     {file "Schokolade.eMesh"; level 2; }
     {file "Luft.eMesh"; level 1;}
    );

    refinementSurfaces
    {     
        Form
        {
      level ( 2 2 ); 
      
            cellZone Form;
            faceZone Form;
            cellZoneInside inside;  
        }
        Luft
        {
      level ( 1 1 ); 
      
            cellZone Luft;
            faceZone Luft;
            cellZoneInside inside;  
        }
        Schokolade
        {
      level ( 2 2 ); 
      
            cellZone Schokolade;
            faceZone Schokolade;
            cellZoneInside inside;  
        }
    }

    resolveFeatureAngle 40;

    refinementRegions
    {
      
      Form
        {
            mode inside;
            levels ((1 1));
        }
      
    }


    locationInMesh (-0.0151 0.031 0.001);

    allowFreeStandingZoneFaces false;
}


snapControls
{

  nSmoothPatch 4;

  tolerance 2.0; 

    nSolveIter 150; 

    nRelaxIter 15;

    nFeatureSnapIter 15;

        implicitFeatureSnap true; 

        explicitFeatureSnap false; 

        multiRegionFeatureSnap false;
}


addLayersControls
{
    relativeSizes false;

    layers
    {
      
        Form
        {
            nSurfaceLayers 2;
            expansionRatio 1.2;
            finalLayerThickness 0.0004;
            minThickness 0.00007;
        }
      
    }
    expansionRatio 1.3;

    finalLayerThickness 0.07;

    minThickness 0.0001;

    nGrow 0; 


    featureAngle 75; 

    nRelaxIter 5;

    nSmoothSurfaceNormals 4;

    nSmoothNormals 3;

    nSmoothThickness 10;

    maxFaceThicknessRatio 0.8;

    maxThicknessToMedialRatio 0.6;

    //nMedialAxisIter 4;

    nBufferCellsNoExtrude 0;

    nLayerIter 50;

    //nRelaxedIter 5;
}


meshQualityControls
{
    #include "meshQualityDict"

    /*relaxed
    {
        //- Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 180;
    }*/

    nSmoothScale 4;
    errorReduction 0.75;
}


writeFlags
(
    scalarLevels    // write volScalarField with cellLevel for postprocessing
    layerSets       // write cellSets, faceSets of faces in layer
    layerFields     // write volScalarField for layer coverage
);


mergeTolerance 1E-6;


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

I am getting three types of warnings:



Code:
Introducing baffles to block off problem cells
----------------------------------------------

--> FOAM Warning : 
    From function Foam::labelList Foam::meshRefinement::nearestPatch(const labelList&) const
    in file meshRefinement/meshRefinementProblemCells.C at line 440
    Did not visit some faces, e.g. face 0 at (-0.4116 -0.11725 -0.216)
Assigning  these cells to patch 3
markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles.
Analyzed problem cells in = 1.47 s
Code:
--> FOAM Warning : Displacement (-8.2175873e-06 0 7.1834088e-06) at mesh point 64855 coord (-0.31020895 0.028528494 -0.10086257) points through the surrounding patch faces
Smoothing displacement ...
Iteration 0
Iteration 10
Iteration 20
Iteration 30
Iteration 40
Iteration 50
Iteration 60
Iteration 70
Iteration 80
Iteration 90
Iteration 100
Iteration 110
Iteration 120
Iteration 130
Iteration 140
Displacement smoothed in = 12.48 s
Code:
--> FOAM Warning : 
    From function void Foam::snappySnapDriver::doSnap(const Foam::dictionary&, const Foam::dictionary&, Foam::scalar, Foam::scalar, const Foam::snapParameters&)
    in file snappyHexMeshDriver/snappySnapDriver.C at line 2764
    Did not successfully snap mesh. Continuing to snap to resolve easy
    surfaces but the resulting mesh will not satisfy your quality constraints
so obviously I did something wrong, but I am not that experienced with OF, so I don't know what to do. I tried playing with the resolveFeatureAngle and increased the iterations but it didn't help.


Also I am not sure about the coordinates for the locationInMesh. Right now it is somewhere in the tray (=Form). How do I know what coordinates to choose when I have mulitple geometries?



I hope that someone can give me some advice, i am really stuck here
Attached Images
File Type: jpg Form.jpg (48.9 KB, 31 views)
Clau.77 is offline   Reply With Quote

Old   April 30, 2021, 09:30
Default
  #2
Member
 
Claudia
Join Date: Mar 2021
Posts: 43
Rep Power: 5
Clau.77 is on a distinguished road
Update: I managed to create a mesh, the solution was to leave out the regionRefinement (I guess the problem here is that you are suppose to use patches and not the whole geometry?) and setting the tolerance higher.
cfdhunter likes this.
Clau.77 is offline   Reply With Quote

Reply

Tags
displacement, meshing, snappyhexmesh, version 8


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
[mesh manipulation] Full or half geometry to use? vava10 OpenFOAM Meshing & Mesh Conversion 0 March 14, 2021 08:31
[ICEM] Holes in complex ICEM geometry alecbann ANSYS Meshing & Geometry 2 April 4, 2019 04:40
Error while running pisoFoam with snappy but ran smoothly without snappy in empty dm faiazk OpenFOAM Running, Solving & CFD 0 October 24, 2018 14:51
[CAD formats] translating geometry from Abaqus to OpenFOAM skuznet OpenFOAM Meshing & Mesh Conversion 3 January 10, 2014 14:49
Export geometry file from ansys mechanical browns6 Structural Mechanics 0 August 27, 2013 17:19


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