Hi Tim,
you can compute and process element-matrices directly within Python, without going over the testout file:
Code:
from netgen.geom2d import unit_square
from ngsolve import *
mesh = Mesh(unit_square.GenerateMesh(maxh=2))
fes = HDiv(mesh, order=5)
u,v = fes.TnT()
a = BilinearForm(fes)
a += u*v*dx
igt = a.integrators[0]
ei = ElementId(0)
el = fes.GetFE(ei)
trafo = mesh.GetTrafo(ei)
mat = igt.CalcElementMatrix(el, trafo)
print (mat)
import scipy.linalg
ev,evec = scipy.linalg.eigh(a=mat)
You have to look into the H(div) basis functions, in the file fem/hdivhofe_impl.hpp, starting line 89:
We are using something like Dubiner, multiplied by RT0 functions. This gives us exactly the RT space.
We could use a construction like the Dubiner, but with different Jacobi weights to improve non-zero entries. If it improves conditioning (after diagonal scaling) it is another good argument to change.
The last block should better be a scaled Legendre, maybe this is what you have observed.
Joachim