I have an issue where the following Nonlinear Elasticity code will not compile the form on the last line when the commented out code is uncommented.
import dolfin as dl
dl.parameters["form_compiler"]["representation"] = "uflacs"
dl.parameters["form_compiler"]["quadrature_degree"] = 6
mesh = dl.UnitCubeMesh(1,1,1)
vectorP2Element = dl.VectorElement("P", mesh.ufl_cell(), 2) #space for u
scalarP1Element = dl.FiniteElement("P", mesh.ufl_cell(), 1) #space for p
TaylorHoodV = dl.FunctionSpace(mesh, dl.MixedElement([vectorP2Element,scalarP1Element]))
parameterV = dl.VectorFunctionSpace(mesh,"R",0,7) #7 parameter fung model
y = dl.Function(TaylorHoodV)
ytest = dl.TestFunction(TaylorHoodV)
ytrial = dl.TrialFunction(TaylorHoodV)
u,p = dl.split(y)
a = dl.Function(parameterV)
atest = dl.TestFunction(parameterV)
atrial = dl.TrialFunction(parameterV)
#Model Parameters
m0 = 543.09
m1 = 4.73
m2 = 4.57
m3 = 5.27
m4 = 4.49
m5 = 4.49
m6 = 12.02
m = (m0,m1,m2,m3,m4,m5,m6)
parameters = dl.interpolate(dl.Constant(m),parameterV)
# print type(parameters)
#Model
d = len(u)
I = dl.Identity(d) # Identity tensor
F = I + dl.grad(u) # Deformation gradient
C = F.T*F # Right Cauchy-Green tensor
J = dl.det(F) # Jacobian of deformation gradient
Cbar = C*(J**(-2.0/3.0)) # Deviatoric Right Cauchy-Green tensor
E = dl.Constant(0.5)*(Cbar-I) # Deviatoric Green strain
c0,c1,c2,c3,c4,c5,c6 = dl.split(parameters)
Q = c1*(E[0,0]**2)+c2*(E[1,1]**2)+c3*(E[2,2]**2) + c4*(dl.Constant(4.0)*(E[1,2]**2)) #+c5*(dl.Constant(4.0)*(E[0,1]**2))#)#+c6*(dl.Constant(4.0)*(E[0,2]**2))
Energy = dl.Constant(0.5)*c0*(dl.exp(Q)-dl.Constant(1.0))
IncompressibilityConstraint = (J-dl.Constant(1.0))
Lagrangian = p*IncompressibilityConstraint*dl.dx + Energy*dl.dx
yhat = dl.interpolate(dl.Constant((1,1,1,1)),TaylorHoodV)
residual_form = dl.derivative(Lagrangian,y,yhat)
residual_form_a = dl.derivative(residual_form, a,atest)
residual_form_y = dl.derivative(residual_form, y,ytest)
residual_form_ya = dl.assemble(dl.derivative(residual_form_y, a,atrial))
residual_form_ay = dl.assemble(dl.derivative(residual_form_a, y,ytrial))
residual_form_aa = dl.assemble(dl.derivative(residual_form_a, a,atrial))
residual_form_yy = dl.assemble(dl.derivative(residual_form_y, y,ytrial)) #error here
#Error: Unable to perform just-in-time compilation of form.
# Traceback (most recent call last):
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/dolfin/compilemodules/jit.py", line 128, in jit
# result = ffc.jit(ufl_object, parameters=p)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/jitcompiler.py", line 198, in jit
# module = jit_build(ufl_object, module_name, parameters)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/jitcompiler.py", line 120, in jit_build
# generate=jit_generate)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/dijitso/jit.py", line 160, in jit
# header, source, dependencies = generate(jitable, name, signature, params["generator"])
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/jitcompiler.py", line 66, in jit_generate
# prefix=module_name, parameters=parameters, jit=True)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/compiler.py", line 141, in compile_form
# prefix, parameters, jit)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/compiler.py", line 198, in compile_ufl_objects
# code = generate_code(oir, parameters)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/codegeneration.py", line 86, in generate_code
# for ir in ir_integrals]
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/codegeneration.py", line 324, in _generate_integral_code
# code = r.generate_integral_code(ir, ir["prefix"], parameters)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/uflacs/uflacsgenerator.py", line 39, in generate_integral_code
# uflacs_code = generate_tabulate_tensor_code(ir, prefix, parameters)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/uflacs/uflacsgenerator.py", line 63, in generate_tabulate_tensor_code
# parts = ig.generate()
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/uflacs/generation/integralgenerator.py", line 103, in generate
# body += self.generate_unstructured_partition(num_points, "piecewise")
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/uflacs/generation/integralgenerator.py", line 409, in generate_unstructured_partition
# num_points)
# File "/workspace/fenics/2016.2_intel_mkl/bld/profile/cghe6hodndkt/lib/python2.7/site-packages/ffc/uflacs/generation/integralgenerator.py", line 351, in generate_partition
# vops = [vaccesses[op] for op in v.ufl_operands]
# KeyError: Sum(Product(Sum(Sum(Product(Sum(IntValue(1), Sum(Sum(Product(Indexed(ReferenceGrad(ReferenceValue(Coefficient(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', tetrahedron, 1), dim=3), -1), MixedElement(VectorElement(FiniteElement('Lagrange', tetrahedron, 2), dim=3), FiniteElement('Lagrange
Is there an easier way to write Q in terms of a quadratic form for E using a 4th order tensor for c that someone could help me with, if this issue can't be easily resolved? I believe this is an issue with FEniCS, not my code..