Skip to content Skip to sidebar Skip to footer

Transforming An Abaqus Macro Into A Python Script

I am using Abaqus (6.13) to run FEM thermal simulations. I need to get the total external heat flux aplied on that model. My searches indicated that the only way to get it was to s

Solution 1:

here is a script that does essentially what you want: (and you see we only need the three import's)

from abaqus import *
from abaqusConstants import *
import visualization
odb=session.openOdb(name='/full/path/Job-1.odb')
session.viewports['Viewport: 1'].setValues(displayedObject=odb)
session.xyDataListFromField(odb=odb, outputPosition=NODAL,
          variable=(('NT11', NODAL),  ),
                   nodeSets=('PART-1-1.SETNAME', ))
keyname='From Field Data: NT11  at part instance PART-1-1'# run this to see what the keys look like:# [ o.description for o in session.xyDataObjects.values() ]
temp=[o for o in session.xyDataObjects.values() if
         o.description.find(keyname)==0]
#note if you only have requested one data type you could just do:#temp=session.xyDataObjects.values()
session.writeXYReport(fileName='test.rpt', xyData=temp)
#alternate way to directly write data instead of using writexyreport:
f=open('test.dat','w')
for o in temp: f.write('%i %g\n'%
     (int(o.description.split()[-1]),o.data[-1][-1]))
f.close()

run with abaqus cae -noGUI script.py or abaqus cae noGUI=script.py

Post a Comment for "Transforming An Abaqus Macro Into A Python Script"