User:Eml4500.f08.ateam.didomenico/hw 5

Essential MATLAB Functions
Similar to the five-bar truss system, the following plane truss system MATLAB programs require additional functions to run. These functions are found at the course textbook website, Fundamental Finite Element Analysis and Applications. They include,  , and. The details of these functions are outlined below.

This function generates the element stiffness matrix for each element. When the function is called it calculates the X and Y coordinate positions of the element ends from the coordinates passed in. It produces the element length from this information. Next it calculates the direction cosines of the element. Using the Young's modulus and cross-sectional area of the element, the element stiffness matrix, k, is assembled. The stiffness matrix is passed back to the.

This function solves the force-displacement relationship for each node, resulting in the displacements and reactions at each node. This information is passed back to the.

This function outputs the axial strain, axial stress, and axial force of each element.

Two-Bar Truss System: MATLAB Code Debugging
In Homework Report #2, the team analyzed the MATLAB code for a two-bar truss system. This code was provided by Dr. Vu-Quoc and can be found here. After the homework report submission deadline, a bug was found in the provided code. This bug occurs during the building of the  array. Instead of passing the proper Young's modulus,, and cross-sectional area,  , indicies into the   function, the program passes in the entire   and   arrays. This is sufficient for cases in which all truss elements have an identical cross-sectional area and Young's modulus, but fails when these properties vary among elements.



Note: Applied load P = 7

To fix the bug, a simple modification was made to the following program segment:

Where the  array is assembled the variables   and   are replaced by the array indices   and   respectively.

was modified to be

The resulting MATLAB program code is as follows:

Running
Running this code produces the following output: >> twobar_debug k_local = 0.75       -0.75         -0.75         0.75 k = 0.5625     0.32476      -0.5625     -0.32476       0.32476       0.1875     -0.32476      -0.1875        -0.5625     -0.32476       0.5625      0.32476      -0.32476      -0.1875      0.32476       0.1875 k_local = 5   -5     -5     5 k = 2.5        -2.5         -2.5          2.5          -2.5          2.5          2.5         -2.5          -2.5          2.5          2.5         -2.5           2.5         -2.5         -2.5          2.5 K = 0.5625     0.32476      -0.5625     -0.32476            0            0       0.32476       0.1875     -0.32476      -0.1875            0            0       -0.5625     -0.32476       3.0625      -2.1752         -2.5          2.5      -0.32476      -0.1875      -2.1752       2.6875          2.5         -2.5             0            0         -2.5          2.5          2.5         -2.5             0            0          2.5         -2.5         -2.5          2.5 R = 0     0      0      7      0      0 d = 0            0         4.352        6.1271             0             0 reactions = -4.4378      -2.5622        4.4378       -4.4378 results = 1.7081      5.1244       5.1244        0.6276        3.138        6.276

Compared to the previously obtained  array shown below, this new   array makes much more sense. The previous array contained additional meaningless values along with the desired values.

Previous  array:

results = 1.7081      5.1244       8.5406       5.1244       17.081        0.6276       1.8828        3.138       1.8828        6.276

Verifying Array Accuracy
The new  array values correspond to the table shown below.

The  array for finite element analysis of the truss system is verified using principles of statics by simply summing the forces in the X and Y directions and setting these equations equal to zero. This produces two equations with two unknown values from which the axial forces of each element are derived. From here, using the element properties, the element stresses and strains can be determined. This is shown below.

$$\sum{F_{y}} = 7 - F_1\cdot sin(30^{\circ} ) - f_2\cdot sin(45^{\circ}) = 0$$

$$\sum{F_{x}} = F_1\cdot cos(30^{\circ} ) - F_2\cdot cos(45^{\circ}) = 0$$

Where $$F_1$$ is the axial force of Element 1 and $$F_2$$ is the axial force of Element 2.

Solving these equations simultaneously yields the element axial forces.

$$F_1 = 5.1244$$

$$F_2 = 6.2760$$

Now the axial stress for each element can be computed using the axial force and cross-sectional area for each element.

$$\sigma_1 = \frac{F_1}{A_1} = \frac{5.1244}{1.00} = 5.1244$$

$$\sigma_2 = \frac{F_2}{A_2} = \frac{6.2760}{2.00} = 3.1380$$

The values for axial stress can now be used along with the Young's modulus to determine the axial strain for each element.

$$\epsilon_1 = \frac{\sigma_1}{E_1} = \frac{5.1244}{3.00} = 1.7081$$

$$\epsilon_2 = \frac{\sigma_2}{E_2} = \frac{3.1380}{5.00} = 0.6276$$

These values are almost identical to the values obtained through finite element analysis. The MATLAB results have been verified to be accurate. For this case, principles of statics proved to be a much more efficient method to solve the problem. This is not the case as mesh complexity increases.

Six-Bar Truss System: MATLAB Finite Element Analysis
The problem to be evaluated in this section is found as Example 4.1 on pg.226 of the course textbook. The MATLAB code used to evaluate the problem is from the  file found at the Student Companion Site for the class textbook.

Additionally, a modified version of the problem is analyzed accordingly in this section.

The load $$P = 20 kN$$ acts at an angle $$\alpha = 30^\circ$$ for each version of the problem.

Original Problem: Example 4.1
Analysis of the original six-bar truss system is important before comparing to the modified six-bar truss system. The following code is from the  file found at the website for the class textbook.

Running
Running this code produces the following results.

>> SixBarTrussEx K = Columns 1 through 6 85355       35355       -50000            0            0            0         35355        35355            0            0            0            0        -50000            0        85355       -35355            0            0             0            0       -35355  1.0202e+005            0            0 0           0            0            0        71554       -35777             0            0            0            0       -35777        17889             0            0            0            0            0            0             0            0            0       -66667            0            0        -35355       -35355       -35355        35355       -71554        35777        -35355       -35355        35355       -35355        35777       -17889   Columns 7 through 10 0           0       -35355       -35355             0            0       -35355       -35355             0            0       -35355        35355             0       -66667        35355       -35355             0            0       -71554        35777             0            0        35777       -17889         71554        35777       -71554       -35777         35777        84555       -35777       -17889        -71554       -35777  2.1382e+005            0 -35777      -17889            0  1.0649e+005 R = 0            0         10000         17321             0             0             0             0             0             0 d  = 0            0       0.21311       0.24998             0             0             0             0    -0.0060971      0.012242 reactions = -10873      -217.27        874.27       -437.13       -1.7279        -16666 results = 5.3276e-005      10.655        10655 -4.6334e-006    -0.92669      -926.69 -4.8873e-006    -0.97746      -977.46 -8.3326e-005     -16.665       -16665 1.5363e-006     0.30727       307.27 -9.659e-009  -0.0019318      -1.9318

The  array values correspond to the table shown below.

The original displacements are shown in the following matrix. It is important to note that the nodal positions were magnified by a factor of 1000 in the original  file.

$$\begin{Bmatrix} d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \\ d_7 \\ d_8 \\ d_9 \\ d_{10} \\ \end{Bmatrix}$$ = $$\begin{Bmatrix} 0 \\           0 \\   0.21311 \\   0.24998 \\            0 \\            0 \\            0 \\            0 \\   -0.0060971 \\     0.012242 \\ \end{Bmatrix}$$

Plotting Example 4.1
To plot the undeformed and deformed shapes, the following code was appended to the original  file. For viewing, the nodal magnification factor in the original file was removed and the resulting nodal displacements were multiplied by a factor of 2500.



Modified Problem: Varying Young's Modulus
This modification of Example 4.1 involves varying the Young's modulus, E, of the elements as shown in the table below. This requires re-writing the  code to allow for an array of E values. The subsequent MATLAB file is called.

To allow for the passing of array indices, the MATLAB code was modified as shown. Much like fixing the bug in the two-bar truss system code,  replaces   inside the   loop that builds the stiffness matrices and the results array.

Running
The results obtained by running the code are as follows. Again, it is important to note that the nodal positions are multiplied by a factor of 1000. >> sixbarmod K = Columns 1 through 6 76391       38891       -37500            0            0            0         38891        38891            0            0            0            0        -37500            0        69320       -31820            0            0             0            0       -31820        98486            0            0             0            0            0            0        71554       -35777             0            0            0            0       -35777        17889             0            0            0            0            0            0             0            0            0       -66667            0            0        -38891       -38891       -31820        31820       -71554        35777        -38891       -38891        31820       -31820        35777       -17889   Columns 7 through 10 0           0       -38891       -38891             0            0       -38891       -38891             0            0       -31820        31820             0       -66667        31820       -31820             0            0       -71554        35777             0            0        35777       -17889         89443        44721       -89443       -44721         44721        89027       -44721       -22361        -89443       -44721  2.3171e+005        16015 -44721      -22361        16015  1.1096e+005 R = 0            0         10000         17321             0             0             0             0             0             0 d = 0            0       0.26485       0.26083             0             0             0             0    0.00063864     -0.001246 reactions = -9908.3       23.619       -90.274        45.137       -1.4008        -17389 results = 6.6213e-005      9.9319       9931.9 5.347e-007    0.096245       96.245 5.0465e-007     0.10093       100.93 -8.6943e-005     -17.389       -17389 -1.5183e-007   -0.033402      -33.402 -6.2645e-009  -0.0015661      -1.5661

The  array values correspond to the table shown below.

The original displacements are shown in the following matrix. It is important to note that the nodal positions were magnified by a factor of 1000 in the  file.

$$\begin{Bmatrix} d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \\ d_7 \\ d_8 \\ d_9 \\ d_{10} \\ \end{Bmatrix}$$ = $$\begin{Bmatrix} 0 \\           0 \\      0.26485 \\      0.26083 \\            0 \\            0 \\            0 \\            0 \\   0.00063864 \\    -0.001246 \\ \end{Bmatrix}$$

Plotting Example 4.1 and the Modified Six-Bar Truss System
To plot the undeformed and deformed shapes, the following code was appended to the original  file. The subsequent file was plotted over the existing plot for Example 4.1 to show how varying Young's modulus throughout the truss system can affect deformation. Subsequent deformation clearly differed from that of elements with identical Young's modulus. However, deformation did not vary greatly.

The undeformed truss system is represented by the blue dashed line. The deformed truss system of Example 4.1 is represented by the solid red line. The deformed modified truss system is represented by the green dotted line. For viewing, the nodal magnification factor in the original files was removed and the resulting nodal displacements were multiplied by a factor of 2500.



Analysis of Three-Bar Space Truss System: Example 4.2
The truss system in Example 4.2 is a pin-jointed structure with three elements. Much like problems solved earlier, the element properties vary in this truss system and are displayed below. This system adds another dimension to the FEA and results in a total of 12 degrees of freedom. Nodal displacements for this problem are denoted by,    and   in the  ,    and   directions, respectively.

Before implementing FEA to solve the problem, it is important to properly set up the  and   arrays. $$= \begin{bmatrix} 1&4\\ 2&4\\ 3&4 \end{bmatrix}$$

$$= \begin{bmatrix} 1 & 2 & 3 & 10 & 11 & 12\\ 4 & 5 & 6 & 10 & 11 & 12\\ 7 & 8 & 9 & 10 & 11 & 12 \end{bmatrix} $$

The  file for this problem was found on the Student Companion Site for the course textbook. It is as follows.

Additional MATLAB Functions
These functions were found on the Student Companion Site for the course textbook. They behave similarly to their corresponding functions for plane trusses detailed in the previous section.

Note: The program also uses, detailed in the previous section.

Running
Running this code produces the following results. Note that the nodal positions are multiplied by a factor of 1000 for simplicity. >> ThreeBarSpaceTrussEx K = Columns 1 through 6 1459.7      2919.3      -3040.9            0            0            0        2919.3       5838.6      -6081.9            0            0            0       -3040.9      -6081.9       6335.3            0            0            0             0            0            0       3566.7      -3566.7       4953.8             0            0            0      -3566.7       3566.7      -4953.8             0            0            0       4953.8      -4953.8       6880.3             0            0            0            0            0            0             0            0            0            0            0            0             0            0            0            0            0            0       -1459.7      -2919.3       3040.9      -3566.7       3566.7      -4953.8       -2919.3      -5838.6       6081.9       3566.7      -3566.7       4953.8        3040.9       6081.9      -6335.3      -4953.8       4953.8      -6880.3   Columns 7 through 12 0           0            0      -1459.7      -2919.3       3040.9             0            0            0      -2919.3      -5838.6       6081.9             0            0            0       3040.9       6081.9      -6335.3             0            0            0      -3566.7       3566.7      -4953.8             0            0            0       3566.7      -3566.7       4953.8             0            0            0      -4953.8       4953.8      -6880.3             0            0            0            0            0            0             0            0            0            0            0            0             0            0        60000            0            0       -60000             0            0            0       5026.4      -647.45       1912.9             0            0            0      -647.45       9405.4       -11036             0            0       -60000       1912.9       -11036        73216 d  = 0            0             0             0             0             0             0             0             0      -0.18705        -2.592       -0.3858 reactions = 6666.7        13333        -13889       -6666.7        6666.7       -9259.3             0             0         23148 results = 0.00050936      101.87        20375    0.00033036       66.072        13214    -0.0001929       -38.58       -23148

The  array values correspond to the table shown below.

The displacement matrix is as follows.

$$\begin{Bmatrix} d_1 \\ d_2 \\ d_3 \\ d_4 \\ d_5 \\ d_6 \\ d_7 \\ d_8 \\ d_9 \\ d_{10} \\ d_{11} \\ d_{12} \\ \end{Bmatrix}$$ = $$\begin{Bmatrix} 0 \\        0 \\         0 \\         0 \\         0 \\         0 \\         0 \\         0 \\         0 \\   -0.1871 \\   -2.5920 \\   -0.3858 \\ \end{Bmatrix}$$

The reactions are as follows.

$$\begin{Bmatrix} R_1 \\ R_2 \\ R_3 \\ R_4 \\ R_5 \\ R_6 \\ R_7 \\ R_8 \\ R_9 \\ \end{Bmatrix}$$ = $$\begin{Bmatrix} 6667 \\  13333 \\  -13889 \\   -6667 \\    6667 \\   -9259 \\       0 \\       0 \\   23148 \\ \end{Bmatrix}$$

MATLAB Plots of Example 4.2
To plot the undeformed and deformed states of the three-bar space truss system the following code was appended to the original  file. Each plotting view was manipulated within the MATLAB plot editor.

Perspective View: (1, 1, 1)
To make the deformation more clear the following perspective view was included.