Create common label edges between two object

Hello all,

I have a coarse element (Object 1 in the attached picture) whose labels are 1, 2 and 3.

I have the same element with perforations (Object 2). In the Object 2, all edges have the Label 0.

I want that the common edges between Object 1 and Object 2 have the same label.

Could someone have an idea about the way to do this ?

Thank you in advance,

Best regards,

Loïc,

This is no so difficult
let us call Thc the coarse mesh and Thp the mesh with perforation.

load "msh3"
meshL ThLc= extract(Thc); // border mesh 
fespace Ehc(Thc,P0Edge); //  Constant fonction of edge 
Ehc ul = label+0.5; // get the label on the each boundary edge

Thp = change(Thp, flabel= dist(ThLc) < 1e-6 ? ul : 4) ; 

Now the label of Thp mesh are 1,2,3 of Coarse mesh border and 4 if not on border of ThLc (dist > 1e-6)

Hello @frederichecht ,

Thank you for your reply,

But it seems that this method does not work. I have this code :

  meshL THL= extract(THK); // border mesh
  meshL ThL=extract(ThK);
  fespace Ehc(THL,P0edge); //  Constant fonction of edge
  Ehc ul = label+0.5; // get the label on the each boundary edge
  ThK = change(ThK, flabel= dist(THL) < 1e-6 ? ul : 4 ) ;

And I get this error:

 44 :   meshL THL= extract(THK); // border mesh
   45 :   meshL ThL=extract(ThK);
   46 :   fespace Ehc(THL,P0edge); //  Constant fonction of edge
   47 :   Ehc ul = label+0.5; // get the label on the each boundary edge
   48 :   ThK = change(ThK, flabel= dist(THL) error operator (  <PPKN5Fem2D5MeshLE> 
 List of choices 
	 (	  <d> :   <d>, <d> )
	 (	  <d> :   <d>, <d>, <d> )

 Error line number 48, in file ReadMeshMED.edp, before  token )


Best regards,

Loïc,

I am sorry the dist function is really new (version 4.9)

So new how to say simply we are not on THL .

fespace WHK(THK,P1b); // p1 bubble

Wh ong ;
varf von(u,v) = on(1,2,3,u=1); // 1 on border
ong[]= von(0,WHK,tgv=1); // 1 ON BORDER …
ThK = change(ThK, flabel= ong>0.999999 ? ul : 4 ) ;


My FreeFEM is on version 4.9. So the dist function has to work, isn’t it ?

Loïc

However I have another error.

Here my code:

 meshL THL= extract(THK); // border mesh
  meshL ThL=extract(ThK);
  fespace Ehc(THL,P0edge); //  Constant fonction of edge
  Ehc ul = label+0.5; // get the label on the each boundary edge
  //ThK = change(ThK, flabel= dist(THL) < 1e-6 ? ul : 4 ) ;

  fespace WHK(THK,P1b); // p1 bubble

  WHK ong ;
  varf von(u,v) = on(1,2,3,u=1); // 1 on border
  ong[]= von(0,WHK,tgv=1); // 1 ON BORDER …
  ThK = change(ThK, flabel= ong>0.999999 ? ul : 4 ) ;

and the error:

sorry no cast to this curve finite element 
  current line = 47
Exec error :  sorry no cast to this curve finite element 
   -- number :1
Exec error :  sorry no cast to this curve finite element 
   -- number :1
 err code 8 ,  mpirank 0

Loïc,

Without line number it is impossible to give answer!!!

Hello @frederichecht ,

Sorry for that,


47 meshL THL= extract(THK); // border mesh
48  fespace Ehc(THL,P0edge); //  Constant fonction of edge
49  Ehc ul = label+0.5; // get the label on the each boundary edge
50  fespace WHK(THK,P1b); // p1 bubble
51 WHK ong ;
52  varf von(u,v) = on(1,2,3,u=1); // 1 on border
53 ong[]= von(0,WHK,tgv=1); // 1 ON BORDER …
54 ThK = change(ThK, flabel= ong>0.999999 ? ul : 4 ) ;
 sorry no cast to this curve finite element 
  current line = 48
Exec error :  sorry no cast to this curve finite element 
   -- number :1
Exec error :  sorry no cast to this curve finite element 
   -- number :1
 err code 8 ,  mpirank 0

The error comes from the line fespace Ehc(THL,P0edge);

Besides, I would like to understand why I have not access to the function dist. I think this function will be very useful for me.

Thank you in advance,

Best regards,

Loïc,

remark on 1d element P0edge is P0 so replace P0edge pas P0

I have no error now, but the labels are only 0 et 1.

It seems that ul does not take the value of THK labels. When I display the value of ul, it gives me -0.5 -0.5 -0.5 .

Best regards,

Loïc,

Sorry) But the label on border become region on MeshL

For the list function , you have to install the develop version or a wait the version 4.11

Hello @frederichecht,

Thank you for your message,
Now it works with region (instead of label).

Best regards,

Loïc,