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 M M is partitioned into triangular simplices, the part of the functional under study for a single triangle with vertices ( x i , y i ) , ( x i + 1 , y i + 1 ) , ( x i + 2 , y i + 2 ) (x_i, y_i), (x_{i+1}, y_{i+1}), (x_{i+2}, y_{i+2}) can be written as
The function υ ( x , y ) \upsilon(x, y) = ∑ i = 1 N υ 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) = q i ⋅ ϕ i ( x , y ) = q_i \cdot \phi_i(x, y) + q i + 1 ⋅ ϕ i + 1 ( x , y ) + q_{i+1} \cdot \phi_{i+1}(x, y) + q i + 2 ⋅ ϕ i + 2 ( x , y ) + q_{i+2} \cdot \phi_{i+2}(x, y) . Taking into account (5.9 { a i + b i ⋅ x i + c i ⋅ y i = 1 a i + b i ⋅ x i + 1 + c i ⋅ y i + 1 = 0 a i + b i ⋅ x i + 2 + c i ⋅ y i + 2 = 0 { a i + 1 + b i + 1 ⋅ x i + c i + 1 ⋅ y i = 0 a i + 1 + b i + 1 ⋅ x i + 1 + c i + 1 ⋅ y i + 1 = 1 a i + 1 + b i + 1 ⋅ x i + 2 + c i + 1 ⋅ y i + 2 = 0 { a i + 2 + b i + 2 ⋅ x i + c i + 2 ⋅ y i = 0 a i + 2 + b i + 2 ⋅ x i + 1 + c i + 2 ⋅ y i + 1 = 0 a i + 2 + b i + 2 ⋅ x i + 2 + c i + 2 ⋅ y i + 2 = 1 \begin{cases} a_{i} + b_{i} \cdot x_i + c_{i} \cdot y_i = 1\\ a_{i} + b_{i} \cdot x_{i+1} + c_{i} \cdot y_{i+1} = 0\\ a_{i} + b_{i} \cdot x_{i+2} + c_{i} \cdot y_{i+2} = 0 \end{cases} \begin{cases} a_{i+1} + b_{i+1} \cdot x_i + c_{i+1} \cdot y_i = 0\\ a_{i+1} + b_{i+1} \cdot x_{i+1} + c_{i+1} \cdot y_{i+1} = 1\\ a_{i+1} + b_{i+1} \cdot x_{i+2} + c_{i+1} \cdot y_{i+2} = 0 \end{cases} \begin{cases} a_{i+2} + b_{i+2} \cdot x_i + c_{i+2} \cdot y_i = 0\\ a_{i+2} + b_{i+2} \cdot x_{i+1} + c_{i+2} \cdot y_{i+1} = 0\\ a_{i+2} + b_{i+2} \cdot x_{i+2} + c_{i+2} \cdot y_{i+2} = 1 \end{cases} ) and (5.10 { a i = ( x i + 1 ⋅ y i + 2 − x i + 2 ⋅ y i + 1 ) / det b i = ( y i + 1 − y i + 2 ) / det c i = ( − x i + 1 + x i + 2 ) / det { a i + 1 = ( − x i ⋅ y i + 2 + x i + 2 ⋅ y i ) / det b i + 1 = ( − y i + y i + 2 ) / det c i + 1 = ( x i − x i + 2 ) / det { a i + 2 = ( x i ⋅ y i + 1 − x i + 1 ⋅ y i ) / det b i + 2 = ( y i − y i + 1 ) / det c i + 2 = ( − x i + x i + 1 ) / det \begin{cases} a_{i} = (x_{i+1} \cdot y_{i+2} - x_{i+2} \cdot y_{i+1}) / \det\\ b_{i} = (y_{i+1} - y_{i+2}) / \det\\ c_{i} = (-x_{i+1} + x_{i+2}) / \det \end{cases} \begin{cases} a_{i+1} = ( - x_i \cdot y_{i+2} + x_{i+2} \cdot y_i) / \det\\ b_{i+1} = (-y_i + y_{i+2}) / \det\\ c_{i+1} = (x_i - x_{i+2}) / \det \end{cases} \begin{cases} a_{i+2} = (x_i \cdot y_{i+1} - x_{i+1} \cdot y_i) / \det\\ b_{i+2} = (y_i - y_{i+1}) / \det\\ c_{i+2} = (-x_i + x_{i+1}) / \det \end{cases} ) from the section on hat functions, we write the relations for the hat functions
Let us compute the partial derivatives of the trial function
Note that the derivatives do not depend on x x and y y and are constants on the triangle. Substituting (6.8 ∂ υ ( i ) ( i + 2 ) ( x , y ) ∂ x \displaystyle \frac{\displaystyle \partial \upsilon_{(i)(i+2)}(x, y)}{\displaystyle \partial x} = q i ⋅ b i \displaystyle = q_i \cdot b_i + q i + 1 ⋅ b i + 1 \displaystyle + q_{i+1} \cdot b_{i+1} + q i + 2 ⋅ b i + 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} = q i ⋅ c i \displaystyle = q_i \cdot c_i + q i + 1 ⋅ c i + 1 \displaystyle + q_{i+1} \cdot c_{i+1} + q i + 2 ⋅ c i + 2 \displaystyle + q_{i+2} \cdot c_{i+2} ) into (6.6 ∫ △ [ ( ∂ υ ∂ x ) 2 + ( ∂ υ ∂ y ) 2 ] d S . \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. )
∫ △ [ ( ∂ υ ( i ) ( i + 2 ) ∂ x ) 2 + ( ∂ υ ( i ) ( i + 2 ) ∂ y ) 2 ] d S \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 △ ⋅ [ ( q i ⋅ b i + q i + 1 ⋅ b i + 1 + q i + 2 ⋅ b i + 2 ) 2 + ( q i ⋅ c i + q i + 1 ⋅ c i + 1 + q i + 2 ⋅ c i + 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 S △ S_{\triangle} is the area of the triangle, which is computed by the formula
where d d = x i ⋅ y i + 1 = x_i \cdot y_{i+1} − x i ⋅ y i + 2 - x_i \cdot y_{i+2} − x i + 1 ⋅ y i - x_{i+1} \cdot y_i + x i + 1 ⋅ y i + 2 + x_{i+1} \cdot y_{i+2} + x i + 2 ⋅ y i + x_{i+2} \cdot y_i − x i + 2 ⋅ y i + 1 - x_{i+2} \cdot y_{i+1} is the determinant from (5.10 { a i = ( x i + 1 ⋅ y i + 2 − x i + 2 ⋅ y i + 1 ) / det b i = ( y i + 1 − y i + 2 ) / det c i = ( − x i + 1 + x i + 2 ) / det { a i + 1 = ( − x i ⋅ y i + 2 + x i + 2 ⋅ y i ) / det b i + 1 = ( − y i + y i + 2 ) / det c i + 1 = ( x i − x i + 2 ) / det { a i + 2 = ( x i ⋅ y i + 1 − x i + 1 ⋅ y i ) / det b i + 2 = ( y i − y i + 1 ) / det c i + 2 = ( − x i + x i + 1 ) / det \begin{cases} a_{i} = (x_{i+1} \cdot y_{i+2} - x_{i+2} \cdot y_{i+1}) / \det\\ b_{i} = (y_{i+1} - y_{i+2}) / \det\\ c_{i} = (-x_{i+1} + x_{i+2}) / \det \end{cases} \begin{cases} a_{i+1} = ( - x_i \cdot y_{i+2} + x_{i+2} \cdot y_i) / \det\\ b_{i+1} = (-y_i + y_{i+2}) / \det\\ c_{i+1} = (x_i - x_{i+2}) / \det \end{cases} \begin{cases} a_{i+2} = (x_i \cdot y_{i+1} - x_{i+1} \cdot y_i) / \det\\ b_{i+2} = (y_i - y_{i+1}) / \det\\ c_{i+2} = (-x_i + x_{i+1}) / \det \end{cases} ).
Expand the squares and regroup the terms
∫ △ ( ∇ υ ( i ) ( i + 2 ) ) 2 d S \displaystyle \int_{\triangle} (\nabla \upsilon_{(i)(i+2)})^2 \,dS = S △ ⋅ [ q i 2 ⋅ [ b i 2 + c i 2 ] + q i + 1 2 ⋅ [ b i + 1 2 + c i + 1 2 ] + q i + 2 2 ⋅ [ b i + 2 2 + c i + 2 2 ] + 2 ⋅ q i ⋅ q i + 1 ⋅ ( b i ⋅ b i + 1 + c i ⋅ c i + 1 ) + 2 ⋅ q i ⋅ q i + 2 ⋅ ( b i ⋅ b i + 2 + c i ⋅ c i + 2 ) + 2 ⋅ q i + 1 ⋅ q i + 2 ⋅ ( b i + 1 ⋅ b i + 2 + c i + 1 ⋅ c i + 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 { a i = ( x i + 1 ⋅ y i + 2 − x i + 2 ⋅ y i + 1 ) / det b i = ( y i + 1 − y i + 2 ) / det c i = ( − x i + 1 + x i + 2 ) / det { a i + 1 = ( − x i ⋅ y i + 2 + x i + 2 ⋅ y i ) / det b i + 1 = ( − y i + y i + 2 ) / det c i + 1 = ( x i − x i + 2 ) / det { a i + 2 = ( x i ⋅ y i + 1 − x i + 1 ⋅ y i ) / det b i + 2 = ( y i − y i + 1 ) / det c i + 2 = ( − x i + x i + 1 ) / det \begin{cases} a_{i} = (x_{i+1} \cdot y_{i+2} - x_{i+2} \cdot y_{i+1}) / \det\\ b_{i} = (y_{i+1} - y_{i+2}) / \det\\ c_{i} = (-x_{i+1} + x_{i+2}) / \det \end{cases} \begin{cases} a_{i+1} = ( - x_i \cdot y_{i+2} + x_{i+2} \cdot y_i) / \det\\ b_{i+1} = (-y_i + y_{i+2}) / \det\\ c_{i+1} = (x_i - x_{i+2}) / \det \end{cases} \begin{cases} a_{i+2} = (x_i \cdot y_{i+1} - x_{i+1} \cdot y_i) / \det\\ b_{i+2} = (y_i - y_{i+1}) / \det\\ c_{i+2} = (-x_i + x_{i+1}) / \det \end{cases} ) for the coefficients b b and c c and introducing the notation for the elements of the local stiffness matrix of the triangle
Thus, the local stiffness matrix for a triangular element has the form
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 × N N \times N , where N N is the total number of mesh nodes.
Stiffness matrix 1D Stiffness matrix 3D