def test_Beam3D(): l, E, G, I, A = symbols('l, E, G, I, A') R1, R2, R3, R4 = symbols('R1, R2, R3, R4') b = Beam3D(l, E, G, I, A) m, q = symbols('m, q') b.apply_load(q, 0, 0, dir="y") b.apply_moment_load(m, 0, 0, dir="z") b.bc_slope = [(0, [0, 0, 0]), (l, [0, 0, 0])] b.bc_deflection = [(0, [0, 0, 0]), (l, [0, 0, 0])] b.solve_slope_deflection() assert b.polar_moment() == 2 * I assert b.shear_force() == [0, -q * x, 0] assert b.bending_moment() == [0, 0, -m * x + q * x**2 / 2] expected_deflection = ( x * (A * G * q * x**3 / 4 + A * G * x**2 * (-l * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (A * G * l**2 + 12 * E * I) / 2 - m) + 3 * E * I * l * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (A * G * l**2 + 12 * E * I) + x * (-A * G * l**2 * q / 2 + 3 * A * G * l**2 * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (A * G * l**2 + 12 * E * I) / 4 + A * G * l * m * Rational(3, 2) - 3 * E * I * q)) / (6 * A * E * G * I)) dx, dy, dz = b.deflection() assert dx == dz == 0 assert dy == expected_deflection b2 = Beam3D(30, E, G, I, A, x) b2.apply_load(50, start=0, order=0, dir="y") b2.bc_deflection = [(0, [0, 0, 0]), (30, [0, 0, 0])] b2.apply_load(R1, start=0, order=-1, dir="y") b2.apply_load(R2, start=30, order=-1, dir="y") b2.solve_for_reaction_loads(R1, R2) assert b2.reaction_loads == {R1: -750, R2: -750} b2.solve_slope_deflection() assert b2.slope() == [ 0, 0, x**2 * (50 * x - 2250) / (6 * E * I) + 3750 * x / (E * I) ] expected_deflection = ( x * (25 * A * G * x**3 / 2 - 750 * A * G * x**2 + 4500 * E * I + 15 * x * (750 * A * G - 10 * E * I)) / (6 * A * E * G * I)) dx, dy, dz = b2.deflection() assert dx == dz == 0 assert dy == expected_deflection # Test for solve_for_reaction_loads b3 = Beam3D(30, E, G, I, A, x) b3.apply_load(8, start=0, order=0, dir="y") b3.apply_load(9 * x, start=0, order=0, dir="z") b3.apply_load(R1, start=0, order=-1, dir="y") b3.apply_load(R2, start=30, order=-1, dir="y") b3.apply_load(R3, start=0, order=-1, dir="z") b3.apply_load(R4, start=30, order=-1, dir="z") b3.solve_for_reaction_loads(R1, R2, R3, R4) assert b3.reaction_loads == {R1: -120, R2: -120, R3: -1350, R4: -2700}
def test_Beam3D(): l, E, G, I, A = symbols('l, E, G, I, A') R1, R2, R3, R4 = symbols('R1, R2, R3, R4') b = Beam3D(l, E, G, I, A) m, q = symbols('m, q') b.apply_load(q, 0, 0, dir="y") b.apply_moment_load(m, 0, 0, dir="z") b.bc_slope = [(0, [0, 0, 0]), (l, [0, 0, 0])] b.bc_deflection = [(0, [0, 0, 0]), (l, [0, 0, 0])] b.solve_slope_deflection() assert b.shear_force() == [0, -q * x, 0] assert b.bending_moment() == [0, 0, -m * x + q * x**2 / 2] expected_deflection = (-l**2 * q * x**2 / (12 * E * I) + l**2 * x**2 * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (8 * E * I * (A * G * l**2 + 12 * E * I)) + l * m * x**2 / (4 * E * I) - l * x**3 * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (12 * E * I * (A * G * l**2 + 12 * E * I)) - m * x**3 / (6 * E * I) + q * x**4 / (24 * E * I) + l * x * (A * G * l * (l * q - 2 * m) + 12 * E * I * q) / (2 * A * G * (A * G * l**2 + 12 * E * I)) - q * x**2 / (2 * A * G)) dx, dy, dz = b.deflection() assert dx == dz == 0 assert simplify(dy - expected_deflection) == 0 # == doesn't work b2 = Beam3D(30, E, G, I, A, x) b2.apply_load(50, start=0, order=0, dir="y") b2.bc_deflection = [(0, [0, 0, 0]), (30, [0, 0, 0])] b2.apply_load(R1, start=0, order=-1, dir="y") b2.apply_load(R2, start=30, order=-1, dir="y") b2.solve_for_reaction_loads(R1, R2) assert b2.reaction_loads == {R1: -750, R2: -750} b2.solve_slope_deflection() assert b2.slope() == [ 0, 0, 25 * x**3 / (3 * E * I) - 375 * x**2 / (E * I) + 3750 * x / (E * I) ] expected_deflection = (25 * x**4 / (12 * E * I) - 125 * x**3 / (E * I) + 1875 * x**2 / (E * I) - 25 * x**2 / (A * G) + 750 * x / (A * G)) dx, dy, dz = b2.deflection() assert dx == dz == 0 assert simplify(dy - expected_deflection) == 0 # == doesn't work # Test for solve_for_reaction_loads b3 = Beam3D(30, E, G, I, A, x) b3.apply_load(8, start=0, order=0, dir="y") b3.apply_load(9 * x, start=0, order=0, dir="z") b3.apply_load(R1, start=0, order=-1, dir="y") b3.apply_load(R2, start=30, order=-1, dir="y") b3.apply_load(R3, start=0, order=-1, dir="z") b3.apply_load(R4, start=30, order=-1, dir="z") b3.solve_for_reaction_loads(R1, R2, R3, R4) assert b3.reaction_loads == {R1: -120, R2: -120, R3: -1350, R4: -2700}
def test_max_bending_moment_Beam3D(): x = symbols('x') b = Beam3D(20, 40, 21, 100, 25) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] assert b.max_bmoment() == [(0, 0), (20, 3000), (20, 16000)]
def test_max_shear_force_Beam3D(): x = symbols('x') b = Beam3D(20, 40, 21, 100, 25) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] assert b.max_shear_force() == [(0, 0), (20, 2400), (20, 300)]
def test_max_deflection_Beam3D(): x = symbols('x') b = Beam3D(20, 40, 21, 100, 25) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] b.solve_slope_deflection() c = sympify("495/14") p = sympify("-10 + 10*sqrt(10793)/43") q = sympify( "(10 - 10*sqrt(10793)/43)**3/160 - 20/7 + (10 - 10*sqrt(10793)/43)**4/6400 + 20*sqrt(10793)/301 + 27*(10 - 10*sqrt(10793)/43)**2/560" ) assert b.max_deflection() == [(0, 0), (10, c), (p, q)]
def test_polar_moment_Beam3D(): l, E, G, A, I1, I2 = symbols('l, E, G, A, I1, I2') I = [I1, I2] b = Beam3D(l, E, G, I, A) assert b.polar_moment() == I1 + I2
from sympy.physics.continuum_mechanics.beam import Beam3D from sympy import symbols l, E, G, I, A, x = symbols('l, E, G, I, A, x') b = Beam3D(20, E, G, I, A, x) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] R1, R2, R3, R4 = symbols('R1, R2, R3, R4') b.apply_load(R1, start=0, order=-1, dir="z") b.apply_load(R2, start=20, order=-1, dir="z") b.apply_load(R3, start=0, order=-1, dir="y") b.apply_load(R4, start=20, order=-1, dir="y") b.solve_for_reaction_loads(R1, R2, R3, R4) b.plot_bending_moment() # PlotGrid object containing: # Plot[0]:Plot object containing: # [0]: cartesian line: 0 for x over (0.0, 20.0) # Plot[1]:Plot object containing: # [0]: cartesian line: -15*x**2/2 for x over (0.0, 20.0) # Plot[2]:Plot object containing: # [0]: cartesian line: 2*x**3 for x over (0.0, 20.0)
from sympy.physics.continuum_mechanics.beam import Beam3D from sympy import symbols l, E, G, I, A, x = symbols('l, E, G, I, A, x') b = Beam3D(20, 40, 21, 100, 25, x) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] R1, R2, R3, R4 = symbols('R1, R2, R3, R4') b.apply_load(R1, start=0, order=-1, dir="z") b.apply_load(R2, start=20, order=-1, dir="z") b.apply_load(R3, start=0, order=-1, dir="y") b.apply_load(R4, start=20, order=-1, dir="y") b.solve_for_reaction_loads(R1, R2, R3, R4) b.solve_slope_deflection() b.plot_slope() # PlotGrid object containing: # Plot[0]:Plot object containing: # [0]: cartesian line: 0 for x over (0.0, 20.0) # Plot[1]:Plot object containing: # [0]: cartesian line: -x**3/1600 + 3*x**2/160 - x/8 for x over (0.0, 20.0) # Plot[2]:Plot object containing: # [0]: cartesian line: x**4/8000 - 19*x**2/172 + 52*x/43 for x over (0.0, 20.0)
from sympy.physics.continuum_mechanics.beam import Beam3D from sympy import symbols l, E, G, I, A, x = symbols('l, E, G, I, A, x') b = Beam3D(20, E, G, I, 2, x) b.apply_load(15, start=0, order=0, dir="z") b.apply_load(12 * x, start=0, order=0, dir="y") b.bc_deflection = [(0, [0, 0, 0]), (20, [0, 0, 0])] R1, R2, R3, R4 = symbols('R1, R2, R3, R4') b.apply_load(R1, start=0, order=-1, dir="z") b.apply_load(R2, start=20, order=-1, dir="z") b.apply_load(R3, start=0, order=-1, dir="y") b.apply_load(R4, start=20, order=-1, dir="y") b.solve_for_reaction_loads(R1, R2, R3, R4) b.plot_shear_stress() # PlotGrid object containing: # Plot[0]:Plot object containing: # [0]: cartesian line: 0 for x over (0.0, 20.0) # Plot[1]:Plot object containing: # [0]: cartesian line: -3*x**2 for x over (0.0, 20.0) # Plot[2]:Plot object containing: # [0]: cartesian line: -15*x/2 for x over (0.0, 20.0)