Include "machine2_data.geo" ;

// longueurs caractéristiques pour le maillage
lc1 = 10*mm;
lcm = 5*mm;
lc2 = 10*mm;
lcint = 30*mm;
lcext = 50*mm;
lcef = 1*mm;

// --------------------------------------------------------------------

// circuit magnétique 1
Point(1) = {Long1/2, -Ef/2-Haut1, 0, lc1};
Point(2) = {Long1/2, -Ef/2, 0, lcef};
Point(3) = {-Long1/2, -Ef/2, 0, lcef};
Point(4) = {-Long1/2, -Ef/2-Haut1, 0, lc1};

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

// aimant
Point(5) = {Longm/2, -Ef/2-Profm-Hautm, 0, lcm};
Point(6) = {Longm/2, -Ef/2-Profm, 0, lcm};
Point(7) = {-Longm/2, -Ef/2-Profm, 0, lcm};
Point(8) = {-Longm/2, -Ef/2-Profm-Hautm, 0, lcm};

Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};

// circuit magnétique 2
Point(9) = {Long2/2, Ef/2, 0, lcef};
Point(10) = {Long2/2, Ef/2+Haut2, 0, lc2};
Point(11) = {-Long2/2, Ef/2+Haut2, 0, lc2};
Point(12) = {-Long2/2, Ef/2, 0, lcef};

Line(9) = {9, 10};
Line(10) = {10, 11};
Line(11) = {11, 12};
Line(12) = {12, 9};

// air intérieur
Point(13) = {0, 0, 0};
Point(14) = {Rint, 0, 0, lcint};
Point(15) = {0, Rint, 0, lcint};
Point(16) = {-Rint, 0, 0, lcint};
Point(17) = {0, -Rint, 0, lcint};

Circle(13) = {14, 13, 15};
Circle(14) = {15, 13, 16};
Circle(15) = {16, 13, 17};
Circle(16) = {17, 13, 14};

// air extérieur
Point(18) = {Rext, 0, 0, lcext};
Point(19) = {0, Rext, 0, lcext};
Point(20) = {-Rext, 0, 0, lcext};
Point(21) = {0, -Rext, 0, lcext};

Circle(17) = {18, 13, 19};
Circle(18) = {19, 13, 20};
Circle(19) = {20, 13, 21};
Circle(20) = {21, 13, 18};

// entrefer
Line(21) = {2, 9};
Line(22) = {12, 3};

// --------------------------------------------------------------------
// bloc 1
Line Loop(1) = {1, 2, 3, 4};
Line Loop(2) = {5, 6, 7, 8};
Plane Surface(1) = {1, 2};

// aimant
Plane Surface(2) = {2};

// bloc 2
Line Loop(3) = {9, 10, 11, 12};
Plane Surface(3) = {3};

// air intérieur
Line Loop(4) = {13, 14, 15, 16};
Plane Surface(4) = {4, 1, 3};

// air extérieur
Line Loop(5) = {17, 18, 19, 20};
Plane Surface(5) = {5, 4};

// entrefer
Line Loop(6) = {21, -12, 22, -2};
Plane Surface(6) = {6};

// --------------------------------------------------------------------

Physical Surface(BLOC1) = {1};
Physical Surface(BLOC2) = {3};
Physical Surface(AIMANT) = {2};
Physical Surface(AIR) = {4};
Physical Surface(AIR_INF) = {5};
Physical Surface(ENTREFER) = {6};
Physical Line(LINFINI) = {17, 18, 19, 20};
