Tutorial 3 - Workpiece 3
Goal
The goal of this tutorial is to partition workpiece3 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 surface on a surface (S) twice, projecting each of the following surfaces down to the base of the model:
This creates the first blocks:
Split the first wedge and propagate the partitioning
Partition the wedge using Split a wedge volume (I):
Resulting in:
Propagate the partitioning created by the wedge split:
- First use Project a point on a curve (
P) and then Split a volume by a point loop (L):
Repeat the same two commands to continue the partitioning:
Play with views and geometry display
Use the view options in the left panel to show or hide the green and orange volumes:
For a clearer view, use the Gmsh shortcuts to show or hide surfaces (Alt+S), curves (Alt+L), and points (Alt+P).
Partitioning around the pocket
Create the following partition around the pocket:
The result is:
Use Project a surface on a surface to extend the pocket partition to the back of the model:
Why project a surface?
Use Project a surface on a surface instead of Add a volume between two surfaces, because some connecting surfaces already exist. The projection command removes duplicate geometry with occ.removeAllDuplicates(). The volume command does not; remove duplicates manually afterward with Remove a surface when necessary.
Propagate the partition at the back of the pocket:
The result is:
Partitioning around the fillet
Create a wedge to partition the fillet:
The result is:
Split the wedge with Split a wedge volume (I):
Propagate the new partition downward:
Link the fillet and pocket partitions with Split a volume by a point loop (L):
Project the two points shown below:
Then use Split all volumes by a surface (4 points) (K) with these four points:
The result is:
Partitioning around the hole
Create the following partition around the hole:
Use Project a point on a curve (P) and Split a volume by a point loop (L) to create this partition:
Split the two indicated volumes:
The result is:
Final transverse splits
Finish the partition by splitting the complete model in the transverse direction:
Complete this in three steps.
First, use Split all volumes by a plane (3 points) (M) with three points such as these:
The result is:
Next, split the volume with a finite surface defined by four points:
The result is:
Remove the surface created inside the hole with Remove surfaces (R), double-click to finish the selection:
Remove the associated curve with Remove Curves (T), double-click to finish the selection.
Project the points around the fillet:
Then split the volumes with a point loop:
Finally, project two points:
Split the volumes with a finite surface defined by four points:
The model is now fully meshable; all volumes appear green:
Mesh generation
Click Mesh CAD at the bottom of the left panel to generate a structured hexahedral mesh:
By default, HexaMSH assigns five nodes to each edge.
To assign n nodes to narrow edges, use Set number of nodes on all edges. Enter the number, select the edges, then double-click to finish the selection.
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.