如何从程序OpenMod导出模态数据

2024-05-29 05:19:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我要问莫里茨这个问题:

我成功地运行了这个程序(ubuntulinuxtestedbranch)并上传了一个.uff文件。当我进行分析时,它也能正常工作,但是我如何提取模态参数(固有频率、阻尼和振型)。当我单击export并选择分析结果时,它保存了一个几乎为空的.uff文件(参见.txt文件)

提前谢谢你!!在


Tags: 文件程序txt参数export模态uff阻尼
1条回答
网友
1楼 · 发布于 2024-05-29 05:19:32

当前模态向量还没有在uff中导出,您必须 用python打开保存的*.mdd文件(mdd文件实际上是pickled数据)。 在数据中可以找到几何数据、模态向量等

下面是执行此操作的python代码(另请参见:https://github.com/openmodal/OpenModal/issues/31):

import OpenModal as OM # In order to reload modules to new location when unpickling files
import pickle
import sys
import pandas as pd

sys.modules['openModal'] = OM  # In order to reload modules to new location when unpickling files
## see: https://stackoverflow.com/questions/13398462/unpickling-python-objects-with-a-changed-module-path

file_name=r'beam_accel.mdd'
f = open(file_name, 'rb')
data = pickle.load(f)

writer = pd.ExcelWriter('output.xlsx')
data[0].tables['analysis_index'].astype(str).to_excel(writer, 'index')
data[0].tables['analysis_values'].astype(str).to_excel(writer, 'values')
writer.save()

相关问题 更多 >

    热门问题