# Samer Adeeb

## Finite Element Analysis: FEA in One Dimension

As shown in the previous chapter, the approximate methods involve assuming a particular form for the unknown variables such that the approximate solution has a finite number of unknown parameters. The approximate solution, or often termed trial function, that were used in the previous section were often polynomials which are continuous and differentiable along the whole domain (Figure 1a). The finite element analysis, however, involves using piecewise linear (piecewise affine) or piecewise nonlinear functions for the approximate solution (Figure 1b). Afterwards, a weak formulation of the problem is solved using the Virtual Work method (which as shown previously is equivalent to the Galerkin method).

Figure 1. The final displacement function as (a) the sum of continuously differentiable group
of functions versus (b) the sum of a group of piecewise linear functions

### Interpolation Order

In traditional finite element analysis, the values of the displacements at specific points (nodes) across the domain are the main unknowns to be calculated using the method. The displacements at intermediate locations between the nodes are interpolated according to a chosen interpolation function. The interpolation functions are classified according to their differentiability. A interpolation function is an interpolation function that can be differentiated times while an interpolation function that is discontinuous across nodes is termed . Figure 2 shows three nodes (node 1, node 2 and node 3) and three different interpolation functions for the displacement at intermediate locations between the nodes. Figure 2 illustrates discontinuous , continuous , and once differentiable interpolation functions.

Figure 2. Examples of interpolation order across nodes

### One Dimensional Linear Elements

To illustrate the finite element method, we will start by solving the same example that was solved before using the Galerkin method but employing a finite element approximation. Using a four-piecewise linear trial function, find the approximate displacement function of the shown bar. Assume that the bar is linear elastic with Young’s modulus and cross-sectional area and that the small strain tensor is the appropriate measure of strain. Ignore the effect of Poisson’s ratio.

The different aspects of the finite element analysis method will be presented through solving this example as follows.

#### Shape Functions

In this example, a piecewise linear trial function for the displacement that satisfies the essential boundary condition is imposed. The displacement is interpolated between the four nodes and thus has the following form:

where are multipliers that happen to be the displacements at the nodes 1, 2, 3, and 4 respectively, while are the interpolation functions that have a value of 1 at node and decrease linearly to zero at the neighbouring nodes (Figure 3). These functions are traditionally termed the “hat” functions, for obvious reasons. They are also referred to as the shape functions since they define the shape of the deformation of the model. Except when they vanish, the shape functions have the form:

The derivatives of the shape functions are very simple and have the form:

Figure 3. One dimensional piecewise linear interpolation functions or “hat” functions

#### Solution using the Galerkin Method

The Galerkin method, involves equating the integral of the weighted residuals to zero. The weight functions are chosen as the functions which happen to be equal to the shape functions . After integration by parts as shown previously, the Galerkin method produces four equations of the form:

There are four trial or shape functions . Each appears only within a sub-interval and is equal to zero at the remaining part of the domain. Thus, the integration for each equation is only performed on the part where does not vanish.

Equation 1: vanishes every where except for . In this part of the domain, and vanish. Therefore, for the first equation we have:

Therefore, the first equation has the form:

The domain of integration can be updated to exclude the sub-domains when the integrand is equal to zero:

Equation 2: vanishes every where except for . In this part of the domain, vanishes. Therefore, for the second equation we have:

Therefore, the second equation has the form:

The domain of integration can be updated to exclude the sub-domains when the integrand is equal to zero:

Equation 3: vanishes every where except for . In this part of the domain, vanishes. Therefore, for the third equation we have:

Therefore, the third equation after excluding the sub-domains when the intgrand is equal to zero has the form:

Equation 4: vanishes every where except for . In this part of the domain, and vanish. Therefore, for the fourth equation we have:

Therefore, the fourth equation after excluding the sub-domains when the intgrand is equal to zero has the form:

The above four equations can be written in matrix form as follows:

where . The integration on both sides is relatively simple to calculate. The final equations have the following form:

which when solved gives the solution:

#### Comparison with the Exact Solution

The exact solution as shown previously is known and is equal to:

The exact displacement at the points 1, 2, 3, and 4 are given by:

The finite element analysis approximation gave exact solution for the displacements of the points 1, 2, 3, and 4. However, in between those points, the finite element analysis approximation following linear interpolation. As shown in the figure below when setting , , , and units, the displacement values are almost accurate. However, the linear interpolation of the displacements means that the strain is constant in the area between points. Therefore, the stresses are constant between points and in fact, the stress distribution is discontinuous!

