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

[snappyHexMesh] problem with snappyHexMesh

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 3 Post By pbalz
  • 1 Post By Antimony
  • 1 Post By pbalz

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 12, 2016, 10:48
Default problem with snappyHexMesh
  #1
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
Hi,
I am new to OpenFoam and snappyHexMesh.
I am trying to make a reactor (cylinder) mesh with snappyHexMesh.
But it works not gut. After snappyHexMesh there are errors as follows:

--> FOAM Warning :
From function autoSnapDriver::doSnap(..)
in file autoHexMesh/autoHexMeshDriver/autoSnapDriver.C at line 3138
Did not succesfully snap mesh. Continuing to snap to resolve easy
surfaces but the resulting mesh will not satisfy your quality constraints

Repatching faces according to nearest surface ...
Repatched 6510 faces in = 0.13 s


Edge intersection testing:
Number of edges : 775190
Number of edges to retest : 193558
Number of intersected edges : 27873
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.866025.

No straight edges simplified and no points removed ...
Snapped mesh : cells:250000 faces:775190 points:276214
Cells per refinement level:
0 250000
Writing mesh to time 3.710179
Wrote mesh in = 2.07 s.
Mesh snapped in = 168.59 s.
Checking final mesh ...
Checking faces in error :
non-orthogonality > 65 degrees : 16264
faces with concavity > 80 degrees : 35
faces with skewness > 4 (internal) or 20 (boundary) : 0
faces with interpolation weights (0..1) < 0.02 : 11
faces with volume ratio of neighbour cells < 0.01 : 0
faces with face twist < 0.02 : 1
faces on cells with determinant < 0.001 : 96
Finished meshing with 16407 illegal faces (concave, zero area or negative cell pyramid volume)
Finished meshing in = 185.11 s.
End

