Abaqus Python sum of Stress components
Abaqus Python sum of Stress components
(OP)
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!
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-
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!





RE: Abaqus Python sum of Stress components
- 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 http://www.tek-tips.com/viewthread.cfm?qid=1750484
RE: Abaqus Python sum of Stress components
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!
RE: Abaqus Python sum of Stress components
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
RE: Abaqus Python sum of Stress components
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?
RE: Abaqus Python sum of Stress components
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):
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]
RE: Abaqus Python sum of Stress components
There you'll see how it's done.
RE: Abaqus Python sum of Stress components