VTU file format

I managed to write a finite element post-processor with vtk, however, it is my understanding that:

  1. Vtk is obsolete, and better to use vtu.
  2. I ould not find a documentation for file format for vtu as this one for vtk
  3. I have to use vtu to assign names to the components of a tensor (3x3)

Can someone kindly confirm/comment on the above?


If the legacy VTK (.vtk) file format suits your needs, you should be OK using it. Although legacy, I don’t think there are any plans to deprecate this file format. It is still used quite a bit.

Also, if you want to use the newer XML formats, the document you referenced documents both the legacy .vtk format and the XML formats. The XML documentation starts after the legacy VTK format starting at the bottom of page 11.

OK., XML is very similar to Latex (or JSON) with which I am familiar. It seems to be geared for document (and not data) preparation, but I can see how it can be used in this context.

Is there “out there” an example of an xml file to represent unstructured data, cells, vectors and tensors such as the following:

vtk DataFile Version 3.0

Increment No. 1
POINTS 3241 float
0.000000e+00 0.000000e+00 0.000000e+00

CELLS 2967 24150
8 0 26 156 548 51 348 945 1624

4 20 312 1603 331

5 1009 103 8 185 3198


VECTORS Node_type float
0.000000e+00 0.000000e+00 0.000000e+00

VECTORS Displacements float
0.000000e+00 0.000000e+00 0.000000e+00

SCALARS VonMises float

TENSORS Cauchy_Stress float
-1.136000e+01 -1.728000e-03 2.264000e-02
-1.728000e-03 -1.138000e+01 2.474000e-03
2.264000e-02 2.474000e-03 -4.398000e-02

Easiest - load your data in ParaView.

  • File/Save Data… choose the vtu format with Data Mode “Ascii” - this should give you a good idea.

The output will include many additional things that you can skip (eg, the RangeMin, RangeMax).

Assuming you only have non-polyhedrals, generating the cells is fairly easy. In the Legacy format each entry in CELLS is prefixed by its size, Eg,

8 0 26 156 548 51 348 945 1624
4 20 312 1603 331

In the xml format this would be represented by two arrays. The connectivity is the list of vertices for the cells and the offsets are the cumulative end of the connectivity lists.

    <DataArray type="Int32" Name="connectivity" format="ascii">
0 26 156 548 51 348 945 1624   # <- Hex
20 312 1603 331    # <- Tet
    <DataArray type="Int32" Name="offsets" format="ascii">
8 12 ...
    <DataArray type="UInt8" Name="types" format="ascii" >

Thanks, but I am using Paraview 5.8.1

I do not see any option for vtu format with Data Mode “Ascii”

Not sure what may be wrong.

Thanks for your help,


Select VTK Unstructured Grid Files (*.vtu) and choose a filename. Then click OK. Before saving the file, ParaView will pop up a second dialog box for options for that file format. In that second dialog box, select Data Mode to Ascii.

1 Like