// Everything is parameterized on the cylinder radius
// unit centimeter selected
 rad = 0.002;
 
 //Characteristic length - used for mesh sizing
 lc = 4*rad;
 
 //Plane dimesions
 planeLength = 25;
 planeWidth = 25;
 
 //Cyclinder constants
 //cir_x = 100*rad;          //The absolute X distance of the center
// cir_y = planeWidth / 2;  //The absolute Y distance of the center
 //
cir_x = 1;          //The absolute X distance of the center
cir_y = 1;  //The absolute Y distance of the center

 //The bottom plane number
 bottomPlaneNum = 16;
 
 //The extrusion thickness
 extThickness = 10;
 zBottom = -(extThickness/5.0);
 zTop    =  (extThickness/5.0);
 z = zBottom;   //The z-height of this plane. 
                // NOTE - For 2D, the plane is centered at 0, so
                // the z value used will be -(h/2) 
 
//Rectangular plane (Counter-clockwise, starting in lower left corner)
 Point(1) = {0,           0,          z, lc};
 Point(2) = {planeLength, 0,          z, lc};
 Point(3) = {planeLength, planeWidth, z, lc};
 Point(4) = {0,           planeWidth, z, lc};
// first cathode plane
Point(5) = {1, 1     ,   z+1, lc};
Point(6) = {1+0.0025, 1,     z+1, lc};
Point(7) = {1+0.0025,planeWidth-2, z+1, lc};
Point(8) = {1, planeWidth-2, z+1, lc};
// seconde cathode plane
Point(9) = {1, 1   ,    z+3, lc};
Point(10) = {planeLength-2, 1,    z+3, lc};
Point(11) = {planeLength-2,1+0.0025, z+3, lc};
Point(12) = {1, 1+0.0025, z+3, lc};

 //Circle ( for Extruding circle into a cylinder )


 Point(13) = {cir_x,       cir_y,      z+2, lc};    // Center point
 Point(14) = {cir_x + rad, cir_y,      z+2, lc};    // 12 o'clock
 Point(15) = {cir_x,       cir_y + rad,z+2, lc};    // 3
 Point(16) = {cir_x - rad, cir_y,      z+2, lc};    // 6
 Point(17) = {cir_x,       cir_y - rad, z+2, lc};
//
 
//Lines
// cube
 Line(1) = {1, 2};
 Line(2) = {2, 3};
 Line(3) = {3, 4};
 Line(4) = {4, 1};
//
//first cathode plane
Line(5) = {5, 6};
Line(6) = {6, 7};
Line(7) = {7, 8};
Line(8) = {8, 5};
//
// seconde cathode plane
Line(9) = {9, 10};
Line(10) = {10, 11};
Line(11) = {11, 12};
Line(12) = {12, 9};
//
Circle(13) = {14,13,15};
Circle(14) = {15,13,16};
Circle(15) = {16,13,17};
Circle(16) = {17,13,14};
//
Line Loop(17) = {1, 2, 3, 4};        // cube
Line Loop(18) = {5, 6, 7, 8};       //first cathode plane
Line Loop(19) = {9, 10, 11, 12};     // seconde cathode plane
Line Loop(20) = {13,14,15,16};       // cylinder (Anode wire)
 
 
 //Surface
 // Don't add any line loop(s) specific to meshing
Plane Surface(21) = {17};    // cube
Plane Surface(22)={18};      // first cathode plane
Plane Surface(23) = {19};    // seconde cathode plane
Plane Surface(24) = {20};    // cylinder (Anode wire)

//  ** add surface first cathode

Translate {0.5, 0.0, 0.0} {
     Duplicata{Surface{22};}
 }

Translate {1.0, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }
Translate {1.5, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }
Translate {2.0, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }

Translate {2.5, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }

Translate {3.0, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }

Translate {3.5, 0.0, 0.0} {
      Duplicata{Surface{22};}
 }

//  ** add surface seconde cathode

Translate {0, 0.5, 0.0} {
     Duplicata{Surface{23};}
 }
Translate {0.0, 1.0, 0.0} {
     Duplicata{Surface{23};}
 }
Translate {0.0, 1.5, 0.0} {
     Duplicata{Surface{23};}
 }
Translate {0.0, 2.0, 0.0} {
     Duplicata{Surface{23};}
 }
Translate {0.0, 2.5, 0.0} {
     Duplicata{Surface{23};}
 }
//

 //Extrude the bottom surface in the z direction a total of extThickness units.
 // This extrusion is centered on 0 (from -h/2 to +h/2)
 newSurfs[] = Extrude {0,0,extThickness} { 
   Surface{21};
 };
//
// Extruding circle into a cylinder 
Extrude {23,0,0} {
   Surface{24};
 }

//

//geoExtrude[] = Extrude {0, extThickness, 0} { Line{5:8}; }; 
//

/
 //Name the surfaces
/*
 Physical Surface("topAndBottom") = {bottomPlaneNum, newSurfs[0]};
 Physical Surface("nearAndFar") = {newSurfs[2], newSurfs[4]};
 Physical Surface("outlet") = {newSurfs[3]};
 Physical Surface("inlet") = {newSurfs[5]};
 Physical Surface("cylinder") = {newSurfs[9], newSurfs[8], newSurfs[7], newSurfs[6]};
*/

Physical Volume(1) = {newSurfs[1]};

//Meshing
fineness = 15;

Field[4] = Cylinder;
Field[4].Radius = 1.5*rad;
Field[4].VIn = lc / fineness;
Field[4].VOut = lc / 2;
Field[4].XAxis = 0.0;
Field[4].XCenter = cir_x;
Field[4].YAxis = 0.0;
Field[4].YCenter = cir_y;
Field[4].ZAxis = 1.0;
Field[4].ZCenter = 0.0;

Field[6] = Box;
Field[6].VIn = lc / (fineness / 3);
Field[6].VOut = lc;
Field[6].XMin = cir_x - 3*rad;
Field[6].XMax = cir_x + 10*rad;
Field[6].YMin = cir_y - 3*rad;
Field[6].YMax = cir_y + 3*rad;
Field[6].ZMin = zBottom -0.000001;
Field[6].ZMax = zTop    +0.000001;

// Use minimum of all the fields as the background field
Field[100] = Min;
Field[100].FieldsList = {4, 6};
Background Field = 100;

[/script]
> 
