phd-scripts/Biomaterials13/StudyP1/nodeCon3DF.py

46 lines
1.3 KiB
Python
Raw Permalink Normal View History

2024-05-13 19:50:21 +00:00
# This is a pre-processor script for 3D ALE corrosion analysis.
# Author: J. Grogan - BMEC, NUI Galway. Created: 19/09/2012
from abaqusConstants import *
from abaqus import *
#
aModel=mdb.models['Square6']
aPart=aModel.parts['Geom']
incFile=open('NodeData.inc','w')
#
numFaces=0
pstring=''
# Cycle through all element faces
for eachFace in aPart.elementFaces:
# Check if Face is on external Surface
if len(eachFace.getElements())==1:
numFaces=numFaces+1
faceNodes=eachFace.getNodes()
# Identify 'Fixed' Faces
fixed=1
try:
fSet=aPart.sets['Fixed']
for eachNode in faceNodes:
if eachNode not in fSet.nodes:
fixed=0
break
except:
fixed=0
pstring=pstring+str(fixed)+' '
# Write Element Nodes
eNodes=[]
for eachNode in eachFace.getElements()[0].getNodes():
pstring=pstring+str(eachNode.label)+' '
pstring=pstring+'\n'
# Write Each Face Nodes and Corresponding Connected Nodes
for eachNode in faceNodes:
pstring=pstring+str(eachNode.label)+' '
for eachEdge in eachNode.getElemEdges():
for eachENode in eachEdge.getNodes():
if eachENode.label != eachNode.label and eachENode in faceNodes:
pstring=pstring+str(eachENode.label)+' '
pstring=pstring+'\n'
#
incFile.write(str(numFaces)+'\n')
incFile.write(pstring)
incFile.close()