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

[snappyHexMesh] SnappyHexMesh doesnt refine in one direction

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 7, 2022, 10:18
Default SnappyHexMesh doesnt refine in one direction
  #1
New Member
 
Gustavo
Join Date: Jun 2021
Posts: 17
Rep Power: 5
gustavoliveira is on a distinguished road
Hello,


I am trying to use the snappyhexmesh to refine the mesh around the channel. I create a blockMesh with 2x2x2 cells and I would like to delimit and refine inside my stl file that represents the channel. But the quality of the cells after the snappyHexMesh doesnt look good. I would like cell around the boundaries of the stl file to be smoother. And on the y-axis the cells are bigger than another axis. I've tried a lot of things but I dont know how to improve. Can someone help me? I attached the results of the blockMesh, snappyHexMesh and the case.


Thanks a lot.
Attached Images
File Type: jpg blockMesh.jpg (108.2 KB, 32 views)
File Type: jpg snappy.jpg (206.1 KB, 42 views)
Attached Files
File Type: zip case.zip (72.0 KB, 3 views)
gustavoliveira is offline   Reply With Quote

Old   July 7, 2022, 11:11
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,198
Rep Power: 27
Yann will become famous soon enough
Hi Gustavo,

First thing: your STL looks pretty bad (see screenshot). I would not expect to get a clean mesh out of a bad STL file.

Second thing: the STL file does not fully intersect the blockMesh domain so snappy does not remove the unwanted part of the mesh when I try to mesh it.

By the way: which version of OpenFOAM are you using?

Regards
Yann
Attached Images
File Type: jpg screenshot.jpg (86.5 KB, 35 views)
Yann is offline   Reply With Quote

Old   July 7, 2022, 11:52
Default
  #3
New Member
 
Gustavo
Join Date: Jun 2021
Posts: 17
Rep Power: 5
gustavoliveira is on a distinguished road
Hi Yann, thanks a lot.

Now I've atacched the case in the correct domain. The stl original is to big to be attached on the forum, so I cut it but I didnt test the case. Sorry about the that.

Really the stl file is very bad, I wasted some time filling the holes after I receveid it. But the first ~120 meters on the x-axis doesnt look too bad, dind it? And it is the main region of interest, and I'd expect that snappyHexMesh refine a little better mainly in the y-axis direction, or not?

By the way I'am using the openfoam9.

Thanks again.
Attached Files
File Type: zip case.zip (72.6 KB, 1 views)
gustavoliveira is offline   Reply With Quote

Old   July 7, 2022, 14:16
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,198
Rep Power: 27
Yann will become famous soon enough
OK so, this is a fun one!

Your geometry is very far away from the origin of the coordinate system: the STL file coordinates are about 6e6-7e6 meters.

The default mergeTolerance in snappyHexMeshDict is 1e-6 and the default writePrecision in controlDict is 6. It basically means you have a precision of 1 meter on your mesh, which explains the poor resolution you get on your mesh.

I translated your STL closer to the origin with this command:

Code:
surfaceTransformPoints "translate=(-666791 -7.77586e+06 -729.012)" constant/triSurface/canal9.stl constant/triSurface/canal9_translated.stl
Then I modified your Allrun scrip to also translate the initial mesh (after running blockMesh) and it seems to works better, as you can see on the screenshot. The geometry is still not very good, but this is related to the quality of the STL file.

You could probably also fix it by increasing the mergeTolerance and writePrecision, but I did not try it so I don't know if something else could mess up the mesh.

Cheers,
Yann
Attached Images
File Type: jpg screenshot.jpg (197.1 KB, 25 views)
Attached Files
File Type: zip case_fix.zip (137.7 KB, 2 views)
Yann is offline   Reply With Quote

Old   July 7, 2022, 14:32
Default
  #5
New Member
 
Gustavo
Join Date: Jun 2021
Posts: 17
Rep Power: 5
gustavoliveira is on a distinguished road
Looks great! Thank you so much! Do you know why snappyHexMesh needs to work with the domain near the origin?
gustavoliveira is offline   Reply With Quote

Old   July 8, 2022, 04:33
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,198
Rep Power: 27
Yann will become famous soon enough
I think this is only a matter of precision: with the default writePrecision of 6, if your coordinate is 100000m, then the nodes coordinates will have a precision down to the meter.

If the coordinate is 1m instead, the nodes coordinates will have a precision down to the hundredth of millimeter.

I think this is why you had this weird behavior where cells seem to be elongated along the y-axis: the coordinates get truncated with a precision lower than the actual cell size and this leads to distorted cells.

I am not sure my explanations are very clear, but if you want to have a look for yourself, change the write format from binary to ascii in your controlDict, and then compare the constant/polyMesh/points file of your original case with the one of the case I posted.

Regards,
Yann
AtoHM likes this.
Yann 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
[snappyHexMesh] SnappyHexMesh in 2D case sjs OpenFOAM Meshing & Mesh Conversion 12 November 8, 2019 05:51
[mesh manipulation] How to use refineHexMesh just in 2 direction? ripperjack OpenFOAM Meshing & Mesh Conversion 8 May 31, 2014 14:43
Changing inflow velocity direction deteriorates lift and drag ziggo FLUENT 3 July 24, 2013 09:39
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! sc298 OpenFOAM Meshing & Mesh Conversion 2 March 27, 2011 22:11
[snappyHexMesh] snappyHexMesh aborting Tobi OpenFOAM Meshing & Mesh Conversion 0 November 10, 2010 04:23


All times are GMT -4. The time now is 00:57.