Stiffness matrix 1D

Let us compute the stiffness matrix for the one-dimensional case. In one-dimensional space the gradient has the form υ\nabla \upsilon =υx= \frac{\displaystyle \partial \upsilon}{\displaystyle \partial x}, 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. Since the one-dimensional computational domain MM is partitioned into segment simplices, the part of the functional under study for a single segment (xi,xi+1)(x_i, x_{i+1}) can be written as

xixi+1(υx)2dx.\int_{x_i}^{x_{i+1}} \left( \frac{\displaystyle \partial \upsilon}{\displaystyle \partial x} \right)^2 \,dx.
(6.1)

In the general case the trial function υ(x)\upsilon(x) =i=1Nυi(x)= \sum_{i=1}^N \upsilon_i(x), whereas on a simplex it has the form υ(i)(i+1)(x)\upsilon_{(i)(i+1)}(x) =qiϕi(x)= q_i \cdot \phi_i(x) +qi+1ϕi+1(x)+ q_{i+1} \cdot \phi_{i+1}(x). Taking into account (5.7) and (5.8) from the section on hat functions, we write the relations for the hat functions

ϕi(x)\displaystyle \phi_i(x) =ai\displaystyle = a_i +bix\displaystyle + b_i \cdot xϕi+1(x)\displaystyle \phi_{i+1}(x) =ai+1\displaystyle = a_{i+1} +bi+1x\displaystyle + b_{i+1} \cdot x
(6.2)

Compute the derivative of the trial function

υ(i)(i+1)(x)x\displaystyle \frac{\displaystyle \partial \upsilon_{(i)(i+1)}(x)}{\displaystyle \partial x} =qibi\displaystyle = q_i \cdot b_i +qi+1bi+1\displaystyle + q_{i+1} \cdot b_{i+1}
(6.3)

Note that the derivative does not depend on xx and is constant on the segment. Substituting (6.3) into (6.1)

xixi+1(υ(i)(i+1)x)2dx\displaystyle \int_{x_i}^{x_{i+1}} \left( \frac{\displaystyle \partial \upsilon_{(i)(i+1)}}{\displaystyle \partial x} \right)^2 \,dx =l(i)(i+1)(qibi+qi+1bi+1)2,\displaystyle = l_{(i)(i+1)} \cdot (q_i \cdot b_i + q_{i+1} \cdot b_{i+1})^2,

where l(i)(i+1)l_{(i)(i+1)} =xi+1= x_{i+1} xi- x_i is the length of the segment.

Expand the square and regroup the terms

xixi+1(υ(i)(i+1)x)2dx\displaystyle \int_{x_i}^{x_{i+1}} \left(\frac{\displaystyle \partial \upsilon_{(i)(i+1)}}{\displaystyle \partial x}\right)^2 \,dx =l(i)(i+1)[qi2bi2+qi+12bi+12+2qiqi+1bibi+1].\displaystyle = l_{(i)(i+1)} \cdot \left[ q_i^2 \cdot b_i^2 + q_{i+1}^2 \cdot b_{i+1}^2 + 2 \cdot q_i \cdot q_{i+1} \cdot b_i \cdot b_{i+1} \right].

Let us take into account the formulas from (5.8) for the coefficients bb and introduce the notation for the elements of the local stiffness matrix of the segment

k(i)(i)=l(i)(i+1)bi2=1xi+1xik(i+1)(i+1)=l(i)(i+1)bi+12=1xi+1xik(i)(i+1)=k(i+1)(i)=l(i)(i+1)bibi+1=1xi+1xi\begin{split} &k_{(i)(i)} = l_{(i)(i+1)} \cdot b_i^2 = \frac{\displaystyle 1}{\displaystyle x_{i+1} - x_i}\\ &k_{(i+1)(i+1)} = l_{(i)(i+1)} \cdot b_{i+1}^2 = \frac{\displaystyle 1}{\displaystyle x_{i+1} - x_i}\\ &k_{(i)(i+1)} = k_{(i+1)(i)} = l_{(i)(i+1)} \cdot b_i \cdot b_{i+1} = -\frac{\displaystyle 1}{\displaystyle x_{i+1} - x_i} \end{split}
(6.4)

Thus, the local stiffness matrix for a one-dimensional element has the form

K=[k(i)(i)k(i)(i+1)k(i+1)(i)k(i+1)(i+1)]=1xi+1xi[1111].\begin{aligned}\mathbf{K} = \begin{bmatrix} k_{(i)(i)} & k_{(i)(i+1)}\\ k_{(i+1)(i)} & k_{(i+1)(i+1)} \end{bmatrix} = \frac{\displaystyle 1}{\displaystyle x_{i+1} - x_i} \begin{bmatrix} 1 & -1\\ -1 & 1 \end{bmatrix}.\end{aligned}
(6.5)

The global stiffness matrix K\mathbf{K} is obtained by summing the contributions from all segments 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 N×NN \times N, where NN is the total number of mesh nodes.

For example, consider a mesh with nodes 0,1,,i,i0, 1, \ldots, i, i +1,,N+1, \ldots, N. During assembly each segment (j)(j+1)(j)(j+1) contributes ±1l(j)(j+1)\pm \frac{\displaystyle 1}{\displaystyle l_{(j)(j+1)}}, and an interior node ii receives a contribution from the two adjacent segments — (i1)(i)(i-1)(i) and (i)(i+1)(i)(i+1) — so its main-diagonal entry is the sum 1l(i1)(i)\frac{\displaystyle 1}{\displaystyle l_{(i-1)(i)}} +1l(i)(i+1)+ \frac{\displaystyle 1}{\displaystyle l_{(i)(i+1)}}. Since the length l(j)(j+1)l_{(j)(j+1)} depends on the segment index, it cannot be taken out as a common factor — each entry of the global matrix keeps the length of its own segment. As a result the matrix is tridiagonal

K\displaystyle \mathbf{K} =[1l(0)(1)1l(0)(1)001l(0)(1)1l(0)(1)+1l(1)(2)1l(1)(2)01l(1)(2)1l(i1)(i)+1l(i)(i+1)1l(i)(i+1)1l(i)(i+1)1l(i)(i+1)+1l(i+1)(i+2)1l(N1)(N)01l(N1)(N)1l(N1)(N)].\displaystyle = \begin{bmatrix} \frac{\displaystyle 1}{\displaystyle l_{(0)(1)}} & -\frac{\displaystyle 1}{\displaystyle l_{(0)(1)}} & 0 & \cdots & & & 0\\ -\frac{\displaystyle 1}{\displaystyle l_{(0)(1)}} & \frac{\displaystyle 1}{\displaystyle l_{(0)(1)}} + \frac{\displaystyle 1}{\displaystyle l_{(1)(2)}} & -\frac{\displaystyle 1}{\displaystyle l_{(1)(2)}} & & & & \\ 0 & -\frac{\displaystyle 1}{\displaystyle l_{(1)(2)}} & \ddots & \ddots & & & \\ \vdots & & \ddots & \frac{\displaystyle 1}{\displaystyle l_{(i-1)(i)}} + \frac{\displaystyle 1}{\displaystyle l_{(i)(i+1)}} & -\frac{\displaystyle 1}{\displaystyle l_{(i)(i+1)}} & & \vdots\\ & & & -\frac{\displaystyle 1}{\displaystyle l_{(i)(i+1)}} & \frac{\displaystyle 1}{\displaystyle l_{(i)(i+1)}} + \frac{\displaystyle 1}{\displaystyle l_{(i+1)(i+2)}} & \ddots & \\ & & & & \ddots & \ddots & -\frac{\displaystyle 1}{\displaystyle l_{(N-1)(N)}}\\ 0 & & & \cdots & & -\frac{\displaystyle 1}{\displaystyle l_{(N-1)(N)}} & \frac{\displaystyle 1}{\displaystyle l_{(N-1)(N)}} \end{bmatrix}.