Hello!
When running the following block of code in Colab, the resulting .xdmf file makes Paraview crash when opened:
domain = dolfinx.mesh.create_unit_cube(MPI.COMM_WORLD, 10, 10, 10)
V = fem.functionspace(domain, ("Lagrange", 1))
u = fem.Function(V)
with XDMFFile(MPI.COMM_WORLD, "foo1.xdmf", "w") as xdmf:
xdmf.write_mesh(domain)
xdmf.write_function(u)
If I try to open the same file with meshio using meshio.xdmf.read("foo1.xdmf")
, I get the following error:
---------------------------------------------------------------------------
ReadError Traceback (most recent call last)
<ipython-input-9-eb0f777a23e6> in <cell line: 1>()
----> 1 meshio.xdmf.read("foo1.xdmf")
2 frames
/usr/local/lib/python3.10/dist-packages/meshio/xdmf/main.py in read_xdmf3(self, root)
240 grids = list(domain)
241 if len(grids) != 1:
--> 242 raise ReadError("XDMF reader: Only supports one grid right now.")
243 grid = grids[0]
244 if grid.tag != "Grid":
ReadError: XDMF reader: Only supports one grid right now.
For importing packages, I run the following:
try:
import gmsh
except ImportError:
!wget "https://fem-on-colab.github.io/releases/gmsh-install.sh" -O "/tmp/gmsh-install.sh" && bash "/tmp/gmsh-install.sh"
import gmsh
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
!pip install meshio
import meshio
import ufl
from dolfinx.io import XDMFFile
from dolfinx import io, cpp, fem, mesh, plot
from mpi4py import MPI
I can’t seem to get where this issue is coming from. How can I fix this? Thanks in advance.