The weak form of linear elasticity
For a long time I used finite element software without really knowing what it solves. It does not solve the equilibrium equations as we write them in mechanics. It solves their weak form. I wanted to write the steps down once for small strain linear elasticity, mostly so I can come back to them myself.
Starting point
We look for the displacement field \(\mathbf{u}\) on \(\Omega\) such that
with \(\boldsymbol{\sigma} = \mathbb{C} : \boldsymbol{\varepsilon}\) and \(\boldsymbol{\varepsilon}(\mathbf{u}) = \tfrac{1}{2}\left(\nabla\mathbf{u} + \nabla\mathbf{u}^{\mathsf{T}}\right)\). This is the strong form: it has to hold at every single point.
Getting to the weak form
Multiply by a test function \(\mathbf{v}\) that is zero on \(\Gamma_D\), integrate over \(\Omega\) and use the divergence theorem. Since \(\boldsymbol{\sigma}\) is symmetric, \(\nabla\mathbf{v} : \boldsymbol{\sigma} = \boldsymbol{\varepsilon}(\mathbf{v}) : \boldsymbol{\sigma}\), and we get
The part that took me a while to appreciate is what happens to the boundary conditions. The traction condition on \(\Gamma_N\) now just shows up in the load term, so it is called natural. The displacement condition on \(\Gamma_D\) still has to be built into the space of admissible functions, so it stays essential.
Discretisation
With the shape functions in \(\mathbf{N}\) and their derivatives in the strain displacement matrix \(\mathbf{B}\), the Galerkin method gives \(\mathbf{K}\mathbf{u} = \mathbf{f}\) with the element stiffness
Checking it on a bar
I like to test things on the simplest case I can solve by hand. Take a bar of length \(L\), clamped at \(x = 0\), free at \(x = L\), with a uniform axial line load \(q\). The exact solution of \(EA\,u'' = -q\) is
A few lines of NumPy with linear elements:
import numpy as np
E, A, L, q = 210e9, 1e-4, 1.0, 1e3 # [Pa], [m^2], [m], [N/m]
n = 8 # linear elements
h = L / n
K = np.zeros((n + 1, n + 1))
f = np.zeros(n + 1)
ke = E * A / h * np.array([[1.0, -1.0], [-1.0, 1.0]])
fe = q * h / 2 * np.array([1.0, 1.0]) # consistent load vector
for e in range(n):
idx = [e, e + 1]
K[np.ix_(idx, idx)] += ke
f[idx] += fe
u = np.zeros(n + 1)
u[1:] = np.linalg.solve(K[1:, 1:], f[1:]) # u(0) = 0 imposed by elimination
print(u[-1], q * L**2 / (2 * E * A)) # both 2.381e-05 m
The first time I ran this I expected a small error at the tip and got none. The nodal values match the exact solution for any \(n\). That is not luck: in 1D with constant \(EA\) and a consistent load vector, the Green's function lies in the finite element space, so the nodal values are exact. Between the nodes it is a different story. The linear interpolant still differs from the quadratic exact solution, and the element strains are only constant approximations of a linear field.
References
- T. J. R. Hughes, The Finite Element Method: Linear Static and Dynamic Finite Element Analysis, Dover, 2000. Chapters 1 and 2.
- O. C. Zienkiewicz, R. L. Taylor, J. Z. Zhu, The Finite Element Method: Its Basis and Fundamentals, 7th ed., Butterworth Heinemann, 2013.