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] snappyHexMesh does not create any mesh except one for the reference cell (https://www.cfd-online.com/Forums/openfoam-meshing/216697-snappyhexmesh-does-not-create-any-mesh-except-one-reference-cell.html)

Arman_N April 16, 2019 13:55

snappyHexMesh does not create any mesh except one for the reference cell
 
2 Attachment(s)
Hello to all,

I am somewhat new to CFD modeling and mesh generation.

Basically, I am trying to generate a mesh for a simple porous geometry and have created an .stl file for it (file attached below). I have checked it with surfaceCheck and it says that the surface is closed.

However, when I run the snappyHexMesh command, it removes all the background mesh except for the cell which contains the point specified by locationInMesh in snappyHexMeshDict (figure attached below). It seems that somehow the rest of the sections of the mesh are unreachable and hence it removes them all.

I would really appreciate if anyone could help me find out what I am doing wrong and how to solve this since it seems to be a trivial problem.

Many thanks,
Arman


snappyHexMeshDict:
Code:

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

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

castellatedMesh true;
snap            false;
addLayers      false;

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

castellatedMeshControls
{
    maxLocalCells 500000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;

    features
    (
        //{
        //    file "all.eMesh";
        //    level 0;
        //}
    );

    refinementSurfaces
    {
        all
        {
            level (0 0);
        }
    }

    resolveFeatureAngle 30;

    refinementRegions
    {       
    }

    locationInMesh (-0.00123 0.00003 0);
    allowFreeStandingZoneFaces true;
}

snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 300;
    nRelaxIter 5;
        nFeatureSnapIter 10;
        implicitFeatureSnap false;
        explicitFeatureSnap true;
        multiRegionFeatureSnap false;
}

addLayersControls
{
    relativeSizes true;

    layers
    {
        //"flange_.*"
        //{
        //    nSurfaceLayers 1;
        //}
    }

    expansionRatio 1.0;
    finalLayerThickness 0.3;
    minThickness 0.1;
    nGrow 0;
    featureAngle 0;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    #include "meshQualityDict"

    relaxed
    {
        maxNonOrtho 80;
    }

    maxBoundarySkewness 2;
    maxInternalSkewness 2;
    maxSkewness 2;
    maxConcave 80;
    minFlatness 0.5;
    minVol 0;
    minTetQuality 1e-10;
    minArea 0;
    minTwist 0.5;
    minDeterminant 0.25;
    minFaceWeight 0.2;
    minVolRatio 0.5;
    minTriangleTwist -1;
    nSmoothScale 4;
    errorReduction 0.75;
}

writeFlags
(
    scalarLevels
    layerSets
    layerFields
);

debug 0;

mergeTolerance 1E-6;

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


