npm install beam-calculator
import Beam from 'Beam'
// Create a new beam
let b = new Beam()
// Set units 'SI' or 'US'
b.units = 'SI'
// Set length of beam
b.length = 20 // SI = meters, US = inch
// Set a constant second moment of area
b.moment = 100 // SI = meter^4, US = inch^4
// (Not yet supported)
// Alternatively, set a variable second moment of
// area (tapered beam) by assigning a function to
// moment. The function accepts a value which is the
// distance from the left end of the beam, and
// returns the second moment of area at that point.
b.moment = someFunction // (Not yet supported: will throw an error)
// Set the beam's Young's modulus
b.modulus = 40 // SI = Pa, US = psi
// or, set the material to use the built-in Young's modulus value
b.material = 'Al6061'
// Use this to list the available materials
Beam.listMaterials()
// Set the types of supports: simple (pin), fixed, or free
b.anchorLeft = 'fixed'
b.anchorRight = 'free'
// Add point loads
b.addPointLoad({ x: 4, w: 1000 }) // x = distance from left end of beam, w = force (SI = N, US = lbf)
// or
b.pointLoads.push({ x: 4, w: 1000 })
// In addition to point loads, you can also
// add a continuous load using a function.
// The function accepts a value which is the
// distance from the left end of the beam, and
// returns the force per unit length at that
// point.
b.contLoad = Function
// Get results
b.getShearForce(10) // SI = N, US = lbf
b.getBendingMoment(10) // SI = N m, US = lbf in
b.getSlope(10) // SI = m/m, US = in/in
b.getDeflection(10) // SI = m, US = in
When a point load is added to a Beam
, it is frozen and cannot be mutated. If you need to change a point load, first remove it using removePointLoad
, and then add a new point load.
For a beam of constant rigidity
Beam Calculator solves for the deflection of a beam through direct integration. This is done in four subsequent integrations, which solve for the shear force (
Each step introduces an unknown constant of integration. These unknowns are solved for based on the constraints applied to the beam, such as the presence of pinned or fixed anchors. Other unknowns, such as reaction forces from anchors, are solved for in the same way.
Traditionally, different approaches are taken to solve a beam deflection problem depending on the particular anchors present. However, in order to simplify the implementation, we have considered all beams to be free-floating with the same set of boundary conditions. This establishes a base set of equations and unknowns with zero degrees of freedom. Then, each anchor adds either one or two additional equations and unknowns in a predictable way. This allows us to use one implementation to solve any configuration of anchors.
The base set of equations is obtained by considering an unsupported beam. At each end of the beam, the shear force and moment are both zero, since there are no applied moments or forces. For this trivial problem, we have 4 unknowns (the 4 constants of integration) and 4 equations:
c1, c2, c3, c4
______________________
V(0) = 0 V(L) = 0
M(0) = 0 M(L) = 0
Now say we add a pinned joint
c1, c2, c3, c4, p1
_______________________
^
y(x1) = 0
V(0) = 0 V(L) = 0
M(0) = 0 M(L) = 0
If we add a second pin joint, the degrees of freedom remain unchanged:
c1, c2, c3, c4, p1, p2
_______________________
^ ^
y(x1) = 0 y(x2) = 0
V(0) = 0 V(L) = 0
M(0) = 0 M(L) = 0
If we add a fixed joint to the left end of the beam, we add two additional unknowns and equations. The unknowns are
c1, c2, c3, c4, p1, p2, p0, m0
/|_______________________
/| ^ ^
y(x1) = 0 y(x2) = 0
y(0) = 0
th(0) = 0
V(0) = 0 V(L) = 0
M(0) = 0 M(L) = 0
Likewise, if we add a fixed joint to the right side:
c1, c2, c3, c4, p1, p2, p0, m0, pL, mL
/|_______________________|/
/| ^ ^ |/
y(x1) = 0 y(x2) = 0
y(0) = 0 y(L) = 0
th(0) = 0 th(L) = 0
V(0) = 0 V(L) = 0
M(0) = 0 M(L) = 0
Any number of joints can be added in this way, and the degrees of freedom remain unchanged. In practice, only fixed joints on the ends of beams are allowed, because a fixed joint in the middle of a beam would divide it into two independent beams, each having a fixed joint on one end.
Adding a pinned joint to the end of the beam does not alter our original
Likewise, adding a fixed joint to the end of the beam does not alter the original
Because the constants of integration and anchor forces and moments are unknown, we have to carry them symbolically through the integration. In practice, we begin by first numerically integrating only the known loads on the beam, and add the unknown forces after the integration. We will use an overbar to show that we have ignored the unknown constants of integration and anchor loads and moments:
To perform the numerical integration and calculation of
Whenever possible, we would like the numerical integration to be as accurate as possible. It turns out that if the applied load to the beam,
Problem: We want to know ybar(x) at these grid points:
x---------------x
Step 1: Divide the grid further and evaluate w(x) at these points:
x---x---x---x---x
Step 2: Use the trapezoid rule to evaluate Vbar(x). If w(x) is constant (zero-order), Vbar(x) will be linear (first order) and this calculation will be exact.
Vbar(x) is now known at the following grid points:
x---x---x---x---x
Step 3: Use the trapezoid rule to evaluate mbar(x). If Vbar(x) is first order, mbar(x) will be second order, and this will be an exact calculation.
mbar(x) is now known at the following grid points:
Step 4: Use Simpson's rule to evaluate thetabar(x). This is required in order to give an exact result, which will be a third order function. The number of grid points is halved.
thetabar(x) is now known at the following grid points:
x-------x-------x
Step 5: Use Simpson's rule to evaluate ybar(x). This results in an exact fourth order function. The number of grid points is halved again.
ybar(x) is now known exactly at the following grid points:
x---------------x
In the last two integrations, the number of grid points at which an exact integral can be calculated is halved as a result of using Simpson's rule. Using Simpson's rule is required because we are integrating a higher-order function. The trapezoid rule is sufficient for the first two integrations because it can still produce exact numerical integrals of zero- and first-order functions. This also means that the applied load on the beam must be evaluated at more grid points than will be present in the final result for ybar.
We won't know a priori if the applied load is a constant or not--the user simply provides a function. We think the method of integration above will provide sufficient accuracy for non-uniform loads, and has the benefit of providing exact answers for uniform loads.
The numerical integration to find
The shear force at
The moment
At this point, we recognize that the constants
Now the slope
We've taken a bit of a leap here moving from five to three piecewise portions, which one can confirm by working out the various pieces, or simply come to accept by recognizing that
Finally, the deflection
We have now worked out the expression for the fully generalized beam. Adding additional pinned joints just increases the number of piecewise portions.
At the present time, the implementation requires the beam to have constant rigidity
The final step is to solve for the remaining unknown variables
|
_____V______
^ ^
p1 p2
Unknowns (4): C3, C4, p1, p2
Equations (4): V(L) = 0, M(L) = 0, y(0) = 0, y(L) = 0
DOF: 0
Fixed-free beam
|
//|_____V______
//|
p1, m1
Unknowns (4): C3, C4, p1, m1
Equations (4): th(0) = 0, y(0) = 0, V(L) = 0, M(L) = 0
DOF: 0
Fixed-pin beam
|
//|_____V______
//| ^
p1, m1 p2
Unknowns (5): C3, C4, p1, m1, p2
Equations (5): th(0) = 0, y(0) = 0, V(L) = 0, M(L) = 0, y(L) = 0
DOF: 0
Fixed-fixed beam
|
//|_____V______|//
//| |//
p1, m1 p2, m2
Unknowns (6): C3, C4, p1, m1, p2, m2
Equations (6): th(0) = 0, y(0) = 0, V(L) = 0, M(L) = 0, th(L) = 0, y(L) = 0
DOF: 0
Three pins in middle of beam
___________
^ ^ ^
p1 p2 p3
Unknowns (5): C3, C4, p1, p2, p3
Equations (5): V(L) = 0, M(L) = 0, y(x1) = 0, y(x2) = 0, y(x3) = 0
DOF: 0
Unsupported beam
___________
Unknowns (2): C3, C4
Equations (2): V(L) = 0, M(L) = 0
DOF: 0
Will result in singular matrix when solving
Beam with single pin
___________
^
p1
Unknowns (3): C3, C4, p1
Equations (3): V(L) = 0, M(L) = 0, y(1) = 0
DOF: 0
Will result in singular matrix when solving
Unbalanced beam
|
________V__
^ ^
p1 p2
Unknowns (4): C3, C4, p1, p2
Equations (4): V(L) = 0, M(L) = 0, y(1) = 0, y(2) = 0
DOF: 0
Will solve just fine with one of the pins having a negative load (but it's a pin, not a roller, so it's okay)