Hi
I have a big odb of 32GB with 5 instances. I am writing a script to output elemental principal stress and strain data. It takes 3 hours for getting 8 elements data associated with one node. If I do it manually in CAE, it would be much faster. The reason I am using script is because I need to process every 8 elements associated with >20 nodes. So I am wondering if you can help me optimize my script to speed up reading? I used timer to check how much time it takes to process each line and I found it takes long time when reading this line: for frame in frames: , Also it is much faster when reading 2nd time for another 8 elements for the other nodes. The first time reading is extremely slow. also, I am wondering if we can only read part of odb, for example, odb for a specific instance, when opening up odb? I don't find this method in the manual so far. Thank you so much for your help. I appreciate it.
Here is the script.
inst = odb_object.rootAssembly.instances[instance]
for elementL in NodalConnectivity:
ele = inst.getElementFromLabel(label=elementL)
ele_region_list.append(ele)
times = []
allstepkeys=odb_object.steps.keys()
steps_odb=odb_object.steps
framecount=0
for step in allstepkeys:
frames = steps_odb[step].frames
for frame in frames:
times.append(frame.frameValue)
allelesdata_thisframe=[]
for key_variable in ['S','E']:
fop = frame.fieldOutputs[key_variable]
for component in [1,2,3]:
alldata_thiscomponent =[fop.getSubset(region=ele_region,position=CENTROID).values[0].data[component-1] \
for ele_region in ele_region_list]
allelesdata_thisframe.extend(alldata_thiscomponent)