You are on page 1of 11

# University of the Philippines Diliman

College of Engineering

## INSTITUTE OF CIVIL ENGINEERING

CE 28 ANALYTICAL AND COMPUTATIONAL
METHODS IN CIVL ENGINEERING III
2nd Semester AY 2014-2015

## SHEAR STRESSES OF PRISMATIC

SHAFTS WITH CIRCULAR AND
TRIANGULAR CROSS-SECTIONS
Submitted by:
Baniqued, Julius Rey
2012Tuppil, Camille G.
2012-24733
CE 28 TXY
Submitted to:
Mr. William Mata
Instructor
Date Submitted:
March 18, 2015

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.

## COMPUTING FOR J, POLAR MOMENT OF INERTIA

The program proceeds to compute for the polar moment of inertia J and the angle of twist
theta for the cross-section.
For circular cross-sections:

## SETTING UP THE GRID MATRIX U

After the user provides the interval h, the program can start setting up the grid matrix U. This
matrix represents the beams cross-section and will be the one printed in the output CSV file.
The number of grid points is computed and stored in variable k where

k=

+1
h

k=

2r
+1
h

b
k = +1
h

## K is then set as the number of rows and columns for Matrix U.

SETTING UP THE BOUNDARY CONDITIONS
The program makes sure that only the grid points inside of the designated area are
considered. If the grid point is outside the circle or triangle, the program gives it a value of 0.
If the grid point is inside, the program gives it a preliminary value or count. This serves as a
number for each grid point. The variable count also determines the number of equations
needed to solve for the Prandtl Stress Function .
For circular cross-sections:

## SETTING UP CONSTANT MATRIX A

Setting up the constant matrix A is the first step to computing for the values of the Prandtl
Stress Function . The number of rows and columns of matrix A is the variable count minus
1. This ensures that the number of rows and columns (equations) corresponds to the
number of points inside the cross-section. The program first gives all elements of Matrix A a
value of 0.

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.

## SOLVING FOR MATRIX X

Using a Gauss-Jordan function, the program obtains a column matrix X containing the
values of for each point in the grid.

## TRANSFORMING MATRIX X INTO MATRIX P

Because Matrix X is a column matrix, another square matrix P created to contain the values
of in grid form.

## GETTING THE DERIVATIVE OF THE PRANDTL STRESS FUNCTION

Because solving for the shear stress at each point requires the derivative of the function , a
process for getting the derivative of each point in the Matrix P is required. This part of the
program uses finite difference formulas (central, forward and backward) to compute for the
derivatives.

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

## Shear Stress for Triangular Cross-Section

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