Hello
I want to find the volume change in a linear elasticity problem. Simply I am using FEniCS demo for linear elasticity. I am trying to obtain:
det (F) = V_f / V_0 where F is deformation gradient tensor, V_f is the final volume and V_0 is the initial volume. Here is the minimal work example:
from fenics import *
# Scaled variables
L = 1; W = 0.2
mu = 1
rho = 1
delta = W/L
gamma = 0.4*delta**2
beta = 1.25
lambda_ = beta
g = gamma
# Create mesh and define function space
mesh = BoxMesh(Point(0, 0, 0), Point(L, W, W), 10, 3, 3)
V = VectorFunctionSpace(mesh, 'P', 2)
# Define boundary condition
tol = 1E-14
def clamped_boundary(x, on_boundary):
return on_boundary and x[0] < tol
bc = DirichletBC(V, Constant((0, 0, 0)), clamped_boundary)
# Define strain and stress
def epsilon(u):
return 0.5*(nabla_grad(u) + nabla_grad(u).T)
def sigma(u):
return lambda_*div(u)*Identity(d) + 2*mu*epsilon(u)
# Define variational problem
u = TrialFunction(V)
d = u.geometric_dimension() # space dimension
v = TestFunction(V)
f = Constant((0, 0, -rho*g))
T = Constant((0, 0, 0))
a = inner(sigma(u), epsilon(v))*dx
L = dot(f, v)*dx + dot(T, v)*ds
#############################
# Kinematics
I = Identity(3) # Identity tensor
F = I + grad(u) # Deformation gradient
C = F.T*F # Right Cauchy-Green tensor
# Jocobian : Determinant of F
J = det(F)
##############################
# Compute solution
u = Function(V)
solve(a == L, u, bc)
##############################
space = FunctionSpace(mesh, 'P', 1)
result = interpolate(J,space)
print (result)
It return this error:
AttributeError: 'Determinant' object has no attribute '_cpp_object'
In general my goal is to find the volume change due to applying a load. Any idea how it can be done?
Thanks