/* -------------------------------------------------------------------
   File "Core.geo"

   This file is the geometrical description used by GMSH to produce
   the file "Core.msh".
   ------------------------------------------------------------------- */

md = 10e-3;
ri = 20e-3;
ro = 30e-3;
c = 3e-3;
n = 2;


Mesh.Algorithm3D = 4;


Function PrintOutput
	strout = "Output: ";
	For j In {0 : #out[]-1}
  		strout = StrCat( strout, Sprintf( "%g: %g, ", j, out[j] ) );
	EndFor	
	Printf( strout );
Return

//out[] = { 1, 2, 3 };
//Call PrintOutput;

Point(1) = { 0, 0, md/2, c };
Point(2) = { md/2, 0, md/2, c/n };
Line(1) = {2, 1};
Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
  Line{1}; Layers{10};
}
Extrude {0, 0, -md} {
  Surface{4}; Layers{10};
}






Function AirSphere
	
	p1 = newp; Point(p1) = { ri, 0, 0, c*n };
	p2 = newp; Point(p2) = { ro, 0, 0, c*n*2 };
	
	out[] = Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
	  Point{p1, p2};
	};
	Call PrintOutput;
	out1[] = out[];
	
	out[] = Extrude {{0, 0, 1}, {0, 0, 0}, Pi/2} {
	  Point{out[0], out[2]};
	};
	Call PrintOutput;
	
	out[] = Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
	  Line{out1[1], out1[3], out[1], out[3]};
	};
	Call PrintOutput;
	airsurf[] = { out[1], out[7] };
	airinfsurf[] = { out[4], out[10] };
	
	For i In { 1:3 }
		out[] = Extrude {{1, 0, 0}, {0, 0, 0}, Pi/2} {
	  	  Line{out[0], out[3], out[6], out[9]};
		};
		Call PrintOutput;
		airsurf[] += { out[1], out[7] };
		airinfsurf[] += { out[4], out[10] };
	EndFor

	sl1 = newsl; Surface Loop(sl1) = { airinfsurf[] };
	sl2 = newsl; Surface Loop(sl2) = { airsurf[] };
	airinfvol = newv; Volume(airinfvol) = { sl1, sl2 };
Return


Call AirSphere;	

  
Surface Loop(77) = {4, -12, -16, -20, -21};
Volume(78) = {75, -77};
