I just figured out a problem in my code that results from using errornorm with discontinuous solutions:
from dolfin import *
mesh = UnitSquareMesh(10, 10)
Q = FunctionSpace(mesh, 'DG', 0)
P = Expression('x[1] > .5')
p = interpolate(P, Q)
print errornorm(P, p)
Above, I interpolate a step-function to a piecewise constant function space and I make sure that the discontinuity is resolved by the mesh. However, executing the code yields
0.0872871560944
which is clearly not the right answer. From the description of errornorm I could find out that it projects both functions to a higher degree discontinuous space, subtracts the coefficients and then square-integrates the resulting difference on the mesh associated with the discrete function space. Now it seems to me that some of the quadrature points are located at the discontinuity and therefore the projection to higher degree discontinuous spaces always smears out the jump on one side of the step. Is it possible to work around this issue?