I’m writing a code in python that extracts the contact stress (CPRESS) in Abaqus 2019 of all the nodes on a given surface. I managed to write the code so that the Node-Label as well as the coordinates of the nodes from the surface get extracted and are written to a csv file. However, I’m not having any success in accessing the CPRESS-Value for the nodes that I’m interested in.
I read in the user’s manual about where to find the values of CPRESS, but I don’t see the reason, on why the code isn’t extracting any values for the given nodes. There is my code:
import csv
from odbAccess import *
odb_Pfad = '123.odb' #not important
odb = openOdb(odb_Pfad)
instance_name = 'PRUEFKOERPER_4-1'
instance = odb.rootAssembly.instances[instance_name]
start_node_id = 0
end_node_id = 5000
partlabel = []
partxcord = []
partycord = []
partzcord = []
for node in instance.nodes:
if start_node_id <= node.label <= end_node_id:
partlabel.append(node.label)
partxcord.append(node.coordinates[0])
partycord.append(node.coordinates[1])
partzcord.append(node.coordinates[2])
step_name = 'Belastung'
step = odb.steps[step_name]
last_frame = step.frames[-1] #Last frame
cpress_dict = {value.nodeLabel: value.magnitude for value in last_frame.fieldOutputs['CPRESS'].values}
#write a csv file with the node ladel and the coordinates of the corresponding node, as well as cpress-Value
csv_datei = '123.csv' #not important
with open(csv_datei, 'wb') as file:
writer = csv.writer(file)
writer.writerow(['Knoten ID', 'x', 'y', 'z', 'CPRESS'])
for i in range(len(partlabel)):
cpress_value = cpress_dict.get(partlabel[i], 'N/A')
writer.writerow([partlabel[i], partxcord[i], partycord[i], partzcord[i], cpress_value])
odb.close()
Jawo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.