18.104.22.168. Outline of getMatrix.m
In this section the way the function getMatrix.m works is outlined.
In summary, the following steps are taken to read a matrix from a mtx file:
▪ Load the contents of the mtx file into a [n x 5] array in Matlab.
▪ Initialize and populate a square matrix with the data contained in the array loaded at step 
▪ Delete the rows and columns containing only zero elements.
▪ Format the square matrix appropriately.
Here the steps summarized in the previous section are explained in detail.
▪ Loading of a comma-delimited text file in Matlab is quite straightforward. The Matlab function "load" is used. For the next steps, assume that the loaded [n x 5] array is named "a".
▪[2.1] Find n which is the number of rows of "a".
▪[2.2] Find the degrees of freedom per node of the finite element model.
▪[2.3] Find the maximum node ID of the model.
▪[2.4] Initialize a zero matrix (assumed to be named as "K") with dimension equal to the product of the degrees of freedom per node and the maximum node ID of the model.
▪[2.5] Populate "K" by scanning all the entries at the 5th column of "a" and placing them in the appropriate positions in "K".
▪ This step is relatively straightforward. For more details, the user should see the code of the function getMatrix.m.
▪ Depending on the specifications of the user, the output matrix "K" is formatted according to the following pseudocode:
in case of sparse & lower triangular
in case of sparse & fully populated
in case of full & lower triangular
in case of full & fully populated
An exemplary Matlab script which reads and loads the matrix contained in a mtx 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\
% AbaqusInputFile.inp is the name of the Abaqus input file
fileID = fopen('AbaqusInputFile.inp','wt');
% Write Abaqus options in the file
fprintf(fileID,' ...<options in Abaqus input file>...\n');
fprintf(fileID,' ...<options to define the preloading history for the model>...\n');
fprintf(fileID,' *END STEP\n');
fprintf(fileID,' *MATRIX GENERATE, STIFFNESS, MASS, VISCOUS DAMPING,\n');
fprintf(fileID,' STRUCTURAL DAMPING\n');
fprintf(fileID,' *MATRIX OUTPUT, STIFFNESS, MASS, VISCOUS DAMPING,\n');
fprintf(fileID,' STRUCTURAL DAMPING, FORMAT=MATRIX INPUT\n');
fprintf(fileID,' ...<Options to define the boundary conditions for the matrix generation step>...\n');
fprintf(fileID,' *END STEP\n');
% Run the input file with Abaqus
% Give Abaqus enough time to create the lck file
% While the lck file exists then halt Matlab execution
% Obtain the matrix output contained in the various mtx files
format='full'; % other options also possible
For more details about the functions involved in this section see:
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)
Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.