Mechanics¶
Statics: equilibrium analysis of rigid bodies and structures.
- Provides:
Beam: Cantilever beam analysis
StaticsParticle: Particle equilibrium
StressTensor3D: 3D stress tensor
StressTransform: Symbolic stress transformation
PrincipalStresses: Principal stress calculation
- class mechlab.mechanics.statics.StaticsParticle(forces)[source]
Bases:
objectRepresents a particle in statics.
Calculates resultant force, inclination angles, and unit vectors.
Example
>>> F1 = (10, 20, 0) >>> F2 = (5, -10, 15) >>> p = StaticsParticle([F1, F2]) >>> p.resultant() Matrix([[15], [10], [15]])
- Parameters:
forces (list)
- resultant()[source]
Calculate and return the resultant force vector.
- Return type:
MutableDenseMatrix
- class mechlab.mechanics.statics.Beam(L, E, I)[source]
Bases:
objectCantilever beam with end load.
Calculates maximum deflection and slope.
Example
>>> beam = Beam(L=2, E=200e9, I=1e-6) >>> beam.max_deflection(load=1000) 0.0133...
- max_deflection(load)[source]
Calculate maximum deflection: δ = PL³/(3EI).
- class mechlab.mechanics.statics.StressTensor3D(components)[source]
Bases:
objectRepresents a 3D stress tensor.
- The stress tensor is a symmetric 3x3 matrix:
- [[σxx, τxy, τxz],
[τxy, σyy, τyz], [τxz, τyz, σzz]]
Example
>>> tensor = StressTensor3D([[100, 25, 0], [25, 50, 0], [0, 0, 0]]) >>> tensor.components array([[100, 25, 0], [ 25, 50, 0], [ 0, 0, 0]])
- class mechlab.mechanics.statics.StressTransform[source]
Bases:
objectSymbolic stress tensor transformation in 3D.
Uses direction cosines (l, m, n) to transform stress tensor from one coordinate system to another.
Example
>>> transform = StressTransform() >>> result = transform.transform() # Returns symbolic L * σ * L^T
- transform()[source]
Compute transformed stress tensor: σ’ = L * σ * L^T.
- Return type:
MutableDenseMatrix
- class mechlab.mechanics.statics.PrincipalStresses[source]
Bases:
objectCalculate principal stresses from stress tensor.
Principal stresses are the eigenvalues of the stress tensor, representing normal stresses on planes with no shear stress.
Example
>>> tensor = [[100, 25, 0], [25, 50, 0], [0, 0, 0]] >>> PrincipalStresses.calculate(tensor) [110.355..., 39.644..., 0.0]