Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IRstuff on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Abaqus Python sum of Stress components

Status
Not open for further replies.

wasntme

Automotive
May 14, 2016
5
Hello everyone!
I'm trying to figure out if there is a quick and easy way on getting the sum of S11 for example.
The Script I wrote for this task is described below:
I first read out the centroidal S11 component of every Element of the model from the odb file and append it to a tuple.
In another for-loop I sum up all the components of that tuple.
The problem I have with this solution is, that it takes ages for bigger meshes.

By using the Abaqus report it "spits out the sums" within a couple second. Is there a more efficient way I can get acces to these summed values via python Script?

Let me know if there is anything unclear and thanks in advance!
 
Replies continue below

Recommended for you

Here are some point you could check or think about:

- Why don't you use the report?
- Why don't you use *El Print?
- Examples in the Users Scripting Guide show how to read data from the odb in an efficient way.
- Why don't you sum the data directly, instead of storing them?
- A tuple cannot be changed, so I think you store the data in a list.
- Exanding a list thousends of times is very inefficient. Create a large list at the beginning and assign the data or use a dictionary. See
 
Thanks for your tipps Mustaine3.

I tried summing the data directly. It does take less time, but still takes ages.
My workaround I managed today is that I create a report file for each step in which I have a couple of "Total" lines since there are more Sections.
The files are read via python and the Total lines are identified within the report-files and the 6 values are stored as a list. In another Step I then sum up the all the totals for each Stress component.

This only needs a couple of seconds, instead of 1.5 hours! :)

Thanks for your other tipps though!
 
hi,

I think if you go to Results -> Options you can uncheck the option "use region boundaries". Then when you generate your report you should only have one line for the totals. No python required if it works as i think it should.

Good Luck,
Dave
 
Wow, thanks Dave.
Great Tip. That would have made my scripting easier if I knew it ahead of time. I will definately still implement that!

I have another question regarding scripting and Materials libraries. Is there some easy way to add Materials into a Material library via scripting? (the *.lib file)
I'm aware that I can add Materials into the Material Module quite easily. But I don't think there is a way to add it into library file, or is there?

 
The Report-File Method works fine, but I can't believe there isn't a more direct way of getting to these values. Where is the Report-File getting them from?

There must be a more efficient method than what my original code is doing. See the code below. I'm trying to get the TOTAL of every stress compoment of THE WHOLE Assembly/Part within Python. The Assembly itself only consists of one Part.
Could I declare a Elementset as the region? Would this make any difference?
Thanks in advance.

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]​
 
Scripting USers Guide 9.5 Reading from an output database

There you'll see how it's done.
 
Thanks for pointing that out Mustaine. I figured it out now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor