CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Mesh Utilities

SnappyHexMesh - no layer added

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 17, 2011, 12:30
Default SnappyHexMesh - no layer added
  #1
New Member
 
Jakob Bejbro Andersen
Join Date: Jan 2010
Posts: 1
Rep Power: 0
bejbro is on a distinguished road
Hi all,

I am trying to do a VAWT wind turbine simulation using GGI and turbDyMFoam. All is well except my y+ values. The domain is in 2D (using "empty" patches in the y-direction) and split into two zones (rotor and stator). I have tried to add a layer mesh at the airfoil surfaces ("wng"), but despite SHM writing writing a new mesh to a folder, the mesh remains the same. I have tried to tweak the parameters, but nothing seems to help.

I have gone through the different fora, but nothing has helped me.

I hope someone can offer an insight - Thank you in advance!

My snappyHexMeshDict (essentially a copy of the motorbike case):

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

// Which of the steps to run
castellatedMesh false;
snap            false;
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
{

};



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

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

    // The surface refinement loop might spend lots of iterations refining just a
    // few cells. This setting will cause refinement to stop if <= minimumRefine
    // are selected for refinement. Note: it will at least do one iteration
    // (unless the number of cells to refine is 0)
    minRefinementCells 10;

    // Allow a certain level of imbalance during refining
    // (since balancing is quite expensive)
    // Expressed as fraction of perfect balance (= overall number of cells /
    // nProcs). 0=balance always.
    maxLoadUnbalance 0.10;


    // Number of buffer layers between different levels.
    // 1 means normal 2:1 refinement restriction, larger means slower
    // refinement.
    nCellsBetweenLevels 3;



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



    // Surface based refinement
    // ~~~~~~~~~~~~~~~~~~~~~~~~

    // Specifies two levels for every surface. The first is the minimum level,
    // every cell intersecting a surface gets refined up to the minimum level.
    // The second level is the maximum level. Cells that 'see' multiple
    // intersections where the intersections make an
    // angle > resolveFeatureAngle get refined up to the maximum level.

    refinementSurfaces
    {

    }

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

    }


    // 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 (3 3 0.43);
}



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

    //- Relative distance for points to be attracted by surface feature point
    //  or edge. True distance is this factor times local
    //  maximum edge length.
    tolerance 4.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;
}



