Combine Multiple Meshes

Dear All,

I’m encountering an error while attempting to combine multiple meshes, and I’m having trouble understanding why this error persists even after adjusting the orientation.
error : “Bug in mortar constrution : close to vertex 9
current line = 14
Assertion fail : (linkd[is] == -2)
line :380, in file …/femlib/fem.cpp”

Below is the code I’ve been using:

int a = 2;

int m = 10;
int SD = m;
int HC = m;
int Bar = m;
int bar = m;
int SC = m;

border C1(t=0, 1.5){x=3-2t; y=0; label=99;};
border C2(t=0, 1){x=3; y=2
t-2; label=99;};
border C3(t=0, 1){x=3+(a/2)(1-t); y=-2; label=99;};
border C4(t=0, 1){x=a
2; y=-2+a*(1-t); label=99;};
border C5(t=0, 1.5){x=a2+2(1.5-t); y=0; label=99;};
border C6(t=0, 1){x=7; y=-2*(1-t); label=99;};
border C7(t=0, 1){x=7+(a/2)(1-t); y=-2; label=99;};
border C8(t=0, 1){x=a
4; y=-2+a*(1-t); label=99;};
border C9(t=0, 1.5){x=8+2*(1.5-t); y=0; label=99;};
border C10(t=0, 1){x=11; y=a*(1-t); label=99;};
border C11(t=0, 1.5){x=11-a*(1.5-t); y=a; label=99;};
border C12(t=0, 1){x=8; y=a+a*(1-t); label=99;};
border C13(t=0, 1){x=8-(a/2)(1-t); y=a2; label=99;};
border C14(t=0, 1){x=7; y=4-a*(1-t); label=99;};
border C15(t=0, 1.5){x=7-a*(1.5-t); y=2; label=99;};
border C16(t=0, 1){x=4; y=a+a*(1-t); label=99;};
border C17(t=0, 1){x=4-(a/2)(1-t); y=a2; label=99;};
border C18(t=0, 1){x=3; y=4-a*(1-t); label=99;};
border C19(t=0, 1.5){x=3-2*(1.5-t); y=2; label=99;};
border C20(t=0, 1){x=0; y=a-a*(1-t); label=99;};

// Contact1
border C21(t=0, 0.5){x=-1t; y=0; label=1;};
border C22(t=0,2){x=0; y=1
t; label=1;};
border C23(t=0, 0.5){x=-0.5+1t; y=2; label=1;};
border C24(t=0, 2){x=-0.5; y=2-1
t; label=1;};

// Contact2
border C25(t=0, 0.5){x=3; y=-2-1t; label=1;};
border C26(t=0, 1){x=3+1
t; y=-2.5; label=1;};
border C27(t=0, 0.5){x=4; y=-2.5+1t; label=1;};
border C28(t=0, 1){x=3+1
t; y=-2; label=1;};

// Contact3
border C29(t=0, 0.5){x=3; y=4.5-1t; label=1;};
border C30(t=0, 1){x=4-1
t; y=4; label=1;};
border C31(t=0, 0.5){x=4; y=4+1t; label=1;};
border C32(t=0, 1){x=4-1
t; y=4.5; label=1;};

// Contact4
border C33(t=0, 0.5){x=7; y=-2-1t; label=1;};
border C34(t=0, 1){x=7+1
t; y=-2.5; label=1;};
border C35(t=0, 0.5){x=8; y=-2.5+1t; label=1;};
border C36(t=0, 1){x=7+1
t; y=-2; label=1;};

// Contact5
border C37(t=0, 0.5){x=11+1t; y=0; label=1;};
border C38(t=0, 2){x=11.5; y=1
t; label=1;};
border C39(t=0, 0.5){x=11.5-1t; y=2; label=1;};
border C40(t=0, 2){x=11; y=1
t; label=1;};

// Contact6
border C41(t=0, 0.5){x=7; y=4.5-1t; label=1;};
border C42(t=0, 1){x=8-1
t; y=4; label=1;};
border C43(t=0, 0.5){x=8; y=4+1t; label=1;};
border C44(t=0, 1){x=8-1
t; y=4.5; label=1;};

func Hallbar = C1(-Bar)+C2(-bar)+C3(-HC)+C4(-bar)+C5(-Bar)+C6(-bar)+C7(-HC)+C8(-bar)+C9(-Bar)+C10(-SD)+C11(-Bar)+C12(-bar)+C13(-HC)
+C14(-bar)+C15(-Bar)+C16(-bar)+C17(-HC)+C18(-bar)+C19(-Bar)+C20(-SD);
plot(Hallbar, dim=2, wait=1);

func Contacts = C21(-SC)+C22(SD)+C23(-SC)+C24(SD)+C25(SC)+C26(HC)+C27(SC)+C28(-HC)+C29(SC)+C30(-HC)+C31(SC)+C32(HC)
+C33(SC)+C34(HC)+C35(SC)+C36(-HC)+C37(SC)+C38(SD)+C39(SC)+C40(-SD)+C41(SC)+C42(-HC)+C43(SC)+C44(HC);
//#plot(Contacts, dim=2, wait=1);

mesh Th = buildmesh(Hallbar+Contacts);
plot(Th,wait=1);

Thank you in advance!