Paraview does not work with VTXWriter on 3rd order elements

Dear Community,
I had a problem when opening files saved with VTXWriter. The error occurred while working with elements of the 3rd order. When opening a .bp file and moving to the last frame paraview raises an error. After experimenting with the grid size, I noticed that the position of the “critical” frame depends on the grid size. The larger the grid, the earlier it is.

I tried using ParaView-5.13.2-MPI, ParaView-5.13.1-MPI and ParaView-5.13.20250304-MPI on Windows 11 and Windows server 2022 to open it. FEniCSx 0.9 running on WSL Ubuntu 24.04 was used for the calculations.

Below you can find a minimal working code sample and the paraview error text.

import numpy as np
from mpi4py import MPI
from basix.ufl import element, mixed_element
from dolfinx.fem import Function, functionspace
from dolfinx.io import VTXWriter
from dolfinx.mesh import CellType, create_rectangle


dtype = np.float64
meshsize = 100
order = 3
msh = create_rectangle(
    MPI.COMM_WORLD,
    [(0.0, 0.0), (1, 1)],
    [meshsize, meshsize],
    CellType.triangle,
    dtype=np.real(dtype(0)).dtype
)
Pn = element("Lagrange", msh.basix_cell(), order,
             dtype=np.real(dtype(0)).dtype)
ME = functionspace(msh, mixed_element([Pn, Pn]))

u = Function(ME)  # current solution
t = 0.0
u.x.array[:] = t

f1 = u.sub(0)
vtx_phi = VTXWriter(msh.comm, f"out/iotest/ch_phi.bp", f1, engine="BP4")
for i in range(500):
    vtx_phi.write(t)
    t += 1.0
    u.x.array[:] = t
    f1 = u.sub(0)
    print(t)
vtx_phi.close()
print("done")

error

ERROR: In vtkADIOS2VTXReader.cxx, line 99
vtkADIOS2VTXReader (0000016854381FA0): Error loading ADIOS2 schema: e[1;36m[Tue Mar 04 19:42:25 2025]e[1;34m [ADIOS2 EXCEPTION]e[0m <Toolkit> <transport::file::FilePOSIX> <Read> : couldn't move to start position 4585881379 in file D:\iefimov\ch-fem\out\iotest\ch_phi.bp\data.0 : errno = 0: No errore[0m
: iostream stream error

ERROR: In vtkExecutive.cxx, line 730
vtkPVCompositeDataPipeline (00000168506C7840): Algorithm vtkADIOS2VTXReader (0000016854381FA0) returned failure for request: vtkInformation (000001684CC0DD30)
  Debug: Off
  Modified Time: 8821638
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
  FROM_OUTPUT_PORT: 0

I can’t reproduce the error when running this script on ubuntu with Paraview 5.12. I also tried it with 5.13.2, without beign able to reproduce the error.
Could you give the output of bpls out/iotest/ch_phi.bp/ -a?
For me that yields

  uint32_t  NumberOfEntities     500*{1}
  uint32_t  NumberOfNodes        500*{1}
  int64_t   connectivity         500*[1]*{20000, 11}
  double    f_0                  500*[1]*{181202, 1}
  double    geometry             500*[1]*{181202, 3}
  double    step                 500*scalar
  uint32_t  types                500*scalar
  string    vtk.xml              attr
  uint8_t   vtkGhostType         500*[1]*{181202}
  int64_t   vtkOriginalPointIds  500*[1]*{181202}

Output

  uint32_t  NumberOfEntities     500*{1}
  uint32_t  NumberOfNodes        500*{1}
  int64_t   connectivity         500*[1]*{20000, 11}
  double    f_0                  500*[1]*{181202, 1}
  double    geometry             500*[1]*{181202, 3}
  double    step                 500*scalar
  uint32_t  types                500*scalar
  string    vtk.xml              attr
  uint8_t   vtkGhostType         500*[1]*{181202}
  int64_t   vtkOriginalPointIds  500*[1]*{181202}

Your comment encouraged me to try Paraview 5.13.2 via WSL gui. On Paraview 5.13.2 via WSL my example runs without any problems. So it seems to be some kind of problem with Paraview for Windows.

My guess is the problem lies in the adios2 library version, and might be related to bp5 support, which is relatively new. It sounds likely that the Windows build is using an older version of adios2. I guess they’ll update it sooner or later.