Delete and Change Boundary Labels

Hi there again :slight_smile:

I have a 3D mesh which I refine using parmmg3d. After this refinement, the labels are messed up. In places where I’ve had label 1 before, it has something else and where the mesh was split internally, the label becomes 1 …

This is a picture of how it is before remeshing and how it is supposed to be: 1 on all boundaries.

These are pictures of how it is after remeshing:

(In the first picture the top should still have label 1 and in the second picture the interior should not have label 1.)

First, I thought I can change the labels using change. The two problems I see there is that the interior is on the same label as the boundary (red in the picture above), so if I change either, I persume I will change both and the top and bottom are on no particular label (blue in the picture, has a high negative “label value”), so the program wouldn’t know which faces/edges I want to change.

Now, I was thinking if it’s possible to delete all existing labels and tell the program to set all labels on the boundaries to 1.

The reason I need this is that I do adaptive refining and in each step I refine and then need to solve my eigenvalue problem with dirichlet boundary conditions again.

Best regards and thanks in advance!

Could you please share a minimal working example?

Thanks for your promt reply.
I’ve changed something in the label/region definition of my mesh and now these issues have resolved. What I did, and please correct me if I’ve understood wrongly, is the following: Two circles each with label=1 make the 2D mesh, then when calling buildlayers I use the labels
int[int] labelsup=[0,1], labelsdown=[0,1], labelsmid=[1,1] ;
because there was no region before, I need to map 0->1 for the upper and lower surface?

There is still some strange behaviour though:

  1. If the upper and lower surface have different labels than the middle surface, after calling buildDmesh, the labels of the middle surface on the processes that contain either the upper or lower surface change to the label of the upper/lower surface (see second bunch of medit plots in example).
  2. After remeshing the labels are 0 everywhere on the plot, but somehow my eigenfunction in the end still has zero boundary values (which is weird because my variational formulation is defined to be zero on label 1).

Maybe I’ve misunderstood the usage of this onG variational formulation that I use to see the labels, I’ve found it on this forum.
change-labels.edp (1.8 KB) (note that computing the eigenfunction is not in this minimal example)

I’m not sure I understand your questions. You should probably use ParaView to check this instead of Medit which is difficult to use in parallel. It would be surely easier for me to understand what you want me to see. Also, lines such as lab = lab3 without checking that lab.n = lab3.n are illegal, your script does not run in debug mode.

I’m sorry for being unclear.

I don’t know why it ran when I made this, but redefining lab and the varf onG each time when looking at the labels more or less resolved the problem.
Sorry for wasting your time and thanks a bunch for helping!

I don’t know why it ran when I made this

Because you are probably not configuring FreeFEM with debugging mode turned on.

thanks a bunch for helping!

No problem.