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

[snappyHexMesh] Layers not growing at all

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

Like Tree6Likes
  • 1 Post By zonda
  • 2 Post By Tobi
  • 1 Post By amuzeshi
  • 1 Post By Tobi
  • 1 Post By Tobi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2017, 12:34
Default Layers not growing at all
  #1
New Member
 
Francesco Liuzzi
Join Date: Jul 2017
Posts: 15
Rep Power: 5
zonda is on a distinguished road
Hello to all the forum community

Some months ago i posted on this forum because of a problem with the mesh modification of a combustion chamber that was, in the end, solved. Now, however, I got a new problem. I want to create a layer around the striction you can see in the picture. The striction was previously created always with sHM from the plain cilinder subtracting a stl file.

layer1.jpg

The various parameters in the addLayersControl inside the sHMdict are still not completely clear to me, but whatever i try to do does not give any results, no layers genereted and even the number of cells remains the same. Any suggestion? Here i'm providing the sHMdict of the case (the last used)

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  4.1                                   |
|   \\  /    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       true; 
 

// 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
{
    Cavcilnolayer.stl
    {
        type triSurfaceMesh;
        name Cavcilnolayer;
    }

    refinementBox
    {
        type searchableBox;
        min (-1 -1 0.32); //(-1 -1 0.32)(-1 -1 0.3);
        max (1 1 0.40); //(1 1 0.4)( 1 1 0.45);
    }
};



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

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

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


    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 1; //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 "Cavcilnolayer.eMesh";
            level 0; //3, 4
        }
    );



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

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

    // Resolve sharp angles
    // Applies maximum level of refinement to cells that can see intersections whose
    // angle exceeds this
    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.0 0)); //(0.001 1) (0.0025 1)()
        }
    }


    // 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.0 0.0 0.35);


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

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

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

    // Feature snapping

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

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

    // Per final patch (so not geometry!) the layer information
    layers
    {
	Cavcilnolayer
	
	{
        	nSurfaceLayers 20;
        }
    }

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

    // 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
{
    #include "meshQualityDict"


    // Advanced

    //- Number of error distribution iterations
    nSmoothScale 4;
    //- Amount to scale back displacement at error points
    errorReduction 0.75;
}


// Advanced

// Write flags
writeFlags
(
    scalarLevels
    layerSets
    layerFields     // write volScalarField for layer coverage
);


// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6s;


// ************************************************************************* //
Let me know if you need anything else.
Big thanks to all of you
amuzeshi likes this.
zonda is offline   Reply With Quote

Old   October 22, 2017, 16:28
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

it would be nice to get the logfile of the sHM output to tell you more. By the way a few hints:

  • The layers will not grow because of your settings of your expansionsRatio factor
  • 20 Layers are a challenge, start with 5
  • Use first the relativeSize and set the finalLayerThickness to 0.8
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 23, 2017, 05:50
Default
  #3
New Member
 
Francesco Liuzzi
Join Date: Jul 2017
Posts: 15
Rep Power: 5
zonda is on a distinguished road
Ok so, as you asked here i'm providing the log file of the running, but only the layers addition part, the whole log is too long to be posted, hope will be enough.

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  3.0.1                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 3.0.1-d8a290b55d28
Exec   : snappyHexMesh
Date   : Oct 23 2017
Time   : 10:57:50
Host   : "an04"
PID    : 16253
Case   : /utenti/simulation/OpenFOAM/simulation-3.0.1/run/cases/AeroSpaceProp/GreenEngine/francesco/Progetto_main_francesco
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

[...]

Layer addition iteration 0
--------------------------

Determining displacement for added points according to pointNormal ...
Detected 0 points with point normal pointing through faces.
Reset displacement at 0 points to average of surrounding points.

displacementMedialAxis : Smoothing using Medial Axis ...
displacementMedialAxis : Reducing layer thickness at 3468 nodes where thickness to medial axis distance is large 
displacementMedialAxis : Removing isolated regions ...
displacementMedialAxis : Number of isolated points extrusion stopped : 0
displacementMedialAxis : Smoothing field ...
    Iteration 0   residual 0.0117393
