dofs of FacetFESpace

Hello,

I’m running the following code:

from ngsolve import *
from netgen.geom2d import SplineGeometry

geo = SplineGeometry()
geo.AddRectangle( (0.0, 0.0), (1.0, 1.0), bc=1 )
mesh = Mesh( geo.GenerateMesh(maxh=1.6))
mesh.Refine()
mesh.Refine()
mesh.Refine()

Q = FacetFESpace(mesh, order=1)

print("ndof qfe:", Q.ndof)

For the FacetFESpace, for order 1, I expect 2 DOFs per edge, but it seems I’m getting slightly more. There are a total of 208 edges, and I get a total of 493 DOFs for the whole mesh (I expect 416). For order 2, I expect to 624 DOFs, but get 701. As I increase the order, I realised that the total number of DOFs I get for the FacetFESpace, for the given mesh, is: DOFs = (p+1)*nrEdges + 77. Could you explain to me where the 77 extra DOFs comes from?

Thanks,
Sander

Dear Sander,

This is related to facets from the former meshes that you refined from. To these older facets the low order dofs are still created. However, you may check the CouplingTypes to see that they are marked as unused as they actually never appear in the usual assembly (no non-zero couplings will be reserved for these dofs). If you don’t like to have these ‘virtual’ facet dofs, you can save and reload the mesh which removes the refinement history and in turn also the virtual facets and hence the virtual dofs. You will get as many dofs as you expect.

Best,
Christoph

Thanks for the explanation!
Sander