Volume of an element

That is because it is not supoprted at the moment, and the syntax:

is not correct.
Why don’t you use:

Ve = fem.FunctionSpace(domain, ("DG", 0))
q_degree = 3
vol = fem.Function(Ve)
fem.petsc.assemble_vector(vol.vector, fem.form(
    1*ufl.TestFunction(Ve)*ufl.dx(metadata={"quadrature_degree": q_degree})))
vol.x.scatter_forward()

which amounts to assembling 1 over each element, i.e. getting the volume of it with linear complexity.

2 Likes