// 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
    {
        wng
        {
            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.
    //  See relativeSizes parameter.
    finalLayerThickness 0.001;

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

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


    // Advanced settings

    //- When not to extrude surface. 0 is flat surface, 90 is when two faces
    //  make straight angle.
    featureAngle 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
    minMedianAxisAngle 130;

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

    // Overall max number of layer addition iterations
    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 projected area v.s. actual area. Set to -1 to disable.
    minFlatness 0.5;

    //- 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 1e-13;

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


// ************************************************************************* //
...and the the output from the snappyHexMesh command is as follows:

Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  1.5-dev                               |
|   \\  /    A nd           | Revision: exported                              |
|    \\/     M anipulation  | Web:      http://www.OpenFOAM.org               |
\*---------------------------------------------------------------------------*/
Exec   : snappyHexMesh
Date   : Jan 17 2011
Time   : 17:24:40
Host   : jakob-desktop
PID    : 10428
Case   : /home/jakob/RUN/TURB2D/BLD6
nProcs : 1

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

--> FOAM Warning : 
    From function dlLibraryTable::open(const fileName& functionLibName)
    in file db/dlLibraryTable/dlLibraryTable.C at line 86
    could not load libOpenFoamTurbo.so: cannot open shared object file: No such file or directory
Create mesh for time = 0

Read mesh in = 0.13 s

Overall mesh bounding box  : (-100 -5.9347412 -21.443569) (40 -4.9347408 98.556431)
Relative tolerance         : 1e-06
Absolute matching distance : 0.0001843936

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.
Checked shell refinement in = 0 s


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

Edge intersection testing:
    Number of edges             : 60324
    Number of edges to retest   : 60324
    Number of intersected edges : 0
Calculated surface intersections in = 0.04 s

Initial mesh : cells:17135  faces:60324  points:17834
Cells per refinement level:
    0	17135

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

Patch	Region
-----	------
Added patches in = 0 s

Selecting decompositionMethod simple

Shrinking and layer addition phase
----------------------------------

Using mesh parameters 
{
    maxNonOrtho     65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave      80;
    minFlatness     0.5;
    minVol          1e-13;
    minArea         -1;
    minTwist        0.02;
    minDeterminant  0.001;
    minFaceWeight   0.02;
    minVolRatio     0.01;
    minTriangleTwist -1;
    nSmoothScale    4;
    errorReduction  0.75;
}



Merging all faces of a cell
---------------------------
    - which are on the same patch
    - which make an angle < 30 degrees
      (cos:0.8660254)
    - as long as the resulting face doesn't become concave by more than 90 degrees
      (0=straight, 180=fully concave)

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.8660254.

No straight edges simplified and no points removed ...
Constructing mesh displacer ...

Checking mesh manifoldness ...

Checking initial mesh ...
Checking faces in error :
    non-orthogonality >  65 degrees                        : 0
    faces with face pyramid volume < 1e-13                 : 0
    faces with concavity >  80 degrees                     : 0
    faces with skewness >   4 (internal) or  20 (boundary) : 0
    faces with interpolation weights (0..1)  <  0.02       : 0
    faces with volume ratio of neighbour cells <  0.01     : 0
    faces with face twist <  0.02                          : 0
    faces on cells with determinant < 0.001                : 5
Detected 5 illegal faces (concave, zero area or negative cell pyramid volume)

Handling points with inconsistent layer specification ...

Handling non-manifold points ...

Checking patch manifoldness ...
Outside of local patch is multiply connected across edges or points at 0 points.
Set displacement to zero for all 0 non-manifold points

Handling feature edges ...
Set displacement to zero for points on 3 feature edges

Handling cells with warped patch faces ...
Set displacement to zero on 0 warped faces since layer would be > 0.5 of the size of the bounding box.

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

patch faces    layers avg thickness[m]
                    near-wall overall
----- -----    ------ --------- -------
wng 282      10     0.000989  0.00989 

medialAxisSmoothingInfo : Calculate distance to Medial Axis ...
shrinkMeshDistance : Smoothing normals ...
    Iteration 0   residual 0.00911
Inserting points on patch sth
Inserting points on patch GGI_out
Inserting points on patch wall
Inserting points on patch inl
Inserting points on patch top
Inserting points on patch out
Inserting points on patch GGI_in
Inserting points on patch defaultFaces
shrinkMeshDistance : Smoothing normals ...
shrinkMeshDistance : Smoothing normals in interior ...
    Iteration 0   residual 0.0215

Layer addition iteration 0
--------------------------
Prevented extrusion on 0 coupled patch points during syncPatchDisplacement.

Determining displacement for added points according to pointNormal ...
Prevented extrusion on 0 coupled patch points during syncPatchDisplacement.

shrinkMeshMedialDistance : Smoothing using Medial Axis ...
shrinkMeshMedialDistance : Reduce layer thickness at 558 nodes where thickness to medial axis distance is large 
shrinkMeshDistance : Removing isolated regions ...
Number isolated points extrusion stopped : 0
shrinkMeshDistance : Smoothing field ...
    Iteration 0   residual 1.84e-05
shrinkMeshMedialDistance : Moving mesh ...
Iteration 0
Moving mesh using diplacement scaling : min:1  max:1
Checking faces in error :
    non-orthogonality > 65  degrees                        : 0
    faces with face pyramid volume < 1e-13                 : 0
    faces with concavity > 80  degrees                     : 0
    faces with skewness > 4   (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 5
shrinkMeshMedialDistance : Successfully moved mesh
shrinkMeshMedialDistance : Finished moving mesh ...
Prevented extrusion on 0 coupled patch points during syncPatchDisplacement.
truncateDisplacement : Unextruded 0 faces due to non-consecutive vertices being extruded.

Setting up information for layer truncation ...

Checking mesh with layer ...
Checking faces in error :
    non-orthogonality > 65  degrees                        : 0
    faces with face pyramid volume < 1e-13                 : 0
    faces with concavity > 80  degrees                     : 0
    faces with skewness > 4   (internal) or 20  (boundary) : 0
    faces with interpolation weights (0..1)  < 0.02        : 0
    faces with volume ratio of neighbour cells < 0.01      : 0
    faces with face twist < 0.02                           : 0
    faces on cells with determinant < 0.001                : 5
Detected 5 illegal faces (concave, zero area or negative cell pyramid volume)
Extruding 0 out of 282 faces. Removed extrusion at 0 faces.
Edge intersection testing:
    Number of edges             : 60324
    Number of edges to retest   : 0
    Number of intersected edges : 0
Writing 0 added cells to cellSet addedCells
Writing 0 faces inside added layer to faceSet layerFaces
Layer mesh : cells:17135  faces:60324  points:17834
Cells per refinement level:
    0	17135
Writing mesh to time 1e-05
Written mesh in = 0.75 s.
Finished meshing in = 0.94 s.
End
BTW: I'm in 1.5-dev.

Thanks,

/J
bejbro is offline   Reply With Quote

Old   June 7, 2011, 01:04
Default
  #2
Member
 
Join Date: Mar 2009
Posts: 74
Rep Power: 9
aerogt3 is on a distinguished road
Did you ever figure this out? I am doing the same and I just can't get the layers to grow. I too am using the motorbike tutorial file with the numbers essentially changed. I can get quite a nice surface/volume mesh, but unfortunately no layers :-(
aerogt3 is offline   Reply With Quote

Old   June 7, 2011, 21:39
Default
  #3
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 17
Rep Power: 7
farahiam is on a distinguished road
Hi Robert

Have you figured out how to create the BL?
I have just succesfully managed my model.
Maybe you could try see this thread: Fail to create boundary layers during sHM

Also, if you like, I could have a see in your sHMD file if you post it here.

Regards,
Ayu
farahiam is offline   Reply With Quote

Old   June 8, 2011, 18:53
Default
  #4
Member
 
Join Date: Mar 2009
Posts: 74
Rep Power: 9
aerogt3 is on a distinguished road
Thanks for your reply, I actually did figure it out. The problem was first naming issues, and then that SHM doesn't imprint onto boundaries, like the symmetry plane for example, so you can only see them by doing a volume mesh slice. Once I did that I saw that they had been grown!
aerogt3 is offline   Reply With Quote

Old   October 16, 2014, 19:24
Default
  #5
New Member
 
sd
Join Date: May 2014
Posts: 14
Rep Power: 4
OvGU is on a distinguished road
I am trying to creat a surface layer in a simple cylinder combined of 2 radius (cone+ cylinder).This can be a reason or not, I don't know. But It's not working. If anybody can give any solution .....................
N.B- picture in problem region
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

FoamFile
{
version 2.0;
format ascii;
class dictionary;
object snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true; // make basic mesh ?
snap true; // decide to snap back to surface ?
addLayers true;//false; // decide to add viscous layers ?


geometry // Load in STL files here
{
inlet_1.stl {type triSurfaceMesh; name inlet_1;}
outlet.stl {type triSurfaceMesh; name outlet;}
inlet_2.stl {type triSurfaceMesh; name inlet_2;}
inlet_3.stl {type triSurfaceMesh; name inlet_3;}
wall.stl {type triSurfaceMesh; name wall;}
//cylinder.stl {type triSurfaceMesh; name volume;}
refineCylinder {type searchableCylinder; point1 (0 0 0); point2 (0 0 2); radius 0.13;}
//refinementBox {type searchableBox; min (-0.5 -0.5 -0.5); max ( 0.5 0.5 0.5);}
};

castellatedMeshControls
{
maxLocalCells 1000000; //max cells per CPU core
maxGlobalCells 2000000; //max cells to use before mesh deletion step
minRefinementCells 10; //was 0 - zero means no bad cells are allowed during refinement stages
maxLoadUnbalance 0.10;
nCellsBetweenLevels 1; // expansion factor between each high & low refinement zone

// Explicit feature edge refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

features // taken from STL from each .eMesh file created by "SurfaceFeatureExtract" command
(
{file "inlet_1.eMesh"; level 2;}
{file "outlet.eMesh"; level 2;}
{file "wall.eMesh"; level 3;}
{file "inlet_2.eMesh"; level 2;}
{file "inlet_3.eMesh"; level 2;}
);

// Surface based refinement
// ~~~~~~~~~~~~~~~~~~~~~~~~

refinementSurfaces // Surface-wise min and max refinement level
{
inlet_1 {level (2 2);}
outlet {level (2 2);}
wall {level (5 5);}
inlet_2 {level (2 2);} // was 4 4
inlet_3 {level (2 2);} // was 4 4
}


resolveFeatureAngle 80; // Resolve sharp angles // Default 30
refinementRegions // In descending levels of fine-ness
{refineCylinder {mode distance; levels ((1E15 2));}} // (0.002 3) (0.01 2));}} // was ((0.001 4) (0.003 3) (0.01 2))
locationInMesh (0.01 0.01 0.01); //to decide which side of mesh to keep **
allowFreeStandingZoneFaces true;
}


// Settings for the snapping.
snapControls
{
nSmoothPatch 3;
tolerance 4.0;
nSolveIter 30;
nRelaxIter 5;
nFeatureSnapIter 15; // default is 10

// New settings from openfoam 2.2 onwards for SHMesh

implicitFeatureSnap false; // default is false - detects without doing surfaceFeatureExtract
explicitFeatureSnap true; // default is true
multiRegionFeatureSnap false; // deafault is false - detects features between multiple surfaces

}



// Settings for the layer addition.
addLayersControls //add the PATCH names from inside the STL file so STLpatchName_insideSTLName
{
relativeSizes false; // was true
layers
{
wall
{nSurfaceLayers 3;} // was 3
//visc_refine_1
// {nSurfaceLayers 3;} // was 3
//visc_refine_2
// {nSurfaceLayers 3;} // was 3
}

expansionRatio 1.3;
finalLayerThickness 0.00016; //was 0.00016
minThickness 0.00008; //was 0.00008
nGrow 0; // was 1


// Advanced settings

featureAngle 80; // was 70 //- When not to extrude surface. 0 is flat, 90 is right angle.
nRelaxIter 3; //- Max# of snapping relaxation iter. Should stop before upon reaching a correct mesh.
nSmoothSurfaceNormals 1; // Number of smoothing iterations of surface normals
nSmoothNormals 3; // Number of smoothing iterations of interior mesh movement direction
nSmoothThickness 10; // Smooth layer thickness over surface patches
maxFaceThicknessRatio 0.5; // Stop layer growth on highly warped cells
maxThicknessToMedialRatio 0.3; // Reduce layer growth where ratio thickness to medial distance is large
minMedianAxisAngle 130; // Angle used to pick up medial axis points
nBufferCellsNoExtrude 0; // Create buffer region for new layer terminations
nLayerIter 50; // Overall max number of layer addition iterations
}



// Generic mesh quality settings. At any undoable phase these determine
// where to undo.
meshQualityControls
{
maxNonOrtho 65;
maxBoundarySkewness 20;
maxInternalSkewness 4;
maxConcave 80;
minFlatness 0.5;
minVol 1e-13;
minTetQuality 1e-9;
minArea -1;
minTwist 0.02;
minDeterminant 0.001;
minFaceWeight 0.02;
minVolRatio 0.01;
minTriangleTwist -1;

// Advanced

nSmoothScale 4;
errorReduction 0.75;
}

// Advanced

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;


// ************************************************** *********************** //
Attached Images
File Type: jpg mesh.jpg (59.5 KB, 182 views)
OvGU is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SnappyHexMesh doesn't succeed in adding several layers eti0123456789 OpenFOAM Native Meshers: snappyHexMesh and Others 5 April 9, 2013 02:36
snappyHexMesh not refining surfaces Hydro1004 OpenFOAM 3 August 29, 2012 11:56
Boundary layer generation problems ivan_cozza OpenFOAM Native Meshers: snappyHexMesh and Others 0 October 6, 2010 13:47
problemes modelling surfaces with snappyhexmesh gija79 OpenFOAM 5 June 30, 2010 13:50
errors Fahad Main CFD Forum 0 March 23, 2004 14:20


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