// Gmsh project created on Wed Feb 22 22:38:44 2017
// Bottom
dx=2.0;
Point(101) = {0, 0, 0, dx};
Point(102) = {64, 0, 0, dx};
Point(103) = {64, 60, 0, dx};
Point(104) = {0, 60, 0, dx};

Point(105) = {64, 60, 40, dx};
Point(106) = {0, 60, 40, dx};

Point(107) = {0, 0, 40, dx};
Point(108) = {64, 0, 40, dx};


Line(201) = {104,103};
Line(202) = {103,102};
Line(203) = {102,101};
Line(204) = {101,104};
Line Loop(5) = {201, 202, 203, 204};
Plane Surface(205) = {5};

Point(70) = {62, 32, 0, dx};
Point(71) = {61, 32, 0, dx};
Point(72) = {63, 32, 0, dx};
Point(73) = {62, 33, 0, dx};
Point(74) = {62, 31, 0, dx};
Circle(113) = {71, 70, 73};
Circle(114) = {73, 70, 72};
Circle(115) = {72, 70, 74};
Circle(116) = {74, 70, 71};
Line Loop(117) = {113, 114, 115, 116};
Plane Surface(118)={117};

// Embed bottom area of vertical production well
//Line {113, 114, 115, 116} In Surface {205};


// Top Horizontal
Point(52) = {2, 60, 18, dx};
Point(53) = {2, 60, 19, dx};
Point(54) = {1, 60, 18, dx};
Point(55) = {3, 60, 18, dx};
Point(56) = {2, 60, 17, dx};
Circle(85) = {55, 52, 53};
Circle(86) = {53, 52, 54};
Circle(87) = {54, 52, 56};
Circle(88) = {56, 52, 55};
Line Loop(89) = {85, 86, 87, 88};
Plane Surface(90)={89};

// Bottom Horizontal
Point(34) = {2, 60, 3, dx};
Point(35) = {3, 60, 3, dx};
Point(36) = {1, 60, 3, dx};
Point(37) = {2, 60, 2, dx};
Point(38) = {2, 60, 4, dx};
Circle(41) = {35, 34, 38};
Circle(42) = {38, 34, 36};
Circle(43) = {36, 34, 37};
Circle(44) = {37, 34, 35};
Line Loop(211) = {41, 42, 43, 44};
Plane Surface(212) = {211};


Line(206) = {106, 105};
Line(207) = {105, 103};
Line(208) = {106, 104};
Line Loop(209) = {206, 207, -201, -208};
Plane Surface(210) = {209};

// embed left
//Line {41, 42, 43, 44, 85, 86, 87, 88} In Surface {210};



Line(213) = {106, 107};
Line(214) = {107, 101};
Line(215) = {107, 108};
Line(216) = {108, 102};
Line(217) = {108, 105};

Line Loop(218) = {213, 214, 204, -208};
Plane Surface(219) = {218};
Line Loop(220) = {214, -203, -216, -215};
Plane Surface(221) = {220};
Line Loop(222) = {216, -202, -207, -217};
Plane Surface(223) = {222};
Line Loop(224) = {213, 215, 217, -206};
Plane Surface(225) = {224};

Surface Loop(226) = {225, 219, 221, 205, 210, 223};
Volume(227) = {226};

Extrude {0, -60, 0} {
  Surface{90, 212};
}

Extrude {0, 0, 40} {
  Surface{118};
}

// embedded lines/surfaces are not a substitute for correct topology! they are
// only provided to embed 0D/1D/2D meshes in 1D/2D/3D ones: not e.g. 1D in 1D,
// or 2D in 2D, or 3D in 3D.

// embed right
//Line {229, 230, 231, 232, 251, 252, 253, 254} In Surface {221};
// Embed top area of vertical production well
//Line {273,274,275,276} In Surface {225};
// Embed wells surface area inside reservoir volume
//Surface {236,240,244,248,258,262,266,270,280,284,288,292} In Volume {227};

Delete {
  Volume{227};
}
Delete {
  Surface{210, 221, 225, 205};
}

Plane Surface(294) = {89, 209, 211};
Line Loop(295) = {273, 274, 275, 276};
Plane Surface(296) = {224, 295};
Plane Surface(297) = {5, 117};
Line Loop(298) = {253, 254, 251, 252};
Line Loop(299) = {232, 229, 230, 231};
Plane Surface(300) = {220, 298, 299};
Surface Loop(301) = {297, 294, 219, 296, 300, 223, 288, 292, 280, 284, 244, 248, 236, 240, 266, 270, 258, 262};
Volume(302) = {301};

// To do intersections automatically you will want to use the new
// SetFactory("OpenCASCADE") mode in recent nightly builds, and the
// "BooleanFragments" operation. See gmsh/demos/boolean for examples (there is
// no official documentation yet).
