## 2.11.4 Construction of the Stiffness Matrix

Measurable Outcome 2.17, Measurable Outcome 2.20

The stiffness matrix arises in the calculation of \(\int _{\Omega } \nabla \phi _ i \cdot \left(k\nabla \tilde{T}\right)\, dA\). As in the one-dimensional case, the \(i\)-th row of the stiffness matrix \(K\) corresponds to the weighted residual of \(\phi _ i\). The \(j\)-th column in the \(i\)-th row corresponds to the dependence of the \(i\)-th weighted residual on \(a_ j\). Further drawing on the one-dimensional example, the weighted residuals are assembled by calculating the contribution to all of the residuals from within a single element. In the two-dimensional linear element situation, three weighted residuals are impacted by a given element, specifically, the weighted residuals corresponding to the nodal basis functions of the three nodes of the triangle. For example, in each element we must calculate

where \(\Omega _ e\) is spatial domain for a specific element. As described in Section 2.11.3, the gradient of \(\tilde{T}\) can be written,

thus the weighted residuals expand to,

For the situation in which \(k\) is constant and linear elements are used, then this reduces to

where \(A_ e\) is the area of element \(e\).