Package: beamframe
Contents:IntroductionAbout ModuleProgram MotivationInstallationDocumentationUnits and ConventionsTable of all classes and argumentsBeamMethods in Beam classLoadPoint LoadUniformly Distributed Load(UDL)Uniformly Varying Load(UVL)ReactionPoint MomentHingeExamplesIntroductionA beam is a structural element that primarily resists loads applied laterally to the beam's axis (an element designed to carry primarily axial load would be a strut or column). Its mode of deflection is primarily by bending. The loads applied to the beam result in reaction forces at the beam's support points. The total effect of all the forces acting on the beam is to produce shear forces and bending moments within the beams, that in turn induce internal stresses, strains and deflections of the beam.Source:WikipediaAbout the moduleThis module is aimed to solve Statically Determinate, Geometrically Stable two dimensional Beam just by using 3 equations of static equilibrium.
$F_x = 0, F_y = 0 \text{ and } M_{point} = 0$.This module supports:determinate 2D beam with Point Loads, Uniformly Distributed Loads, Uniformly Varying Loads, Point MomentsFixed or Hinged or Roller types of support conditionsA Beam with Internal HingeBending Moment Diagram and Shear Force DiagramProgram MotivationI studied about Beams first time in my second semester which had an included course ofApplied Mechanics - I (Statics). About 10-15 marks question were sure from beams and frames in board examination. But, while practicing beam analysis questions, from past question collection, one thing that collection was lacking was solution to those questions. Not even reaction values were given. So, it would cost us 15 minutes for even simple reaction calculation error. So, I thought of making this library from that period. And, I turned this thought into action in my 3rd semester's vacation.Installation and usagepip install beamframeRequirements"numpy>=1.19",
"sympy>=1",
"matplotlib>=3"NoteAll requirements will be installed automatically while installing this module.PyPi linkImporting the moduleAny one way of importing can be adoptedfrom beamframe import beam
#or 
from beamframe.beam import *DocumentationUnits and ConventionsOne can use and follow thier own sign conventions in this module. But, default values will have following units and sign conventions.Sign Conventions:Positive x-axis for beam: increases in right hand side.Positive y-axis for beam: increases upward direction.Positive angle direction: Counter clockwise with respect to positive x-axis of beam.Positive moment: Counter clockwiseStandard Units:Length: meterAngle: degreesLoad: kNMoment: kNmLoad per meter: kN/mList of all classes and argumentsclassrequired argumentsoptional argumentsBeamlength: floatE: float, I:floatLoadpos: float, load: floatinverted:bool=FalsePointLoadpos: float, load: floatinverted:bool = False, inclination:float=90UDLstart: float, loadpm: float, span: floatinverted:bool = TrueUVLstart: float, startload: float, span: float, endload: floatinverted: bool = TrueReactionpos: float, type: str, pos_sym: strnonePointMomentpos: float, mom: floatccw: bool = TrueHingepos: floatside: str = 'l'Beam:Beamis the main class to represent a beam object and perform various calculations.Argumentslength(float): length of a beamndivs(int): number of divisions of beam. This specifies number of points along beam in which shear force and bending moment values will be calculated.Here are few optional keyword argumentsE(float)= Modulus of Elasticity of beam materialI(float)= 2nd moment of area of the cross section of beamMethodsS.NMethodArgumentsDescription1.fast_solveloads_listPass list (or tuple) of all load, moment, reaction and hinge elements present in beam.This method will:1. Calculate Reactions2. Generate Shear and Bending Moment Equation2.generate_graphwhich:str = 'both' , save_fig:bool = False , show_graph:bool = True, res:str = 'low'By default this generate will both Bending Moment Diagram(BMD) and Shear Force Diagram (SFD) stacked vertically.To obtain seperate graphs change default valuewhich = 'both'to'sfd'or'bmd'To change resolution useresand accepted values are('low', 'medium', 'high') or ('l', 'm', 'h')Note:Don't useres(values other than'low') andshow_graph=Truetogether. It will create render error.3.add_loadsload_listPass list of force generating objects. This will add the net loads in x and y direction.Possible loads are(PointLoad, Reaction, UDL, UVL)4.add_momentsmomgen_listoptional:about=0Pass in list of moment generating objects like(PointLoad,Reaction, UDL, UVL, PointMoment)By default this function takes moment about origin.If you want to take moment about any other point, use Optional argumentaboutand pass any x-coordinate value.5.add_hingehinge, mom_gensThis method must be used iff there is hinge object in beam. A hinge object and list(or tuple) of moment generating objects are expected arguments6.calculate_reactionsreaction_listPass in list(or tuple) of unknown reactions object to solve and assign reaction values7.generate_shear_equationloadsPass in list(or tuple) of load generators to generate shear equation8.generate_moment_equationloadsPass in list(or tuple) of load generators to generate moment equation9.generate_shear_valuesloadsPass in list(or tuple) of load generators to generate shear force values along various points in beam specified byndivsargument while creating beam object10.generate_moment_valuesloadsPass in list(or tuple) of load generators to generate bending moment values along various points in beam specified byndivsargument while creating beam object11.save_datafname:str, format:str='txt'Saves numerical values of Shear Forces and Moment Values in text fileNoteJust first and second methods are sufficient to solve beam and generate graph. But, to keep track of ongoing process use other methods.Remember not to usefast_solveand other methods(excluding method no. 2). Doing this will re-add all those loads you've passed again.Example#importing the module
from beamframe.beam import *

