News:

SMF - Just Installed!

Main Menu

ODB temperature reader

Started by Mark Barkey, December 10, 2016, 02:40:54 AM

Previous topic - Next topic

Mark Barkey


#read selected frame results for nodal temperatures from ODB file
#M. E. Barkey
# 9 December 2016



#with reference from python code from Mustaine
#ww3.cad.de/foren/ubb/Forum254/HTML/000798.shmtl
#and
#www.eng-tips.com/viewthread.cfm?qid=306565




import sys
from odbAccess import *
from abaqusConstants import *
from types import IntType
from numpy import array


odbName = 'spt1'
odb = openOdb(odbName + '.odb', readOnly=False)


print'------------------------------------------------'
print'This step will be read from the ODB'
#this is the step just as it is labeled in the ODB when the input file was analyzed
steptoread=odb.steps['Step-2']
print' selected step:  ', steptoread.name
print ''
print'------------------------------------------------'
#frame 0 is the first frame
# from -1 is the last frame
#these are the same frame numbers that are in the ODB
frametoread=steptoread.frames[4]

#this grabs only the NT11 field data
print'Only write out the NT11 (temperature) field from this frame of this step.'
odbSelectResults=frametoread.fieldOutputs['NT11']

#this was written for ABAQUS 6.14-2, the following may be different for other verions
#values in the field odbSelectResults
#here is an example with data in it
#({'baseElementType': '', 'conjugateData': None, 'conjugateDataDouble': 'unknown', 'data': 570.72705078125,
#'dataDouble': 'unknown', 'elementLabel': None, 'face': None, 'instance': 'OdbInstance object',
#'integrationPoint': None, 'inv3': None, 'localCoordSystem': None, 'localCoordSystemDouble': 'unknown',
#'magnitude': None, 'maxInPlanePrincipal': None, 'maxPrincipal': None, 'midPrincipal': None, 'minInPlanePrincipal': None,
#'minPrincipal': None, 'mises': None, 'nodeLabel': 41313, 'outOfPlanePrincipal': None, 'position': NODAL,
#'precision': SINGLE_PRECISION, 'press': None, 'sectionPoint': None, 'tresca': None, 'type': SCALAR})

#this is to get the nodes in the root assembly
#nodes = odbSelectResults.getSubset(region=odb.rootAssembly.nodeSets[' ALL NODES'])

#this will show the fields that are in nodes
#print nodes

print '-------------------------------------------'

print 'selected results  ', odbSelectResults.name

t = odbSelectResults

print
print '-------------------------------------------'

#this prints out the data (temperature) of element 50 in t
#print t.values[50].data

#this prints out the 0-10 elements of t
#for n in range (0,10):
# print t.values[n].data

#this prints out the nodeLabels and data (temperature) for the nodes
#this is a loop for all the number of entries in the tuple
#notice that nodeLabel and data are fields from above and that any of these fields can be included in the statement
#they must be spelled correctly including capitalization

for x in t.values:
    print x.nodeLabel, x.data
   

   
text = 'This is a header line'   
for x in t.values:
    output = str(x.nodeLabel) +'\t'+str(x.data)
    text = '\n'.join([text, output])
   
data = file('results.xls', 'w')   
data.write(text)
data.close()
   


odb.close()



Wahid

Hello,

How to add lines in the program to read and display the maximum temperature.

I will be very grateful for your help.