Hey everyone,
I have a question on how to read the vtu files. Can someone help me with it? Thanks!
I created some simple vtu files using this mfx file.
vtu.mfx (11.8 KB)
I tried reading the vtu files that contains information about flow velocity along the x-axis, and transform the information into a matrix for my machine learning algorithm. However, when I tried reading the vtu files of the simulation results, I got an error saying that my file was empty. Here is the python code that I used to read the vtk.
import numpy as np
import vtk
from vtk.util.numpy_support import vtk_to_numpy
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName(“BACKGROUND_IC_0005.vtu”)
reader.Update()
data = reader.GetOutput()
u = vtk_to_numpy(data.GetPointData().GetArray(2))
Can anyone let me know if I had a mistake in my python code or if I had some misunderstand about how mfix creates vtu files?
Thanks,
Jack