Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Collecting all elements position with python script

Status
Not open for further replies.

Sergiano

Mechanical
Apr 26, 2019
1
I'm modelling high speed water impact in a structure. The water jet is modeled with an Eulerain Eulements (the part is named 'Water') while the structure is modeled with a Lagrangian element (the part is named 'Structure').I'm currently writing a script Abaqus python to collect [highlight #F57900]separately[/highlight] every element position (X, Y, Z) in space from the Water and the Structure part . The element position should be extracted in the last frame from the first step. Once it is done the coordinate are saved in excel file. Can you help me to write the script.


# odb reading and writing acces
odbPath='E:/Temp/A1.odb'
Odb = session.openOdb(odbPath)
# create a variable that refers to the last frame of the first steps
lastFrame=Odb.steps['Step-1'].frames[-1]
#Part instance in the model
print Odb.rootAssembly.instances.keys()
# abaqus visualise ['Water-1', 'Structure-1']

myInstance1=Odb.rootAssembly.instances ['Water-1']
myInstance2=Odb.rootAssembly.instances ['Structure-1']
numElements1=len(yInstance1.elements)
numElements2=len(yInstance2.elements)

for el in range(0,numElements1):
# What commande to use to extract

for el in range(0,numElements1): # this commande does'nt work. What commande to use to extract coordinate position
print'Position=',el.position
Odb.close()
 
Replies continue below

Recommended for you

I don't know if this will help making it work but there is a method that gets the coordinates of vertices, datum nodes, reference points and mesh nodes. This method can work with you if you -somehow- linked the element number one of its nodes. This method is written as follows:
getCoordinates(...)
And it returns a tuple of three floats representing the node coordinates.
 
What is the coordinate of an element?
The nodes have coordinates or the element center has a coordinate. Both can requested when using COORD as Field Output Request for elements. See keyword *Element Output.
 
That is what I meant by linking the element number to one of its nodes...and I don't know if Sergiano have other meaning... by default when talking about an element, we mean the center of that element unless we specify another node of its geometry. Thank you Mustaine3 for making things obvious as I might have written something ambiguous. And let us know Sergiano, if it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor