Hey there,
It’s Robin from CFD Engine & it’s time for me to take the new curvature-based mesh refinement for a spin in OpenFOAM v2212
.
If your models have a mix of sharp edges, fillets & soft curvy bits, then this should be able to capture them more efficiently than what you’re currently doing.
There are some bits I like, some bits I don’t like, but overall I reckon this is a solid (albeit seemingly unfinished) addition to snappyHexMesh
π
But, before we get to the curvy bits…
I got it wrong
I got it all wrong when I mentioned this in my v2212
highlights π€¦ββοΈ
Thanks to Marco for pointing me in the right direction β ignore anything I said about it previously β here’s the real deal…
What is it?
The name says it all, this is a new way to capture curvature in snappyHexMesh
.
In addition to specifying levels
for your geometry in the refinementSurfaces
section of your snappyHexMeshDict
you can now specify what (if any) curvature refinement you’d like to see.
refinementSurfaces
{
myCurvyGeometry
{
level (5 6);
curvatureLevel (5 0 7 -1);
}
}
The new curvatureLevel
line is essentially saying “SHM, please try to add 5 cells across curved surfaces & you’re allowed drop the edge-length to level 7 to do it”.
The other two values 0
& -1
didn’t seem to do anything in my tests, I’m not sure that they’re fully implemented (yet).
Behind the scenes, SHM calculates a curvature field from your geometry, converts it to a refinement level based on your chosen settings & uses that value to control the mesh refinement.
You don’t have to change anything else, just add curvatureLevel
settings to each geometry that you’d like refined & let SHM get on with it.
I’m guessing, but…
I think the intention is that we use the level
settings to refine the mesh near sharp features & curvatureLevels
to refine the softer ones.
The existing SHM parameter refineFeatureAngle
is the key to this β it not only controls what gets refined, but also how.
Features that are sharper than the refineFeatureAngle
are refined up to your maximum level
, whilst softer/curvier features are refined according to your curvatureLevels
.
Goldilocks
As with many things in snappyHexMesh
, you’re going to need to try a few different values to determine what’s right for your geometry.
For example, in my tests I found that the first setting (“number of cells per radius of curvature”) could be both too big and too small.
When it was too small it didn’t resolve as much of the curvature as I wanted & when it was too big it seemed to give up & not add any refinement at all π€·ββοΈ
It’s probably worth a little trial & error to find your sweet spot though.
Here’s one I made earlier β an AeroSUV wheel meshed using curvature-based refinement only (note: level
is set to (0 0)
)
Like π
I like that this is a per-geometry setting, it means we should be able to use it tactically, sprinkling it here & there to bring out those otherwise hard to capture details.
I also like that it’s easy to activate & that it doesn’t seem to add any time or overhead to the meshing process.
Dislike π
I’m not liking the blotchy surfaces that I got whilst using this feature…
Firstly, I ended up with little islands of mesh that had been refined for no obvious reason. I’m guessing they were somehow related to the underlying STL/OBJ triangulation, but it was a bit weird.
Secondly, I ran into some snap issues in the transition between levels, particularly when using larger feature angles (>30ΒΊ). I’m hoping that this is fixable with a tweak to some other settings, but I’ll report back π€
In summary
I reckon I’ll use this, not all the time & not on every geometry, but it’s a nice addition. The ability to target specific regions, of specific geometries, without having to change your input files is really useful.
It’s not worth the upgrade to OpenFOAM v2212
on it’s own, but it’s definitely worth a look.
Check out the announcement of this feature in the release notes & take a look at the demo tutorial here.
Now that we’ve got curvature-refinement sorted π what other burning issues do you have with snappyHexMesh
? I’m sure there must be some, drop me a note, it might make a good topic for a future email.
Until next week, stay safe,