TetGen for domains with overlapping facets

Dear FreeFEM comminity,

Is there any example or does anybody know how to mesh, provided feasibility, a domain like the one in the attached code? The problem here is that the subdomain is not strictly contained in the bounding domain, but rather, they have common interfaces. Increasing the bounding box size works but is not an option. The code below works with binary 4.8 on MSW10.

Best Regards,
/Fotios

load "msh3"
load "tetgen"

border a01(t = 0.5   , 1.0   ){x = t         ; y = 0.0       ;}
border a02(t = 0.0*pi, 0.5*pi){x = 1.0*cos(t); y = 1.0*sin(t);}
border a03(t = 1.0   , 0.5   ){x = 0.0       ; y = t         ;}
border a04(t = 0.0*pi, 0.5*pi){x = 0.5*sin(t); y = 0.5*cos(t);}

int n = 100;
mesh T2 = buildmesh(a01(n) + a02(n) + a03(n) + a04(n));
mesh3 T3 = buildlayers(T2, 20, zbound=[0.0, 1.0]);
mesh3 Tb = cube(20, 20, 20, [2.0*x, 2.0*y, -0.5+2.0*z]);

T3 = buildBdMesh(T3); meshS TS3 = T3.Gamma;
Tb = buildBdMesh(Tb); meshS TSb = Tb.Gamma;
meshS TSall = TS3 + TSb;

plot(TSall, wait=true);
//mesh3 Tall = tetg(TSall, switch="paAAYYQ");
1 Like

A way for doing this, although I find it far from a good solution, follows; this approach uses trunc for removing the necessary parts from the surface mesh TS3.

real eps = 1.0e-2;
TS3 = trunc(TS3, x > eps);
TS3 = trunc(TS3, y > eps);

meshS TSall = TS3 + TSb;

mesh3 Tall = tetg(TSall);
plot(Tall, wait=true);