displacementMedialAxis : Moving mesh ...
displacementMedialAxis : Iteration 0
Moving mesh using displacement scaling : min:1  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 2288933
    faces with face pyramid volume < 1e-13                 : 61567
    faces with face-decomposition tet quality < 1e-15      : 22929
    faces with concavity > 80  degrees                     : 18
    faces with skewness > 4   (internal) or 20  (boundary) : 136
    faces with interpolation weights (0..1)  < 0.02        : 7524
    faces with volume ratio of neighbour cells < 0.01      : 1176
    faces with face twist < 0.02                           : 99
    faces on cells with determinant < 0.001                : 216862
displacementMedialAxis : Iteration 1
Moving mesh using displacement scaling : min:0.75  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 2601847
    faces with face pyramid volume < 1e-13                 : 69577
    faces with face-decomposition tet quality < 1e-15      : 37547
    faces with concavity > 80  degrees                     : 523
    faces with skewness > 4   (internal) or 20  (boundary) : 299
    faces with interpolation weights (0..1)  < 0.02        : 6362
    faces with volume ratio of neighbour cells < 0.01      : 2677
    faces with face twist < 0.02                           : 222
    faces on cells with determinant < 0.001                : 239040
displacementMedialAxis : Iteration 2
Moving mesh using displacement scaling : min:0.5625  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 2755444
    faces with face pyramid volume < 1e-13                 : 78650
    faces with face-decomposition tet quality < 1e-15      : 49930
    faces with concavity > 80  degrees                     : 1140
    faces with skewness > 4   (internal) or 20  (boundary) : 178
    faces with interpolation weights (0..1)  < 0.02        : 6308
    faces with volume ratio of neighbour cells < 0.01      : 3259
    faces with face twist < 0.02                           : 968
    faces on cells with determinant < 0.001                : 220162
displacementMedialAxis : Iteration 3
displacementMedialAxis : Displacement scaling for error reduction set to 0.
Moving mesh using displacement scaling : min:0.421875  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 2851712
    faces with face pyramid volume < 1e-13                 : 85402
    faces with face-decomposition tet quality < 1e-15      : 62901
    faces with concavity > 80  degrees                     : 1610
    faces with skewness > 4   (internal) or 20  (boundary) : 139
    faces with interpolation weights (0..1)  < 0.02        : 6169
    faces with volume ratio of neighbour cells < 0.01      : 3424
    faces with face twist < 0.02                           : 1470
    faces on cells with determinant < 0.001                : 178857
displacementMedialAxis : Iteration 4
Moving mesh using displacement scaling : min:0  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 149415
    faces with face pyramid volume < 1e-13                 : 1013
    faces with face-decomposition tet quality < 1e-15      : 4200
    faces with concavity > 80  degrees                     : 163
    faces with skewness > 4   (internal) or 20  (boundary) : 29
    faces with interpolation weights (0..1)  < 0.02        : 4534
    faces with volume ratio of neighbour cells < 0.01      : 48
    faces with face twist < 0.02                           : 310
    faces on cells with determinant < 0.001                : 8591
displacementMedialAxis : Iteration 5
Moving mesh using displacement scaling : min:0  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 66136
    faces with face pyramid volume < 1e-13                 : 181
    faces with face-decomposition tet quality < 1e-15      : 1291
    faces with concavity > 80  degrees                     : 29
    faces with skewness > 4   (internal) or 20  (boundary) : 15
    faces with interpolation weights (0..1)  < 0.02        : 1726
    faces with volume ratio of neighbour cells < 0.01      : 3
    faces with face twist < 0.02                           : 12
    faces on cells with determinant < 0.001                : 1957
displacementMedialAxis : Finished moving mesh ...
truncateDisplacement : Unextruded 0 faces due to non-consecutive vertices being extruded.
truncateDisplacement : Unextruded 0 faces due to stringed edges with inconsistent extrusion.

Setting up information for layer truncation ...

Checking mesh with layer ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 66266
    faces with face pyramid volume < 1e-13                 : 166
    faces with face-decomposition tet quality < 1e-15      : 1262
    faces with concavity > 80  degrees                     : 29
    faces with skewness > 4   (internal) or 20  (boundary) : 15
    faces with interpolation weights (0..1)  < 0.02        : 1726
    faces with volume ratio of neighbour cells < 0.01      : 3
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 1989
Detected 71456 illegal faces (concave, zero area or negative cell pyramid volume)
Extruding 0 out of 7650 faces (0%). Removed extrusion at 27 faces.
Added 56 out of 153000 cells (0.0366013%).

Growing non-extrusion points by one layer ...
Set displacement to zero for an additional 0 points.


Layer addition iteration 1
--------------------------

Determining displacement for added points according to pointNormal ...
Detected 0 points with point normal pointing through faces.
Reset displacement at 0 points to average of surrounding points.

displacementMedialAxis : Smoothing using Medial Axis ...
displacementMedialAxis : Reducing layer thickness at 0 nodes where thickness to medial axis distance is large 
displacementMedialAxis : Removing isolated regions ...
displacementMedialAxis : Number of isolated points extrusion stopped : 0
displacementMedialAxis : Smoothing field ...
    Iteration 0   residual 0
displacementMedialAxis : Moving mesh ...
displacementMedialAxis : Iteration 0
Moving mesh using displacement scaling : min:1  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 20046
    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        : 1
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 76
displacementMedialAxis : Successfully moved mesh
displacementMedialAxis : Finished moving mesh ...
truncateDisplacement : Unextruded 0 faces due to non-consecutive vertices being extruded.
truncateDisplacement : Unextruded 0 faces due to stringed edges with inconsistent extrusion.

Setting up information for layer truncation ...

Checking mesh with layer ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 20046
    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        : 1
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 76
Detected 20123 illegal faces (concave, zero area or negative cell pyramid volume)
Extruding 0 out of 7650 faces (0%). Removed extrusion at 0 faces.
Added 0 out of 153000 cells (0%).
Edge intersection testing:
    Number of edges             : 4047139
    Number of edges to retest   : 0
    Number of intersected edges : 7650
Writing 0 added cells to cellSet addedCells
Writing 0 faces inside added layer to faceSet layerFaces

Writing fields with layer information:
    nSurfaceLayers    : actual number of layers
    thickness         : overall layer thickness
    thicknessFraction : overall layer thickness (fraction of desired thickness)


patch         faces    layers   overall thickness
                                [m]       [%]
-----         -----    ------   ---       ---
Cavcilnolayer 7650     0        0         0       

Layer mesh : cells:1337376  faces:4047139  points:1372681
Cells per refinement level:
    0	1337376
Writing mesh to time 3e-05
Wrote mesh in = 201.21 s.
Layers added in = 201.21 s.
Checking final mesh ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 20046
    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        : 1
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 76
Finished meshing with 20123 illegal faces (concave, zero area or negative cell pyramid volume)
Finished meshing in = 673.44 s.
End
While waiting for your answer i will try to use the suggestions you gave me

Thank for your reply
zonda is offline   Reply With Quote

Old   October 23, 2017, 06:35
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi, based on your output you can directly say: No Layer will be generated. You have only problems. What do I mean: E.g.
Code:
0.37500E-03

   non-orthogonality > 65  degrees                        : 2288933
    faces with face pyramid volume < 1e-13                 : 61567
    faces with face-decomposition tet quality < 1e-15      : 22929
    faces with concavity > 80  degrees                     : 18
    faces with skewness > 4   (internal) or 20  (boundary) : 136
    faces with interpolation weights (0..1)  < 0.02        : 7524
    faces with volume ratio of neighbour cells < 0.01      : 1176
    faces with face twist < 0.02                           : 99
    faces on cells with determinant < 0.001                : 216862
