每天都在改变

Abaqus如何提取质量阵和刚度阵

2019.02.16

方法1 — 全局刚度阵和质量阵的提取

在刚度阵和质量阵的提取过程中,需要独立步提取刚度阵和质量阵,Abaqus input文件Jobfile.inp如下:

** Output Global Stiffness Matrix
*Step, name=Global_Stiffness_Matrix
*MATRIX GENERATE, STIFFNESS
*MATRIX OUTPUT, STIFFNESS, FORMAT=MATRIX INPUT
*End Step
** Output Global Mass Matrix
*Step, name=Global_Mass_Matrix
*MATRIX GENERATE, MASS
*MATRIX OUTPUT, MASS, FORMAT=MATRIX INPUT
*End Step

通过命令行提交作业代码:

abaqus job=Jobname int

输出包括二进制文件jobfile_X1.sim和文本文件jobfile_STIF1.mtxjobfile_MASS1.mtx,文本文件中前者为刚度矩阵文件,后者为质量阵文本文件,保存为稀疏矩阵形式。 .mtx文件的形式如下所示:

Node1, Dof1, Node2, Dof2,  Stiffness value

  101,    1,   101,    1,  9.890109890109926e+01
  101,    2,   101,    1,  3.571428571428572e+01
  102,    1,   101,    1, -6.043956043956079e+01
  102,    2,   101,    1, -2.747252747252749e+00
  103,    1,   101,    1, -4.945054945054909e+01
  103,    2,   101,    1, -3.571428571428572e+01
  104,    1,   101,    1,  1.098901098901063e+01
  104,    2,   101,    1,  2.747252747252750e+00
  101,    2,   101,    2,  9.890109890109926e+01
......

.mtx文件可以通过matlab程序转成matlab中m*n的满阵形式,matlab子程序如下(源代码来源于abaqus2matlab):

function Mout = getMatrix(varargin)
%
% Get the stiffness, mass, viscous damping and structural damping matrices
% of any Abaqus model
%
% Syntax
%     #Mout# = getMatrix(#mtxFile#,#sw#,#abqDir#)
%
% Description
%     This function loads the matrix elements of an Abaqus model from an
%     external file generated by Abaqus (*.mtx). Abaqus can generate four
%     different types of matrices after the input file X.inp is executed:
%         X_STIFN.mtx (stiffness matrix)
%         X_MASSN.mtx (mass matrix)
%         X_DMPVN.mtx (viscous damping matrix)
%         X_DMPSN.mtx (structural damping matrix)
%     where N is the number of the matrix output step in X.inp. The
%     necessary options which are required in X.inp for the creation of
%     X_STIFN.mtx (stiffness matrix) are:
%         *MATRIX GENERATE,STIFFNESS
%         *MATRIX OUTPUT,FORMAT=MATRIX INPUT,STIFFNESS
%     The necessary options which are required in X.inp for the creation of
%     X_MASSN.mtx (mass matrix) are:
%         *MATRIX GENERATE,MASS
%         *MATRIX OUTPUT,FORMAT=MATRIX INPUT,MASS
%     The necessary options which are required in X.inp for the creation of
%     X_DMPVN.mtx (viscous damping matrix) are:
%         *MATRIX GENERATE,VISCOUS DAMPING
%         *MATRIX OUTPUT,FORMAT=MATRIX INPUT,VISCOUS DAMPING
%     The necessary options which are required in X.inp for the creation of
%     X_DMPSN.mtx (structural damping matrix) are:
%         *MATRIX GENERATE,STRUCTURAL DAMPING
%         *MATRIX OUTPUT,FORMAT=MATRIX INPUT,STRUCTURAL DAMPING
%     The matrix output of this function can be in full or sparse format,
%     and in triangular lower, or fully populated configuration.
%
% Input parameters
%     REQUIRED:
%     #mtxFile# (string) is a string containing the name of the ABAQUS
%         matrix (*.mtx) file, along with its extension. The matrix file is
%         generated by Abaqus after the analysis has been completed.
%     #sw# ('sparseTril','sparse','fullTril','full') is a string which
%         specifies the format of the matrix to be output from this
%         function according to the following:
%         'sparseTril':SPARSE Lower TRIangular 
%         'sparse':SPARSE
%         'fullTril':FULL Lower TRIangular 
%         'full':FULL
%     OPTIONAL:
%     #abqDir# (string) is a string containing the path of the current
%         working directory in which the mtx file exists.
%
% Output parameters
%     #Mout# ([#n# x #m#]) is a floating point array which is the matrix
%         requested.
%
% Example
%     file={'MAT_STIF1.mtx';
%         'MAT_MASS1.mtx';
%         'MAT_DMPV1.mtx';
%         'MAT_DMPS1.mtx'};
%     abqDir='C:\Abaqus_Temp';
%     for i=1:4
%         mtxFile=file{i};
%         Mout = getMatrix(mtxFile,'full',abqDir)
%         Mout = getMatrix(mtxFile,'fullTril',abqDir)
%         Mout = getMatrix(mtxFile,'sparse',abqDir)
%         Mout = getMatrix(mtxFile,'sparseTril',abqDir)
%     end
%
% _________________________________________________________________________
% Abaqus2Matlab - www.abaqus2matlab.com
% Copyright (c) 2017 by George Papazafeiropoulos
%
% If using this toolbox 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



