以下答案由GPT-3.5大模型与博主波罗歌共同编写:
在分析窗口中选择下表面,在菜单栏选择“Edit”->“Reference Point”->“Create Reference Point”,新建一个参考点,分析窗口会出现一个绿点表示参考点位置。
然后,在下表面所施加的边界条件强度处,建立一个反向集合,命名为“Constraint Set”。
在菜单栏选择“Output”->“History Output”,在“History Output”窗口中点击“Create Output”。
在“Create XY Data”窗口中,选择“Type = Force”,“Category = Reaction Force”,“Set = Constraint Set”,“Region = Reference Point”。
点击“OK”,可以添加一个图形“Force vs. Time”。这张图将显示上表面在时间内所受到的冲击力。
代码实现:
# 提取冲击力
import numpy as np
import matplotlib.pyplot as plt
# 读取odb文件
import odbAccess
odb_name = 'example.odb'
odb_path = 'D:/path/to/odb/file/'
odb = odbAccess.openOdb(path=odb_path+odb_name)
step_name = odb.steps.keys()[0]
step = odb.steps[step_name]
ref_pt = odb.rootAssembly.instances['PART-1-1'].referencePoints[1]
time = []
RF1 = []
RF2 = []
RF3 = []
for frame in step.frames:
time.append(frame.frameValue)
reaction_force = frame.fieldOutputs['RF']
force_at_ref_pt = reaction_force.getSubset(region=ref_pt)
RF1.append(force_at_ref_pt.values[0].data[0])
RF2.append(force_at_ref_pt.values[0].data[1])
RF3.append(force_at_ref_pt.values[0].data[2])
time = np.array(time)
RF = np.sqrt(np.array(RF1) ** 2 + np.array(RF2) ** 2 + np.array(RF3) ** 2)
plt.plot(time, RF)
plt.xlabel('Time (s)')
plt.ylabel('Reaction Force (N)')
plt.show()
如果我的回答解决了您的问题,请采纳!