### Local and global facet normal for RT space

118

views

0

Hi, I want to understand how exactly the RT0 dofs are computed. Based on my understanding, the dof values are computed as the inner product of the value of the RT vector function (here is numer_flux) and the global facet normal (here I assume it is facet.normal()). But obviously there is some misunderstanding since the following verification code does not always returns 0. Any help is appropriated! Thank you!

Below is my code

from fenics import *

mesh = RectangleMesh(Point(-1,-1), Point(1,1), 2,2, 'right')

mesh.init()

W = FunctionSpace(mesh, "RT", 1)

f = Expression(('1','1'),degree=0)

numer_flux = project(f, W)

dofmap = W.dofmap()

for cell in cells(mesh):

Below is my code

from fenics import *

mesh = RectangleMesh(Point(-1,-1), Point(1,1), 2,2, 'right')

mesh.init()

W = FunctionSpace(mesh, "RT", 1)

f = Expression(('1','1'),degree=0)

numer_flux = project(f, W)

dofmap = W.dofmap()

for cell in cells(mesh):

for i, global_facet_index in enumerate(cell.entities(1)):

facet = Facet(mesh,global_facet_index)

f_normal = facet.normal().array()

local_facet_dof_index = dofmap.tabulate_facet_dofs(i)

global_facet_dof_index = dofmap.cell_dofs(cell.index())[local_facet_dof_index]

sigma_F = numer_flux(cell.midpoint())[0]*f_normal[0]

sigma_F += numer_flux(cell.midpoint())[1]*f_normal[1]

error = numer_flux.vector().get_local()[global_facet_dof_index] - sigma_F

print("facet_index=", global_facet_index, "error=",error)

Community: FEniCS Project

### 1 Answer

3

I believe facet.normal() is not the global normal but the local normal. You cannot compare the element quantities calculated with the element local normal vectors (sigma_F) with the assembled vector components (numer_flux). The normal vectors shared by two elements must have the same orientation, and therefore, they do not coincide with the local element normal vectors (which are all pointing outside of the element). That explains the sign difference you are seeing. More info about normal orientation at https://arxiv.org/pdf/1205.3085.pdf

Thank you very much. The resource is very helpful. The global normal is determined by the global indexes of vertices on the facet.

written
11 weeks ago by
Cuiyu

You are welcome. By the way, are you Cuiyu He who interned at the LLNL in 2016?

written
11 weeks ago by
Miguel

Please login to add an answer/comment or follow this question.