This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Quadrature elements

+4 votes

I am using an expression, which is only defined at the quadrature points in my computations. I used to be able to do things like:

from dolfin import *

mesh = UnitSquareMesh(10,10,'crossed')
el = FiniteElement("Quadrature", degree=3)

class E(Expression):
    def __init__(self):
       Expression.__init__(self,element=el)

    def eval(self,value,x):
        value[0] = 1.0


e = E()
print assemble(e*dx)

which now produces an error:

An Integral without a Domain is now illegal.
Traceback (most recent call last):
  File "test_q.py", line 16, in <module>
    print assemble(e*dx)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/measure.py", line 426, in __rmul__
    return Form([integral])
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/form.py", line 88, in __init__
    self._integrals = _sorted_integrals(integrals)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/form.py", line 45, in _sorted_integrals
    ufl_assert(d is not None, "An Integral without a Domain is now illegal.")
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/assertions.py", line 37, in ufl_assert
    if not condition: error(*message)
  File "/Applications/FEniCS.app/Contents/Resources/lib/python2.7/site-packages/ufl/log.py", line 151, in error
    raise self._exception_type(self._format_raw(*message))
ufl.log.UFLException: An Integral without a Domain is now illegal.

What am I doing wrong here?

asked May 5, 2015 by ae FEniCS Novice (290 points)

Have you tried:

print assemble(e*dx(mesh))

?

Great, thanks a lot!

...