Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
College of Engineering
PROGRAM IMPLEMENTATION
DECLARATION OF LIBRARIES AND VARIABLES
This program makes use of an external library matrix.h composed of matrix functions. In
the first part of the program, this library, along with other standard libraries, were called. The
value of the constant pi is also defined.
The output of this program is a file named shear.csv. This CSV file will contain a table of
values showing the shear stress in regularly-spaced points within the cross-section of a
beam. The program creates this file at the start of the program.
INPUT
The program first asks the user if the cross-section of the beam is circular or triangular.
The program then proceeds to ask for other significant values such as Internal Torque (T) in
N-m, Length of Shaft (L) in m, Shear Modulus of Elasticity (G) in Pa, radius of cross-section
(r) in m for circular cross-sections (cs=1).
For triangular cross-sections (cs=2), the program also asks for Internal Torque (T) in N-m,
Length of Shaft (L) in m, Shear Modulus of Elasticity (G) in Pa. The program also asks for
the length of one side of the triangle (b) in m. This program assumes that the triangle is
equilateral and one side is parallel to the horizontal.
k=
k=
2r
+1
h
b
k = +1
h
The program proceeds to set values of Matrix A based on the values of Matrix U. If the
element is in the main diagonal of the matrix, a value of -4 is assigned to it. For any other
element, the program checks its corresponding element in Matrix U. If the surrounding
elements of element A in Matrix B is not zero, the program assigns a value of 1 for the
corressponding surrounding element in Matrix A.
For both circular and triangular cross-sections:
SETTING UP MATRIX B
Matrix B represents the other side of the matrix equation (Ax = B). The program sets up
Matrix B as a column matrix with values equal to -2G for both circular and triangular crosssections.
This part of the program also computes the shear stress of each point in the grid using the
given formula for shear stress:
= xy2 + xz 2
The computed shear stress is stored into its corresponding element in Matrix U.
OUTPUT
The output is printed in a CSV file containing the values of grid Matrix U.
SAMPLE OUTPUT/RESULTS
FOR CIRCULAR CROSS-SECTIONS
0.025
0.05
0.075
0.1
0.125
0.15
0.175
0.2
0.225
0.25
0.275
0.3
0.325
0.35
0.375
0.4
0.425
0.45
0.475
0.5
0.525
0.55
0.575
0.6
0.625
0.65
0.675
0.7
0.725
0.75
0.775
0.8
0.825
0.85
0.875
0.9
0.925
0.95
0.975
LIMITATIONS
The contour graphs produced by the program MS Excel show discrepancies at the
boundaries. The graphs make it seem like the shear stress becomes lower at the
boundaries. However, the proponents believe that this is only because the program
interpolates the given data to create a continuous contour.
APPENDIX
FORMULAS
Circular Cross-Sections
Polar Moment of Inertia, J
Angle of Twist,
1 4
J= r
2
=
TL
JG
Triangular Cross-Sections
4
J=
b
16 3
TL
JG