// Definition of cm & mm (SI)

cm = 1e-02;
mm = 1e-03;

/*--------------------------------------

Some definitions are for later use.

--------------------------------------*/

// Centers of coils

sv1z = 10*mm;	// Center of 1st coil (meassured from middle of sensor)
sv2z = 70*mm;	// Center of 2nd coil
sv3z = -10*mm;	// Center of 3rd coil
sv4z = -70*mm;	// Center of 4th coil

// Radius

rmi = 62*mm;	// Hole radius
rme = 150*mm;	// Shield radius (external)
rvi = 90*mm;	// Coil radius (internal)
rl  = 35*mm;	// Steel rope radius

// Thickness

a1 = 15*mm;	// Sensor shell
a2 = 15*mm;	// Sensor shell (upper, lower)
a3 = 15*mm;	// Coil thickness

// Factors

c1 = 3;
c2 = 10;

// Height

hm = 135*mm;	// Sensor shield height (internal)
hv = 50*mm;	// Coil height
hl = c1*hm;	// Rope height

// Characteristic lengths

lc1 = 3*cm;
lc2 = 6*cm;


/*-----------------

Geometry definition

-----------------*/

// POINTS

// COil

Point(1) = {-rvi,0,hv/2,lc1};
Point(2) = {0,rvi,hv/2,lc1};
Point(3) = {rvi,0,hv/2,lc1};
Point(4) = {0,-rvi,hv/2,lc1};

Point(5) = {-rvi,0,-hv/2,lc1};
Point(6) = {0,rvi,-hv/2,lc1};
Point(7) = {rvi,0,-hv/2,lc1};
Point(8) = {0,-rvi,-hv/2,lc1};

Point(9) = {-rvi-a3,0,hv/2,lc1};
Point(10) = {0,rvi+a3,hv/2,lc1};
Point(11) = {rvi+a3,0,hv/2,lc1};
Point(12) = {0,-rvi-a3,hv/2,lc1};

Point(13) = {-rvi-a3,0,-hv/2,lc1};
Point(14) = {0,rvi+a3,-hv/2,lc1};
Point(15) = {rvi+a3,0,-hv/2,lc1};
Point(16) = {0,-rvi-a3,-hv/2,lc1};

// AirInf

Point(17) = {c1*(-rvi-a3),0,c2*hv/2,lc2};
Point(18) = {0,c1*(rvi+a3),c2*hv/2,lc2};
Point(19) = {c1*(rvi+a3),0,c2*hv/2,lc2};
Point(20) = {0,c1*(-rvi-a3),c2*hv/2,lc2};

Point(21) = {c1*(-rvi-a3),0,c2*(-hv/2),lc2};
Point(22) = {0,c1*(rvi+a3),c2*(-hv/2),lc2};
Point(23) = {c1*(rvi+a3),0,c2*(-hv/2),lc2};
Point(24) = {0,c1*(-rvi-a3),c2*(-hv/2),lc2};

// Centers

Point(25) = {0,0,hv/2,lc1};
Point(26) = {0,0,-hv/2,lc1};
Point(27) = {0,0,c2*hv/2,lc1};
Point(28) = {0,0,c2*(-hv/2),lc1};

// LINES

Circle(1) = {1,25,2};
Circle(2) = {2,25,3};
Circle(3) = {3,25,4};
Circle(4) = {4,25,1};

Circle(5) = {5,26,6};
Circle(6) = {6,26,7};
Circle(7) = {7,26,8};
Circle(8) = {8,26,5};

Line(9) = {1,5};
Line(10) = {2,6};
Line(11) = {3,7};
Line(12) = {4,8};

Circle(13) = {9,25,10};
Circle(14) = {10,25,11};
Circle(15) = {11,25,12};
Circle(16) = {12,25,9};

Circle(17) = {13,26,14};
Circle(18) = {14,26,15};
Circle(19) = {15,26,16};
Circle(20) = {16,26,13};

Line(21) = {9,13};
Line(22) = {10,14};
Line(23) = {11,15};
Line(24) = {12,16};

Circle(25) = {17,27,18};
Circle(26) = {18,27,19};
Circle(27) = {19,27,20};
Circle(28) = {20,27,17};

Circle(29) = {21,28,22};
Circle(30) = {22,28,23};
Circle(31) = {23,28,24};
Circle(32) = {24,28,21};

Line(33) = {17,21};
Line(34) = {18,22};
Line(35) = {19,23};
Line(36) = {20,24};

Line(37) = {1,9};
Line(38) = {2,10};
Line(39) = {3,11};
Line(40) = {4,12};

Line(41) = {5,13};
Line(42) = {6,14};
Line(43) = {7,15};
Line(44) = {8,16};

// SURFACES

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

Line Loop(5) = {13,22,-17,-21};	Ruled Surface(5) = {5};
Line Loop(6) = {14,23,-18,-22};	Ruled Surface(6) = {6};
Line Loop(7) = {15,24,-19,-23};	Ruled Surface(7) = {7};
Line Loop(8) = {16,21,-20,-24};	Ruled Surface(8) = {8};

Line Loop(9) = {25,34,-29,-33};		Ruled Surface(9) = {9};
Line Loop(10) = {26,35,-30,-34};	Ruled Surface(10) = {10};
Line Loop(11) = {27,36,-31,-35};	Ruled Surface(11) = {11};
Line Loop(12) = {28,33,-32,-36};	Ruled Surface(12) = {12};

Line Loop(13) = {1,38,-13,-37};		Plane Surface(13) = {13};
Line Loop(14) = {2,39,-14,-38};		Plane Surface(14) = {14};
Line Loop(15) = {3,40,-15,-39};		Plane Surface(15) = {15};
Line Loop(16) = {4,37,-16,-40};		Plane Surface(16) = {16};

Line Loop(17) = {5,42,-17,-41};		Plane Surface(17) = {17};
Line Loop(18) = {6,43,-18,-42};		Plane Surface(18) = {18};
Line Loop(19) = {7,44,-19,-43};		Plane Surface(19) = {19};
Line Loop(20) = {8,41,-20,-44};		Plane Surface(20) = {20};

Line Loop(21) = {25,26,27,28};		Plane Surface(21) = {21};
Line Loop(22) = {29,30,31,32};		Plane Surface(22) = {22};

// VOLUMES

Surface Loop(1) = {1,2,3,4,5,6,7,8,13,14,15,16,-17,-18,-19,-20};
					Volume(1) = {1};
Surface Loop(2) = {9,10,11,12,-21,22};	Volume(2) = {2,1};

// PHYSICAL ENTITIES

Physical Surface(1) = {9,10,11,12,21,22};			// AirInf
Physical Surface(2) = {1,2,3,4,5,6,7,8,13,14,15,16,17,18,19,20};// Coil surface

Physical Volume(1) = {1};	// Coil
Physical Volume(2) = {2};	// Air