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

Howto set mesh size tolerance

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 19, 2012, 13:39
Default Howto set mesh size tolerance
  #1
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
Hi everyone,

I'm using the snappyHexMesh castellatedMesh step on its own, to refine up to 7 or 8 levels from an original blockMesh with nCellsBetweenLevels 3. I have a surface defined in an STL file. The surface is being picked up ok but as I increase my refinement level beyond 6 I start getting 0 determinant cells and checkMesh tells me I have nearPoints (closer than 1.5e-06 apart). Yet, inspection of the problem cells in paraFoam shows good looking cubes that are in reasonable places. It is possible that snappy is stopping before full refinement has occurred but I wonder:

How can I tighten the spatial tolerances in snappy?

I have adjusted my controlDict writePrecision to 8 and my mergeTolerance in snappyHexMeshDict to 1E-8 but this seems not to help. Any pointers would be welcome!

Best regards,

Mark.
anothr_acc is offline   Reply With Quote

Old   July 20, 2012, 12:05
Default
  #2
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
I also set minVol to -1E30 to turn off the minimum volume checker: still the same effect.

Please, if anyone has any comment, I'd like to hear it! Snapping to the .stl is working wonderfully, the mesh looks good and I've almost got layer addition working but if I can't beat this single, zero determinant cell this is a no-go!

Cheers,

Mark.
anothr_acc is offline   Reply With Quote

Old   July 20, 2012, 15:23
Default
  #3
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings Mark,

Did you see this at the bottom of "snappyHexMeshDict"?
Code:
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;


edit: I advise you to use "binary" mode in "controlDict", instead of "ascii".

Best regards,
Bruno

Last edited by wyldckat; July 20, 2012 at 15:37. Reason: see "edit:"
wyldckat is offline   Reply With Quote

Old   July 23, 2012, 02:55
Default
  #4
Member
 
Join Date: Apr 2012
Location: France
Posts: 72
Rep Power: 5
Rider is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
I advise you to use "binary" mode in "controlDict", instead of "ascii".
Hi Bruno,

Could you explain why ?

Best regards,
Rider.
Rider is offline   Reply With Quote

Old   July 23, 2012, 05:23
Default
  #5
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
Quote:
Originally Posted by wyldckat View Post
Greetings Mark,

Did you see this at the bottom of "snappyHexMeshDict"?
Code:
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
// Note: the write tolerance needs to be higher than this.
mergeTolerance 1E-6;


edit: I advise you to use "binary" mode in "controlDict", instead of "ascii".

Best regards,
Bruno
Hi Bruno, thanks for responding.

I did spot that parameter and experimented with it. I'd convinced myself it wasn't helping. I'll try again. Regarding binary mode, I hadn't considered it. Great idea!

Thanks again,

Mark.
anothr_acc is offline   Reply With Quote

Old   July 23, 2012, 10:19
Default
  #6
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
My single zero determinant is now a tiny determinant: 7E-46. Thanks for the tip.

As for the difference between ascii and binary mode:

ascii: 164 Mb per time-step.
binary: 79Mb per time-step.

Lovely.
anothr_acc is offline   Reply With Quote

Old   July 23, 2012, 17:19
Default
  #7
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!
Quote:
Originally Posted by anothr_acc View Post
My single zero determinant is now a tiny determinant: 7E-46. Thanks for the tip.

As for the difference between ascii and binary mode:

ascii: 164 Mb per time-step.
binary: 79Mb per time-step.

Lovely.
Yep, if the mesh needs high detail, you'll need to preserve as much information as possible for the mesh in question, as well as the results for the simulation.

Quote:
Originally Posted by Rider View Post
Hi Bruno,

Could you explain why ?

Best regards,
Rider.
ASCII is a nice format for:
  • Debugging manually the results, using a text editor.
  • Getting higher compression ratios when using gzip.
But it's cumbersome if you need precision. Binary saves the full 8 bytes in double precision, which would require ASCII about 14 digits and 6 more characters for the (almost) same precision: 0.12345678901234e-308

And as confirmed by Mark, the more precision you have for the mesh, the merrier the user

Best regards,
Bruno

Last edited by wyldckat; July 23, 2012 at 17:22. Reason: typo
wyldckat is offline   Reply With Quote

Old   July 24, 2012, 10:32
Default
  #8
Member
 
Join Date: Apr 2012
Location: France
Posts: 72
Rep Power: 5
Rider is on a distinguished road
Thank you both for your clarification
Rider is offline   Reply With Quote

Old   July 25, 2012, 04:51
Default Update
  #9
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
I've now changed to binary format in all my simulations. Great tip, Bruno. I've also adjusted my tolerances. However, the zero determinant that turned into a tiny determinant with a change of tolerances, vanished when I changed my snappyHexMeshDict:castellatedMeshControls parameter,

Code:
refinementSurface { anemometer { level (7 7); } }
to

Code:
refinementSurface { anemometer { level (8 8); } }
This occurs at the castellation phase.

In fact, I get something like the following:

Code:
level       minimum 
            determinant
(2 2)            1
(3 3)            1
(4 4)            1
(5 5)            1
(6 6)            1
(7 7)            0 (or very small with tight spatial tolerances
(8 8)            1
I am going to use (8 8) for now and accept that my mesh is overly refined. Hopefully my y+ won't get too small. In short, I have another problem and I don't know why it occurs but am moving on as results are required. Still, I improved my Openfoam! Thanks for your help.

Best regards,

Mark.
anothr_acc is offline   Reply With Quote

Old   July 25, 2012, 13:46
Default
  #10
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Hi Mark,

I've picked up on this post which should help you a lot:
Quote:
Originally Posted by elvis View Post
there is a brilliant tutorial (download and untar it "tar -xzf ") I believe it will guide you throught most of your SHM questions
The full link to where the tutorial is: http://www.openfoamworkshop.org/2012...enedeVilliers/

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   July 28, 2012, 13:17
Default
  #11
Member
 
ms
Join Date: Mar 2009
Location: West London
Posts: 43
Rep Power: 8
anothr_acc is on a distinguished road
Read it and digested. Cheers Bruno.
anothr_acc 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
Number of cells in mesh don't match with size of cellLevel colinB OpenFOAM Native Meshers: snappyHexMesh and Others 11 January 13, 2015 12:47
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
3D Hybrid Mesh Errors DarrenC ANSYS Meshing & Geometry 11 August 5, 2013 06:42
[ICEM] ICEM Scripting Issues tylerplowright ANSYS Meshing & Geometry 17 June 3, 2012 21:23
2D Mesh Generation Tutorial for GMSH aeroslacker Open Source Meshers: Gmsh, Netgen, CGNS, ... 12 January 19, 2012 04:52


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