How to check 1D XDMF file?

Hi everyone,
I am trying to check a mesh file in dolfin-x as a XDMF file by using paraview. But according to this topic (Can't view xdmf checkpoint of Function in paraview), it seems that it is not possible to do this. So, how could I check the proposed saved mesh file?
Thanks in advance

As your mesh is not 1D, I am not sure what your issue is.
The following 1D mesh can be visualized in paraview:

from mpi4py import MPI
from dolfinx import IntervalMesh, Function, FunctionSpace
from dolfinx.cpp.mesh import CellType
from dolfinx.io import XDMFFile
import numpy as np
mesh = IntervalMesh(MPI.COMM_WORLD, 10, [0,1])
V= FunctionSpace(mesh, ("CG",1))
v = Function(V)
def expr(x):
    return x[0]**2
v.interpolate(expr)

with XDMFFile(MPI.COMM_WORLD, "mesh.xdmf", "w") as file:
    file.write_mesh(mesh)
    file.write_function(v)

You can look at the nodes of the mesh in Paraview by visualizing the mesh as points, and for instance increase the point size or render them as spheres.

To look at the function data, you can either use the previous approach, or use plot over line.

1 Like

Dear @dokken
Thanks a lot for your kind help. I was looking for the same example that you have mentioned and it works properly.