Can mshr.generate_mesh be stuck in infinte loop?
I use mshr to create meshes for the computation of shape functions in a ms-gfem with oversampling.
Therefore i use the csg interface of mshr to specify domains with inclusions and an inner area using subdomains.
Here is an abridged code sample, where setting
high enough will cause
to run seemlingly forever.
from dolfin import * from mshr import * import numpy as np import numpy.random as rnd resolution=2**5 number=1000 print('creating coordinates and radii') nodes =  radii =  count = 0 while count < number: tmp = 2*rnd.rand(2)-1 rad = 4*rnd.rand()/number ok = True for ii in range(len(nodes)): dist = np.sqrt((tmp-nodes[ii])@(tmp-nodes[ii])) if dist < 1.5*(rad+radii[ii]): ok = False break if ok: nodes.append(tmp) radii.append(rad) count += 1 print('creating csg objects') domain = Rectangle(Point(-1,-1),Point(1,1)) inside = Circle(Point(0,0),0.5,200) outside = domain-inside inclusions = Circle(Point(*nodes),radii,100) for ii in range(1,number): inclusions += Circle(Point(*nodes[ii]),radii[ii],100) domain.set_subdomain(1, inside*inclusions) domain.set_subdomain(2, outside-inclusions) domain.set_subdomain(3, outside*inclusions) print('meshing') mesh = generate_mesh(domain, resolution) mf = MeshFunction('size_t', mesh, 2, mesh.domains()) print('write') out = XDMFFile(mpi_comm_world(), 'cells.xdmf') out.write(mf) del out print('done')
It appears to me that
seems to be stuck in an infinite loop or frozen or deadlocked.
From what i've seen the process still seems to be running, but I have no clue to what and if to a finite end.
Is the method guaranteed to terminate, i.e. do I only have to wait longer?
Or is it possible that there is a freeze/deadlock/infinite loop somewhere?
Most importantly, can I "configure" mshr/generate_mesh such that the method is guaranteed to terminate?
Thanks, I am well aware of the code sample working for small numbers.
I am, however, interested in a large number of inclusions, i.e. number > 1000, because that's the interesting case for the application, composite materials, I'm working on.
Also, I have no idea if or if not mshr is still working on my computer because the process is still running, memory consumption is still far from the computer's limits and I simply have no clue if the process is going to finish or not.