You can use following way to do it for a single frame: stress_tensor = odb.steps['Step-1'].frames[0].fieldOutputs['S'] This is stress tensor (6 components) for while assembly. From stress tensor, get the components: s1 = stress_tensor.getScalarField(componentLabel='S11') s2 = stress_tensor.getScalarField(componentLabel='S22') Here, s1 and s2 are the stress components S11 and S22 for whole assembly. Now to add just do following: s1_s2 = s1 + s2 Now access the data as array as, arr = s1_s2.bulkDataBlocks Now to write the data to text file, fout = open( 'out_file.csv', 'w') fout.close() fout = open( 'out_file.csv', 'a') import numpy for data in arr: numpy.savetxt(fout, data) fout.close() Then you can use for loop to create a report for all the steps and frames. For more details, please write an email. You find it in the "About" section.
Hello sir, The explaination is really amazing and thanks for making it easy. My doubt is, Could we loop over the index for frame in order to write report for all the frames, for eg, like basic for loop?
I appreciated your all efforts, great job.
Thank you. That means a lot.😊
Great video
Lets say that I want to add Stress 1 to Stress 2 for every frame at every element and put that new variable into the report. How could you do that?
You can use following way to do it for a single frame:
stress_tensor = odb.steps['Step-1'].frames[0].fieldOutputs['S']
This is stress tensor (6 components) for while assembly.
From stress tensor, get the components:
s1 = stress_tensor.getScalarField(componentLabel='S11')
s2 = stress_tensor.getScalarField(componentLabel='S22')
Here, s1 and s2 are the stress components S11 and S22 for whole assembly.
Now to add just do following:
s1_s2 = s1 + s2
Now access the data as array as,
arr = s1_s2.bulkDataBlocks
Now to write the data to text file,
fout = open( 'out_file.csv', 'w')
fout.close()
fout = open( 'out_file.csv', 'a')
import numpy
for data in arr:
numpy.savetxt(fout, data)
fout.close()
Then you can use for loop to create a report for all the steps and frames.
For more details, please write an email. You find it in the "About" section.
Hello sir, The explaination is really amazing and thanks for making it easy.
My doubt is, Could we loop over the index for frame in order to write report for all the frames, for eg, like basic for loop?
YES. We can. As it is iterable, we can iterate it.