SetFactory("OpenCASCADE");

//---------------------------------------
// adjust mesh resolution
//---------------------------------------
Mesh.CharacteristicLengthMin = 0.25;
Mesh.CharacteristicLengthMax = 0.25;

//---------------------------------------
// full-length barrel for simulation
//---------------------------------------
// x1 = 72;
// x2 = 80;
// x3 = 90;

//---------------------------------------
// truncated barrel for setting up mesh
//---------------------------------------
x1 = 7.2;
x2 = 8.0;
x3 = 9.0;

Cylinder(1) = {0, 0, 0, x1, 0, 0, 1.75, 2*Pi};
Cylinder(2) = {0, 0, 0, x2, 0, 0, 1.535, 2*Pi};
BooleanDifference{ Volume{1}; Delete; }{ Volume{2}; Delete; }

Cylinder(2) = { 0, 0,    0,    -2, 0, 0, 4.125, 2*Pi};
Cylinder(3) = {-2, 0,    0,    x3, 0, 0, .35, 2*Pi};
Cylinder(4) = {-2, 0,    1.15, x3, 0, 0, .28, 2*Pi};
Cylinder(5) = {-2, 0,   -1.15, x3, 0, 0, .28, 2*Pi};
Cylinder(6) = {-2, 1.15, 0,    x3, 0, 0, .28, 2*Pi};
Cylinder(7) = {-2,-1.15, 0,    x3, 0, 0, .28, 2*Pi};
BooleanUnion{ Volume{1}; Delete; }{ Volume{2}; Delete; }

BooleanDifference{ Volume{8}; Delete; } { 
      Volume{3}; Volume{4}; Volume{5}; 
      Volume{6}; Volume{7}; Delete; }

// s1 = newsl;
// Surface Loop(s1) = {1,2,3,4,  5,6,  7,8,9,10,11, 12};

Physical Surface("rim1")    = {1};
Physical Surface("wallout") = {2};
Physical Surface("wallin")  = {3};

Physical Surface("disk4")   = {4};
Physical Surface("disk5")   = {5};
Physical Surface("edge6")   = {6};

Physical Surface("inlet1")  = {7};
Physical Surface("inlet2")  = {8};
Physical Surface("inlet3")  = {9};
Physical Surface("inlet4")  = {10};
Physical Surface("inlet5")  = {11};

Physical Surface("disk12")  = {12};

Physical Volume("fluid") = {8};
