// Gmsh project created on Thu Sep  1 09:37:43 2011
r2=1.09;
lc = 0.2;                
r1=1.000;
//===================================
// La sphere
//===================================

Point(1)  = { -r1,0,0,lc} ;
Point(2)  = {    0,-r1,0,lc} ;
Point(3)  = { 0,0,r1,lc} ;
Point(4)  = { 0,0,-r1,lc} ;
Point(10) = {    0,0,0,lc} ; 

Circle(1) = {1,10,2};
Circle(2) = {2,10,3};
Circle(3) = {3,10,1};

Circle(4) = {4,10,2};
Circle(5) = {1,10,4};


N=8;
lc1 = 0.05;
teta_c = 3*Pi/2-Pi/4;
lambda_c = Pi/7;

R = Pi/25;

For i In {0:N-1}
  alpha = i*2*Pi/N;
  lambda = lambda_c-R*Sin(alpha);
  teta = teta_c+R*Cos(alpha);       
  Point(11+i) = {r1*Cos(lambda)*Cos(teta), r1*Cos(lambda)*Sin(teta), r1*Sin(lambda), lc1};
EndFor

Spline(100) = { 11:N+10,11};

Line Loop(6) = {-100};
Line Loop(7) = {1,2,3};
Ruled Surface(8) = {7,6} In Sphere{10};
Line Loop(9) = {4,-1,5};
Ruled Surface(9)   = {9};

a[] = Rotate { {0,0,1} , {0,0,0} , Pi/2  } { Duplicata{ Surface{8}; } } ;
b[] = Rotate { {0,0,1} , {0,0,0} , Pi    } { Duplicata{ Surface{8}; } } ;
c[] = Rotate { {0,0,1} , {0,0,0} , 3*Pi/2} { Duplicata{ Surface{8}; } } ;

d[] = Rotate { {0,0,1} , {0,0,0} , Pi/2  } { Duplicata{ Surface{9}; } } ;
e[] = Rotate { {0,0,1} , {0,0,0} , Pi    } { Duplicata{ Surface{9}; } } ;
f[] = Rotate { {0,0,1} , {0,0,0} , 3*Pi/2} { Duplicata{ Surface{9}; } } ;

//Physical Surface(1)={8,a[],b[],c[],9,d[],e[],f[]};
Surface Loop(1)={8,a[],b[],c[],9,d[],e[],f[]};

// Scale sphere surface to obtain outer boundary
out[] = Dilate {{0,0,0,lc},r2}
{
  Duplicata{ Surface{8,a[],b[],c[],9,d[],e[],f[]}; }
};
                                                                                                              
Physical Surface(1)={2,1};
