# [Gmsh] Converting a 2D "H" domain into a structured grid

Nicholas Danes ndanes at mymail.mines.edu
Tue Jun 13 00:34:43 CEST 2017

I currently have a grid that works fine with the unstructured algorithms
in Gmsh to build a "H" shaped grid.

I know the transfinite algorithm does not work with a grid with more
than 4 corners, but is there a way to make this grid structured (with
triangular elements)?

I have tried extracting out grids as well as piecing 3 rectangular grids
together without much success.

The source code for my grid is given below.

Thanks,

Nick

// Inputs
xchar = 3.0;
l_injury = 100.0;
w_injury = 20.0;
boxdimx = (200+l_injury)/xchar;
boxdimy = (150+w_injury)/xchar;
gridsize = 1.8/xchar;
gridsize2 = 1.8/(1.0*xchar);

//Create "H" mesh basis points
Point(1) = {0,0,0,gridsize};
Point(2) = {0,boxdimy,0,gridsize};
Point(3) = {100.0/xchar,boxdimy,0,gridsize};
Point(4) = {100.0/xchar,(boxdimy/2.0) + w_injury/(2.0*xchar),0,gridsize2};
Point(5) = {(100.0+l_injury)/xchar,(boxdimy/2.0) +
w_injury/(2.0*xchar),0,gridsize2};
Point(6) = {(100.0+l_injury)/xchar,boxdimy,0,gridsize2};
Point(7) = {boxdimx,boxdimy,0,gridsize2};
Point(8) = {boxdimx,0.0,0,gridsize};
Point(9) = {boxdimx-100.0/xchar,0.0,0,gridsize2};
Point(10) = {boxdimx-100.0/xchar,(boxdimy/2.0) -
w_injury/(2.0*xchar),0,gridsize2};
Point(11) = {100/xchar,(boxdimy/2.0) - w_injury/(2.0*xchar),0,gridsize2};
Point(12) = {100/xchar,0.0,0,gridsize2};

Line(71) = {1,2};
Line(72) = {2,3};
Line(73) = {3,4};
Line(74) = {4,5};
Line(75) = {5,6};
Line(76) = {6,7};
Line(77) = {7,8};
Line(78) = {8,9};
Line(79) = {9,10};
Line(80) = {10,11};
Line(81) = {11,12};
Line(82) = {12,1};

// Connect lines into a loop
Line Loop(100) = {71,72,73,74,75,76,77,78,79,80,81,82};
Plane Surface(101) = 100;

// Boundaries
Physical Line(1) = {71,73,74,75,77,79,80,81}; // no-slip boundaries
Physical Line(2) = {72};
Physical Line(3) = {76};
Physical Line(4) = {82};
Physical Line(5) = {78};
Physical Surface(102) = {101};