Saving more than one point_data using TimeSeries
mwenceslaucosta opened this issue · 1 comments
mwenceslaucosta commented
Hello, is it possible to use xdmf.TimeSeries to save more than one result field in the same file? I tried to use it as shown below, but when I read the file, all the data are not present.
with meshio.xdmf.TimeSeriesWriter('out_file.XDMF') as writer:
points = nodes
cells = [("hexahedron", connectivity)]
writer.write_points_cells(points,cells)
for i in range(len(time_vector)):
t=time_vector[i]
writer.write_data(t, point_data={"Temperature": temperature_1[:,0]})
writer.write_data(t, point_data={"Qx_flux": q_all_nodes[:,0]})
writer.write_data(t, point_data={"Qy_flux": q_all_nodes[:,1]})
writer.write_data(t, point_data={"Qz_flux": q_all_nodes[:,2]})`
Note: Saving just one field in a file, "Temperature" for example, works fine.
Thank you.
keurfonluu commented
Hi @mwenceslaucosta,
You should gather all your data in a single dict:
with meshio.xdmf.TimeSeriesWriter('out_file.XDMF') as writer:
points = nodes
cells = [("hexahedron", connectivity)]
writer.write_points_cells(points,cells)
for i in range(len(time_vector)):
t=time_vector[i]
writer.write_data(t, point_data={
"Temperature": temperature_1[:,0],
"Qx_flux": q_all_nodes[:,0],
"Qy_flux": q_all_nodes[:,1],
"Qz_flux": q_all_nodes[:,2],
},
)
Another issue with your code is that you are saving the same arrays at each time step.