Hello all,
I am working wth a particular special geometry for my problem. I glued two bodies with a simple ‘mesh3 body1 + body2;‘ command. However, I now want to identify these two bodies as two different regions. How do I do it? At the end, the new body became a single region but I want it to be two.
Here’s my code:
load “msh3”
load “medit”
// Parameters
real H = 10;
real HH = 1;
real L = 30;
real B = 40;
real W = 15;
int nn=10;
// _ _
//| | | |
//| |_ _ _ _ _| |->4
//|_ _ _ _ _ _|
// | | 3
// | |->2
// |_|
// 1
// 2D mesh
border C1(t=0, H){x=t ; y=0 ; label=1;}
border C2(t=0, 2*H){x=H ; y=t ; label=2;}
border C3(t=H, 3*H){x=t ; y=2*H ; label=3;}
border C4(t=2*H, 5*H){x=3*H ; y=t ; label=4;}
border C5(t=0, H){x=3*H-t ; y=5*H ; label=5;}
border C6(t=0, 2*H){x=2*H ; y=5*H-t; label=6;}
border C7(t=0, 3*H){x=2*H-t ; y=3*H ; label=7;}
border C8(t=3*H, 5*H){x=-H ; y=t ; label=8;}
border C9(t=0, H){x=-H-t; y=5*H ; label=9;}
border C10(t=0, 3*H){x=-2*H ; y=5*H-t ; label=10;}
border C11(t=0, 2*H){x=-2*H+t; y=2*H ; label=11;}
border C12(t=0, 2*H){x=0 ; y=2*H-t ; label=12;}
mesh Th = buildmesh(C1(nn)+C2(nn)+C3(nn)+C4(nn)+
C5(nn)+C6(nn)+C7(nn)+C8(nn)+
C9(nn)+C10(nn)+C11(nn)+C12(nn));
int reg1 = Th(5,20).region;
int[int] regv = [0,1];
cout<<"2D base region ID "<<reg1<<endl;
//plot(Th, wait=true);
func zmin = 0.;
func zmax = H;
int MaxLayer = 5;
int[int] r1 = [12,13];
mesh3 Th3 = buildlayers(Th, MaxLayer, zbound=[zmin, zmax], region = regv);
//plot(Th3);
mesh3 Block = cube(nn, nn, nn, [L*x, B*y, W*z], region = 2);
Block = movemesh(Block,[x-10,y+30,z-2.5]);
//plot(Block);
mesh3 Popsicle = Th3 + Block;
plot(Popsicle);
int body1= Popsicle(5.,30.,5.5).region;
int body2 = Popsicle(5.,20.,1).region;
cout<<"body1 region "<<Imp<<endl;
cout<<"body2 region "<<Bone<<endl;