# Identifying 3D domain boundaries

Hello Everyone,
Can anyone suggest me for accessing a particular boundary of 3d shaped problem domain?

in the case of the unit cube box, how the numbering starts for boundaries here.

Hi,

try to open your mesh in GMSH. Click on the visibility and check each surface.

Hi !

Default numbering of the cube sides obtained by function “cube”, i.e.

mesh3 Th = cube(3, 4, 5);

are given in documentation. Go to: Documentation → The type mesh3 in 3 dimension → The command cube ( Mesh Generation ).

Alternatively, ‘a nice trick’ is to create a little playground and figure out the labels, e.g.

mesh3 Th = cube(6, 6, 6);
{
fespace Vh(Th,P1);
Vh uh;

``````    int lab=5;
varf bdryID([u],[v]) = on(lab,u=1);
uh[] = bdryID(0,Vh,tgv=1);

plot(uh,fill=1,wait=1,cmm="label = "+lab);
``````

}

Varying the variable “lab” from 1 to 6 will plot you which side is which label.

In case of general mesh where the integer names of the sides are not known, you can always play a bit with mesh connectivity to figure out the distinct boundary labels, e.g.

for(int k=0; k<Th.nbe; ++k) cout << Th.be(k).label << endl;

will print all the boundary elements labels ( Mesh Generation ). Of course, in your real code you will want to optimize this to print only the distinct labels, each only once. The ‘mesh connectivity’ approach is (most likely) the way to go if you do not wish to involve other software which allows you to see the boundary labels (as recommended by @Pitagoras1 ). In general, the function “.be(int)” gives you access to certain boundary element (e.g. Th.be(k) ).

Hope this helps,
if

1 Like

Thanks, @fivanci, for a detailed solution. It really helped me to a quick start on 3d problems.

I’ll ask further if some doubts would arise further.

Check out this post as well,

You can also found boundary labels more conveniently with built-in function “labels” as
int[int] labs = labels(Th);

if

1 Like