Erroneous output when tdim != gdim for compute_vertex_values on RT

Issue #10 resolved
Chris Richardson created an issue

See https://bitbucket.org/fenics-project/dolfin/issue/75

FFC generates code for compute_vertex_values() which is the wrong dimension when tdim != gdim (at least for RT elements). See example in dolfin issue #75.

Comments (12)

  1. Martin Sandve Alnæs

    I think the bug is somewhere in this behaviour in fiatinterface.py:

    def reference_cell(dim):
        ...
        return FIAT.ufc_simplex(cellname2dim[dim])
    
    # These lines in _create_fiat_element:
    fiat_cell = reference_cell(cell.cellname())
    element = ElementClass(fiat_cell, degree)
    

    Note how gdim is lost through cellname2dim[cell.cellname()] and FIAT builds a pure 2D RT element. Now the value size of element is 2 instead of 3 which results in the bug you tried to fix with your patch. I'm not sure what the proper solution is.

  2. Chris Richardson reporter

    Sure, I am no expert on FFC/FIAT - and my patch was just a result of messing around to find something that sort of works (!) I know it is not right....

  3. Martin Sandve Alnæs

    Fix issue 10.

    interpolate_vertex_values for elements where reference and physical value size is different. The fix will not extend to mixed elements, e.g. RT*DG0 on a manifold will likely fail.

    → <<cset b97e2b3689a6>>

  4. Martin Sandve Alnæs

    For the record, there are probably more issues with this code for uncommon combinations such as mixed and fancy elements on manifolds. I added a safeguard in this particular code that should detect if the same problem pops up with another combo.

  5. Martin Sandve Alnæs

    I had to make another fix to pass the tests: when the safeguard fails, interpolate_vertex_values is generated to throw an exception instead of failing at runtime. This will happen e.g. with a RT1*DG0 mixed element on a manifold (see the interpolate_vertex_values implementations in ProjectionManifold.h). Fixing this looks a bit trickier (because of code organization), I have no plans to do so.

  6. Marie Elisabeth Rognes

    The original issue (DOLFIN issue 75, which was marked resolved, but was definitely still failing) now has a fix in DOLFIN next. I'll resolve this when that fix has graduated to master.

  7. Marie Elisabeth Rognes

    For completeness here: @martinal, FIAT should build an element of dimension tdim (topological dimension) as the reference element does not need to know about the geometrical dimension of the physical element. I'm not sure what the fixes made in the fall were (and I'm not sure if I want to ...)

  8. Log in to comment