Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
May 28, 2012
Messages
1
Location
CA
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
 
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

Back
Top