CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: snappyHexMesh and Others (http://www.cfd-online.com/Forums/openfoam-meshing-snappyhexmesh/)
-   -   Howto set mesh size tolerance (http://www.cfd-online.com/Forums/openfoam-meshing-snappyhexmesh/104965-howto-set-mesh-size-tolerance.html)

anothr_acc July 19, 2012 13:39

Howto set mesh size tolerance
 
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 July 20, 2012 12:05

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.

wyldckat July 20, 2012 15:23

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

Rider July 23, 2012 02:55

Quote:

Originally Posted by wyldckat (Post 372684)
I advise you to use "binary" mode in "controlDict", instead of "ascii".

Hi Bruno,

Could you explain why ?

Best regards,
Rider.

anothr_acc July 23, 2012 05:23

Quote:

Originally Posted by wyldckat (Post 372684)
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 July 23, 2012 10:19

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. :)

wyldckat July 23, 2012 17:19

Greetings to all!
Quote:

Originally Posted by anothr_acc (Post 373007)
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 (Post 372921)
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 :D

Best regards,
Bruno

Rider July 24, 2012 10:32

Thank you both for your clarification :)

anothr_acc July 25, 2012 04:51

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

wyldckat July 25, 2012 13:46

Hi Mark,

I've picked up on this post which should help you a lot:
Quote:

Originally Posted by elvis (Post 373402)
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

anothr_acc July 28, 2012 13:17

Read it and digested. Cheers Bruno. :)


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