- changed status to wontfix
FFC 1.2.0 generates code with syntax error
Issue #3
wontfix
from dolfin import *
parameters["linear_algebra_backend"] ="PETSc"
parameters["form_compiler"]["quadrature_degree"] = 4
parameters["allow_extrapolation"] = True
b2 = 0.8
mesh = BoxMesh(0, -0.5*b2, -0.4, 45.0, 0.5*b2, 0.4, 10, 6, 4)
print mesh
V = VectorFunctionSpace(mesh, 'Lagrange', 2)
# Initialize mesh function for boundary domains
boundary_parts = MeshFunction("size_t", mesh, mesh.topology().dim()-1)
# Define boundary conditions
class DirichletBoundaryCondLeft (SubDomain):
def inside(self, x, on_boundary):
return on_boundary and (x[0] <= DOLFIN_EPS)
class NeumannBoundaryCondBottom (SubDomain):
def inside(self, x, on_boundary):
return on_boundary and (x[1] <= -0.4 + DOLFIN_EPS)
u0_boundary = DirichletBoundaryCondLeft()
u0_boundary.mark(boundary_parts, 1)
g_boundary = NeumannBoundaryCondBottom()
g_boundary.mark(boundary_parts, 2)
u0 = Constant((0.0, 0.0, 0.0))
bc = DirichletBC(V, u0, boundary_parts, 1)
# Define parameters for Cauchy tensor
E, nu = pow(10,7)/6.0, 0.285
lambdaS=Constant(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)))
muS=Constant(E/(2.0*(1.0 + nu)))
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
# Define Cauchy tensor
def sigma(v):
return lambdaS*tr(sym(grad(v)))*Identity(v.cell().d) + 2.0*muS*sym(grad(v))
# Define volume/boundary forces
f = Constant((0.0, -0.2, 0.0))
g = Constant((0.0, -10.0, 0.0))
# Define (bi)linear forms
a = (inner(sigma(u), grad(v)))*dx
L = inner(f, v)*dx + inner(g, v)*ds(2)
#L = inner(f, v)*dx
u = Function(V)
# Define goal functional for adaptive mesh refinement
n = FacetNormal(mesh)
MF = -inner(u, n)*ds #(inner(f, u)-inner(sigma(u), grad(u)))*dx #inner(sigma(u)*n, n)*ds(2)+inner(g, n))*ds(2)
solve(a == L, u, bc, tol=5.0E-7, M=MF) #Solve adaptively
plot(u, mode="displacement")
interactive()
gcc responds: error: expected ‘;’ before ‘)’ token
Error does not occur with recent master
.
Comments (1)
-
- Log in to comment
New release coming soon, so won't fix.