snappyHexMesh output:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  v1806                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.com                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : v1806
Arch  : "LSB;label=32;scalar=64"
Exec  : snappyHexMesh
Date  : Apr 16 2019
Time  : 17:50:34
Host  : "Arman"
PID    : 16369
I/O    : uncollated
Case  : /media/arman/EDU/ProSoft/Installed/OpenFOAM/GeoChemFoam/run/validationCase/mesh_all
nProcs : 1
trapFpe: Floating point exception trapping enabled (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

--> FOAM Warning :
    From function static Foam::IOstreamOption::compressionType Foam::IOstreamOption::compressionEnum(const Foam::word&)
    in file db/IOstreams/IOstreams/IOstreamOption.C at line 86
    Unknown compression specifier 'uncompressed', assuming no compression
Create mesh for time = 0

Read mesh in = 0.03 s

Overall mesh bounding box  : (-0.0018 -0.00055 -2.5e-05) (0.0018 0.00055 2.5e-05)
Relative tolerance        : 1e-06
Absolute matching distance : 3.76464e-09

Reading refinement surfaces.
Read refinement surfaces in = 0.01 s

Reading refinement shells.
Read refinement shells in = 0 s

Setting refinement level of surface to be consistent with shells.
For geometry all.stl detected 0 uncached triangles out of 5000
Checked shell refinement in = 0.01 s

Reading features.
Read features in = 0 s


Determining initial surface intersections
-----------------------------------------

Edge intersection testing:
    Number of edges            : 25532
    Number of edges to retest  : 25532
    Number of intersected edges : 8130
Calculated surface intersections in = 0.07 s

Initial mesh : cells:6336  faces:25532  points:13050
Cells per refinement level:
    0        6336

Adding patches for surface regions
----------------------------------

Patch Type                Region                       
----- ----                ------                       
all:

1    wall                all                         

Added patches in = 0 s

Edge intersection testing:
    Number of edges            : 25532
    Number of edges to retest  : 0
    Number of intersected edges : 8130
Selecting decompositionMethod none [1]

Refinement phase
----------------

Found point (-0.00123 3e-05 0) in cell 3334 on processor 0

Surface refinement iteration 0
------------------------------

Marked for refinement due to surface intersection          : 0 cells.
Determined cells to refine in = 0.03 s
Selected for refinement : 0 cells (out of 6336)
Stopping refining since too few cells selected.


Removing mesh beyond surface intersections
------------------------------------------

Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 1 out of 17 regions.
Keeping all cells containing inside points
Selected for keeping : 6336 cells.
Edge intersection testing:
    Number of edges            : 25532
    Number of edges to retest  : 0
    Number of intersected edges : 8130
Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 1 out of 17 regions.
Keeping all cells containing inside points
Selected for keeping : 6336 cells.
Edge intersection testing:
    Number of edges            : 25532
    Number of edges to retest  : 0
    Number of intersected edges : 8130

Shell refinement iteration 0
----------------------------

Marked for refinement due to distance to explicit features : 0 cells.
Marked for refinement due to refinement shells            : 0 cells.
Determined cells to refine in = 0.13 s
Selected for internal refinement : 0 cells (out of 6336)
Stopping refining since too few cells selected.


Dangling coarse cells refinement iteration 0
--------------------------------------------

Determined cells to refine in = 0 s
Selected for refinement : 0 cells (out of 6336)
Stopping refining since too few cells selected.


Dangling coarse cells refinement iteration 0
--------------------------------------------

Determined cells to refine in = 0 s
Selected for refinement : 0 cells (out of 6336)
Stopping refining since too few cells selected.


Refinement transition refinement iteration 0
--------------------------------------------

Determined cells to refine in = 0 s
Selected for refinement : 0 cells (out of 6336)
Stopping refining since too few cells selected.


Splitting mesh at surface intersections
---------------------------------------

Introducing baffles for 8130 faces that are intersected by the surface.

Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 1 out of 17 regions.
Edge intersection testing:
    Number of edges            : 26454
    Number of edges to retest  : 18630
    Number of intersected edges : 9052
Created baffles in = 0.11 s


After introducing baffles : cells:6336  faces:26454  points:13050
Cells per refinement level:
    0        6336

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

markFacesOnProblemCells : marked 6752 additional internal faces to be converted into baffles.
Analyzed problem cells in = 0.01 s


Introducing baffles to delete problem cells.

Edge intersection testing:
    Number of edges            : 33206
    Number of edges to retest  : 21695
    Number of intersected edges : 9052
Created baffles in = 0.05 s


After introducing baffles : cells:6336  faces:33206  points:13050
Cells per refinement level:
    0        6336
Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 1956 out of 3626 regions.
Edge intersection testing:
    Number of edges            : 33206
    Number of edges to retest  : 25376
    Number of intersected edges : 9052

Remove unreachable sections of mesh
-----------------------------------

Keeping all cells containing points 1((-0.00123 3e-05 0))
Selected for keeping : 1 cells.
Edge intersection testing:
    Number of edges            : 6
    Number of edges to retest  : 0
    Number of intersected edges : 2
Split mesh in = 0.14 s


After subsetting : cells:1  faces:6  points:8
Cells per refinement level:
    0        1

Introducing zones for interfaces
--------------------------------

Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 0 out of 1 regions.
Setting faceZones according to neighbouring cellZones:

Edge intersection testing:
    Number of edges            : 6
    Number of edges to retest  : 0
    Number of intersected edges : 2

Handling cells with snap problems
---------------------------------

Introducing baffles for 2 faces that are intersected by the surface.

Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 0 out of 1 regions.
Edge intersection testing:
    Number of edges            : 6
    Number of edges to retest  : 6
    Number of intersected edges : 2
Created baffles in = 0 s


After introducing baffles : cells:1  faces:6  points:8
Cells per refinement level:
    0        1

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

markFacesOnProblemCells : marked 0 additional internal faces to be converted into baffles.
Analyzed problem cells in = 0 s


Introducing baffles to delete problem cells.

Created baffles in = 0 s


After introducing baffles : cells:1  faces:6  points:8
Cells per refinement level:
    0        1
Setting cellZones according to locationsInMesh:
Location : (-0.00123 3e-05 0)
    cellZone : none

For cellZone none found point (-0.00123 3e-05 0) in global region 0 out of 1 regions.
Edge intersection testing:
    Number of edges            : 6
    Number of edges to retest  : 6
    Number of intersected edges : 2

Remove unreachable sections of mesh
-----------------------------------

Split mesh in = 0 s


After subsetting : cells:1  faces:6  points:8
Cells per refinement level:
    0        1

Merge free-standing baffles
---------------------------

freeStandingBaffles : detected 0 free-standing baffles out of 0

Detected free-standing baffles : 0
Merged free-standing baffles in = 0 s


dupNonManifoldPoints : Found : 0 non-manifold points (out of 8)
Detected unsplittable baffles : 0

Merge refined boundary faces
----------------------------

Merging 0 sets of faces.

No faces merged ...

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.

No straight edges simplified and no points removed ...
Refined mesh : cells:1  faces:6  points:8
Cells per refinement level:
    0        1
Writing mesh to time 1
Wrote mesh in = 0 s.
Mesh refined in = 0.46 s.
Checking final mesh ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 0
    faces with face pyramid volume < 0                    : 0
    faces with face-decomposition tet quality < 1e-10      : 0
    faces with concavity > 80  degrees                    : 0
    faces with area < 0    m^2                            : 0
    faces with skewness > 2  (internal) or 2  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.2        : 0
    faces with volume ratio of neighbour cells < 0.5      : 0
    faces with face twist < 0.5                            : 0
    faces on cells with determinant < 0.25                : 0
Finished meshing without any errors
Finished meshing in = 0.59 s.
End

Attachment 69447

Attachment 69448

Arman_N May 20, 2019 17:16

Solved!
 
1 Attachment(s)
UPDATE:

I managed to solve the problem by simply inverting the .stl file (attached below).

It seems that snappyHexMesh has trouble meshing a geometry with holes in it (i.e. porous media). So instead, the holes should be created into a .stl file and then removed from the background mesh using snappyHexMesh.

Cheers.


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