import odbAccess
odb = session.openOdb('case14.odb')
Moment = 'SM'
Stress ='S'
elemset = odb.rootAssembly.instances['PART-1-1'].elementSets['BEAMELEM']
maxMises = -0.1
maxSM1 = 0.0
maxSM2 = 0.0
maxSM3 = 0.0
maxStep1 = "_None_"
maxStep2 = "_None_"
maxStep3 = "_None_"
maxStep4 = "_None_"
maxFrame1 = -1
maxFrame2 = -1
maxFrame3 = -1
maxFrame4 = -1
i = 1
for step in odb.steps.values():
# print 'Processing Step:', step.name
for frame in step.frames:
# print 'frame inc:', frame.incrementNumber
# print 'frame no:', i
allFields = frame.fieldOutputs
stressSet = allFields[Stress]
momentSet = allFields[Moment]
stressSet = stressSet.getSubset(region=elemset)
momentSet = momentSet.getSubset(region=elemset)
for stressValue in stressSet.values:
if (stressValue.mises > maxMises):
maxMises = stressValue.mises
maxElem1 = stressValue.elementLabel
maxStep1 = step.name
maxFrame1 = i
for momentValue in momentSet.values:
if (abs(momentValue.data[0]) > abs(maxSM1)):
maxSM1 = momentValue.data[0]
maxElem2 = stressValue.elementLabel
maxStep2 = step.name
maxFrame2 = i
if (abs(momentValue.data[1]) > abs(maxSM2)):
maxSM2 = momentValue.data[1]
maxElem3 = stressValue.elementLabel
maxStep3 = step.name
maxFrame3 = i
if (abs(momentValue.data[2]) > abs(maxSM3)):
maxSM3 = momentValue.data[2]
maxElem4 = stressValue.elementLabel
maxStep4 = step.name
maxFrame4 = i
i = i + 1
OutStressMomentfile = open('stressmoment.txt','w+')
print 'Maximun Mises %f in elem %d frame # %d Step: %s'%(maxMises,maxElem1, maxFrame1,maxStep1)
OutStressMomentfile.write(' Max Mises: ')
OutStressMomentfile.write(str(maxMises))
OutStressMomentfile.write(' in elem: ')
OutStressMomentfile.write(str(maxElem1))
OutStressMomentfile.write(' at frame: ')
OutStressMomentfile.write(str(maxFrame1))
OutStressMomentfile.write(' at step: ')
OutStressMomentfile.write(maxStep1)
OutStressMomentfile.write('\n')
print 'Maximun SM1 %f in elem %d frame # %d Step: %s'%(maxSM1,maxElem2, maxFrame2,maxStep2)
OutStressMomentfile.write(' MaxSM1: ')
OutStressMomentfile.write(str(maxSM1))
OutStressMomentfile.write(' in elem: ')
OutStressMomentfile.write(str(maxElem2))
OutStressMomentfile.write(' at frame: ')
OutStressMomentfile.write(str(maxFrame2))
OutStressMomentfile.write(' at step: ')
OutStressMomentfile.write(maxStep2)
OutStressMomentfile.write('\n')
print 'Maximun SM2 %f in elem %d frame # %d Step: %s'%(maxSM2,maxElem3, maxFrame3,maxStep3)
OutStressMomentfile.write(' MaxSM2: ')
OutStressMomentfile.write(str(maxSM2))
OutStressMomentfile.write(' in elem: ')
OutStressMomentfile.write(str(maxElem3))
OutStressMomentfile.write(' at frame: ')
OutStressMomentfile.write(str(maxFrame3))
OutStressMomentfile.write(' at step: ')
OutStressMomentfile.write(maxStep3)
OutStressMomentfile.write('\n')
print 'Maximun SM3 %f in elem %d frame # %d Step: %s'%(maxSM3,maxElem4, maxFrame4,maxStep4)
OutStressMomentfile.write(' MaxSM3: ')
OutStressMomentfile.write(str(maxSM3))
OutStressMomentfile.write(' in elem: ')
OutStressMomentfile.write(str(maxElem4))
OutStressMomentfile.write(' at frame: ')
OutStressMomentfile.write(str(maxFrame4))
OutStressMomentfile.write(' at step: ')
OutStressMomentfile.write(maxStep4)
OutStressMomentfile.write('\n')
OutStressMomentfile.close()
timeFrame = odb.steps['Step-2'].frames[2002]
displacement = timeFrame.fieldOutputs['U']
Pipenode = odb.rootAssembly.instances['PART-1-1'].nodeSets['PIPENODE']
PipenodeDisp = displacement.getSubset(region=Pipenode)
OutDispfile = open('Disp.txt','w+')
OutDispfile.write("Node ")
OutDispfile.write("x disp ")
OutDispfile.write("y disp ")
OutDispfile.write("z disp\n")
for v in PipenodeDisp.values:
print 'Node label =', v.nodeLabel
OutDispfile.write(str(v.nodeLabel))
OutDispfile.write(" ")
print 'x disp =', v.data[0]
OutDispfile.write(str(v.data[0]))
OutDispfile.write(" ")
print 'x disp =', v.data[1]
OutDispfile.write(str(v.data[1]))
OutDispfile.write(" ")
print 'x disp =', v.data[2]
OutDispfile.write(str(v.data[2]))
OutDispfile.write("\n")
OutDispfile.close()
SMoment = timeFrame.fieldOutputs['SM']
SMoment = SMoment.getSubset(region=elemset)
OutMomentfile = open('Moment.txt','w+')
OutMomentfile.write("Element ")
OutMomentfile.write("SM1 ")
OutMomentfile.write("SM2 ")
OutMomentfile.write("SM3 \n")
for m in SMoment.values:
print 'Elem label =', m.elementLabel
OutMomentfile.write(str(m.elementLabel))
OutMomentfile.write(" ")
print 'SM1 =', m.data[0]
OutMomentfile.write(str(m.data[0]))
OutMomentfile.write(" ")
print 'SM2 =', m.data[1]
OutMomentfile.write(str(m.data[1]))
OutMomentfile.write(" ")
print 'SM3 =', m.data[2]
OutMomentfile.write(str(m.data[2]))
OutMomentfile.write("\n")
OutMomentfile.close()
odb.close()
订阅:
博文评论 (Atom)
没有评论:
发表评论