Dear NGSpy Team,
I was just testing my L
2 projection, projecting u
ref=x
2 on a finite element space V consisting of linear polynomials, but somehow the error (Pu-u,Pu) is not zero, but of order 10^
-6.
Here is my code:
Code:
uref = CoefficientFunction(x*x)
mesh = Mesh(unit_square.GenerateMesh(maxh=0.1))
V = L2(mesh, order=1)
u = V.TrialFunction()
v = V.TestFunction()
L = LinearForm(V)
L += uref * v * dx
a = BilinearForm(V, symmetric=True)
a += u*v*dx
Puref = GridFunction(V)
a.Assemble()
L.Assemble()
Puref.vec.data = a.mat.Inverse(V.FreeDofs(), inverse='sparsecholesky') * L.vec
print(Integrate((uref-Puref)*Puref, mesh))
Could you point me out to what is wrong?
Thank you!