Friday 05 December 2025
It is interesting to think about and create the elbow geometry in Gmsh for the 2D elbow mesh. Figure 1 shows the drawing [1].
Fig. 1. The drawing of the elbow [1]
// elbow_new.geo
Point(1) = {0, 4.54, 0, 1.0}; Point(2) = {32, 4.54, 0, 1.0};
Point(3) = {52.54, 20.54, 0, 1.0}; Point(4) = {52.54, 0, 0, 1.0};
Point(5) = {56.54, 0, 0, 1.0}; Point(6) = {56.54, 20.54, 0, 1.0};
Point(7) = {64, 36.54, 0, 1.0}; Point(8) = {64, 68.54, 0, 1.0};
Point(9) = {48, 68.54, 0, 1.0}; Point(10) = {48, 36.54, 0, 1.0};
Point(11) = {32, 20.54, 0, 1.0}; Point(12) = {0, 20.54, 0, 1.0};
Line(1) = {1, 2}; // Line(2) = {3, 4}; Line(3) = {5, 6};
Line(4) = {7, 8}; Line(5) = {8, 9}; Line(6) = {9, 10};
Line(7) = {11, 12}; Line(8) = {1, 12}; Line(9) = {4, 5};
//
Point(13) = {32, 36.54, 0, 1.0};
Circle(10) = {11, 13, 10}; Circle(11) = {2, 13, 7};
//
Line(2) = {3, 4}; Line(3) = {5, 6};
Coherence;
//
Delete {
Point{13}; Curve{11}; Curve{14}; Point{14}; Point{17}; Curve{16};
}
//
Curve Loop(1) = {15, 12, 9, 13, 17, 4, 5, 6, -10, 7, -8, 1};
Plane Surface(1) = {1};
//
Extrude {0, 0, 1} {
Surface{1};
}
//
Physical Surface("velocity-inlet-5", 42) = {12};
Physical Surface("velocity-inlet-6", 43) = {4};
Physical Surface("pressure-outlet-7", 44) = {8};
Physical Surface("wall-4", 45) = {9, 10, 3, 5, 2, 11, 13};
Physical Surface("wall-8", 46) = {6, 7};
Physical Surface("frontAndBackPlanes", 47) = {14, 1};
Physical Volume("elbow-new", 49) = {1};
// uniform triangular
mesh_size = 2.0;
Mesh.RecombineAll = 0; // 0 for triangles, 1 for quads
Mesh.Algorithm = 6; // 6 for triangles, 8 for quads
Mesh.CharacteristicLengthMin = mesh_size;
Mesh.CharacteristicLengthMax = mesh_size;
Mesh.CharacteristicLengthExtendFromBoundary = 0;
//
Mesh 3;
Fig. 3. Mesh exported from Gmsh to use in OpenFoam
Files copied from the elbow tutorial to a new folder elbow_new created for this purpose.
Fig. 4. Tree structure of the elbow_new folder
Execute the commands gmshToFoam elbow_new.msh and checkMesh. Ensure the Mesh OK and a new folder polyMesh in the constant folder.
[1] https://www.tfd.chalmers.se/~hani/kurser/TMEX02_2007/Gambit/tg02.htm
Learning Point
- For p and U in folder 0, use type slip; for frontAndBackPlanes
No comments:
Post a Comment