Skip to content

physical groups #397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mgenet opened this issue Nov 11, 2020 · 2 comments · May be fixed by #423
Closed

physical groups #397

mgenet opened this issue Nov 11, 2020 · 2 comments · May be fixed by #423

Comments

@mgenet
Copy link

mgenet commented Nov 11, 2020

Hello,

I upgraded pygmsh to 7.1.2, and I am a little confused by the new behavior with physical groups. Basically, adding physical groups using geom.add_physical does nothing, and I am getting all points, edges and cells in the output mesh; it used to work fine. What would be the proper way to handle physical groups now? Thank you so much!

Martin

PS: Here is MWE:

R = 1
L = 3
l = 1
with pygmsh.geo.Geometry() as geom:
    p0 = geom.add_point([0, 0, 0], l)
    p1 = geom.add_point([R, 0, 0], l)
    p2 = geom.add_point([0, R, 0], l)
    p3 = geom.add_point([0, L, 0], l)
    p4 = geom.add_point([L, L, 0], l)
    p5 = geom.add_point([L, 0, 0], l)

    l1 = geom.add_circle_arc(p1, p0, p2)
    l2 = geom.add_line(p2, p3)
    l3 = geom.add_line(p3, p4)
    l4 = geom.add_line(p4, p5)
    l5 = geom.add_line(p5, p1)

    ll = geom.add_curve_loop([l1, l2, l3, l4, l5])

    s = geom.add_plane_surface(ll)
    geom.add_physical(s) # this seems to do nothing

    pygmsh_mesh = geom.generate_mesh()
pygmsh_mesh.points # this contains [0,0,0]

PPS: This worked in 6.1.1:

R = 1
L = 3
l = 1
geom = pygmsh.built_in.Geometry()
p0 = geom.add_point([0, 0, 0], l)
p1 = geom.add_point([R, 0, 0], l)
p2 = geom.add_point([0, R, 0], l)
p3 = geom.add_point([0, L, 0], l)
p4 = geom.add_point([L, L, 0], l)
p5 = geom.add_point([L, 0, 0], l)

l1 = geom.add_circle_arc(p1, p0, p2)
l2 = geom.add_line(p2, p3)
l3 = geom.add_line(p3, p4)
l4 = geom.add_line(p4, p5)
l5 = geom.add_line(p5, p1)

ll = geom.add_line_loop([l1, l2, l3, l4, l5])

s = geom.add_plane_surface(ll)
geom.add_physical(s)

pygmsh_mesh = pygmsh.generate_mesh(geom)
pygmsh_mesh.points
@beckerrh
Copy link

beckerrh commented Dec 8, 2020

Hi Martin,
for me, your code is working in the sense that I don't get a single point (using pygmesh 7.1.3 and gmsh 4.7.1 pip-installed).
However, the way to retrieve the information has changed, it is in pygmsh_mesh.cell_sets and stored differently than before.
Best, Roland

@nschloe
Copy link
Owner

nschloe commented Feb 18, 2021

From what I can see, everything works as expected. You'll find the data in mesh.cell_sets, but with an empty label (''). I just deprecated no labels for physical sets in #424 to avoid such situations.

@nschloe nschloe closed this as completed Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants