Tutorial 1 - Workpiece 1
Goal
The goal of this tutorial is to partition workpiece1 into meshable blocks and generate a structured hexahedral mesh.
You will use HexaMSH to partition the CAD model and generate the mesh.
Before you begin
Download the CAD file here.
Open it from a prompt in a Python environment that contains HexaMSH:
Gmsh opens with the CAD model:
The aim is to partition the CAD model into meshable sub-volumes:
CAD partitioning
There are several ways to obtain this partitioning. This tutorial presents one possible workflow.
Create the first blocks
Use Project a point on a curve (P). Select the point to project, then select the curves to split. Double-click to finish the selection. Right-click to remove an entity from the selections.
The point is projected onto the two curves shown below:
The operation creates two new points and splits the curves:
Entities selection and unselection
Right-click a selected entity to remove it from the selection. Double-click with the left mouse button to finish selecting.
Next, use Split a volume by a point loop (L).
Select the points that define a loop. The direction does not matter, but the points must form a closed loop. Double-click to finish the selection. Right-click to remove an entity from the selections.
This creates the first meshable block, shown in green:
The goal is for every block to be meshable, so all blocks should appear green.
Repeat the same feature to create a second block:
This creates a second meshable block:
Project points onto the vertical edges shown below:
The result is:
Then split the CAD with a point loop:
Split the upper section
Split the upper section into two parts with Split all volumes by a plane (3 points) (M). Select three points:
The CAD is split by an infinite plane:
Infinite-plane split
This operation works because the fourth point around the cylindrical hole is aligned with the other three points. Otherwise, the split would create a new point.
Project an upper point onto the lower edge to create the partition around the fillet:
This creates three points that define a new infinite plane:
Define the infinite plane that splits the CAD:
The new partition creates additional blocks:
Play with views and geometry display
At any time, we can hide/show the green and orange volumes using the view options in the left pannel:
We can also use the Gmsh options to hide/show surfaces (alt + S), curves (alt + L) and points (alt + P) for a better visibility.
Split around the cylinder
Finally, split the CAD around the cylinder:
Project the corresponding points onto the cylinder edges. There are eight points to project. Then split the volumes with four point loops, each containing four points.
First block:
Second block:
Third block:
Fourth block:
The model is now fully meshable: all volumes appear green.
Mesh generation
Click Mesh CAD at the bottom of the left panel:
HexaMSH generates a transfinite mesh on the partitioned geometry:
By default, five nodes are assigned to every edge. To use six nodes on selected edges, use Set number of nodes on edges:
To assign three nodes to a group of narrow edges, use Set number of nodes on all edges. Set the number to 3, select the edges, and double-click to finish the selection. Right-click to remove an entity from the selections.
You only need to select one edge. HexaMSH automatically applies the same number of nodes to the opposite edges, which appear green. The mesh updates immediately:
Once the node counts are correct, close the Gmsh window. HexaMSH writes the result to a .msh file.