Skip to content
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

Raw code alternative for periodic curve #573

Open
dthillaithevan opened this issue Mar 6, 2023 · 0 comments
Open

Raw code alternative for periodic curve #573

dthillaithevan opened this issue Mar 6, 2023 · 0 comments

Comments

@dthillaithevan
Copy link

Hi,

I am trying to generate a 2D mesh with periodic nodes on opposite faces. Looking at past discussions (#193) it seems add_raw_code with Periodic Curve was used, however since this has been depreciated is there a new alternative method ensure periodicity constraints in pygmsh?

I've included a simple test case on a squre domain below.

import pygmsh
import gmsh
import meshio

verts = [[0,0], [0,1], [1,1],[1,0]]
lcar = 0.1
with pygmsh.geo.Geometry() as geom:
    p1 = geom.add_point(verts[0], lcar/2)
    p2 = geom.add_point(verts[1], lcar/2)
    p3 = geom.add_point(verts[2], lcar)
    p4 = geom.add_point(verts[3], lcar)
  
    l1 = geom.add_line(p1, p2)
    l2 = geom.add_line(p2, p3)
    l3 = geom.add_line(p3, p4)
    l4 = geom.add_line(p4, p1)
    
    ll = geom.add_curve_loop([l1, l2, l3, l4])
    pl = geom.add_plane_surface(ll)
    
    # Raw code no longer supported
    # geom.add_raw_code("Periodic Curve {{{}}} = {{{}}};".format(l1.id, l3.id))
    
    # I thought setPeriodic might be used but does not seem to work either
    # translation = [1, 0, 0, 1,
                   # 0, 1, 0, 0,
                   # 0, 0, 1, 0,
                   # 0, 0, 0, 1]
    # gmsh.model.mesh.setPeriodic(0, [l3.dim_tag[1]], [l1.dim_tag[1]], translation)
    
    mesh = geom.generate_mesh(2)

Many thanks,
D

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

No branches or pull requests

1 participant