Hello,
I needed to build a simple tent-like mesh3, by extruding a triangle along the z-axis using the buildlayers command. The tet mesh as such is fine but I need to set the labels of the vertices and triangles at the bottom z=0 and at the top z=length to “outer” in order for the Dirichlet boundary conditions to be applied correctly.
As I understood, this is what the argument labeldown and/or reffacelow of the buildlayers command are for, but neither of them succeed setting the labels of the vertices at z=0 to the label “outer”. Furthermore, I have a hard time understanding the difference in purpose between these two arguments.
In the following script, I expect the labels to be “couted” as label=2 but they come out as either 0 or 6 (which, by the way is a label that I didn’t define - what is its meaning?)
Thank you.
PS: trying func newlabel = (z < 0.01 ) ? outer : label; Th=change(Th, flabel= newlabel);
also didn’t change the labels. Are they readonly for some reason?
load "msh3"
real width=120;
real height=60;
real length=250;
real thickness=7;
real alpha = atan2(height, width/2);
real thicknessx = thickness / sin(alpha);
real thicknessy = thickness / cos(alpha);
int house=1;
int outer=2;
border C0left(t=0,thicknessx)
{x=t;y=0;label=house;}
border C0right(t=0,thicknessx)
{x=width-thicknessx+t;y=0;label=house;}
border C0mid(t=0,width-2*thicknessx){x=thicknessx+t;y=0;label=house;}
border C1(t=0,height){x=width-t/height*width/2; y=t;label=outer;}
border C2(t=0,height){x=width/2-(t/height*width/2); y=height-t;label=outer;}
border C1i(t=0,height-thicknessy)
{
x=width/2+(t/height*width/2);
y=height-thicknessy-t;
}
border C2i(t=0,height-thicknessy)
{
x=width/2-(t/height*width/2);
y=height-thicknessy-t;
}
mesh Th2=buildmesh(
C1(30) +
C2(30) +
C0left(30) +
C0mid(30) +
C0right(30) +
C1i(30) +
C2i(30)
);
plot(Th2,wait=1);
int[int] r4 = [house, outer];
mesh3 Th = buildlayers(
Th2,
length / thickness * 3,
zbound=[0,length],
labeldown=r4 // <-- PROBLEM HERE, does not replace references of vertices at z=0 with label outer=2; does not work with reffacelow either
);
plot(Th,wait=true);
for (int i = 0; i < Th.nt; i++)
for (int j = 0; j < 3; j++)
if (Th[i][j].z < 0.001)
cout << i << " " << j << " - Th[i][j] = " << Th[i][j]
<< ", z= " << Th[i][j].z
<< ", label=" << Th[i][j].label << endl;