Cannot save adn Reopen to visualize

I am trying to save a time-dependent equation into a single file and then to visualize externally. The code (not all) is below

u,v = ufl.TestFunction(V), ufl.TrialFunction(V)

Now, we interpolate the function f over the mesh

Q = fem.functionspace(msh, (“Lagrange”, 5))
expr = fem.Expression(source, V.element.interpolation_points())
f = fem.Function(V)
f.interpolate(expr)
un = fem.Function(V)
un.x.array[:] = f.x.array

a = (uv + ufl.dot(ufl.grad(u), ufl.grad(v))) * ufl.dx
L =((un + dt
f) * v ) * ufl.dx

uh = fem.Function(V)
uh.x.array[:] = un.x.array

xdmf = io.XDMFFile(msh.comm, “HeatEquation.xdmf”, “w”)
xdmf.write_mesh(msh)

bilinear_form = fem.form(a)
linear_form = fem.form(L)
A = assemble_matrix(bilinear_form, bcs= [bc])
A.assemble()
b = create_vector(linear_form)

solver = PETSc.KSP().create(msh.comm)
solver.setOperators(A)
solver.setType(PETSc.KSP.Type.PREONLY)
solver.getPC().setType(PETSc.PC.Type.LU)

for i in range(num_steps):
t += dt

# Update the right hand side reusing the initial vector
with b.localForm() as loc_b:
    loc_b.set(0)
assemble_vector(b, linear_form)

# Apply Dirichlet boundary condition to the vector
apply_lifting(b, [bilinear_form], [[bc]])
b.ghostUpdate(addv=PETSc.InsertMode.ADD_VALUES, mode=PETSc.ScatterMode.REVERSE)
set_bc(b, [bc])

# Solve linear problem
solver.solve(b, uh.x.petsc_vec)
uh.x.scatter_forward()

# Update solution at previous time step (u_n)
un.x.array[:] = uh.x.array

# Write solution to file
xdmf.write_function(uh, t)

xdmf.close()

But when I visualize uh using pyvista, I have something like this

P.S. Is there another way to save file to be compatible with VisIT? Or do you know some other software for post-processing. I tried with OVITO, but it says it cannot open the file, even if I tried to save them as .pvt or .vtk

I use JupyterLab in Doker

As there is no pyvista plotting commands here, it’s hard to say what has happened to the output.

It seems like you can read in VTK-files to visit: 2. The VTK file format — VisIt User Manual 3.2.2 documentation
this using dolfinx.io.VTKFile or the XDMFFile 7. The Xdmf file format — VisIt User Manual 3.2.2 documentation