Hello! I have a question for the exact definition of DOFs in RT2 space (with 8 DOFs in each element in 2D). My understanding is that the basis functions on the edges (2D) should have zero moments in the element, i.e., if multiplying one edge basis by any test function in VectorFunctionSpace(mesh,‘DG’,0), its integration should be 0. But in fact, that is not true based on my computation. I put a short code as follows. the Any help is highly appreciated! Thanks.

P.S. I am using the older version 1.5.0 of Fenics.

from fenics import *

mesh = UnitSquareMesh(2,2,‘crossed’)

mesh.init()

RT2 = FunctionSpace(mesh,‘RT’,2)

dofmap = RT2.dofmap()

tau = Function(RT2)

tau.vector()[:] = 0.0

%Set all boundary DOF = 1.0 and all interior DOF = 0.0.

for cell in cells(mesh):

cell_dof = dofmap.cell_dofs(cell.index())

for l1, l2 in enumerate(cell.entities(1)):

for index in dofmap.tabulate_facet_dofs(l1):

tau.vector()[index] = 1.0

DG0 = VectorFunctionSpace(mesh,‘DG’,0)

w = TestFunction(DG0)

L = inner(tau,w)*dx

b = assemble(L).array().reshape(-1,2)

print(b)

%I should get b[:]==0. But I get the following:

array([[ 0.0625 , -0.02083333],

[ 0.01041667, -0.03125 ],

[ 0.01041667, 0.03125 ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ],

[ 0. , 0. ]])