← Back to team overview

ffc team mailing list archive

compiling forms

 

I've tried to recompile the updated elasticity form present in the old
FEniCS modules with the new FFC. I've modified the syntax as:

# Test form for updated elasticity

name = "ElasticityUpdated"
element1 = VectorElement("Discontinuous Lagrange", "tetrahedron", 0, 9)
element2 = VectorElement("Lagrange", "tetrahedron", 1)

nuv = Constant("tetrahedron")	# viscosity coefficient

v = TestFunction(element2)
f = Function(element2)
sigma = Function(element1)
epsilon = Function(element1)

def tomatrix(q):
    return [ [q[3 * i + j] for i in range(3)] for j in range(3) ]

sigmam = tomatrix(sigma)
epsilonm = tomatrix(epsilon)

L = ( dot(f,v) - dot(sigmam, grad(v)) - nuv * dot(epsilonm, grad(v)) ) * dx


but I obtain the following error:

Traceback (most recent call last):
  File "/usr/bin/ffc", line 180, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/bin/ffc", line 107, in main
    execfile(outname, ns)
  File "ElasticityUpdated.py", line 27, in <module>
    sigmam = tomatrix(sigma)
  File "ElasticityUpdated.py", line 25, in tomatrix
    return [ [q[3 * i + j] for i in range(3)] for j in range(3) ]
  File
"/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py",
line 112, in __getitem__
    return Form(self)[component]
  File
"/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py",
line 636, in __getitem__
    w.monomials = [p[component] for p in self.monomials]
  File
"/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py",
line 478, in __getitem__
    w = Monomial(self.basisfunctions[0][component])
  File
"/usr/lib/python2.5/site-packages/ffc/compiler/language/algebra.py",
line 218, in __getitem__
    if self.element.value_mapping(component) == Mapping.PIOLA:
  File "/usr/lib/python2.5/site-packages/ffc/fem/mixedelement.py", line
76, in value_mapping
    (sub_element, offset) = self.value_offset(i)
  File "/usr/lib/python2.5/site-packages/ffc/fem/mixedelement.py", line
104, in value_offset
    raise RuntimeError("Component does not match value dimension")
RuntimeError: Component does not match value dimension


I've tried to also use the index notation but ffc doesn't like the product
between an index and an 'int'.

L = ( f[i] * v[i] - sigma[3*i+j] * D(v[i],j) - nuv * epsilon[3*i+j] *
D(v[i],j) ) * dx


I couldn't find any similar example in ffc manual or dolfin demos. Thanks
for your help.

Regards,
Alessio Quaglino



Follow ups