Hello Freefem community,

I am experimenting with the mesh script with two disks D1=B(0,r1), D2=B((r1/2,0), r2), as in https://doc.freefem.org/documentation/mesh-generation.html, in the case when the boundaries of D1, D2 are tangent.

Freefem handles the mesh well in particular cases, namely, if m2=k*m1, where m1, m2 are the number of nodes on \partial D1, \partial D2, and k within a certain range. Out of this range, Freefem complains with “Meshing error: Bamg” error - I have included the code below for more clarity.

It is clear that there is no miracle solution in the case of tangent boundaries, but still, depending on the algorithm used, my question is if there is any recipe for the ratio k.

Thank you!

PS: It may be a topic discussed earlier, still my searches for an answer were unsuccessful

/////////////////////////////////////////////

real k=1.6;

// ok for: k in [0.1,1.6]

int m1=50, m2=k*m1;

cout << “m1=” << m1 << “; m2=” << m2 << endl;

real r1=2, r2=1;

//

border a(t=0, 2*pi){x=r1*cos(t); y=r1*sin(t); label=1;}
border b(t=0, 2*pi){x=r1/2+r2

*cos(t); y=r2*sin(t); label=2;}

//

plot(a(m1) + b(m2), wait=1, dim=2); //to see a plot of the border mesh

//

mesh Thwithouthole = buildmesh(a(m1) + b(m2));

mesh Thwithhole = buildmesh(a(m1) + b(-m2));

//

plot(Thwithouthole, wait=1);

plot(Thwithhole, wait=1)