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

Unable to understand this simple error: Cube linear elasticity

0 votes

I am trying to solve the following cube created in gmsh for the problem posted below. I have written the following formulation but it shows an error: I am totally unable to find what's wrong. Maybe, its the force equation. No matter what I change, I get the same error. Please help.

File "carvedcube.py", line 44
c = Constant((0.0, 0.0, 0.0))
^ SyntaxError: invalid syntax

All files including the .xml and .py are POSTED HERE .....(Also, brief python script posted below)

The problem
The problem has been taken from Page 100 of THIS THESIS
The cube
enter image description here

mesh = Mesh("carvedcube.xml")
V  = VectorFunctionSpace(mesh, "Lagrange", 1)  

r1 = 4.0/5.0-DOLFIN_EPS;

class Left(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0)

left = Left()

if x[0] >= r1: 
 f= Expression((0.0, 0.0, -10*exp(2*x[2]+x[1])))
else:
 f= Expression((0.0, 0.0, 0.0))

E = 200*(10**9)
nu = 0.3

mu, lmbda = E/(2.0*(1.0 + nu)), E*nu/((1.0 + nu)*(1.0 - 2.0*nu))

sigma = 2*mu*sym(grad(u)) + lmbda*tr(grad(u))*Identity(v.cell().d)   

a = inner(sigma, grad(v))*dx 
L = (dot(f, v)*dx                          # body force f   

c = Constant((0.0, 0.0, 0.0))
bc = [DirichletBC(V, c, left)]       #gmsh tag for fixed face is 1 but doing it the conventional way
asked Sep 11, 2015 by Chaitanya_Raj_Goyal FEniCS User (4,150 points)
edited Sep 11, 2015 by Chaitanya_Raj_Goyal

You have an open parenthesis on the line above...

...