有限元计算只能得到杆单元两端的节点位移和内力,单元任意截面的位移和内力需要通过迭加原理得到。
如图所示,单元内有均布荷载。由单元两端节点的位移引起单元内部任意截面位移可以通过插值得到。设
其中
把单元节点位移值代入得到
记为
在单元两端固定时,由材料力学可知任意截面的位移为
记,则
单元内部总位移
单元任意截面弯矩
单元任意截面剪力
[例]两端固定的梁,跨度,均布荷载,作为一个单元考虑时,单元两端节点的位移求任意截面的位移,弯矩,剪力以及画弯矩图,剪力图代码如下
代码语言:javascript复制import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.sans-serif'] = ['SimHei'] # 正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False # 正常显示负号
q = -1
l = 3
x = np.linspace(0, l, 18)
EI = 1
l2 = l**2
l3 = l**3
l4 = l**4
invA = np.array([[1, 0, 0, 0],
[ 0, 1, 0, 0],
[ -3/l2, -2/l, 3/l2, -1/l],
[ 2/l3, 1/l2, -2/l3, 1/l2] ])
ue = np.array([ [0],[0],[0],[0] ]) #杆端节点位移
uq = np.array([[0], [0], [q*l4/(24*EI)], [q*l3/(6*EI)] ])
u = ue - uq
B = np.dot(invA,u)
w = np.zeros(len(x))
M = np.zeros(len(x))
V = np.zeros(len(x))
for i in range( len(x) ):
pt = np.array([1, x[i], x[i]**2, x[i]**3])
pt2 = np.array([0, 0, 2, x[i]*6])
pt3 = np.array([0, 0, 0, 6])
w[i] = np.dot(pt, B)
w[i] = w[i] q*x[i]**4/(24*EI)
M[i] = np.dot(pt2, B)
M[i] = M[i]*EI q*x[i]**2 /2
V[i] = np.dot(pt3, B)
V[i] = -V[i]*EI - q*x[i]
x1 = np.array( [0] )
x2 = np.array( x[-1] )
xx = np.hstack( (x1, x, x2) )
m1 = np.array( [ 0 ] )
MM = np.hstack( (m1, M, m1) )
v1 = np.array( [ 0 ] )
VV = np.hstack( (v1, V, v1) )
fig, axs = plt.subplots(2, 1, figsize=(8,6) )
axs[0].plot(xx, -MM, label="M1", linewidth = 3)
axs[0].plot([0, x[-1]],[0,0], linewidth = 2, color = "dimgrey")
axs[0].set_ylabel('弯矩', fontsize = 18)
axs[1].plot(xx, -VV, label="M1", linewidth=3)
axs[1].plot([0, x[-1]],[0,0], linewidth = 2, color = "dimgrey")
axs[1].set_ylabel('剪力', fontsize = 18)
fig.savefig('./f115.png', dpi = 400) #保存图片
plt.show()
弯矩图剪力图