12.1 Exporting a mesh from Gmsh

To demonstrate how MeshConvert works, we will define a simple channel-like 3D geometry. First, we must define the Gmsh geometry to be used. The Gmsh definition is given below, and is visualised in figure 12.1.

1Point(1) = {-1, 0, 0, 1.0}; 
2Point(2) = {-0.3, 0, 0, 1.0}; 
3Line(3) = {1, 2}; 
4s[] = Extrude {0, 0, 7} { 
5  Line{3}; Layers{5}; Recombine; 
6}; 
7v[] = Extrude {{0, 0, 1}, {0, 0, 0}, Pi} { 
8  Surface{s[1]}; Layers{10}; Recombine; 
9};

Whilst a full tutorial on Gmsh is far beyond the scope of this document, note the use of the Recombine argument. This allows us to generate a structured hexahedral mesh; remove the first Recombine to generate a prismatic mesh and both occurances to generate a tetrahedral mesh. Increasing the Layers numbers refines the mesh in the radial and azimuthal direction respectively.