Hi community,
I’m facing a strange problem when trying to generate a periodic mesh of 120 degree, here is the geometry :
I get different number of point left and right ( when angle = 90 it works, but in this case of 120 degree, there is a mismatch between left and right – see the code)
The code :
angle = 120
'# angle in degrees
trf_leftright = gp_Trsf().Rotation(gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1)), angle)
print(len(geo_compound.edges[“left”])) # => 5
print(len(geo_compound.edges[“right”])) # => 5
geo_compound.edges[“right”].Identify(
geo_compound.edges[“left”], “leftright”, IdentificationType.PERIODIC, trf_leftright
)
geo = OCCGeometry(geo_compound, dim=2)
ngmesh = geo.GenerateMesh()
ngmesh.Save(mesh_file_name)
mesh = ngs.Mesh(ngmesh)
fes = ngs.H1(mesh=mesh, order=1, dirichlet=‘infini’)
per_outer_gf = ngs.GridFunction(fes)
per_inner_gf = ngs.GridFunction(fes)
left_gf = ngs.GridFunction(fes)
right_gf = ngs.GridFunction(fes)
left_gf.Set(ngs.CoefficientFunction((1)), definedon = mesh.Boundaries(“left”))
right_gf.Set(ngs.CoefficientFunction((1)), definedon = mesh.Boundaries(“right”))
list_str = [“left”, “right”]
list_gfs = [left_gf, right_gf]
for idx, gf in enumerate(list_gfs) :
n_points = 0
for k in range(len(mesh.ngmesh.Points())):
if gf.vec.FV()[k] > 0.5:
n_points += 1
print("nbr points ", list_str[idx], n_points)
'# there is no mention of “leftright” in the mesh file
'# the last print
'# nbr points left 122
'# nbr points right 120