Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Node and Element output using Python

Status
Not open for further replies.

RH72

Mechanical
May 28, 2012
1
I have written a large Python application for Abaqus. The only issue that I have is how to output certain components to the .dat file using Python without having to alter my input files.

The part that I want my input file to contain is

*Output, field, variable=PRESELECT
*Node Output
CF,... (other output)

AND

** HISTORY OUTPUT: H-Output-1
**
*Output, history, variable=PRESELECT
*El Print, freq=1, POSITION=CENTROIDAL, ELSET=mySet1
VARIABLE NAME

I have been doing this by manually inserting this into the input file. What is the Python function that will simply allow me to output that data to the .dat file? (I'm assuming there is some "node print" or "element print")

Thanks
 
Replies continue below

Recommended for you

Well I guess an easy way in Python would be:

fi = open('inputfile.inp','w')
fd = open('datfile.inp','r')

for line in fd:

if line.startswith('*Output, field, variable=PRESELECT'):

print, write, append etc.
(good idea to write yourself the fields that you know never change)

elif line.startswith('CF,... (other output)'):

print, write, append again.

........................................................

..................

else:
pass

fi.close()
fd.close()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor