Quadrature function space


with the latest dolfinx (docker image from today), I realized that there must have been some change to Quadrature function spaces. If I now want to create a function space on a Quadrature element, i.e.

#!/usr/bin/env python3
from dolfinx import BoxMesh, FunctionSpace, VectorFunctionSpace, Function
from dolfinx.io import XDMFFile
import dolfinx.cpp.mesh
from mpi4py import MPI
import numpy as np
from ufl import TrialFunction, TestFunction, FiniteElement, VectorElement, TensorElement


mesh = BoxMesh(comm, [np.array([0.0, 0.0, 0.0]),np.array([2.0, 1.0, 1.0])], [5, 5, 5],
               dolfinx.cpp.mesh.CellType.tetrahedron, dolfinx.cpp.mesh.GhostMode.none)

P_q = FiniteElement("Quadrature", mesh.ufl_cell(), 1)
V_q = FunctionSpace(mesh, P_q)

I get a RuntimeError: Can’t find name Quadrature. However, the ufl type “Quadrature” still exists, so the FiniteElement command works.

Has the syntax for this changed? And, would it be equivalent to use a DG space instead, i.e.
FunctionSpace(mesh, ("DG", 0)) ?

Thanks for any help!



Quadrature functions spaces are not supported in dolfinx yet, but fixing them is on my to do list so they shouldn’t be too far away.

All the best,

Hi Matthew,

Thanks for pointing to this! And, maybe another thing: Can’t a DG function space be used equivalently instead? I.e., at least if I have a linear tet mesh with one Gauss point, shouldn’t FunctionSpace(mesh, ("DG", 0)) yield the same?


Yes, that would work for order 0, although I don’t think it generalises to Quadrature element with more than one point

Yes, I have the feeling that there is something wrong going on for higher order meshes…
I have a nonlinear solid material that needs to be iterated at Quadrature point level and for 2nd order displacement, hence using a DG1 for the internal variable, I’m running into convergence issues. :-/
So I’d be very happy if dolfinx will support the Quadrature function space again! :slight_smile: