To output a function's value to a VTK file, I do the following
ofile = File("u.pvd")
ofile << u
With XDMF files, I have the option to output the time value of that specific timestep
ofile = XDMFFile("u.xdmf")
ofile.write(u, t)
When I try the same with VTK output, I observe that the time value is not there
ofile = File("u.pvd")
ofile << u, t
Hence I see the timestep count, not the time value when postprocessing the files in ParaView. The <<
operator accepts another float as a second parameter, but strangely does not wrap it in a field in the .vtu
files.
The file u.pvd
:
<?xml version="1.0"?>
<VTKFile type="Collection" version="0.1">
<Collection>
<DataSet timestep="0" part="0" file="u000000.vtu" />
<DataSet timestep="1" part="0" file="u000001.vtu" />
<DataSet timestep="2" part="0" file="u000002.vtu" />
...
</Collection>
</VTKFile>
The file u000000.vtu
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" >
<UnstructuredGrid>
<Piece NumberOfPoints="1089" NumberOfCells="2048">
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="ascii"> ... </DataArray>
</Points>
<Cells>
<DataArray type="UInt32" Name="connectivity" format="ascii"> ... </DataArray>
<DataArray type="UInt32" Name="offsets" format="ascii"> ... </DataArray>
<DataArray type="UInt8" Name="types" format="ascii"> ... </DataArray>
</Cells>
<PointData Scalars="u">
<DataArray type="Float64" Name="u" format="ascii"> ... </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
</VTKFile>
The time field is nowhere to be seen, contrary to what is expected. How can I make it so that the time value is output to the VTK files?