Error when viewing XDMF in Paraview

Hi Guys,

I am trying to visualize a fenics mesh in XDMF format using Paraview.

Here is the fenics code

from fenics import *
mesh = UnitSquareMesh(10, 10)
with XDMFFile("out.xdmf") as outfile:
    outfile.write(mesh)

But when I try to open out.xdmf in Paraview 5.11.1, I am encounting following error.

ERROR: In vtkXdmfReader.cxx, line 487
vtkXdmfReader (0000021D2ED55970): Failed to read data.

ERROR: In vtkExecutive.cxx, line 741
vtkPVCompositeDataPipeline (0000021D2AC13AB0): Algorithm vtkFileSeriesReader (0000021D2A642F70) returned failure for request: vtkInformation (0000021D2EBA4320)
  Debug: Off
  Modified Time: 1582614
  Reference Count: 1
  Registered Events: (none)
  Request: REQUEST_DATA
  FORWARD_DIRECTION: 0
  ALGORITHM_AFTER_FORWARD: 1
  FROM_OUTPUT_PORT: 0

Can anyone help me in resolving this issue?

Thank you

What version of Paraview, and what xdmf-reader are you using. You should use the Xdmf3ReaderT

I am currently using Paraview 5.11.1 and Xdmf3Reader.

Could you add the content of out.xdmf here? And try doing the same as suggested in

1 Like

The out.xdmf file

<?xml version="1.0"?>
<!DOCTYPE Xdmf SYSTEM "Xdmf.dtd" []>
<Xdmf Version="3.0" xmlns:xi="http://www.w3.org/2001/XInclude">
  <Domain>
    <Grid Name="mesh" GridType="Uniform">
      <Topology NumberOfElements="200" TopologyType="Triangle" NodesPerElement="3">
        <DataItem Dimensions="200 3" NumberType="UInt" Format="HDF">out.h5</DataItem>
      </Topology>
      <Geometry GeometryType="XY">
        <DataItem Dimensions="121 2" Format="HDF">out.h5</DataItem>
      </Geometry>
    </Grid>
  </Domain>
</Xdmf>

@dokken , ASCII encoding is working.

from dolfin import *
mesh = UnitSquareMesh(10, 10)
with XDMFFile("out.xdmf") as outfile:
    outfile.parameters["flush_output"] = True
    outfile.write(mesh, encoding=XDMFFile.Encoding.ASCII)

The issue is the same as referenced in:

which has been fixed in legacy dolfin master branch and on conda.
If you use docker you can use