# Define different regions and border in a 3D mesh

Hi to all , i have problems to understand how to define a particular region inside a 3D mesh, and in particular how it works the definition of “labelmid” ecc…

In detail, i have the following mesh:

//Builds a mesh on 3d cylinder with a “full holes”.
real cx1 = 0.0; // cerchio esterno
real cy1 = 0.0;
real r1 = 22.85;

real cx2 = 0.0; // canale centrale
real cy2 = 0.0;
real r2 = 1.905;

real cx3 = 7.058; // shim
real cy3 = 4.075;
real r3 = 1.88;

real cx4 = 0.0; // trans
real cy4 = -12.15;
real r4 = 1.88;

real cx5 = -14.142; // reg
real cy5 = 8.165;
real r5 = 1.88;

real zmin=0, zmax=35.6;
int[int] rup=[0,1], rdown=[0,2], rmid=[1,7];
border C1(t1=0,2pi){x=cx1+r1cos(t1);y=cy1+r1sin(t1);label=1;}; // cerchio esterno
border C2(t1=0,2
pi){x=cx2+r2cos(t1);y=cy2+r2sin(t1);label=2;}; // canale centrale
border C3(t1=0,2pi){x=cx3+r3cos(t1);y=cy3+r3sin(t1);label=3;}; // shim
border C4(t1=0,2
pi){x=cx4+r4cos(t1);y=cy4+r4sin(t1);label=4;}; // trans
border C5(t1=0,2pi){x=cx5+r5cos(t1);y=cy5+r5*sin(t1);label=5;}; // reg

int m=5;
mesh Thcercle = buildmesh(C1(40m)+C2(+10m)+C3(+10m)+C4(+10m)+C5(+10*m));
plot(Thcercle,wait =1);

mesh3 Th3=buildlayers(Thcercle,coef=2, 4*m, zbound=[zmin,zmax],
labelmid=rmid,
labelup = rup,
labeldown = rdown);

plot (Th3);

I want define the region of points included in the 4 “small” cylinder (separatly) and the surface of external cilinder (i suppose it is the “labelmid”), where I will apply a dirichlet condition in my problem.

Anyone can help me, or give me some tips? I read the FF documentation but is not so clear.
Thanks!

P.s. i upload also the original file if can help

triga mesh 3D.edp (1.4 KB)

the way to change the region number with buildmesh construction is

// to get the region number in 2d mesh
int reg1 = Thcercle(cx1,cy1+r1*0.999).region;
int reg2 = Thcercle(cx2,cy2).region;
int reg3 = Thcercle(cx3,cy3).region;
int reg4 = Thcercle(cx4,cy4).region;
int reg5 = Thcercle(cx5,cy5).region;
// to change the region number in 3d mesh

int[int] regv=[reg1,1,reg2,2,reg3,3,reg4,4,reg5,5];
cout << " reg " << reg1 << " " << reg2 << " " << reg3 << " "<< reg4 << " " << reg5 << endl;
mesh3 Th3=buildlayers(Thcercle,coef=2, 4*m, zbound=[zmin,zmax],
labelmid=rmid,
labelup = rup,
labeldown = rdown,region=regv);

thank you very very much for your respond!

1. what is the “correct” definition of rmid, rup, rdown in this case? The one that i propose is ok?

2. the output of cout is " 4 3 2 1 0" so reg1 in 3d mesh is identified by “4”?

3. in my differential problem i write a dirichlet condition like “…+on (4 , u=1e-30)” but on the external surface i haven’t u=0. I write the wrong label?

1. we build a cylinder $\omega\times[0,1]$ before transformation with 3 type of boundary
up part $\omega\times{1}$, down part $\omega\times{0}$ and the cylinder part call mid
$\partial\omega\times[0,1]$. Where Omega is the 2d domain.

2. yes

3. in is case array run and down a wrong because you have a mapping between region number to label
it depend of want you want
// for label of top is 10
int[int] rup=[reg1,10,reg2,10,reg3,10,reg4,10,reg5,10];
// for label of bottom par is 20
int[int] rdown=[reg1,20,reg2,20,reg3,20,reg4,20,reg5,20];

// le label of face of cycle will be 31,32,33,34,35 depending of the label of cercle 1,2,3,4,5
int[int] rmid=[1,31,2,32,3,33,4,34,5,35];