0

I have an Assembly which only consist of one Part. I'm trying to get the TOTAL of every stress compoment of THE WHOLE Assembly/Part within Python. My problem with my current method is, that it takes ages to sum up the stress of each element(see the code below). The report files gvies me the Totals within a second, so there must be a better way to get to these values over the odb-file.

Thankful for any hint!

odb = session.openOdb(name='C:/temp/Job-1.odb')
step_1 = odb.steps['Step-1']
stress_1=step_1.frames[-1].fieldOutputs['S']
#Step-1
sum_Sxx_1=sum_Syy_1=sum_Szz_1=0
for el in range(numElemente):
Stress=stress_1.getSubset(region=Instance.elements[el],position=CENTROID, elementType='C3D8R').values
sum_Sxx_1 = sum_Sxx_1 + Stress[0].data[0]
sum_Syy_1 = sum_Syy_1 + Stress[0].data[1]
sum_Szz_1 = sum_Szz_1 + Stress[0].data[2]
  • you can access the integration point data quickly: look at `stressdata=stress_1.values` then `stressdata[i].data`. Getting the centroid value requires an extra calculation which is inevitably slow. There is of course hardly any sense to summing stresses that way, unless your elements are all the same size. – agentp May 24 '16 at 18:50

1 Answers1

0

Direct access by python to values is very slow indeed (I've experienced the same problems). You can write a report file with each value and then work with text files by python again. Just feed file line by line, find relevant line, split it to get stresses, sum them in and continue.

nikolay-pv
  • 76
  • 3
  • That's what I was doing too! But there is a quicker way to read the ODB-Files. Just check into the manual of Abaqus. They show you how to read it correctly. The Code I'm using above searches thorugh every element or so. but there is a other section of the odb where everythink is added up together already... – wasntme0804 Jul 14 '16 at 15:16
  • Then I think it is not a python code anymore, but c++(if I remember correctly), which you are using to access odb directly. – nikolay-pv Jul 14 '16 at 15:33
  • It's definately python. I have no clue from c++ and just starting to learn python... Check out "Abaqus Scripting User's Guide" Chapter 9.5. "Rading from an output database". In 9.5.10 they show you how to read dispalcements by using: for v in centerDisplace.values: print v.data[0] etc... Check it out. That's the way i finally did it. The report-file way still takes a second less, but it's not very elegant. Let me know if you figured it out. I can add and example in my upper post within the next couple days if you wish – wasntme0804 Jul 14 '16 at 15:44
  • I will check it, thanks. The report-file way is indeed not so elegant. However for some cases it is the only way I think. I am not sure odb has sum of all kinds stored values... – nikolay-pv Jul 14 '16 at 15:50