Regions and Boundaries

Hi there!
I’m trying to model some cylinders thanks to FreeFem++. I did following:
0/ Define some constant values
1/ Define borders
border S1(parametre=0,2pi){ x=rinfinicos(parametre); y=rinfinisin(parametre); label=FirstBorder;}
border S2(parametre=0,2
pi){ x=rbcos(parametre); y=rbsin(parametre); label=SecondBorder; }
2/ Mesh 2D
mesh Thdeuxdim=buildmesh( S1(maillage)+S2(maillage) )
3/ Apply buildlayers
mesh3 Th=buildlayers(Thdeuxdim, nombreextrusions, zbound=[fond,surface]);
fespace Vh(Th,P03d);

If I want to get the region number knowing some coordinates (x,y,z), for example (1.,2.,0.) I can do following:
Vh regions=region;
int labelcylindre=regions(1., 2., 0.)
labelcylindre is an integer with the number of a cylinder.

Now, I’d like to apply a boundary condition on a face of the cylinder, let’s say the bottom face z=fond.
Is there a similar method to get the number of the face ? Maybe something like following?
Vh faces=border;
int labelface=faces(1.,2.,fond)

Thank you for your help, have a good evening!

Hi, you can specify the labels for the boundaries when you do the buildlayer :

int[int] rup=[0,labsTop], rdown=[0,labsBottom], rmid=[0,labsSide];
mesh TT2d=buildmesh(circle(npts));
labelup=rup, labeldown=rdown);

where labsTop, labsBottom, labsSide are the labels you choose

Thank you Julien !

I’ll test it as soon as possible. Just to be sure that I understand: if I want to apply my boundary condition on the bottom face of the cylinder which contains the point (x,y,z)=(1.,2.,0.), then I can use following:

+on((reg,labsBottom), u=condition)
where reg=regions(1., 2., 0.) and labsBottom is computed thanks to the 4 lines you wrote ?

Good afternoon,

I would say just

+on(labsBottom, u=condition)

the label labsBottom denotes the whole lower disc of your cylinder

It sounds a bit strange to me : as you can state, I defined 2 circles S1 and S2. The first one is the full domain where I want to compute the FEM, the second one is the object which produces a thermal effect. “Thdeuxdim”, that is “TT2d” in your message, is the mesh with these 2 objects.

If I follow your logic, I do not understand how the computer should “know” that my boundary condition is to be applied on the bottom face of my second object, and not on the bottom face of both (that is : including the full domain) ?