【发布时间】:2021-02-03 08:22:49
【问题描述】:
我正在 Abaqus 中执行由两个板的影响组成的模拟。假设模拟有 100 帧,我想要的是沿着特定帧的路径提取数据。我编写了这个 Python 脚本来从所有帧的所有节点中提取速度和 mises 数据(txt 文件很大),但我只想针对给定帧的一组数据执行此操作。有谁知道如何创建一个节点集或路径,然后沿该集或路径提取特定帧的数据?
从 abaqus 导出数据的脚本:
import time
import numpy as np
from numpy import savetxt
import math
from odbAccess import *
from textRepr import *
import os, sys
#import matplotlib.pyplot
start_time = time.time()
path = (os.getcwd())
odbName = '%s/Job-1.odb'%path
odb = openOdb(odbName, readOnly=True)
myAssembly = odb.rootAssembly.instances['FIXED-1']
newpath = 'results'
if not os.path.exists(newpath):
os.makedirs(newpath)
steps1 = odb.steps['Step-1'].frames
currentframe1 = []
for c_elem in range(len(steps1)):
currentframe1 = steps1[c_elem]
mises = []
velocity = []
strain = []
displacement = []
fieldvalues_mises = currentframe1.fieldOutputs['S']
fieldvalues_velocity = currentframe1.fieldOutputs['V']
fieldvalues_displacement = currentframe1.fieldOutputs['U']
fieldvalues_strain = currentframe1.fieldOutputs['LE']
vel_set = fieldvalues_velocity.values
disp_set = fieldvalues_displacement.values
mises_set = fieldvalues_mises.values
strain_set = fieldvalues_strain.values
for v in vel_set:
velocity.append(v.data)
for s in strain_set:
strain.append(s.data)
for m in mises_set:
mises.append(m.data)
for d in disp_set:
displacement.append(d.data)
# Vector of frames
vector_frame = c_elem*[1]
with open('velocityFile.txt', 'w') as f:
for i in range(1,len(vector_frame)+1):
f.write('\n\n')
for j in velocity:
f.write(str(j) + 3*' ')
with open('misesFile.txt', 'w') as f:
for i in range(1,len(vector_frame)+1):
f.write('\n\n')
for j in mises:
f.write(str(j) + 3*' ')
【问题讨论】: