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!

how to find nodes connected to a specific node 1

Status
Not open for further replies.

thepiggy

Mechanical
Oct 7, 2008
15
hi everybody
does anyone have a suggestion on how to find the connected nodes (i mean the labels of those nodes) to a given node in a nodeset through a python script? it is important that this be carried out through a python script.
thanks a lot!
 
Replies continue below

Recommended for you

Since nobody has replied yet I'd like to add this to my request for help:

I need what I explained above to calculate a mean normal direction to a node in order to move that node along that direction during a postprocessing of the abaqus results.

All that could be avoided if somebody has an idea on how to obtain such normal direction to a node.

Thanks again to all of you

 
thepiggy

I guess you could loop though all of the elements that are associated with the nodeset to work out if the target node resides in the connectivity list for a particular element. If so, you could then work out what other nodes are connected to that target node based upon its position in each associative elements connectivity list (you will need to refer to the documentation to ascertain what the connectivity is for the specific element you are using i.e. if using C3D8 and target node is first in element connectivity list then connected nodes are 2nd, 3rd, 4th & 5th of that element). If these connected nodes belong to the nodeset then you can store its label in an array etc and output as required

bfillery
 
thanks bfillery

that could be a good idea. i'm just wondering where i could find the info on the connectivity (i mean, on the fact that the first node in the element connectivity list is connected to the 2nd,3rd,4th,and 5th).
thanks a lot for your help!
 
could you bfillery or anybody else be so kind to explain to me how to access the labels of the nodes belonging to a specific set? i seem to not be able to. i'm still talking about python script
thanks a lot!!!
 
Hi

Lets say that you have an element set defined in the assembly that contains all the elements that are associated with the node set you mentioned above. To access the connectivity for each of the elements in this element set you would loop over the elements as follows

for i in mdb.models[modelName].rootAssembly.instances[instanceName].sets[elementSetName].elements:
element=i
connectivityList=element.connectivity

This tells you what nodes are connected to each other node from an element perspective. You can then build your required connected nodes list accordingly.
 
great!
thanks a lot. you're cool bfillery.
i appreciated your help very much



 
excuse me bfillery
i ended up not needing to access mdb because i chose another way to do what i needed to do when i asked that question. but now i'd actually like to open my mdb and access some stuff in there.
could you kindly explain to me how to make what you suggested work?
you wrote
mdb.models[modelName].rootAssembly.instances[instanceName].sets[elementSetName].elements:
element=i

but i can't get it to work
don't i have to define mdb first? i'm very confused on how to access a model database.....
 
Hi,

Sorry, I think I wrote the wrong thing. If accessing the odb from within CAE one way is to use,

myOdb=session.openOdb(name='myOdb', path='C:/......')

then

myOdb.rootAssembly.instances[instanceName].sets[elementSetName].elements etc as discussed above.
 
thanks
though i'd like to access the model database, not the odb, because the node connectivity is in the model database, and i'd like to access it through a python script and not from within the CAE. could you help me with that?

 
thepiggy

I am guessing by the database you mean a file.cae.

If this is the case then you still need to use a cae license but not run cae with a GUI

To do this you can call the script in the working directory as follows

abaqus cae noGUI=script_name.py

You will also need some stuff at the top of your script to help with the import of cae tools: i.e.

from abaqus import *
from abaqusConstants import *
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
Mdb()

From here you should be able to use:

mdb.models[modelName].rootAssembly.instances[instanceName].sets[elementSetName].elements etc as given above.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor