Commit ddc2863e authored by matecellab's avatar matecellab
Browse files

extracting LE from abaqus ODB

parent ec1b1ed4
"""
extract_LE.py
Extracts nodal logarithmic strains at the end of the simulation
Usage: abaqus python extract_LE.py -odb odbName
Arguments:
1. -odb : Name of the output database.
2. -help : Print usage
"""
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from odbAccess import *
from sys import argv,exit
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def rightTrim(input,suffix):
if (input.find(suffix) == -1):
input = input + suffix
return input
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def extractLE(odbName,elsetName):
""" Open the output database """
odb = openOdb(odbName)
assembly = odb.rootAssembly
softTissue = assembly.instances['LEG-1'].nodeSets['SOFTTISSUE']
LEHandle = open(odbName[:-4] + '.le', 'w')
if odb.steps['step-4'].totalTime > 0:
frame = odb.steps['step-4'].frames[-1]
time = frame.frameValue
# print frame.fieldOutputs
if frame.fieldOutputs.has_key('LE'):
print odbName,': about to extract final LE'
data = frame.fieldOutputs['LE']
ndata=data.getSubset(region=softTissue, position=ELEMENT_NODAL)
for value in ndata.values:
print >> LEHandle, '%f, %i, %f, %f, %f, %f, %f, %f'%(time,value.nodeLabel,value.data[0],value.data[1],value.data[2],value.data[3],value.data[4],value.data[5])
else:
print odbName,': No indentation occured, please adjust your expectations'
""" Close the output database before exiting the program """
odb.close()
#==================================================================
# S T A R T
#
if __name__ == '__main__':
odbName = None
elsetName = None
argList = argv
argc = len(argList)
i=0
while (i < argc):
if (argList[i][:2] == "-o"):
i += 1
name = argList[i]
odbName = rightTrim(name,".odb")
elif (argList[i][:2] == "-e"):
i += 1
elsetName = argList[i]
elif (argList[i][:2] == "-h"):
print __doc__
exit(0)
i += 1
if not (odbName):
print ' **ERROR** output database name is not provided'
print __doc__
exit(1)
extractLE(odbName,elsetName)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment