User:Eml4500.f08.team.foskey.ckf/hw5b

MATLAB Assignment The Six Bar Truss Problem

The Six Bar Truss Problem
The following codes address the six bar truss problem as seen in Example 4.1 on page 226 of the text Fundamental Finite Element Analysis and Applications by M. Asghar Bhatti. This is a three part assignment, and each part is commented after its code. The figure below shows the problem setup



In the problem, P is equal to 20kN and $$ \alpha $$ is 30o. The Young's Modulus and cross sectional areas of the bars varies between Case 1 and Case 2 as explained following the MATLAB code for each case.

Comments And Explanation Of Case 1 Code
The code for the six bar truss above is commented throughout as best as possible to explain the function of key sections and variables.

In case 1, the Young's Modulus for all six of the bars is 200GPa, and the cross sectional area is 0.001 m2 for all six bars

Essentially, the code receives the constant properties, and the nodal positions. Next it calculates the lengths of each bar, then creates the connectivity array and location matrix master array. The force matrix is then created. The global stiffness matrix is then calculated by looping through all of the elements. With this information, the output results shows the elemental stiffness matrices, the global stiffness matrix, the applied loads (in a global coordinate system), the displacements and the reactions. The results matrix displays the strain, stress, and axial forces in columns, for each element ( each row).

With all the important values calculated and displayed, the code next focuses on plotting the deformed and undeformed trusses. Each node is given a number, and each dislocated node is given a new number. Next, the code assigns each end of an element a node number (either and original node or a new dislocated node). The code then plots each element based on the node data. Line styles and color are changed after plotting the undeformed truss so that the deformed truss can be easily identified.

The final part of the code labels the nodes and elements, as well as creates a legend

Comments And Explanation Of Case 2 Code
Again, the code for the six bar truss (Case 2) is commented throughout as best as possible.

In Case 2, each bar (element) of the truss has its own values for its Young's Modulus.

These values were:

E (1) = 150 GPa E (2) = 180 GPa E (3) = 200 GPa E (4) = 200 GPa E (5) = 220 GPa E (6) = 250 GPa

The values for the cross sectional area remains constant at 0.001 m2.

The Case 2 code works exactly as the code for Case 1 (see Comments And Explanation Of Case 1 Code above), with the exception that the values for the Young's Moduli are stored as a matrix rather than a constant variable. As a result, each time a value for the modulus is used, it is used as the value of an element in that matrix.

Comments On The Comparison
The comparison code basically runs the code for Case 1 and Case 2 back to back. The output results is the results for Case 2 first, followed by the results for Case 1. The results are preceded by text indicating the case for which they correspond.

The key feature in the comparison code is the figure generated. The comparison code plots the undeformed truss, the deformed truss in Case 1 and the deformed truss in Case 2 in one figure. The nodes and elements are not labeled in this figure to avoid cluttering the figure.

Note: The comparison code is considerable less commented as it is essentially a combination of the individual case codes.

For code comments, see the code for either Case 1 or Case 2 (above).

A Note On Functions Used
The codes for Case 1, Case 2, and the comparison code all use the functions PlaneTrussElement, PlaneTrussResults, and NodalSoln. These functions and explanations of what they do can be seen here

Comments On The Results Output
The output results shows the elemental stiffness matrices( in local and global coordinate systems), the global stiffness matrix, the applied loads (in a global coordinate system), the displacements and the reactions(both in the global coordinate system). The results matrix displays in three columns the strain, stress, and axial forces (respectively) for each element. Each element is represented by a row, with row 1 being element 1 and so forth.

For the comparison results, the same results is generated twice, first for Case 2, and then for Case 1. At the beginning of each case's output, text states for which case the results are for.

Note on Units:  The units of the output values are as follows:

Stiffness Matrices, k_local, k, and K : Newtons per meter (N/m) Applied Loads, R : Newtons (N) Global Displacements, d : millimeters (mm) Reaction Forces, reactions : Newtons (N) Results, results : Dimensionless (m/m) for strain, Pascals (pa) for stress, and Newtons (N) for axial force

Case 1 Figure
The figure below is generated by running the Case 1 code. The undeformed truss is shown in red dotted lines, and the deformed truss is shown in blue solid lines. Global nodes and elements are labeled on the deformed truss.

Since nodes 1, 3, and 4 were pinned, those nodes remain the same for both trusses. Node 5 moves slightly, and node 2 moves considerably, as this was the point at which the load was applied.

Note: To better show the deformed truss, the displacements were multiplied by a scaling factor of 5. This results in exaggerated displacements when the truss is plotted.



Case 2 Figure
The figure below is generated by running the Case 2 code. The undeformed truss is shown in red dotted lines, and the deformed truss is shown in blue solid lines. Global nodes and elements are labeled on the deformed truss.

Since nodes 1, 3, and 4 were pinned, those nodes remain the same for both trusses. Node 5 moves very slightly, and node 2 moves in the direction of the applied load. Since the bars of the truss had different material properties, the truss deforms slightly differently than in Case 1, but overall the deformation is similar.

Note: To better show the deformed truss, the displacements were multiplied by a scaling factor of 5. This results in exaggerated displacements when the truss is plotted.



Comparison of Cases 1 and 2 Figure
The figure below is created when the comparison code is run. It shows the undeformed truss in red dotted lines, the deformed truss for Case 1 in green solid lines, and the deformed truss for Case 2 in blue solid lines. Element and node numbers are neglected to avoid cluttering the figure.

By putting all three trusses in one figure, one can clearly see the difference that changing the Young's moduli makes on the deformations. It is interesting to note that node 2 moves more in Case 2, but node 5 almost not at all. Node 5 moves more in Case 1.

Note: To better show the displacements, the displacements of the deformed trusses are both multiplied by a scaling factor of 5.