engineeringkit.structural_engineering#

Hooke’s law, Poisson’s ratio, Coulomb’s torsion and Bredt’s thin-walled tubes for axial and twisted members; rectangular section properties, elastic and plastic, and I, T, channel, angle, box and transformed sections built from rectangles; Navier’s bending stress, unsymmetrical bending, Jourawski’s shear stress and the shear centre; the simply supported beam, Macaulay’s beam on any supports and superposition, Clapeyron’s three-moment equation and influence lines; Euler’s buckling load, Engesser’s tangent-modulus load, the secant formula and Johnson’s parabola (scipy.optimize.brentq); plane stress transformation, Mohr’s circle, three-dimensional principal stresses and strain rosettes; thin- and thick-walled pressure vessels; Castigliano’s theorem and the unit-load method (scipy.integrate.simpson) and Maxwell-Betti reciprocity; Maxwell’s count, the method of joints and the direct stiffness truss with conditioning diagnostics; plastic collapse loads; slope-deflection, Hardy Cross’s moment distribution and the plane-frame stiffness method; parabolic and catenary cables and the three-hinged arch.

engineeringkit.structural_engineering: members, sections, beams, columns, stress, vessels, trusses, frames, cables and arches.

Hooke’s law and Poisson’s ratio for axial members, Coulomb’s torsion and Bredt’s thin-walled tubes; section properties of rectangles and of I, T, channel, angle, box and transformed sections; Navier’s bending theory, unsymmetrical bending, Jourawski’s shear stress and the shear centre; Macaulay’s beams on any supports and superposition, Clapeyron’s three-moment equation and Winkler’s influence lines; Euler’s and Engesser’s column loads, the secant formula and Johnson’s parabola; Mohr’s circle, three-dimensional principal stresses and strain rosettes; thin and thick-walled pressure vessels; Castigliano’s theorem, the unit-load method and Maxwell-Betti reciprocity; Maxwell’s count, Whipple’s method of joints and the direct stiffness method for trusses; plastic collapse loads; Maney’s slope-deflection, Hardy Cross’s moment distribution and plane frames; cables and three-hinged arches. Models are hand-written; NumPy’s linear algebra and SciPy’s Simpson rule and Brent root finder are used where they are the standard tool.

class engineeringkit.structural_engineering.ArchResult(x, y, moment, axial_force, reactions, thrust)[source]#

Bases: object

Shape, bending moment and axial force of a three-hinged arch.

Loads act downward when positive and sagging moment (intrados in tension) is positive.

Parameters:
  • x (ndarray)

  • y (ndarray)

  • moment (ndarray)

  • axial_force (ndarray)

  • reactions (tuple)

  • thrust (float)

axial_force: ndarray#

Axial force along the arch axis [N], tension positive.

Type:

ndarray

moment: ndarray#

Bending moment at each station [N m], sagging positive.

Type:

ndarray

plot()[source]#

Draw the arch with its three hinges above its bending-moment diagram; return (fig, axes).

reactions: tuple#

Left and right vertical reactions [N], upward positive.

Type:

tuple of float

summary()[source]#

Thrust [N], vertical reactions [N], largest moment [N m] and largest compression [N].

Return type:

dict

thrust: float#

Horizontal thrust on each springing [N], pushing the supports outward.

Type:

float

x: ndarray#

Stations along the span [m].

Type:

ndarray

y: ndarray#

Height of the arch axis above the springings [m].

Type:

ndarray

class engineeringkit.structural_engineering.Beam(length, young_modulus, second_moment, supports)[source]#

Bases: object

Prismatic Euler-Bernoulli beam on any supports, solved by Macaulay’s method.

The bending moment is written once for the whole beam with singularity functions \(\langle x - a\rangle^n\), which are zero to the left of \(a\):

\[M(x) = \sum R_k\langle x - a_k\rangle - \sum P\langle x - a\rangle + \sum C\langle x - a\rangle^0 - \tfrac{w}{2}\langle x - a\rangle^2 + \cdots\]

and integrated twice, \(EIy = \iint M\,dx\,dx + C_1x + C_2\). The unknown reactions and the two constants follow from vertical and moment equilibrium and the support conditions (\(y = 0\) at every support, \(y' = 0\) at a fixed one), so statically indeterminate beams are solved the same way as determinate ones.

Parameters:
  • length (float) – Length [m], positive; the beam runs from \(x = 0\) to length.

  • young_modulus (float) – Young’s modulus [Pa], positive.

  • second_moment (float) – Second moment of area [m^4], positive.

  • supports (tuple) – (position [m], kind) for each support, with kind one of "pin", "roller" (both restrain deflection only) or "fixed" (restrains deflection and slope).

References

W. H. Macaulay, “Note on the deflection of beams,” Messenger of Mathematics 48 (1919) 129-130; A. Clebsch, Theorie der Elasticität fester Körper (Leipzig: Teubner, 1862).

length: float#
second_moment: float#
solve(point_loads=(), moments=(), distributed_loads=(), n=401)[source]#

Reactions, shear, moment, slope and deflection under any combination of loads.

Parameters:
  • point_loads (sequence of (float, float), optional) – (position [m], P [N]), downward positive.

  • moments (sequence of (float, float), optional) – (position [m], C [N m]) applied couples, clockwise positive.

  • distributed_loads (sequence of tuple, optional) – (start [m], end [m], w_start [N/m]) for a uniform load or (start, end, w_start, w_end) for a linearly varying one, downward positive.

  • n (int) – Number of equally spaced stations, at least 2.

Returns:

With one reaction per support, the reaction moments of the fixed supports and the slope. Shear at a point load or support takes the value just to its right, except at x = length, where it takes the value just to its left.

Return type:

BeamResult

Raises:

ValueError – If the supports leave the beam free to move as a mechanism.

supports: tuple#
young_modulus: float#
class engineeringkit.structural_engineering.BeamResult(x, shear, moment, deflection, reactions, support_moments=(), slope=None)[source]#

Bases: object

Shear, moment and deflection along a beam.

Positive loads act downward, reactions upward, sagging moment is positive and downward deflection is negative.

Parameters:
  • x (ndarray)

  • shear (ndarray)

  • moment (ndarray)

  • deflection (ndarray)

  • reactions (tuple)

  • support_moments (tuple)

  • slope (ndarray | None)

deflection: ndarray#

Transverse deflection at each station [m], downward negative.

Type:

ndarray

moment: ndarray#

Bending moment at each station [N m], sagging positive.

Type:

ndarray

plot()[source]#

Draw the shear, moment and deflection diagrams; return (fig, axes).

reactions: tuple#

Support reactions [N], upward positive, left to right (left and right for SimplySupportedBeam).

Type:

tuple of float

shear: ndarray#

Shear force at each station [N].

Type:

ndarray

slope: ndarray | None = None#

Slope \(dy/dx\) at each station [-], counterclockwise positive; None when the solver does not return it.

Type:

ndarray or None

summary()[source]#

Largest absolute shear [N], moment [N m] and deflection [m], and the reactions [N].

Return type:

dict

support_moments: tuple = ()#

Reaction moments of the fixed supports [N m], clockwise positive, left to right; empty when no support is fixed.

Type:

tuple of float

x: ndarray#

Stations along the span [m].

Type:

ndarray

class engineeringkit.structural_engineering.FrameResult(nodes, members, displacements, reactions, member_end_forces, condition_number)[source]#

Bases: object

Displacements and member end forces of a rigid-jointed plane frame.

Degrees of freedom are ordered u0, v0, theta0, u1, v1, theta1, ..., with rotations and moments counterclockwise positive.

Parameters:
  • nodes (ndarray)

  • members (tuple)

  • displacements (ndarray)

  • reactions (ndarray)

  • member_end_forces (ndarray)

  • condition_number (float)

axial_forces()[source]#

Axial force in each member [N], tension positive.

Return type:

ndarray

condition_number: float#

2-norm condition number of the reduced stiffness matrix K_ff.

Type:

float

displacements: ndarray#

Nodal displacements [m] and rotations [rad], three per node.

Type:

ndarray

member_end_forces: ndarray#

[N_i, V_i, M_i, N_j, V_j, M_j] exerted on each member by its joints, in member axes [N, N m].

Type:

ndarray, shape (m, 6)

members: tuple#

Member connectivity.

Type:

tuple of (int, int)

nodes: ndarray#

Node coordinates [m].

Type:

ndarray, shape (n, 2)

plot(scale=1.0, ax=None)[source]#

Draw the undeformed (dashed) and deformed frame; return (fig, ax).

Members are drawn as cubic Hermite curves through their end displacements and rotations, so the bending shape is visible.

Parameters:
  • scale (float, optional) – Factor applied to the displacements so they are visible [-].

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

Returns:

(fig, ax).

Return type:

tuple

reactions: ndarray#

Support forces [N] and moments [N m], three per node (zero at free degrees of freedom).

Type:

ndarray

summary()[source]#

Largest translation [m], rotation [rad], end moment [N m] and axial force [N], and cond(K_ff).

Return type:

dict

class engineeringkit.structural_engineering.JointMethodResult(member_forces, reactions, order)[source]#

Bases: object

Output of engineeringkit.structural_engineering.method_of_joints().

Parameters:
  • member_forces (ndarray)

  • reactions (ndarray)

  • order (tuple[int, ...])

member_forces: ndarray#

Axial force in each member [N], tension positive.

Type:

ndarray

order: tuple[int, ...]#

Joints in the order their equilibrium equations were used.

Type:

tuple of int

reactions: ndarray#

Support forces [N], two per node (zero at free degrees of freedom).

Type:

ndarray

summary()[source]#

Largest absolute member force [N], numbers of members in tension and compression, and the joint order.

Return type:

dict

class engineeringkit.structural_engineering.MomentDistributionResult(end_moments, iterations, unbalance)[source]#

Bases: object

Output of engineeringkit.structural_engineering.moment_distribution().

End moments follow Hardy Cross’s convention: a moment acting on the end of a member is positive clockwise. For a horizontal member drawn from joint i on the left to joint j on the right, the sagging-positive bending moment is end_moments[k, 0] at i and -end_moments[k, 1] at j.

Parameters:
  • end_moments (ndarray)

  • iterations (int)

  • unbalance (ndarray)

end_moments: ndarray#

Moments at the i and j ends of each member [N m], clockwise positive.

Type:

ndarray, shape (m, 2)

iterations: int#

Number of balance-and-carry-over cycles performed.

Type:

int

plot(ax=None)[source]#

Plot the unbalanced moment against cycle number on a log scale; return (fig, ax).

summary()[source]#

Number of cycles, largest end moment [N m] and remaining unbalance [N m].

Return type:

dict

unbalance: ndarray#

Largest unbalanced joint moment [N m] before each cycle, and after the last one.

Type:

ndarray

class engineeringkit.structural_engineering.PlanarFrame(nodes, members, young_modulus, area, second_moment)[source]#

Bases: object

Rigid-jointed plane frame solved by the direct stiffness method.

Members are Euler-Bernoulli beam-columns with axial and bending stiffness, joined rigidly at the nodes.

Parameters:
  • nodes (ndarray) – Node coordinates [m].

  • members (tuple) – Zero-based node indices of each member; the member’s local x axis runs from the first node to the second.

  • young_modulus (float) – Young’s modulus [Pa], positive.

  • area (float | ndarray) – Cross-sectional area [m^2], one value or one per member, positive.

  • second_moment (float | ndarray) – Second moment of area [m^4], one value or one per member, positive.

area: float | ndarray#
members: tuple#
nodes: ndarray#
second_moment: float | ndarray#
solve(loads, fixed_dofs, member_loads=None, cond_limit=1000000000000.0)[source]#

Solve for displacements, reactions and member end forces.

Parameters:
  • loads (array_like) – Nodal loads (Fx [N], Fy [N], Mz [N m]) per node, 3n values or shape (n, 3); moments counterclockwise positive.

  • fixed_dofs (array_like of int) – Restrained degrees of freedom, 3 * node + (0, 1, 2) for (u, v, theta).

  • member_loads (float or array_like, optional) – Uniform transverse load on each member [N/m], acting along the member’s local -y axis (downward on a member drawn left to right). Converted to equivalent nodal loads \((wL/2, wL^2/12)\).

  • cond_limit (float, optional) – A RuntimeWarning is issued if \(\operatorname{cond}(K_{ff})\) exceeds this value.

Return type:

FrameResult

Raises:

ValueError – If \(K_{ff}\) is singular (a mechanism, or a frame not restrained against rigid-body motion).

References

R. K. Livesley, “The application of an electronic digital computer to some problems of structural analysis,” Struct. Eng. 34 (1956) 1-12.

young_modulus: float#
class engineeringkit.structural_engineering.PlanarTruss(nodes, members, young_modulus, area)[source]#

Bases: object

Pin-jointed plane truss solved by the direct stiffness method.

Parameters:
  • nodes (ndarray) – Joint coordinates [m].

  • members (tuple) – Zero-based joint indices of each member.

  • young_modulus (float) – Young’s modulus of every member [Pa], positive.

  • area (float) – Cross-sectional area of every member [m^2], positive.

area: float#
members: tuple#
nodes: ndarray#
solve(loads, fixed_dofs, cond_limit=1000000000000.0)[source]#

Solve for displacements, reactions and member forces.

Each member contributes \((EA/L)[\mathbf{nn}^T, -\mathbf{nn}^T; -\mathbf{nn}^T, \mathbf{nn}^T]\) to the global stiffness matrix \(K\); the free displacements solve \(K_{ff}u_f = F_f\).

Parameters:
  • loads (array_like) – Joint loads [N], 2n values or shape (n, 2).

  • fixed_dofs (array_like of int) – Restrained degrees of freedom (zero displacement).

  • cond_limit (float, optional) – A RuntimeWarning is issued if \(\operatorname{cond}(K_{ff})\) exceeds this value, a sign that the truss is close to a mechanism.

Returns:

Includes condition_number, \(\operatorname{cond}(K_{ff})\).

Return type:

TrussResult

Raises:

ValueError – If Maxwell’s count is negative, or \(K_{ff}\) is singular (a mechanism, or a truss not restrained against rigid-body motion).

References

M. J. Turner, R. W. Clough, H. C. Martin and L. J. Topp, “Stiffness and deflection analysis of complex structures,” J. Aeronaut. Sci. 23 (1956) 805-823.

young_modulus: float#
class engineeringkit.structural_engineering.SectionProperties(area, y_centroid, z_centroid, Iz, Iy, Iyz, rectangles)[source]#

Bases: object

Area, centroid and second moments of a cross-section built from rectangles.

The section lies in the \(y\)-\(z\) plane with \(z\) horizontal and \(y\) vertical (upward), as in Hibbeler and Gere: \(I_z\) is the second moment about the horizontal centroidal axis (the strong axis of an I-beam), \(I_y\) about the vertical one, and \(I_{yz} = \int yz\,dA\). Each rectangle carries a weight: 1 for solid material, -1 for a hole and the modular ratio \(n = E/E_\mathrm{ref}\) for a transformed section, in which case every property is that of the transformed section in the reference material.

Parameters:
  • area (float)

  • y_centroid (float)

  • z_centroid (float)

  • Iz (float)

  • Iy (float)

  • Iyz (float)

  • rectangles (tuple)

Iy: float#

Second moment about the vertical centroidal axis [m^4].

Type:

float

Iyz: float#

Product of inertia about the centroidal axes [m^4].

Type:

float

Iz: float#

Second moment about the horizontal centroidal axis [m^4].

Type:

float

area: float#

(Transformed) area [m^2].

Type:

float

first_moment(y)[source]#

First moment \(Q\) of the part above height y about the centroidal \(z\) axis.

Parameters:

y (float) – Height of the cut [m], in the coordinates of the rectangles.

Returns:

\(Q = \int_{A'} (y - \bar y)\,dA\) [m^3], weighted like the area; the part below the cut has the opposite value.

Return type:

float

plot(ax=None)[source]#

Draw the parts (holes white, transformed parts orange) and the centroid; return (fig, ax).

Parameters:

ax (matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

Returns:

(fig, ax).

Return type:

tuple

principal_moments()[source]#

Principal second moments and the direction of the major axis.

Returns:

(I_max [m^4], I_min [m^4], angle [rad]); the major principal axis is the \(z\) axis turned counterclockwise by angle, with \(\tan 2\theta = -2I_{yz}/(I_z - I_y)\).

Return type:

tuple[float, float, float]

rectangles: tuple#

The parts as (b, h, z, y, weight) [m, m, m, m, -], with (z, y) each part’s centre.

Type:

tuple

summary()[source]#

Area [m^2], centroid [m] and centroidal second moments [m^4].

Return type:

dict

width_at(y)[source]#

Width of material cut by the horizontal line at height y.

Holes subtract their width and modular ratios are ignored, so this is the true thickness \(t\) in Jourawski’s formula.

Parameters:

y (float) – Height of the cut [m].

Returns:

Width [m].

Return type:

float

y_centroid: float#

Vertical position of the centroid [m].

Type:

float

z_centroid: float#

Horizontal position of the centroid [m].

Type:

float

class engineeringkit.structural_engineering.SimplySupportedBeam(length, young_modulus, second_moment)[source]#

Bases: object

Prismatic Euler-Bernoulli beam on a pin and a roller.

Parameters:
  • length (float) – Span [m], positive.

  • young_modulus (float) – Young’s modulus [Pa], positive.

  • second_moment (float) – Second moment of area [m^4], positive.

length: float#
second_moment: float#
solve_point_load(load, position=None, n=401)[source]#

Shear, moment and exact deflection under one point load.

Parameters:
  • load (float) – Point load [N], downward positive.

  • position (float | None) – Distance of the load from the left support [m]; midspan by default.

  • n (int) – Number of stations, at least 2.

Return type:

BeamResult

solve_uniform_load(w, n=401)[source]#

Shear, moment and exact deflection under a uniform load.

Parameters:
  • w (float) – Load intensity [N/m], downward positive.

  • n (int) – Number of stations, at least 2.

Return type:

BeamResult

young_modulus: float#
class engineeringkit.structural_engineering.SlopeDeflectionResult(end_moments, rotations)[source]#

Bases: object

Output of engineeringkit.structural_engineering.slope_deflection().

Moments and rotations are clockwise positive, as in Maney’s method and Hardy Cross’s moment distribution, so end_moments compare directly with MomentDistributionResult.

Parameters:
  • end_moments (ndarray)

  • rotations (ndarray)

end_moments: ndarray#

Moments at the i and j ends of each member [N m], clockwise positive.

Type:

ndarray, shape (m, 2)

rotations: ndarray#

Rotation of each joint [rad], clockwise positive (zero at fixed joints).

Type:

ndarray

summary()[source]#

Largest end moment [N m] and joint rotation [rad].

Return type:

dict

class engineeringkit.structural_engineering.TrussResult(displacements, reactions, member_forces, member_stresses, condition_number=nan)[source]#

Bases: object

Displacements and member forces of a pin-jointed plane truss.

Degrees of freedom are ordered x0, y0, x1, y1, ....

Parameters:
  • displacements (ndarray)

  • reactions (ndarray)

  • member_forces (ndarray)

  • member_stresses (ndarray)

  • condition_number (float)

condition_number: float = nan#

2-norm condition number of the reduced stiffness matrix K_ff.

Type:

float

displacements: ndarray#

Nodal displacements [m], two per node.

Type:

ndarray

member_forces: ndarray#

Axial force in each member [N], tension positive.

Type:

ndarray

member_stresses: ndarray#

Axial stress in each member [Pa], tension positive.

Type:

ndarray

plot(nodes, members, scale=1.0)[source]#

Draw the undeformed (dashed) and deformed truss; return (fig, ax).

Parameters:
  • nodes (array_like, shape (n, 2)) – Node coordinates [m] used to solve the truss.

  • members (sequence of (int, int)) – Member connectivity used to solve the truss.

  • scale (float, optional) – Displacement magnification [-].

reactions: ndarray#

Support forces [N], two per node (zero at free degrees of freedom).

Type:

ndarray

summary()[source]#

Largest absolute displacement [m] and member force [N], and cond(K_ff).

Return type:

dict

engineeringkit.structural_engineering.angle_section(leg_height, leg_width, thickness)[source]#

Properties of an angle (L) section, the simplest section with \(I_{yz} \ne 0\).

Parameters:
  • leg_height (float) – Overall height of the vertical leg [m], more than thickness.

  • leg_width (float) – Overall width of the horizontal leg [m], more than thickness.

  • thickness (float) – Leg thickness [m], positive.

Returns:

Heel (outer corner) at the origin, legs along \(+y\) and \(+z\).

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.axial_deformation(force, length, area, E)[source]#

Elongation of a uniform elastic bar, \(\delta = PL/(AE)\).

Parameters:
  • force (float or array_like) – Axial force [N], tension positive.

  • length (float or array_like) – Bar length [m], positive.

  • area (float or array_like) – Cross-sectional area [m^2], positive.

  • E (float or array_like) – Young’s modulus [Pa], positive.

Returns:

Elongation [m] (negative when shortened).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.bending_stress(M, y, I)[source]#

Flexure formula, \(\sigma = My/I\).

Parameters:
  • M (float or array_like) – Bending moment [N m], sagging positive.

  • y (float or array_like) – Distance from the neutral axis [m]. With a sagging-positive M, measure y downward so that tension comes out positive; pass the extreme-fibre distance c for the peak stress.

  • I (float or array_like) – Second moment of area about the neutral axis [m^4], positive.

Returns:

Normal stress [Pa].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

C.-L. Navier, Résumé des leçons données à l’École des ponts et chaussées sur l’application de la mécanique à l’établissement des constructions et des machines (Paris, 1826).

engineeringkit.structural_engineering.box_section(depth, width, thickness)[source]#

Properties of a rectangular hollow (box) section of uniform wall thickness.

Parameters:
  • depth (float) – Overall depth [m], more than twice thickness.

  • width (float) – Overall width [m], more than twice thickness.

  • thickness (float) – Wall thickness [m], positive.

Returns:

Bottom at \(y = 0\), centred on \(z = 0\).

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Corner radii are ignored.

engineeringkit.structural_engineering.castigliano_deflection(dU_dP=None, *, x=None, moment=None, dmoment_dP=None, E=None, I=None)[source]#

Deflection by Castigliano’s second theorem.

Called with a single number, it returns that strain-energy derivative \(\partial U/\partial P\) unchanged (the original interface). Called with the keyword arguments, it integrates

\[\delta = \int \frac{M(x)}{E I(x)}\,\frac{\partial M}{\partial P}(x)\,dx\]

along a beam with Simpson’s rule, where \(M\) is the bending moment under the actual loads and \(\partial M/\partial P\) the moment produced by a unit load at the point and in the direction of the wanted deflection (a dummy load if no real load acts there).

Parameters:
  • dU_dP (float, optional) – Strain-energy derivative [m], returned unchanged.

  • x (array_like, optional) – Stations along the beam [m], strictly increasing. An odd number of equally spaced stations, with a station at every load point, integrates piecewise-cubic integrands exactly.

  • moment (array_like, optional) – Bending moment at each station [N m].

  • dmoment_dP (array_like, optional) – Derivative of the moment with respect to the load [m] (N m/N).

  • E (float or array_like, optional) – Young’s modulus [Pa], positive.

  • I (float or array_like, optional) – Second moment of area [m^4], positive; may vary along the beam.

Returns:

Deflection [m] in the direction of the load P.

Return type:

float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Only bending energy is included; axial and shear energy are negligible for slender beams.

References

A. Castigliano, Théorie de l’équilibre des systèmes élastiques et ses applications (Turin: Negro, 1879).

engineeringkit.structural_engineering.catenary_cable(w, span, sag)[source]#

Tension and length of a cable hanging under its own weight, the catenary.

The cable is \(y = a(\cosh(x/a) - 1)\) from its lowest point, with \(a = H/w\). The sag fixes \(a\) through \(f = a(\cosh(L/2a) - 1)\), solved by Brent’s method; then

\[T_\max = H + wf,\qquad s = 2a\sinh\frac{L}{2a}.\]
Parameters:
  • w (float) – Weight per unit length of cable [N/m], positive.

  • span (float) – Horizontal distance between the supports, at the same level [m], positive.

  • sag (float) – Midspan sag [m], positive.

Returns:

(H, T_max, length): horizontal tension [N], tension at the supports [N] and cable length [m]. For a shallow cable they approach parabolic_cable() with the same w.

Return type:

tuple of float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Scalars only.

References

The problem was posed by Jacob Bernoulli in Acta Eruditorum (1690) and solved there by Johann Bernoulli, G. W. Leibniz and C. Huygens (1691).

engineeringkit.structural_engineering.channel_section(depth, flange_width, flange_thickness, web_thickness)[source]#

Properties of a channel (C) section, flanges pointing in \(+z\).

Parameters:
  • depth (float) – Overall depth [m], more than twice flange_thickness.

  • flange_width (float) – Overall flange width, including the web [m], more than web_thickness.

  • flange_thickness (float) – Flange thickness [m], positive.

  • web_thickness (float) – Web thickness [m], positive.

Returns:

Back of the web at \(z = 0\), bottom at \(y = 0\).

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. A channel loaded through its centroid twists: see channel_shear_center().

engineeringkit.structural_engineering.channel_shear_center(depth, flange_width, flange_thickness, web_thickness)[source]#

Distance of a thin-walled channel’s shear centre behind its web.

The flange shear flows, each with resultant \(F = Vb^2ht_f/(4I)\), form a couple \(Fh\) that the shear force can only balance if it acts at

\[e = \frac{3b^2t_f}{6bt_f + ht_w}\]

from the web centreline, on the side away from the flanges.

Parameters:
  • depth (float) – Distance \(h\) between the flange centrelines [m], positive.

  • flange_width (float) – Distance \(b\) from the web centreline to the flange tips [m], nonnegative.

  • flange_thickness (float) – Flange thickness \(t_f\) [m], positive.

  • web_thickness (float) – Web thickness \(t_w\) [m], positive.

Returns:

Shear-centre offset \(e\) [m]; \(3b^2/(6b + h)\) for a uniform wall thickness.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Centreline (thin-wall) dimensions are used, and the web’s contribution to the second moment is \(t_wh^3/12\).

References

R. Maillart, “Zur Frage der Biegung,” Schweizerische Bauzeitung 77 (1921) 195-197.

engineeringkit.structural_engineering.composite_section(rectangles)[source]#

Area, centroid and second moments of a section made of rectangles.

Each part adds its own centroidal second moment and, by the parallel-axis theorem, its area times the squared distance to the section centroid:

\[I_z = \sum n_i\left(\frac{b_ih_i^3}{12} + b_ih_i(y_i - \bar y)^2\right),\qquad I_{yz} = \sum n_ib_ih_i(y_i - \bar y)(z_i - \bar z).\]

A weight \(n_i = -1\) removes a hole; a modular ratio \(n_i = E_i/E_\mathrm{ref}\) gives the transformed section of a composite beam, whose bending stress in part \(i\) is \(n_i\) times the flexure-formula stress of the transformed section.

Parameters:

rectangles (sequence of tuple) – (b, h, z, y) or (b, h, z, y, weight) for each part: width along \(z\) [m] and height along \(y\) [m], both positive, the coordinates of its centre [m], and its weight [-], nonzero (1 by default). Holes must lie inside solid parts.

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

R. C. Hibbeler, Mechanics of Materials, 10th ed. (Pearson, 2017), section 6.6 and appendix A.

engineeringkit.structural_engineering.effective_length_factor(ends)[source]#

Theoretical effective-length factor \(K\) of an ideal column.

\(KL\) is the length of the pin-ended column with the same Euler load, the distance between inflection points of the buckled shape. For a column fixed at one end and pinned at the other, the buckling condition is \(\tan kL = kL\), whose first root \(kL = 4.4934\) gives \(K = \pi/4.4934 = 0.699\).

Parameters:

ends ({"pinned-pinned", "fixed-pinned", "fixed-fixed", "fixed-free", "fixed-guided"}) – End conditions; "fixed-guided" has both ends restrained against rotation but one free to sway.

Returns:

\(K\) [-]: 1, 0.699, 0.5, 2 and 1 respectively.

Return type:

float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Design codes recommend larger values (0.65 for fixed-fixed, 0.80 for fixed-pinned, 2.1 for fixed-free) because real connections are never perfectly rigid.

engineeringkit.structural_engineering.euler_buckling_load(E, I, L, K=1.0)[source]#

Elastic critical load of an ideal column, \(P_{cr} = \pi^2EI/(KL)^2\).

Parameters:
  • E (float or array_like) – Young’s modulus [Pa], positive.

  • I (float or array_like) – Least second moment of area [m^4], positive.

  • L (float or array_like) – Column length [m], positive.

  • K (float or array_like, optional) – Effective-length factor [-], positive: 1 pinned-pinned, 0.5 fixed-fixed, about 0.7 fixed-pinned, 2 fixed-free.

Returns:

Critical load [N].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

L. Euler, Methodus inveniendi lineas curvas maximi minimive proprietate gaudentes, Additamentum I, “De curvis elasticis” (Lausanne, 1744).

engineeringkit.structural_engineering.hooke_stress(E, strain)[source]#

Uniaxial stress from Hooke’s law, \(\sigma = E\varepsilon\).

Parameters:
  • E (float or array_like) – Young’s modulus [Pa], positive.

  • strain (float or array_like) – Axial strain [-].

Returns:

Stress [Pa], tension positive.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.i_section(depth, flange_width, flange_thickness, web_thickness)[source]#

Properties of a doubly symmetric I (wide-flange) section.

Parameters:
  • depth (float) – Overall depth [m], more than twice flange_thickness.

  • flange_width (float) – Flange width [m], at least web_thickness.

  • flange_thickness (float) – Flange thickness [m], positive.

  • web_thickness (float) – Web thickness [m], positive.

Returns:

Bottom of the section at \(y = 0\), web centred on \(z = 0\).

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Root fillets are ignored.

engineeringkit.structural_engineering.influence_line(length, positions, quantity='moment', at=None)[source]#

Influence line of a simply supported beam for a moving unit load.

Gives the value of a response quantity when a unit downward load stands at each of positions. Multiplying by a load and summing over several loads gives the response to any load train, and the position of the train that maximises it.

Parameters:
  • length (float) – Span [m], positive.

  • positions (float or array_like) – Positions of the unit load from the left support [m], in [0, length].

  • quantity ({"moment", "shear", "left_reaction", "right_reaction"}, optional) – Response quantity.

  • at (float, optional) – Section [m] at which "moment" or "shear" is measured, in [0, length]. Not used for reactions.

Returns:

Response per unit load: reactions [-] (N/N), shear [-] (N/N) or moment [m] (N m/N). Shear follows SimplySupportedBeam: with the load at or left of the section, the shear there is \(-\xi/L\); otherwise \(1 - \xi/L\).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

E. Winkler, Die Lehre von der Elasticität und Festigkeit (Prague: Dominicus, 1867); O. Mohr, “Beitrag zur Theorie der Holz- und Eisen-Constructionen,” Z. Architekten- und Ingenieur-Vereins zu Hannover 14 (1868) 19-51.

engineeringkit.structural_engineering.johnson_critical_stress(sigma_y, E, slenderness)[source]#

Critical stress on Johnson’s parabola, joined to Euler’s hyperbola.

\[\sigma_{cr} = \sigma_y - \frac{\sigma_y^2}{4\pi^2E}\left(\frac{KL}{r}\right)^2 \quad\text{for}\quad \frac{KL}{r} < C_c = \sqrt{\frac{2\pi^2E}{\sigma_y}},\]

and \(\pi^2E/(KL/r)^2\) beyond. The parabola starts at the yield stress for a stub column and meets Euler’s curve tangentially at \(\sigma_y/2\).

Parameters:
  • sigma_y (float or array_like) – Yield stress [Pa], positive.

  • E (float or array_like) – Young’s modulus [Pa], positive.

  • slenderness (float or array_like) – Effective slenderness ratio \(KL/r\) [-], nonnegative.

Returns:

Critical stress [Pa].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The curve includes no safety factor.

References

J. B. Johnson, C. W. Bryan and F. E. Turneaure, The Theory and Practice of Modern Framed Structures (New York: Wiley, 1893).

engineeringkit.structural_engineering.maxwell_betti_reciprocity(delta_ij, delta_ji, rtol=1e-09, atol=1e-12)[source]#

Check Maxwell’s reciprocal theorem, \(\delta_{ij} = \delta_{ji}\).

In a linear elastic structure, the deflection at point i due to a unit load at point j equals the deflection at j due to a unit load at i.

Parameters:
  • delta_ij (float) – Deflection at i due to a unit load at j [m].

  • delta_ji (float) – Deflection at j due to a unit load at i [m].

  • rtol (float, optional) – Relative tolerance [-].

  • atol (float, optional) – Absolute displacement tolerance [m].

Returns:

Whether the two deflections agree within the tolerances.

Return type:

bool

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

J. C. Maxwell, “On the calculation of the equilibrium and stiffness of frames,” Phil. Mag. 27 (1864) 294-299; E. Betti, Il Nuovo Cimento 7-8 (1872) 5-21.

engineeringkit.structural_engineering.method_of_joints(nodes, members, loads, fixed_dofs)[source]#

Member forces of a statically determinate plane truss, joint by joint.

This is the hand method. When the truss has three reactions, they are first found from the equilibrium of the whole truss. Then, repeatedly, a joint with at most two unknown forces is chosen and its two equilibrium equations, \(\sum F_x = 0\) and \(\sum F_y = 0\), are solved for them, until every joint has been used. No stiffness enters: the forces of a determinate truss follow from statics alone.

Parameters:
  • nodes (array_like, shape (n, 2)) – Joint coordinates [m].

  • members (sequence of (int, int)) – Zero-based joint indices of each member.

  • loads (array_like) – Applied joint loads [N], 2n values or shape (n, 2).

  • fixed_dofs (array_like of int) – Restrained degrees of freedom; each carries one reaction.

Returns:

Member forces [N] (tension positive), reactions [N] at every degree of freedom (zero where free) and the order in which joints were used.

Return type:

JointMethodResult

Raises:

ValueError – If Maxwell’s count is not zero, if three reactions are parallel or concurrent (an unstable truss), or if the procedure stalls because every remaining joint has three or more unknowns, or two unknown members that are collinear (use PlanarTruss, or the method of sections, for such trusses).

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

  1. Whipple, A Work on Bridge Building (Utica, N.Y., 1847).

engineeringkit.structural_engineering.mohr_circle(sx, sy, txy)[source]#

Centre, radius and principal stresses of Mohr’s circle for plane stress.

Parameters:
  • sx (float or array_like) – Normal stresses on the x and y faces [Pa], tension positive.

  • sy (float or array_like) – Normal stresses on the x and y faces [Pa], tension positive.

  • txy (float or array_like) – Shear stress [Pa].

Returns:

(center, radius, sigma_1, sigma_2), all [Pa]: the circle’s centre and radius, and the maximum and minimum principal stresses. The radius is also the maximum in-plane shear stress.

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

O. Mohr, “Über die Darstellung des Spannungszustandes und des Deformationszustandes eines Körperelementes,” Zivilingenieur 28 (1882) 113-156.

engineeringkit.structural_engineering.moment_distribution(members, fixed_joints=(), *, tol=1e-10, max_iterations=10000)[source]#

Member-end moments of a continuous beam or braced frame by Hardy Cross’s method.

Every joint is assumed restrained against translation (no sway). A joint listed in fixed_joints is also restrained against rotation; every other joint rotates freely, so a joint with a single member is a pinned end.

The fixed-end moments of a member carrying a uniform load \(w\) are \(\mp wL^2/12\). Each cycle computes the unbalanced moment at every free joint, distributes its negative to the member ends in proportion to \(4EI/L\), and carries half of each distributed moment to the far end. Cycles stop when the largest unbalance falls below tol times the largest fixed-end moment.

Parameters:
  • members (sequence of (int, int, float, float, float)) – (i, j, length, EI, w) for each member: joint indices, length [m], flexural rigidity [N m^2] and uniform transverse load [N/m]. For a horizontal member drawn from i on the left to j on the right, positive w acts downward.

  • fixed_joints (sequence of int, optional) – Joints restrained against rotation (built-in supports).

  • tol (float, optional) – Relative convergence tolerance [-].

  • max_iterations (int, optional) – Maximum number of cycles.

Returns:

End moments [N m], clockwise positive on the member end, with the number of cycles and the unbalance history.

Return type:

MomentDistributionResult

Raises:

RuntimeError – If the unbalance has not converged after max_iterations cycles.

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

H. Cross, “Analysis of continuous frames by distributing fixed-end moments,” Proc. ASCE 56 (1930) 919-928.

engineeringkit.structural_engineering.neutral_axis_angle(My, Mz, Iy, Iz, Iyz=0.0)[source]#

Inclination of the neutral axis under bending about two axes.

The neutral axis is the line of zero unsymmetrical_bending_stress() through the centroid. On principal axes, with the moment vector at \(\theta\) from the \(z\) axis, \(\tan\alpha = (I_z/I_y)\tan\theta\): unless \(I_y = I_z\) the neutral axis is not perpendicular to the plane of the loads.

Parameters:
  • My (float or array_like) – Moment components [N m], not both zero.

  • Mz (float or array_like) – Moment components [N m], not both zero.

  • Iy (float or array_like) – Centroidal second moments of area [m^4], positive.

  • Iz (float or array_like) – Centroidal second moments of area [m^4], positive.

  • Iyz (float or array_like, optional) – Product of inertia [m^4].

Returns:

Angle \(\alpha\) of the neutral axis from the \(z\) axis [rad], counterclockwise positive, in \((-\pi/2, \pi/2]\).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.parabolic_cable(w, span, sag)[source]#

Tension and length of a cable carrying a load uniform along the span.

With supports at the same level and the sag \(f\) at midspan, the cable is the parabola \(y = 4fx(L - x)/L^2\) and

\[H = \frac{wL^2}{8f},\qquad T_\max = \sqrt{H^2 + (wL/2)^2},\qquad s = \frac{L}{2}\sqrt{1 + 16n^2} + \frac{L}{8n}\sinh^{-1}4n,\quad n = f/L.\]
Parameters:
  • w (float or array_like) – Load per unit horizontal length [N/m], positive (a suspension bridge deck).

  • span (float or array_like) – Horizontal distance between the supports [m], positive.

  • sag (float or array_like) – Midspan sag [m], positive.

Returns:

(H, T_max, length): horizontal tension [N], tension at the supports [N] and cable length [m].

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The cable is perfectly flexible and inextensible.

engineeringkit.structural_engineering.parallel_axis(Ic, A, d)[source]#

Second moment about a parallel axis, \(I = I_c + Ad^2\).

Parameters:
  • Ic (float or array_like) – Second moment about the centroidal axis [m^4], nonnegative.

  • A (float or array_like) – Area [m^2], positive.

  • d (float or array_like) – Distance between the axes [m].

Returns:

Second moment about the shifted axis [m^4].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.plane_stress_from_strains(ex, ey, gxy, E, nu)[source]#

Plane stress from measured strains by Hooke’s law for an isotropic material.

\[\sigma_x = \frac{E}{1 - \nu^2}(\varepsilon_x + \nu\varepsilon_y),\quad \sigma_y = \frac{E}{1 - \nu^2}(\varepsilon_y + \nu\varepsilon_x),\quad \tau_{xy} = \frac{E}{2(1 + \nu)}\gamma_{xy}.\]
Parameters:
  • ex (float or array_like) – Normal strains [-].

  • ey (float or array_like) – Normal strains [-].

  • gxy (float or array_like) – Engineering shear strain [-].

  • E (float or array_like) – Young’s modulus [Pa], positive.

  • nu (float or array_like) – Poisson’s ratio [-], in (-1, 0.5).

Returns:

(sigma_x, sigma_y, tau_xy) [Pa].

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Valid at a free surface, where the gauges are.

engineeringkit.structural_engineering.plastic_collapse_load(Mp, L, supports='fixed', load='point', position=None)[source]#

Collapse load of a prismatic beam with plastic moment \(M_p\).

  • "simple": \(P_c = M_pL/(ab)\) for a point load at \(a\) (\(b = L - a\)), \(w_c = 8M_p/L^2\) for a uniform load.

  • "propped": \(P_c = M_p(2/a + 1/b)\), \(w_c = 2(3 + 2\sqrt{2})M_p/L^2 \approx 11.66M_p/L^2\).

  • "fixed": \(P_c = 2M_pL/(ab)\), \(w_c = 16M_p/L^2\).

A propped cantilever is fixed at the left end (\(x = 0\)) and simply supported at the right.

Parameters:
  • Mp (float or array_like) – Plastic moment of the section [N m], positive (\(\sigma_y Z_p\)).

  • L (float or array_like) – Span [m], positive.

  • supports ({"fixed", "propped", "simple"}, optional) – End conditions.

  • load ({"point", "uniform"}, optional) – A single point load or a uniform load over the whole span.

  • position (float, optional) – Distance of the point load from the left end [m], strictly inside the span; midspan by default.

Returns:

Collapse load [N] for a point load, or collapse intensity [N/m] for a uniform load.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Rigid-plastic behaviour is assumed: no strain hardening, no instability and no reduction of \(M_p\) by shear or axial force.

References

G. Kazinczy, “Kísérletek befalazott tartókkal” (Experiments with clamped girders), Betonszemle 2 (1914), nos. 4-6; J. F. Baker, M. R. Horne and J. Heyman, The Steel Skeleton, vol. 2 (Cambridge, 1956).

engineeringkit.structural_engineering.plastic_section_modulus(b, h)[source]#

Plastic section modulus of a rectangle, \(Z_p = bh^2/4\).

When the whole section has yielded, half of it is at \(+\sigma_y\) and half at \(-\sigma_y\), and the moment is \(M_p = \sigma_y Z_p\). The ratio \(Z_p/Z = 1.5\) is the rectangle’s shape factor.

Parameters:
  • b (float or array_like) – Width [m], positive.

  • h (float or array_like) – Depth [m], positive.

Returns:

Plastic section modulus [m^3].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.poisson_lateral_strain(axial_strain, nu)[source]#

Lateral strain of an isotropic bar, \(\varepsilon_t = -\nu\,\varepsilon_a\).

Parameters:
  • axial_strain (float or array_like) – Axial strain [-].

  • nu (float or array_like) – Poisson’s ratio [-], in the open interval (-1, 0.5) required for a positive-definite isotropic elastic material.

Returns:

Lateral strain [-].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

S.-D. Poisson, “Mémoire sur l’équilibre et le mouvement des corps élastiques,” Mém. Acad. Roy. Sci. Inst. France 8 (1829) 357-570.

engineeringkit.structural_engineering.principal_stresses_3d(sx, sy, sz, txy=0.0, tyz=0.0, tzx=0.0)[source]#

Principal stresses of a three-dimensional stress state.

They are the eigenvalues of the symmetric stress tensor

\[\begin{split}\boldsymbol\sigma = \begin{pmatrix}\sigma_x & \tau_{xy} & \tau_{zx}\\ \tau_{xy} & \sigma_y & \tau_{yz}\\ \tau_{zx} & \tau_{yz} & \sigma_z\end{pmatrix},\end{split}\]

the roots of \(\sigma^3 - I_1\sigma^2 + I_2\sigma - I_3 = 0\). Mohr drew the three circles through each pair of them; the largest has radius \(\tau_\mathrm{abs} = (\sigma_1 - \sigma_3)/2\).

Parameters:
  • sx (float or array_like) – Normal stresses [Pa], tension positive.

  • sy (float or array_like) – Normal stresses [Pa], tension positive.

  • sz (float or array_like) – Normal stresses [Pa], tension positive.

  • txy (float or array_like, optional) – Shear stresses [Pa].

  • tyz (float or array_like, optional) – Shear stresses [Pa].

  • tzx (float or array_like, optional) – Shear stresses [Pa].

Returns:

(sigma_1, sigma_2, sigma_3) [Pa], in decreasing order.

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. numpy.linalg.eigvalsh computes the eigenvalues.

References

O. Mohr, “Über die Darstellung des Spannungszustandes und des Deformationszustandes eines Körperelementes,” Zivilingenieur 28 (1882) 113-156.

engineeringkit.structural_engineering.radius_of_gyration(I, A)[source]#

Radius of gyration, \(r = \sqrt{I/A}\).

Parameters:
  • I (float or array_like) – Second moment of area [m^4], positive.

  • A (float or array_like) – Area [m^2], positive.

Returns:

Radius of gyration [m].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.rectangular_second_moment(b, h)[source]#

Second moment of area of a rectangle about its centroidal axis, \(bh^3/12\).

Parameters:
  • b (float or array_like) – Width, parallel to the bending axis [m], positive.

  • h (float or array_like) – Depth, in the plane of bending [m], positive.

Returns:

Second moment of area [m^4].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.rectangular_section_modulus(b, h)[source]#

Elastic section modulus of a rectangle, \(Z = I/c = bh^2/6\).

Parameters:
  • b (float or array_like) – Width [m], positive.

  • h (float or array_like) – Depth [m], positive.

Returns:

Section modulus [m^3]; the extreme-fibre stress is \(M/Z\).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

G. Galilei, Discorsi e dimostrazioni matematiche intorno a due nuove scienze (Leiden: Elsevier, 1638), second day.

engineeringkit.structural_engineering.secant_formula_load(sigma_y, A, e, c, r, L, E, K=1.0)[source]#

Load at which the secant-formula stress reaches yield.

Solves secant_formula_stress() \(= \sigma_y\) for \(P\) by Brent’s method. With \(e = 0\) it is the smaller of the squash load \(\sigma_yA\) and the Euler load.

Parameters:
  • sigma_y (float) – Yield stress [Pa], positive.

  • A (float) – Area [m^2], positive.

  • e (float) – Eccentricity [m], nonnegative.

  • c (float) – Distance from the centroid to the extreme compressive fibre [m], positive.

  • r (float) – Radius of gyration [m], positive.

  • L (float) – Length [m], positive.

  • E (float) – Young’s modulus [Pa], positive.

  • K (float, optional) – Effective-length factor [-], positive.

Returns:

Load at first yield [N].

Return type:

float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Scalars only.

engineeringkit.structural_engineering.secant_formula_stress(P, A, e, c, r, L, E, K=1.0)[source]#

Peak stress in an eccentrically loaded column, the secant formula.

\[\sigma_\max = \frac{P}{A}\left[1 + \frac{ec}{r^2} \sec\left(\frac{KL}{2r}\sqrt{\frac{P}{EA}}\right)\right].\]

The stress is not proportional to the load: it grows without bound as \(P\) approaches the Euler load.

Parameters:
  • P (float or array_like) – Compressive load [N], positive and below the Euler load.

  • A (float or array_like) – Area [m^2], positive.

  • e (float or array_like) – Eccentricity of the load [m], nonnegative.

  • c (float or array_like) – Distance from the centroid to the extreme compressive fibre [m], positive.

  • r (float or array_like) – Radius of gyration in the plane of bending [m], positive.

  • L (float or array_like) – Length [m], positive.

  • E (float or array_like) – Young’s modulus [Pa], positive.

  • K (float or array_like, optional) – Effective-length factor [-], positive.

Returns:

Largest compressive stress [Pa], as a positive number.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Linear elastic: valid while the stress stays below the proportional limit.

References

T. Young, A Course of Lectures on Natural Philosophy and the Mechanical Arts (London: Johnson, 1807), vol. 2.

engineeringkit.structural_engineering.shear_flow(V, Q, I)[source]#

Shear force per unit length on a longitudinal cut, \(q = VQ/I\).

In a built-up beam this is the force the glue, nails or bolts joining the part beyond the cut must carry per metre; fasteners of capacity \(F\) need a spacing of at most \(F/q\).

Parameters:
  • V (float or array_like) – Shear force on the section [N].

  • Q (float or array_like) – First moment of the area beyond the cut about the neutral axis [m^3].

  • I (float or array_like) – Second moment of the whole section [m^4], positive.

Returns:

Shear flow [N/m].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.slenderness_ratio(L, K, r)[source]#

Effective slenderness ratio, \(KL/r\).

Parameters:
  • L (float or array_like) – Column length [m], positive.

  • K (float or array_like) – Effective-length factor [-], positive.

  • r (float or array_like) – Radius of gyration [m], positive.

Returns:

Slenderness [-]; the Euler stress is \(\pi^2E/(KL/r)^2\).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.slope_deflection(members, fixed_joints=(), chord_rotations=None)[source]#

Member-end moments of a continuous beam or braced frame by Maney’s slope-deflection method.

With clockwise moments and rotations positive, the moment at end \(i\) of a member \(ij\) is

\[M_{ij} = \frac{2EI}{L}\left(2\theta_i + \theta_j - 3\psi\right) + M^F_{ij},\]

where \(\psi\) is the clockwise rotation of the chord (a support settlement \(\Delta\) of the far end gives \(\psi = \Delta/L\)) and \(M^F = \mp wL^2/12\) the fixed-end moments of a uniform load. The moments at each free joint must sum to zero; these equations are solved for the unknown rotations, and the rotations give the moments. It is the same problem moment_distribution() solves by iteration.

Parameters:
  • members (sequence of (int, int, float, float, float)) – (i, j, length, EI, w) for each member, as in moment_distribution().

  • fixed_joints (sequence of int, optional) – Joints restrained against rotation.

  • chord_rotations (array_like, optional) – Known chord rotation \(\psi\) of each member [rad], clockwise positive; zero by default (no settlement, no sway).

Returns:

End moments [N m] and joint rotations [rad], clockwise positive.

Return type:

SlopeDeflectionResult

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Joint translations other than the given chord rotations are not solved for: sway frames need one more equilibrium equation per storey, as in PlanarFrame.

References

G. A. Maney, “Secondary stresses in rigid frames,” Studies in Engineering (Minneapolis: University of Minnesota, 1915).

engineeringkit.structural_engineering.strain_energy_axial(force, length, area, E)[source]#

Strain energy stored in a uniform elastic bar, \(U = P^2L/(2AE)\).

Parameters:
  • force (float or array_like) – Axial force [N].

  • length (float or array_like) – Bar length [m], positive.

  • area (float or array_like) – Cross-sectional area [m^2], positive.

  • E (float or array_like) – Young’s modulus [Pa], positive.

Returns:

Strain energy [J], equal to \(P\delta/2\).

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.strain_energy_bending_constant_moment(moment, length, E, I)[source]#

Bending strain energy under a constant moment, \(U = M^2L/(2EI)\).

Parameters:
  • moment (float or array_like) – Bending moment [N m].

  • length (float or array_like) – Length [m], positive.

  • E (float or array_like) – Young’s modulus [Pa], positive.

  • I (float or array_like) – Second moment of area [m^4], positive.

Returns:

Strain energy [J].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.strain_rosette(strains, angles=(0.0, 0.7853981633974483, 1.5707963267948966))[source]#

Plane strain components from three strain-gauge readings.

A gauge at angle \(\theta\) from the \(x\) axis reads

\[\varepsilon_\theta = \varepsilon_x\cos^2\theta + \varepsilon_y\sin^2\theta + \gamma_{xy}\sin\theta\cos\theta,\]

and three such equations are solved for \((\varepsilon_x, \varepsilon_y, \gamma_{xy})\).

Parameters:
  • strains (array_like, shape (3,) or (3, k)) – Readings of the three gauges [-], optionally k readings each.

  • angles (array_like of 3 float, optional) – Gauge directions [rad], counterclockwise from \(x\), distinct modulo \(\pi\). The default is the rectangular (0°, 45°, 90°) rosette; (0, pi/3, 2*pi/3) is the delta rosette.

Returns:

(eps_x, eps_y, gamma_xy) [-], with \(\gamma_{xy}\) the engineering shear strain.

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The principal strains are mohr_circle(eps_x, eps_y, gamma_xy / 2).

References

E. E. Simmons, US Patent 2,292,549 (11 August 1942), the bonded resistance strain gauge, found independently by A. C. Ruge at MIT in 1938.

engineeringkit.structural_engineering.stress_transformation(sx, sy, txy, theta)[source]#

Stresses on an element rotated counterclockwise by theta.

\[\begin{split}\sigma_{x'} = \frac{\sigma_x + \sigma_y}{2} + \frac{\sigma_x - \sigma_y}{2}\cos 2\theta + \tau_{xy}\sin 2\theta,\\ \tau_{x'y'} = -\frac{\sigma_x - \sigma_y}{2}\sin 2\theta + \tau_{xy}\cos 2\theta,\end{split}\]

and \(\sigma_{y'} = \sigma_x + \sigma_y - \sigma_{x'}\).

Parameters:
  • sx (float or array_like) – Normal stresses [Pa], tension positive.

  • sy (float or array_like) – Normal stresses [Pa], tension positive.

  • txy (float or array_like) – Shear stress [Pa].

  • theta (float or array_like) – Rotation of the element [rad], counterclockwise positive.

Returns:

(sigma_x', sigma_y', tau_x'y') [Pa].

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.superpose_beam_results(*results)[source]#

Add the responses of one beam to several load cases (the principle of superposition).

Shear, moment, deflection, slope and reactions of a linear elastic beam are linear in the loads, so the response to a combination of loads is the sum of the responses to each.

Parameters:

*results (BeamResult) – Responses of the same beam, computed at the same stations and with the same supports.

Returns:

The summed response. The slope is summed when every result has one, and is None otherwise.

Return type:

BeamResult

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.t_section(depth, flange_width, flange_thickness, web_thickness)[source]#

Properties of a T section, flange on top.

Parameters:
  • depth (float) – Overall depth [m], more than flange_thickness.

  • flange_width (float) – Flange width [m], at least web_thickness.

  • flange_thickness (float) – Flange thickness [m], positive.

  • web_thickness (float) – Web (stem) thickness [m], positive.

Returns:

Bottom of the stem at \(y = 0\), stem centred on \(z = 0\).

Return type:

SectionProperties

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.tangent_modulus_load(Et, I, L, K=1.0, *, area=None)[source]#

Engesser’s tangent-modulus buckling load, \(P_t = \pi^2E_tI/(KL)^2\).

If Et is a number, the formula is evaluated directly. If it is a function of stress, the buckling stress must satisfy

\[\sigma = \frac{\pi^2E_t(\sigma)}{(KL/r)^2},\qquad r^2 = I/A,\]

which is solved for \(\sigma\) by Brent’s method between zero and the Euler stress computed with the initial modulus \(E_t(0)\).

Parameters:
  • Et (float, array_like or callable) – Tangent modulus [Pa], positive, or a function returning the tangent modulus [Pa] at a compressive stress [Pa]. A function must be positive at zero stress, nonnegative above it, and must not increase with stress.

  • I (float or array_like) – Least second moment of area [m^4], positive.

  • L (float or array_like) – Column length [m], positive.

  • K (float or array_like, optional) – Effective-length factor [-], positive.

  • area (float, optional) – Cross-sectional area [m^2], positive. Required when Et is a function; I, L and K must then be scalars.

Returns:

Critical load [N]. It equals euler_buckling_load() wherever the column buckles while still elastic.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

F. Engesser, “Ueber die Knickfestigkeit gerader Stäbe,” Z. Architekten- und Ingenieur-Vereins zu Hannover 35 (1889) 455-462; F. R. Shanley, “Inelastic column theory,” J. Aeronaut. Sci. 14 (1947) 261-268.

engineeringkit.structural_engineering.thermal_strain(alpha, delta_T)[source]#

Free thermal strain, \(\varepsilon_T = \alpha\,\Delta T\).

Parameters:
  • alpha (float or array_like) – Coefficient of linear thermal expansion [1/K].

  • delta_T (float or array_like) – Temperature change [K].

Returns:

Strain [-].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.thick_wall_cylinder_stresses(r, inner_radius, outer_radius, inner_pressure, outer_pressure=0.0)[source]#

Lamé’s radial, hoop and axial stresses in a thick-walled cylinder.

\[\sigma_r = A - \frac{B}{r^2},\qquad \sigma_\theta = A + \frac{B}{r^2},\qquad A = \frac{p_ir_i^2 - p_or_o^2}{r_o^2 - r_i^2},\quad B = \frac{(p_i - p_o)r_i^2r_o^2}{r_o^2 - r_i^2},\]

and, with closed ends, \(\sigma_z = A\).

Parameters:
  • r (float or array_like) – Radius [m], in [inner_radius, outer_radius].

  • inner_radius (float) – Inner radius \(r_i\) [m], positive.

  • outer_radius (float) – Outer radius \(r_o\) [m], greater than inner_radius.

  • inner_pressure (float) – Internal pressure \(p_i\) [Pa], nonnegative.

  • outer_pressure (float, optional) – External pressure \(p_o\) [Pa], nonnegative.

Returns:

(radial, hoop, axial) stresses [Pa], tension positive. The hoop stress is largest at the bore.

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Linear elastic, isotropic, away from the ends.

References

G. Lamé and É. Clapeyron, “Mémoire sur l’équilibre intérieur des corps solides homogènes,” Mémoires présentés par divers savans à l’Académie royale des sciences de l’Institut de France 4 (1833) 465-562.

engineeringkit.structural_engineering.thin_wall_vessel_stresses(p, r, t, shape='cylinder')[source]#

Membrane stresses in a thin-walled pressure vessel.

Parameters:
  • p (float or array_like) – Internal gauge pressure [Pa].

  • r (float or array_like) – Inner radius [m], positive.

  • t (float or array_like) – Wall thickness [m], positive.

  • shape ({"cylinder", "sphere"}, optional) – Vessel shape.

Returns:

(hoop, longitudinal) stresses [Pa]: \((pr/t, pr/2t)\) for a cylinder with closed ends and \((pr/2t, pr/2t)\) for a sphere. The radial stress, between \(-p\) and zero, is neglected.

Return type:

tuple of float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The usual limit is \(r/t \ge 10\), where the error against thick_wall_cylinder_stresses() is about 5%.

engineeringkit.structural_engineering.thin_walled_torsion_angle(T, L, G, enclosed_area, ds_over_t)[source]#

Twist of a closed thin-walled tube, Bredt’s second formula.

\[\phi = \frac{TL}{4A_m^2G}\oint\frac{ds}{t},\]

so the torsion constant is \(J = 4A_m^2/\oint ds/t\); for a uniform wall, \(\oint ds/t = s/t\) with \(s\) the centreline perimeter.

Parameters:
  • T (float or array_like) – Torque [N m].

  • L (float or array_like) – Length [m], positive.

  • G (float or array_like) – Shear modulus [Pa], positive.

  • enclosed_area (float or array_like) – Area enclosed by the centreline of the wall [m^2], positive.

  • ds_over_t (float or array_like) – \(\oint ds/t\) around the centreline [-], positive.

Returns:

Angle of twist [rad].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

R. Bredt, “Kritische Bemerkungen zur Drehungselastizität,” Zeitschrift des Vereines deutscher Ingenieure 40 (1896) 785ff.

engineeringkit.structural_engineering.thin_walled_torsion_shear_stress(T, enclosed_area, t)[source]#

Shear stress in a closed thin-walled tube, Bredt’s first formula \(\tau = T/(2A_mt)\).

The shear flow \(q = \tau t = T/(2A_m)\) is the same all round the wall, so the stress is largest where the wall is thinnest.

Parameters:
  • T (float or array_like) – Torque [N m].

  • enclosed_area (float or array_like) – Area \(A_m\) enclosed by the centreline of the wall [m^2], positive.

  • t (float or array_like) – Wall thickness at the point of interest [m], positive.

Returns:

Shear stress [Pa].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The wall must be thin compared with the size of the tube and the section free to warp; stress concentrations at re-entrant corners are not included.

References

R. Bredt, “Kritische Bemerkungen zur Drehungselastizität,” Zeitschrift des Vereines deutscher Ingenieure 40 (1896) 785ff.

engineeringkit.structural_engineering.three_hinged_arch(span, rise, w=0.0, point_loads=(), n=401)[source]#

Bending moment and thrust of a parabolic three-hinged arch.

The arch axis is \(y = 4fx(L - x)/L^2\), pinned at both springings and hinged at the crown. With \(M_0(x)\) the moment of a simply supported beam of the same span under the same loads,

\[H = \frac{M_0(L/2)}{f},\qquad M(x) = M_0(x) - Hy(x),\]

and the axial force is \(N = -(H\cos\varphi + V_0\sin\varphi)\), with \(\varphi\) the slope of the axis and \(V_0\) the beam shear. A load uniform along the span gives \(M \equiv 0\): the parabola is its funicular shape.

Parameters:
  • span (float) – Distance between the springings, at the same level [m], positive.

  • rise (float) – Height of the crown hinge above the springings [m], positive.

  • w (float, optional) – Load per unit horizontal length over the whole span [N/m], downward positive.

  • point_loads (sequence of (float, float), optional) – (position [m], P [N]), downward positive.

  • n (int, optional) – Number of stations, at least 2.

Return type:

ArchResult

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Small deflections: the shape is not updated under load.

References

R. Hooke, A Description of Helioscopes, and Some Other Instruments (London: John Martyn, 1676), postscript anagram; R. C. Hibbeler, Structural Analysis, 10th ed. (Pearson, 2018), section 5.5.

engineeringkit.structural_engineering.three_moment_equation(spans, w=0.0, I=1.0)[source]#

Support moments of a continuous beam by Clapeyron’s three-moment equation.

For the supports \(i-1, i, i+1\) around spans \(L_i\) and \(L_{i+1}\) carrying uniform loads \(w_i, w_{i+1}\),

\[M_{i-1}\frac{L_i}{I_i} + 2M_i\left(\frac{L_i}{I_i} + \frac{L_{i+1}}{I_{i+1}}\right) + M_{i+1}\frac{L_{i+1}}{I_{i+1}} = -\frac{w_iL_i^3}{4I_i} - \frac{w_{i+1}L_{i+1}^3}{4I_{i+1}},\]

one equation per interior support, with \(M = 0\) at the two simply supported ends. The modulus is taken to be the same in every span.

Parameters:
  • spans (array_like) – Span lengths [m], positive, left to right.

  • w (float or array_like, optional) – Uniform load on each span [N/m], downward positive.

  • I (float or array_like, optional) – Second moment of area of each span [m^4], positive. Only ratios between spans matter.

Returns:

Bending moment at each of the len(spans) + 1 supports [N m], sagging positive (interior supports of a loaded beam hog, so they come out negative).

Return type:

ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

É. Clapeyron, “Calcul d’une poutre élastique reposant librement sur des appuis inégalement espacés,” C. R. Acad. Sci. Paris 45 (1857) 1076-1080.

Examples

Two equal spans: the middle support moment is \(-wL^2/8\).

>>> three_moment_equation([4.0, 4.0], w=1000.0)
array([    0., -2000.,     0.])
engineeringkit.structural_engineering.torsion_angle(T, L, G, J)[source]#

Angle of twist of a uniform circular shaft, \(\phi = TL/(GJ)\).

Parameters:
  • T (float or array_like) – Torque [N m].

  • L (float or array_like) – Shaft length [m], positive.

  • G (float or array_like) – Shear modulus [Pa], positive.

  • J (float or array_like) – Polar second moment of area [m^4], positive.

Returns:

Twist [rad].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

References

C.-A. Coulomb, “Recherches théoriques et expérimentales sur la force de torsion et sur l’élasticité des fils de métal,” Mém. Acad. Roy. Sci. (1784, publ. 1787) 229-269.

engineeringkit.structural_engineering.torsion_shear_stress(T, r, J)[source]#

Shear stress in a circular shaft, \(\tau = Tr/J\).

Parameters:
  • T (float or array_like) – Torque [N m].

  • r (float or array_like) – Radial position [m], nonnegative (the outer radius gives the peak).

  • J (float or array_like) – Polar second moment of area [m^4], positive (\(\pi d^4/32\) for a solid shaft).

Returns:

Shear stress [Pa].

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata.

engineeringkit.structural_engineering.transverse_shear_stress(V, Q, I, t)[source]#

Jourawski’s average shear stress across a cut, \(\tau = VQ/(It)\).

Parameters:
  • V (float or array_like) – Shear force on the section [N].

  • Q (float or array_like) – First moment, about the neutral axis, of the area beyond the cut [m^3] (SectionProperties.first_moment()).

  • I (float or array_like) – Second moment of the whole section about the neutral axis [m^4], positive.

  • t (float or array_like) – Width of the cut [m], positive (SectionProperties.width_at()).

Returns:

Shear stress [Pa], averaged across the width of the cut. For a rectangle it peaks at \(1.5V/A\) on the neutral axis.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The stress is assumed uniform across the cut, which is accurate for narrow cuts and thin walls, not across the wide flange of a stocky section.

References

D. J. Jourawski, “Sur la résistance d’un corps prismatique et d’une pièce composée en bois ou en tôle de fer à une force perpendiculaire à leur longueur,” Annales des ponts et chaussées, 3e série, 12 (1856) 328-351.

engineeringkit.structural_engineering.truss_determinacy(n_joints, n_members, n_reactions)[source]#

Maxwell’s count for a plane truss, \(m + r - 2j\).

Parameters:
  • n_joints (int) – Number of joints \(j\), at least 2.

  • n_members (int) – Number of members \(m\), at least 1.

  • n_reactions (int) – Number of restrained degrees of freedom \(r\), nonnegative.

Returns:

Negative: a mechanism, whatever the arrangement. Zero: statically determinate if the truss is also geometrically stable. Positive: that many redundant members or reactions.

Return type:

int

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. A zero or positive count does not prove stability; PlanarTruss checks that separately through the stiffness matrix.

References

J. C. Maxwell, “On the calculation of the equilibrium and stiffness of frames,” Phil. Mag. 27 (1864) 294-299.

engineeringkit.structural_engineering.unit_load_beam_deflection(x, moment, virtual_moment, E, I)[source]#

Beam deflection by the unit-load method, \(\delta = \int mM/(EI)\,dx\).

The same integral as the keyword form of castigliano_deflection(), with \(\partial M/\partial P\) read as the moment \(m\) of a unit (virtual) load, integrated by Simpson’s rule.

Parameters:
  • x (array_like) – Stations along the beam [m], strictly increasing.

  • moment (array_like) – Bending moment \(M\) under the real loads [N m].

  • virtual_moment (array_like) – Bending moment \(m\) under a unit load at the point and in the direction of the wanted deflection [m] (N m/N); a unit couple gives a rotation instead.

  • E (float or array_like) – Young’s modulus [Pa], positive.

  • I (float or array_like) – Second moment of area [m^4], positive; may vary along the beam.

Returns:

Deflection [m] (or rotation [rad] for a unit couple).

Return type:

float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Only bending is included.

References

O. Mohr, “Beitrag zur Theorie des Fachwerks,” Zeitschrift des Architekten- und Ingenieur-Vereins zu Hannover 20 (1874) 509-526.

engineeringkit.structural_engineering.unit_load_truss_deflection(forces, virtual_forces, lengths, area, E)[source]#

Joint displacement of a truss by the unit-load method, \(\delta = \sum nNL/(AE)\).

Parameters:
  • forces (array_like) – Member forces \(N\) under the real loads [N], tension positive.

  • virtual_forces (array_like) – Member forces \(n\) under a unit load at the joint, in the direction of the wanted displacement [-] (N/N).

  • lengths (array_like) – Member lengths [m], positive.

  • area (float or array_like) – Member areas [m^2], positive.

  • E (float or array_like) – Young’s moduli [Pa], positive.

Returns:

Displacement of the joint in the direction of the unit load [m].

Return type:

float

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. The virtual forces need only satisfy equilibrium; in a statically indeterminate truss the real forces must be those of the compatible solution (PlanarTruss).

References

O. Mohr, “Beitrag zur Theorie des Fachwerks,” Zeitschrift des Architekten- und Ingenieur-Vereins zu Hannover 20 (1874) 509-526.

engineeringkit.structural_engineering.unsymmetrical_bending_stress(My, Mz, y, z, Iy, Iz, Iyz=0.0)[source]#

Normal stress under bending about two axes, the generalized flexure formula.

\[\sigma = -\frac{M_zI_y + M_yI_{yz}}{I_yI_z - I_{yz}^2}\,y + \frac{M_yI_z + M_zI_{yz}}{I_yI_z - I_{yz}^2}\,z,\]

which reduces to \(\sigma = -M_zy/I_z + M_yz/I_y\) on principal axes. Positive \(M_z\) compresses the fibres at positive \(y\) (for a beam along \(x\) loaded downward, it is the sagging moment).

Parameters:
  • My (float or array_like) – Moment components about the centroidal \(y\) (vertical) and \(z\) (horizontal) axes [N m], right-hand rule.

  • Mz (float or array_like) – Moment components about the centroidal \(y\) (vertical) and \(z\) (horizontal) axes [N m], right-hand rule.

  • y (float or array_like) – Coordinates of the point from the centroid [m], \(y\) up.

  • z (float or array_like) – Coordinates of the point from the centroid [m], \(y\) up.

  • Iy (float or array_like) – Centroidal second moments of area [m^4], positive.

  • Iz (float or array_like) – Centroidal second moments of area [m^4], positive.

  • Iyz (float or array_like, optional) – Product of inertia \(\int yz\,dA\) [m^4]; zero on principal axes.

Returns:

Normal stress [Pa], tension positive.

Return type:

float or ndarray

Notes

Assumptions, governing equations and validity limits are discussed in Structural engineering: loads, signs and linear elasticity. SI inputs are required; raw numbers carry no dimensional metadata. Loads must pass through the shear centre, or the beam also twists.

References

R. C. Hibbeler, Mechanics of Materials, 10th ed. (Pearson, 2017), section 6.5; J. M. Gere and B. J. Goodno, Mechanics of Materials, 9th ed. (Cengage, 2018), sections 6.4-6.5.

Utilities#

Supporting numerics for engineeringkit.structural_engineering’s systems/ modules.

engineeringkit.structural_engineering.utils.bar_stiffness_matrix(E, A, L, c, s)[source]#

Global 4x4 stiffness matrix of a pin-ended bar.

Parameters:
  • E (float) – Young’s modulus [Pa].

  • A (float) – Cross-sectional area [m^2].

  • L (float) – Length [m].

  • c (float) – Direction cosines of the bar axis [-].

  • s (float) – Direction cosines of the bar axis [-].

Returns:

Stiffness [N/m] relating (x_i, y_i, x_j, y_j) forces to displacements: \((EA/L)\,[\mathbf{n}\mathbf{n}^T, -\mathbf{n}\mathbf{n}^T; -\mathbf{n}\mathbf{n}^T, \mathbf{n}\mathbf{n}^T]\) with \(\mathbf{n} = (c, s)\).

Return type:

ndarray, shape (4, 4)

engineeringkit.structural_engineering.utils.fixed_dof_vector(fixed_dofs, ndof)[source]#

Validate supported degrees of freedom and return them sorted and unique.

Parameters:
  • fixed_dofs (array_like of int) – Indices of the degrees of freedom held at zero displacement.

  • ndof (int) – Total number of degrees of freedom.

Return type:

ndarray of int

engineeringkit.structural_engineering.utils.frame_rotation_matrix(c, s)[source]#

6x6 rotation from global to member axes for a plane frame member.

Parameters:
  • c (float) – Direction cosines of the member axis [-].

  • s (float) – Direction cosines of the member axis [-].

Returns:

T such that local displacements are T @ global.

Return type:

ndarray, shape (6, 6)

engineeringkit.structural_engineering.utils.frame_stiffness_matrix(E, A, I, L)[source]#

Local 6x6 stiffness matrix of a plane Euler-Bernoulli frame member.

Parameters:
  • E (float) – Young’s modulus [Pa].

  • A (float) – Cross-sectional area [m^2].

  • I (float) – Second moment of area about the bending axis [m^4].

  • L (float) – Length [m].

Returns:

Stiffness relating (N_i, V_i, M_i, N_j, V_j, M_j) to (u_i, v_i, theta_i, u_j, v_j, theta_j) in member axes, with the local x axis from node i to node j.

Return type:

ndarray, shape (6, 6)

engineeringkit.structural_engineering.utils.mesh_geometry(nodes, members)[source]#

Validate a plane mesh and return its coordinates and member geometry.

Parameters:
  • nodes (array_like, shape (n, 2)) – Node coordinates [m].

  • members (sequence of (int, int)) – Zero-based node indices of each member’s ends.

Returns:

  • xy (ndarray, shape (n, 2)) – Node coordinates [m] as floats.

  • geometry (ndarray, shape (m, 3)) – Length [m] and direction cosines c, s [-] of each member, from its first node to its second.

engineeringkit.structural_engineering.utils.solve_reduced(K, loads, fixed, cond_limit, name='structure')[source]#

Solve \(K_{ff}u_f = F_f\) with a conditioning check.

Parameters:
  • K (ndarray, shape (ndof, ndof)) – Assembled global stiffness matrix.

  • loads (ndarray, shape (ndof,)) – Applied nodal loads.

  • fixed (ndarray of int) – Supported degrees of freedom (zero displacement).

  • cond_limit (float) – A RuntimeWarning is issued when \(\operatorname{cond}(K_{ff})\) exceeds this value.

  • name (str, optional) – Word used in messages (“truss”, “frame”).

Returns:

  • u (ndarray, shape (ndof,)) – Displacements, zero at the fixed degrees of freedom.

  • cond (float) – 2-norm condition number of \(K_{ff}\) (1 if every degree of freedom is fixed).

Raises:

ValueError – If \(K_{ff}\) is singular to working precision: the structure is a mechanism or is not restrained against rigid-body motion.

Visualizers#

Matplotlib visualizers for engineeringkit.structural_engineering.

engineeringkit.structural_engineering.visualizers.plot_beam_diagrams(result, axes=None)[source]#

Shear, moment and deflection diagrams of a BeamResult, stacked.

Parameters:
  • result (BeamResult) – Output of SimplySupportedBeam.

  • axes (sequence of three matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

Return type:

ndarray of matplotlib.axes.Axes

engineeringkit.structural_engineering.visualizers.plot_frame(result, scale=1.0, ax=None, n=21)[source]#

Draw a plane frame and its deflected shape from a FrameResult.

Each member’s deflected shape is the cubic Hermite interpolation of its end displacements and rotations, which is exact for members without span loads.

Parameters:
  • result (FrameResult) – Output of PlanarFrame.solve().

  • scale (float, optional) – Displacement magnification [-].

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

  • n (int, optional) – Points drawn along each member.

Return type:

matplotlib.axes.Axes

engineeringkit.structural_engineering.visualizers.plot_mohr_circle(sx, sy, txy, ax=None)[source]#

Draw Mohr’s circle for a plane stress state.

The x-face point \((\sigma_x, \tau_{xy})\) and the y-face point \((\sigma_y, -\tau_{xy})\) are marked, with shear plotted positive downward so that rotating the element counterclockwise by \(\theta\) moves the point counterclockwise by \(2\theta\).

Parameters:
  • sx (float) – Plane stress components [Pa].

  • sy (float) – Plane stress components [Pa].

  • txy (float) – Plane stress components [Pa].

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

Return type:

matplotlib.axes.Axes

engineeringkit.structural_engineering.visualizers.plot_truss(nodes, members, displacements=None, forces=None, scale=1.0, ax=None)[source]#

Draw a plane truss, optionally deformed and coloured by member force.

Parameters:
  • nodes (array_like, shape (n, 2)) – Joint coordinates [m].

  • members (sequence of (int, int)) – Member connectivity.

  • displacements (array_like, optional) – Joint displacements [m], two per joint. If given, the undeformed truss is dashed and the deformed one solid.

  • forces (array_like, optional) – Member forces [N]; tension is drawn red and compression blue.

  • scale (float, optional) – Displacement magnification [-].

  • ax (matplotlib.axes.Axes, optional) – Axes to draw on; a new figure is created if omitted.

Return type:

matplotlib.axes.Axes