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

时间:2017-11-15 15:49:37

标签: python open-source

我在问莫里茨这个问题:

我设法运行程序(ubuntu-linux-tested分支)并上传.uff文件。当我执行分析时,它也可以正常工作,但我如何提取模态参数(特征频率,阻尼和模式形状)。当我点击导出并选择分析结果时,它会保存一个几乎为空的.uff文件(参见.txt文件)

提前谢谢!!

1 个答案:

答案 0 :(得分:1)

目前,模态向量尚未以uff的形式导出 用python打开保存的* .mdd文件(mdd文件实际上是pickle数据)。 在数据中,您将找到几何数据,模态向量等。

这是执行此操作的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()