|
| 1 | +// 2D Rectangle: 4m (width) x 2m (height) |
| 2 | +// With Physical Lines for boundary labeling |
| 3 | + |
| 4 | +lc = 0.2; // Characteristic length (mesh density) |
| 5 | + |
| 6 | +// Points (x, y, z, mesh size) |
| 7 | +Point(1) = {0, 0, 0, lc}; // Bottom left |
| 8 | +Point(2) = {4, 0, 0, lc}; // Bottom right |
| 9 | +Point(3) = {4, 2, 0, lc}; // Top right |
| 10 | +Point(4) = {0, 2, 0, lc}; // Top left |
| 11 | + |
| 12 | +// Lines |
| 13 | +Line(1) = {1, 2}; // bottom |
| 14 | +Line(2) = {2, 3}; // right |
| 15 | +Line(3) = {3, 4}; // top |
| 16 | +Line(4) = {4, 1}; // left |
| 17 | + |
| 18 | +// Line Loop and Surface |
| 19 | +Line Loop(1) = {1, 2, 3, 4}; |
| 20 | +Plane Surface(1) = {1}; |
| 21 | + |
| 22 | +// Physical Lines |
| 23 | +Physical Line("bottom") = {1}; |
| 24 | +Physical Line("right") = {2}; |
| 25 | +Physical Line("top") = {3}; |
| 26 | +Physical Line("left") = {4}; |
| 27 | + |
| 28 | +// Physical Surface (optional, for FEM domains) |
| 29 | +Physical Surface("domain") = {1}; |
| 30 | + |
| 31 | +// Generate 2D mesh |
| 32 | +//Recombine Surface{1}; // Turns triangle mesh into quads |
| 33 | +Mesh 2; |
| 34 | + |
0 commit comments