LoginSignup
0
2

sympyで不静定はりを解く(単純梁編)

Last updated at Posted at 2018-06-20

オリジナル
sympyで不静定はりを解く

https://qiita.com/tehen_/items/78de14be5de482d84a26

参考資料

Statically indeterminate beams<

WolframAlpha

勉強中

単純梁(中心荷重)

単純梁(等分布荷重)

自乗の表示が間違っています。sympy

単純梁(中心荷重)

PartialScript.py
def _main():
    from sympy.core import symbols
    from sympy.plotting import plot

    l = symbols('l', positive=True, real=True)
    RA, RB = symbols('R_A, R_B')
    P = symbols('P')
    E, I = symbols('E, I')
    x = symbols('x')
    loads = [
        (-RA, 0, -1),
        (-RB, l, -1),
        (P, 0.5*l, -1),
        (0, 0, -2),
        (0, l, -2)
    ]

    b = Beam(l, E, I)
    for load in loads:
        b.apply_load(*load)
    b.bc_deflection = [
        (0, 0),
        (l, 0)
    ]

    b.solve_for_reaction_loads(RA, RB )
    print(b.reaction_loads)
    print("v(x)=",b.deflection())
    print("v(l/2)=",b.deflection().subs({x: 0.5*l}))
    print("  1/48=",1/48)

    # こことんでもなく雑な数字
    constants = {l: 1, P: 1, E: 1, I: 1}
    plot(
        # b.shear_force().subs(constants),
        b.bending_moment().subs(constants),
        # b.slope().subs(constants),
        # b.deflection().subs(constants),
        (b.variable, 0, b.length.subs(constants))
    )

if __name__ == '__main__':
    _main()
# {R_A: 0.5*P, R_B: 0.5*P}
# v(x)= (0.0625*P*l**2*x - 0.0833333333333333*P*SingularityFunction(x, 0, 3) + P*SingularityFunction(x, 0.5*l, 3)/6 - 0.0833333333333333*P*SingularityFunction(x, l, 3))/(E*I)
# v(l/2)= 0.0208333333333333*P*l**3/(E*I)
#   1/48= 0.020833333333333332

単純梁(等分布荷重)

PartialScript.py
def _main():
    from sympy.core import symbols
    from sympy.plotting import plot

    l = symbols('l', positive=True, real=True)
    RA, RB = symbols('R_A, R_B')
    E, I = symbols('E, I')
    x = symbols('x')
    w = symbols('w')

    loads = [
        (-RA, 0, -1),
        (-w, 0, 0, l),
        (-RB, l, -1),
        (0, 0, -2),
        (0, l, -2)
    ]

    b = Beam(l, E, I)
    for load in loads:
        b.apply_load(*load)
    b.bc_deflection = [
        (0, 0),
        (l, 0)
    ]

    b.solve_for_reaction_loads(RA, RB )
    print(b.reaction_loads)
    print("v(x)=",b.deflection())
    print("v(l/2)=",b.deflection().subs({x: 0.5*l}))
    print("-5/384=",-5/384)

    # こことんでもなく雑な数字
    constants = {l: 1, w: 1, E: 1, I: 1}
    plot(
        # b.shear_force().subs(constants),
        b.bending_moment().subs(constants),
        # b.slope().subs(constants),
        # b.deflection().subs(constants),
        (b.variable, 0, b.length.subs(constants))
    )

if __name__ == '__main__':
    _main()
# {R_A: -l*w/2, R_B: -l*w/2}
# v(x)= (-l**3*w*x/24 + l*w*SingularityFunction(x, 0, 3)/12 + l*w*SingularityFunction(x, l, 3)/12 - w*SingularityFunction(x, 0, 4)/24 + w*SingularityFunction(x, l, 4)/24)/(E*I)
# v(l/2)= -0.0130208333333333*l**4*w/(E*I)
# -5/384= -0.013020833333333334
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2