gmsh question

Hello,

I am using gmsh to build the mesh of several spheres in a box. When I open the mesh file in Mecway, it gives me all of the individual spheres as individual components. Is there a gmsh command to group those spheres into one component? I've tried using physical groups but maybe I'm doing it wrong.

Here's my python gmsh code:

box_id = gmsh.model.occ.addBox(-10, -10, -10, dx+10, dy+10, dz+10)

radius = 0.5
particles = []
for particle_data in xyz_data:
p_name, px, py, pz = particle_data
sphere_id = gmsh.model.occ.addSphere(px, py, pz, radius)
particles.append((3, sphere_id))

out, _ = gmsh.model.occ.fragment([(3, box_id)], particles)

gmsh.model.occ.synchronize()

for p_info in particles:
gmsh.model.addPhysicalGroup(3, [p_info[1]], name="Spheres")
gmsh.model.addPhysicalGroup(3, [out[-1][1]], name="Box")




Thanks for the help!
Frank
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!