# [Gmsh] Layers in a curved surface

 Register Blogs Members List Search Today's Posts Mark Forums Read

 November 24, 2011, 17:46 Layers in a curved surface #1 New Member   Patrick Pazour Join Date: Nov 2011 Posts: 9 Rep Power: 13 Dear Forum Users, After solving the problem with converting, there is just another task. First of all, i created the following body (simple pipe and a reducer): Code: ```r = 10; h1 = 70; cl1 = 2; Point(1) = {0, 0, 0, cl1}; Point(2) = {r, 0, 0, cl1}; Point(3) = {-r, 0, 0, cl1}; Point(4) = {0, r, 0, cl1}; Point(5) = {0, -r, 0, cl1}; Circle(1) = {5, 1, 3}; Circle(2) = {3, 1, 4}; Circle(3) = {4, 1, 2}; Circle(4) = {2, 1, 5}; Extrude {0, 0, h1} { Line{2, 1, 4, 3}; Layers{20}; } Point(39) = {2, 15, 100, cl1}; Point(40) = {2, -15, 100, cl1}; Point(41) = {-2, 15, 100, cl1}; Point(42) = {-2, -15, 100, cl1}; Line(21) = {39, 41}; Line(22) = {41, 42}; Line(23) = {42, 40}; Line(24) = {40, 39}; Rotate {{0, 0, 1}, {0, 0, 0}, Pi/4} { Line{24, 21, 22, 23}; } Line(25) = {8, 39}; Line(26) = {6, 41}; Line(27) = {10, 40}; Line(28) = {9, 42}; Line Loop(29) = {2, 3, 4, 1}; Plane Surface(30) = {29}; Line Loop(31) = {22, 23, 24, 21}; Plane Surface(32) = {31}; Line Loop(33) = {27, 24, -25, 17}; Ruled Surface(34) = {33}; Line Loop(35) = {28, -22, -26, -9}; Ruled Surface(36) = {35}; Line Loop(37) = {13, 28, 23, -27}; Ruled Surface(38) = {37}; Line Loop(39) = {25, 21, -26, 5}; Ruled Surface(40) = {39}; Surface Loop(41) = {20, 30, 8, 40, 34, 38, 16, 12, 36, 32}; Volume(42) = {41};``` There is just one question, do you have any ideas how to get similar layers (like from the extrusion) into the reducer? thanks Last edited by Artex85; December 18, 2011 at 09:41.

December 18, 2011, 09:51
Solution for a complex body
#2
New Member

Patrick Pazour
Join Date: Nov 2011
Posts: 9
Rep Power: 13
Dear Forum Users,

After completing the simple body, i created a more complex one.

