I am struggling to project a function into a FunctionSpace of the “Quadrature” family in classic legacy dolfin. Has anyone had any experience with this?
import dolfin as df
mesh = df.UnitSquareMesh(10, 10)
# Step 1: Create a Quadrature element specifying the quadrature scheme
quad_element = df.FiniteElement("Quadrature",
mesh.ufl_cell(),
degree=4,
quad_scheme="default")
# Step 2: Create a VectorElement from the Quadrature element
vector_element = df.VectorElement(quad_element)
# Step 3: Create the VectorFunctionSpace with the VectorElement
V = df.FunctionSpace(mesh, vector_element)
u = df.TrialFunction(V)
uf = df.Function(V)
v = df.TestFunction(V)
f = df.Expression("sin(x[0])*cos(x[1])", degree=2)
df.solve(df.inner(u,v)*df.dx == df.inner(f,v)*df.dx, uf)
#df.assemble(df.inner(u,v)*df.dx) #This one also fails
print("Quarature Test finished successfully!")
When I run the script I get the following error
Missing quad_scheme in quadrature element.
Traceback (most recent call last):
File “/home/gabriel/mywork/research_studies/CHESRA/chesra_gb/experiments/unload/quadrature_elem_test.py”, line 15, in
V = df.FunctionSpace(mesh, vector_element)
File “/usr/lib/petsc/lib/python3/dist-packages/dolfin/function/functionspace.py”, line 31, in init
self._init_from_ufl(*args, **kwargs)
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 “”, line 1, in
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.