Overlapping Meshes on Boundary After Boolean Operations
I am writing a script that continually adds cylinders with the same length and diameter, but at random orientations and positions in a box until a desired volume fraction is reached. Only the parts of cylinders inside the bounding box are kept, and each cylinder must intersect at least one other cylinder. I am using the fuse command to combine a new cylinder with the main body once it is known to intersect. If two cylinders intersect each other at the edge of the cubic boundary, however, there is some mesh overlap that I am not sure how to handle, which is causing problems when I try to perform finite element analysis on the geometry. I have tried various commands such as gmsh.model.occ.healshapes(), gmsh.model.occ.removeDuplicates(), gmsh.model.mesh.optmize() (with various inputs, such as "UntangleMeshGeometry"), and replacing the fuse command with the fragments command, but to no avail. I have also experimented with different meshing parameters and algorithms.
Here's what the overlap looks like:
Here's the script I'm running: Rotated_Fibers.py