3. Getting started with Abaqus2Matlab
A very simple example is here documented to introduce the use and the capabilities of Abaqus2Matlab. A video of the present benchmark example can be found in Youtube
The stresses in a plate subjected to uniaxial tension under the assumption of plane strain conditions will be analyzed. As depicted in Figure 1, the vertical displacement will be constrained in only a half of the lower edge so as to introduce a non-uniform stress state (in a way that resembles the half model of a plate with a crack-like defect). The horizontal displacement of the node located in the low-right corner is also constrained to prevent rigid body motion.
The model is first created in Abaqus/CAE. A very simple 2D deformable part with the dimensions shown in Figure 1 is sketched. Then, a linear elastic material is defined, with Young’s modulus = 200000 MPa and Poisson’s ratio = 0.3. A homogeneous section is created and assigned to the part. An instance is then created from the part and inserted into the Assembly. The instance is partitioned to divide the lower edge in two halves. Quasi-static conditions are assumed and therefore a Static, General Step is created. The model is meshed with 100 (10x10) quadrilateral 8-noded plane strain elements (CPE8). The default Field Output is edited to request the information of interest. In the present example stress fields are of interest and particularly the Von Mises effective stress, so as to assess if the specimen has attained the yield limit. Therefore, the S (stress components and invariants) option is selected. The boundary conditions described in Figure 1 are defined and the Job is created. By right-clicking on the name of the Job (by default, Job-1) and selecting Write Input the input file is created as shown in Figure 2.
From the APPS menu of the Matlab main window the graphical user interface (GUI) of Abaqus2Matlab is opened. In the GUI interface we first click on LOAD INPUT and browse for the input file that has just been created (it will be typically stored in Abaqus working directory, by default C:\Temp). In this example the possibility to read the stresses at the Gauss integration points and operate with them is demonstrated, which is popular among Abaqus users. This happens because an engineering application may require a very high degree of accuracy regarding the stresses, and it is undesirable to lose critical information in the extrapolation and averaging that takes place in the calculation of the nodal values of the stresses. Therefore, not only the output requests of the .odb file (already specified in Abaqus) will be used, but also the output requests of the .fil file which stores the coordinates at the material integration points will be considered as well. Hence, for all elements (ELEMENT SETS – ALL), the Coordinates (COORD) option is selected in the dropdown menu and then the ENTER SELECTION button is pressed. It can be seen in the box below that the information required has been added to the output requests that were already specified in the input file. In order to test as many features as possible of Abaqus2Matlab the von Mises effective stress will be also requested from the .fil file. In order to do this, the Stress Invariant (SINV) in the dropdown menu is selected again for all elements (ELEMENT SETS – ALL) and the button ENTER SELECTION is pressed once more.
Once it has been checked that all the information of interest is inserted in the box then the user can proceed to update the input file by pressing the button WRITE TO INPUT. This will create a new folder called A2M_GUI_Output in the Matlab current working directory (i.e. the directory to which the original input file is placed) and store a new copy of the input file (Job1_A2M.inp) with this new information included. The renaming is done to store the input files that will be created during the analysis in such a way that the user can easily distinguish between them. Finally, one should press the GENERATE POST-PROCESSING SCRIPT button to create a Matlab script (*.m) file that will run the Abaqus analysis specified in the new input file and store the desired output.
This post-processing script contains basically two main steps. In the first step the finite element model is solved.
% Change the current directory
S = mfilename('fullpath');
f = filesep;
%% 1st STEP - Run one FEM model
% Run the input file with Abaqus
% Initialize sw (boolean switch) as true
system(['abaqus job=' Inp_file]);
% Pause Matlab execution in order for the lck file to be created
% While the lck file exists, pause Matlab execution. If it is
% deleted, exit the while loop and proceed.
while exist([Inp_file '.lck'],'file')==2
% the lck file has been created and Matlab halts in this loop.
% Set sw to false to break the outer while loop and continue
% the code execution.
% In case that the lck file cannot be detected, then terminate
% infinite execution of the outer while loop after a certain
% execution time limit (5 sec)
if sw && (toc>5)
Alternatively, the last 22 lines of the above code listing can be replaced by:
system(['abaqus job=' Inp_file ' interactive'])
In the second step the information requested is loaded into Matlab and stored in appropriate variables upon which the user can operate according to his/her needs.
Regarding the information of the field output, the following commands are executed:
% Read the field output contained in Job1_A2M.odb
indOut='True'; %(create indexing file)
Where odbOut_S is a floating point array containing the results in Job1_A2M.odb which are retrieved by this function, and odbDat_S is an integer array containing the indices for the results in odbOut_S. Both results are first printed in external files (Job1_A2M.out and Job1_A2M.ind respectively) and then these files are loaded into Matlab. If there is any existing file in the working directory with the same name and extension before the execution of the readElementFieldOdb function, then it is deleted (without asking for permission) and populated from scratch. rpyOut_S is a column vector containing model information of the Abaqus rpy file, such as number of assemblies, number of instances, number of meshes, number of node/element sets, etc. The user is referred to the corresponding help section of the readElementFieldOdb.m function for more details.
Information regarding the stresses can be found in Abaqus2Matlab documentation, specifically in 22.214.171.124. Classification of field output written in odb files, where it is stated that the stresses belong to category 3, meaning that they include in general 16 numerical values, which are the 6 stress tensor components and the following 10 stress tensor invariants according to the order presented: INV3, MAXINPLANEPRINCIPAL, MAXPRINCIPAL, MIDPRINCIPAL, MININPLANEPRINCIPAL, MINPRINCIPAL, MISES, OUTOFPLANEPRINCIPAL, PRESS, TRESCA. Due to plane strain conditions, the components of the stress tensor will not be 6 but 4, and therefore the numerical values of each stress result requested will be 14 (instead of 16). The variable odbOut_S includes all the stress components in all increments of the analysis. The order of variables can be found in the Abaqus documentation (Results file output format section). Hence, for the present plane strain analysis we have:
S11, S22, S33, S12
such that we can store in one variable the Von Mises output as read from the .odb file by adding the following lines of code to the Matlab script:
Regarding the post-processing of the .fil file the following commands are executed:
COORD = readFil([ Inp_file '.fil' ], 8 );
SINV = readFil([ Inp_file '.fil' ], 12 );
After these, the integration point coordinates (COORD) and the stress invariants (SINV) are stored in the corresponding output variables as cells. While this may be a suitable format for many Matlab users, this information is here converted in the standard matrix format by adding these lines:
So that the variables COORDmtx, SINVmtx and MISES store now, respectively, the coordinates of the integration points, the stress invariants and the Von Mises stress at the integration points. We may, for example, decide to plot the Von Mises stress distribution in a much prettier way through a 3D surface. We can do so by adding the following lines:
[xq,yq] = meshgrid(0:0.1:60,0:0.1:60);
vq = griddata(COORDmtx(:,1),COORDmtx(:,2),MISES,xq,yq,'cubic');
And in doing so we get the following plot,
The user could also take advantage from other Matlab capabilities so as to, for example, identify the point of maximum Von Mises stress so as to check if the model has undergone yielding by looking at the information at the integration points (and therefore avoiding inaccuracies that may arise from the nodal averaging). By plotting the results with the output information extracted from the odb (i.e., substituting MISES by MISESodb in the code lines above) one can easily see that the results are identical.
The use and some of the capabilities of Abaqus2Matlab with one simple example have been shown. More advanced case studies can be performed that can open new horizons in the state of the art research. We invite the users to see the remaining examples of this documentation and the case studies reported in the reference article.
Abaqus2Matlab - www.abaqus2matlab.com
Copyright (c) 2017 by George Papazafeiropoulos & E. Martinez-Paneda
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)
Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.