from dolfin import *
mesh = UnitIntervalMesh(2)
V = FunctionSpace(mesh, 'CG', 1)
u = TrialFunction(V)
v = TestFunction(V)
k1 = Expression('sin(x[0])*exp(x[0])', degree=2)
a1 = k1*u*v*dx
A1 = as_backend_type(assemble(a1)).array()
k2 = Expression('sin(x[0])*exp(x[0])', degree=3)
a2 = k2*u*v*dx
A2 = as_backend_type(assemble(a2)).array()
print A1
print A2
I can see the entries of A1 and A2 are different, and I'm curious how exactly the degree of k1/k2 makes different here. What happens when a matrix is assembled? I thought k1/k2 would be projected to CG1 first, but apparently, I was wrong.
In [63]: A1
Out[63]:
array([[ 0.30926758, 0.12185024, 0. ],
[ 0.12185024, 0.27557479, 0.02776519],
[ 0. , 0.02776519, 0.0251803 ]])
In [64]: A2
Out[64]:
array([[ 0.30926328, 0.12185723, 0. ],
[ 0.12185723, 0.27544346, 0.02776675],
[ 0. , 0.02776675, 0.0253416 ]])