[Gmsh] Create a circular mesh on the surface of a cube

Julian Dean j.dean at sheffield.ac.uk
Tue Apr 5 13:43:41 CEST 2011


Dear all,

I'm trying to mesh a circular shape on the top of the cube for use as a contact (if you image a block of material with a wire attaching to the top you have the idea of why i need to design it like this.)

What i'm having issues with is how to generate the top surface so that it is still one surface but the mesh will follow the circle shape.

Any help would be gratefully received!!

Best regards

Julian 




Geometry.AutoCoherence=0;

Lc1 = 1.00000;

Point(0)={-0.500000,0.500000,0.500000, Lc1};
Point(1)={0.500000,0.500000,0.500000, Lc1};
Point(2)={-0.500000,0.500000,-0.500000, Lc1};
Point(3)={0.500000,0.500000,-0.500000, Lc1};
Point(4)={-0.500000,-0.500000,0.500000, Lc1};
Point(5)={0.500000,-0.500000,0.500000, Lc1};
Point(6)={-0.500000,-0.500000,-0.500000, Lc1};
Point(7)={0.500000,-0.500000,-0.500000, Lc1};

Line(1)={1,5};
Line(2)={5,4};
Line(3)={4,0};
Line(4)={0,1};
Line Loop(1)={1,2,3,4}; 

Point(8)={0.000000,0.000000,0.500000, Lc1};
Point(9)={-0.250000,0.000000,0.500000, Lc1};
Point(10)={0.000000,-0.250000,0.500000, Lc1};
Point(11)={0.250000,0.000000,0.500000, Lc1};
Point(12)={0.000000,0.250000,0.500000, Lc1};

Ellipse(6)={9, 8, 9, 10};
Ellipse(7)={10, 8, 9, 11};
Ellipse(8)={11, 8, 9, 12};
Ellipse(9)={12, 8, 9, 9};

Line Loop(2)={6, 7, 8, 9};
Plane Surface(1)={1};
Plane Surface(2)={2,1};
Line(10)={2,3};
Line(11)={3,1};
Line(12)={1,0};
Line(13)={0,2};
Line Loop(3)={10,11,12,13}; 
Plane Surface(3)={3};
Line(15)={3,7};
Line(16)={7,5};
Line(17)={5,1};
Line(18)={1,3};
Line Loop(4)={15,16,17,18}; 
Plane Surface(4)={4};
Line(20)={6,2};
Line(21)={2,0};
Line(22)={0,4};
Line(23)={4,6};
Line Loop(5)={20,21,22,23}; 
Plane Surface(5)={5};
Line(25)={7,6};
Line(26)={6,4};
Line(27)={4,5};
Line(28)={5,7};
Line Loop(6)={25,26,27,28}; 
Plane Surface(6)={6};
Line(30)={6,7};
Line(31)={7,3};
Line(32)={3,2};
Line(33)={2,6};
Line Loop(7)={30,31,32,33}; 
Plane Surface(7)={7};
Surface Loop(1)={1,2,3,4,5,6,7};
Volume(1)={1};

Coherence;
Mesh.CharacteristicLengthExtendFromBoundary = 0;
Mesh.CharacteristicLengthMax = 1.000000;