Stiffness matrix 2D

Now let us compute the stiffness matrix for the two-dimensional case. In two-dimensional space the gradient has the form υ\nabla \upsilon =(υx,υy)= \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial x}, \frac{\displaystyle \partial \upsilon}{\displaystyle \partial y} \right), and the dot product of the gradient with itself is υυ\nabla \upsilon \cdot \nabla \upsilon =(υx)2= \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial x} \right)^2 +(υy)2+ \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial y} \right)^2. Since the two-dimensional computational domain MM is partitioned into triangular simplices, the part of the functional under study for a single triangle with vertices (xi,yi),(xi+1,yi+1),(xi+2,yi+2)(x_i, y_i), (x_{i+1}, y_{i+1}), (x_{i+2}, y_{i+2}) can be written as

[(υx)2+(υy)2]dS.\int_{\triangle} \left[ \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial x} \right)^2 + \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial y} \right)^2 \right] \,dS.
(6.6)

The function υ(x,y)\upsilon(x, y) =i=1Nυi(x,y)= \sum_{i=1}^N \upsilon_i(x, y). The trial function on the triangle has the form υ(i)(i+2)(x,y)\upsilon_{(i)(i+2)}(x, y) =qiϕi(x,y)= q_i \cdot \phi_i(x, y) +qi+1ϕi+1(x,y)+ q_{i+1} \cdot \phi_{i+1}(x, y) +qi+2ϕi+2(x,y)+ q_{i+2} \cdot \phi_{i+2}(x, y). Taking into account (5.9) and (5.10) from the section on hat functions, we write the relations for the hat functions

ϕi(x,y)\displaystyle \phi_i(x, y) =ai\displaystyle = a_i +bix\displaystyle + b_i \cdot x +ciy\displaystyle + c_i \cdot yϕi+1(x,y)\displaystyle \phi_{i+1}(x, y) =ai+1\displaystyle = a_{i+1} +bi+1x\displaystyle + b_{i+1} \cdot x +ci+1y\displaystyle + c_{i+1} \cdot yϕi+2(x,y)\displaystyle \phi_{i+2}(x, y) =ai+2\displaystyle = a_{i+2} +bi+2x\displaystyle + b_{i+2} \cdot x +ci+2y\displaystyle + c_{i+2} \cdot y
(6.7)

Let us compute the partial derivatives of the trial function

υ(i)(i+2)(x,y)x\displaystyle \frac{\displaystyle \partial \upsilon_{(i)(i+2)}(x, y)}{\displaystyle \partial x} =qibi\displaystyle = q_i \cdot b_i +qi+1bi+1\displaystyle + q_{i+1} \cdot b_{i+1} +qi+2bi+2\displaystyle + q_{i+2} \cdot b_{i+2}υ(i)(i+2)(x,y)y\displaystyle \frac{\displaystyle \partial \upsilon_{(i)(i+2)}(x, y)}{\displaystyle \partial y} =qici\displaystyle = q_i \cdot c_i +qi+1ci+1\displaystyle + q_{i+1} \cdot c_{i+1} +qi+2ci+2\displaystyle + q_{i+2} \cdot c_{i+2}
(6.8)

Note that the derivatives do not depend on xx and yy and are constants on the triangle. Substituting (6.8) into (6.6)

[(υ(i)(i+2)x)2+(υ(i)(i+2)y)2]dS\displaystyle \int_{\triangle} \left[ \left( \frac{\displaystyle \partial \upsilon_{(i)(i+2)}}{\displaystyle \partial x} \right)^2 + \left( \frac{\displaystyle \partial \upsilon_{(i)(i+2)}}{\displaystyle \partial y} \right)^2 \right] \,dS =S[(qibi+qi+1bi+1+qi+2bi+2)2+(qici+qi+1ci+1+qi+2ci+2)2],\displaystyle = \quad S_{\triangle} \cdot \left[ (q_i \cdot b_i + q_{i+1} \cdot b_{i+1} + q_{i+2} \cdot b_{i+2})^2 + (q_i \cdot c_i + q_{i+1} \cdot c_{i+1} + q_{i+2} \cdot c_{i+2})^2 \right],

where SS_{\triangle} is the area of the triangle, which is computed by the formula

S\displaystyle S_{\triangle} =d2,\displaystyle = \frac{\displaystyle |d|}{\displaystyle 2},
(6.9)

where dd =xiyi+1= x_i \cdot y_{i+1} xiyi+2- x_i \cdot y_{i+2} xi+1yi- x_{i+1} \cdot y_i +xi+1yi+2+ x_{i+1} \cdot y_{i+2} +xi+2yi+ x_{i+2} \cdot y_i xi+2yi+1- x_{i+2} \cdot y_{i+1} is the determinant from (5.10).

Expand the squares and regroup the terms

(υ(i)(i+2))2dS\displaystyle \int_{\triangle} (\nabla \upsilon_{(i)(i+2)})^2 \,dS =S[qi2[bi2+ci2]+qi+12[bi+12+ci+12]+qi+22[bi+22+ci+22]+2qiqi+1(bibi+1+cici+1)+2qiqi+2(bibi+2+cici+2)+2qi+1qi+2(bi+1bi+2+ci+1ci+2)]\displaystyle = S_{\triangle} \cdot \Big[ q_i^2 \cdot [b_i^2 + c_i^2] + q_{i+1}^2 \cdot [b_{i+1}^2 + c_{i+1}^2] + q_{i+2}^2 \cdot [b_{i+2}^2 + c_{i+2}^2] + 2 \cdot q_i \cdot q_{i+1} \cdot (b_i \cdot b_{i+1} + c_i \cdot c_{i+1}) + 2 \cdot q_i \cdot q_{i+2} \cdot (b_i \cdot b_{i+2} + c_i \cdot c_{i+2}) + 2 \cdot q_{i+1} \cdot q_{i+2} \cdot (b_{i+1} \cdot b_{i+2} + c_{i+1} \cdot c_{i+2}) \Big]

