Note
Go to the end to download the full example code
Single span beam under uniform load.
The system is statically determined and allows for easy validation of calculated deformation, reactions and internal forces.
Author: Peter Mackenzie-Helnwein
from femedu.examples.Example import *
from femedu.domain.System import *
from femedu.domain.Node import *
from femedu.elements.linear import Beam2D
from femedu.materials.ElasticSection import *
class ExampleBeam01(Example):
def problem(self):
# initialize a system model
SpanLength = 10.0 * 12
w = -1.0 # distributed load (positive if acting in local y-direction
P = -40.0 # center point load (uses global system)
Nelems = 4 # number of elements
params = {'E': 29000., 'A': 4.7, 'I':103}
model = System()
# meshing parameters
Le = SpanLength / Nelems
Xnode = 0.0
Ynode = 0.0
# create left node
nd0 = Node(Xnode, Ynode)
model += nd0
ndP = None
# initialization for node and element creation
ndi = nd0
for e in range(Nelems):
# create next node
Xnode += Le
ndj = Node(Xnode, Ynode)
model += ndj
# remember center node for loading
if Xnode <= SpanLength/2:
ndP = ndj
# create elements
elem = Beam2D(ndi, ndj, ElasticSection(params))
model += elem
# load the element
elem.setDistLoad(w)
# shift one node to the right
ndi = ndj
# define support(s)
nd0.fixDOF('ux', 'uy') # pin support left end
ndj.fixDOF('uy') # roller support right end
# add point loads
# .. load only the center node
if ndP:
ndP.setLoad([0.0, P], ('ux', 'uy'))
# analyze the model
model.solve()
# write out report
model.report()
# create plots
model.plot(factor=10., filename="beam01_deformed.png", show_bc=1, show_reactions=1)
model.beamValuePlot('V', filename="beam01_shear.png")
model.beamValuePlot('M', filename="beam01_moment.png")
Run the example by creating an instance of the problem and executing it by calling Example.run()
if __name__ == "__main__":
ex = ExampleBeam01()
ex.run()
System Analysis Report
=======================
Nodes:
---------------------
Node_12:
x: [0. 0.]
fix: ['ux', 'uy']
u: [ 0. -0.03615668]
Node_13:
x: [30. 0.]
u: [-0.97547707 -0.02561098]
Node_14:
x: [60. 0.]
P: [-40. 0.]
u: [-1.38600603e+00 -1.37017950e-17]
Node_15:
x: [90. 0.]
u: [-0.97547707 0.02561098]
Node_16:
x: [120. 0.]
fix: ['uy']
u: [0. 0.03615668]
Elements:
---------------------
Beam2D: Node_12 to Node_13:
material ElasticSection properties: {'E': 29000.0, 'A': 4.7, 'I': 103, 'nu': 0.0, 'fy': 1e+30} strain:{'axial': 0.0, 'flexure': 0.0} stress:{'axial': 0.0, 'flexure': 0.0}
nodal forces: Vi:65.0 Mi:-74.99999999999909 Vj:-65.0 Mj:2024.999999999989
Beam2D: Node_13 to Node_14:
material ElasticSection properties: {'E': 29000.0, 'A': 4.7, 'I': 103, 'nu': 0.0, 'fy': 1e+30} strain:{'axial': 0.0, 'flexure': 0.0} stress:{'axial': 0.0, 'flexure': 0.0}
nodal forces: Vi:34.999999999999886 Mi:-2024.9999999999864 Vj:-34.999999999999886 Mj:3074.999999999981
Beam2D: Node_14 to Node_15:
material ElasticSection properties: {'E': 29000.0, 'A': 4.7, 'I': 103, 'nu': 0.0, 'fy': 1e+30} strain:{'axial': 0.0, 'flexure': 0.0} stress:{'axial': 0.0, 'flexure': 0.0}
nodal forces: Vi:-34.999999999999716 Mi:-3074.99999999998 Vj:34.999999999999716 Mj:2024.9999999999936
Beam2D: Node_15 to Node_16:
material ElasticSection properties: {'E': 29000.0, 'A': 4.7, 'I': 103, 'nu': 0.0, 'fy': 1e+30} strain:{'axial': 0.0, 'flexure': 0.0} stress:{'axial': 0.0, 'flexure': 0.0}
nodal forces: Vi:-65.00000000000023 Mi:-2024.9999999999936 Vj:65.00000000000023 Mj:74.99999999999818
Total running time of the script: (0 minutes 0.310 seconds)