-
Notifications
You must be signed in to change notification settings - Fork 29
Description
I am trying to plot CFD data with turbulucid. I have *vtk files wit STRUCTURED_GRID dataset type. These files work well with other 3d visualization packages as pyvista. But when I try to create the Case with turbulucid i get the following error.
2021-10-13 17:46:03.685 (1410.649s) [ 2DB42740] vtkPolyDataReader.cxx:126 ERR| vtkPolyDataReader (0x3b03f30): Cannot read dataset type: structured_grid
`---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/tmp/ipykernel_871702/3782052166.py in
4 import turbulucid as tb
5 #
----> 6 case = tb.Case(vtk_files[0])
7 # ------------------------------------------------------------------------- #
/usr/local/lib/python3.8/dist-packages/turbulucid-0.2-py3.8.egg/turbulucid/core/case.py in init(self, fileName, clean, pointData)
38
39 # Read in the data
---> 40 self._blockData = self.read(clean, pointData)
41
42 # Compute the cell-centres
/usr/local/lib/python3.8/dist-packages/turbulucid-0.2-py3.8.egg/turbulucid/core/case.py in read(self, clean, pointData)
458 return reader.data
459 elif fileExt == ".vtk":
--> 460 return LegacyReader(fileName, clean=clean,
461 pointData=pointData).data
462 elif (fileExt == ".vtu") or (fileExt == ".vtp"):
/usr/local/lib/python3.8/dist-packages/turbulucid-0.2-py3.8.egg/turbulucid/core/readers.py in init(self, filename, clean, pointData)
175 self._vtkReader.Update()
176
--> 177 internalData = self._transform()
178 if clean:
179 internalData = self._clean(internalData)
/usr/local/lib/python3.8/dist-packages/turbulucid-0.2-py3.8.egg/turbulucid/core/readers.py in _transform(self)
93 transform = vtk.vtkTransform()
94
---> 95 meanNormal = self._compute_normal()
96
97 axis = np.cross(meanNormal, [0, 0, 1])
/usr/local/lib/python3.8/dist-packages/turbulucid-0.2-py3.8.egg/turbulucid/core/readers.py in _compute_normal(self)
129 vtkNormals.Update()
130 normals = dsa.WrapDataObject(vtkNormals.GetOutput()).CellData["Normals"]
--> 131 meanNormal = np.mean(normals, axis=0)
132 meanNormal /= np.linalg.norm(meanNormal)
133 return meanNormal
<array_function internals> in mean(*args, **kwargs)
/usr/lib/python3/dist-packages/numpy/core/fromnumeric.py in mean(a, axis, dtype, out, keepdims)
3254 return mean(axis=axis, dtype=dtype, out=out, **kwargs)
3255
-> 3256 return _methods._mean(a, axis=axis, dtype=dtype,
3257 out=out, **kwargs)
3258
/usr/lib/python3/dist-packages/numpy/core/_methods.py in _mean(a, axis, dtype, out, keepdims)
136
137 is_float16_result = False
--> 138 rcount = _count_reduce_items(arr, axis)
139 # Make this warning show up first
140 if rcount == 0:
/usr/lib/python3/dist-packages/numpy/core/_methods.py in _count_reduce_items(arr, axis)
55 items = 1
56 for ax in axis:
---> 57 items *= arr.shape[ax]
58 return items
59
IndexError: tuple index out of range`
Is it possible that structured grids are not supported and I should create polydata files?