// Gmsh project created on Wed May 11 13:31:10 2011
//Points on the inner circle of the torus upper face
Point(1) = {0,0,0.005};
Point(2) = {0.045,0,0.005};
Point(3) = {0,0.045,0.005};
Point(4) = {-0.045,0,0.005};
Point(5) = {0,-0.045,0.005};

//Vertices of plane no.1 of the sorrounding cube
Point(6) = {0.2,0.2,0.2};
Point(7) = {-0.2,0.2,0.2};
Point(8) = {-0.2,0.2,-0.2};
Point(9) = {0.2,0.2,-0.2};

//Vertices of Plane no.2 of the cube
Point(10) = {0.2,-0.2,-0.2};
Point(11) = {0.2,-0.2,0.2};

//Vertices of Plane no.3
Point(12) = {-0.2,-0.2,0.2};
Point(13) = {-0.2,-0.2,-0.2};
// Points on the outer bound of the torus upper face
Point(14) = {0,0,0.005};
Point(15) = {0.055,0,0.005};
Point(16) = {0,0.055,0.005};
Point(17) = {-0.055,0,0.005};
Point(18) = {0,-0.055,0.005};
Circle(16) = {2,1,3};
Circle(17) = {3,1,4};
Circle(18) = {4,1,5};
Circle(19) = {5,1,2};
Circle(20) = {15,14,16};
Circle(21) = {16,14,17};
Circle(22) = {17,14,18};
Circle(23) = {18,14,15};
Line Loop(1)= {16,17,18,19,20,21,22,23};
Plane Surface(7) = {1};

//creating the coil using by extruding down the created upper face
Extrude {0,0,-0.01} { 
Surface{7};
}

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



//plane 2
Line(6) = {6,11};
Line(7) = {11,10};
Line(8) = {10,9};
Line Loop(9) = {6,7,8,4};
Plane Surface(2)={9};

//plane 3
Line(10) = {10,13};
Line(11) = {13,12};
Line(12) = {12,11};
Line Loop(13) = {7,10,11,12};
Plane Surface(3)={13};

//plane 4
Line(14) = {12,7};
Line(15) = {8,13};
Line Loop(16) = {11,2,14,15};
Plane Surface(4)={16};


//plane 5
Line Loop(19) = {-12,-1,14,6};
Plane Surface(5)={19};

//plane 6
Line Loop(22) = {-8,10,-15,3};
Plane Surface(6)={22};

//ferrite beneath the coil
Point(59) = {0,0,-0.02};
Point(60) = {0.055,0,-0.02};
Point(61) = {0,0.055,-0.02};
Point(62) = {-0.055,0,-0.02};
Point(63) = {0,-0.055,-0.02};
Circle(60) = {60,59,61};
Circle(61) = {61,59,62};
Circle(62) = {62,59,63};
Circle(63) = {63,59,60};
Line Loop (23) = {60,61,62,63};
Plane Surface(66) = {23};
Extrude {0,0,0.015} { 
Surface{66};
}
Line Loop(5000) = {25,26,27,28};
Plane Surface(90) = {5000};

// Plane Surface of the conductor over the coil
Point(64)= {0,0,0.01};
Point(65)= {0.1,0,0.01};
Point(66)= {0,0.1,0.01};
Point(67)= {-0.1,0,0.01};
Point(68)= {0,-0.1,0.01};
Circle(83) = {65,64,66};
Circle(84) = {66,64,67};
Circle(85) = {67,64,68};
Circle(86) = {68,64,65};
Line Loop (87) = {83,84,85,86};
Plane Surface(100) = {87};
Extrude {0,0,0.005} { 
Surface{100};
}



Surface Loop (2000) = {1,2,3,4,5,6};
Surface Loop (2001) = {7,36,40,44,48,52,56,60,64,66,75,79,83,87,90};
Surface Loop (2002) = {100,5009,5013,5017,5021,5022};
Volume(4) = {2000,2001,2002};

Coherence;