View Mathematica Code
uexact = c*L^2/2/EA*x - c/6/EA*x^3;
N1 = Piecewise[{{4 x/L, 0 <= x <= L/4}, {4/L (L/2 - x), L/4 <= x <= L/2}}, 0];
N2 = Piecewise[{{4/L (x - L/4), L/4 <= x <= L/2}, {4/L (3 L/4 - x), L/2 <= x <= 3 L/4}}, 0];
N3 = Piecewise[{{4/L (x - L/2), L/2 <= x <= 3 L/4}, {4/L (L - x), 3 L/4 <= x <= L}}, 0];
N4 = Piecewise[{{4/L (x - 3 L/4), 3 L/4 <= x <= L}}, 0];
u1 = c*L^3/EA*(47/384);
u2 = c*L^3/EA*(11/48);
u3 = c*L^3/EA*(39/128);
u4 = c*L^3/EA*(1/3);
u = u1*N1 + u2*N2 + u3*N3 + u4*N4;
uexactp = uexact /. {c -> 1, EA -> 1, L -> 1}
sigmaexact = D[uexactp, x]
up = u /. {c -> 1, EA -> 1, L -> 1}
(*Assuming Young's modulus = 1 unit *)
sigmap = D[up, x]
Plot[{uexactp, up}, {x, 0, 1}, AxesLabel -> {"x", "displacement"}, PlotLegends -> {uexact, u_FEA}]
Plot[{sigmaexact, sigmap}, {x, 0, 1}, AxesLabel -> {"x", "sigma_11"},  PlotLegends -> {"sigma_exact", "sigma_FEA"}]


#### Solution Using the Virtual Work Method

As stated previously, the Galerkin method and the virtual work method are equivalent. The principle of virtual work states that, from a state of equilibrium, when a virtual admissible (compatible) displacement is applied, the increment in the work done by the external and body forces during the application of the virtual displacement is equal to the increment in the deformation energy stored. We will adopt the traditional matrix multiplication convention with differentiation between row and column vectors. The displacement function has the form:

The stress component due to the assumed trial displacement function has the following form:

The virtual displacement can be set by choosing virtual parameters :

Setting:

then the equations can be rewritten as follows:

The internal virtual work has the form:

The external virtual work has the form:

Equating the internal and external virtual work, the following is obtained:

where . Note that the factor is constant in this problem and was pulled out as a common factor for simplicity.
Since the coefficients are arbitrary, the coefficients of each on both sides of the equality are equal. Therefore, the same equations of the Galerkin method are retrieved.

#### Elements, Nodes, and Degrees of Freedom

In the finite element method, the domain is discretized into points which are called nodes and the regions between the nodes are called elements. The approximate solution involves assuming a trial function for the displacements interpolated between the values of the displacements the nodes. The displacement function is formed by multiplying the displacements of the nodes by shape functions. The displacements of the nodes are termed the degrees of freedom of the system. The right-hand side of the matrix equation formed is equivalent to a nodal force vector and is formed by lumping the distributed load and forming equivalent concentrated loads at the nodes.

For this particular example the solution is exact at the selected nodes. However, the solution within the elements will be linearly interpolated between the two values on each side and thus is not exact. The value of the gradient of the displacement at each node does not exist, as the displacement function is not differentiable at the nodes. In the finite element analysis method, the stresses that are related to the strains (the gradients of the displacements) are usually averaged at the nodes, and the degree of variation of the stresses between the different elements could be an indication of the accuracy of the solution. The matrix multiplied by the degrees of freedom is, in conservative systems, symmetric and is termed the stiffness matrix.

When the virtual work method was applied, the integration was done on the whole domain. However, it is possible to perform the integration locally on the elements. The equations of the virtual work can be written as follows:

Because the integration can be done locally on the elements, it is possible to isolate the elements and perform the integration on each element separately (Figure 4). On each element, the shape functions or interpolation functions are associated with the end nodes. For example, element e2 connects nodes 1 and 2 with two shape functions,
and . What is remarkable about the method is the similarity between all the elements shown in (Figure 4). Thus, a local stiffness matrix for each element can be developed, and then, the global stiffness matrix can be easily assembled by combining all the local stiffness matrices.

Element 1:
On element 1, the displacement is given by: and the virtual displacement is given by . By considering the first element, the first term (denoted ) in the internal virtual work equation has the following form:

is the local stiffness entry for element 1 corresponding to the degree of freedom .

The first term in the external virtual work has the form:

where is the nodal force to be applied at node 1 corresponding to lumping the distributed load acting on element 1.

Element 2:
On element 2, the displacement is given by: and the virtual displacement is given by . By considering the second element, the second term in the internal virtual work equation has the following form:

where are the local stiffness matrix entries for element 2 corresponding to the degrees of freedom and .
The second term in the external virtual work has the form:

where and are the nodal forces to be applied at nodes 1 and 2 corresponding to lumping the distributed load acting on element 2.

Element 3:
On element 3, the displacement is given by: and the virtual displacement is given by . By considering the third element, the third term in the internal virtual work equation has the following form:

where are the local stiffness matrix entries for element 3 corresponding to the degrees of freedom and .
The third term in the external virtual work has the form:

where and are the nodal forces to be applied at nodes 2 and 3 corresponding to lumping the distributed load acting on element 3.

Element 4:
On element 4, the displacement is given by: and the virtual displacement is given by . By considering the fourth element, the fourth term in the internal virtual work equation has the following form:

where are the local stiffness matrix entries for element 4 corresponding to the degrees of freedom and .
The fourth term in the external virtual work has the form:

where and are the nodal forces to be applied at nodes 3 and 4 corresponding to lumping the distributed load acting on element 4.

Global Stiffness Matrix
The global stiffness matrix can be assembled by the equation:

The resulting equations (global stiffness matrix and global nodal forces vector) considering the arbitrariness of the multipliers :

It is important to note that because the assumed displacement function satisfies the essential boundary conditions, the structure is stable, and the equations can be solved directly. In general, the structure under consideration would have five degrees of freedom and would have a global stiffness matrix and a global nodal forces vector. The nodal forces vector corresponding to the displacement of the first node where the displacement is prescribed would have an unknown reaction. The stiffness matrix can then be reduced into a matrix which can be solved.

Figure 4. Discretizing the domain into elements and nodes

#### Properties of the Stiffness Matrix

In the example above, the final equations had the following form:

where is the global stiffness matrix, is the vector of degrees of freedom while is the nodal forces vector. In general, the global stiffness matrix of an elastic structure formed using the finite element analysis method whether the problems has one, two, or three dimensions has the following properties:

• Sparsity: The stiffness matrix formed in the traditional finite element analysis is sparse, i.e., contains many zero entries. This property is due to the choice of piecewise-linear interpolation functions. The shape functions (or the interpolation functions) are chosen to be “Hat functions” that take values of 1 at each node and decrease linearly or in a parabolic fashion across the neighboring elements connected to that node. Nodes that are not connected together with any elements have a corresponding zero entry in the global stiffness matrix.
• Invertibility: (See the section on Invertible linear maps) The stiffness matrix of a structure is a linear map between and . Such map is invertible if and only if the map is injective (one to one), which means that the only element in the kernel of the map is the zero vector. Otherwise, if the map is not injective, then there are two nonzero distinct displacement vectors and that can be produced by the same force vector . I.e., , then the nonzero vector displacement can be applied to the structure without any external forces! If no boundary conditions are applied to a structure, then naturally rigid body motions and rigid body rotations can be applied without any external forces. Therefore, a stiffness matrix of a structure that is not restrained is not invertible and its determinant is equal to zero. Once enough boundary conditions are applied to the structure, then the only element of the kernel of the linear map is the zero element, the stiffness matrix is invertible, and its determinant is not equal to zero. Notice, however, that when a structure is not well supported and does not have the correct boundary conditions, the stiffness matrix is termed “ill conditioned”. Some finite element analysis software will still be able to find a possible solution, depending on the solution method. A user should be cautious in such cases since the solution could involve very large numbers for the displacement that would render the solution inaccurate.
• Symmetry: The stiffness matrix of an elastic structure is symmetric. The symmetry is a direct consequence of elasticity. Elasticity implies that there is an energy function such that . Therefore, implying that is symmetric.
• Positive and Semi-Positive Definiteness: (See the corresponding section in linear vector maps) A stable structure will deform in the direction of increasing external forces. Mathematically speaking, the dot product between the displacement and the force vectors has to be positive. If the structure is well restrained, i.e., is invertible, then is positive definite and any displacement field in the structure will produce positive energy. In mathematical terms, this imples: . However, if the structure is not well restrained, then is not invertible and such that . If the material of the structure is elastic, then the global stiffness matrix of the structure is semi-positive definite. Most finite element analysis software will check the invertibility of the stiffness matrix by finding the smallest eigenvalue of the stiffness matrix. If one of the eigenvalues of the stiffness matrix is zero, then the stiffness matrix is not invertible. If one of the eigenvalues is negative, then the stiffness matrix is not positive definite, since positive definiteness ensures positive eigenvalues (See the corresponding section in linear vector maps). A direct consequence of the positive definiteness is that the diagonal entries of the stiffness matrix have to be positive; since a diagonal element represents the force applied at the corresponding degree of freedom to produce unit displacement at this particular degree of freedom, then the requirement that the energy is positive ensures that the force and the displacement are in the same direction.
• Any vertical column of the stiffness matrix is equal to the vector of nodal forces required to move the corresponding degree of freedom by one unit displacement while keeping the remaining degrees of freedom equal to zero.

### One Dimensional Quadratic Elements

In the previous section, the domain of a one-dimensional problem was discretized using piecewise linear functions. Another approximation is the C0 piecewise quadratic interpolation functions, where on each element, the displacement is quadratic. If one wishes to obtain better accuracy, either a finer mesh of linear elements is to be used, or quadratic elements are to be used instead of the linear elements (Figure 5).

Figure 5. Linear vs. quadratic one dimensional elements

To define a quadratic one dimensional element, an additional inner node is introduced. Similar to the linear elements, the displacement function is continuous across nodes but not differentiable at the boundaries between elements. In general, the quadratic form of the displacement is:

Figure 6 shows the displacement function of a quadratic element with three nodes. An alternative form of the displacement is:

where , , and are the displacements of the nodes 1, 2, and 3, while , and , and are the shape functions associated with these nodes (Figure 6). , , and are the generalized degrees of freedom of the element while , , and are the nodal degrees of freedom. To find the shape functions , , and , the following three equations are solved:

Therefore,

Therefore, the displacement function in terms of the nodal degrees of freedom has the form:

Rearranging:

Therefore, the shape functions are:

Figure 6. One dimensional quadratic element displacement function and shape functions

It can be checked that the sum of the shape functions is always equal to 1, which allows for the rigid-body motion or constant displacement of an element to be modelled (Why?). The local stiffness matrix and the local nodal forces vectors can be established similar to the previous section. First, the following matrices are defined:

then the displacement , , and can be written in terms of the nodal degrees of freedom vector as follows:

If is Young’s modulus and is the cross sectional area of the element, then the local stiffness matrix of the element is a matrix and has the form:

If and are constant, then has the form:

The nodal forces vector is a 3 dimensional vector and has the form:

where is the distributed load per unit length acting on the element. If is constant, then the nodal forces vector have the form:

View Mathematica Code
u = a0 + a1*X1 + a2*X1^2;
Eq1 = u /. X1 -> 0;
Eq2 = u /. X1 -> L/2;
Eq3 = u /. X1 -> L;
a = Solve[{Eq1 == u1, Eq2 == u2, Eq3 == u3}, {a0, a1, a2}]
u = u /. a[[1]]
N1 = FullSimplify[Coefficient[u, u1]]
N2 = FullSimplify[Coefficient[u, u2]]
N3 = FullSimplify[Coefficient[u, u3]]
B = {{D[N1, X1], D[N2, X1], D[N3, X1]}};
B // MatrixForm
Transpose[B] // MatrixForm
K = EA*Integrate[Transpose[B].B, {X1, 0, L}];
K // MatrixForm
Nn = {{N1, N2, N3}};
fe = Integrate[p*Transpose[Nn], {X1, 0, L}];
fe // MatrixForm


### Problems

1. For a quadratic one dimensional element of length , find the nodal forces vector if a distributed horizontal load of (load per unit length) is applied on the element.
2. Using two quadratic one dimensional elements and the virtual work method, find the displacement of the nodes and the stress within each element of the following problem assuming , , , and units. Compare with the exact solution and the solution using four linear elements shown above.