Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming Shear and Moment Diagrams 1

Status
Not open for further replies.

bearjew

Structural
Apr 2, 2015
27
I wrote some software in Python that basically analyzes any beam that the user enters and determines support reactions/deflections. I accomplish this using stiffness matrices.

However now I want to be able to draw the shear, moment, and deflection diagrams for the same beam. I could probably brute force this by developing equations from my support reactions/applied loading and integrating as necessary but this seems cumbersome. Is there a way to make use of the work I have already done to accomplish this?

I want to think I learned about using shape functions with stiffness matrices that may be the way to go but I've since forgotten. Any tips?
 
Replies continue below

Recommended for you

Do you have loading applied along the length of the beam? My belief is that shape functions become problematic when you have anything more complex than full length distributed loads.

My tendency would be to go back to simple beam theory. The shear diagram should be really easy.... It can be derived from the reactions and whatever loading is applied along the length of the beam. Then the moment diagrams can be derived from the shear diagrams.
 
JoshPlum said:
Do you have loading applied along the length of the beam? My belief is that shape functions become problematic when you have anything more complex than full length distributed loads.

Potentially computationally expensive work around to this is to have a subroutine that creates internal nodes at the start and end of the loading so you end up with a full loaded element instead of partially loaded. Then again just use superposition to combine the various results.

you could in theory add a bunch of internal nodes and use your current routine to solve for the shears, moments, etc. to then graph the results, unless your looking for exact local max and mins.

Open Source Structural Applications:
 
Thanks for the replies everyone.
 
be careful with using the approximate integration methods there will be some inherent error.

check out issue #4 on my github and take a look at the integration_test file I have under analysis.

you get decent results for "real" world beams but there are instance where cumulative trapezoidal will give excessive error and in the case of point moments just break down entirely unless you build in a handler for inflection points. Simpson rule tightens up the error but at the expense of computation time.

Open Source Structural Applications:
 
If maximally leveraging your stiffness matrix algorithm is a high priority, Celt's idea of introducing a bunch of dummy reporting nodes is probably the way to go. I'm pretty sure that's how SAP & ETABS work actually.

As part of a programming endeavor from my academic days, I developed closed form solutions to solve your exact problem. Deflections for the partial span trapezoidal loads, in particular, were a lot of work. I did it using virtual work and the resulting equations are enormous. They work though. I tested them thoroughly and actually found an error in S-Frame as a result. I rolled the same equations into a MathCAD sheet that I used a lot in my designer days. It would apply the functions at sampling intervals to generate graphical shear, moment, and deflection diagrams.

I'm happy to share any or all of this with you if you're interested.

I like to debate structural engineering theory -- a lot. If I challenge you on something, know that I'm doing so because I respect your opinion enough to either change it or adopt it.
 
KootK said:
.. Deflections for the partial span trapezoidal loads, in particular, were a lot of work...

yeah your not kidding here is one of the 9 constants of integration for a partial trapezoidal load on just a simply supported 1 span beam, I was constantly making sign errors with my pencil and paper calculation to come up with these when I did them a few years ago.

Code:
c9 = ((-1 * rl * b ** 3) / 3) + ((b ** 5 * s) / 30) + ((b ** 4 * (w1 - (s * a))) / 8) + ((((s * a) - (2 * w1)) * a * b ** 3) / 6) - ((c2 * b ** 2) / 2) + c8 - ((rr * b ** 3) / 3) + ((c3 * b ** 2) / 2)

I've got most the pin-pin equations generalized already wrapped up right side cantilevers over the weekend and am just about done with left side cantilevers. Partial trapezoidal loads are the bane of my existence right now.

Open Source Structural Applications:
 
Since your using Python:

I like matplotlib for plotting it is slower but produces report level graphics - making effective use of the sub plotting can give you nice results, the fill feature is nice but can take awhile to process if you have a complicated plot, if you make a gui and embed a graph start out with dummy x and y data and simply update it (can do this if you don't have a gui as well if you want to change data on the fly and speed up the plotting).
example:
figure_1_uzppdd.jpg


code for the plot starts on line 48 of this file

If you want to write out a CAD dxf file of your beam with results on layers check out the beam patterning program I have for an example of the code and values needed, number of spaces on each line in the file matters. Method starts on line 2818 of that python file.

for patterning of loads check out itertools to generate lists of 1 and 0 - line 21 of that beam patterning program has the method I used

Sorry I hijacked the thread a little bit, you just happened to post on a topic that I am currently deeply invested and interested in.

Edubeam is an open source 2d fem frame program written in python, you may be able to look at there code to see how they handled the between node data.

Open Source Structural Applications:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor