Dolfin eBook Figure 26.1, Exception: Missing quad_scheme in quadrature element

As described in Figure 26.1:

from dolfin import *

mesh = UnitIntervalMesh(8)
V = FunctionSpace( mesh, "Lagrange", 2) 
Q = FunctionSpace( mesh, "Quadrature", 2)

print('done...')

Exception:

Calling FFC just-in-time (JIT) compiler, this may take some time.
Missing quad_scheme in quadrature element.
Traceback (most recent call last):
  File "/home/prusso/fenicsx-tutorials/main.py", line 5, in <module>
    Q = FunctionSpace( mesh, "Quadrature", 2)
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py", line 33, in __init__
    self._init_convenience(*args, **kwargs)
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py", line 100, in _init_convenience
    self._init_from_ufl(mesh, element, constrained_domain=constrained_domain)
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py", line 42, in _init_from_ufl
    ufc_element, ufc_dofmap = ffc_jit(element, form_compiler_parameters=None,
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/jit/jit.py", line 50, in mpi_jit
    return local_jit(*args, **kwargs)
  File "/usr/lib/petsc/lib/python3/dist-packages/dolfin/jit/jit.py", line 100, in ffc_jit
    return ffc.jit(ufl_form, parameters=p)
  File "/usr/lib/python3/dist-packages/ffc/jitcompiler.py", line 217, in jit
    module = jit_build(ufl_object, module_name, parameters)
  File "/usr/lib/python3/dist-packages/ffc/jitcompiler.py", line 130, in jit_build
    module, signature = dijitso.jit(jitable=ufl_object,
  File "/usr/lib/python3/dist-packages/dijitso/jit.py", line 165, in jit
    header, source, dependencies = generate(jitable, name, signature, params["generator"])
  File "/usr/lib/python3/dist-packages/ffc/jitcompiler.py", line 65, in jit_generate
    code_h, code_c, dependent_ufl_objects = compile_object(ufl_object,
  File "/usr/lib/python3/dist-packages/ffc/compiler.py", line 149, in compile_element
    return compile_ufl_objects(elements, "element", object_names,
  File "/usr/lib/python3/dist-packages/ffc/compiler.py", line 185, in compile_ufl_objects
    analysis = analyze_ufl_objects(ufl_objects, kind, parameters)
  File "/usr/lib/python3/dist-packages/ffc/analysis.py", line 125, in analyze_ufl_objects
    error("Missing quad_scheme in quadrature element.")
  File "<string>", line 1, in <lambda>
  File "/usr/lib/python3/dist-packages/ufl_legacy/log.py", line 158, in error
    raise self._exception_type(self._format_raw(*message))
Exception: Missing quad_scheme in quadrature element.

To get the exception I installed fenics with apt-get as described in the fenicsx-tutorial.pdf. So it seems there is maybe a change in the latest fenics from what was printed in Figure 26.1.

What I am trying to find out is what is the meaning here of “Q” (does that mean quadrature?) and also is there a way to use the most up to date fenics from apt-get to say the same thing that has changed from when dolfin book was created?

P.S. I see now that there is a “CG”, is that meant to be an equivalent in some way to “CG”? I was also able to find:
https://fenicsproject.org/qa/9635/quadrature-element/

where:

from dolfin import *

mesh = UnitSquareMesh(1,1)
fe = FiniteElement(family="Quadrature", cell=mesh.ufl_cell(), degree=2, quad_scheme="default")
fs = FunctionSpace(mesh, fe) 

I have not been far enough to verify that those are really equivalent but it is the best I have so far.

A quadrature element is an element used to represent a quantity at quadrature points. It does not have a set of underlying basis functions.

The family “Q” is an alternative to writing “CG” or “Lagrange”, and are defined as: DefElement: Lagrange

I dont understand this question. The FEniCS book was created back in 2012. The FEniCS tutorial was released in 2016 (compatible with version 2016.1.0 of dolfin). The FEniCSx tutorial was released in 2020, and is up to date with version 0.6.0 of DOLFINx. It has been recommended since Q2 of 2022 that people using fenics for new projects should use DOLFINx, see The new DOLFINx solver is now recommended over DOLFIN

1 Like