// Gmsh project created on Fri May 10 12:05:50 2019
/*
  Reset meshing parameters
  
*/
Mesh.CharacteristicLengthFromPoints = 1;
Mesh.CharacteristicLengthFromCurvature = 1;
Mesh.CharacteristicLengthExtendFromBoundary = 1;
Mesh.MinimumCirclePoints=20;
//
SetFactory("OpenCASCADE");
L=100;
W=100;
H=14;
Cx=5.0;
Cy=50;
RadC = 1.0;
RadJet = 0.25;
//
Hcx =  0.0;
Hcy =  0.0;
Hcz = 14.0;
JetL =  3;
//
Jetx =  Cx;
Jety =  Cy;
Jetz = 5.0;
Hjx = JetL ;
Hjy = 0.0;
Hjz = 0.0;
/*
      Vertical Cylinder generation
      1 Half cylinder
      2 Rotation about Z axis
      3 Union of the two cylinders
*/
Cylinder(1) = {  Cx,   Cy,    0, Hcx, Hcy, Hcz,   RadC, Pi};
Rotate{ {0.0,0.,1.},{Cx, Cy, 0.0}, Pi } { Duplicata{Volume{1};} }
CylVN=BooleanUnion{ Volume{1}; Delete; }{ Volume{2}; Delete; };
/*
         Different synatx to explictely asssign the volume tag
         
      Nozzle Jet generation
      1 Half cylinder
      2 Rotation about X axis
      3 Union of the two cylinders
*/
JetCN = 4;
Cylinder(JetCN) = {Jetx, Jety, Jetz, Hjx, Hjy, Hjz, RadJet, Pi};
RotS=Rotate{{1.0,0.,0.},{Jetx,Jety,Jetz},Pi}{Duplicata{Volume{JetCN};}};
Printf("RotS= %g JetCN = %g  ", RotS, JetCN);
JetVN=2;
BooleanUnion(JetVN)={Volume{JetCN}; Delete;}{Volume{RotS[0]}; Delete;};
/*
         Partition of the volumes in
         non-overlapping volumes 

         The array JointV 
      Nozzle Jet generation
      1 Half cylinder
      2 Rotation about X axis
      3 Union of the two cylinders
*/
JointV[]=BooleanFragments {Volume{CylVN};Delete;}{Volume{JetVN};Delete;};
Printf(" Joint[0]= %g Joint[1]= %g Joint[2]= %g   ", JointV[]);
Delete{ Volume{JointV[1]};}
/*
     Get list of point of Cylinder
*/
LegPoints()= PointsOf{ Volume{JointV[0]}; };
JetPoints()= PointsOf{ Volume{JointV[2]}; };
Printf(" JP[0]= %g JP[1]= %g JP[2]= %g JP[3]=%g JP[4]=%g ", JetPoints[]);
//
//
Characteristic Length{ LegPoints() } = 0.25;
Characteristic Length{ JetPoints() } = 0.05;
// //
// Mesh.CharacteristicLengthFromCurvature = 40;
// //Rotate{ {1.0,0.,0.},{Jetx, Jety, Jetz},-Pi } {Volume{2};} 
// // Box(10)={0.,0.,0.,L,W,H};
// // //
// // BooleanDifference(20) = { Volume{10};Delete; }{ Volume{4};Delete; };
// //
//+
Recursive Delete {
  Surface{13}; Surface{3}; Surface{7}; 
}
//+
Recursive Delete {
  Surface{3}; Surface{13}; 
}
//+
Recursive Delete {
  Surface{13}; 
}
