[Gmsh] Trying to create a structured quad mesh in 2D

Jorge Milhazes milhazes at gmail.com
Mon Nov 5 14:36:56 CET 2012


    Hello!
    I'm new to Gmsh and I've been struggling with structured meshes. I
read the hex.geo example and when I try to apply same rule with
transfinite+recombine surface I get almost-squared elements with
distortions here and there.
    I'm using the all-quads subdivision algorithm and tried Delaunay
for quads and frontal with no success. Bellow is my code. Will be glad
if someone could help me with this.
    Cheers,

    Jorge Milhazes


    ##################

    cl1 = 1;
Point(1) = {0, 0, 0, cl1};
Point(2) = {0.9, 0.9, 0, cl1};
Point(3) = {0, 0.9, 0, cl1};
Point(4) = {0.9, 0, 0, cl1};
Point(5) = {0.9, 0.4, 0, cl1};
Point(6) = {0.9, 0.425, 0, cl1};
Point(7) = {0.9, 0.6, 0, cl1};
Point(8) = {0.9, 0.625, 0, cl1};
Point(9) = {0.9, 0.8, 0, cl1};
Point(10) = {0.9, 0.825, 0, cl1};
Point(11) = {0.75, 0.4, 0, cl1};
Point(12) = {0.75, 0.425, 0, cl1};
Point(13) = {0.75, 0.6, 0, cl1};
Point(14) = {0.75, 0.625, 0, cl1};
Point(15) = {0.75, 0.8, 0, cl1};
Point(16) = {0.75, 0.825, 0, cl1};
Point(17) = {0, 0.4, 0, cl1};
Point(18) = {0, 0.425, 0, cl1};
Point(19) = {0, 0.6, 0, cl1};
Point(20) = {0, 0.625, 0, cl1};
Point(21) = {0, 0.8, 0, cl1};
Point(22) = {0, 0.825, 0, cl1};
Point(23) = {0.15, 0.4, 0, cl1};
Point(24) = {0.15, 0.425, 0, cl1};
Point(25) = {0.15, 0.6, 0, cl1};
Point(26) = {0.15, 0.625, 0, cl1};
Point(27) = {0.15, 0.8, 0, cl1};
Point(28) = {0.15, 0.825, 0, cl1};
Line(1) = {1, 17};
Transfinite Line {1} = 17Using Bump 1;
Line(2) = {17, 23};
Transfinite Line {2} = 7Using Bump 1;
Line(3) = {23, 24};
Line(4) = {24, 18};
Transfinite Line {4} = 7Using Bump 1;
Line(5) = {18, 19};
Transfinite Line {5} = 8Using Bump 1;
Line(6) = {19, 25};
Transfinite Line {6} = 7Using Bump 1;
Line(7) = {25, 26};
Line(8) = {26, 20};
Transfinite Line {8} = 7Using Bump 1;
Line(9) = {20, 21};
Transfinite Line {9} = 8Using Bump 1;
Line(10) = {21, 27};
Transfinite Line {10} = 7Using Bump 1;
Line(11) = {27, 28};
Line(12) = {28, 22};
Transfinite Line {12} = 7Using Bump 1;
Line(13) = {22, 3};
Transfinite Line {13} = 4Using Bump 1;
Line(14) = {4, 5};
Transfinite Line {14} = 17Using Bump 1;
Line(15) = {5, 11};
Transfinite Line {15} = 7Using Bump 1;
Line(16) = {11, 12};
Line(17) = {12, 6};
Transfinite Line {17} = 7Using Bump 1;
Line(18) = {6, 7};
Transfinite Line {18} = 8Using Bump 1;
Line(19) = {7, 13};
Transfinite Line {19} = 7Using Bump 1;
Line(20) = {13, 14};
Line(21) = {14, 8};
Transfinite Line {21} = 7Using Bump 1;
Line(22) = {8, 9};
Transfinite Line {22} = 8Using Bump 1;
Line(23) = {9, 15};
Transfinite Line {23} = 7Using Bump 1;
Line(24) = {15, 16};
Line(25) = {16, 10};
Transfinite Line {25} = 7Using Bump 1;
Line(26) = {10, 2};
Transfinite Line {26} = 4Using Bump 1;
Line(27) = {1, 4};
Transfinite Line {27} = 37Using Bump 1;
Line(28) = {3, 2};
Transfinite Line {28} = 37Using Bump 1;
Line Loop(30) = {28, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17,
-16, -15, -14, -27, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
Plane Surface(30) = {30};
Transfinite Surface {30};
Recombine Surface {30};
Physical Line(0) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
cl1 = 1;
Physical Line(cl1) = {14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
Physical Line(2) = {27};
Physical Line(3) = {28};
Physical Surface(35) = {30};

    ####################