# to create a beam of length 5m:
b = Beam(5)LoadArguments:pos(float): position of that netload with respect to beam coordinates's originload(float): net load of that load type(for point load that is point load value,
but it will be different
for other loads like uvl and udl)inverted(bool)=False: Default direction of positive net load is in positive direction of y-axesby default:inverted = False(Positive Load)useinverted=True(indicates negative Load)PointLoadDescriptionSubclass of classLoadArgumentspos, load, inverted: inherit from super classLoadinclination(float)=90:unit=degreerepresents angle made by direction of net load with positive direction of beam's x axisinclination will be positive for counter clockwise directionput negative inclination if you want to take angle in clockwise directionAttributesload_x: component of net load value in positive direciton of beam's x-axisload_y: component of net load value in positive y-direciton(upward direction)UDLUDL(Uniformly Distributed Load) is type of load that is combinaiton of infinite points load over certain length acting transverse to beamArguments:start(float):Start position of UDLloadpm(float): Load Per meter of udlspan(float): Total length of udlinverted(bool) = True: UDL facing downwards on beamuseinverted=Falsefor upside udlAttributesnetload(float): total effective load of udlpos(float): position of effective load from - beam originUVLIt is that load whose magnitude varies along the loading length with a constant rate.
Uniformly varying load is further divided into two types:1. Triangular Load
2. Trapezoidal LoadArgumentsstart:float= Start position of uvl from beam's origin along x-axis of beam coordinate systemstartload:float=unit: kN/m= Starting load/m value of uvlspan:float= Total length of uvl objectendload:float= Ending load/m value of uvl objectinverted:bool= True: Default=TrueInverts the uvl objectAttributesend= End coordinate of uvl objecttload= Net load value of upper triangular part of trapezoidal or triangular loadrload= Net load value of lower rectangular part of trapezoidal load itselfnetload= Net load of whole uvl object itself.netload = tload + rloadnetpos= Net position(coordinates) where net load of uvl actsReactionReactions are given by supports. 3 types of supports are defined for now:hinge,rollerandfixedsupport.Argumentspos(float): position of reactiontype(str): any one of('roller','hinge','fixed')or('r','h','f')Representing support condition at that point.pos_sym(str): Symbolic variable to represent support location nameAttributesrx_val, ry_val, mom_val: variables to store numerical values for reaction loads and momentsrx_var, ry_var, mom_var: symbolic variables to store symbolic values for reactionsPointMomentPure moment that act at pointArgumentspos: location of that point moment from beam's originmom: value of that point momentccw(bool) = False: counterclockwise direciton is positive value of moment,by defalut:ccw = Falseand given moment is positiveHingeInternal hinges are provided in a structure to reduce statical indeterminacy of the structure.
Bending moment at internal hinge is always zero.
Internal hinge makes structure more flexible.
It allows structure to move which reduces the reactive stresses.Argumentspos:float= Position of that internal hinge from origin of beam coordinate systemside:str = 'l': Accepted Values =('r', 'right', 'l', 'left')Default Value ='l'This side specifies which side of loads to take in order to take moment of that loads about hinge.ExamplesExample-1: Solving Simplest BeamThe simplest possible code to solve simply supported beam with pointload at middle of span.#import module
from beamframe.beam import *

# create a beam of length 5m
b = Beam(5)

# create reaction and pointload objects
ra = Reaction(0, 'r', 'A')
rb = Reaction(b.length, 'h', 'B')
p = PointLoad(b.length/2, 10, inverted=True)

b.fast_solve((ra, rb, p))
b.generate_graph()Graph:Example-2: Cantilever beam with udlfrom beamframe.beam import *

# create a beam of length 5m
b = Beam(5)

# create reaction and udl object
ra = Reaction(0, 'f', 'A')
udl = UDL(0, 5, 5)

b.fast_solve((ra, udl))
b.generate_graph()Graph:Example-3: Overhanging beam with internal hinge, and 3 supportsNote: Inb.generate_graph: usedetails=Trueto show details like max and min bending moment, max and minimum shear force.save_fig=Trueto save figure of desired quality specified by quality inresfrom beamframe.beam import *

b = Beam(10)
ra = Reaction(0, 'h', 'A')
p1 = PointLoad(1,100, inverted=True, inclination=40)
m1 = PointMoment(2.5,20, ccw=False)
rd = Reaction(3.5, 'r', 'D')
h = Hinge(5, side='r')
udl = UDL(5,10,2)
rf = Reaction(7, 'r', 'F')
p2 = PointLoad(b.length, 50, inverted=True)

lds = (ra, p1, m1, rd, h, udl, rf, p2)
b.fast_solve(lds)
b.generate_graph(which='both', details=True, save_fig=True, show_graph=False, res='h')Graph: