Failure to select quadrature rule for empty forms

Issue #48 resolved
Martin Sandve Alnæs created an issue

Was - Empty integrals are not detected early enough

This dolfin program from @Gabrielbalaban results in an internal error in ffc that is the result of having 0 integrals in the form, which should probably be detected at an earlier stage.

from dolfin import *

mesh = UnitCubeMesh(1,1,1)
M = VectorFunctionSpace(mesh,"CG", 2)*FunctionSpace(mesh, "DG", 0)
U = Function(M)
vq = TestFunction(M)

#This one produces a cryptic error message.
u,p = U.split()

#This one works fine.
#u,p = split(U)

F = grad(u) + Identity(3)
psi = tr(F) - 3 + p*(det(F) - 1)

R = derivative(psi*dx, U, vq)
assemble(R)

Comments (6)

  1. Martin Sandve Alnæs reporter

    I've fixed the actual bug here, the choice of quadrature rule now defaults to canonical when the form is empty. Changing the last line in the example here to

    r = assemble(R)
    print r
    print norm(r)
    

    will work as it should, giving a zero vector instead of the cryptic error message.

    Note that 'as it should' is not 'as Gabriel expected', because U.split() and split(U) are fundamentally different operations, but that is a whole other issue already in the bug tracker somewhere.

  2. Log in to comment