File 52 MARTEC174
File 52 MARTEC174
net/publication/368939289
CITATIONS READS
2 25
3 authors, including:
Shahidul Islam
Bangladesh University of Engineering and Technology
33 PUBLICATIONS 74 CITATIONS
SEE PROFILE
All content following this page was uploaded by Shahidul Islam on 11 April 2023.
ABSTRACT
An Object-Oriented Programming (OOP) procedure is presented for solving structural mechanics ‘beam’
problems by using the deflection, bending moment and shear force equations. The program is developed for a
single span and for cantilever and simply supported beam. A beam is divided into one hundred segments, i.e.,
one hundred and one nodes and deflection, bending moment and shear force are calculated on each node for
applied loads and moments.
Key words: Beam analysis, C++, Object oriented programming, shear force, bending moment, deflection.
347
Proceedings of MARTEC 2010
x L
L
x
Fig. 3: Uniformly distributed load
Fig. 1: Point load at any point on the beam
Loading condition 4: A gradually varying load (Fig. 4)
Loading condition 2: Uniformly distributed load (Fig.
A gradually varying load of highest magnitude w is
2)
subjected to a beam of length L where the variable
A uniformly distributed load of magnitude w per distance is x. The deflection equation is
unit length is applied to a cantilever beam of length L
where the variable distance is x. The deflection y=
(
w 10 L3 − 10 L2 x + 5Lx 2 − x 3 ) (10)
equation is 120 EIL
y=
(
wx 2 6 L2 − 4 Lx + x 2 ) (5)
24 EI
w
x L
When q = 0 and x ≤ p , the deflection equation Loading condition 2: Uniformly distributed load over
the length of the beam
y=
( −
) (
wx 2 6 L2 − 4 Lx + x 2 wx 2 6 p 2 − 4 px + x 2 ) (8) y=
wx 3
(
L − 2 Lx 2 + x 3 ) (12)
24 EI 24 EI 24 EI
Loading condition 3: A gradually varying load (Fig. 6)
When x > p and q = 0, the deflection equation
348
Proceedings of MARTEC 2010
y=
wx
360 EIL
(
7 L4 − 10 L2 x 2 + 3x 4 ) (13)
and moments. The class Node has member data
about deflection shear force and bending moment due
to different types of loads and finally total deflection,
total shear force and total moment to sum up all the
individual effects. The class Beam has member
data as typebeam (value 1 means cantilever beam
and 2 means simply supported beam), E (Young’s
modulus of elasticity), I (moment of inertia) and
length. The beam is divided into 100 segments, i.e.,
contains 101 nodes. Then for applied loads (maximum
four point loads) and moments (maximum four),
L appropriate member functions are created to evaluate
x
deflections, shear force and bending moments at each
Figure 6: A gradually varying load node. Then a member function named void
summation_beam()is created to add up the
3. THE PROGRAM individual deflection, shear force and bending
moment components to give total values at each node.
The programming language used is C++, an In short, all the member functions are declared in
extension of C. It was developed by Bjarne Stroustrup corresponding classes in class_beam.h file.
in the early 1980s at Bell Laboratories (Deitel, 2005). These functions are defined in either
The reason for using this language is that it provides canti_beam.cpp or in simply_beam.cpp
capabilities for object-oriented programming. and are called in main_beam.cpp.
As seen in section 2, for each of the two types of
beams (cantilever and simply supported), a number of
loading conditions are present. Procedural program 4. RESULTS AND DISCUSSION
does not work very well for large and complex To investigate the quality of the output generated by
problems. Though it can not be claimed that the the program, a problem (A cantilever beam of 3 m
presented program is such a complicated one, but length is carrying a load of 1 KN (downward) at the
object oriented programs are easier to understand, free end , 2 KN (downward) at a distance 1 m from
correct and modify (Deitel, 2005). It results in the free end,3 KN(downward) at a distance 2 m from
programs that are clearer, more reliable and more the free end and finally a partially uniformly
easily maintained. Instead of viewing a program as a distributed load of 2 N/mm as shown in Figure 7. The
series of steps to be carried out, it views it as a group modulus of elasticity of the beam is 200x103 N/mm2
of objects that have certain properties and can take and moment of inertia is 48.6x106 mm4) is selected.
certain actions. Then the generated output is compared with the
The developed program is a multifile program. The outputs from a professional FEM software and hand
calculation.
source file main_beam.cpp contains the function
main. This function makes an object beam of class
Beam. Its next task is to call a member function of
class Beam named add_node(). Then according to 3 KN 2 KN
2
1 KN
1m 1m
the type of beam and presence of point load,
uniformly distributed load, partially distributed load,
gradually varying load and moment, it calls different
member functions of class Beam like
add_pointload_cantibeam()to find out the Figure 7: Model problem
effect due to the presence of corresponding loads or
moments. Finally to add up all the effects on the Node Bending moment Shear force Deflection
beam, ie, to apply the method of superposition, the in (N-mm) (N) (mm)
function summation_beam()is called. 0 1.50E+07 8000 0
In the header file named class_beam.h, all the 1 1.48E+07 8000 -0.000690741
classes used in the program are created. These classes 2 1.45E+07 8000 -2.75E-03
are class pointload, class unidl --- --- --- ---
(uniformly distributed load), class gvdl 49 4.65E+06 5000 -1.24E+00
(gradually varying distributed load), class 50 4.50E+06 5000 -1.28E+00
partidl (partially distributed load), class 51 4.35E+06 5000 -1.32E+00
moment, class Node and class Beam. --- --- --- ---
The first five classes mentioned above contain 98 6.36E+04 1120 -3.59431
member data about the positions and values of loads 99 30900 1060 -3.64472
100 0 1000 -3.69513
349
Proceedings of MARTEC 2010
Table1. Nodal values for the developed software are shown in Figures 8-10. Demo version of the
professional software BEAM (based on finite element
method), used for comparison (Table 2), gives only
bending moment and shear force data. For that reason
the space for deflection in the table of comparison is
kept empty. It is clear from the table that the
developed program gives accurate results.
Though the problem discussed above has only point
loads but the program is capable of performing the
analysis of beams subjected to a combination of point
loads, uniformly distributed loads, gradually varying
loads, non-uniformly distributed loads and moments.
At present both the cantilever beam and simply
Figure 8: Deflection Curve supported beam can be analyzed. The program is
capable of analyzing beam of only one span.
6. CONCLUSION
An Object-Oriented Program is developed for
solving structural mechanics ‘beam’ problems by
using the deflection, bending moment and shear force
equations. The developed program generates output
without any error. At present no graphics is associated
with the program. The generated results are
transferred to Microsoft Excel to create the curves.
Future goal is to create graphical input and output
Figure 9: Shear Force Curve system.
REFERENCES
1. A. Pytel and F. L. Singer (2005), Strength of
Materials, Fourth Edition, Harper Collins publishers.
2. H. M. Deitel (2005), C++, How to Program, Fifth
Edition, Prentice Hall.
5. COMPARISON
BM(max) 1.50E+07
1.50E+07 15000127
N-mm
SF(max) 8000
8000 8000.06
N
DEF(max)
-3.69513 ------ -3.69513
mm
Table 2: Table of Comparison
The curves drawn from the results of the program
350