I've seen several examples on the internet of how to get the highest Von Mises stress from an instance. However, in my simulation there are 4 geometries (ie 4 instances) and my code is only evaluating the Von Mises stress in a single instance (disregarding the other three). Can anybody help me?
Put a "for" so that it would call the 4 instances, but even so it still insists on always getting 1 instance.
from abaqus import *
from abaqusConstants import *
from caeModules import *
from driverUtils import executeOnCaeStartup
from odbAccess import *
import numpy
import itertools
import math
import csv
odb = session.openOdb(job_name)
session.viewports['Viewport: 1'].setValues(displayedObject=odb)
assembly = odb.rootAssembly
frame=-1
f2=odb.steps['Step-1'].frames[frame]
max_stress = 0
for name, instance in assembly.instances.items():
f = f2.fieldOutputs['S'].values[0].instance.elements
tam_elemento = len(f)
print 'Instance: %s \n Elementos: %d'%(name,tam_elemento)
for k in range(len(f)):
element_mises_stress = f2.fieldOutputs['S'].values[k].mises
if element_mises_stress > max_stress:
max_stress_element_label = f2.fieldOutputs['S'].values[k].elementLabel
field_output_stress_object_index = k
max_stress = element_mises_stress
print 'Mises: %f' % (max_stress)