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

[snappyHexMesh] optimize snapping

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2009, 05:18
Default optimize snapping
  #1
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Greetings foamers,

After seeing my mesh in paraview, I wasn't too happy with the snapping phase (see attached pictures). The attachments only contain the symmetry plane. I blended out the parts of the vehicle. As you can see there are still a lot of elements sticking out. Is there a way to smoothen these shown areas?

A digital pat on the back for your help.

Patrick

Here is a section of my snappydict.

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

//- Relative distance for points to be attracted by surface feature point
// or edge. True distance is this factor times local
// maximum edge length.
tolerance 4.0;

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

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

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

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

… the patches all have 5 as their nSurfaceLayers value

// Expansion factor for layer mesh
expansionRatio 1.5;

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

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

// 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;
}
Attached Images
File Type: jpg pic02.jpg (80.5 KB, 695 views)
File Type: jpg pic03.jpg (99.2 KB, 623 views)
foam_noob is offline   Reply With Quote

Old   December 19, 2009, 14:49
Default snapTolerance?
  #2
New Member
 
Axel Tietjen
Join Date: Dec 2009
Location: Hamburg, Germany
Posts: 19
Rep Power: 16
Axel_T is on a distinguished road
Hi Patrick,

I've got my problems with snappy, too.
But at least the snap-to surface-part works better than in your screenshots.
My suggestion would be to try another tolerance in the snapControl section.
Axel_T is offline   Reply With Quote

Old   January 12, 2010, 03:34
Default
  #3
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Hi Axel,

I think I know what the problem is. After inspecting the internal mesh in Paraview, I realized that the snapping did a fine job. The picture above shows a boundary region, more specifically a symmetry plane. The symmetry plane was already created in the STL file, which I meshed with snappy. My assumption is that snapping only influences the internal mesh, but has no influence on already existing boundaries.

Can someone verify my assumption?

Appreciate the help.

Patrick
foam_noob is offline   Reply With Quote

Old   January 13, 2010, 14:15
Default
  #4
Senior Member
 
Francesco Del Citto
Join Date: Mar 2009
Location: Zürich Area, Switzerland
Posts: 237
Rep Power: 18
fra76 is on a distinguished road
Simply, snappyHexMesh does not recognise feature lines, so sharp edges are not preserved.
If you want to improve the aspect of your mesh in those cases, all you can do is refine it, unfortunately...

Hope this helps,
Francesco
fra76 is offline   Reply With Quote

Old   January 14, 2010, 17:25
Default
  #5
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
hi all,

from what I saw using SnappyHexMesh, the aspect ratio plays an important role for the snapping phase. if you use an aspect ratio closer to one for the cells in this region the snapping should work better. At least that's the case for me.

I am currently working on trying to find a workaround for that. If you can try and tell us what you get.

Regards,

Vincent
vinz is offline   Reply With Quote

Old   January 18, 2010, 03:12
Default
  #6
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Thanks everybody. You've all been very helpful.

Patrick
foam_noob is offline   Reply With Quote

Old   January 21, 2010, 10:28
Default
  #7
Senior Member
 
MadsR's Avatar
 
Mads Reck
Join Date: Aug 2009
Location: Copenhagen, Denmark
Posts: 177
Rep Power: 17
MadsR is on a distinguished road
@Vincent: It seems from the screen-shot, that Patrick already has an aspect ratio around 1, or am I not following what you mean?

/Mads
__________________
Online free airfoil-mesher for OpenFOAM here
MadsR is offline   Reply With Quote

Old   January 21, 2010, 11:05
Default
  #8
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
From the screen shot I wouls say the aspect ratio is more around 3 or 4. I know that's it's the same order but from the use of snappyHexMesh I did so far I saw that it can have some influence.

However I didn't get so bad results. Coud it come from the stl discretisation? too large? too small?

I still think that unfortunately I don't understand the influence of all the parameters inside SnappyHexMesh. I don't know which parameter can result in this behaviour.

SnappyHexMesh looks very close to be a very useful tool, but each time I create a mesh, I get something which makes me think that there are few things missing to get a very good grid.

Regards,

Vincent
vinz is offline   Reply With Quote

Old   January 21, 2010, 11:26
Default aspec ratio
  #9
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Hey Vincent,

I would like to try to mesh the file with an aspect ratio value of 1. I looked through the snappyDict, but I didn't find the option for aspect ratio. Can you tell me where I can adjust it?

Thanks,

Patrick
foam_noob is offline   Reply With Quote

Old   January 21, 2010, 11:33
Default
  #10
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
To get an aspect ratio of 1, you have to change the values of number of points in the x direction in blockMeshDict, not in snappyHexMeshDict.

Your base mesh should have an aspect ratio close to 1, and then your final mesh will have the same since cells are split equally in each direction.

Hope this helps.

Vincent
vinz is offline   Reply With Quote

Old   January 21, 2010, 11:45
Default
  #11
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Hey Vincent,

This is a short segment of the blockmeshdict.

blocks
(
hex (0 1 2 3 4 5 6 7) // vertex numbers
(10 10 10) // numbers of cells in each direction
simpleGrading (1 2 3) // cell expansion ratios
);


Do you mean the number after simpleGrading or the ones before //numbers of cells....

And why only change the aspect ratio of the cells in x direction??

Your help is much appreciated .

Patrick
foam_noob is offline   Reply With Quote

Old   January 21, 2010, 11:55
Default
  #12
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
I was talking about the "number of cells in each direction"
You can change (10 10 10) by (30 10 10) for exemple

This comes from the fact that you place the same number of cells in each direction, but the size of your domain is larger in x direction than in y direction, so at the end cells are larger in x direction.

If you take a domain of 3m in x direction and 1 m in y direction, that you devide by 10 (number of cells in each direction in your dictionary), at the end, cells in x are 0.3m wide and 0.1m in y direction. You see what I mean?
Then what I call the aspect ration here deltaX / deltaY = 3

If you choose to put 30 cells in x direction, then the deltaX is equal to 0.1, and the aspect ratio is equal to 1.

It would be also interesting maybe later to twice or four time as many cells in each direction, so let say (120 40 40) in our example to refine the base mesh. But then in snappy, you use a refinement level one or two below the one you currently have, to obtain the same number of cells at the end. I don't know if the base mesh is very important in SnappyHexMesh.

Hope this helps.

Vincent
vinz is offline   Reply With Quote

Old   January 22, 2010, 08:04
Default
  #13
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Hey,

Quote:
Originally Posted by vinz View Post

It would be also interesting maybe later to twice or four time as many cells in each direction, so let say (120 40 40) in our example to refine the base mesh. But then in snappy, you use a refinement level one or two below the one you currently have, to obtain the same number of cells at the end. I don't know if the base mesh is very important in SnappyHexMesh.
What do you mean by "use a refinement level one or two below the one you currently have, to obtain the same number of cells at the end."
What is my current refinement level??
I thought the whole point of snappy was to create a finer mesh of the geometry and have more cells.

Patrick
foam_noob is offline   Reply With Quote

Old   January 22, 2010, 08:34
Default
  #14
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
In the snappyhexmesh dict, you have a part which is named "castellatedMeshControls"
In this part, there is something like this:
refinementSurfaces
{
yourModel
{
// Surface-wise min and max refinement level
level (5 5);
}
}
the part level (5 5) means that around your model, in your case, the car, the cells of your original blockMesh grid are going to be split in two, and this five times. there are two numbers, the minimum refinement level and maximum refinement level

So let say you want a final cell size of 0.25m, you can do this in several way:
- chose a blockmesh grid with cells of 1m and chose a refinement level of 2. The cell is going to be devided by 2, and then again by 2, so you'll get a size of 0.25m.
- you can also chose to create a blockMesh grid with cells of 0.5m and then chose a refinement level of 1 which will split the cell only once and give you cells of 0.25m.

Not easy to explain, but I hope you can understand. Or maybe someone else will be able to give a better explanation.

Vincent
vinz is offline   Reply With Quote

Old   January 25, 2010, 10:22
Default
  #15
New Member
 
Patrick Wang
Join Date: Dec 2009
Location: Stuttgart, Germany
Posts: 26
Rep Power: 16
foam_noob is on a distinguished road
Hey,

I just remeshed my structure with an aspect ratio close to 1. Although it didn't solve my problem with the elements jagged elements sticking out of the symmetry plane, it did however create a mesh with no quality errors (CheckMesh => Mesh Ok). I always had skewFaces in my mesh and didn't know how to remove them with the mesh utilities.

Vincent do you by any chance know how to use the mesh utilities to remove flaws in the mesh?

Thanks again, you helped me out big time.

Patrick
foam_noob is offline   Reply With Quote

Old   January 25, 2010, 10:33
Default
  #16
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
Hi Patrick,

Unfortunately I don't have much experience with the mesh utilities.
I was thinking about an other possible cause of your problem. Does your problem only appear at the intersection between the car and the symmetry plane? Because it could be due to a bad intersection of the model with the symmetry plane if your are using only half of the car as input. Or it could also come from a bad discretisation of the stl model itself making it hard for SnappyHexMesh to find the correct position of the surface?

Would you be able to share the input model so I can try with my usual settings and tell you if I get the same results?

I hope you'll find a solution.

Vincent
vinz is offline   Reply With Quote

Old   February 15, 2010, 14:13
Default
  #17
New Member
 
Join Date: Sep 2009
Posts: 17
Rep Power: 16
tachyon_me is on a distinguished road
foam_noob
I 'm trying to view mesh section cut with paraview, it show me all the cross lines ,
How to get a clean reactanguar mesh , the one you showed in your post with paraview .


thanks
tachyon_me is offline   Reply With Quote

Old   February 16, 2010, 05:24
Default
  #18
New Member
 
Simon Rees
Join Date: Mar 2009
Posts: 12
Rep Power: 17
sjrees is on a distinguished road
Unfortunately Paraview (VTK) does not have an explicit representation of polyhedra - you will only see tets, hexs and pyramids. Hence a polyhedra in openfoam will be devolved into these shapes. When you cut through an unstructured mesh the plane is always decomposed into triangles. This can be missleading when viewing the openFOAM mesh made with SHM but is just a 'feature' of Paraview (VTK really). I don't know a way arround this except to use another visualisation tool. I just live with it and find it good enough when visualising the mesh.

Simon
sjrees is offline   Reply With Quote

Old   February 16, 2010, 06:12
Default
  #19
New Member
 
Simon Rees
Join Date: Mar 2009
Posts: 12
Rep Power: 17
sjrees is on a distinguished road
As snapping to edges is a recurring theme perhaps one of the SHM developers could add something?

It would be good to know if there is a development plan. I am sure some of us would like to commit to using the tool but the edge snapping problem is something of a stumbling block.

Regards,
Simon
sjrees is offline   Reply With Quote

Old   February 16, 2010, 06:49
Default
  #20
Senior Member
 
Vincent RIVOLA
Join Date: Mar 2009
Location: France
Posts: 283
Rep Power: 18
vinz is on a distinguished road
Unfortunately, as it has been said a lot of times on this forum, something has already been developed, but from what I know, it is kept inside the software of Icon named FoamPro. It is not in the public domain, and i didn't heard anything so far telling me that it would become public some time soon.
vinz 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] SHM not snapping to some surfaces Swift OpenFOAM Meshing & Mesh Conversion 13 January 4, 2016 02:56
[snappyHexMesh] Snapping problem, non orthogonal faces Zephiro88 OpenFOAM Meshing & Mesh Conversion 7 April 17, 2015 03:56
[snappyHexMesh] snapping doesn't work properly estang OpenFOAM Meshing & Mesh Conversion 7 January 12, 2015 02:06
[snappyHexMesh] Snapping not enough (even with surfaceFeatureExtract) ironclad OpenFOAM Meshing & Mesh Conversion 1 November 8, 2013 03:58
[snappyHexMesh] Weird snapping outside a refinement region jasimpson89 OpenFOAM Meshing & Mesh Conversion 0 July 29, 2012 21:46


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