There are three main methods to obtain the stiffness matrix
Variational method (minimizing a functional). This functional is the potential energy of the structure and loads.
Weighted residual. Requires the differential equation as a starting point. Approximated in weighted average. Galerkin weighted residual method is the most common method for implementation.
Virtual work method. Making the virtual work zero for an arbitrary allowed displacement.
5.1 Virtual work method for derivation of the stiffness matrix
In virtual work method, a small displacement is assumed to occur. Looking at small volume element, the amount of work done by external loads to cause the small displacement is set equal to amount of increased internal strain energy. Assuming the field of displacement is given by \(\mathbf {u}=\left \{ u,v,w\right \} \) and assuming the external loads are given by \(\left \{ p\right \} \) acting on the nodes, hence these point loads will do work given by \(\left \{ \delta d\right \} ^{T}\left \{ p\right \} \) on that unit volume
where \(\left \{ d\right \} \) is the nodal displacements. In all these derivations, only loads acting directly on the nodes are considered for now. In other words, body forces and traction forces are not considered in order to simplify the derivations.
The increase of strain energy is \(\left \{ \delta \varepsilon \right \} ^{T}\left \{ \sigma \right \} \) in that same unit volume.
Since \(\left \{ \delta d\right \} \) and \(\left \{ d\right \} \) do not depend on the integration variables they can be moved outside the integral, giving
knowing \(\left [ B\right ] \) allows finding \(\left [ k\right ] \) by integrating over the volume. For the beam element though, \(\mathbf {u=}v\left ( x\right ) \) the transverse displacement. This
means \(\left [ B\right ] =\frac {d^{2}}{dx^{2}}\left [ N\right ] \). Recalling from the above that for the beam element,
5.2 Potential energy (minimize a functional) method to derive the stiffness matrix
This method is very similar to the first method actually. It all comes down to finding a functional, which is the potential energy of the system, and minimizing this with respect to the nodal displacements. The result gives the stiffness matrix.
Let the system total potential energy by called \(\Pi \) and let the total internal energy in the system be \(U\) and let the work done by external loads acting on the nodes be \(\Omega \), then
\[ \Pi =U-\Omega \]
Work done by external loads have a negative sign since they are an external agent to the system and work is being done onto the system. The internal strain energy is given by \(\frac {1}{2}\int _{V}\left \{ \sigma \right \} ^{T}\left \{ \varepsilon \right \} dV\) and the work done by external loads is \(\left \{ d\right \} ^{T}\left \{ p\right \} \), hence