<div dir="ltr"><div dir="ltr"><div>Hello,</div><div>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.</div><div><br></div><div>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.</div><div>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!</div><div><br></div><div>Here's the code:</div><div><br></div><div>SetFactory("OpenCASCADE");<br>Mesh.RandomFactor=1.0e-6;<br>lc=0.35;<br>a = 2;<br>b = 1;<br>c = 0.06;</div><div><br></div><div>// bottom motif<br>Point(1) = {-a/2, -b/2, -c/2, lc};<br>Point(2) = {-a/2, b/2, -c/2, lc};<br>Point(3) = {a/2, b/2, -c/2, lc};<br>Point(4) = {a/2, -b/2, -c/2, lc};<br>Line(1) = {1,2};<br>Line(2) = {2,3};<br>Line(3) = {3,4};<br>Line(4) = {4,1};<br>Line Loop(5) = {1,2,3,4};<br>Plane Surface(6) = {5};<br><br>// auxiliary points over top and bottom surface<br>// rectangle 1<br>Point(7) = {-a/10 + a/4.4,-b/10, c/2};<br>Point(8) = {-a/10 + a/4.4,b/10,c/2};<br>Point(9) = {a/10 + a/4.4, b/10,c/2};<br>Point(10) = {a/10 + a/4.4,-b/10,c/2};<br>Line(11) = {7,8};<br>Line(12) = {8,9};<br>Line(13) = {9,10};<br>Line(14) = {10,7};<br>Line Loop(15) = {11,12,13,14};<br>Plane Surface(16) = {15};<br><br>// rectangle 2<br>Point(17) = {-a/16+a/4,-b/16, -c/2};<br>Point(18) = {-a/16+a/4,b/16,-c/2};<br>Point(19) = {a/16+a/4, b/16,-c/2};<br>Point(20) = {a/16+a/4,-b/16,-c/2};<br>Line(21) = {17,18};<br>Line(22) = {18,19};<br>Line(23) = {19,20};<br>Line(24) = {20,17};<br>Line Loop(25) = {21,22,23,24};<br>Plane Surface(26) = {25};<br> <br>// rectangle 3<br>Point(27) = {-(-a/16+a/4),-b/16, c/2};<br>Point(28) = {-(-a/16+a/4),b/16,c/2};<br>Point(29) = {-(a/16+a/4), b/16,c/2};<br>Point(30) = {-(a/16+a/4),-b/16,c/2};<br>Line(31) = {27,28};<br>Line(32) = {28,29};<br>Line(33) = {29,30};<br>Line(34) = {30,27};<br>Line Loop(35) = {31,32,33,34};<br>Plane Surface(36) = {35};<br><br>// rectangle 4<br>Point(37) = {-a/22+a/14,-b/22, -c/2};<br>Point(38) = {-a/22+a/14,b/22,-c/2};<br>Point(39) = {a/22+a/14, b/22,-c/2};<br>Point(40) = {a/22+a/14,-b/22,-c/2};<br>Line(41) = {37,38};<br>Line(42) = {38,39};<br>Line(43) = {39,40};<br>Line(44) = {40,37};<br>Line Loop(45) = {41,42,43,44};<br>Plane Surface(46) = {45};<br><br><br>// bottom mesh<br>Line Loop(46) = {2, 3, 4, 1};<br>Line Loop(47) = {42, 43, 44, 41};<br>Line Loop(48) = {22, 23, 24, 21};<br>Plane Surface(47) = {46, 47, 48};<br>Physical Surface(98) = {26};<br>Physical Surface(99) = {46};<br>Physical Surface(100) = {47};<br><br>surfaceVector[] = Extrude {0, 0, c} {<br>     Surface{6};<br>    Layers{15};<br>     Recombine;<br>    };<br><br>// volume and top mesh<br>Physical Volume("internal") = surfaceVector[1];<br>Physical Surface(201) = {16};<br>Physical Surface(202) = {36};<br>Line Loop(54) = {49,51,52,47};<br>Plane Surface(203) ={54, 15, 35};<br>Physical Surface(203)={203};<br></div><div><br></div><div><br></div><div>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.</div><div><br></div><div>Thanks!<br></div></div></div>