Issue 172 – November 11, 2023

Skipping blockMesh

Hey there 👋

It’s Robin from CFD Engine and this week I’ve got a solution to a problem you probably don’t have 🤦‍♂️

It’s a way to generate background meshes for snappyHexMesh without touching blockMesh.

It’s particularly handy when your meshes aren’t Cartesian-aligned, or if you need to create a bunch of meshes in different (weird) orientations.

All you need is a quad-meshed plane & a couple of measurements – extrudeMesh will do the rest.

No more copy-pasting vertices from CAD, or stringing together a bunch of transforms to get your background mesh in the right spot 👍

If you’re a blockMesh master (or your blockMeshDict never changes) then you can file this one away for another day.

For the rest of us…onward, to easy background meshes.

What’s the problem?

Is it really that hard to figure out your blockMesh.vertices?

If you need a Cartesian-aligned bounding box, then probably not.

If you need a specific alignment or orientation, then maybe.

If you need to change the alignment often, then definitely.

When you’re dealing with other people’s CAD you don’t always get to choose its position & orientation.

Sometimes the object of your study has a weird orientation (like when it’s placed in an assembly) & putting it in a Cartesian-aligned bounding box is going to introduce some avoidable non-orthogonality 🤔

Or, perhaps the walls of your blockMesh are an important part of your model.

In my case, the base of my blockMesh defines the ground plane of my automotive cases. Its size, position & orientation (relative to the car) are critical.

For example, if I want to alter the pitch, roll or heave, I’ll move the ground (& the wheels) but leave the body in it’s original position (it makes comparing the flow between attitudes MUCH easier).

In any event, I’m particular about my blockMesh.vertices & I need to generate new ones quite frequently.

I used to mock-up my domain in CAD & then copy-paste the corner points into blockMeshDict, but that gets old quickly.

Now I just skip blockMesh altogether 🙌

What’s the alternative?

Instead, I export my ground plane from CAD (as a quad-meshed .obj) & use extrudeMesh to grow my background mesh.

Here’s an example of an extrudeMeshDict that does just that…

An example extrudeMeshDict to extrude a plane into a background mesh

My background mesh is now based on an exported plane & a couple of measurements.

If I update the .obj (& re-run extrudeMesh) I’ll have an updated background mesh without having to edit any dictionaries.

Note: extrudeMesh will extrude whatever faces are in the .obj file. Make sure they’re all quads (& the right size). Any triangular faces will be extruded into prisms & snappyHEXmesh will not be pleased 😠

You can also use ParaView to generate quad-meshed planes for this. Add a Plane source, export it as an .obj (using File > Save Data) & you’re good to go.

You’ll probably need to re-patch the sides of your new domain if you’re using this for external flows. Let me know if you need any tips, it’s dead easy.

No problem

There you have it, a way to skip blockMesh by creating your background meshes with extrudeMesh instead.

Like I said, it solves a problem you probably don’t have 🤣

Drop me a note if it turns out to be useful though & shout if you need any pointers on using it – my inbox is always open.

Until next week, stay safe,

Signed Robin K