Paraview display error after remeshing by OptimizeMesh2d

Hello everyone,
I got a problem while using VTKOutput. When I remesh by mesh.ngmesh.OptimizeMesh2d, the mesh in netgen GUI is correct but incorrect in paraview as follows:


I think OptimizeMesh2d may rearrange the nodes number but don’t know how to get the correct image. Has anyone encountered a similar issue? Are there recommended solutions?

Thank you very much for your help!

can you provide a minimal example?
after optimizing, you might need to create a new ngsolve mesh wrapper around the netgen mesh:

mesh = Mesh(mesh.ngmesh)