CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: snappyHexMesh and Others

Fail to create boundary layers during sHM

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 1, 2011, 05:24
Default Fail to create boundary layers during sHM
  #1
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Hello all,
I am currently working on the external aerodynamics case for a car.
Basically, I manage to do the snappyHexMesh
However, eventhough I set the number of layers = 10, but, I fail to create even a single layer.
I dont know what is the problem with my file.
The part in sHM where I define the no.of layers are as below:

// Settings for the layer addition.
addLayersControls
{
relativeSizes true;
//relativeSizes false;

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

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

//finalLayerThickness 0.0055; //absolute
finalLayerThickness 0.1; //relative

//- 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.0005; //absolute
minThickness 0.1; //relative

//- 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 15;
//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.0025; //absolute
maxFaceThicknessRatio 1.0; //relative

// Reduce layer growth where ratio thickness to medial
// distance is large
//maxThicknessToMedialRatio 0.0015; //absolute
maxThicknessToMedialRatio 1.0; //relative

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


Hope someone could help me on this.
The pics of the section cuts are as attached.

Thank you.
Attached Images
File Type: jpg 2011-06-01_172318.jpg (87.1 KB, 212 views)
File Type: jpg 2011-06-01_172358.jpg (72.2 KB, 214 views)
farahiam is offline   Reply With Quote

Old   June 6, 2011, 19:32
Default
  #2
Member
 
Scott
Join Date: Sep 2009
Posts: 41
Rep Power: 6
scott is on a distinguished road
It might be good if you post a log of your snappy run. I use snappyHexMesh -overwrite >Snappy_Log

This will create a Snappy_Log file which you can post here which should tell us/someone why it doesn't work.

I am having the same problem, and I think it is due to the complexity of the geometry and layers possibly crashing into each other. Would be good to know for sure though.

Scott
scott is offline   Reply With Quote

Old   June 6, 2011, 20:56
Default
  #3
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Hello Scott!
Thanks alot for the reply.
I really appreciate your attention..

Here, I attached my log file for snappyHexMesh process.
I am not sure what is the actual problem.
I am really hoping to figure this out and solve the problem.

N.B. I divide the file into 2 parts as this web has size limitation on the filesize.

Tq.
Attached Files
File Type: txt log.snappy-2.txt (78.8 KB, 50 views)
File Type: txt log.snappy-1.txt (41.1 KB, 43 views)
farahiam is offline   Reply With Quote

Old   June 6, 2011, 22:03
Default
  #4
Member
 
Scott
Join Date: Sep 2009
Posts: 41
Rep Power: 6
scott is on a distinguished road
It says that there are no layers to add... It may be that something is not right in the setup.

Can you please also post your snappyHexMeshDict file.

Thanks,

Scott
scott is offline   Reply With Quote

Old   June 6, 2011, 22:25
Default
  #5
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Hi Scott,
I include the half part of the snappyHexMeshDict file as below.
FYI, my y+ values are very small, which I am not sure how to increase the y+ values (attached is the y+ log file).

Regards,
Ayu

Snappy:

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

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

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



// Settings for the layer addition.
addLayersControls
{
//relativeSizes true;
relativeSizes false;

// Per final patch (so not geometry!) the layer information
layers
{
ext_aero
{
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.

finalLayerThickness 0.001; //absolute
//finalLayerThickness 0.1; //relative

//- 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.010; //absolute
//minThickness 0.1; //relative

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


// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.

//featureAngle 15;
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.0025; //absolute
maxFaceThicknessRatio 1.0; //relative

// Reduce layer growth where ratio thickness to medial
// distance is large
//maxThicknessToMedialRatio 0.0015; //absolute
maxThicknessToMedialRatio 1.0; //relative

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


// ************************************************** *********************** //
Attached Files
File Type: txt log_yPlus.txt (3.6 KB, 47 views)
farahiam is offline   Reply With Quote

Old   June 6, 2011, 22:32
Default
  #6
Member
 
Scott
Join Date: Sep 2009
Posts: 41
Rep Power: 6
scott is on a distinguished road
What is the full patch name for ext_aero in the boundary file under constant/polymesh?

I think you need to use the full patch name, not just the name of that section.

It might be car_ext_aero or something similar... I do not think that it is recognising the ext_aero by itself.

I'm only coming to terms with Snappy now myself, but I think I am on the right track for your problem.

As far as Y+ goes, its the non-dimensional cell distance from the wall and its relation to the local velocity of that cell. Hence if you want to increase (or decrease) it then you need to go to larger (or smaller) cell heights at the surface. I guess you can do this by modifying the thickness of the layers or also by not refining the surface as much, hence the first cell would be larger.

Hope this helps!

Scott
scott is offline   Reply With Quote

Old   June 6, 2011, 22:57
Default
  #7
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
"It might be car_ext_aero or something similar... I do not think that it is recognising the ext_aero by itself."

Hi Scott, I have been thinking about this too but I havent tried anything yet. Yes, just like you guessed, my .stl files has different names. Below is the initial part of the sHMD file where I define each diff. components of the car:

// 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
{
car3.stl
{
type triSurfaceMesh;
name ext_aero;
regions
{
airdam
{
name airdam;
}
battery
{
name battery;
}
body
{
name body;
}
bumper_headlamp
{
name bumper_headlamp;
}
CAC
{
name CAC;
}
cond
{
name cond;
}
cowl-top
{
name cowl-top;
}
ECU-box
{
name ECU-box;
}
engine
{
name engine;
}
exhaust-pipe
{
name exhaust-pipe;
}
fan-blade
{
name fan-blade;
}
fan-shroud
{
name fan-shroud;
}
firewall
{
name firewall;
}
fuel-tank
{
name fuel-tank;
}
grills
{
name grills;
}
hood
{
name hood;
}
intercooler
{
name intercooler;
}
rad
{
name rad;
}
side-mirror
{
name side-mirror;
}
snorkel-inlet
{
name snorkel-inlet;
}
spoiler
{
name spoiler;
}
fr-suspension
{
name fr-suspension;
}
rr-suspension
{
name rr-suspension;
}
trans-oil
{
name trans-oil;
}
underfloor
{
name underfloor;
}

}
}
/*
refinementFrontGrill
{
type searchableBox;
min (-2.17 -0.75 -0.07);
max (-0.7 0.75 0.55);
}
*/
refinementWake
{
type searchableBox;
min (3.18 -0.771 -0.108);
max (6.131 0.771 0.838);
}
/* refinementSnorkel
{
type searchableBox;
min (-0.746 -0.312 0.473);
max (-0.573 -0.063 0.629);
}
*/
refinementTunnel_01
{
type searchableBox;
min (-2.182 -1.507 -0.667);
max (7.523 1.508 2.007);
}
refinementTunnel_02
{
type searchableBox;
min (-4.782 -2.300 -0.670);
max (12.20 2.300 3.000);
}
refinementTunnel_03
{
type searchableBox;
min (-10.06 -3.500 -0.670);
max (15.06 3.500 4.000);
}
/*
refinementBOX_WINDOW_RH
{
type searchableBox;
min (0.986 0.602 0.695);
max (1.535 0.860 1.105);
}
refinementBOX_BACKSIDE
{
type searchableBox;
min (2.865 -0.860 0.655);
max (3.225 0.860 1.055);
}
*/
}



// Settings for the castellatedMesh generation.
castellatedMeshControls
{

// Refinement parameters
// ~~~~~~~~~~~~~~~~~~~~~

// While refining maximum number of cells per processor. This is basically
// the number of cells that fit on a processor. If you choose this too small
// it will do just more refinement iterations to obtain a similar mesh.
maxLocalCells 10000000;
//maxLocalCells 1000000;

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

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

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

"As far as Y+ goes, its the non-dimensional cell distance from the wall and its relation to the local velocity of that cell. Hence if you want to increase (or decrease) it then you need to go to larger (or smaller) cell heights at the surface. I guess you can do this by modifying the thickness of the layers or also by not refining the surface as much, hence the first cell would be larger."

Ok, I will give it a try on your suggestions.

Thanks a lot Scott. I really appreciate your help.


Regards,
Ayu
farahiam is offline   Reply With Quote

Old   June 6, 2011, 23:06
Default
  #8
Member
 
Scott
Join Date: Sep 2009
Posts: 41
Rep Power: 6
scott is on a distinguished road
Hi again,

Ok, by the looks of it I'd try car3_ext_aero when defining the names for the layers. One way to check for sure is to look at the resultant $RUN_DIRECTORY/constant/polymesh/boundary file.

If anyone else familiar with snappyHexMesh can have a look at this problem then I'd also like to hear your comments. I am just thinking along the lines of the simple things I have done in the past to resolve similar issues.

For complex geometries mine will start to create the layers, based on the naming convention I have used above, but then it all falls in a heap and after a few undo iterations there are no layers in my final mesh.

Thanks,

Scott
scott is offline   Reply With Quote

Old   June 6, 2011, 23:59
Default
  #9
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Ok Thanks a lot Scott.
I will re-post once I've obtained the results.

Cheers!
Ayu
farahiam is offline   Reply With Quote

Old   June 7, 2011, 21:25
Default
  #10
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Hi Scot,
I have managed to create the boundary layers on the car. Pictures as attached.
In my opinion, to capture the BL on complex geometry, maybe you could play around with the feature angle? I am not sure whether this helps.

Ayu
Attached Images
File Type: jpg BL_1.jpg (87.4 KB, 356 views)
File Type: jpg BL_2.jpg (100.0 KB, 359 views)
farahiam is offline   Reply With Quote

Old   June 7, 2011, 21:38
Default
  #11
Member
 
Scott
Join Date: Sep 2009
Posts: 41
Rep Power: 6
scott is on a distinguished road
Hi Ayu,

Good to see that it is working!

For future reference for others who come across this thread, what was the fix?

I'll try feature angle but I think its due to the complexities of my geometry.

Could you please post a closer up photo of your underbody/engine bay? Has it included boundary layers there also? Have you modified any of the settings/feature angles etc to get this to work?

Cheers,

Scott
scott is offline   Reply With Quote

Old   June 7, 2011, 21:55
Default
  #12
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 15
Rep Power: 6
farahiam is on a distinguished road
Yes, I also manage to capture the BL on the underbody.
Attached picture shows the BL near the exhaust pipe & underfloor and rear muffler & rr bumper.

Below are the part of the files that define the layers settings:

// Settings for the layer addition.
addLayersControls
{
relativeSizes true;
//relativeSizes false;

// Per final patch (so not geometry!) the layer information
layers
{
"ext_aero.*" {nSurfaceLayers 10;}
airdam {nSurfaceLayers 10;}
battery {nSurfaceLayers 10;}
body {nSurfaceLayers 10;}
bumper_headlamp {nSurfaceLayers 10;}
cowl-top {nSurfaceLayers 10;}
ECU-box {nSurfaceLayers 10;}
engine {nSurfaceLayers 10;}
exhaust-pipe {nSurfaceLayers 10;}
fr-suspension {nSurfaceLayers 10;}
fuel-tank {nSurfaceLayers 10;}
grills {nSurfaceLayers 10;}
hood {nSurfaceLayers 10;}
rr-suspension {nSurfaceLayers 10;}
side-mirror {nSurfaceLayers 10;}
spoiler {nSurfaceLayers 10;}
underfloor {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.

//finalLayerThickness 0.001; //absolute
finalLayerThickness 0.1; //relative

//- 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.010; //absolute
minThickness 0.1; //relative

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


// Advanced settings

//- When not to extrude surface. 0 is flat surface, 90 is when two faces
// make straight angle.

//featureAngle 15;
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.0025; //absolute
maxFaceThicknessRatio 1.0; //relative

// Reduce layer growth where ratio thickness to medial
// distance is large
//maxThicknessToMedialRatio 0.0015; //absolute
maxThicknessToMedialRatio 1.0; //relative

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

I change the setting to relative (instead of absolute) - means that the layers addition is relative to the near wall cell dimensions.
Hope this helps.

Ayu
Attached Images
File Type: jpg BL_3.jpg (99.2 KB, 295 views)
File Type: jpg BL_4.jpg (96.9 KB, 282 views)
farahiam is offline   Reply With Quote

Old   June 16, 2013, 09:35
Default
  #13
Senior Member
 
Mojtaba.a's Avatar
 
Mojtaba Amiraslanpour
Join Date: Jun 2011
Location: Zanjan, Iran
Posts: 195
Rep Power: 5
Mojtaba.a is on a distinguished road
Send a message via Yahoo to Mojtaba.a
Hello Guys, I have a similar problem with much more complex geometry. I haven't managed to make BL around the hole body since now.
Working for days and trying different combinations of options and settings is useless.

I have attached an image.
Do you have any idea how can I make it work?

Dear Scott and Ayu,

Quote:
Originally Posted by scott View Post
For complex geometries mine will start to create the layers, based on the naming convention I have used above, but then it all falls in a heap and after a few undo iterations there are no layers in my final mesh.
Is this because of mesh controls? How can I prevent sHM not to undo layer adding?

Quote:
Originally Posted by farahiam View Post
In my opinion, to capture the BL on complex geometry, maybe you could play around with the feature angle? I am not sure whether this helps.
I tried different feature angles 0, 15, 30, 180, but no success.

Quote:
Originally Posted by farahiam View Post
I change the setting to relative (instead of absolute) - means that the layers addition is relative to the near wall cell dimensions.
Hope this helps.
even making it relative or absolute doesn't effect anything.

Why is it so hard for sHM to create boundary layers? wasn't it better for sHM and other meshing programs to make boundary layers at first and then mesh the rest of the domain? for example like GAMBIT.

Thank you very much,
Mojtaba
Attached Images
File Type: jpg Screenshot from 2013-06-16 17:37:40.jpg (75.4 KB, 121 views)
__________________
Complex Heat & Flow Simulation Research Group
If you can't explain it simply, you don't understand it well enough. "Richard Feynman"
Mojtaba.a 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
Wind turbine simulation Saturn CFX 32 October 8, 2013 07:53
Implementation of boundary conditions for FVM Tom Main CFD Forum 6 April 1, 2012 09:31
Boundary layers in pipes 3D vas84 ANSYS Meshing & Geometry 2 May 2, 2011 03:20
boundary layers and k-w model paul Main CFD Forum 1 December 8, 2009 02:01
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55


All times are GMT -4. The time now is 19:55.