This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

FEniCS Course demo - Expecting scalar arguments in 'diff' function

+1 vote

Hi!
I got a problem when I learn FEniCS demo - Lecture 6 - Hyperelasticity. In slide 7 about
Hyperelasticity - stress strain relationship, given u is displacement. I got error Expecting scalar arguments when solve second Piola-Kirchhoff stress tensor with diff. Could anyone give me some suggestion?
This is the code sample.

# -*- coding: utf-8 -*-
"""

@author: xy
"""
from fenics import *
from numpy import *

mesh = Mesh("lego_beam.xml")
# plot(mesh)

E, mu = 10.0, 0.3
nu, lmbda = E/(2*(1+mu)), E*mu/((1+mu)*(1-2*mu))
g = Constant((0, 0, -9.81))

V = VectorFunctionSpace(mesh, 'Lagrange', 1)

v = TestFunction(V)
u = TrialFunction(V)

I = Identity(3)
F = grad(u) + I
C = F.T*F
E = 0.5*(C - I)
E = variable(E)
W = 0.5*lmbda*(tr(E))*(tr(E)) + nu*tr(E*E)

S = diff(W, E)
asked Jun 20, 2016 by xiyang FEniCS Novice (410 points)
edited Jun 20, 2016 by xiyang

Hi xiyang,

Did you ever figure that out? Thanks!

Martin

Hi, Martin,
I am on a conference until Wednesday. I will check it later this week. Be honest, I have been off FEniCS for a while. Really I cannot remember, but probably not solved. I will try to give you some feedback on Thursday or Friday.

Martin,
I checked today, the problem is unsolved. Sorry for that.
Regards,
Xiyang

...