I am porting some (originally legacy) c++ code from fenicsx 0.6.0 to fenicsx 0.7.0. With version 0.7.0 vector quadrature elements do not behave as expected. Running the python example below with vector quadrature elements defined using quadrature_element(…) and VectorElement(…) results in the output:
new version:
array size scalar: 3072
array size vector: 3072
old version:
array size scalar: 3072
array size vector: 6144
For both definitions, I would expect the vector valued function to have twice as many dofs as the scalar function. Why isn’t that the case?
from dolfinx import (fem, mesh)
from basix.ufl import (quadrature_element)
from ufl import (FiniteElement, VectorElement)
from mpi4py import MPI
# common defintions
geoShape = "triangle"
degT = 2
degQ = degT
dim = 2
# mesh
msh = mesh.create_rectangle(comm=MPI.COMM_WORLD,
points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),
cell_type=mesh.CellType.triangle)
# new code -> not working as intended
quScaElem = quadrature_element(geoShape, (), "default", degQ)
quVecElem = quadrature_element(geoShape, (dim,), "default", degQ)
qu_1 = fem.functionspace(msh, quScaElem)
qu_2 = fem.functionspace(msh, quVecElem)
Fsca = fem.Function(qu_1)
Fvec = fem.Function(qu_2)
print("\nnew version:")
print("array size scalar: " + str(Fsca.x.array.size))
print("array size vector: " + str(Fvec.x.array.size))
# old code -> working as intended
quScaElem = FiniteElement(family = "Quadrature",
cell = geoShape,
degree = degQ,
quad_scheme="default")
quVecElem = VectorElement(quScaElem, dim)
qu_1 = fem.functionspace(msh, quScaElem)
qu_2 = fem.functionspace(msh, quVecElem)
Fsca = fem.Function(qu_1)
Fvec = fem.Function(qu_2)
print("\nold version:")
print("array size scalar: " + str(Fsca.x.array.size))
print("array size vector: " + str(Fvec.x.array.size))