VtkOutput problem: .vtu files instead of .vtk files

More
3 years 1 month ago - 3 years 1 month ago #3997 by dong
I run the code with vtk output . The output is only .vtu files instead of .vtk files.
I couldn't visualize those .vtu files with Paraview software. On the output message, when I tried to open those files was as follows.
Code:
ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLUnstructuredDataReader.cxx, line 681 vtkXMLUnstructuredGridReader (000001A1AC6925D0): Cannot read cell connectivity from Cells in piece 0 because the "offsets" array is not monotonically increasing or starts with a value other than 0.

Could you please tell me how I can solve this issue? How can I get .vtk files from .vtu files.
Thank you so much.
Last edit: 3 years 1 month ago by dong.
More
3 years 1 month ago #3998 by dong
Updated:
My problem was solved.
When I used the latest version, it produced the .vtu files. Couldn't view in Paraview.
When I used the 2020 version, it produced the .vtk files. Can visualize in Paraview.
I don't know why.
More
3 years 1 month ago #4000 by schruste
We indeed changed the default VTK output from the legacy format (.vtk) to the xml format (.vtu) (which also allows for binary output) in the meantime. However, Paraview (if not very very old) should be able to cope with both. You can also enforce the legacy format with a latest versions of ngsolve adding "legacy=True" in the VTKOutput constructor.

Best,
Christoph
More
3 years 1 month ago - 3 years 1 month ago #4001 by dong
I changed bool legacy = False to bool legacy =True in VtkOuput.hpp file, I still get vtu files. I also used the latest version of Paraview, but I still couldn’t visualize vtu file. Perhaps I made a mistake somewhere.

Best wishes,
Dong
Last edit: 3 years 1 month ago by dong.
More
3 years 1 month ago #4002 by schruste
Well, you changed the default argument on the C++-side, but when called from python, the VTKOutput will still use the python-default which is false. So, simply use legacy=True when instantiating the VTKOutput object.

Alternatively you can use tools like meshio to convert vtk to vtu, e.g. install `pip install meshio` and then call `meshio convert test.vtu test.vtk`.

Best,
Christoph
Time to create page: 0.103 seconds