# [Gmsh] Parallelepiped with hole in the middle

Christophe Geuzaine cgeuzaine at uliege.be
Mon Apr 6 22:41:41 CEST 2020

```
> On 6 Apr 2020, at 19:07, Robert Atanasiu <robert.atanasiu29 at gmail.com> wrote:
>
> Hello,
>
> I hope you are all doing well.
>
> I am trying to make an structured mesh having the representation of a parallelepiped with a hole in the middle of the structure. This "hole" has the sole purpose of signaling the presence of an obstacle. For some reason, I get errors regarding the transfinite algo of 2 particular surfaces, while the other 8 work.

The transfinite algorithm requires the same number of nodes on each pair of opposing curves (between the corner points).

Why don't you simply use extrusion?

Point(1) = {-0.5, -0.5, 0};
Point(10) = {-0.5, 0.5, 0};
Point(11) = {-0.5, -0.5, 4.0};
Point(12) = {-0.5, 0, 4.0};
Point(13) = {-0.5, 0, 6.0};
Point(14) = {-0.5, -0.5, 6.0};
Point(15) = {-0.5, -0.5, 10.0};
Point(16) = {-0.5, 0.5, 10.0};

Line(10) = {10, 16};
Line(13) = {10, 1};
Line(14) = {1, 11};
Line(15) = {11, 12};
Line(16) = {12, 13};
Line(17) = {13, 14};
Line(18) = {14, 15};
Line(19) = {15, 16};

Line Loop(27) = {-10, 13, 14, 15, 16, 17, 18, 19};
Plane Surface(28) = {27};
Transfinite Line{10} = 100;
Transfinite Line{14,18} = 25;
Transfinite Line{15,17} = 8;
Transfinite Line{16} = 100-2*25-2*8+4;
Transfinite Line{13, 19} = 15;
Transfinite Surface{28} = {1,15,16,10};
Recombine Surface{28};
Mesh.Smoothing = 1;

Extrude{1,0,0}{ Surface{28}; Recombine; Layers{10}; }

(The mesh would also be nicer if you split surface 28 into multiple parts...)

> Also, how can I ensure the normals are all pointing in the right convention?
>

The orientation of the mesh follows the orientation of the geometrical surface.

Christophe

> Here is my algorithm:
> //
> l_ref = 1;
>
> Point(1) = {-0.5, -0.5, 0, l_ref};  Point(2) = {0.5, -0.5, 0, l_ref};
> Point(3) = {0.5, -0.5, 4.0, l_ref}; Point(4) = {0.5, 0, 4.0, l_ref};
> Point(5) = {0.5, 0, 6.0, l_ref}; Point(6) = {0.5, -0.5, 6.0, l_ref};
> Point(7) = {0.5, -0.5, 10.0, l_ref}; Point(8) = {0.5, 0.5, 10.0, l_ref};
> Point(9) = {0.5, 0.5, 0, l_ref}; Point(10) = {-0.5, 0.5, 0, l_ref};
> Point(11) = {-0.5, -0.5, 4.0, l_ref}; Point(12) = {-0.5, 0, 4.0, l_ref};
> Point(13) = {-0.5, 0, 6.0, l_ref}; Point(14) = {-0.5, -0.5, 6.0, l_ref};
> Point(15) = {-0.5, -0.5, 10.0, l_ref}; Point(16) = {-0.5, 0.5, 10.0, l_ref};
>
> Line(1) = {1, 2};
> Line(2) = {2, 3};
> Line(3) = {3, 4};
> Line(4) = {4, 5};
> Line(5) = {5, 6};
> Line(6) = {6, 7};
> Line(7) = {7, 8};
> Line(8) = {8, 9};
> Line(9) = {9, 10};
> Line(10) = {10, 16};
> Line(11) = {16, 8};
> Line(12) = {2, 9};
> Line(13) = {10, 1};
> Line(14) = {1, 11};
> Line(15) = {11, 12};
> Line(16) = {12, 13};
> Line(17) = {13, 14};
> Line(18) = {14, 15};
> Line(19) = {15, 16};
> Line(20) = {7, 15};
> Line(21) = {3, 11};
> Line(22) = {14, 6};
> Line(23) = {4, 12};
> Line(24) = {5, 13};
>
> Line Loop(21) = {1, 12, 9, 13}; Plane Surface(22) = {21};
> Line Loop(23) = {2, 3, 4, 5, 6, 7, 8, -12}; Plane Surface(24) = {23};
> Line Loop(25) = {7, -11, -19, -20}; Plane Surface(26) = {25};
> Line Loop(27) = {-10, 13, 14, 15, 16, 17, 18, 19}; Plane Surface(28) = {27};
> Line Loop(29) = {8, 9, 10, 11}; Plane Surface(30) = {29};
> Line Loop(31) = {1, 2, 21, -14}; Plane Surface(32) = {31};
> Line Loop(33) = {3, 23, -15, -21}; Plane Surface(34) = {33};
> Line Loop(35) = {4, 24, -16, -23}; Plane Surface(36) = {35};
> Line Loop(37) = {-5, 24, 17, 22}; Plane Surface(38) = {37};
> Line Loop(39) = {6, 20, -18, 22}; Plane Surface(40) = {39};
>
> Surface Loop(40) = {22, 24, 26, 28, 30, 32, 34, 36, 38, 40};
> Volume(41) = {40};
>
> Transfinite Line {1, 9, 20, 11} = 10;
> Transfinite Line {12, 13, 7, 19} = 20;
> Transfinite Line {2, 14} = 20;
> Transfinite Line {4, 16} = 60;
> Transfinite Line {6, 18} = 40;
> Transfinite Line {8, 10} = 120;
>
> Transfinite Surface{22} = {1, 2, 9, 10};
> Transfinite Surface{24} = {2, 7, 8, 9};
> Transfinite Surface{26} = {7, 8, 16, 15};
> Transfinite Surface{28} = {16, 15, 10, 1};
> Transfinite Surface{30} = {8, 9, 10, 16};
> Transfinite Surface{32} = {1, 2, 3, 11};
> Transfinite Surface{34} = {3, 4, 12, 11};
> Transfinite Surface{36} = {4, 5, 13, 12};
> Transfinite Surface{38} = {5, 6, 13, 14};
> Transfinite Surface{40} = {6, 7, 15, 14};
>
> Recombine Surface {22, 24, 26, 28, 30, 32, 34, 36, 38, 40};
> Transfinite Volume {41} = {2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 12, 13, 14, 15, 16};
>
> // Physical Surface(200) = {22, 24, 26, 28, 30, 32, 34, 36, 38, 40};
> Physical Surface('inlet') = {22};
> Physical Surface('periodic_0_r') = {24};
> Physical Surface('outlet') = {26};
> Physical Surface('periodic_0_l') = {28};
> Physical Surface('top') = {30};
> Physical Surface('bottom1') = {32};
> Physical Surface('bottominclined1') = {34};
> Physical Surface('bottom2') = {36};
> Physical Surface('bottominclined2') = {38};
> Physical Surface('bottom3') = {40};
>
> Physical Volume('fluid') = {41};
>
> //
>
> I would be very grateful if you can answer my question!
>
> Kind regards,
> Robert Atanasiu
> Imperial College London, Aeronautics Undergraduate Student
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

—
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science
http://www.montefiore.ulg.ac.be/~geuzaine

```