Let us proceed to computing the stiffness matrix for the three-dimensional case. In three-dimensional space the gradient has the form , and the dot product of the gradient with itself is . Since the three-dimensional computational domain is partitioned into tetrahedral simplices, the part of the functional under study for a single tetrahedron with vertices
can be written as
(6.12)
The function . The trial function on the tetrahedron has the form . Analogously to the two-dimensional case, the hat functions for the tetrahedron are linear
(6.13)
Let us compute the partial derivatives of the trial function
(6.14)
Note that the derivatives do not depend on , and and are constants over the tetrahedron. Substituting (6.14) into (6.12)
where is the volume of the tetrahedron, which is computed by the formula
(6.15)
where is the determinant of the matrix
(6.16)
Let us expand the squares and regroup the terms
The coefficients , and for each vertex of the tetrahedron are computed through the minors of the determinant . For the vertex with index the coefficients have the form
(6.17)
where , and are the minors obtained by deleting the -th row and the corresponding column (, or ) from the matrix (6.16).
We introduce the notation for the elements of the local stiffness matrix of the tetrahedron
(6.18)
Thus, the local stiffness matrix for a tetrahedral element has the form
(6.19)
The local stiffness matrix is symmetric, that is . The global stiffness matrix is obtained by summing the contributions from all tetrahedral elements of the mesh by 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 , where is the total number of mesh nodes.