CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

A new meshing algorithm

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 2 Post By flotus1
  • 1 Post By sbaffini
  • 1 Post By kandelabr
  • 1 Post By sbaffini
  • 1 Post By JBeilke
  • 1 Post By kandelabr

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 1, 2021, 15:44
Default A new meshing algorithm
  #1
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Hello!

Once I described meshing process to a layman as a process where the domain is split into hexes. I also complained how insanely complicated and difficult that is but when I was asked to explain why, I had no idea.

I still don't know why but I'm thinking of writing a rather obvious and simple algorithm to chop a domain into a mesh. Before I throw myself into programming and waste months with it, I'd like to share it with you for comments and warnings.

This is how it goes:
  1. Similar to snappyHexMesh, a background mesh would be a starting point.
  2. Refinement and all the same as snappy.
  3. Unlike snappy, instead of snapping cells to surface, I'd just cut them with it:
    1. Since cells wouldn't be deformed, non-orthogonality and skewness and stuff would be that problematic.
    2. Small details in geometry (smaller than cell size) would automatically get eliminated (one option)
    3. Cells almost completely cut away could be deleted and then snapping could be done much safer and easier
  4. Adding layers: similar to snappy but in reverse:
    1. First, offset the surface by boundary layer thickness.
    2. Create internal mesh on the offset surface.
    3. Extrude faces to meet with the original geometry.

To me this algorithm seems a bit too obvious and that's why my all my alarms are going off.
Is there something I'm missing or should I give this a go? Does anything like that exist already?

Thanks for all your feedback.
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 1, 2021, 16:00
Default
  #2
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Here's a simple hand-made example using CAD - cubes, cut with with a revolved surface.

Imagine straight edges and collapsed small/thin cells.
Attached Images
File Type: png mesh-cad.PNG (75.5 KB, 28 views)
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 1, 2021, 16:10
Default
  #3
Super Moderator
 
flotus1's Avatar
 
Alex
Join Date: Jun 2012
Location: Germany
Posts: 3,427
Rep Power: 49
flotus1 has a spectacular aura aboutflotus1 has a spectacular aura about
Many algorithms may sound pretty straightforward and simple to implement. As long as you don't actually have to do it, but just write down bullet points
From time to time, I am still pushing updates to what is essentially a multi-level Cartesian grid generator. It has been years since I wrote the first line of code. Part of that is certainly feature creep, but a lot of it is just the reality of having to deal with complex, real-world geometries.

Let's just take one of your bullet points: "Small details in geometry (smaller than cell size) would automatically get eliminated (one option)"
Sounds easy enough. But now define what counts as a small detail, and how you can reliably and safely identify it through an algorithm.

Or this one: "First, offset the surface by boundary layer thickness."
First issue that comes to mind, and there might be many more: what happens when the offset surface is no longer inside the computational domain, because there was another wall too close.

Not trying to discourage you, but you should be aware of what you are getting yourself into.
sbaffini and aero_head like this.
flotus1 is offline   Reply With Quote

Old   March 1, 2021, 17:30
Default
  #4
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Yes, these thoughts are exactly what I would like to hear - that's why I'm asking here.

