Integrate over edges

Hi Fenics experts, I need to compute the following integral over the internal edges of the mesh

where E is an internal edge and t_{E} is a unit tangent vector of the edge.
I am thankful for every hint.

Hi,
I do not understand what you are trying to compute since the gradient is not defined over the edges (for P1-Lagrange elements it is discontinuous across a facet). If you are implying that y and v are interpolated with polynomials over the edges and not the cells, then I am not sure it is currently possible to do so.
I imagine it will be possible when mixed dimensional interpolation will be released, there you will be able to couple a PDE on the mesh cells with a PDE on the mesh facets for instance.

First of all, many thanks for your answer. To answer your question. I would like to implement a stabilization scheme. The stabilization term contains the following expression

where \mathcal{E}{h} is the set of all internal edges of the mesh and y{h}, v_{h} \in P_{1}(T) for each element T of the triangulation.

Hi, so how are \nabla y_h and \nabla v_h defined on E since they are \mathbb{P}_0 in each cells sharing a common facet ? Is there a jump operator missing maybe ?

Hi, since y_{h} and v_{h} are P_{1} finite element functions on each element T you can write

where h_{E} is the length of the unit tangent vector ( sorry, I forgot h_{E} in my original formulation of the question above ) . Moreover, x_{E,1} and x_{E,2} are the endpoints of the edge E. The unit tangent vector is defined by
.
My hope is that there is a possibility to implement a bilinearform which correspond to the stabilization term.

OK, I imagine you can use something like:

n = FacetNormal(mesh)
t = ufl.perp(n)
a = avg(dot(grad(y),t))*avg(dot(grad(v),t))*dS
1 Like

Hi, it works. Thank you very much for the support.

Hi, I have an additional question. Is it possible to integrate over a specific edge ? The reason for my question is the following. I would like to compute
,

where \delta_{E} is a parameter (not constant and different for each integral) for the integral over the edge E. Hence, it would be helpful if there is a possibility to access on each edge integral.

Many thanks in advance for your support.

HI,
yes if you have only a few different integrals over some sub-part over the internal facets, you can use a facets MeshFunction and use dS = Measure("dS", subdomain_data=facets) to mark the different regions, then use ...*dS(1)+...*dS(2)+...*dS(3) for your different integrals.
If the \delta_E coefficient is really different for all edges, then define it for instance as a Function living on the edges only through the Discontinuous Lagrange Trace FunctionSpace, for instance for a P1-function on edges:

Vedge = FunctionSpace(mesh, "Discontinuous Lagrange Trace", 1)
delta= Function(Vedge)
...
a = avg(delta*dot(grad(y),t))*avg(dot(grad(v),t))*dS

Hi,
many thanks for your support. I have a little question about your reply. Suppose I have defined the measure dS on the subdomain_data = facets. Does the number 1 in the measure dS(1) refer to the edge.index = 1 ?

Hello, no it refers to the subdomain number that comes either from your mesh generation (if you tag some part of the internal edges as 1) if facets is read from a mesh file. Otherwise, you must define manually some mathematical SubDomain and mark the facets MeshFunction such as:

class MiddleLine(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.5)
MiddleLine().mark(facets, 1)