4.2.1.5. Outline of exploreHistoryOdb.m

In this section the way the function exploreHistoryOdb.m works is outlined.

Contents

Summary

Detailed outline

Template

Reference

Summary

In summary, the following steps are taken to explore the history output of an odb file:

[1] Check if the odb file specified exists in the working directory

[2] Delete any Abaqus rpy files if present in the working directory. If any file cannot be deleted (e.g. if it is opened in Abaqus) then issue a warning

[3] Upgrade in case that the version of the odb file is older than the version of Abaqus running on the pc

[4] Create the Python script to be executed for postprocessing of the odb file

[5.1] If the Python script is created successfully

[5.1.1] Execute the Python script

[5.1.2] Read all the rpy files which are present in the working directory

[5.2] If the Python script is not created successfully, terminate execution and issue an error

Detailed outline

Here the steps summarized in the previous section are explained in detail.

[1] This step is relatively straightforward. For more details, the user should see the code of the function exploreHistoryOdb.m.

[2] This step is relatively straightforward. For more details, the user should see the code of the function exploreHistoryOdb.m.

[3] This step is implemented by issuing the following command to the operating system through Matlab, where odbFileNew is the name of the updated odb file which is compatible with the Abaqus version used at the computing platform and odbFileOld is the name of the existing odb file:

system('abaqus -upgrade -job odbFileNew -odb odbFileOld')
 

[4] The Python script that is generated at this step is named exploreHistoryOdbPyScript.py and performs the following operations:

[4.1] Make the basic Abaqus objects accessible to the script

[4.2] Open an empty lock file (*lck). This file is closed after the termination of the execution of the Python script. As long as this file exists, this means that either the Python script is running, or an error/bug has occurred which does not allow the Python script to run successfully.

[4.3] Open the odb file and perform the following loop, written in a simplified way to facilitate understanding the various programming concepts:

for step in steps
    for key in step.historyRegions
         for outputID in key.historyOutputs
             print the key associated with outputID

[4.4] Close the odb file

[4.5] Close the lck file and delete the lck file

[4.6] Check if the Python script has been successfully created in the working directory in order to notify the parent Matlab function to proceed in executing the script.

[5.1] This step is checked through the results of step [4.4]

[5.1.1] Execute the script by issuing a command to the operating system and halting Matlab execution as long as the lck file opened in [4.2] and closed in [4.5] exists:

!abaqus cae nogui=exploreHistoryOdbPyScript.py
pause(0.5);
while the lck file exists
    pause(0.1)

[5.1.2] The rpy files contain information about the model, written by Abaqus by default, as well as information printed in the Abaqus Command Line Interface (CLI) during execution of the Python script, which is tagged as Abaqus2Matlab output. The function that reads the rpy files searches and prints in the Matlab command window the contents of rpy file by executing the following loop:

Read the first line of the rpy file
while the read line contains characters
    if it contains Abaqus2Matlab output
        if the Abaqus2Matlab output is not duplicate
            print the Abaqus2Matlab output in the Matlab command window
    elseif the line starts with the string "#: Number of"
        print the remaining of the line
    elseif the line starts with the string "#: Warning:"
        issue the statement as warning in the Matlab command window
    read the next line of the rpy file
close the rpy file

[5.2] This step is quite straightforward. The user is referred to lines 140-141 of the function exploreHistoryOdb.m

Template

An exemplary Matlab script which prints in the Matlab command window the history output identifiers and their categories of an odb file is as follows:

% S is the directory path of the results file. It is assumed that it is
% placed in the folder C:\Abaqus_Temp\
S='C:\Abaqus_Temp';
% AbaqusInputFile.inp is the name of the Abaqus input file
fileID = fopen('AbaqusInputFile.inp','wt');
% Write Abaqus options in the file
fprintf(fileID,' *HEADING\n');
fprintf(fileID,' ...<options in Abaqus input file>...\n');
fprintf(fileID,' *OUTPUT, HISTORY\n');
% specify at least one of the following:
fprintf(fileID,' *ELEMENT OUTPUT\n');
fprintf(fileID,'  ...<Element output variable IDs>...\n');
% or:
fprintf(fileID,' *NODE OUTPUT\n');
fprintf(fileID,'  ...<Node output variable IDs>...\n');
% end the step definition
fprintf(fileID,' *END STEP\n');
fclose(fileID);
% Run the input file with Abaqus
!abaqus job=AbaqusInputFile
% Give Abaqus enough time to create the lck file
pause(2)
% While the lck file exists then halt Matlab execution
while exist('AbaqusInputFile.lck','file')==2
    pause(0.1)
end
% Explore the history output contained in AbaqusInputFile.odb
out=exploreHistoryOdb('AbaqusInputFile.odb',S);
 

Reference

For more details about the functions involved in this section see:

exploreHistoryOdb.m

exploreHistoryOdbPyScript.m

_________________________________________________________________________
Abaqus2Matlab - www.abaqus2matlab.com
Copyright (c) 2017 by George Papazafeiropoulos

If using this application for research or industrial purposes, please cite:
G. Papazafeiropoulos, M. Muniz-Calvente, E. Martinez-Paneda.
Abaqus2Matlab: a suitable tool for finite element post-processing.
Advances in Engineering Software. Vol 105. March 2017. Pages 9-16. (2017)
DOI:10.1016/j.advengsoft.2017.01.006



Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.

We support Ukraine and condemn war. Push Russian government to act against war. Be brave, vocal and show your support to Ukraine. Follow the latest news HERE