FFC compilation fails for RT x Discontinuous Lagrange Trace

Issue #159 resolved
Marie Elisabeth Rognes created an issue

The below UFL code fails with the following error:

File "/home/meg/local/fenics/master/lib/python2.7/site-packages/FIAT/mixed.py", line 103, in tabulate arr[slice(ir), slice(cr)] = tab

ValueError: could not broadcast input array from shape (3,1,2) into shape (3,1,3)

# Define finite element spaces and mixed function space
S = FiniteElement("RT", triangle, 1)
V = FiniteElement("Discontinuous Lagrange Trace", triangle, 0)
M = MixedElement(S, V)
#M = FunctionSpace(mesh, MixedElement(S, V))

# Unknowns and test functions
s = TrialFunction(M)
phi = TestFunction(M)

# Define variational formulation (backward Euler)
a = inner(s[0], phi[0])*dx()

# Runs with old fenics dev Docker image labelled 2016.1.0dev
# Fails with current FFC master

Comments (4)

  1. Miklós Homolya

    It seems that the issue is not in MixedElement but rather in HDivTrace, and the offending commit is 38751784 in FIAT. The following patch to FIAT seems to fix the issue:

    diff --git a/FIAT/hdiv_trace.py b/FIAT/hdiv_trace.py
    index 4e40019..a59e051 100644
    --- a/FIAT/hdiv_trace.py
    +++ b/FIAT/hdiv_trace.py
    @@ -204,7 +204,7 @@ class HDivTrace(FiniteElement):
                 # If not successful, return NaNs
                 if not success:
                     for key in phivals:
    -                    phivals[key] = np.full(shape=(sd, len(points)), fill_value=np.nan)
    +                    phivals[key] = np.full(shape=(self.space_dimension(), len(points)), fill_value=np.nan)
    
                     return phivals
    
  2. Marie Elisabeth Rognes reporter

    Thanks Miklos, that fixes the compilation error. Will you push this fix?

    I'm still getting really non-satisfactory results for the complete test case however, possibly related to UFLACS, I'll find a new MWE.

  3. Log in to comment