16.1 Introduction
This chapter is going to introduce you to reading output databases, and gaining useful information from them. When you run an analysis in Abaqus, the data you request – the field and history outputs – as well as other information, such as the geometry of the part instance, is written to the output database (.odb ) file. You might be required to extract some specific information from an odb as part of your analysis procedure. A script might be a more efficient then manually using the Abaqus/Viewer environment. In addition there are some tasks that are impossible to perform in the Viewer but possible through a script.
In this example we will experiment with the output database of the static truss analysis from Chapter 7 and the explicit dynamic truss analysis of Chapter 8. We will perform 4 tasks.
1) We will extract the stress field, and display a contour plot of one-half of its value.
Each of the truss members will therefore appear to have only half of their original stress when viewed in Abaqus/Viewer. While this may not appear very useful, the purpose is to demonstrate how you can modify a field by performing a mathematical operation on it or a linear combination with another field. We will use the field output data of the static truss analysis for this.
2) We will extract information about the part instance used in the analysis, its nodes and elements, and find out which element and node experienced the maximum stress and displacement respectively. You saw an example of finding which element experiences the maximum stress in the plate optimization example (Chapter 13), but in that example you obtained this information by reading the
144 Explore an Output Database
report file generated during post-processing. This time you will read the output database. You will also use the print command in a manner similar to the printf() command from C which allows you to format your printed output. We will use the field output data of the static truss analysis for this.
3) We will find out what regions of the part have history outputs available, what these history outputs are, and extract the history output data. You will also see how to find out which sets were defined in the model, and how to extract information about the history region these sets correspond to. History output information will be examined for both the output databases – the static truss analysis and the dynamic explicit truss analysis.
4) We will extract the material and section properties from the odb. We will also extract the entire material and section definitions from the static truss analysis odb and put them in a new Abaqus/CAE model for future use using some built-in methods provided by Abaqus.
In the process you will also learn of the various type of print statements, and how to format printed output to suit your needs (and also to make your code more readable). In addition you will discover the hasattr() and type() built-in functions offered by Python.
Performing these tasks will give you a good insight into working with Abaqus output databases using a Python script.
16.2 Methodology
For the first task, we will read in the stress [S] and displacement [U], both FieldOutput objects. We will divide the stresses by 2 to make them half their value, and leave the displacements at their present values. We will then create a new viewport window, set the primary variable to our new half stresses, and the deformed variable to the unchanged displacement, and plot these. We will also turn on element and node labels, so we can see the element and node numbers in the viewport to better understand what is going on in the next task.
For the second task, we will use the object model to examine field output values in the output database. Output databases consist of a very large amount of information, and this information is buried inside the object model at different levels –you have containers with information and more containers nested within them with additional information. To
16.3 Before we begin – Odb Object Model 145
find the element with the maximum stress and the node with the maximum displacement, we will need to loop through all the elements and nodes examining their stress and displacement values respectively.
For the third task we will once again use the object model, but this time we will examine history output information.
For the fourth task we will use some methods provided by Abaqus to easily extract material and section information from an odb. We will create a new model file and place this information in it for demonstration purposes.
16.3 Before we begin – Odb Object Model
(Section removed from preview)
16.4 How to run the script
Open a new model in Abaqus/CAE and run the script created for the static truss analysis using File > Run Script… The analysis will create an output database file
‘TrussAnalysisJob.odb’ and the script will open and display it in the Abaqus/Viewer viewport.
Then then open another new model in Abaqus/CAE and run the script created for the dynamic explicit truss analysis using File > Run Script… (It will be necessary to open a model to run the second script since both the scripts were originally written to be standalone and assume the existence of a default model ‘Model-1’ which they rename).
The analysis will create an output database file ‘TrussExplicitAnalysisJob.odb’ and the script will open and display it in the Abaqus/Viewer viewport.
The reason both these scripts must be run is that they run the analysis and produce the output databases. The Odb exploration script in this example needs to access these output database files.
Once these scripts have been run, the Odb exploration script written in this chapter can be run using File > Run Script.. either with those models still open in Abaqus/CAE, or in a
146 Explore an Output Database
new Abaqus/CAE model. (It does not make a difference since this script only accesses the .odb files and does not assume the existence or lack of any model in Abaqus/CAE).
(Remaining sections removed from preview)
.
16.5 Summary
You now have a good understanding of how you can access information stored in an output database using a Python script. There is a wealth of information available in an odb, and all you need to access it is a basic understanding of the output database object model. There is no sense in memorizing the entire tree structure which has hundreds of nested repositories, attributes and methods; you should instead use object model interrogation with print and prettyPrint() statements to determine how to access the information you need.