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!

Post-Processing the stress in a section

Status
Not open for further replies.

plop

New member
May 20, 2010
1
Hello,
I'm studying the carcks in a metalic material. I've done a FE analysis on my structure ans i'm now interessed by having the stresses S22 in a file .txt in order to import it into matlab.
I would like to get a file like this :
COOR1 | COOR2 | COOR3| S22
I'm trying to use a pyhon script to carry out this task but it seems that the script doesn't find the variable which corresponds to the coordinates of the node. Of course, I created a set which correspond to the section I'm interested in. With this post, I attach the script python I'm using as well as the error that occur.
I'd just like to add that i'm not familiar with Abaqus and data processing with python so if one of you wants to help me, i would be gratefull if you explain like for a noob.

x0=session.xyDataObjects[word]
KeyError : COORD:COOR1 PI: PART1-1 N:3


from abaqus import *
from abaqusConstants import *
from caeModules import *
from driverUtils import *
from odbMaterial import *
from odbAccess import *

from textRepr import *
import pickle
from sys import *
from os.path import *
from time import *
from string import *
from types import *

Pi=acos(-1.)

nom_odb='Job-1'

nom_sortie='result_'+ nom_odb +'.txt'
nom_odb=nom_odb+'.odb'

odb = session.odbs[nom_odb]

#: extrait la liste des nodes sets
setname=(odb.rootAssembly.nodeSets.keys())
print ' #: Node Set Name=', setname
#: choisir le node Set PLANHAUT
setnom=(odb.rootAssembly.nodeSets.keys())[2]
print ' #: Node Set Name=', setnom
ToAnalyse = odb.rootAssembly.nodeSets[setnom].nodes[0]
listeN=[]
for v in range(len(ToAnalyse)):
listeN=listeN+[(ToAnalyse[v].label)]
#: print 'listeN', listeN

#: creer toute les courbes
session.xyDataListFromField(odb=odb, outputPosition=NODAL, variable=(('COORD',
NODAL, ((COMPONENT, 'COOR1'), (COMPONENT, 'COOR2'), (COMPONENT, 'COOR3'),
)), ('S', INTEGRATION_POINT, ((COMPONENT, 'S22'), )), ), nodeSets=(
'SET-2', ))

#: extraire coor1 et coor2
liste_coor1=[]
liste_coor2=[]
liste_coor3=[]
liste_s22=[]

for j in range(len(listeN)):
#:for j in range(10):
word='COORD:COOR1 PI: PART1-1 N: '+ '%d' % listeN[j]
x0 = session.xyDataObjects[word]
elem=x0[0][1]
liste_coor1=liste_coor1 + [elem]

word='COORD:COOR2 PI: PART1-1 N: '+ '%d' % listeN[j]
x0 = session.xyDataObjects[word]
elem=x0[0][1]
liste_coor2=liste_coor2 + [elem]

word='COORD:COOR3 PI: PART1-1 N: '+ '%d' % listeN[j]
x0 = session.xyDataObjects[word]
elem=x0[0][1]
liste_coor3=liste_coor3 + [elem]

word='S:S22 PI: PART1-1 N: '+ '%d' % listeN[j]
x0 = session.xyDataObjects[word]
elem=x0[1][1]
liste_s22=liste_s22 + [elem]

print 'noeud: ', (j+1), ' sur: ', len(listeN)


#: ecrire les données dans un fichier
file=open(nom_sortie,'w')
file.write(' \n' )
file.write(' label, coor1, coor2, coor3, s22 ')
file.write(' \n' )
for j in range(len(listeN)):
#:for j in range(10):
file.write('%10.10E ' % listeN[j])
file.write('%10.10E ' % liste_coor1[j])
file.write('%10.10E ' % liste_coor2[j])
file.write('%10.10E ' % liste_coor3[j])
file.write('%10.10E ' % liste_s22[j])
file.write(' \n' )

file.close()
 
Replies continue below

Recommended for you

Can't be of too much help, but I can say that the easiest way to go about scripting python in abaqus is to open a new session, do what it is you want to do manually, and then start with the *.rpy file for that session, which should included python commands for everything you did via the CAE window.

That may be what you have done already, but I thought I'd mention it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor