Merge "area_circle.brep";
//+
SetFactory("OpenCASCADE");


//inner_circle
Line Loop(1) = {1,2,3,4};
Line Loop(2) = {5,6,7,8};

//Plane
Plane Surface(1) = {1};
Plane Surface(2) = {2,1};


//add_curves physical


//+ Boundarylayer
// Variables
nb_layer = 1;
layerthickness = 0.30;
hfar_l = 0.3;
hwall_nl = 0.13;
layersize = 0.1;


Field[1] = BoundaryLayer;
Field[1].EdgesList = {1,2,3,4};
Field[1].hfar = hfar_l;
Field[1].hwall_n = hwall_nl;
Field[1].thickness = layerthickness;
Field[1].ratio = 1.1;
Field[1].IntersectMetrics = 1;
Field[1].ExcludedSurfacesList = {2};
Field[1].Quads = 1;

BoundaryLayer Field = 1;
Field[1].NbLayers = nb_layer;
Field[1].Size = layersize;


//+
Field[2] = BoundaryLayer;
Field[2].EdgesList = {1,2,3,4,5,6,7,8};
Field[2].hfar = hfar_l;
Field[2].hwall_n = hwall_nl;
Field[2].thickness = layerthickness;
Field[2].ratio = 1.1;
Field[2].IntersectMetrics = 1;
Field[2].ExcludedSurfacesList = {1};
Field[2].Quads = 1;

BoundaryLayer Field = 2;
Field[2].NbLayers = nb_layer;
Field[2].Size = layersize;



//+
Physical Surface("inlet_inner", 9) = {1};
//+
Physical Surface("inlet_outer", 10) = {2};
//+

// Extrusion
z_dim = 320; // length in mm

//+
// 320 for 32cm in z-Direction (10 lengthunits = 1cm)
// 160 for layers in z-Direction (note that after 3D Meshing the layers will be doubled, 10 layer per 10 lenghtunits)
Extrude {0, 0, z_dim} {
  Surface{1}; Surface{2}; Layers {z_dim/4}; Recombine;
}

// grouped surfaces and Volumina
//+
Physical Volume("pipe_and_sweep", 25) = {1};
//+
Physical Surface("outlet_inner", 26) = {7};
//+
Physical Surface("outlet_outer", 27) = {12};
//+
Physical Surface("mantle_outer", 28) = {11, 8, 9, 10};
//+
Physical Surface("membrane", 29) = {3, 4, 5, 6};



