xref: /libCEED/examples/fluids/meshes/cylinder.geo (revision 5fb68f377259d3910de46d787b7c5d1587fd01e1)
1DefineConstant[
2  zspan = {0.2, Min .1, Max 10, Step .1,
3    Name "Parameters/Zspan"}
4];
5
6DefineConstant[
7  H = {4.5, Min 1, Max 10, Step .1,
8    Name "Parameters/Height"}
9];
10
11DefineConstant[
12  xL = {4.5, Min 1, Max 10, Step .1,
13    Name "Parameters/XL"}
14];
15
16DefineConstant[
17  xR = {11, Min .2, Max 30, Step .1,
18    Name "Parameters/XR"}
19];
20
21DefineConstant[
22  cyldiameter = {1.0, Min .1, Max 1.0, Step .1,
23    Name "Parameters/CylDiameter"}
24];
25
26DefineConstant[
27  N = {20, Min 2, Max 80, Step 2,
28    Name "Parameters/ElementsPerQuadrant"}
29];
30
31DefineConstant[
32  RadialRatio = {1, Min .2, Max 5, Step .1,
33  Name "Parameters/RadialRatio"}
34];
35DefineConstant[
36  Rb = {.9, Min .5, Max 2, Step .05,
37  Name "Parameters/RadialProgression"}
38];
39
40Nx1 = N + 1; Rx1 = 1.00;
41Nx2 = Ceil(N * 9 / 11 * xR / (2*xL)) + 1; Rx2 = 1.00;
42Ny  = N + 1; Ry = 2.00;
43Nb  = Ceil(RadialRatio * N) + 1;
44Nc  = N + 1; Rc = 1.00;
45
46// Characteristic element length
47h = 2 * H / N;
48
49// Exterior corners
50Point(1) = {-xL, -H, 0};
51Point(2) = {xL, -H, 0};
52Point(3) = {xL + xR, -H, 0};
53Point(4) = {-xL, H, 0};
54Point(5) = {xL, H, 0};
55Point(6) = {xL + xR, H, 0};
56
57// Coordinates for Cylinder points
58Point(7) = {-cyldiameter/Sqrt(8), -cyldiameter/Sqrt(8), 0};
59Point(8) = {cyldiameter/Sqrt(8), -cyldiameter/Sqrt(8), 0};
60Point(9) = {-cyldiameter/Sqrt(8), cyldiameter/Sqrt(8), 0};
61Point(10) = {cyldiameter/Sqrt(8), cyldiameter/Sqrt(8), 0};
62Point(11) = {0, 0, 0};
63
64// Top and bottom edges
65Line(1) = {1, 2}; Transfinite Curve {1} = Nx1 Using Progression Rx1;
66Line(2) = {2, 3}; Transfinite Curve {2} = Nx2 Using Progression Rx2;
67Line(3) = {4, 5}; Transfinite Curve {3} = Nx1 Using Progression Rx1;
68Line(4) = {5, 6}; Transfinite Curve {4} = Nx2 Using Progression Rx2;
69// Vertical edges and internal interface
70Line(5) = {4, 1}; Transfinite Curve {5} = Ny Using Bump Ry;
71Line(6) = {5, 2}; Transfinite Curve {6} = Ny Using Bump Ry;
72Line(7) = {6, 3}; Transfinite Curve {7} = Ny Using Bump Ry;
73
74// Cylinder arcs
75Circle(8) = {7, 11, 8}; Transfinite Curve {8} = Nc Using Progression Rc;
76Circle(9) = {8, 11, 10}; Transfinite Curve {9} = Nc Using Progression Rc;
77Circle(10) = {10, 11, 9}; Transfinite Curve {10} = Nc Using Progression Rc;
78Circle(11) = {9, 11, 7}; Transfinite Curve {11} = Nc Using Progression Rc;
79
80// Radial lines
81Line(12) = {1, 7}; Transfinite Curve {12} = Nb Using Progression Rb;
82Line(13) = {2, 8}; Transfinite Curve {13} = Nb Using Progression Rb;
83Line(14) = {5, 10}; Transfinite Curve {14} = Nb Using Progression Rb;
84Line(15) = {4, 9}; Transfinite Curve {15} = Nb Using Progression Rb;
85
86// surfaces
87Curve Loop(1) = {12, 8, -13, -1};
88Plane Surface(1) = {1};
89Curve Loop(2) = {13, 9, -14, 6};
90Plane Surface(2) = {2};
91Curve Loop(3) = {14, 10, -15, 3};
92Plane Surface(3) = {3};
93Curve Loop(4) = {15, 11, -12, -5};
94Plane Surface(4) = {4};
95Curve Loop(5) = {2, -7, -4, 6};
96Plane Surface(5) = {5};
97Transfinite Surface {1};
98Transfinite Surface {2};
99Transfinite Surface {3};
100Transfinite Surface {4};
101Transfinite Surface {5};
102Recombine Surface {1};
103Recombine Surface {2};
104Recombine Surface {3};
105Recombine Surface {4};
106Recombine Surface {5};
107Extrude {0, 0, zspan} {
108  Surface{1, 2, 3, 4, 5};
109  Layers {Ceil(zspan / h)};
110  Recombine;
111}
112
113Physical Surface("inlet") = {102}; // inlet
114Physical Surface("outlet") = {116}; // outlet
115Physical Surface("top") = {80, 120}; // top
116Physical Surface("bottom") = {36, 112}; // bottom
117Physical Surface("cylinderwalls") = {94, 28, 50, 72}; // cylinderwalls
118Physical Surface("frontandback") = {37, 1, 4, 103, 3, 81, 2, 59, 5, 125}; // frontandback
119Physical Volume("mesh") = {1:5};
120