Hello everyone,
I can’t figure out why I have such big difference between dolfin VS dolfinx with the assemble function.
I am using RT elements. (I have not the problem with CG or DG elements).
Here is a code snippet to reproduce my problem:
import numpy as np
import basix
# Using Dolfin
import dolfin as dlf
mesh_dlf = dlf.BoxMesh(dlf.Point(0.0, 0.0, 0.0),
dlf.Point(1.0, 1.0, 1.0),
10,10,10)
V_dlf = dlf.FunctionSpace(mesh_dlf, "RT", 1)
f_dlf = dlf.Function(V_dlf)
f_dlf.vector().set_local(np.ones(V_dlf.dim()))
vol_dlf = dlf.assemble(dlf.Constant(1) * dlf.Measure('dx', domain=mesh_dlf))
res_dlf = dlf.assemble(dlf.dot(f_dlf,f_dlf)**(1/2) * dlf.dx)
print(vol_dlf)
print(res_dlf)
# Using Dolfinx
import dolfinx as dlfx
from mpi4py import MPI
import ufl
mesh_dlfx = dlfx.mesh.create_unit_cube(MPI.COMM_WORLD,
10,
10,
10,
dlfx.mesh.CellType.tetrahedron)
V_dlfx = dlfx.fem.functionspace(mesh_dlfx,("RT",1))
f_dlfx = dlfx.fem.Function(V_dlfx)
f_dlfx.vector.setArray(np.ones(f_dlfx.vector.size))
vol_dlfx = dlfx.fem.assemble_scalar(dlfx.fem.form(dlfx.fem.Constant(mesh_dlfx, 1.0) * ufl.dx))
res_dlfx = dlfx.fem.assemble_scalar(dlfx.fem.form(ufl.dot(f_dlfx,f_dlfx)**(1/2) * ufl.dx))
print(vol_dlfx)
print(res_dlfx)
I first compute the volume of the domain just to check if everything is ok (and it is indeed: vol_dlf ~ vol_dlfx ~ 1).
But I have a big difference when comparing the norm of the function on the domain:
res_dlf = 141.42
res_dlfx = 312.47
Is it related to different lagrangevariant used ? The default lagrangevariant for RT with dolfinx is “legendre”, but I can’t find the one used with dolfin.
Thanks