[Gmsh] Problem with mesh over extruded surface where other surfaces are defined

Isaac Haïk Dunn anjeeisaac at gmail.com
Wed Feb 6 23:14:01 CET 2019


Hello,
My goal is to create a parallelepiped with two rectangles on each of the
top and bottom surfaces. That way I could import the mesh and solve an
equation on that volume and apply boundary conditions on each of the 4
rectangular regions over the solid.

I've almost completed the task by extruding a rectangular shape and by
defining the rectangles over the top and bottom surfaces. However when I
mesh 3D, the bottom surface and the volume are correctly meshed, but not
the top surface. The mesh does not accommodate to the two rectangular
shapes, hence my final mesh over that surface has two meshes overlapping on
each rectangle, which is a problem.
I applied the exact same logic than for the bottom surface, so I do not
really understand why the result differs, nor how I could fix it. I would
greatly appreciate some guidance!

Here's the code:

SetFactory("OpenCASCADE");
Mesh.RandomFactor=1.0e-6;
lc=0.35;
a = 2;
b = 1;
c = 0.06;

// bottom motif
Point(1) = {-a/2, -b/2, -c/2, lc};
Point(2) = {-a/2, b/2, -c/2, lc};
Point(3) = {a/2, b/2, -c/2, lc};
Point(4) = {a/2, -b/2, -c/2, lc};
Line(1) = {1,2};
Line(2) = {2,3};
Line(3) = {3,4};
Line(4) = {4,1};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};

// auxiliary points over top and bottom surface
// rectangle 1
Point(7) = {-a/10 + a/4.4,-b/10, c/2};
Point(8) = {-a/10 + a/4.4,b/10,c/2};
Point(9) = {a/10 + a/4.4, b/10,c/2};
Point(10) = {a/10 + a/4.4,-b/10,c/2};
Line(11) = {7,8};
Line(12) = {8,9};
Line(13) = {9,10};
Line(14) = {10,7};
Line Loop(15) = {11,12,13,14};
Plane Surface(16) = {15};

// rectangle 2
Point(17) = {-a/16+a/4,-b/16, -c/2};
Point(18) = {-a/16+a/4,b/16,-c/2};
Point(19) = {a/16+a/4, b/16,-c/2};
Point(20) = {a/16+a/4,-b/16,-c/2};
Line(21) = {17,18};
Line(22) = {18,19};
Line(23) = {19,20};
Line(24) = {20,17};
Line Loop(25) = {21,22,23,24};
Plane Surface(26) = {25};

// rectangle 3
Point(27) = {-(-a/16+a/4),-b/16, c/2};
Point(28) = {-(-a/16+a/4),b/16,c/2};
Point(29) = {-(a/16+a/4), b/16,c/2};
Point(30) = {-(a/16+a/4),-b/16,c/2};
Line(31) = {27,28};
Line(32) = {28,29};
Line(33) = {29,30};
Line(34) = {30,27};
Line Loop(35) = {31,32,33,34};
Plane Surface(36) = {35};

// rectangle 4
Point(37) = {-a/22+a/14,-b/22, -c/2};
Point(38) = {-a/22+a/14,b/22,-c/2};
Point(39) = {a/22+a/14, b/22,-c/2};
Point(40) = {a/22+a/14,-b/22,-c/2};
Line(41) = {37,38};
Line(42) = {38,39};
Line(43) = {39,40};
Line(44) = {40,37};
Line Loop(45) = {41,42,43,44};
Plane Surface(46) = {45};


// bottom mesh
Line Loop(46) = {2, 3, 4, 1};
Line Loop(47) = {42, 43, 44, 41};
Line Loop(48) = {22, 23, 24, 21};
Plane Surface(47) = {46, 47, 48};
Physical Surface(98) = {26};
Physical Surface(99) = {46};
Physical Surface(100) = {47};

surfaceVector[] = Extrude {0, 0, c} {
     Surface{6};
    Layers{15};
     Recombine;
    };

// volume and top mesh
Physical Volume("internal") = surfaceVector[1];
Physical Surface(201) = {16};
Physical Surface(202) = {36};
Line Loop(54) = {49,51,52,47};
Plane Surface(203) ={54, 15, 35};
Physical Surface(203)={203};


In Gmsh, to see that the bottom surface mesh is correct, go to Visibility
and select Surfaces 98, 99 and 100. To see that the top surface mesh is
wrong, select the surfaces 201, 202 and 203.

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20190206/869fdc16/attachment.html>


More information about the gmsh mailing list