https://linen.dev logo
snappyAiMesh: improvements on snappyHexMesh
# general-talk
k
1. Cut the cells instead of deform; .org branch has this cell-cutting thingy it uses for multiphase flows (Claude found that on its own) and it can be used to cut cells; problem: you get small cells, slivers, high-skewness etc. It's much more difficult to fix bad cells than to just 'not make' them
2. remove all cells where a single point protrudes from the STL; smooth the surface to get a 'potato'; then, extrude cells back to STL. works flawlessly for convex geometry (a.k.a. sphere) but extrusion fails in concave corners and it's totally miserable when it has to snap to features (edges, vertices)
I tried these two with like 5 different iterations each. Was excited at first to see Claude do what I wanted but meshes were... shit
3. The verdict: snapping algorithm is kind of a gem (handles all possible situations with surfaces/features) and let's reuse that but try to make background more conforming/castellation better suited to the geometry. Alas, I can't describe what to do because I currently don't know how I'd do that.
Also: I think layer addition is not a problem - it just doesn't have space to work with. If the underlying mesh was pretty (like, a single thick cell layer) it would be a piece of cake - could be as easy as
refineWallLayer
...
And then I hit the weekly token limit. Now my floating license is used in the finance department where they're asking Claude about the weather
y
Hmmm I'm not so sure. There are cases where the failed layer addition is due to the quality of the outer mesh going wrong when you morph it to make room for the layers. A single thick layer that you cut (``refineWallLayer`` style) kinda still have the same issue, no? I mean you still have to morph the mesh to insert this layer
To avoid this there is @otaolafr's dream of creating layers based on a surface mesh first, and then fill the volume with cells (could be hex cells with polys to join volume mesh and boundary layer)
z
I imagine 3 is a probably the most promising route
Replace block mesh instead of replacing snappy
Although maybe you'd run into the problem of snappy seeming to really hate cells that aren't perfect cubes
y
I think a better suited initial mesh could ease snappy job indeed
Engys advanced mesh algorithm sounds kinda like a fancy "buffer layer + refineWallLayer" strategy. Maybe you should ask Claude about it, just in case Anthropic scrapped that too 🙄 😅
o
Hahaha you tag me to tempt me I know you enough Yann 🤣
1. For me, remeshing of surface mesh to quad mesh (if necessary) there are a bunch of existing algorithms that can deal with high complex geometries. 2. Extrude big feature conserving layer, Check the image of the code here https://hal.science/hal-03127350/document 3. Your main issue ones this is done is make conformal the big layer and the conformal interface now that's an issue, the fastest and at least doable thing to do is throw an advancing front tetra mesher. This can be netgen for example but there is a bunch of other meshers around. 4. You can divide you wall layer 5. You try to create a dual mesh that respects features, also difficult step. 6. I would (and if you want to ask to develop this as a extra tool, would be awsome) decompose the polys of the snappy refinement into "classic cells" tetra pyr prism blablabla. And use a smoothing based on the paper of 2. To increase the global quality.
This are the improvements I see. The hard point is 3. IMO or once you have you big layer your mesh snapped to to re create the big layer going the other way around to get conformal.
It has been almost fully solved by the snappy creator as he works in helyx. There you get way better quality with helyxmesher and it is based on snappy so you can have hopes that the truth is out there
for 2. also you have https://www.sciencedirect.com/science/article/pii/S0021999125000270 and if you add the 1. (before you say you want all full hexas) no, it is not the reason the reason is this: https://github.com/mxncr/AllHexBoundaryLayerTopologySolver
you have a bunch of material to throw at claude ^^
are you intentionally not using it for classy to keep it ai free? or simply you are not looking in that right now?
two last items, there is the all forgotten openfoam mesher with gui i can not find it right now that was in serial that first generated the boundary layer and it was generating quite good quality meshes... but in serial, also a place to check out.
and lastly there is a similar snappy boundary layer extrusion in salome cfd

https://www.youtube.com/watch?v=VGpiWwZYrH4â–¾

