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

[snappyHexMesh] Cylindrical blockmesh to Improve snappyHexMesh Results

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By kandelabr

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 13, 2015, 19:51
Default Cylindrical blockmesh to Improve snappyHexMesh Results
  #1
New Member
 
Join Date: Jul 2015
Posts: 23
Rep Power: 11
nicholas.jones is on a distinguished road
All,

I have been trying to use a cylindrical blockMesh to improve my snappyHexMesh results. An example blockMesh is attached. I find that coarse simple blockMeshes results in holes when two surfaces of my .stl files become close together (also attached). I can use a finer blockMesh, but I get very large meshes as a result. I am hoping there is a more elegant solution!

Although the initial blockMesh looks good, I receive an error from snappyHexMesh, citing the following:
Quote:
Shell refinement iteration 0
----------------------------

Marked for refinement due to distance to explicit features : 0 cells.
Marked for refinement due to refinement shells : 0 cells.


--> FOAM FATAL ERROR:
Illegal maxFaceDiff 0
Value should be >= 1

From function hexRef8::consistentSlowRefinement(const label, const labelList&, const labelList&, const label, const labelList&)
in file polyTopoChange/polyTopoChange/hexRef8.C at line 2370.

FOAM exiting
Google has very few illegal maxFaceDif 0 errors, so im hoping someone here might have an idea.

Should I persue this strategy to improve my snappyHexMeshes, or am I better off sticking with a simple blockMesh?

The code I use to generate cylindrical meshes is below (thanks to the folks at CFD-Online back in 2006, this code is excellent!):

Quote:
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'printf ($1)')])
define(VCOUNT, 0)
define(vlabel, [[// ]Vertex $1 = VCOUNT define($1, VCOUNT)define([VCOUNT], incr(VCOUNT))])


convertToMeters 0.00001;

define(D, 6693) //6.693 mm column diameter
define(L, 30000) //30 cm length
define(PI, 3.14159265)

define(R, calc(D/2))
define(CW, calc(D/4)) //Width of middle square section

define(CX, calc(R*cos((PI/180)*45)))
define(CZ, calc(R*sin((PI/180)*45)))

define(NPS, 10) //how many cells in the square section
define(NPD, 15) //how many cells from square section to perimeter
define(NPY, 15) // how many cells from top to bottom

vertices
(
( CW 0.0 CW) vlabel(fiveoclocksqb)
(-CW 0.0 CW) vlabel(sevenoclocksqb)
(-CW 0.0 -CW) vlabel(elevenoclocksqb)
( CW 0.0 -CW) vlabel(oneoclocksqb)

( CX 0.0 CZ) vlabel(fiveoclockcb)
(-CX 0.0 CZ) vlabel(sevenoclockcb)
(-CX 0.0 -CZ) vlabel(elevenoclockcb)
( CX 0.0 -CZ) vlabel(oneoclockcb)

( CW L CW) vlabel(fiveoclocksqt)
(-CW L CW) vlabel(sevenoclocksqt)
(-CW L -CW) vlabel(elevenoclocksqt)
( CW L -CW) vlabel(oneoclocksqt)

( CX L CZ) vlabel(fiveoclockct)
(-CX L CZ) vlabel(sevenoclockct)
(-CX L -CZ) vlabel(elevenoclockct)
( CX L -CZ) vlabel(oneoclockct)
);

blocks
(
//square block
hex (
sevenoclocksqb fiveoclocksqb oneoclocksqb elevenoclocksqb
sevenoclocksqt fiveoclocksqt oneoclocksqt elevenoclocksqt
)
(NPS NPS NPY)
simpleGrading (1 1 1)

//slice1
hex (
sevenoclockcb fiveoclockcb fiveoclocksqb sevenoclocksqb
sevenoclockct fiveoclockct fiveoclocksqt sevenoclocksqt
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice2
hex (
sevenoclocksqb elevenoclocksqb elevenoclockcb sevenoclockcb
sevenoclocksqt elevenoclocksqt elevenoclockct sevenoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice3
hex (
elevenoclocksqb oneoclocksqb oneoclockcb elevenoclockcb
elevenoclocksqt oneoclocksqt oneoclockct elevenoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

//slice4
hex (
oneoclocksqb fiveoclocksqb fiveoclockcb oneoclockcb
oneoclocksqt fiveoclocksqt fiveoclockct oneoclockct
)
(NPS NPD NPY)
simpleGrading (1 1 1)

);


//create the quarter circles
edges
(
arc fiveoclockcb sevenoclockcb (0.0 0.0 R)
arc sevenoclockcb elevenoclockcb (-R 0.0 0.0)
arc elevenoclockcb oneoclockcb (0.0 0.0 -R)
arc oneoclockcb fiveoclockcb (R 0.0 0.0)

arc fiveoclockct sevenoclockct (0.0 L R)
arc sevenoclockct elevenoclockct (-R L 0.0)
arc elevenoclockct oneoclockct (0.0 L -R)
arc oneoclockct fiveoclockct (R L 0.0)

);

boundary
(
Inlet
{
type patch;
faces
(
(fiveoclocksqb oneoclocksqb elevenoclocksqb sevenoclocksqb)
(fiveoclocksqb fiveoclockcb oneoclockcb oneoclocksqb)
(fiveoclockcb fiveoclocksqb sevenoclocksqb sevenoclockcb)
(sevenoclocksqb elevenoclocksqb elevenoclockcb sevenoclockcb)
(oneoclocksqb oneoclockcb elevenoclockcb elevenoclocksqb)
);
}

Outlet
{
type patch;
faces
(
(fiveoclocksqt oneoclocksqt elevenoclocksqt sevenoclocksqt)
(fiveoclocksqt fiveoclockct oneoclockct oneoclocksqt)
(fiveoclockct fiveoclocksqt sevenoclocksqt sevenoclockct)
(sevenoclocksqt elevenoclocksqt elevenoclockct sevenoclockct)
(oneoclocksqt oneoclockct elevenoclockct elevenoclocksqt)
);
}

Walls
{
type wall;
faces
(
(sevenoclockcb fiveoclockcb fiveoclockct sevenoclockct)
(sevenoclockcb sevenoclockct elevenoclockct elevenoclockcb)
(elevenoclockcb elevenoclockct oneoclockct oneoclockcb)
(oneoclockcb oneoclockct fiveoclockct fiveoclockcb)
);
}

);

mergePatchPairs
(
);
snappyHexMeshDict is attached:

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

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

castellatedMesh true;
snap true;
addLayers false;

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

castellatedMeshControls
{

maxLocalCells 10000000;
maxGlobalCells 70000000;
minRefinementCells 10;
nCellsBetweenLevels 0;



features
(
// {file "Inlet.eMesh"; level 2;}
// {file "Outlet.eMesh"; level 2;}
// {file "Balls.eMesh"; level 2;}
// {file "Walls.eMesh"; level 2;}
);

refinementSurfaces
{
Balls {level (1 2);}
}

resolveFeatureAngle 30;

refinementRegions
{
//refinementBox
//{
// mode inside;
// levels ((1E15 4));
//}
}


locationInMesh (0.01519 0.00008 0.18982);

allowFreeStandingZoneFaces true;
}



snapControls
{

nSmoothPatch 3;
tolerance 1;
nSolveIter 30;
nRelaxIter 5;

//- Highly experimental and wip: number of feature edge snapping
// iterations. Leave out altogether to disable.
// Of limited use in this case since faceZone faces not handled.
//nFeatureSnapIter 10;

//- Detect (geometric) features by sampling the surface
implicitFeatureSnap false;

//- Use castellatedMeshControls::features
explicitFeatureSnap false;

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

}


addLayersControls
{
relativeSizes true;

// Per final patch (so not geometry!) the layer information
layers
{
"Balls"
{
nSurfaceLayers 40;
}
}

// Expansion factor for layer mesh
expansionRatio 1.05;

// 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.
finalLayerThickness 0.1;

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

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

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

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

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

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

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



meshQualityControls
{
#include "meshQualityDict"

relaxed
{
maxNonOrtho 75;
}

// Advanced

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


// Advanced

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

mergeTolerance 1E-6;


// ************************************************** *********************** //
Attached Images
File Type: jpg Screenshot from 2015-10-01 19:29:17.jpg (157.9 KB, 168 views)
File Type: jpg Screenshot from 2015-10-13 18:49:17.jpg (106.1 KB, 132 views)
nicholas.jones is offline   Reply With Quote

Old   October 14, 2015, 15:10
Default
  #2
New Member
 
Join Date: Jul 2015
Posts: 23
Rep Power: 11
nicholas.jones is on a distinguished road
All,

The error was originating from the snappyHexMeshDict. The cylindrical blockMeshDict m4 is helpful in improving my mesh, any may be a more effective solution for this kind of problem.
nicholas.jones is offline   Reply With Quote

Old   January 2, 2018, 14:14
Default
  #3
Member
 
Join Date: Nov 2014
Posts: 36
Rep Power: 12
Tscar is on a distinguished road
May I ask how exactly did you solve this issue?
Tscar is offline   Reply With Quote

Old   May 16, 2019, 10:52
Default
  #4
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
nCellsBetweenLevels 0;

that's how, don't ask me how i know that
alabardati1918 likes this.
__________________
www.damogranlabs.com
kandelabr 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
[blockMesh] Simple cylindrical geometry: example using blockMesh guin OpenFOAM Meshing & Mesh Conversion 0 June 19, 2017 06:59
[snappyHexMesh] boundary layer on a curvy 3D cylindrical surface - snappyHexMesh ravichaithanya OpenFOAM Meshing & Mesh Conversion 1 April 6, 2016 13:18
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 15:53
[snappyHexMesh] 2D wind turbine airfoil (snappyHexMesh OR blockMesh) openfoam1 OpenFOAM Meshing & Mesh Conversion 0 January 5, 2010 03:15
[snappyHexMesh] SnappyHexMesh not generate mesh first time mavimo OpenFOAM Meshing & Mesh Conversion 4 August 26, 2008 08:08


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