my snappyhexmeshdict as follows:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.2.0                                 |
|   \\  /    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. 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
{
    reaktor.stl 
    {
        type triSurfaceMesh;
        name reaktor;
    }
    deckeloben.stl 
    {
        type triSurfaceMesh;
        name deckeloben;
    }
    deckelunten.stl 
    {
        type triSurfaceMesh;
        name deckelunten;
    }

    refinementBox
    {
        type searchableBox;
        min (-8.7 -1.92 -26);
        max ( 0.114  2.84 -23.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 4000000;

    // 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 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 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 "Sondeuntenkomplettmitdeckel.eMesh";
       //     level 0;
       // }

      /* {
            file "reaktor.eMesh";
            level 0;
        }
        {
            file "deckeloben.eMesh";
            level 0;
        }
        {
            file "deckelunten.eMesh";
            level 0;
        }*/
    );



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

            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type wall;
                //inGroups (reaktor);
            }
        }
        deckeloben
        {
            // Surface-wise min and max refinement level
            level (0 0);//(4 6)

            // Optional specification of patch type (default is wall). No
            // constraint types (cyclic, symmetry) etc. are allowed.
            patchInfo
            {
                type patch;// was wall
                //inGroups (inlet);
            }
        }
        deckelunten
        {
            // Surface-wise min and max refinement level
            level (0 0);//(4 6)

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

    // Resolve sharp angles
    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
    {
        refinementBox
        {
            mode inside;
            levels ((1 4));//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.001 0.001 -0.001);
    //locationInMesh (-4 -1 -1.0);// org


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



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

    // Feature snapping

        //- Number of feature edge snapping iterations.
        //  Leave out altogether to disable.
        nFeatureSnapIter 0;

        //- Detect (geometric only) features by sampling the surface
        //  (default=false).
        implicitFeatureSnap false;

        //- Use castellatedMeshControls::features (default = true)
        explicitFeatureSnap true;

        //- Detect points on multiple surfaces (only for explicitFeatureSnap)
        multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
    // Are the thickness parameters below relative to the undistorted
    // size of the refined cell outside layer (true) or absolute sizes (false).
    relativeSizes true;

    // Per final patch (so not geometry!) the layer information
    layers
    {
        /*"(lowerWall|Rohr).*"
        {
            nSurfaceLayers 10;
        }*/
    }

    // Expansion factor for layer mesh
    expansionRatio 1.0;

    // Wanted thickness of final added cell layer. If multiple layers
    // is the
    // thickness of the layer furthest away from the wall.
    // Relative to undistorted size of cell outside layer.
    // is the thickness of the layer furthest away from the wall.
    // See relativeSizes parameter.
    finalLayerThickness 0.3;

    // Minimum thickness of cell layer. If for any reason layer
    // cannot be above minThickness do not add layer.
    // Relative to undistorted size of cell outside layer.
    minThickness 0.1;

    // If points get not extruded do nGrow layers of connected faces that are
    // also not grown. This helps convergence of the layer addition process
    // close to features.
    // Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
    nGrow 0;

    // Advanced settings

    // When not to extrude surface. 0 is flat surface, 90 is when two faces
    // are perpendicular
    featureAngle 60;

    // At non-patched sides allow mesh to slip if extrusion direction makes
    // angle larger than slipFeatureAngle.
    slipFeatureAngle 30;

    // Maximum number of snapping relaxation iterations. Should stop
    // before upon reaching a correct mesh.
    nRelaxIter 3;

    // Number of smoothing iterations of surface normals
    nSmoothSurfaceNormals 1;

    // Number of smoothing iterations of interior mesh movement direction
    nSmoothNormals 3;

    // Smooth layer thickness over surface patches
    nSmoothThickness 10;

    // Stop layer growth on highly warped cells
    maxFaceThicknessRatio 0.5;

    // Reduce layer growth where ratio thickness to medial
    // distance is large
    maxThicknessToMedialRatio 0.3;

    // Angle used to pick up medial axis points
    // Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
    minMedianAxisAngle 90;


    // Create buffer region for new layer terminations
    nBufferCellsNoExtrude 0;


    // Overall max number of layer addition iterations. The mesher will exit
    // if it reaches this number of iterations; possibly with an illegal
    // mesh.
    nLayerIter 50;
}



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

    //- Minimum quality of the tet formed by the face-centre
    //  and variable base point minimum decomposition triangles and
    //  the cell centre. This has to be a positive number for tracking
    //  to work. Set to very negative number (e.g. -1E30) to
    //  disable.
    //     <0 = inside out tet,
    //      0 = flat tet
    //      1 = regular tet
    minTetQuality -1e30;

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

    //- minimum normalised cell determinant
    //- 1 = hex, <= 0 = folded or flattened illegal cell
    minDeterminant 0.001;

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

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


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

Anyone may have ideas.
Thanks a lot for your advices.
kanes is offline   Reply With Quote

Old   January 12, 2016, 14:42
Default
  #2
Member
 
Pascal Balz
Join Date: Feb 2015
Location: Germany
Posts: 44
Rep Power: 11
pbalz is on a distinguished road
Hi,

you should really use feature edge refinement instead of commenting it out.
Try using these snapControls:
Code:
snapControls
{
    nSmoothPatch 3;
    tolerance 2.0;
    nSolveIter 50;
    nRelaxIter 20;
    nFeatureSnapIter 20;
    implicitFeatureSnap false;
    explicitFeatureSnap true;
    multiRegionFeatureSnap false;
}
If this doesn't work, probably there's something wrong with your stl files (i.e. wrong dimension mm <-> m).
When it fails, your case files would help to identify the problem.
kanes, Krapf and wht like this.
__________________
Regards,
Pascal
pbalz is offline   Reply With Quote

Old   January 14, 2016, 06:00
Default
  #3
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
Hey Pascal,

Thank you very much!

I have tried to change the snapControls, but it does not work.
I think, like you said, probably there is something wrong with the .stl files. I use Salome to create the geometry and export them in .stl files.
I will check them again.

Thanks again.

reagrds,
Cheng
kanes is offline   Reply With Quote

Old   January 14, 2016, 09:08
Default
  #4
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

In your refinementSurfaces, please change from level (0 0) to at least level (3 3). I am not sure how fine your base mesh is, and if your locationInMesh has been put at a reasonable point, but nevertheless, since you are using a STL file, you need to specify a non-zero value for "level".

And as Pascal mentioned, it is best to use the featureEdges as well.

Antimony
kanes likes this.
Antimony is offline   Reply With Quote

Old   January 14, 2016, 09:59
Default
  #5
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
Quote:
Originally Posted by Antimony View Post
Hi,

In your refinementSurfaces, please change from level (0 0) to at least level (3 3). I am not sure how fine your base mesh is, and if your locationInMesh has been put at a reasonable point, but nevertheless, since you are using a STL file, you need to specify a non-zero value for "level".

And as Pascal mentioned, it is best to use the featureEdges as well.

Antimony
Hi Antimony,

thank you very much!

I have tried to change the level (0 0) to other values like (3 3) or (4 6). but it does not work either.
for example if I use level (3 3),then I get the information:
Quote:
-> FOAM FATAL ERROR:
cell 4 of level 0 does not seem to have 8 points of equal or lower level
cellPoints:6(4 9 59 60 65 66)
pointLevels:6{0}


From function hexRef8::setRefinement(const labelList&, polyTopoChange&)
in file polyTopoChange/polyTopoChange/hexRef8.C at line 3775.

FOAM aborting

#0 Foam::error:rintStack(Foam::Ostream&) at ??:?
#1 Foam::error::abort() at ??:?
#2 Foam::hexRef8::setRefinement(Foam::List<int> const&, Foam:olyTopoChange&) at ??:?
#3 Foam::meshRefinement::refine(Foam::List<int> const&) at ??:?
#4 Foam::meshRefinement::refineAndBalance(Foam::strin g const&, Foam::decompositionMethod&, Foam::fvMeshDistribute&, Foam::List<int> const&, double) at ??:?
#5 Foam::autoRefineDriver::surfaceOnlyRefine(Foam::re finementParameters const&, int) at ??:?
#6 Foam::autoRefineDriver::doRefine(Foam::dictionary const&, Foam::refinementParameters const&, Foam::snapParameters const&, bool, Foam::dictionary const&) at ??:?
#7 ? at ??:?
#8 __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9 ? at ??:?
Aborted (core dumped)
my blockMeshDict :
Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

convertToMeters 0.01;//0.0254

vertices
(

(-150 0 -150)
(150 0 -150)
(150 0 150)
(-150 0 150)
(-353.55 0 -353.55)
(353.55 0 -353.55)
(353.55 0 353.55)
(-353.55 0 353.55)



(-150 14763 -150)
(150 14763 -150)
(150 14763 150)
(-150 14763 150)
(-353.55 14763 -353.55)
(353.55 14763 -353.55)
(353.55 14763 353.55)
(-353.55 14763 353.55)
);

blocks
(
hex (0 3 2 1 8 11 10 9) (10 10 1000) simpleGrading (1 1 1)
hex (0 1 5 4 8 9 13 12) (10 10 1000) simpleGrading (1 1 1)
hex (1 2 6 5 9 10 14 13) (10 10 1000) simpleGrading (1 1 1)
hex (2 3 7 6 10 11 15 14) (10 10 1000) simpleGrading (1 1 1)
hex (3 0 4 7 11 8 12 15) (10 10 1000) simpleGrading (1 1 1)
);


boundary
(
inlet
{type patch;
faces
(
(0 3 2 1)
(0 1 5 4)
(1 2 6 5)
(2 3 7 6)
(3 0 4 7)
);
}
outlet
{type patch;
faces
(
(8 9 10 11)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
(11 15 12 8)
);
}
fixedWalls
{type wall;
faces
(
(4 5 13 12)
(5 6 14 13)
(6 7 15 14)
(7 4 12 15)
);
}
);

mergePatchPairs
(
);

// ************************************************** *********************** //
About the featureEdges, these are something I dont quite understand.
If I use the featureEdges, there is the error:
Quote:
--> FOAM FATAL IO ERROR:
Could not open "/home/chengma/OpenFOAM/chengma-3.0.0/run/probe/incompressible/simpleFoam/Cylinder_Ishii_2000/constant/triSurface/reaktor.eMesh"

file: /home/chengma/OpenFOAM/chengma-3.0.0/run/probe/incompressible/simpleFoam/Cylinder_Ishii_2000/system/snappyHexMeshDict.castellatedMeshControls.features from line 109 to line 110.

From function refinementFeatures::read(const objectRegistry&, const PtrList<dictionary>&)
in file autoHexMesh/refinementFeatures/refinementFeatures.C at line 100.
thank you again for your help.

Cheng
kanes is offline   Reply With Quote

Old   January 14, 2016, 13:09
Default
  #6
Member
 
Pascal Balz
Join Date: Feb 2015
Location: Germany
Posts: 44
Rep Power: 11
pbalz is on a distinguished road
Code:
-> FOAM FATAL ERROR: 
cell 4 of level 0 does not seem to have 8 points of equal or lower level
cellPoints:6(4 9 59 60 65 66)
pointLevels:6{0}


From function hexRef8::setRefinement(const labelList&, polyTopoChange&)
in file polyTopoChange/polyTopoChange/hexRef8.C at line 3775.
I know this strange error from using refineMesh. Changing the decomposition method from scotch to simple worked for me (just for the case that you're using exactly this).

As for the feature edge error:
Seems like you either don't have the feature edges extracted (then do a surfaceFeatureExtract) or there are missing permissions (then do something like sudo chmod -R 755 *).
kanes likes this.
__________________
Regards,
Pascal
pbalz is offline   Reply With Quote

Old   January 19, 2016, 10:04
Default
  #7
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
Hey Pascal,

thanks.
I have created the geometry again, now it works, but there are still errors.
For the feature edge I think the problem is the version of openFOAM, perhaps it is no need to use it (also surfaceFeatureExtract).

regads,
Cheng
kanes is offline   Reply With Quote

Old   January 19, 2016, 10:12
Default
  #8
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
hey,

now I can see the geometry from the paraview.
but there are still many errors.
I need only the the double-wall cylinder.but now the background geometry is still there.

maybe you have some suggests to solve this problem.







regards,
Cheng
kanes is offline   Reply With Quote

Old   January 22, 2016, 07:11
Default
  #9
Member
 
Pascal Balz
Join Date: Feb 2015
Location: Germany
Posts: 44
Rep Power: 11
pbalz is on a distinguished road
Hi Cheng,

can you provide the geometry and your case files?
By having a look at it it's easier to suggest something. I had this problem with low quality stl files and depending on the refinement level.

If your geometry consist of different patches connected together try using surfaceHookUp to check whether you have holes between your stl files or not.
__________________
Regards,
Pascal
pbalz is offline   Reply With Quote

Old   January 25, 2016, 06:35
Default
  #10
New Member
 
Cheng
Join Date: Nov 2015
Location: Germany
Posts: 18
Rep Power: 11
kanes is on a distinguished road
Quote:
Originally Posted by pbalz View Post
Hi Cheng,

can you provide the geometry and your case files?
By having a look at it it's easier to suggest something. I had this problem with low quality stl files and depending on the refinement level.

If your geometry consist of different patches connected together try using surfaceHookUp to check whether you have holes between your stl files or not.
Hi Pascal,

thank you very much for your reply!
I have solved that problem, I think problem is that I had a wrong point as locationInMesh.
Now it worked and I have got the cylinder (reactor).
But when I snappyHexMesh the rotor ( now the result (polymesh) from last step has been saved in the file constant for the next step ), there is no error, but it looks not so good. (see the pictures). It is cylinder, but after snappyHexMesh it seems that it has 4 parts.

I am not sure where the problem is.

the code of SnappyHexMesh as followed

Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.2.0 |
| \\ / 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. 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
{
ruehrer.stl
{
type triSurfaceMesh;
name ruehrer;
}
/* blatt1.stl
{
type triSurfaceMesh;
name blatt1;
}
blatt2.stl
{
type triSurfaceMesh;
name blatt2;
}
blatt3.stl
{
type triSurfaceMesh;
name blatt3;
}
blatt4.stl
{
type triSurfaceMesh;
name blatt4;
}*/

// refinementBox
// {
// type searchableBox;
// min (0 0 0);
// max (0.1 0.1 0.1);// max ( 0 0 0);
// }
};



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

// 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 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 "Sondeuntenkomplettmitdeckel.eMesh";
// level 0;
// }
);



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

// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.
patchInfo
{
type ruehrer;
inGroups (ruehrer);
}
}
/* blatt1
{
// Surface-wise min and max refinement level
level (4 6);

// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.
patchInfo
{
type ruehrer;
inGroups (ruehrer);
}
}
blatt2
{
// Surface-wise min and max refinement level
level (4 6);

// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.
patchInfo
{
type ruehrer;
inGroups (ruehrer);
}
}
blatt3
{
// Surface-wise min and max refinement level
level (4 6);

// Optional specification of patch type (default is wall). No
// constraint types (cyclic, symmetry) etc. are allowed.
patchInfo
{
type ruehrer;
inGroups (ruehrer);
}
}
blatt4
{
// Surface-wise min and max refinement level
level (4 6);

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

// Resolve sharp angles
resolveFeatureAngle 30;//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
{
refinementBox
{
mode inside;
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 (-20 -9 -10);//(-4 -1 -1.0)


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



// Settings for the snapping.
snapControls
{
//- Number of patch smoothing iterations before finding correspondence
// to surface
nSmoothPatch 8;//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 2.0;

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

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

// Feature snapping

//- Number of feature edge snapping iterations.
// Leave out altogether to disable.
nFeatureSnapIter 20;//0

//- Detect (geometric only) features by sampling the surface
// (default=false).
implicitFeatureSnap false;

//- Use castellatedMeshControls::features (default = true)
explicitFeatureSnap true;

//- Detect points on multiple surfaces (only for explicitFeatureSnap)
multiRegionFeatureSnap false;
}



// Settings for the layer addition.
addLayersControls
{
// Are the thickness parameters below relative to the undistorted
// size of the refined cell outside layer (true) or absolute sizes (false).
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
"(lowerWall|ruehrer).*"
{
nSurfaceLayers 10;
}
}



// Expansion factor for layer mesh
expansionRatio 1.0;

// Wanted thickness of final added cell layer. If multiple layers
// is the
// thickness of the layer furthest away from the wall.
// Relative to undistorted size of cell outside layer.
// is the thickness of the layer furthest away from the wall.
// See relativeSizes parameter.
finalLayerThickness 0.3;

// Minimum thickness of cell layer. If for any reason layer
// cannot be above minThickness do not add layer.
// Relative to undistorted size of cell outside layer.
minThickness 0.1;

// If points get not extruded do nGrow layers of connected faces that are
// also not grown. This helps convergence of the layer addition process
// close to features.
// Note: changed(corrected) w.r.t 17x! (didn't do anything in 17x)
nGrow 0;

// Advanced settings

// When not to extrude surface. 0 is flat surface, 90 is when two faces
// are perpendicular
featureAngle 60;

// At non-patched sides allow mesh to slip if extrusion direction makes
// angle larger than slipFeatureAngle.
slipFeatureAngle 30;

// Maximum number of snapping relaxation iterations. Should stop
// before upon reaching a correct mesh.
nRelaxIter 3;

// Number of smoothing iterations of surface normals
nSmoothSurfaceNormals 1;

// Number of smoothing iterations of interior mesh movement direction
nSmoothNormals 3;

// Smooth layer thickness over surface patches
nSmoothThickness 10;

// Stop layer growth on highly warped cells
maxFaceThicknessRatio 0.5;

// Reduce layer growth where ratio thickness to medial
// distance is large
maxThicknessToMedialRatio 0.3;

// Angle used to pick up medial axis points
// Note: changed(corrected) w.r.t 17x! 90 degrees corresponds to 130 in 17x.
minMedianAxisAngle 90;


// Create buffer region for new layer terminations
nBufferCellsNoExtrude 0;


// Overall max number of layer addition iterations. The mesher will exit
// if it reaches this number of iterations; possibly with an illegal
// mesh.
nLayerIter 50;
}



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

//- Minimum quality of the tet formed by the face-centre
// and variable base point minimum decomposition triangles and
// the cell centre. This has to be a positive number for tracking
// to work. Set to very negative number (e.g. -1E30) to
// disable.
// <0 = inside out tet,
// 0 = flat tet
// 1 = regular tet
minTetQuality -1e30;

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

//- minimum normalised cell determinant
//- 1 = hex, <= 0 = folded or flattened illegal cell
minDeterminant 0.001;

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

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


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




thanks again,

Regards,
Cheng
kanes is offline   Reply With Quote

Old   January 26, 2016, 07:11
Default
  #11
Member
 
Pascal Balz
Join Date: Feb 2015
Location: Germany
Posts: 44
Rep Power: 11
pbalz is on a distinguished road
Hey,

the upper picture looks ok to me.
Concerning the last image:
- seems like your background mesh is far too coarse. Either refine it or use a refinement box for the total volume with i.e. lv2
- I would guess that your stl "ruehrer" is just the right part (so the -z surface of the cylinder)? You specify the surface mesh to be of lv 4-6 whilst the other surfaces are lv0.
So you can clearly see the increasing cell size from -z to +z. Didn't count it, but the "steps" could be approx 10 cells thick which is your nCellsBetweenLevels (btw: 5 is sufficient for most cases).


Good luck!
__________________
Regards,
Pascal
pbalz 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] Problem with decomposePar, snappyHexMesh luca1992 OpenFOAM Meshing & Mesh Conversion 12 August 23, 2017 20:06
[snappyHexMesh] snappyHexMesh problem cfdsolver1 OpenFOAM Meshing & Mesh Conversion 0 June 23, 2016 11:09
[snappyHexMesh] Problem handling with subdictionary in SnappyHexMesh Lorenzo92 OpenFOAM Meshing & Mesh Conversion 0 November 21, 2015 14:57
[snappyHexMesh] Problem with snappyhexMesh: modelling a pore chamber and pore throat model Saideep OpenFOAM Meshing & Mesh Conversion 5 May 10, 2015 15:46
[snappyHexMesh] Problem with snappyHexMesh giack OpenFOAM Meshing & Mesh Conversion 2 September 18, 2014 11:03


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