Tells you that this amount of cells do not fulfill the quality criterion. SnappyHexMesh will redu everything if the criteria are not fulfilled.
amuzeshi and Gang Wang like this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 24, 2017, 08:47
Default
  #5
New Member
 
Francesco Liuzzi
Join Date: Jul 2017
Posts: 15
Rep Power: 5
zonda is on a distinguished road
I have tried the values you have suggested me in your first reply and they worked, as you can see:
layeredmesh.jpg

Now i want to make them a bit thicker, so i think i just have to properly modify the parameters related to thickness, am i right?
zonda is offline   Reply With Quote

Old   October 24, 2017, 08:54
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

you are wrong. The thickness parameter (as it is written in the comments) are adjusting the final layer thickness. The growth is based on the expansionRatio. I would suggest you to read the comments in the file + search for the snappyHexMesh PDF from Engys.

Good luck.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 24, 2017, 10:39
Default
  #7
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
I just want to mention that you can checkout that case too: http://www.holzmann-cfd.de/index.php...sphere-meshing
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   November 13, 2017, 07:41
Default
  #8
New Member
 
Francesco Liuzzi
Join Date: Jul 2017
Posts: 15
Rep Power: 5
zonda is on a distinguished road
Ok so, sorry for being late with this answer, but it took some time to try to grow better layers. The fact is that openFoam doesn't allow me to grow bigger layers than those you can see in the previous post, if i modify the values the layers disappear. However, talking to my teacher he said that these are good for my task, so i consider myself satisfied. I want to thank you tobi for your decisive help
zonda is offline   Reply With Quote

Old   March 4, 2020, 06:23
Default
  #9
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 122
Rep Power: 7
amuzeshi is on a distinguished road
Quote:
Originally Posted by zonda View Post
Ok so, sorry for being late with this answer, but it took some time to try to grow better layers. The fact is that openFoam doesn't allow me to grow bigger layers than those you can see in the previous post, if i modify the values the layers disappear. However, talking to my teacher he said that these are good for my task, so i consider myself satisfied. I want to thank you tobi for your decisive help
Sometimes, minThickness is the restriction that does not allow adding layers. Setting this parameter to a very low value - e.g. 1e-16 - let you get rid of this restriction.

Edit
Question: Why addLayers does not add layers which are specified in snappyHexMeshDict?
Answer:To state a more general solution, we have to refer to output log of snappyHexMesh. In doing so, we will find lines like this (there are a repetition of these lines, but I mean those appearing under Checking mesh with layer ...
):
Code:
Checking mesh with layer ...
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.05        : 30
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 120
This shows what criteria annoy you, namely the criteria of which it's number is not zero (colored be red)!
Therefore the solution is to go to meshQualityDict/meshQualityControls and remove these restrictions by changing their value appropriately. Comments usually suggest these values (e.g. OpenFOAM 7).

Best,
Ali
EZByK likes this.

Last edited by amuzeshi; March 4, 2020 at 09:39.
amuzeshi is offline   Reply With Quote

Old   March 4, 2020, 13:48
Default
  #10
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Just one comment. If you tell snappy to make just one iteration while deactivating the quality criteria, you will get the layers as expected. However, if this does make sense in a numerical point of view, I am not sure
amuzeshi likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 5, 2020, 08:59
Default
  #11
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 122
Rep Power: 7
amuzeshi is on a distinguished road
Quote:
Originally Posted by Tobi View Post
Just one comment. If you tell snappy to make just one iteration while deactivating the quality criteria, you will get the layers as expected. However, if this does make sense in a numerical point of view, I am not sure
In simple domains like flow around a cylinder, this doesn't cause a problem. BTW, checkMesh can be used after layer addition step in order to return potentially bad cells.
amuzeshi is offline   Reply With Quote

