# failure to read xdmf files generated by Fenics

**URL:** https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928
**Category:** ParaView Support
**Tags:** vtk
**Created:** [July 23, 2020, 12:07am UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928 "2020-07-23T00:07:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![azerad](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@azerad](https://discourse.paraview.org/u/azerad)
#### Post date: [July 23, 2020, 12:07am UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928/1 "2020-07-23T00:07:32Z")

</div>

I am using Paraview-5.8.1-RC2 with a MacOS Mojave 10.14.5 with 16Gb Ram

I get errors message (see below) when I open the attached xdmf file (generated by Fenics). [velocity.xdmf](https://discourse.paraview.org/uploads/short-url/oKZ10vhWtHMu0ULot1G2zVdEiT1.xdmf) (24.1 KB)  
The velocity.h5 companion file is present in the same directory. It is 9Mo so I don’t include it here. I can provide a link if necessary.

I tried to open the file with Paraview-5.8.0 and Paraview-5.6.2 and got the same issue.  
I could not find an answer in the posts about xdmf.  
Any help appreciated.

ERROR: In /Users/kitware/dashboards/buildbot-slave/88b2a88f/build/superbuild/paraview/src/VTK/IO/Xdmf2/vtkXdmfReader.cxx, line 476  
vtkXdmfReader (0x7fbb45582580): Failed to read data.

ERROR: In /Users/kitware/dashboards/buildbot-slave/88b2a88f/build/superbuild/paraview/src/VTK/Common/ExecutionModel/vtkExecutive.cxx, line 753  
vtkPVCompositeDataPipeline (0x600002298a80): Algorithm vtkFileSeriesReader(0x60000266cf00) returned failure for request: vtkInformation (0x60000059b780)  
Debug: Off  
Modified Time: 330481  
Reference Count: 1  
Registered Events: (none)  
Request: REQUEST\_DATA  
FROM\_OUTPUT\_PORT: 0  
ALGORITHM\_AFTER\_FORWARD: 1  
FORWARD\_DIRECTION: 0

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dave_demarle/32/27_2.png) [@Dave\_DeMarle](https://discourse.paraview.org/u/Dave_DeMarle)
#### Post date: [July 23, 2020, 12:16am UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928/2 "2020-07-23T00:16:08Z")

</div>

Use the XDMF3 reader option.

---

<div class="post-metadata">

### Author: ![azerad](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@azerad](https://discourse.paraview.org/u/azerad)
#### Post date: [July 23, 2020, 12:28am UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928/3 "2020-07-23T00:28:42Z")

</div>

I can choose between XDMF Reader or xdmf3ReaderS or xdfmf3ReaderT.  
But the last two make Paraview crash. So I can only open with XDMF Reader and I still have the same problem.

---

<div class="post-metadata">

### Author: ![azerad](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@azerad](https://discourse.paraview.org/u/azerad)
#### Post date: [July 23, 2020, 8:28am UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928/4 "2020-07-23T08:28:51Z")

</div>

Seems I didn’t generate the xdmf file correctly.  
I did it in python with the following commands:

# First I create the file before my time loop

xdmffile\_u = XDMFFile(‘velocity.xdmf’)

# then I save the time values within the time loop to file (XDMF/HDF5)

```
xdmffile_u.write(u, t)

```

Thanks to [https://fenicsproject.discourse.group/t/loading-xdmf-file-in-paraview/2291](https://fenicsproject.discourse.group/t/loading-xdmf-file-in-paraview/2291)

# I solved the issue inserting the command

**xdmffile\_u.parameters[“flush\_output”] = True**

just after the file creation:

xdmffile\_u = XDMFFile(‘velocity.xdmf’)  
xdmffile\_u.parameters[“flush\_output”] = True

Now all three xdmf readers work correctly. No need to use xdfm3 btw.

---

<div class="post-metadata">

### Author: ![DAnny03](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danny03/32/8500_2.png) [@DAnny03](https://discourse.paraview.org/u/DAnny03)
#### Post date: [January 31, 2022, 7:25pm UTC](https://discourse.paraview.org/t/failure-to-read-xdmf-files-generated-by-fenics/4928/5 "2022-01-31T19:25:52Z")

</div>

Could you go through step by step on how to use this command. I’m currently extracting an xdmf file from a fenicsproject machine and I desperately need help on this topic. If you could please go through step by step on how to make this work that would be great.