% Initial checks
if nargin<2
    error('Not enough input arguments.');
elseif nargin==2
    mtxFile=varargin{1};
    sw=varargin{2};
    % Use the directory of this function
    abqDir=pwd;
else
    mtxFile=varargin{1};
    sw=varargin{2};
    % Use the directory specified by the user
    abqDir=varargin{3};
    if nargin>3
        warning('Too many input arguments.')
    end
end
oldFolder=cd(abqDir);
% Check if mtxFile exists in the working directory
if ~(exist(mtxFile,'file')==2)
    error(['The file ',mtxFile,' does not exist'])
end
% generate matrix from mtx file - main function
K=matrixGen(mtxFile,zeros(0,1),zeros(1,0));
% export matrix
switch sw
    case 'sparseTril'
        Mout=sparse(K);
    case 'sparse'
        K=K+tril(K,-1)';
        Mout=sparse(K);
    case 'fullTril'
        Mout=K;
    case 'full'
        K=K+tril(K,-1)';
        Mout=K;
    otherwise
end
cd(oldFolder);
end

方法2

另一种提取刚度阵和质量阵的方法是把上述中的*MATRIX OUTPUT, STIFFNESS, FORMAT=MATRIX INPUT替换为*MATRIX OUTPUT, STIFFNESS, FORMAT=COORDINATE,可以直接获取如下形式的稀疏刚度阵和质量阵。

row,  column,  value
  1,      1,  4.01340706825e-36
  2,      1,  5.60098743107e-37
  1,      2,  5.60098743107e-37
  3,      1, -5.22761524367e-37
  1,      3, -5.22761524367e-37
  4,      1, -2.07870246255e-37
  1,      4, -2.07870246255e-37
  5,      1, -3.62444662193e-38
  1,      5, -3.62444662193e-38
  6,      1, -3.18133224619e-37
  1,      6, -3.18133224619e-37
  7,      1, -6.63360514036e-37
  1,      7, -6.63360514036e-37

inp文件如下:

** Output Global Stiffness Matrix
*Step, name=Global_Stiffness_Matrix
*MATRIX GENERATE, STIFFNESS
*MATRIX OUTPUT, STIFFNESS, FORMAT=COORDINATE
*End Step
** Output Global Mass Matrix
*Step, name=Global_Mass_Matrix
*MATRIX GENERATE, MASS
*MATRIX OUTPUT, MASS, FORMAT=COORDINATE
*End Step