def test_moment_for_fixed_cantilevered_beam_with_load_at_end(): P = -1000 # load in lbs down L = 25 # length of beam in inches E = 29e6 # Young's modulus in psi Ixx = 345 # area moment of inertia in in**4 # function to calculate moment anywhere along the length of the beam m = lambda x: P * x beam = Beam(L, [PointLoad(P, 0)], [FixedReaction(L)], E, Ixx) for x in [7, 12.5, 25]: # check the deflection of the beam at both end points, and the center assert pytest.approx(beam.moment(x), rel=0.01) == m(x), \ f"Calculated moment does not match expected moment at {x}" with pytest.warns(UserWarning): beam.moment(0)
def test_cantilevered_beam_load_at_end(): """fixed beam with concentrated load at free end case 13 """ R = -P M_max = P * L # at fixed end d_max = P * L**3 / (3 * EI) # at free end beam = Beam( length=L, loads=[PointLoad(magnitude=P, location=0)], reactions=[FixedReaction(L)], E=E, Ixx=Ixx, ) beam.solve() validate(beam, loc=0, R=[(R, M_max)], M_loc=0, d_loc=d_max) assert pytest.approx(beam.moment(L), rel=TOL) == M_max