Old   March 5, 2020, 12:53
Default
  #12
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,448
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
CheckMesh should be used in any case as well as renumberMesh
EZByK likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   June 6, 2020, 12:28
Default
  #13
Senior Member
 
Ali Shayegh
Join Date: Oct 2015
Posts: 122
Rep Power: 7
amuzeshi is on a distinguished road
I am going to create a rectangular gap in a uniform 2D mesh. To this end, I used snappyHexMesh. While going only through castellation step gives a visually correct mesh, If I go through snap step, it produces a wrong mesh. Can I rely on the output of castellation step as a body-fitted mesh and do not go through snap step?
snappyHexMesh is given below:
Code:
/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  7
     \\/     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
{
    box1
    {
        type searchableBox;
        min (7.53 5.19 -100);
        max (12.53 5.69 100);
    }

    street
    {
        type triSurfaceMesh;
        file "topStreetMain.stl"
        // file "test1.stl";
    }

    sphere2
    {
        type searchableSphere;
        centre  (1.5 1.5 1.5);
        radius  1.03;
    }
};

// Settings for the castellatedMesh generation.
castellatedMeshControls
{
    maxLocalCells 100000;

    maxGlobalCells 2000000;

    minRefinementCells 0;

    maxLoadUnbalance 0.10;

    nCellsBetweenLevels 1;

    features
    (
        //{
        //   file "topStreetMain.extendedFeatureEdgeMesh";
        //   level 2;
        //   // levels ((0.0 2)
        //    // (1.0 3)
        //    // );
        //}
    );

    refinementSurfaces
    {
        street
        // box1
        {
            // Surface-wise min and max refinement level
            level (1 2);  
        }
    }

    resolveFeatureAngle 30;

    planarAngle 30;

    refinementRegions
    {
        
    }

    locationInMesh (10 2 50);
 
    allowFreeStandingZoneFaces true;

}

// Settings for the snapping.
snapControls
{
    // Number of patch smoothing iterations before finding correspondence
    // to surface
    nSmoothPatch 30;

    // Maximum relative distance for points to be attracted by surface.
    // True distance is this factor times local maximum edge length.
    // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance)
    tolerance 2.0;

    // Number of mesh displacement relaxation iterations.
    nSolveIter 30;

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

    // Feature snapping

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

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

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

        // Detect features between multiple surfaces
        // (only for explicitFeatureSnap, default = false)
        multiRegionFeatureSnap false;


    // wip: disable snapping to opposite near surfaces (revert to 22x behaviour)
    // detectNearSurfacesSnap 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;

    // Layer thickness specification. This can be specified in one of following
    // ways:
    // - expansionRatio and finalLayerThickness (cell nearest internal mesh)
    // - expansionRatio and firstLayerThickness (cell on surface)
    // - overall thickness and firstLayerThickness
    // - overall thickness and finalLayerThickness
    // - overall thickness and expansionRatio
    //
    // Note: the mode thus selected is global, i.e. one cannot override the
    //       mode on a per-patch basis (only the values can be overridden)

        // Expansion factor for layer mesh
        expansionRatio 1.0;

        // Wanted thickness of the layer furthest away from the wall.
        // If relativeSizes this is relative to undistorted size of cell
        // outside layer.
        finalLayerThickness 0.3;

        // Wanted thickness of the layer next to the wall.
        // If relativeSizes this is relative to undistorted size of cell
        // outside layer.
        // firstLayerThickness 0.3;

        // Wanted overall thickness of layers.
        // If relativeSizes this is relative to undistorted size of cell
        // outside layer.
        // thickness 0.5


    // Minimum overall thickness of total layers. If for any reason layer
    // cannot be above minThickness do not add layer.
    // If relativeSizes this is relative to undistorted size of cell
    // outside layer..
    minThickness 0.25;


    // Per final patch (so not geometry!) the layer information
    // Note: This behaviour changed after 21x. Any non-mentioned patches
    //       now slide unless:
    //          - nSurfaceLayers is explicitly mentioned to be 0.
    //          - angle to nearest surface < slipFeatureAngle (see below)
    layers
    {
        sphere_firstSolid
        {
            nSurfaceLayers 1;

        }
        maxY
        {
            nSurfaceLayers 1;
            // Per patch layer data
            expansionRatio      1.3;
            finalLayerThickness 0.3;
            minThickness        0.1;
        }

        // Disable any mesh shrinking and layer addition on any point of
        // a patch by setting nSurfaceLayers to 0
        frozenPatches
        {
            nSurfaceLayers 0;
        }
    }

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


    // Static analysis of starting mesh

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

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


    // Patch displacement

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

        // Smooth layer thickness over surface patches
        nSmoothThickness 10;



    // Medial axis analysis

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

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

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

        // Optional: limit the number of steps walking away from the surface.
        // Default is unlimited.
        // nMedialAxisIter 10;

        // Optional: smooth displacement after medial axis determination.
        // default is 0.
        // nSmoothDisplacement 90;

        // (wip)Optional: do not extrude a point if none of the surrounding points is
        // not extruded. Default is false.
        // detectExtrusionIsland true;


    // Mesh shrinking

        // Optional: at non-patched sides allow mesh to slip if extrusion
        // direction makes angle larger than slipFeatureAngle. Default is
        // 0.5*featureAngle.
        slipFeatureAngle 30;

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

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

        // Max number of iterations after which relaxed meshQuality controls
        // get used. Up to nRelaxedIter it uses the settings in
        // meshQualityControls,
        // after nRelaxedIter it uses the values in
        // meshQualityControls::relaxed.
        nRelaxedIter 20;

        // Additional reporting: if there are just a few faces where there
        // are mesh errors (after adding the layers) print their face centres.
        // This helps in tracking down problematic mesh areas.
        // additionalReporting true;
}

// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
    // Specify mesh quality constraints in separate dictionary so can
    // be reused (e.g. checkMesh -meshQuality)
    #include "meshQualityDict"


    // Optional : some meshing phases allow usage of relaxed rules.
    // See e.g. addLayersControls::nRelaxedIter.
    relaxed
    {
        // Maximum non-orthogonality allowed. Set to 180 to disable.
        maxNonOrtho 75;
    }
}

// Advanced

//// Debug flags
debugFlags
(
//   mesh            // write intermediate meshes
//    intersections   // write current mesh intersections as .obj files
//    featureSeeds    // write information about explicit feature edge
//                    // refinement
//    attraction      // write attraction as .obj files
//    layerInfo       // write information about layers
);
//
//// Write flags
//writeFlags
//(
//    scalarLevels    // write volScalarField with cellLevel for postprocessing
//    layerSets       // write cellSets, faceSets of faces in layer
//    layerFields     // write volScalarField for layer coverage
//);

// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1e-6;

// ************************************************************************* //
Attached Images
File Type: png uniform mesh.png (8.8 KB, 10 views)
File Type: png surface to which the mesh will be fitted.png (10.6 KB, 13 views)
File Type: png castellation step.png (15.4 KB, 11 views)
File Type: png snap step.png (33.2 KB, 11 views)
amuzeshi 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] Help with Snappy: no layers growing GianF OpenFOAM Meshing & Mesh Conversion 2 September 23, 2020 09:26
[snappyHexMesh] Controlling y+ values with snappyHexMesh? cjm OpenFOAM Meshing & Mesh Conversion 67 July 10, 2019 19:56
[ICEM] Surface/Volume orientation errors growing prism layers jlichtwa ANSYS Meshing & Geometry 17 September 25, 2018 01:41
[snappyHexMesh] poorly growing boundary layers in SnappyHexMesh DaveR OpenFOAM Meshing & Mesh Conversion 2 August 31, 2016 09:26
[ICEM] Prism layers distorted near trailing edge of blade-Unstructured Mesh Rohith Giridhar ANSYS Meshing & Geometry 3 June 29, 2015 18:52


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