Hello everyone,
I am using RT elements, and I wanted to visualize a single shape function on ParaView, just to check if what I am doing is correct.
I’v learned that I have to interpolate my function on a DG vector function space (and avoid to write directly to VTK file, because of the default CG-1 interpolation).
Since the number of dofs of RT function space is equal to the number of facets (dof = norm of the vector normal to the facet), I am expecting to see a vector centered on a facet.
But when I open my XDMF file on Paraview, I get values on vertices (not on facets center), and I also got redundent points on the same coordinates (nb of points = 3* nb of triangle in 2D), because it didn’t manage points in common between 2 cells.
Here is my following code to export one single RT shape function:
import dolfin as dlf
import numpy as np
mesh = dlf.RectangleMesh(dlf.Point(0.0, 0.0),
dlf.Point(0.03 , 0.03),
10,
10,
"left")
V = dlf.FunctionSpace(mesh, "RT", 1)
f = dlf.Function(V)
ndofs = V.dim()
dofmap = V.dofmap()
j = np.zeros(ndofs)
dof = 15 # for example
j[dof] = 1
f.vector().set_local(j)
Vv = dlf.VectorFunctionSpace(mesh, "DG", degree=1, dim=2)
fv = dlf.interpolate(f, Vv)
encoding = dlf.XDMFFile.Encoding.ASCII
with dlf.XDMFFile("out.xdmf") as outfile:
outfile.write(mesh)
outfile.write_checkpoint(fv, "current", 0, append=True, encoding=encoding)
And the visualization on Paraview of the output XMDF file
Am I missing something ?
Thank you !