Missing a surface when fragmenting

Hi Guys

Please refer to the below code.
I have a few circles which are fragmented there after I need a line of nodes which pass through the center of the circles.

The below code is able to to develop that line of nodes for all surfaces expect one as per the attached image. Is there anything that I am missing or doing wrong?

import gmsh
import sys
import meshio

###User inputs
R_overhang = 10 
R_tank = 9
R1 = 8
R2 = 7
R3 = 5
R4 = 3



gmsh.initialize()

# #R_overhand
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R_overhang,1,0)
gmsh.model.occ.addCurveLoop([1] ,2)
gmsh.model.occ.addPlaneSurface([2],1)
#R_tank
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R_tank,3)
gmsh.model.occ.addCurveLoop([3] ,4)
gmsh.model.occ.addPlaneSurface([4],2)
#R1
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R1,5)
gmsh.model.occ.addCurveLoop([5] ,6)
gmsh.model.occ.addPlaneSurface([6],3)
#R2
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R2,7)
gmsh.model.occ.addCurveLoop([7] ,8)
gmsh.model.occ.addPlaneSurface([8],4)
#R3
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R3,9)
gmsh.model.occ.addCurveLoop([9] ,10)
gmsh.model.occ.addPlaneSurface([10],5)
#R4
gmsh.model.occ.addCircle(0.0, 0.0, 0.0,R4,11)
gmsh.model.occ.addCurveLoop([11] ,12)
gmsh.model.occ.addPlaneSurface([12],6)


gmsh.model.occ.addPoint(R_overhang,0,-0.1,1,13)
gmsh.model.occ.addPoint(R_overhang,0,0.1,1,14)
gmsh.model.occ.addPoint(-R_overhang,0,-0.1,1,15)
gmsh.model.occ.addPoint(-R_overhang,0,0.1,1,17)
gmsh.model.occ.addLine(13,14,18)
gmsh.model.occ.addLine(14,17,19)
gmsh.model.occ.addLine(17,15,20)
gmsh.model.occ.addLine(15,13,21)
gmsh.model.occ.addCurveLoop([18,19,20,21] ,13)
gmsh.model.occ.addPlaneSurface([13],7)


#Fragmenting surfaces
frag = gmsh.model.occ.fragment([(2,1)],[(2,2)])
print(frag)
frag = gmsh.model.occ.fragment([(2,2)],[(2,3)])
print(frag)
frag = gmsh.model.occ.fragment([(2,3)],[(2,4)])
print(frag)
frag = gmsh.model.occ.fragment([(2,4)],[(2,5)])
print(frag)
frag = gmsh.model.occ.fragment([(2,5)],[(2,6)])
print(frag)

frag = gmsh.model.occ.fragment([(2,7)],[(2,6)])
print(frag)
frag = gmsh.model.occ.fragment([(2,7)],[(2,8)])
print(frag)
frag = gmsh.model.occ.fragment([(2,7)],[(2,9)])
print(frag)
frag = gmsh.model.occ.fragment([(2,7)],[(2,10)])
print(frag)
frag = gmsh.model.occ.fragment([(2,7)],[(2,11)])
print(frag)
frag = gmsh.model.occ.fragment([(2,7)],[(2,12)])
print(frag)




gmsh.model.occ.synchronize()
gmsh.option.setNumber('Mesh.MeshSizeMin', 0.5)
gmsh.option.setNumber('Mesh.MeshSizeMax', 0.5)



gmsh.model.mesh.generate(2)
gmsh.model.mesh.recombine()
gmsh.option.setNumber("Mesh.SubdivisionAlgorithm", 1)
gmsh.model.mesh.refine()

gmsh.write("Circle.msh")
if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()


You can pass multiple objects and tools to fragment. Also, you can fragment using lower-dimensional entities, such as lines:

import gmsh
import sys

# import meshio

###User inputs
R_overhang = 10
R_tank = 9
R1 = 8
R2 = 7
R3 = 5
R4 = 3

gmsh.initialize()

# #R_overhand
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R_overhang, 1, 0)
gmsh.model.occ.addCurveLoop([1], 2)
gmsh.model.occ.addPlaneSurface([2], 1)
# R_tank
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R_tank, 3)
gmsh.model.occ.addCurveLoop([3], 4)
gmsh.model.occ.addPlaneSurface([4], 2)
# R1
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R1, 5)
gmsh.model.occ.addCurveLoop([5], 6)
gmsh.model.occ.addPlaneSurface([6], 3)
# R2
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R2, 7)
gmsh.model.occ.addCurveLoop([7], 8)
gmsh.model.occ.addPlaneSurface([8], 4)
# R3
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R3, 9)
gmsh.model.occ.addCurveLoop([9], 10)
gmsh.model.occ.addPlaneSurface([10], 5)
# R4
gmsh.model.occ.addCircle(0.0, 0.0, 0.0, R4, 11)
gmsh.model.occ.addCurveLoop([11], 12)
gmsh.model.occ.addPlaneSurface([12], 6)

gmsh.model.occ.addPoint(R_overhang, 0, 0, 1, 13)
gmsh.model.occ.addPoint(-R_overhang, 0, 0, 1, 14)
gmsh.model.occ.addLine(13, 14, 18)

# Fragmenting surfaces
frag = gmsh.model.occ.fragment([(2, 1)], [(2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (1, 18)])

gmsh.model.occ.synchronize()
gmsh.option.setNumber('Mesh.MeshSizeMin', 0.5)
gmsh.option.setNumber('Mesh.MeshSizeMax', 0.5)

gmsh.model.mesh.generate(2)
gmsh.model.mesh.recombine()
gmsh.option.setNumber("Mesh.SubdivisionAlgorithm", 1)
gmsh.model.mesh.refine()

gmsh.write("Circle.msh")
if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()
2 Likes