Skip to content

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:

hexamsh workpiece3.brep

Gmsh opens with the CAD model:

tuto_3_intro

The aim is to partition the CAD model into meshable sub-volumes:

tuto_3_intro_end

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:

tuto_3_project_surface

This creates the first blocks:

tuto_3_project_surface_done

Split the first wedge and propagate the partitioning

Partition the wedge using Split a wedge volume (I):

tuto_3_split_wedge

Resulting in:

tuto_3_split_wedge_done

Propagate the partitioning created by the wedge split:

tuto_3_propagate_wedge

Repeat the same two commands to continue the partitioning:

tuto_3_propagate_wedge_1

Play with views and geometry display

Use the view options in the left panel to show or hide the green and orange volumes:

view_pannel

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:

tuto_3_pocket_split_proposition

The result is:

tuto_3_pocket_split_proposition_done

Use Project a surface on a surface to extend the pocket partition to the back of the model:

tuto_3_pocket_till_background

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:

tuto_3_pocket_background_split_proposition

The result is:

tuto_3_pocket_background_split_proposition_done

Partitioning around the fillet

Create a wedge to partition the fillet:

tuto_3_wedge_fillet_proposition

The result is:

tuto_3_wedge_fillet_proposition_done

Split the wedge with Split a wedge volume (I):

tuto_3_partition_wedge

Propagate the new partition downward:

tuto_3_partition_wedge_1

Link the fillet and pocket partitions with Split a volume by a point loop (L):

tuto_3_link_pocket_fillet

Project the two points shown below:

tuto_3_pocket_propagation

Then use Split all volumes by a surface (4 points) (K) with these four points:

tuto_3_4_points_split_proposition

The result is:

tuto_3_4_points_split_proposition_done

Partitioning around the hole

Create the following partition around the hole:

tuto_3_hole_split_proposition

Use Project a point on a curve (P) and Split a volume by a point loop (L) to create this partition:

tuto_3_hole_split_done

Split the two indicated volumes:

tuto_3_hole_split_2

The result is:

tuto_3_hole_split_2_done

Final transverse splits

Finish the partition by splitting the complete model in the transverse direction:

tuto_3_transverse_partitioning

Complete this in three steps.

First, use Split all volumes by a plane (3 points) (M) with three points such as these:

tuto_3_split_3points

The result is:

tuto_3_split_3points_done

Next, split the volume with a finite surface defined by four points:

tuto_3_split_4points

The result is:

tuto_3_split_4points_done

Remove the surface created inside the hole with Remove surfaces (R), double-click to finish the selection:

tuto_3_remove_surface

Remove the associated curve with Remove Curves (T), double-click to finish the selection.

Project the points around the fillet:

tuto_3_projection_points

Then split the volumes with a point loop:

tuto_3_split_point_loop

Finally, project two points:

tuto_3_projection_points_2

Split the volumes with a finite surface defined by four points:

tuto_3_split_finite_surface_4points

The model is now fully meshable; all volumes appear green:

tuto_3_meshable

Mesh generation

Click Mesh CAD at the bottom of the left panel to generate a structured hexahedral mesh:

tuto_3_mesh_cad

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:

tuto_3_new_mesh

Once the node counts are correct, close the Gmsh window. HexaMSH writes the result to a .msh file.