Shell Grouper
Find groups of neighbouring shells from an arbitrary list of shell ID's.

When post-processing results, it is sometimes necessary to find neighbouring groups of like elements. For example if LS-DYNA reports 20 eroded elements at the end of an analysis, does this mean there are:
20 small holes OR 1 large hole OR 5 medium holes each of 4 elements?
This script illustrates how, using a list of element id’s, it is possible to group elements in to neighbouring collections. It works by creating custom objects for all of the shells being sorted, followed by all of the nodes on the shells. The clever part is that the node objects become properties of the shells and the shells become properties of the nodes, which then means it is possible to use a recursive function to go from one shell to it’s neighbour via the shared node object(s).
The script was written for shells and comes with a little example d3plot file that you can run it on (it groups the elements with PID=2). It could be modified to work with other element types easily.