.bp file cannot be viewed in paraview

I recently learning FEM using dolfinx tutorial by Jørgen S. Dokken with updated version on v0.6.0.
https://github.com/jorgensd/dolfinx-tutorial/blob/v0.4.0/chapter2/ns_code2.ipynb

I run it on google colab. and i moved those .bp file to my google drive and downloaded to my laptop (i7 cpu + intel iris xe graphics) for viewing in paraview. I use paraview 5.11.1.

But it crashed immediately with select ADIO2VTXreader. The following message was displated with selecting ADIO2CoreImageReader to view the .bp folder.

ERROR: In vtkADIOS2CoreImageReader.cxx, line 401
vtkADIOS2CoreImageReader (0000015274688F20): failed to open and read meta data: [1;36m[Mon Jul 3 02:30:12 2023] [1;34m [ADIOS2 EXCEPTION] [0m : ERROR: this version didn’t compile with BP5 library, can’t use BP5 engine
[0m

ERROR: In vtkADIOS2CoreImageReader.cxx, line 435
vtkADIOS2CoreImageReader (0000015274688F20): unable to open file and data

ERROR: In vtkExecutive.cxx, line 741
vtkPVCompositeDataPipeline (00000152694AC390): Algorithm vtkADIOS2CoreImageReader (0000015274688F20) returned failure for request: vtkInformation (000001527484FAC0)
Debug: Off
Modified Time: 413612
Reference Count: 1
Registered Events: (none)
Request: REQUEST_INFORMATION
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1

May i know whats wrong with the code or my laptop is not fast enough?

The issue has be resolved on the main branch of dolfinx, see Add ADIOS2 engine as option by garth-wells · Pull Request #2636 · FEniCS/dolfinx · GitHub

I am sorry but what should i know next?
In your link it seems the writer was changed from VTXWriter to ADIOS2Writer.

So i changed the import part from

from dolfinx.io import (VTXWriter, distribute_entity_data, gmshio)

to

from dolfinx.io import (ADIOS2Writer, distribute_entity_data, gmshio)

but it got error saying

cannot import name ‘ADIOS2Writer’ from ‘dolfinx.io’ (/usr/local/lib/python3.10/dist-packages/dolfinx/io/init.py)

I am using dolfinx v0.7.0.0 using the way procided by FEM on colab

https://fem-on-colab.github.io/packages.html

try:
import dolfinx
except ImportError:
!wget “https://fem-on-colab.github.io/releases/fenicsx-install-real.sh” -O “/tmp/fenicsx-install.sh” && bash “/tmp/fenicsx-install.sh”
import dolfinx

Do i need to import another version of dolfinx? if so, how can i do it in google colab?

No, ADIOS2Writer is the base class for both VTXWriter and FidesWriter. The only thing that has changed is that the constructor of VTXWriter can now take in an engine as an option.

So you mean i should leave the import part the same but adding one argument as option?

So from

vtx_u = VTXWriter(mesh.comm, “dfg2D-3-u.bp”, [u_])

to

vtx_u = VTXWriter(mesh.comm, “dfg2D-3-u.bp”, [u_],“BPFile”)

but i got the following error

VTXWriter.init() takes 4 positional arguments but 5 were given

Looks to me that the PR mentioned above did not add the optional argument to the python layer, see dolfinx/python/dolfinx/io/utils.py. If that is indeed the case, @neolam_1987 you are welcome to create a PR on that. FEM on Colab releases updated packages every week, so the PR will be picked up shortly after it is merged.

1 Like

they said the issue is in dolfinx, not in FEM on Colab.

I got lost now.

Keep in mind that who closed your issue on the FEM on Colab github is still me, even if the username is different :wink: The suggestion is to open a PR on the dolfinx repo, the relevant file to be updated is dolfinx/python/dolfinx/io/utils.py at main · FEniCS/dolfinx · GitHub

EDIT: I’ve changed my username to be the same one I have on github, to avoid confusion in future!

1 Like

Sorry for messing up.

I have uploaded utlis.py into colab and import it via

from utlis import VTXWriter

and run the code to generate the velocity and pressure files

However, when i open it on paraview, the following error message pops up.

ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\VTK\IO\ADIOS2\vtkADIOS2CoreImageReader.cxx, line 402
vtkADIOS2CoreImageReader (000001C9A48D2A50): failed to open and read meta data: FATAL CODING ERROR: ADIOS Index file C:\Users\XXX\Downloads\dfg2D-3-p.bp is assumed to always contain n*64 byte-length records. The file size now is 205146 bytes.

ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\VTK\IO\ADIOS2\vtkADIOS2CoreImageReader.cxx, line 439
vtkADIOS2CoreImageReader (000001C9A48D2A50): unable to open file and data

ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\VTK\Common\ExecutionModel\vtkExecutive.cxx, line 753
vtkPVCompositeDataPipeline (000001C9A4196D20): Algorithm vtkADIOS2CoreImageReader(000001C9A48D2A50) returned failure for request: vtkInformation (000001C9A45D4A00)
Debug: Off
Modified Time: 484743
Reference Count: 1
Registered Events: (none)
Request: REQUEST_INFORMATION
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1

Is it something i did wrong on importing or my setting in paraview ? This time i was not prompted to choose between ADIO2VTXreader or ADIO2CoreImageReader when opening it on paraview.

Since you’re on Windows, did you download the newest MPI build of ParaView? This helped a colleague. Download ParaView

I’ve not used fem-on-colab but apparently it uses the dev version of ADIOS2 (>=2.9.0). This version uses BP5 as default engine which to date seems not to be supported by ParaView (Paraview opens ADIOS2-VTX BP5 files as BP4 (#22108) · Issues · ParaView / ParaView · GitLab). I’ve had this issue using the dolfinx:nightly Docker image which also recently bumped their ADIOS2 version to 2.9.
A simple fix that works for me with dolfinx@main is simply to pass engine="BP4" to VTXWriter.

1 Like

I have the same problem, but i realized that my dolfinx is under the 0.6.0 version and not 0.7.0, even though i used

conda create -n vfenicsx -c conda-forge fenics-dolfinx

And when i tried to install the last version :

conda install fenics-dolfinx=0.7

he couldn’t find the package
this is due to the fact that it isn’t updated on conda : [Fenics Dolfinx :: Anaconda.org]

If anyone has an idea how to update my conda environment to 0.7 (and thus probably solve this problem of reading .pb files) i would gladely appreciate.

FEniCS 0.7 has not been released for conda yet (probably happening in one of the next few days). If you want to use dolfinx v0.6.0 with bp4 file format you should pin adios to be smaller than 2.9

Thanks for this reply, i’ll work on it.

Same issue here. I tried to save with vtx_u = VTXWriter(mesh.comm, “dfg2D-3-u.bp”, [u_],“BP4”). Now Paraview doesn’t crash but I can’t see any variables to plot.

Please use bpls from adios to inspect your mesh file: Command Line Utilities — ADIOS2 2.9.0 documentation and post the output here

It used to work fine with DOLFINx 0.6, so I guess if there is an issue with the data is on the VTXWriter side…

This isn’t very constructive. Please yield a minimal working example and what version of DOLFINx you are using, how you have installed it, and what version of Paraview you are using.

I use a docker image, dolfinx:stable, i.e., version 0.7.0 in complex mode (source /usr/local/bin/dolfinx-complex-mode). I’m using the last version of Paraview, 5.11.2 on a arm64 Mac OS. I am trying to save a vector function (DG, degree=2) as well as a scalar function (still DG). Tried again with dolfinx 0.6.0, and have no issues. Here an extract of the code where I try to save the solution E:
v_dg_el = ufl.VectorElement(“DG”, domain.ufl_cell(), 2)
W = fem.FunctionSpace(domain,v_dg_el)
F_dg = fem.Function(W)
F_dg.interpolate(fem.Expression(E, W.element.interpolation_points()))
with io.VTXWriter(domain.comm, ‘E.bp’, F_dg) as f:
f.write(0.0)

I can reproduce the issue with:

import dolfinx
from mpi4py import MPI
import ufl
domain = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 10, 10)
v_dg_el = ufl.VectorElement("DG", domain.ufl_cell(), 2)
W = dolfinx.fem.FunctionSpace(domain,v_dg_el)
F_dg = dolfinx.fem.Function(W)
E = 2*F_dg
F_dg.interpolate(dolfinx.fem.Expression(E, W.element.interpolation_points()))
fname = f"E{dolfinx.__version__}.bp"
if dolfinx.__version__ == "0.6.0":
    with dolfinx.io.VTXWriter(domain.comm, fname, F_dg) as f:
        f.write(0.0)

elif dolfinx.__version__ == "0.7.0":
    with dolfinx.io.VTXWriter(domain.comm, fname, F_dg, engine="BP4") as f:
        f.write(0.0)

yielding:

bpls E0.6.0.bp/ -a  -l
  uint32_t  NumberOfEntities     {1} = 200 / 200
  uint32_t  NumberOfNodes        {1} = 1200 / 1200
  int64_t   connectivity         [1]*{200, 7} = 0 / 1199
  double    f_imag               [1]*{1200, 3} = 0 / 0
  double    f_real               [1]*{1200, 3} = 0 / 0
  double    geometry             [1]*{1200, 3} = -2.15423e-18 / 1
  double    step                 scalar = 0
  uint32_t  types                scalar = 69
  string    vtk.xml              attr   = 
<VTKFile type="UnstructuredGrid" version="0.1">
  <UnstructuredGrid>
    <Piece NumberOfPoints="NumberOfNodes" NumberOfCells="NumberOfCells">
      <Points>
        <DataArray Name="geometry" />
      </Points>
      <Cells>
        <DataArray Name="connectivity" />
        <DataArray Name="types" />
      </Cells>
      <PointData>
        <DataArray Name="TIME">step</DataArray>
        <DataArray Name="vtkOriginalPointIds" />
        <DataArray Name="vtkGhostType" />
        <DataArray Name="f_real" />
        <DataArray Name="f_imag" />
      </PointData>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

  uint8_t   vtkGhostType         [1]*{1200} = 0 / 0
  int64_t   vtkOriginalPointIds  [1]*{1200} = 0 / 1199

and

bpls E0.7.0.bp/ -l -a
  uint32_t  NumberOfEntities     {1} = 200 / 200
  uint32_t  NumberOfNodes        {1} = 1200 / 1200
  int64_t   connectivity         [1]*{200, 7} = 0 / 1199
  double    f_imag               [1]*{1200, 3} = 0 / 0
  double    f_real               [1]*{1200, 3} = 0 / 0
  double    geometry             [1]*{1200, 3} = -2.15423e-18 / 1
  double    step                 scalar = 0
  uint32_t  types                scalar = 69
  string    vtk.xml              attr   = 
<VTKFile type="UnstructuredGrid" version="0.1">
  <UnstructuredGrid>
    <Piece NumberOfPoints="NumberOfNodes" NumberOfCells="NumberOfCells">
      <Points>
        <DataArray Name="geometry" />
      </Points>
      <Cells>
        <DataArray Name="connectivity" />
        <DataArray Name="types" />
      </Cells>
      <PointData>
        <DataArray Name="TIME">step</DataArray>
        <DataArray Name="vtkOriginalPointIds" />
        <DataArray Name="vtkGhostType" />
        <DataArray Name="f" />
      </PointData>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

  uint8_t   vtkGhostType         [1]*{1200} = 0 / 0
  int64_t   vtkOriginalPointIds  [1]*{1200} = 0 / 1199

As one can see, something has happend in the data-arrays when naming f.
I’ll open an issue and hopefully resolve it quickly

1 Like

Reported, see : Complex variables not saved to VTK scheme in VTXWriter · Issue #2828 · FEniCS/dolfinx · GitHub for progress