Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

python script to read J-Integral from odb file

Status
Not open for further replies.

DiegoSarzosa

Marine/Ocean
Apr 20, 2017
1
Hello:

My problem is very simple, I guess.

I want to extract the J-Integral values from the odb file. I have written the following script, see the next lines:
#######################################################
import odbAccess
names2=['J-Integral_test']
nameOfStep='Step-1'
Name=names2+'.odb'
myOdb = odbAccess.openOdb(path=Name)
lastStep=myOdb.steps[nameOfStep]
# using print command I figured out the keys for the region
# print lastStep.historyRegions.keys()
historyRegion=lastStep.historyRegions['ElementSet ALL ELEMENTS']
# again using print option I figured out the variables inside historyOutputs
for res in historyRegion.historyOutputs.keys():
print res
# The result of the previous print is:
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_01
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_02
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_03
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_04
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_05
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_06
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_07
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_08
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_09
#: J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_10
# ...
# ...
# ...
# The question is:
# What is the VariableName (???) that I must use to write the J-Integral values
historyOutputJ = historyRegion.historyOutputs['<VariableName>'].data
J-IntegralFile = open('Jval.dat','w')
for time,Jdata in historyOutputJ:
J-IntegralFile.write('%10.4E %10.4E\n' % (time, Jdata))
J-IntegralFile.close()

# I have tried for <VariableName>:_PICKEDSET4-1_;_PICKEDSET4-1__Contour_01; J at H-OUTPUT-1_CRACK-1__PICKEDSET4-1__Contour_0
# without success!
#If the result were displacement , the keyword for <VariableName> would be 'U'
##############################################################################
My question is:

What is the name of output variable regarding to J-Integral ?

Any idea?

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor