Unexact location of copied nodes
Hello GMSH team,
I am having an issue when it comes to creating new nodes by using a function similar to the "mirror_mesh" example. I have used the code from that example and modified it in the following way so that the mesh is copied and rotated instead of mirrored:
m = {}
for e in entities:
m[e] = (gmsh.model.getBoundary([e]),
gmsh.model.mesh.getNodes(e[0], e[1]),
gmsh.model.mesh.getElements(e[0], e[1]))
def copyrotate(m, offset_entity, offset_node, offset_element, angle):
for e in sorted(m):
gmsh.model.addDiscreteEntity(
e[0], e[1] + offset_entity,
[(abs(b[1]) + offset_entity) * math.copysign(1, b[1]) for b in m[e][0]])
coord = []
for i in range(0, len(m[e][1][1]), 3):
x = m[e][1][1][i] * np.cos(angle) - m[e][1][1][i + 1] * np.sin(angle)
y = m[e][1][1][i + 1] * np.cos(angle) + m[e][1][1][i] * np.sin(angle)
z = m[e][1][1][i + 2]
coord.append(x)
coord.append(y)
coord.append(z)
gmsh.model.mesh.addNodes(e[0], e[1] + offset_entity,
m[e][1][0] + offset_node, coord)
gmsh.model.mesh.addElements(e[0], e[1] + offset_entity, m[e][2][0],
[t + offset_element for t in m[e][2][1]],
[n + offset_node for n in m[e][2][2]])
Now the problem I have is that not all new nodes are located in the right coordinates after using the function. This is especially a problem in the intersection between two meshes where the gmsh.model.mesh.removeDuplicateNodes()
method does not delete the missplaced nodes and the bad mesh leads to errors in the FEM analysis. Here is an example of an intersection in my model, as you can see many nodes are overlapping and not getting removed.
I got the coordinates of the first overlapping nodes from the screenshot using gmsh.model.mesh.getNode()
:
As you can see even the Z coordinates that my function does not change are not the same. I don't know if it changes anything but I am using the OCC Kernel.
I was wondering what the best solution is to counter this problem, is there a way to change the tolerance of my function or maybe the tolerance of the gmsh.model.mesh.removeDuplicateNodes()
method?
Thank you in advance