Code:
```// MESH
cl    =    2; // Globale Feinheit, wenn kein strukturiertes Mesh angegeben,
sl1    =    10; // Meshnodes 1
sl2    =    9; // Meshnodes 2
ar    =    0.8; // Verhältnis für den progressiven Verlauf
la    =    40; // Unterteilungen in Längsrichtung

// PARAMETRISCHE ABMESSUNGEN
D    =    30; // Rohrdurchmesser
Lr    =    150; // Rohrlänge
Ld    =    25; // Diffusorlänge
B    =    35; // Diffusorbreite
H    =     5; // Diffusorhöhe

R    =    0.5 * D; // Radius Rohr
x    =    R * Cos(45 * Pi / 180.);
y    =    R * Sin(45 * Pi / 180.);

xe1    =    R * Cos((90-sl1/2) * Pi / 180.);
ye1    =    R * Sin((90-sl1/2) * Pi / 180.);
xe2    =    R * Cos((90+sl1/2) * Pi / 180.);
ye2    =    R * Sin((90+sl1/2) * Pi / 180.);

F    =    0.8; // Verkleinerungsfaktor
Fh    =    0.5; // Verkleinerungsfaktor Höhe

// GEOMETRIE
// Punkte für Rohr: Außenkontur
Point(1)    =    {0, 0, 0, cl};
Point(2)    =    {x, y, 0, cl};
Point(3)     =    {-x, y, 0, cl};
Point(4)     =    {-x, -y, 0, cl};
Point(5)    =    {x, -y, 0, cl};

// Punkte für Rohr: Innenkontur
Point(6)    =    {x*F, y*F, 0, cl};
Point(7)    =    {-x*F, y*F, 0, cl};
Point(8)    =    {-x*F, -y*F, 0, cl};
Point(9)    =    {x*F, -y*F, 0, cl};

// Punkte für Rohr: Innenkontur 2
Point(18)    =    {x*F^2, y*F^2, 0, cl};
Point(19)    =    {-x*F^2, y*F^2, 0, cl};
Point(20)    =    {-x*F^2, -y*F^2, 0, cl};
Point(21)    =    {x*F^2, -y*F^2, 0, cl};

// Punkte für Diffusor: Außenkontur
Point(10)    =    {B/2, H/2, Ld, cl};
Point(11)    =     {-B/2, H/2, Ld, cl};
Point(12)    =    {-B/2, -H/2, Ld, cl};
Point(13)    =    {B/2, -H/2, Ld, cl};

// Punkte für Diffusor: Innenkontur
Point(14)    =    {F*B/2, Fh*H/2, Ld, cl};
Point(15)    =    {-F*B/2, Fh*H/2, Ld, cl};
Point(16)    =    {-F*B/2, -Fh*H/2, Ld, cl};
Point(17)    =    {F*B/2, -Fh*H/2, Ld, cl};

// Punkte für Diffusor: Innenkontur 2
Point(22)    =    {F^2*B/2, Fh^2*H/2, Ld, cl};
Point(23)    =    {-F^2*B/2, Fh^2*H/2, Ld, cl};
Point(24)    =    {-F^2*B/2, -Fh^2*H/2, Ld, cl};
Point(25)    =    {F^2*B/2, -Fh^2*H/2, Ld, cl};

// Punkte für Inlet
Point(26)    =    {xe1, ye1, -Lr, cl};
Point(27)    =    {xe2, ye2, -Lr, cl};
Point(28)    =    {xe1*F, ye1*F, -Lr, cl};
Point(29)    =    {xe2*F, ye2*F, -Lr, cl};

// Punkte für Restfläche Inlet
Point(30)    =    {-xe1, -ye1, -Lr, cl};
Point(31)    =    {-xe2, -ye2, -Lr, cl};
Point(32)    =    {-xe1*F, -ye1*F, -Lr, cl};
Point(33)    =    {-xe2*F, -ye2*F, -Lr, cl};

// Volumen 1
Line(1)     =     {4, 12};
Line(2)     =     {12, 11};
Line(3)     =     {11, 3};
Line(4)     =     {4, 8};
Line(5)     =     {3, 7};
Line(6)     =     {16, 12};
Line(7)     =     {15, 11};
Line(8)     =     {15, 16};
Circle(9)     =     {8, 1, 7};
Circle(10)     =     {4, 1, 3};
Line(11)     =     {8, 16};
Line(12)     =     {7, 15};

Transfinite Line{1,2,3,8,9,10,11,12}     =     sl1;
Transfinite Line{4,5}             =     sl2;
Transfinite Line{6,7}             =     sl2;

Line Loop(13)     =     {6, 2, -7, 8};
Line Loop(15)     =     {10, 5, -9, -4};
Line Loop(17)     =     {11, 6, -1, 4};
Line Loop(19)     =     {11, -8, -12, -9};
Line Loop(21)     =     {10, -3, -2, -1};
Line Loop(23)     =     {7, 3, 5, 12};

Ruled Surface(14) = {13}; Transfinite Surface{14} = {16,15,11,12};
Ruled Surface(16) = {15}; Transfinite Surface{16} = {8,4,3,7};
Ruled Surface(18) = {17}; Transfinite Surface{18} = {16,12,4,8};
Ruled Surface(20) = {19}; Transfinite Surface{20} = {7,8,16,15};
Ruled Surface(22) = {21}; Transfinite Surface{22} = {12,11,3,4};
Ruled Surface(24) = {23}; Transfinite Surface{24} = {15,11,3,7};

Recombine Surface{14,16,18,20,22,24};

Surface Loop(25) = {22, 16, 24, 14, 18, 20};

Volume(26) = {25}; Transfinite Volume{26}={16,12,11,15,8,4,3,7};

// Volumen 2
Circle(27)     =     {8, 1, 9};
Circle(28)     =     {4, 1, 5};
Line(29)     =     {9, 5};
Line(30)     =     {9, 17};
Line(31)     =     {5, 13};
Line(32)     =     {13, 17};
Line(33)     =     {17, 16};
Line(34)     =     {12, 13};

Transfinite Line{27,28,30,31,33,34} = sl1;
Transfinite Line{-29} = sl2;
Transfinite Line{32} = sl2;

Line Loop(35)     =     {28, -29, -27, -4};
Line Loop(37)     =     {28, 31, -34, -1};
Line Loop(39)     =     {27, 30, 33, -11};
Line Loop(41)     =     {30, -32, -31, -29};
Line Loop(43)     =     {33, 6, 34, 32};

Ruled Surface(36) = {35}; Transfinite Surface{36} = {9,5,4,8};
Ruled Surface(38) = {37}; Transfinite Surface{38} = {5,4,12,13};
Ruled Surface(40) = {39}; Transfinite Surface{40} = {9,17,16,8};
Ruled Surface(42) = {41}; Transfinite Surface{42} = {17,13,5,9};
Ruled Surface(44) = {43}; Transfinite Surface{44} = {17,13,12,16};

Recombine Surface {36,38,40,42,44};

Surface Loop(45) = {38, 36, 42, 40, 44, 18};
Volume(46)     =     {45}; Transfinite Volume{46}={17,13,12,16,9,5,4,8};

// Volumen 3
Circle(47)     =     {9, 1, 6};
Circle(48)     =     {5, 1, 2};
Line(49)     =     {2, 6};
Line(50)     =     {2, 10};
Line(51)     =     {6, 14};
Line(52)     =     {14, 17};
Line(53)     =     {10, 13};
Line(54)     =     {10, 14};

Transfinite Line{47,48,50,51,53,52} = sl1;
Transfinite Line{49} = sl2;
Transfinite Line{54} = sl2;

Line Loop(55) = {48, 49, -47, 29};
Line Loop(57) = {51, -54, -50, 49};
Line Loop(59) = {51, 52, -30, 47};
Line Loop(61) = {50, 53, -31, 48};
Line Loop(63) = {53, 32, -52, -54};

Ruled Surface(56) = {55}; Transfinite Surface{56} = {6,2,5,9};
Ruled Surface(58) = {57}; Transfinite Surface{58} = {6,2,10,14};
Ruled Surface(60) = {59}; Transfinite Surface{60} = {6,14,17,9};
Ruled Surface(62) = {61}; Transfinite Surface{62} = {2,5,13,10};
Ruled Surface(64) = {63}; Transfinite Surface{64} = {14,10,13,17};

Recombine Surface {56,58,60,62,64};

Surface Loop(65) = {58, 60, 64, 62, 56, 42};
Volume(66) = {65}; Transfinite Volume{66}={17,14,10,13,9,6,2,5};

// Volumen 4
Circle(67) = {6, 1, 7};
Circle(68) = {2, 1, 3};
Line(69) = {15, 14};
Line(70) = {11, 10};

Transfinite Line{67,68,69,70} = sl1;

Line Loop(71) = {68, 5, -67, -49};
Line Loop(73) = {68, -3, 70, -50};
Line Loop(75) = {67, 12, 69, -51};
Line Loop(77) = {70, 54, -69, 7};

Ruled Surface(72) = {71}; Transfinite Surface{72} = {7,3,2,6};
Ruled Surface(74) = {73}; Transfinite Surface{74} = {3,2,10,11};
Ruled Surface(76) = {75}; Transfinite Surface{76} = {7,6,14,15};
Ruled Surface(78) = {77}; Transfinite Surface{78} = {15,11,10,14};

Recombine Surface {72,74,76,78};

Surface Loop(79) = {74, 72, 76, 78, 24, 58};
Volume(80) = {79}; Transfinite Volume{80}={15,11,10,14,7,3,2,6};

// Volumen 5-8
Extrude {0, 0, -Lr} {
Surface{36, 16, 72, 56}; Layers{la}; Recombine;
}

// Volumen 9
Line(169) = {21, 20};
Line(170) = {21, 9};
Line(171) = {20, 8};
Line(172) = {21, 25};
Line(173) = {25, 24};
Line(174) = {24, 20};
Line(175) = {25, 17};
Line(176) = {24, 16};

Transfinite Line{169,172,173,174} = sl1;
Transfinite Line{170,171} = sl2;
Transfinite Line{175,176} = sl2;

Line Loop(177) = {27, -170, 169, 171};
Line Loop(179) = {30, -175, -172, 170};
Line Loop(181) = {174, 171, 11, -176};
Line Loop(183) = {173, 176, -33, -175};
Line Loop(186) = {169, -174, -173, -172};

Ruled Surface(178) = {177}; Transfinite Surface{178} = {21,9,8,20};
Ruled Surface(180) = {179}; Transfinite Surface{180} = {21,25,17,9};
Ruled Surface(182) = {181}; Transfinite Surface{182} = {8,16,24,20};
Ruled Surface(184) = {183}; Transfinite Surface{184} = {25,17,16,24};
Ruled Surface(187) = {186}; Transfinite Surface{187} = {20,24,25,21};

Recombine Surface {178,180,182,184,187};

Surface Loop(188) = {178, 180, 184, 187, 182, 40};
Volume(189) = {188}; Transfinite Volume{189}={16,24,25,17,8,20,21,9};

// Volumen 10
Line(190) = {20, 19};
Line(191) = {19, 7};
Line(192) = {23, 24};
Line(193) = {23, 15};
Line(194) = {23, 19};

Transfinite Line{190,192,194} = sl1;
Transfinite Line{191} = sl2;
Transfinite Line{193} = sl2;

Line Loop(195) = {171, 9, -191, -190};
Line Loop(197) = {190, -194, 192, 174};
Line Loop(199) = {194, 191, 12, -193};
Line Loop(201) = {176, -8, -193, 192};

Ruled Surface(196) = {195}; Transfinite Surface{196} = {20,8,7,19};
Ruled Surface(198) = {197}; Transfinite Surface{198} = {24,20,19,23};
Ruled Surface(200) = {199}; Transfinite Surface{200} = {23,15,7,19};
Ruled Surface(202) = {201}; Transfinite Surface{202} = {24,16,15,23};

Recombine Surface {196,198,200,202};

Surface Loop(203) = {182, 198, 196, 200, 202, 20};
Volume(204) = {203}; Transfinite Volume{204}={24,16,15,23,20,8,7,19};

// Volumen 11
Line(205) = {19, 18};
Line(206) = {18, 6};
Line(207) = {18, 22};
Line(208) = {22, 23};
Line(209) = {22, 14};

Transfinite Line{205,207,208} = sl1;
Transfinite Line{206} = sl2;
Transfinite Line{209} = sl2;

Line Loop(210) = {205, 206, 67, -191};
Line Loop(212) = {51, -209, -207, 206};
Line Loop(214) = {205, 207, 208, 194};
Line Loop(216) = {208, 193, 69, -209};

Ruled Surface(211) = {210}; Transfinite Surface{211} = {19,7,6,18};
Ruled Surface(213) = {212}; Transfinite Surface{213} = {18,6,14,22};
Ruled Surface(215) = {214}; Transfinite Surface{215} = {22,23,19,18};
Ruled Surface(217) = {216}; Transfinite Surface{217} = {23,15,14,22};

Recombine Surface {211,213,215,217};

Surface Loop(218) = {211, 215, 213, 217, 76, 200};
Volume(219) = {218}; Transfinite Volume{219}={19,7,6,18,23,15,14,22};

// Volumen 12
Line(220) = {22, 25};
Line(221) = {18, 21};

Transfinite Line{220, 221} = sl1;

Line Loop(222) = {221, 172, -220, -207};
Line Loop(224) = {209, 52, -175, -220};
Line Loop(226) = {206, -47, -170, -221};

Ruled Surface(223) = {222}; Transfinite Surface{223} = {18,22,25,21};
Ruled Surface(225) = {224}; Transfinite Surface{225} = {22,14,17,25};
Ruled Surface(227) = {226}; Transfinite Surface{227} = {18,6,9,21};

Recombine Surface {223,225,227};

Surface Loop(228) = {225, 223, 227, 180, 60, 213};
Volume(229) = {228}; Transfinite Volume{229}={18,6,9,21,22,14,17,25};

// Volumen 13
Line Loop(230) = {208, 192, -173, -220};
Line Loop(232) = {205, 221, 169, 190};

Ruled Surface(231) = {230}; Transfinite Surface{231} = {23,22,25,24};
Ruled Surface(233) = {232}; Transfinite Surface{233} = {19,18,21,20};

Recombine Surface {231,233};

Surface Loop(234) = {233, 198, 215, 187, 223, 231};
Volume(235) = {234}; Transfinite Volume{235}={23,22,25,24,19,18,21,20};

// Apply an elliptic smoother to the grid
Mesh.Smoothing = 100;

Physical Surface("HotWall") = {133, 155, 89, 111, 141, 119, 97, 163, 211, 233, 196, 178, 227};
Physical Surface("Inlet") = {146, 124, 102, 168};
Physical Surface("Outlet") = {14, 44, 64, 78, 202, 217, 184, 231, 225};
Physical Surface("ColdWall") = {74, 62, 38, 22};
Physical Volume("Flow") = {83, 82, 84, 81, 80, 219, 26, 204, 235, 229, 66, 189, 46};```
Attached Files
 hg_duese_simple_inlet.geo.txt (10.1 KB, 1 views)