The first point is pretty straightforward: when cutting a cell, only one triangle (I'm limiting myself to STL for now) can cut through a single edge (in case of many, choose a point that creates a shorter edge). So cut the edges and divide the cell, regardless of what's between them. Hehe, I can already see if()'s stacking

The second is not as simple. For a start I could just rely on user to operate within sane parameters and return garbage otherwise. It's the same with other meshers I know.

However, I am aware it's not going be simple and I also know these two thoughts are not the only problems I would encounter. But maybe, just maybe it'll be easier to fix problems created by a simple algorithm than, for instance, foamyHexMesh. That thing is so complicated that no one uses it. Also, it doesn't work.

Thank you for your input!
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 2, 2021, 05:24
Default
  #5
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
There is some material out there related to actual hexa grid generators that you might find useful.

One is the Ph.D. thesis of Kostantin Kovalev at Vrije Brussel under Hirsch and Lacor, that certainly has links with Hexpress by Numeca, the title being "Unstructured Hexahedral Non-conformal Mesh Generation".

You can also give a look at the series of paper by Prof. J. Wang on the 2^N tree cartesian grid generator, which became part of Fastran (at the time developed by CFD Research).

The international meshing roundtable is also a relevant source of information.

Finally, I recently discovered this project https://www.dgp.toronto.edu/projects/mandoline/ which promises what you seem to look for. But, honestly, I have doubts it can be done in a CFD context without control on the STL input.

Ideally, you can devise an approach that will always mesh any STL without difficulty (i.e., a trivial algorithm), but then you will have one or more of the following:

- severe quality degradation in the representation of the underlying geometry

- severe mesh quality degradation

- lack of features nowadays considered fundamental for usability, like the mentioned gap meshing, or the conformal meshing across STL surfaces for multiple zones

- lack of robustness

However, I would not consider SH as a reference in the field as, indeed, the number of times it can fail without proper care is certainly revealing of some issue
aero_head likes this.
sbaffini is offline   Reply With Quote

Old   March 2, 2021, 06:53
Default
  #6
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Thank you for your advice, I'll have a closer look into your links, it really does look similar to my ideas. That either confirms we're both right or we're all wrong =D

I also agree about your thoughts about geometry representation vs. quality degradation. In my opinion, it's far more important to have a high-quality mesh that omits minor details than detailed one that doesn't work. However, that's just my opinion based on my current experience.

Additional features you're talking about are yet to be thought about. A bit too early for my current plans...

Thank you for your comments!
aero_head likes this.
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 2, 2021, 13:46
Default
  #7
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by kandelabr View Post
  1. Unlike snappy, instead of snapping cells to surface, I'd just cut them with it:
To me this algorithm seems a bit too obvious and that's why my all my alarms are going off.

What's gonna be the surface normal of the cells when you use it in a CFD simulation, and how are you going to calculate the fluxes through this cells?


That would be the limiting factor.


I saw some papers use cells faces that were curved and conformed to the boundary shape. Your algorithm would produce a similar result. But those curved cell faces would need to be represented using some form of polynomial/nubs/bezier curves.


Your solver code also becomes more complicated while using this kind of grid.
aerosayan is offline   Reply With Quote

Old   March 2, 2021, 13:51
Default
  #8
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by aerosayan View Post
What's gonna be the surface normal of the cells when you use it in a CFD simulation, and how are you going to calculate the fluxes through this cells?


That would be the limiting factor.


I saw some papers use cells faces that were curved and conformed to the boundary shape. Your algorithm would produce a similar result. But those curved cell faces would need to be represented using some form of polynomial/nubs/bezier curves.


Your solver code also becomes more complicated while using this kind of grid.
I think he was considering just STL surfaces as input. Hence he would just end up with polyhedral cells with planar faces, nothing fancy to manage on the solver side, if he is actually able to produce them
sbaffini is offline   Reply With Quote

Old   March 2, 2021, 14:10
Default
  #9
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
I think he was considering just STL surfaces as input. Hence he would just end up with polyhedral cells with planar faces, nothing fancy to manage on the solver side, if he is actually able to produce them
Yes, that's right.
There are two possible variants:
  • conforming to every triangle of STL and making polyhedral cells or
  • cutting only cube edges and making (more or less) planar faces from new points. Triangles inside the cell itself could easily be ignored.

I would say the first method would be much more complicated and could cause trouble with bad input surfaces, concave cells and so on. Also I don't really see the point in having that complex cells on boundary - details must be captured with many cells, not with a single complicated poly.
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 2, 2021, 14:26
Default
  #10
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by kandelabr View Post
Yes, that's right.
There are two possible variants:
  • conforming to every triangle of STL and making polyhedral cells or
  • cutting only cube edges and making (more or less) planar faces from new points. Triangles inside the cell itself could easily be ignored.

I would say the first method would be much more complicated and could cause trouble with bad input surfaces, concave cells and so on. Also I don't really see the point in having that complex cells on boundary - details must be captured with many cells, not with a single complicated poly.
Yes, the second one would be a sort of marching cubes. Still, a cube cut by a plane (i.e., a single triangle) is still a polyhedron in general and might also have polygonal faces.
kandelabr likes this.
sbaffini is offline   Reply With Quote

Old   March 2, 2021, 14:34
Default
  #11
Senior Member
 
Joern Beilke
Join Date: Mar 2009
Location: Dresden
Posts: 516
Rep Power: 20
JBeilke is on a distinguished road
The idea is not new. The same was done by cd-adapco and called "samm" and later "pro-am". The first version was published around 1997. Some of the possible cell types can be seen in the picture.
Attached Images
File Type: png Screenshot_20210302_081241.png (46.7 KB, 14 views)
kandelabr likes this.
JBeilke is offline   Reply With Quote

Old   March 2, 2021, 14:51
Default
  #12
Senior Member
 
kandelabr's Avatar
 
Nejc
Join Date: Feb 2017
Location: Slovenia
Posts: 196
Rep Power: 9
kandelabr is on a distinguished road
Quote:
Originally Posted by JBeilke View Post
The idea is not new. The same was done by cd-adapco and called "samm" and later "pro-am". The first version was published around 1997. Some of the possible cell types can be seen in the picture.
Very interesting stuff!
https://www.researchgate.net/publica...eration_in_CFD

I knew I wasn't the first to think of that
tkeskita likes this.
__________________
www.damogranlabs.com
kandelabr is offline   Reply With Quote

Old   March 2, 2021, 15:56
Default
  #13
Senior Member
 
Sayan Bhattacharjee
Join Date: Mar 2020
Posts: 495
Rep Power: 8
aerosayan is on a distinguished road
Quote:
Originally Posted by sbaffini View Post
I think he was considering just STL surfaces as input. Hence he would just end up with polyhedral cells with planar faces, nothing fancy to manage on the solver side, if he is actually able to produce them

Interesting. STL surfaces sometimes have very skewed triangulation to preserve memory space. Generally that's how it works in 3D industry, but in CFD, the STL surfaces may be of higher quality triangulation.
aerosayan is offline   Reply With Quote

Old   March 2, 2021, 16:14
Default
  #14
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,190
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Quote:
Originally Posted by aerosayan View Post
Interesting. STL surfaces sometimes have very skewed triangulation to preserve memory space. Generally that's how it works in 3D industry, but in CFD, the STL surfaces may be of higher quality triangulation.
Well, no, I didn't mean that the result would be great or satisfy any quality criteria.

Just that, as he explicitly mentioned the STL input, that he would only have to deal with planar faces, by definition of STL.
sbaffini 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
[ANSYS Meshing] only automatic meshing works, kazra ANSYS Meshing & Geometry 2 February 23, 2017 12:38
Meshing Process sidharth9426 STAR-CCM+ 4 September 15, 2015 04:31
[ICEM] Flow channel meshing problems StefanG ANSYS Meshing & Geometry 19 May 15, 2012 07:44
[ANSYS Meshing] Meshing strategy for External Flows Hybrid ANSYS Meshing & Geometry 0 January 24, 2012 15:27
Best Meshing scheme for Cylinder Nutrex Main CFD Forum 4 July 29, 2008 12:03


All times are GMT -4. The time now is 23:30.