Hello everyone, I want to compute the derivative of the stress field with respect to the displacement field. But I am getting the zero value of the derivative everywhere in the mesh.
I am using the following governing differential equation of linear elasticity as:
The equations governing small elastic deformations of a body \Omega can be written as
where \sigma is the stress tensor, f is the body force per unit volume, \lambda and \mu are Laml’e’s elasticity parameters for the material in \Omega, I is the identity tensor, tr is the trace operator on a tensor, \varepsilon is the symmetric strain-rate tensor (symmetric gradient), and u is the displacement vector field. We have here assumed isotropic elastic conditions.
In matrix notation, I have the following relation-
\sigma = CBu
\frac{\partial \sigma}{\partial u}=CB
where C=constitutive matrix
B= strain displacement matrix
u=displacement vector
The minimal working code is:
from dolfin import *
L, H = 3, 1
Nx, Ny = 30, 10
mesh = RectangleMesh(Point(0., 0.), Point(L, H), Nx, Ny, "crossed")
eps = lambda _u:sym(grad(_u))
sigma = lambda _u: 2.0 * mu * sym(grad(_u)) + lmbda * tr(sym(grad(_u))) * Identity(len(_u))
E, nu, rho_g = Constant(1e5), Constant(0.3), 1e-3
mu = E/2/(1+nu)
lmbda = E*nu/(1+nu)/(1-2*nu)
f = Constant((0, -rho_g))
U = VectorFunctionSpace(mesh, 'Lagrange', degree=1)
u, v = TrialFunction(U), TestFunction(U)
a = inner(sigma(u), eps(v))*dx
l = inner(f, v)*dx
left = CompiledSubDomain("near(x[0], 0.) && on_boundary")
bc = DirichletBC(U, Constant((0.,0.)), left)
u_sol = Function(U, name="Displacement")
solve(a == l, u_sol, bc)
# Find the derivative of stress with respect to displacement
u_var = variable(u_sol)
stress = sigma(u_var)
dstress_du = diff(stress, u_var)
dstress_du[0,0,0](1,1)
Can anyone help me how to compute the derivative \frac{\partial \sigma}{\partial u}? Thanks in advance.