// Gmsh project created on Tue Jul 02 09:33:10 2019
SetFactory("OpenCASCADE");

ri=0.102;
re=0.1575;
rcat=0.0248;
rgrafite=0.085;
rceramic=0.175;
ds=0.007;

rbox=0.20;
dbox=0.15;
inter=0.6;

Cylinder(1) = {-dbox, -inter/2.0, 0, dbox, 0, 0, rbox, 2*Pi};
Cylinder(2) = {-dbox,  inter/2.0, 0, dbox, 0, 0, rbox, 2*Pi};

Box(3) = {-dbox, -inter/2, -rbox, dbox, inter, 2*rbox};

BooleanUnion{ Volume{1}; Delete; }{ Volume{3}; Delete; }
BooleanUnion{ Volume{3}; Delete; }{ Volume{2}; Delete; }

Delete {Volume{1}; }

Delete {Surface{11}; Surface{13}; Surface{14}; Surface{12}; }

Delete {Curve{19}; Curve{20}; }

nl=newl;

Circle(nl  ) = {-0, -inter/2, 0, rcat, 0, 2*Pi};
Circle(nl+1) = {-0, -inter/2, 0, rgrafite, 0, 2*Pi};
Circle(nl+2) = {-0, -inter/2, 0, ri-ds, 0, 2*Pi};
Circle(nl+3) = {-0, -inter/2, 0, ri, 0, 2*Pi};
Circle(nl+4) = {-0, -inter/2, 0, re, 0, 2*Pi};
Circle(nl+5) = {-0, -inter/2, 0, re+ds, 0, 2*Pi};
Circle(nl+6) = {-0, -inter/2, 0, rceramic, 0, 2*Pi};

Rotate {{0, 1, 0}, {0, 0, 0}, Pi/2} {
  Curve{nl,nl+1,nl+2,nl+3,nl+4,nl+5,nl+6}; 
}

Translate {-ds, 0, 0} {
  Curve{nl+3}; Curve{nl+4}; 
}

ll=newll;
ns=news;

Curve Loop(ll) = {nl};
Curve Loop(ll+1) = {nl+1};
Curve Loop(ll+2) = {nl+2};
Curve Loop(ll+3) = {nl+3};
Curve Loop(ll+4) = {nl+4};
Curve Loop(ll+5) = {nl+5};
Curve Loop(ll+6) = {nl+6};

Plane Surface(ns) = {ll};
Plane Surface(ns+1) = {ll+1, ll};
Plane Surface(ns+2) = {ll+2, ll+1};
Plane Surface(ns+3) = {ll+4, ll+3};
Plane Surface(ns+4) = {ll+6, ll+5};

nl=newl;

Circle(nl  ) = {-0, inter/2, 0, rcat, 0, 2*Pi};
Circle(nl+1) = {-0, inter/2, 0, rgrafite, 0, 2*Pi};
Circle(nl+2) = {-0, inter/2, 0, ri-ds, 0, 2*Pi};
Circle(nl+3) = {-0, inter/2, 0, ri, 0, 2*Pi};
Circle(nl+4) = {-0, inter/2, 0, re, 0, 2*Pi};
Circle(nl+5) = {-0, inter/2, 0, re+ds, 0, 2*Pi};
Circle(nl+6) = {-0, inter/2, 0, rceramic, 0, 2*Pi};

Rotate {{0, 1, 0}, {0, 0, 0}, Pi/2} {
  Curve{nl,nl+1,nl+2,nl+3,nl+4,nl+5,nl+6}; 
}

Translate {-ds, 0, 0} {
  Curve{nl+3}; Curve{nl+4}; 
}

ll=newll;
ns=news;

Curve Loop(ll) = {nl};
Curve Loop(ll+1) = {nl+1};
Curve Loop(ll+2) = {nl+2};
Curve Loop(ll+3) = {nl+3};
Curve Loop(ll+4) = {nl+4};
Curve Loop(ll+5) = {nl+5};
Curve Loop(ll+6) = {nl+6};

Plane Surface(ns) = {ll};
Plane Surface(ns+1) = {ll+1, ll};
Plane Surface(ns+2) = {ll+2, ll+1};
Plane Surface(ns+3) = {ll+4, ll+3};
Plane Surface(ns+4) = {ll+6, ll+5};

