/*
  Coaxial cable with elliptical cross-section.
*/

CableLength[] = 5.0;
ShieldRx[]=2.0;
ShieldRy[]=1.0;
CondRx[]=1.0;
CondRy[]=0.5;

///////////////////////////////////
MshFacZ0[]=0.5;
MshFacZL[]=1.0;
MshCond[]=0.5;
MshShield[]=1.0;
MshSizeX[]=0.1;
MshSizeY[]=0.15;

// Center points:
Point(1) = {0,0,0,1};
Point(2) = {0,0,CableLength,1};
// Defining points of the cross-section at z=0:
Point(3) = {CondRx,0,0,MshFacZ0*MshCond*MshSizeX};
Point(4) = {0,CondRy,0,MshFacZ0*MshCond*MshSizeY};
Point(5) = {0,ShieldRy,0,MshFacZ0*MshShield*MshSizeY};
Point(6) = {ShieldRx,0,0,MshFacZ0*MshShield*MshSizeX};
// Definig points at z=l:
Point(7) = {CondRx,0,CableLength,MshFacZL*MshCond*MshSizeX};
Point(8) = {0,CondRy,CableLength,MshFacZL*MshCond*MshSizeY};
Point(9) = {0,ShieldRy,CableLength,MshFacZL*MshShield*MshSizeY};
Point(10) = {ShieldRx,0,CableLength,MshFacZL*MshShield*MshSizeX};
///////////////////////////////////
// Lines:
//
Ellipse(1) = {3,1,3,4}; // z=0; Cond.
Ellipse(2) = {5,1,6,6}; // z=0; Shield
Ellipse(3) = {7,2,7,8}; // z=CableLength; Cond.
Ellipse(4) = {9,2,10,10};// z=CableLength; Shield
//
Line(5) = {3,7}; // Cond.
Line(6) = {4,8}; // Cond.
Line(7) = {5,9}; // Shield
Line(8) = {6,10}; // Shield
// Symmetry cuts:
Line(9) = {3,6}; // z=0; x-dir
Line(10) = {4,5}; // z=0; y-dir
Line(11) = {7,10}; // z=CableLength; x-dir
Line(12) = {8,9}; // z=CableLength; y-dir
///////////////////////////////////
// Surfaces:
// z=0; Cable end
Line Loop(13) = {2,-9,1,10};
Plane Surface(14) = {13};

// z=CableLength; Cable end
Line Loop(15) = {-11,3,12,4};
Plane Surface(16) = {15};

// Symmetry cut:
Line Loop(17) = {7,-12,-6,10};
Plane Surface(18) = {17};

// Symmetry cut:
Line Loop(19) = {8,-11,-5,9};
Plane Surface(20) = {19};

// Conductor:
Line Loop(21) = {6,-3,-5,1};
Ruled Surface(22) = {21};

// Shield:
Line Loop(23) = {8,-4,-7,2};
Ruled Surface(24) = {23};

///////////////////////////////////
// Volume:
Surface Loop(25) = {20,24,16,22,18,14};
Volume(26) = {25};

///////////////////////////////////
// Physical elements:
Physical Volume(100) = { 26 };

// physical surfaces:
// symmetry cuts:
Physical Surface(101) = { 20, 18 };
// Conductors with zero boundary conditions:
Physical Surface(102) = { 16, 22, 24 };
// Cable end at z=0:
Physical Surface(103) = { 14 };

/*
 postprocessing mode, 
 gmsh coax-ellipse.geo -p -noview -option coax-ellipse.opt
*/