Taking into account the formulas from (5.10) for the coefficients bb and cc and introducing the notation for the elements of the local stiffness matrix of the triangle

k(i)(i)=S[bi2+ci2]=12d[(yi+1yi+2)2+(xi+1+xi+2)2]k(i+1)(i+1)=S[bi+12+ci+12]=12d[(yi+yi+2)2+(xixi+2)2]k(i+2)(i+2)=S[bi+22+ci+22]=12d[(yiyi+1)2+(xi+xi+1)2]k(i)(i+1)=k(i+1)(i)=S(bibi+1+cici+1)=12d[(yi+1yi+2)(yi+yi+2)+(xi+1+xi+2)(xixi+2)]k(i)(i+2)=k(i+2)(i)=S(bibi+2+cici+2)=12d[(yi+1yi+2)(yiyi+1)+(xi+1+xi+2)(xi+xi+1)]k(i+1)(i+2)=k(i+2)(i+1)=S(bi+1bi+2+ci+1ci+2)=12d[(yi+yi+2)(yiyi+1)+(xixi+2)(xi+xi+1)]\begin{split} &k_{(i)(i)} = S_{\triangle} \cdot [b_i^2 + c_i^2] = \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(y_{i+1} - y_{i+2})^2 + (-x_{i+1} + x_{i+2})^2]\\ &k_{(i+1)(i+1)} = S_{\triangle} \cdot [b_{i+1}^2 + c_{i+1}^2] = \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(-y_i + y_{i+2})^2 + (x_i - x_{i+2})^2]\\ &k_{(i+2)(i+2)} = S_{\triangle} \cdot [b_{i+2}^2 + c_{i+2}^2] = \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(y_i - y_{i+1})^2 + (-x_i + x_{i+1})^2]\\ &k_{(i)(i+1)} = k_{(i+1)(i)} = S_{\triangle} \cdot (b_i \cdot b_{i+1} + c_i \cdot c_{i+1})\\ &= \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(y_{i+1} - y_{i+2}) \cdot (-y_i + y_{i+2}) + (-x_{i+1} + x_{i+2}) \cdot (x_i - x_{i+2})]\\ &k_{(i)(i+2)} = k_{(i+2)(i)} = S_{\triangle} \cdot (b_i \cdot b_{i+2} + c_i \cdot c_{i+2})\\ &= \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(y_{i+1} - y_{i+2}) \cdot (y_i - y_{i+1}) + (-x_{i+1} + x_{i+2}) \cdot (-x_i + x_{i+1})]\\ &k_{(i+1)(i+2)} = k_{(i+2)(i+1)} = S_{\triangle} \cdot (b_{i+1} \cdot b_{i+2} + c_{i+1} \cdot c_{i+2})\\ &= \frac{\displaystyle 1}{\displaystyle 2 \cdot |d|} \cdot [(-y_i + y_{i+2}) \cdot (y_i - y_{i+1}) + (x_i - x_{i+2}) \cdot (-x_i + x_{i+1})] \end{split}
(6.10)

Thus, the local stiffness matrix for a triangular element has the form

K\displaystyle \mathbf{K}_{\triangle} =[k(i)(i)k(i)(i+1)k(i)(i+2)k(i+1)(i)k(i+1)(i+1)k(i+1)(i+2)k(i+2)(i)k(i+2)(i+1)k(i+2)(i+2)]\displaystyle = \begin{bmatrix} k_{(i)(i)} & k_{(i)(i+1)} & k_{(i)(i+2)}\\ k_{(i+1)(i)} & k_{(i+1)(i+1)} & k_{(i+1)(i+2)}\\ k_{(i+2)(i)} & k_{(i+2)(i+1)} & k_{(i+2)(i+2)} \end{bmatrix} =S[bi2+ci2bibi+1+cici+1bibi+2+cici+2bi+1bi+ci+1cibi+12+ci+12bi+1bi+2+ci+1ci+2bi+2bi+ci+2cibi+2bi+1+ci+2ci+1bi+22+ci+22].\displaystyle = S_{\triangle} \begin{bmatrix} b_i^2 + c_i^2 & b_i \cdot b_{i+1} + c_i \cdot c_{i+1} & b_i \cdot b_{i+2} + c_i \cdot c_{i+2}\\ b_{i+1} \cdot b_i + c_{i+1} \cdot c_i & b_{i+1}^2 + c_{i+1}^2 & b_{i+1} \cdot b_{i+2} + c_{i+1} \cdot c_{i+2}\\ b_{i+2} \cdot b_i + c_{i+2} \cdot c_i & b_{i+2} \cdot b_{i+1} + c_{i+2} \cdot c_{i+1} & b_{i+2}^2 + c_{i+2}^2 \end{bmatrix}.
(6.11)

The global stiffness matrix K\mathbf{K} is obtained by summing the contributions from all triangular elements of the mesh using the assembly method: the elements of the local matrices are added to the corresponding elements of the global matrix according to the global node numbering. The dimension of the global stiffness matrix is equal to N×NN \times N, where NN is the total number of mesh nodes.