mm = 0.001 ; // 1 milimetre = 0.001 metre
lc = 1*mm ; // unite de base min pour la taille caracteristique du maillage

//Fer doux support + aimants
// 12 points a definir
xfe  = 0*mm; yfe  = 0*mm;
lofe = 47.5*mm;h1fe = 5*mm;h2fe=5*mm;h3fe=5*mm;
hai = 15*mm;lai=5*mm;lai1=3.5*mm;


Point(1)={xfe,yfe,0,lc};
Point(2)={xfe+lofe,yfe,0,lc};
Point(3)={xfe+lofe,yfe+h1fe,0,lc};
Point(4)={xfe+lofe,yfe+h1fe+hai,0,lc};
Point(5)={xfe+lofe-lai,yfe+h1fe+hai,0,lc};
Point(6)={xfe+lofe-lai,yfe+h1fe,0,lc};
Point(7)={xfe+lai1,yfe+h2fe,0,lc};
Point(8)={xfe+lai1,yfe+h3fe+hai,0,lc};
Point(9)={xfe,yfe+h3fe+hai,0,lc};
Point(10)={xfe,yfe+h3fe,0,lc};

Line(20)={1,2};
Line(21)={2,3};
Line(22)={3,4};
Line(23)={4,5};
Line(24)={5,6};
Line(25)={6,7};
Line(26)={7,8};
Line(27)={8,9};
Line(28)={9,10};
Line(29)={10,1};
Line(30)={3,6};
Line(32)={7,10};


// Surface aimant central
surfaic = newreg ;
Line Loop(surfaic)={26,27,28,-32};
Plane Surface(surfaic+1)={surfaic};

surfail = newreg ;
Line Loop(surfail)={22,23,24,-30};
Plane Surface(surfail+1)={surfail};

surffe = newreg ;
Line Loop(surffe)={20,21,30,25,32,29};
Plane Surface(surffe+1)={surffe};


//Sphere infini

//creation des points pour creer les sphere de transfo inf

rint     = 150. *mm ;       // rayon interne coquille spherique
rext     = 1.5 * rint ;     // rayon externe coquille spherique
tranZ=0*mm; 

Point(500) = {  0.0  , rint    ,  tranZ      , lc*2.5 };
Point(501) = {  0.0  , rext   ,  tranZ     , lc*2.5 };
Point(502) = {  0.0  , -rint    ,  tranZ      , lc*2.5 };
Point(503) = {  0.0  , -rext   ,  tranZ     , lc*2.5 };

Line(504)={500,501};
Line(505)={502,503};
Line(506)={500,9};
Line(507)={502,1};

centre=newreg;
Point(centre) = {  0.0     ,    0.0   ,  tranZ       ,  lc*2.5  };


Circle(508) = {503, centre,501};
Circle(509) = {502, centre,500};


//Surface externe
Line Loop(510) = {504,-508,-505,509};
Plane Surface(511) = {510};

//Surface interne

Inter=newreg;
Line Loop(Inter)={509,506,-27,-26,-25,-24,-23,-22,-21,-20,-507};
Plane Surface(Inter+1)={Inter};

// definition des entites physiques


Physical Surface(9999)={Inter+1};
Physical Surface(9998)={surffe+1}; 
Physical Surface(9997)={511};

Physical Surface(8888)={surfaic+1};
Physical Surface(8887)={surfail+1};


Physical Line(7776)={508};
Physical Line(7775)={504,506,28,29,507,505};
