Incorrect cell_data shapes when reading .cas.h5 with vtkFLUENTCFFReader

Hey everyone! This is my first post here, so I apologize if its in the wrong category or otherwise not according to the rules. Happy to open this in a different place, if that helps:)

I am encountering an issue when reading a Fluent .cas.h5 case file with vtkFLUENTCFFReader (VTK version 9.5.20251101.dev0). Several cell_data arrays in the resulting vtkUnstructuredGrid blocks have invalid shapes.

Came here for help after discussion with the pyvista folks.

Below is a reproducer.

from pathlib import Path
import vtk

here = Path(__file__).parent

# Read the .cas.h5 file using VTK's Fluent CFF reader
reader = vtk.vtkFLUENTCFFReader()
reader.SetFileName(str(here / "one_way_fsi_probe_report.cas.h5"))
reader.Update()

# Get the multiblock
output = reader.GetOutputDataObject(0)
assert isinstance(output, vtk.vtkMultiBlockDataSet)

print(f"Number of blocks: {output.GetNumberOfBlocks()}")
for i in range(output.GetNumberOfBlocks()):
    block = output.GetBlock(i)
    print(f" Type: {block.GetClassName()}")
    print(f"  Points: {block.points.shape}")
    for key, array in block.point_data.items():
        print(f"   - {key}: {array.shape}")
    print(f"  Cells: {block.cells['cell_types'].shape}")
    for key, array in block.cell_data.items():
        print(f"   - {key}: {array.shape}")

Output:

Number of blocks: 2
 Type: vtkUnstructuredGrid
  Points: (83135, 3)
  Cells: (48478,)
   - SV_DENSITY: (48478,)
   ...
   - SV_BF_V: (48478, 2)

 Type: vtkUnstructuredGrid
  Points: (83135, 3)
  Cells: (290985,)
   - SV_DENSITY: (290985,)
   - SV_K: (242507,)
   - SV_MU_LAM: (242507,)
   - SV_MU_T: (242507,)
   - SV_O: (242507,)
   - SV_P: (242507,)
   - SV_SIGMA_XX: (0,)
   - SV_SIGMA_XY: (0,)
   - SV_SIGMA_XZ: (0,)
   - SV_SIGMA_YY: (0,)
   - SV_SIGMA_YZ: (0,)
   - SV_SIGMA_ZZ: (0,)
   - SV_U: (242507,)
   - SV_V: (242507,)
   - SV_W: (242507,)
   - SV_WALL_DIST: (290985,)
   - SV_BF_V: (242507, 2)

Inspecting the underlying .cas.h5 file gives:

results/1/phase-1/cells/SV_BF_V/1:        (290985, 3)
results/1/phase-1/cells/SV_DENSITY/1:     (339463,)
results/1/phase-1/cells/SV_K/1:           (290985,)
results/1/phase-1/cells/SV_MU_LAM/1:      (290985,)
results/1/phase-1/cells/SV_MU_T/1:        (290985,)
results/1/phase-1/cells/SV_O/1:           (290985,)
results/1/phase-1/cells/SV_P/1:           (290985,)
results/1/phase-1/cells/SV_SIGMA_XX/1:    (48478,)
results/1/phase-1/cells/SV_SIGMA_XY/1:    (48478,)
results/1/phase-1/cells/SV_SIGMA_XZ/1:    (48478,)
results/1/phase-1/cells/SV_SIGMA_YY/1:    (48478,)
results/1/phase-1/cells/SV_SIGMA_YZ/1:    (48478,)
results/1/phase-1/cells/SV_SIGMA_ZZ/1:    (48478,)
results/1/phase-1/cells/SV_U/1:           (290985,)
results/1/phase-1/cells/SV_V/1:           (290985,)
results/1/phase-1/cells/SV_W/1:           (290985,)
results/1/phase-1/cells/SV_WALL_DIST/1:   (339463,)

Thanks a lot for your help!

Hello @nmheim,

As it was suggested in the pyvista issue, having arrays with a different size that the number of cells is the problem, I’m able to open this data in ParaView when I unchecked these data arrays:

tbh I don’t know if this is expected by Fluent or your file wasn’t generated correctly but the vtkFluentCFFReader didn’t do anything special in that case which leads to a crash.

Maybe Ansys’s support could help you here to know if your file is corrupted or not? If your data is valid, we need to create an issue as the vtkFLUENTCFFReader should not crash for a valid CFF file (and we should support it at some point ofc).

cc @Francois_Mazen

1 Like

Thanks a lot for the quick reply @lgivord! I just heard back from Ansys’s support and they said the file looks fine. If there is anything else I can do to help, please let me know.

Alright, in that case, could you please create an issue on https://gitlab.kitware.com/vtk/vtk/-/issues ?

At least, we need to fix the crash and outputs a warning when the data array size doesn’t match the number of cells.

1 Like

Done :+1: https://gitlab.kitware.com/vtk/vtk/-/issues/19847

1 Like