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]; 35 36Nx1 = N + 1; Rx1 = 1.00; 37Nx2 = Ceil(N * 9 / 11 * xR / (2*xL)) + 1; Rx2 = 1.00; 38Ny = N + 1; Ry = 2.00; 39Nb = Ceil(RadialRatio * N) + 1; Rb = 0.9; 40Nc = N + 1; Rc = 1.00; 41 42// Characteristic element length 43h = 2 * H / N; 44 45// Exterior corners 46Point(1) = {-xL, -H, 0}; 47Point(2) = {xL, -H, 0}; 48Point(3) = {xL + xR, -H, 0}; 49Point(4) = {-xL, H, 0}; 50Point(5) = {xL, H, 0}; 51Point(6) = {xL + xR, H, 0}; 52 53// Coordinates for Cylinder points 54Point(7) = {-cyldiameter/Sqrt(8), -cyldiameter/Sqrt(8), 0}; 55Point(8) = {cyldiameter/Sqrt(8), -cyldiameter/Sqrt(8), 0}; 56Point(9) = {-cyldiameter/Sqrt(8), cyldiameter/Sqrt(8), 0}; 57Point(10) = {cyldiameter/Sqrt(8), cyldiameter/Sqrt(8), 0}; 58Point(11) = {0, 0, 0}; 59 60// Top and bottom edges 61Line(1) = {1, 2}; Transfinite Curve {1} = Nx1 Using Progression Rx1; 62Line(2) = {2, 3}; Transfinite Curve {2} = Nx2 Using Progression Rx2; 63Line(3) = {4, 5}; Transfinite Curve {3} = Nx1 Using Progression Rx1; 64Line(4) = {5, 6}; Transfinite Curve {4} = Nx2 Using Progression Rx2; 65// Vertical edges and internal interface 66Line(5) = {4, 1}; Transfinite Curve {5} = Ny Using Bump Ry; 67Line(6) = {5, 2}; Transfinite Curve {6} = Ny Using Bump Ry; 68Line(7) = {6, 3}; Transfinite Curve {7} = Ny Using Bump Ry; 69 70// Cylinder arcs 71Circle(8) = {7, 11, 8}; Transfinite Curve {8} = Nc Using Progression Rc; 72Circle(9) = {8, 11, 10}; Transfinite Curve {9} = Nc Using Progression Rc; 73Circle(10) = {10, 11, 9}; Transfinite Curve {10} = Nc Using Progression Rc; 74Circle(11) = {9, 11, 7}; Transfinite Curve {11} = Nc Using Progression Rc; 75 76// Radial lines 77Line(12) = {1, 7}; Transfinite Curve {12} = Nb Using Progression Rb; 78Line(13) = {2, 8}; Transfinite Curve {13} = Nb Using Progression Rb; 79Line(14) = {5, 10}; Transfinite Curve {14} = Nb Using Progression Rb; 80Line(15) = {4, 9}; Transfinite Curve {15} = Nb Using Progression Rb; 81 82// surfaces 83Curve Loop(1) = {12, 8, -13, -1}; 84Plane Surface(1) = {1}; 85Curve Loop(2) = {13, 9, -14, 6}; 86Plane Surface(2) = {2}; 87Curve Loop(3) = {14, 10, -15, 3}; 88Plane Surface(3) = {3}; 89Curve Loop(4) = {15, 11, -12, -5}; 90Plane Surface(4) = {4}; 91Curve Loop(5) = {2, -7, -4, 6}; 92Plane Surface(5) = {5}; 93Transfinite Surface {1}; 94Transfinite Surface {2}; 95Transfinite Surface {3}; 96Transfinite Surface {4}; 97Transfinite Surface {5}; 98Recombine Surface {1}; 99Recombine Surface {2}; 100Recombine Surface {3}; 101Recombine Surface {4}; 102Recombine Surface {5}; 103Extrude {0, 0, zspan} { 104 Surface{1, 2, 3, 4, 5}; 105 Layers {Ceil(zspan / h)}; 106 Recombine; 107} 108 109Physical Surface("inlet") = {102}; // inlet 110Physical Surface("outlet") = {116}; // outlet 111Physical Surface("top") = {80, 120}; // top 112Physical Surface("bottom") = {36, 112}; // bottom 113Physical Surface("cylinderwalls") = {94, 28, 50, 72}; // cylinderwalls 114Physical Surface("frontandback") = {37, 1, 4, 103, 3, 81, 2, 59, 5, 125}; // frontandback 115Physical Volume("mesh") = {1:5}; 116