Paraview crashes strangely when inputting VTXWriter files

Hello,

I generated a simple .bp file to save simulation results using FEniCSx. When I attempt to open this file in ParaView, the software crashes and exits immediately.

I am wondering if the issue could be related to version compatibility between ParaView and FEniCSx or if there are any additional settings or steps required to ensure the file opens correctly in ParaView.

The version of dolfinx is 0.7.2, and the version of Paraview is 5.12. Here is the MWE:

from mpi4py import MPI
from dolfinx import mesh, fem
from dolfinx.io import  VTXWriter
import ufl

domain = mesh.create_unit_square(MPI.COMM_WORLD, 2, 2, mesh.CellType.triangle)

# Defining FunctionSpace
P2 = ufl.FiniteElement("Lagrange", domain.ufl_cell(), 2)
N = fem.FunctionSpace(domain, P2)

n = fem.Function(N)
n.interpolate(lambda x: x[0])

VTX_n = VTXWriter(MPI.COMM_WORLD, "n.bp", [n])
VTX_n.write(0.0)

Could anyone provide guidance or suggest a solution for this issue? I would greatly appreciate any help or pointers!

Thank you!

Usually I would set `engine=“BP4” as a last argument to VTXWriter, as Paraview’s support for “BP5” (the default) is a bit patchy.