The results of a simulation in Abaqus are stored in a .odb file. We can open the odb file in the GUI and visualize the results. By creating a XY Data set in the GUI, we can also plot the results graphically. But if we require certain values in a tabular or text form to perform further analysis, then, using python is a better option.
Using the Python Abaqus library, we can run a python script and extract the simulation into a desired file format like a text file or an excel workbook. The benefit of using a python script is that we can simply change the value of a variable and get different results.
Consider the same example of a 2D beam model. Suppose you have performed a bending test simulation on the model and want to extract the results of deformation at individual node points.
To run a python script, you need to click: File --> Run Script
Below is an example of a python script that extracts the nodal displacement data from an odb file into a text file.
import sys
from odbAccess import *
from abaqus import *
from abaqusConstants import *
import __main__
odb = openOdb('Job-1.odb')
# Get the first step and frame
step = odb.steps['force']
frame = step.frames[-1]
node_set = odb.rootAssembly.instances['PART-1-1'].nodeSets['SET-4']
with open('odb_edge_node_data.txt', 'w') as f:
for node in node_set.nodes:
# Get the nodal coordinates and data for the node
node_coords = node.coordinates
node_data = frame.fieldOutputs['COORD'].getSubset(region=node).values[0].data
# Write the nodal coordinates and data to the text file
f.write('{},{},{}'.format(node.label, node_data[0], node_data[1]))
f.write("\\n")
The above written code stores the nodal displacement data in a text file. We can also choose to store the data in an excel file. Also, as seen on line 10, we can just change the "SET-4" to any desired node set for which we want to get the nodal displacement data.
The data was stored in the format of: "node id, x coordinate, y coordinate". We can also change this format to any other format by making a change in the code.
Edu
