# [Gmsh] Interior a sphere

Christophe Geuzaine geuzaine at acm.caltech.edu
Tue Sep 21 16:46:23 CEST 2004

```Durufle marc wrote:
> Hello,
> I used the following file "sphere.geo" :
>
> lc=0.3;
> r1=1.0;
> //Sphere
> Point(1) = {0,0,0,lc};
> Point(2) = {0,0,-r1,lc};
> Point(3) = {0,-r1,0,lc};
> Point(4) = {0,0,r1,lc};
>
> Line(1) = {1,2};
> Circle(2) = {2,1,3};
> Circle(3) = {3,1,4};
> Line(4) = {4,1};
>
> Line Loop(4) = {3,4,1,2};
> Plane Surface(5) = {4};
> Extrude Surface {5, {0.0,0.0,1.0}, {0.0,0.0,0.0},
> 2*Pi/3};
> Extrude Surface {19, {0.0,0.0,1.0}, {0.0,0.0,0.0},
> 2*Pi/3};
> Extrude Surface {33, {0.0,0.0,1.0}, {0.0,0.0,0.0},
> 2*Pi/3};
>
> Surface Loop(47) = {13,18,27,32,41,46};
>
> Physical Surface(1) = {13};
> Physical Surface(2) = {18};
> Physical Surface(3) = {27};
> Physical Surface(4) = {32};
> Physical Surface(5) = {41};
> Physical Surface(6) = {46};
>
> Volume(48) = {47};
>
> Physical Volume(1) = {48};
>
> When i compiled, all is ok, and i obtain a wonderful
> surfacic mesh, but i want in truth a volumic mesh with
> tetrahedra ! So, i would want to know what i did not
> do correctly in this file.

In Gmsh >= 1.54 you don't need to define the surface loop and the volume
for an extruded surface (see
http://geuz.org/pipermail/gmsh-announce/2004/000040.html).

> What are the modifications
> I have to bring to my file. My second question is
> about the numbers 13,18,19 ...
> When i call extrude command, how i can get the numbers
> of the surfaces created during this operation ? At
> present, i run gmsh, and i look at numbers, that are
> displayed on the screen. I display then each surface,
> to see what surface matches what number. And then i
> construct my volume...
> There is a better way to do that ?

Only for some of the extruded entities (the "top" and the actual entity).

Here is a modified version of your geometry:

lc=0.3;
r1=1.0;
//Sphere
Point(1) = {0,0,0,lc};
Point(2) = {0,0,-r1,lc};
Point(3) = {0,-r1,0,lc};
Point(4) = {0,0,r1,lc};

Line(1) = {1,2};
Circle(2) = {2,1,3};
Circle(3) = {3,1,4};
Line(4) = {4,1};

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

v1[] = Extrude Surface {5, {0.0,0.0,1.0}, {0.0,0.0,0.0},2*Pi/3};;
v2[] = Extrude Surface {v1[0], {0.0,0.0,1.0}, {0.0,0.0,0.0},2*Pi/3};;
v3[] = Extrude Surface {v2[0], {0.0,0.0,1.0}, {0.0,0.0,0.0},2*Pi/3};;

Physical Volume(1) = {v1[1],v2[1],v3[1]};

// unfortunately, no way to get these automatically yet (the "sides"
// of the extruded regions):
Physical Surface(1) = {13};
Physical Surface(2) = {18};
Physical Surface(3) = {27};
Physical Surface(4) = {32};
Physical Surface(5) = {41};
Physical Surface(6) = {46};

Take care,

Christophe

--
Christophe Geuzaine
Applied and Computational Mathematics, Caltech
geuzaine at acm.caltech.edu - http://geuz.org

```