Issue 160 – August 19, 2023

I like fine mesh & I cannot lie

Hey there 👋

It’s Robin from CFD Engine & this is one of those “I’ve just discovered an old feature & thought you might dig it” emails & it’s especially for all you snappyHexHeads.

If you’ve ever wanted to have a few different distance refinements on a single input geometry then this feature has you covered.

No more carving up your OBJs just because you want to get super-specific with your refinement regions.

It’s been in SHM for nearly 8 years, but it’s new to me & maybe it’s new to you too?

Let’s get into it…

Refine that mesh

Distance refinement in snappyHexMesh is one of my favourite features. Defining volume refinement relative to your input geometry just makes sense, as does the ability to grade the mesh as it gets closer to the surface.

Something like this 👇

An example refinementRegions snippet from a snappyHexMeshDict

…where cells within 0.2m of the “car” will be refined to level 7, those within 0.4m will be refined to level 6 & so on 👍

But (AFAIK) snappy only lets you specify one distance refinement per-input-file.

So, if you wanted to have a different set of refinements for a subset of your geometry, you’d need to grab those surfaces & put them into a new input file.

For example, imagine a racecar with distance refinement applied to the whole car. If we wanted to have more refinement around the rear wing, we’d need to extract the rear wing surfaces into their own OBJ to make that happen.

Except…we don’t 🤦‍♂️ our new feature has us covered for exactly this situation.

We can grab a subset of surfaces from an input geometry & use them as a refinement target without modifying our input geometry at all.

Say hello to subTriSurfaceMesh 👋

Note: I don’t think this feature exists in the Foundation snappyHexMesh, but maybe it just has a different name.

How to use it

It’s pretty easy to use – just add a subTriSurfaceMesh entry to the geometry section of your snappyHexMeshDict and then reference it in the refinementRegions section – that’s it.

Going back to our racecar example…

In this snippet I’m creating a subset of my original geometry (I’ve called it refine_RW) which contains all of the patches with rw in their name.

An example geometry snippet from a snappyHexMeshDict, containing a subTriSurfaceMesh definition

Then I can add refine_RW to my refinementRegions & specify some mighty-fine refinement.

Using a subTriSurfaceMesh as a refinementRegion in snappyHexMeshDict

Just to note, our new subset merely duplicates bits of the original geometry. The original surfaces remain unchanged & we can continue to use them in refinementSurfaces as normal.

That’s all folks

There you have it – multiple distance refinements on a single input geometry without having to change your OBJs or STLs, all thanks to subTriSurfaceMesh 🙌

Always nice to find a new feature, even if it is nearly 8yrs old 🤦‍♂️

I wonder how many more quality-of-life features I’m missing out on.

Drop me a note with any that you’ve discovered & I’ll share them with the rest of the class.

Until next week, stay safe,

Signed Robin K