0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ひずみエネルギとそれを使った材料力学 基本例題8.28 P286 「材料力学演習(20221021)」をsympyのTrussでやってみた。

Last updated at Posted at 2025-05-30

・sympyのTrussで作図しました。(2025-06-16)

(旧タイトル)ひずみエネルギとそれを使った材料力学 基本例題8.28 P286 「材料力学演習(20221021)」をsympyでやってみた。
・作図はありません。(>形)でイメージして下さい。

オリジナル

基本例題8.28 P287
http://zairikiweb.starfree.jp/zai_enshuh/zai_enshuh_ver.3.3.pdf#page=292

「材料力学演習(20221021)一括(ver.3.3)」を勉強したい。>sympy
https://qiita.com/mrrclb48z/items/c3274daf5f7a99cfe027#%E4%BD%9C%E6%A5%AD%E4%B8%AD%E7%A7%81%E3%81%AE%E8%A7%A3%E7%AD%94sympy

sympyで

# (>形) 例題8.28
from sympy import *
var('P,Q,δ,λ,θ,l,AE')
θ  =pi/4
NAC=P*cos(θ)                ;NBC=-P*cos(θ)
U  =1/(2*AE)*NAC**2*l/cos(θ)+1/(2*AE)*NBC**2*l/cos(θ)
print("#",diff(U,P))
rep={P:1}
nAC=NAC.subs(rep);nBC=-NBC.subs(rep)
print("#",1/AE*NAC*nAC*l*cos(θ)+1/AE*NBC*nBC*l*cos(θ))
# sqrt(2)*P*l/AE
# 0

sympyのTrussで

ver1.1

# ver1.1
from sympy.physics.continuum_mechanics.truss import Truss
from sympy import *
var('P,dummyQ')
var('l,AE',positive=True)  
def myTruss(l):
    def myAdd_member(*args):
        def make_triples(s):
            return (s,s[0],s[1])
        for s in args:
            t.add_member(make_triples(s))      
    t = Truss()
    t.add_node     (('A',0,l*2),('B',0,0),('C',l,l) ) 
    myAdd_member   ( 'AC','CB')  
    t.apply_support(('A' ,'pinned'),('B','pinned'))
    t.apply_load   (('C',P     ,270))   
    t.apply_load   (('C',dummyQ,0))   
    return t
# -------------------------------------------------------------------------------------
myTruss(1).draw().show()       # 作図のため(l=1)
t=myTruss(l);t.solve()         # 計算のみ
U=sum({k:1/(2*AE)*v1**2*v2  \
       for (k,v1),(_,v2) in zip(t.internal_forces.items(),t.member_lengths.items())} \
       .values())
print('#',diff(U,P).simplify())
print('#',diff(U,dummyQ).subs({dummyQ:0}))
# sqrt(2)*P*l/AE
# 0

・縦横比は1:1では、ありません。
111.png

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?