phd-scripts/Biomaterials13/Scripts/pdiam.py

33 lines
No EOL
1 KiB
Python

from abaqusConstants import *
from odbAccess import *
odbfilename='tpit3.odb'
resFile='Diams20.dat'
outFile = open(resFile,"w")
odb=openOdb(path=odbfilename)
# create sets
addNodes=[]
tol1=0.005
tol2=0.005
minval=-5.0
# Find Inner Nodes
for eachNode in odb.rootAssembly.instances['PLAQUE-1'].nodes:
x=eachNode.coordinates[0]
y=eachNode.coordinates[1]
dist=sqrt(x*x+y*y)
if dist<0.82:
addNodes.append(eachNode.label)
odb.rootAssembly.NodeSetFromNodeLabels(name='Min13', nodeLabels=(('PLAQUE-1',addNodes),))
aSet=odb.rootAssembly.nodeSets['Min13']
print aSet
# Find Min Radius
for eachFrame in odb.steps['Step-3'].frames:
if eachFrame.frameValue>.5:
dist=0.
for eachValue in eachFrame.fieldOutputs["U"].getSubset(region=aSet).values:
x=eachValue.data[0]
y=eachValue.data[1]
dist=dist+sqrt(x*x+y*y)
dist=dist/(len(eachFrame.fieldOutputs["U"].getSubset(region=aSet).values))
print dist,eachFrame.frameValue
outFile.write('%f %f \n'%(dist,eachFrame.frameValue))
outFile.close()