Basis derivative tabulation is broken in 1D

Issue #9 resolved
Matthew Knepley created an issue

Here is a small test that shows that 'master' disagrees with FIAT 0.9.9 and with common sense:

import numpy
from FIAT.polynomial_set import mis
from FIAT.reference_element import default_simplex
from FIAT.quadrature import make_quadrature

order = 1
quadrature = make_quadrature(default_simplex(1), order)

from FIAT.lagrange import Lagrange

degree = 1
element = Lagrange(default_simplex(1), degree)

vertices = [n.get_point_dict().keys()[0] for n in element.dual.get_nodes()]

quadpts = numpy.array(quadrature.get_points(), dtype=numpy.float64)
quadwts = numpy.array(quadrature.get_weights(), dtype=numpy.float64)
numQuadPts = len(quadpts)
evals = element.get_nodal_basis().tabulate(quadrature.get_points(), 1)
basis = numpy.array(evals[mis(1, 0)[0]], dtype=numpy.float64).transpose()
numBasis = element.get_nodal_basis().get_num_members()
basisDeriv = numpy.array([evals[alpha] for alpha in mis(1, 1)],
dtype=numpy.float64).transpose()

print "order: %d" % order
print "degree: %d" % degree
print "numQuadPts: %d" % numQuadPts
print "basis:"
print basis
print "basisDeriv:"
print basisDeriv

Comments (13)

  1. Jan Blechta

    I believe @knepley is correct here. Do you agree @martinal, @meg so that we can just revert this change before release?

  2. Prof Garth Wells

    Was this caused by confusion around what is the reference element in 1D, i.e. FIAT (-1, 1) and UFC (0, 1)?

  3. Martin Sandve Alnæs

    I'm not at all intimately familiar with FIAT.

    If I understand the situation correctly, in the commit you mentioned above the derivatives were scaled by 0.5 probably to "fix" some issue another place, probably failing regression tests in FFC.

    I'm guessing it's related to the difference between FIAT and FFC/UFC reference cells [-1,+1] vs [0,1]. If this is correct, just reverting the above commit will show up as wrong results somewhere else (e.g. ffc or dolfin tests) and a followup fix will be needed somewhere.

  4. Jan Blechta

    Yes, Martin, it compensates with something else. I'll try bisecting FFC later to find the regression there.

  5. Prof Garth Wells

    @blechta Would it be a lot of work to add a simple py.test framework to FIAT? This example could go in as a test.

  6. Log in to comment