oh and make claud throw mesquite before layer addition after snappying (or just before it) this will solve already a buuuuunch of issues if you success to remove the polyhedral cells.
i dont have the brain or the computer capabilities to do this. also if you have the time and want to help me there is 2 bugs in salome that it has been several versions that i am asking for help without solution, and if you can chase them with claud i would be infinity greatfull ahahah
(just if you simply want to make claud license work )
k
https://discord.com/channels/397772779870486529/397874745464586242/1547326637228691519 that's my current final verdict a.k.a. snappy is terribly well-polished but the approach is just... clumsy
I dealt with custom backgrounds and the problem was that you can't refine a lot with that. after refining, points should be re-snapped to the surface or else you get dangling cells that make the situation worse than with non-fitted background https://cdn.discordapp.com/attachments/1547237441067294780/1547485271220551680/24846.png?ex=6aa39777&is=6aa245f7&hm=f85b5464fcf7b2d0d9b9f48c88dc69b4cacc11ef40142c41a49dfb0e97e48c09&
Besides, making a custom background is almost the same as making a proper hex mesh from the start, just a bit simpler. And it can't be smoothed or smashed into conformal-ish shapes, there's always something that goes wrong (spoils the mesh) or doesn't help.
o
i readed 3 times your message i did not understand what you were answering or in general... sorry it is quite early for me
k
tkeskita's smoothMesh is pretty darn good (I know it's being used in the industry already). I also made Claude transcribe my blocking optimization algo from classy (which is not smoothing but point-by-point optimization based on surrounding cell quality) but snappy didn't mind a lot
o
"but snappy didn't mind a lot"
k
I did use Claude for classy but only for some generic stuff but even with that I feel like I don't know what's where - almost as if I don't own the code at all - but that's another story AI is a good candidate to test a few approaches, then we can polish the code manually... supposing AI does the job well enough for a test
Maybe an out-of-the-box approach: start with a tet mesh; extrude one wall layer, triangular; recombine it into quads and optimize; make a dual mesh inside; leave tets where it would create crap
o
yeah was asking as i am hesitant from my side to not pollute my code. but at the moment not implemententing anything... but what i was working right now actually what i did is throw my class at it and say find bugs. and it found some interesting ones i gorgot
tetra with prismatic layer?
why not use salome, it exists already it is there and it does it quite well.
k
poly core > tetra/pyramid buffer > quad prismatic
o
oh yeah what we discussed the other day
k
if salome does that, that means it's only using an existing package - why don't we use it already without salome?
o
the issue is the dealing with the buffer layer.
the prismatic layer it is not an external package i think. but what you are saying with netgen is doable
i want to go back to work on this kind of things but i have my hole can of worms to deal with right now... 🥲 already i passed from my code taking +500gb and 1 week to 40 gb and ~2 days hahaahaha
k
yeah... when going out-of-the-box with meshing the rabbit holes appear everywhere so I thought first to try fixing snappy's worst points
o
i told you already i would instead revive cfmesh 🤣
k
not-so-easy! who knows what lurks in the depths of polycore-and-whatnot
that's the next plan! let's make a survey where cfMesh needs improvements
o
what i am super curious about is the buffer polyhedral layers of fluet. this i NEVER came with something similar
easy pease, add the buffer layer of snappy to it.
the buffer layer looks like is the last ultimate development in octree meshes to improve quality (and it is logic, it is dealing with missaligment which is the shitty thing of octree meshers)
or foamyHexMesh ahahahaha
lol
that looked promising
k
damn, the original idea was just to flip some switches and maybe change the order of steps in snappy... all of a sudden I'm reading https://cdn.discordapp.com/attachments/1547237441067294780/1547494129703977010/image.png?ex=6aa39fb7&is=6aa24e37&hm=1568f106399990f984ef04bd6db43bcfd7a8f52557e72b914299f185a76f06da&
o
yeah, meshing papers i find them even more complex to understand than cfd ones... the simbols are all over the place
y
For real, I hesitated to tag you as I know you hate it, but I thought it would be nice to have your insights as I know you spent lot of time thinking and digging this topic! (based on the following discussion, I don't regret it 😆 )
o
i dont hate tagging, i hate when someone random tags you in some random shit help post. they 'hey answer me' when there are a lot of users speciially compared to me that are way better...
y
Alright, from now on I will tag you everywhere in the meshing section 😃
When you see things like snappy and variations such as the Helyx mesh or cfMesh, it feels like it should be possible to fix the main issues of snappy. I really want to believe in the buffer layer thing. Tobias comments few months ago gave me hopes for some news in v2612
k
you might be right
o
change the snappying to buffer layer+ marchingHex approach, I think you will simply solve all problems of snappy. i hear you before, you want full hexas it is a benefit for sure but what this algorithm generates is assured good quality elements on the boudnary.
in his examples (true they are simple) but the minimum SJ is 0.2, openfoam is a piece of cake dealing with hexas of SJ 0.2 so you might be able to get better meshes but with this approach you at least will get meshes that will not make OF explode anymore for sure....
(and you get the extra benefit that you are full hexa)
if you fix the refinement to constant level in surface and features (not saying doing it but as a first approach) it would be a copy paste logic (so claud will handly pretty easily IMO)
k
that's also something to try out... so now I wait for my license to return 🙂