// Gmsh project created on Wed March 04 11:45:26 2015


nm = 1.e-09;
lc = 1000. * nm;
xsize = 20000.*nm;
ysize = 20000.*nm;
zsize = 10000.*nm;
SiO2thickness = 40.*nm;
LineYSize = ysize-1000.*nm; // Making it a bit shorter avoids making the plane faces coincide
LineXSize = 85.*nm;
LineXSize1 = 70.*nm;
LineZSize1 = 22.5*nm;
LineZSize2 = 15.*nm;
LineDepth = 150.*nm;


// Points defining a rectangle at SiO2/wafer interface
Point(1) = {-xsize/2.,-ysize/2., 0., lc}; 
Point(2) = {xsize/2.,-ysize/2.,0., lc};
Point(3) = {xsize/2.,ysize/2.,0.,lc};
Point(4) = {-xsize/2.,ysize/2.,0.,lc};

// Points defining a rectangle at SiO2/vacuum interface
Point(5) = {-xsize/2.,-ysize/2., -SiO2thickness, lc}; 
Point(6) = {xsize/2.,-ysize/2.,-SiO2thickness, lc};
Point(7) = {xsize/2.,ysize/2.,-SiO2thickness, lc};
Point(8) = {-xsize/2.,ysize/2.,-SiO2thickness, lc};

//Points defining a rectangle at the meshed vacuum surface farthest from wafer
Point(9) = {-xsize/2.,-ysize/2., -zsize,lc}; 
Point(10) = {xsize/2.,-ysize/2.,-zsize,lc};
Point(11) = {xsize/2.,ysize/2.,-zsize,lc};
Point(12) = {-xsize/2.,ysize/2.,-zsize,lc};




//Points defining a rectangle at the PMMA surface nearest the SiO2/vacuum interface
zval1 = -SiO2thickness; // -40nm
xll = -LineXSize/2.; // -42.5nm
yll = -LineYSize/2; // -9.5 microm
xur = LineXSize/2.; // 42.5nm
yur = LineYSize/2; // 9.5 microm
Point(13) = {xll,yll, zval1,lc}; 
Point(16) = {xll,yur, zval1,lc}; 

//Points defining a rectangle at the Line surface farthest from the SiO2/vacuum interface
zval2 = -SiO2thickness - LineDepth + LineZSize1;
//Point(17) = {xll,yll, zval2,lc}; 
//Point(20) = {xll,yur, zval2,lc};

xll1 = -LineXSize1/2.; // -35nm
xur1 = LineXSize1/2.; // 35nm

//Point(21) = {xll1,yll, zval2,lc}; 
//Point(24) = {xll1,yur, zval2,lc};

zval3 = -SiO2thickness - LineDepth + LineZSize2;
//Point(25) = {xll1,yll, zval3,lc}; 
//Point(28) = {xll1,yur, zval3,lc};

zval4 = -SiO2thickness - LineDepth;
Point(29) = {xll,yll, zval4,lc}; 
Point(32) = {xll,yur, zval4,lc};

Point(33) = {-xsize/3.,yll, zval1, lc};
Point(36) = {-xsize/3.,yur, zval1, lc};
Point(37) = {-xsize/3.,yll, zval4, lc};
Point(40) = {-xsize/3.,yur, zval4, lc};



Line(1) = {2, 3};
Line(2) = {3, 4};
Line(3) = {4, 1};
Line(4) = {1, 2};
Line(5) = {6, 7};
Line(6) = {7, 8};
Line(7) = {8, 5};
Line(8) = {5, 6};
Line(9) = {1, 5};
Line(10) = {2, 6};
Line(11) = {3, 7};
Line(12) = {4, 8};
Line(13) = {13, 16};
//Line(15) = {13, 17};
//Line(17) = {16, 20};

//Circle(19) = {17, 21, 25};
//Circle(21) = {20, 24, 28};
//Line(23) = {28, 32};

Line(14) = {16, 32};
Line(15) = {32, 29};
Line(16) = {29, 13};
Line(17) = {16, 36};
Line(18) = {36, 40};
Line(19) = {40, 32};
Line(20) = {13, 33};
Line(21) = {33, 37};
Line(22) = {37, 29};
Line(23) = {40, 37};
Line(24) = {36, 33};
Line(25) = {12, 9};
Line(26) = {9, 10};
Line(27) = {10, 11};
Line(28) = {11, 12};
Line(29) = {12, 8};
Line(30) = {5, 9};
Line(31) = {11, 7};
Line(32) = {10, 6};




Line Loop(33) = {17, 18, 19, -14};
Plane Surface(34) = {33};
Line Loop(35) = {19, 15, -22, -23};
Plane Surface(36) = {35};
Line Loop(37) = {22, 16, 20, 21};
Plane Surface(38) = {37};
Line Loop(39) = {17, 24, -20, 13};
Plane Surface(40) = {39};
Line Loop(41) = {13, 14, 15, 16};
Plane Surface(42) = {41};
Line Loop(43) = {24, 21, -23, -18};
Plane Surface(44) = {43};
Line Loop(45) = {2, 3, 4, 1};
Plane Surface(46) = {45};
Line Loop(47) = {7, 8, 5, 6};
Plane Surface(48) = {39, 47};
Line Loop(49) = {2, 12, -6, -11};
Plane Surface(50) = {49};
Line Loop(51) = {11, -5, -10, 1};
Plane Surface(52) = {51};
Line Loop(53) = {4, 10, -8, -9};
Plane Surface(54) = {53};
Line Loop(55) = {3, 9, -7, -12};
Plane Surface(56) = {55};
Line Loop(57) = {25, 26, 27, 28};
Plane Surface(58) = {57};
Line Loop(59) = {31, -5, -32, 27};
Plane Surface(60) = {59};
Line Loop(61) = {29, 7, 30, -25};
Plane Surface(62) = {61};
Line Loop(63) = {29, -6, -31, 28};
Plane Surface(64) = {63};
Line Loop(65) = {30, 26, 32, -8};
Plane Surface(66) = {65};

Surface Loop(67) = {58, 62, 64, 60, 66, 48, 40};
Surface Loop(68) = {36, 34, 44, 38, 42, 40};
Volume(69) = {68};
Volume(70) = {68, 67};
Surface Loop(71) = {50, 46, 56, 54, 52, 48, 40};
Volume(72) = {71};

Physical Volume(300) = {70};
Physical Volume(200) = {69};
Physical Volume(100) = {72};
Physical Surface(3) = {58};
Physical Surface(2) = {44, 36, 40, 34, 42, 38};
Physical Surface(1) = {46};

Field[1] = MathEval;
Field[1].F= "1.*(0.000000001+Sqrt(1./0.000001)*(((x-0)^4/((0.000001)^2+(x-0)^2))+((y-0)^4/((0.000001)^2+(y-0)^2))+((z-0.00000004)^4/((0.0000005)^2+(z-0.00000004)^2)))^(0.75))";
Mesh.CharacteristicLengthFromPoints = 0;
Mesh.CharacteristicLengthMax = 0.01; // 1 cm maximum mesh size
Background Field = 1;
