From The FEniCS project
A gear is clamped at two of its ends and twisted. The image shows the displacement as the solution of the static linear elasticity equations. The following code shows the implementation in FFC:
|
element = FiniteElement("Vector Lagrange", "tetrahedron", 1)
v = BasisFunction(element) # test function
u = BasisFunction(element) # trial function
f = Function(element) # external force
E = 10.0
nu = 0.3
mu = E / (2*(1 + nu))
lmbda = E*nu / ((1 + nu) * (1 - 2*nu))
def epsilon(v):
return 0.5 * (grad(v) + transp(grad(v)))
def sigma(v):
return 2*mu*epsilon(v) + lmbda*mult(trace(epsilon(v)), Identity(len(v)))
a = dot(grad(v), sigma(u)) * dx
L = dot(v, f) * dx
|
Contributed by Johan Jansson / Anders Logg