Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to output max stress from each increment?

Status
Not open for further replies.

mechengmikey

Mechanical
Sep 8, 2013
5
Hi,

I have a quick questions regarding how to output the result I am after.

Basically I have a model that has 2 gears meshing, during step 3 the gears rotate and there are 400 increments.

The result I would like is the maximum stress during each increment. I am not concerned about each individual node or element, I purely want to know the maximum at each increment.

I can only work out how to find the maximum for each element at this stage, but as the maximum stress moves along the gear teeth this output is not very helpful.

Does anyone know how I can output the results?

Thanks
-Mikey
 
Replies continue below

Recommended for you

look at the scripting manual:
“Finding the maximum value of von Mises stress,” Section 9.10.1
This pretty much does exactly what you are looking for.
 
Thanks for that.

Unfortunately I never never scripted with Abaqus, I have only used the interface by clicking buttons.

Can you explain how I would use that code to extract the results?

Thanks
 
Just save the example script, and run it using

abaqus python odbMaxMises.py -odb yourODB.odb
If you want to list max stress over all frames, put the print (or save to text) inside the loop
 
OK, I'm not sure how to save the text to a .py file? any idea how I do that?

Is this exactly what I need to copy (including the bits at the top)? Also what bits will be needed to be changed specific to my files?

abaqus fetch job=odbMaxMises.py
abaqus fetch job=viewer_tutorial
"""
odbMaxMises.py
Code to determine the location and value of the maximum
von-mises stress in an output database.
Usage: abaqus python odbMaxMises.py -odb odbName
-elset(optional) elsetName
Requirements:
1. -odb : Name of the output database.
2. -elset : Name of the assembly level element set.
Search will be done only for element belonging
to this set. If this parameter is not provided,
search will be performed over the entire model.
3. -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 getMaxMises(odbName,elsetName):
""" Print max mises location and value given odbName
and elset(optional)
"""
elset = elemset = None
region = "over the entire model"
""" Open the output database """
odb = openOdb(odbName)
assembly = odb.rootAssembly

""" Check to see if the element set exists
in the assembly
"""
if elsetName:
try:
elemset = assembly.elementSets[elsetName]
region = " in the element set : " + elsetName;
except KeyError:
print 'An assembly level elset named %s does' 'not exist in the output database %s' % (elsetName, odbName)
odb.close()
exit(0)

""" Initialize maximum values """
maxMises = -0.1
maxElem = 0
maxStep = "_None_"
maxFrame = -1
Stress = 'S'
isStressPresent = 0
for step in odb.steps.values():
print 'Processing Step:', step.name
for frame in step.frames:
allFields = frame.fieldOutputs
if (allFields.has_key(Stress)):
isStressPresent = 1
stressSet = allFields[Stress]
if elemset:
stressSet = stressSet.getSubset(
region=elemset)
for stressValue in stressSet.values:
if (stressValue.mises > maxMises):
maxMises = stressValue.mises
maxElem = stressValue.elementLabel
maxStep = step.name
maxFrame = frame.incrementNumber
if(isStressPresent):
print 'Maximum von Mises stress %s is %f in element %d'%(
region, maxMises, maxElem)
print 'Location: frame # %d step: %s '%(maxFrame,maxStep)
else:
print 'Stress output is not available in' 'the output database : %s\n' %(odb.name)

""" 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[:2] == "-o"):
i += 1
name = argList
odbName = rightTrim(name,".odb")
elif (argList[:2] == "-e"):
i += 1
elsetName = argList
elif (argList[:2] == "-h"):
print __doc__
exit(0)
i += 1
if not (odbName):
print ' **ERROR** output database name is not provided'
print __doc__
exit(1)
getMaxMises(odbName,elsetName)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor