Skip to main content

Educational package for visualizing shear forces and bending moments on 1-D beams

Project description

BeamBending: a teaching aid for 1-D shear-force and bending-moment diagrams

Version License DOI Build Status Documentation Status Binder Colab

BeamBending is both an educational module and a Python package, intended to serve as a teaching aid during a first course in Statics. The aim of this module is to enhance clarity and provide visual hands-on examples while introducing the concepts of:

  • stresses on slender one-dimensional solids (i.e. beams)
  • normal force, shear force and bending moment diagrams

The package documentation includes a simplified (but still rigorous enough) explanation of the background theory, inspired in [@Beer2017] and [@Bell2015]. It is assumed that the students understand static equilibrium of flat rigid bodies, but a short recap is provided. Code snippets that reproduce the theory examples are presented next to each result.

The package can be used by

  • teachers who want to automatically create problem sets with their solutions (easily scriptable, random-problem-generator friendly);
  • students who want to verify their solutions to introductory problem sets;
  • students who like to play with example problems and receive immediate visual feedback about how simple modifications to imposed loads affect the resulting reaction forces and internal stresses.

The materials are distributed publicly and openly under a Creative Commons Attribution license, CC-BY 4.0

Cite as:

Carella, (2019). BeamBending: a teaching aid for 1-D shear force and bending moment diagrams. Journal of Open Source Education, 2(19), 65,

Statement of Need

Statics courses in undergraduate engineering programs are sometimes taught before the knowledge of the relevant mathematical tools (i.e. simple calculus and linear vector algebra) is fully mature. Introducing a topic that resembles the mindset of calculus and employs an unintuitive standard sign convention, on top of a wobbly mathematical foundation, makes it fairly common for students to get lost in the calculations.

This package/module aims to bridge this gap and simplify students' first contact with this challenging new topic by working on two fronts simultaneously:

  1. Explain the background theory from a simple example with focus on connecting the mathematical description with the physical beam model (beambending code snippets are interleaved in order to illustrate how the package works).
  2. Provide a temporary scaffolding that helps to establish an immediate visual association between beam load states and internal stresses.

Functionality and Usage

A typical use case of the beambending package always involves creating an instance of the Beam class. The class constructor takes an optional length argument, which defaults to 10 in case no argument is provided.

from beambending import Beam
beam = Beam(9)  # Initialize a Beam object of length 9m

After a Beam object is created, the properties corresponding to the x-coordinates of the pinned and rolling supports must be defined.

beam.pinned_support = 2    # x-coordinate of the pinned support
beam.rolling_support = 7  # x-coordinate of the rolling support

Note that the Beam class currently supports only statically determined beams with exactly one pinned and one roller support.

Each load applied to the beam requires an instance of one of the load classes DistributedLoadH, DistributedLoadV, PointLoadH, or PointLoadV. The load classes are simply namedtuples, and make the resulting scripts easier to read by making the user's intention explicit. The symbolic variable x, also defined by the module, is used for defining variable distributed loads.

from beambending import DistributedLoadV, PointLoadH, PointLoadV, x

The loads can be applied to the Beam by passing an iterable (list or tuple) to the method add_loads.

                PointLoadH(10, 3),  # 10kN pointing right, at x=3m
                PointLoadV(-20, 3),  # 20kN downwards, at x=3m
                DistributedLoadV(-10, (3, 9)),  # 10 kN/m, downward, for 3m <= x <= 9m
                DistributedLoadV(-20 + x**2, (0, 2)),  # variable load, for 0m <= x <= 2m

After the problem is fully defined (beam length + placement of supports + loads), the plot method can me invoked to plot a sketch of the loaded beam together with its corresponding load diagrams (normal force, shear force and bending moment).

fig = beam.plot()

The plot method is actually a wrapper that combines these four methods: plot_beam_diagram, plot_normal_force, plot_shear_force and plot_bending_moment into a single A4-sized printer-friendly plot.

The script above produces the following figure: Output corresponding to the example code above

You can read about this example in context in the documentation, or try it in a Jupyter notebook hosted online: Binder Colab

For more sophisticated applications, like automatic problem generation, you should read the package documentation.

Installing the package

If you want to install the beambending package, you run this one-liner:

pip install --user beambending

NOTE: You need Python 3 to install this package (you may need to write pip3 instead of pip).

The library dependencies are listed in the file requirements.txt, but you only need to look at them if you clone the repository. If you install the package via pip, the listed dependencies should be installed automatically.

How to contribute to BeamBending

The guidelines for contributing are specified here.

Copyright and License

(c) 2018 Alfredo R. Carella. All content is under Creative Commons Attribution CC-BY 4.0.

You are welcome to re-use this content in any way.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for beambending, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size beambending-1.1.1.tar.gz (13.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page