Unable to compile Stokes.ufl, "Since there are no variables, ... it cannot be differentiated

Issue #1111 invalid
Alex Melville created an issue

I’m trying to build fenics completley from source, I’m up to Dolfin so far.

I’m having trouble building 2017.2 (unfortunately this doesn’t seem to be selectable on the version dropdown), note that I’m attempting to compile on a ppc64le system, Python 3.6.

This error comes up during the build process, I can run ffc outside of the build process to reproduce it, too:

(fenics_compile) [<redacted>@<redacted> cpp]$ ffc -l dolfin Stokes.ufl -v
Traceback (most recent call last):
  File "<redacted>anaconda3/envs/fenics_compile/bin/ffc", line 30, in <module>
    sys.exit(load_entry_point('fenics-ffc==2017.2.0', 'console_scripts', 'ffc')())
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/main.py", line 217, in main
    resultcode = _compile_files(args, parameters, enable_profile)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/main.py", line 256, in _compile_files
    code_h, code_c = compile_ufl_data(ufd, prefix, parameters)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/main.py", line 99, in compile_ufl_data
    parameters=parameters)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/compiler.py", line 143, in compile_form
    prefix, parameters, jit)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/compiler.py", line 190, in compile_ufl_objects
    ir = compute_ir(analysis, prefix, parameters, jit)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/representation.py", line 171, in compute_ir
    for e in elements]
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/representation.py", line 171, in <listcomp>
    for e in elements]
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/representation.py", line 203, in _compute_element_ir
    fiat_element = create_element(ufl_element)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/fiatinterface.py", line 99, in create_element
    element = _create_fiat_element(ufl_element)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_ffc-2017.2.0-py3.6.egg/ffc/fiatinterface.py", line 196, in _create_fiat_element
    element = ElementClass(fiat_cell, degree)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/lagrange.py", line 56, in __init__
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/polynomial_set.py", line 176, in __init__
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/expansions.py", line 262, in tabulate_derivatives
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/expansions.py", line 104, in _tabulate_dpts
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/expansions.py", line 50, in form_derivative
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/fenics_fiat-2017.2.0-py3.6.egg/FIAT/expansions.py", line 50, in <listcomp>
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/sympy-1.5.1-py3.6.egg/sympy/core/function.py", line 2448, in diff
    return Derivative(f, *symbols, **kwargs)
  File "<redacted>anaconda3/envs/fenics_compile/lib/python3.6/site-packages/sympy-1.5.1-py3.6.egg/sympy/core/function.py", line 1250, in __new__
    it cannot be differentiated.''' % expr))
ValueError:
Since there are no variables in the expression [0, 0], it cannot be
differentiated.

Also, it’d be really helpful if the script compiler gave more debugging information,

“Since there are no variables in the expression [0,0] it cannot be differentiated.”

  • What line in the script caused the error (if possible)
  • What variables is it expecting?
  • What expression is causing the problem?
  • Where is it being differentiated?
  • What is it taking the derivative of?

Since this script comes with dolfin (dolfin\demo\documented\stokes-taylor-hood\cpp\Stokes.ufl), here’s my guesses as to what’s going on:

  • The test case is fine but I’m using the wrong version of sympy (is 1.5.1 ok?)
  • The test case is fine but there’s a bug in fenics-ffc or fiat and I need to upgrade to a slightly newer version
  • The test case is fine but there’s some strange problem with the parser on ppc64le
  • The test code is bad, it’s mathematically invalid, it never ran, and I should skip it
  • The test code is fine but I’m missing some data file and I should skip it (maybe missing from source control?)

    • It doesn’t seem to pull data from a file so this doesn’t seem likely to me
  • This is due to some obscure difference between Python versions and I should start over with a different version of Python

I’m not opposed to using the latest Dolfin, but 2017.2 is known to work on the experiments I need to run on AMD64 systems and I have a pretty decent list of dependencies set up for it.

If there’s no possible way to get 2017.2 working on ppc64le I’d try something newer, but I’d rather avoid it for consistency’s sake.

Also, for reference, here is the contents of Stokes.ufl

# The bilinear form a(u, v) and Linear form L(v) for the Stokes
# equations using a mixed formulation (Taylor-Hood elements).
#
# Compile this form with FFC: ffc -l dolfin Stokes.ufl
P2 = VectorElement("Lagrange", triangle, 2)
P1 = FiniteElement("Lagrange", triangle, 1)
TH = P2 * P1

(u, p) = TrialFunctions(TH)
(v, q) = TestFunctions(TH)

f = Coefficient(P2)

a = (inner(grad(u), grad(v)) - div(v)*p + div(u)*q)*dx
L = dot(f, v)*dx

Thanks,

Comments (3)

  1. Log in to comment