/* Paramètres */
//Core
LxCore  = 5.e-3;
LyCore  = 5.e-3;
LzCore  = 5.e-3;
pCore   = LxCore/6;

//Inducteur
LxInd   = 7.e-3;
LyInd   = 7.e-3;
HzInd   = 10.e-3;
dxInd   = 4.e-3;
dyInd   = 4.e-3;
pInd    = dxInd/3;

//Air
pAir    = 1.e-3;

/* Points */
//Core
Point (1) = {0, 0, 0, pCore};
Point (2) = {LxCore, 0, 0, pCore};
Point (3) = {LxCore, LyCore, 0, pCore};
Point (4) = {0, LyCore, 0, pCore};
Point (5) = {0, 0, LzCore, pCore};
Point (6) = {LxCore, 0, LzCore, pCore};
Point (7) = {LxCore, LyCore, LzCore, pCore};
Point (8) = {0, LyCore, LzCore, pCore};

//Inducteur
Point (10) = {LxInd, 0, 0, pInd};
Point (11) = {LxInd+dxInd, 0, 0, pInd};
Point (12) = {LxInd+dxInd, LyInd+dyInd, 0, pInd};
Point (13) = {0, LyInd+dyInd, 0, pInd};
Point (14) = {0, LyInd, 0, pInd};
Point (15) = {LxInd, LyInd, 0, pInd};
Point (16) = {LxInd, 0, HzInd, pInd};
Point (17) = {LxInd+dxInd, 0, HzInd, pInd};
Point (18) = {LxInd+dxInd, LyInd+dyInd, HzInd, pInd};
Point (19) = {0, LyInd+dyInd, HzInd, pInd};
Point (20) = {0, LyInd, HzInd, pInd};
Point (21) = {LxInd, LyInd, HzInd, pInd};

//Air
Point (9) = {0, 0, HzInd, pAir};

/* Lignes */
//Core
Line (101) = {1, 2};
Line (102) = {2, 3};
Line (103) = {3, 4};
Line (104) = {4, 1};
Line (105) = {5, 6};
Line (106) = {6, 7};
Line (107) = {7, 8};
Line (108) = {8, 5};
Line (109) = {1, 5};
Line (110) = {2, 6};
Line (111) = {3, 7};
Line (112) = {4, 8};

//Inducteur
Line (120)  = {10, 11};
Line (121)  = {11, 12};
Line (122)  = {12, 13};
Line (123)  = {13, 14};
Line (124)  = {14, 15};
Line (125)  = {15, 10};
Line (126)  = {16, 17};
Line (127)  = {17, 18};
Line (128)  = {18, 19};
Line (129)  = {19, 20};
Line (130)  = {20, 21};
Line (131)  = {21, 16};
Line (132)  = {10, 16};
Line (133)  = {11, 17};
Line (134)  = {12, 18};
Line (135)  = {13, 19};
Line (136)  = {14, 20};
Line (137)  = {15, 21};
Line(190)  = {21,18};
Line(191)  = {15,12};

//Air
Line (138)  = {9, 16};
Line (139)  = {9, 20};
Line (140)  = {2, 10};
Line (141)  = {4, 14};
Line (142)  = {9, 5};
 
/* Surfaces */
//Core
Line Loop (150)  = {101, 102, 103, 104};   Plane Surface (151)  = {150}; //Z=0
Line Loop (152)  = {105, 106, 107, 108};   Plane Surface (153)  = {152}; //Z=1
Line Loop (154)  = {101, 110, -105, -109}; Plane Surface (155)  = {154}; //
Line Loop (156)  = {102, 111, -106, -110}; Plane Surface (157)  = {156}; //Y=0
Line Loop (158)  = {103, 112, -107, -111}; Plane Surface (159)  = {158}; //
Line Loop (160)  = {104, 109, -108, -112}; Plane Surface (161)  = {160}; //X=0

//Inducteur
Line Loop (166)  = {120, 133, -126, -132}; Plane Surface (167)  = {166}; //Y=0
Line Loop (168)  = {121, 134, -127, -133}; Plane Surface (169)  = {168}; //Ext_X
Line Loop (170)  = {122, 135, -128, -134}; Plane Surface (171)  = {170}; //Ext_Y
Line Loop (172)  = {123, 136, -129, -135}; Plane Surface (173)  = {172}; //X=0
Line Loop (174)  = {124, 137, -130, -136}; Plane Surface (175)  = {174}; //Int_Y
Line Loop (176)  = {125, 132, -131, -137}; Plane Surface (177)  = {176}; //Int_X

Line Loop (301)  = {126, 127, -190, 131}; Plane Surface (302)  = {301}; //Z=1 X
Line Loop (303)  = {129, 130, 190, 128};  Plane Surface (304)  = {303}; //Z=1 Y
Line Loop (305)  = {120, 121, -191, 125}; Plane Surface (306)  = {305}; //Z=0 X
Line Loop (307)  = {191, 122, 123, 124}; Plane Surface (308)  = {307}; //Z=0 Y
Line Loop (309)  = {190, -134, -191, 137}; Plane Surface (310)  = {309}; //Milieu

//Air
Line Loop (178)  = {141, 124, 125, -140, 102, 103};
Plane Surface (179)  = {178}; //Z=0
Line Loop (180)  = {139, 130, 131, -138};
Plane Surface (181)  = {180}; //Z=1
Line Loop (182)  = {105, -110, 140, 132, -138, 142};
Plane Surface (183)  = {182}; //Y=0
Line Loop (184)  = {142, -108, -112, 141, 136, -139};
Plane Surface (185)  = {184}; //X=0

/* Volumes */
//Core
Surface Loop (201) = {151, 153, 155, 157, 159, 161};
Volume (202) = {201};

//Inducteur
Surface Loop (210) = {167, 169, 310, 177, 306, 302};
Volume (211) = {210};
Surface Loop (212) = {310, 171, 173, 175, 304, 308};
Volume (213) = {212};

//Air
Surface Loop (205) = {179, 181, 183, 185, 153, 157, 159, 175, 177};
Volume (206) = {205};

/* Entités physiques */
Physical Surface (510)  = {151, 179, 306, 308}; //Z=0
Physical Surface (520)  = {181, 302, 304}; //Z=1
Physical Surface (530)  = {155, 183, 167}; //Y=0
Physical Surface (540)  = {161, 185, 173}; //X=0
Physical Surface (550)  = {169, 171}; //Ext

Physical Volume  (1000) = {202};  //Core
Physical Volume  (2000) = {211};  //InducteurX
Physical Volume  (3000) = {213};  //InducteurY
Physical Volume  (4000) = {206};  //Air