Python Code for Drawing BMD and SFD (Bending Moment and Shear Force) for a SSB with Point Load

 Hi,

Introducing Two Programs for Shear Force and Bending Moment Diagrams

In this article, I am excited to share with you two programs that I have developed for drawing Shear Force and Bending Moment Diagrams. One of these programs is available here for free!

The first program is a simple yet effective code that specifically solves problems with point loads and is designed for simply supported beams (SSB). It provides a convenient solution tailored to these specific scenarios.

On the other hand, the second program, which is not available for free, offers a broader range of capabilities. It can generate accurate Shear Force and Bending Moment Diagrams for various load types, including point loads, pure couples, uniformly distributed loads (UDLs), and uniformly varying loads (UVL).

Beyond the diagram generation, this program goes a step further by providing equations for the Shear Force and Bending Moment at different sections of the beam. To get a deeper understanding of the capabilities of the second program, I encourage you to watch the accompanying video.

If you find the features intriguing and applicable to your needs, the code is available for purchase through our online store.

Join me as we explore the world of Shear Force and Bending Moment Diagrams and unlock the potential of these powerful programs

Shop Now: Python Code for SFD and BMD of Statically Determinate Beams

Let’s list the advantages and disadvantages of each code version.

Free Version:

  1. Works with SSB only
  2. Only for point loads.
  3. SFD and BMD are not annotated.

Elite Version:

  1. Works with SSB, Cantilevers, Overhangs, and Beams with Internal Hinges.
  2. Works with Point Loads, Pure Couples, UDLs, UVLs, and a combination of these loads at the same time.
  3. SFD and BMDs are properly annotated, showing the maximum, minimum, and all nodal values of Shear force and bending moment on the beam.

Buy the Elite Version Now: Python Code for SFD and BMD of Statically Determinate Beams

To know more about the Elite Version, please check the YouTube video:

How does the Free Version of the Code work:

The following code is written in Python, utilizing the Numpy and Matplotlib libraries. It provides a solution for drawing the Bending Moment Diagram (BMD) and Shear Force Diagram (SFD) for a Simply Supported Beam (SSB) with a point load at any position along the beam.

When running the code, it will prompt you for the following inputs:

  • Load
  • Load unit
  • Length of the beam
  • Length unit
  • Location of the point load on the beam

The code generates the following output:

  • Reactions
  • Equations for Shear Force and Bending Moment at any position on the beam
  • Maximum Shear Force and Maximum Bending Moment
  • Location of the maximum Bending Moment
  • Plot of the SFD and BMD

This code provides a comprehensive solution for analyzing the structural behavior of a Simply Supported Beam subjected to point loads. By inputting the required parameters, you can obtain valuable information about the internal forces and moments in the beam.

Feel free to utilize this code to visualize and analyze the behavior of your beams.

python code:

import numpy as np
import matplotlib.pyplot as plt

P = float(input('load = '))
u1 = input('load unit = ')
L = float(input('Length of the beam = '))
u2 = input('length unit = ')
a = float(input('Distance of Point load from left end = '))

b = L - a
R1 = P*b/L
R2 = P - R1
R1 = round(R1, 3)
R2 = round(R2, 3)
print(f''' 
As per the static equilibrium, net moment sum at either end is zero, 
hence Reaction R1 = P*b/L = {R1} {u1},
Also Net sum of vertical forces is zero, 
hence R1+R2 = P, R2 = P - R1 = {R2} {u1}.
''')

l = np.linspace(0, L, 1000)
X = []
SF = []
M = []
maxBM= float()
for x in l:
    if x <= a:
        m = R1*x
        sf = R1
    elif x > a:
        m = R1*x - P*(x-a)
        sf = -R2
    M.append(m)
    X.append(x)
    SF.append(sf)

print(f'''
Shear Force at x (x<{a}), Vx = R1 ={R1} {u1}
             at x (x>{a}), SF = R1 - P = {R1} - {P} = -{R1-P} {u1}

Bending Moment at x (x<{a}), Mx = R1*x = {R1}*x
               at x (x>={a}), Mx = R1*x - P*(x-{a}) 
                                = {R1}x - {P}(x-{a}) = -{R2}x + {P*a}
''')
max_SF = 0
for k in SF:
    if max_SF < k:
        max_SF = k


print(f'Maximum Shear Force Vmax = {max_SF} {u1}')


for k in M:
    if maxBM < k:
        maxBM = k
print(f'maximum BM, Mmax = {round(maxBM, 3)} {u1}{u2}')
Mx = float()

for x in l:
   if x<a:
       Mx = R1*x
       if maxBM == Mx:
          print(f'maximum BM at x = {round(x,3)} {u2}')
   elif x>=a:
        Mx = R1*x - P*(x- a)
        if maxBM == Mx:
          print(f'maximum BM at x = {round(x,3)} {u2}')


plt.plot(X, SF)
plt.plot([0, L], [0, 0])
plt.plot([0, 0], [0, R1], [L, L], [0, -R2])
plt.title("SFD")
plt.xlabel("Length in m")
plt.ylabel("Shear Force")
plt.show()


plt.plot(X, M)
plt.plot([0, L], [0, 0])
plt.title("BMD")
plt.xlabel("Length in m")
plt.ylabel("Bending Moment")
plt.show()

This code has limitations in that it works with only the kind of loads and beams specified above.

The elite version of this code, which is paid, can handle any kind of load, and any kind of support. Using this elite version one can get shear and bending moment equations for any kind of load (concentrated, UDLs, and UVLs.)

Buy the Elite Version Now: Python Code for SFD and BMD of Statically Determinate Beams

Thanks!

6 thoughts on “Python Code for Drawing BMD and SFD (Bending Moment and Shear Force) for a SSB with Point Load”

Leave a Comment

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com