def test_clamped_distributed(): # {{{1 """Clamped beam with distributed load""" results = bm.solve(L, None, bm.DistLoad(force=P, start=0, end=L), np.ones(L + 1) * E * Ix, np.ones(L + 1) * G * A, np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False) deflection_bm = results.y[L] deflection_formula = P * L**3 / (8 * E * Ix) reldiff = abs((deflection_bm - deflection_formula) / deflection_formula) assert reldiff < 0.005
def test_supported_distributed(): # {{{1 """Ends supported beam with distributed load""" results = bm.solve(L, (0, L), bm.DistLoad(force=P, start=0, end=L), np.ones(L + 1) * E * Ix, np.ones(L + 1) * G * A, np.ones(L + 1) * H / 2, -np.ones(L + 1) * H / 2, False) deflection_bm = results.y[int(L / 2)] deflection_formula = 5 * P * L**3 / (384 * E * Ix) reldiff = abs((deflection_bm - deflection_formula) / deflection_formula) assert reldiff < 0.005
def test_supported_distributed(): # {{{1 """Ends supported beam with distributed load""" problem = {'length': L, 'EI': np.ones(L+1)*E*I, 'GA': np.ones(L+1)*G*A, 'top': np.ones(L+1)*H/2, 'bot': -np.ones(L+1)*H/2, 'supports': (0, L), 'shear': False, 'loads': bm.DistLoad(force=P, start=0, end=L)} bm.solve(problem) deflection_bm = problem['y'][L/2] deflection_formula = 5*P*L**3/(384*E*I) reldiff = abs((deflection_bm-deflection_formula)/deflection_formula) assert reldiff < 0.005