Elements with several labels


I have been trying to compute integral on a label surface Sr using imported mesh from GMSH.

There are 2 surfaces : Sr and Si.

Several elements are on Sr AND Si and other only on Sr or Si. They are (normally) well defined in the .msh file following:

Element id - Element dimension - Number of tags - < Tags > - Nodes

When I try to compute: int2d(Th,Sr) (1.) ,

it only integrates on elements which are only on Sr. Elements which are on Sr AND Si are not taken into account.

It may be a basic problem but I haven’t found similar issues. Sorry if solution has been already provided.

Best regards,


You need to compute int2d(Th,Sr,Si) (1.).

It’s not what I am looking for. Sorry, it may be not clear.

I want to integrate on all elements of Sr.

But in the definition of the elements in .msh file, some belong to Sr (case 1), and some belong Sr and Si (case 2), such as:

Case 1:
Element Id - 2 - 1 - Sr - Nodes

Case 2:
Element Id - 2 - 2 - Sr - Si - Nodes

Elements of case 2 are not taken into account in the integral.

In FreeFEM, elements only have a single region. Boundary elements have only a single label. If Sr and Si are boundary element labels, my answer still holds.

In FreeFEM, elements only have a single region.

I ignored that. Thank you. I managed to do it in a different way by creating an other label : SrSi ( Sr ∩ Si ).

And I integrate on Sr and Sr ∩ Si :int2d(Th,Sr,SrSi) (1.)

Thanks @prj