Dear George,
I am trying to extract and assemble structural matrices using the getMatrix module, but I get the error "cannot grow a matrix with greater than intmax() elements." For reference, intmax() returns int32 in the computer I am using.
I am attempting to obtain a SPARSE matrix of around 1M non-zero elements, and I should not have memory problems in the computer I am using. I have successfully used A2M's getMatrix with smaller matrices.
Have you come across this problem before?
Your help will be greatly appreciated.
Victor
Thanks! You can contact me at gpapazafeiropoulos@yahoo.gr
Dear George,
Please provide an email address to continue communication.
Thank you for your help!
Victor
Dear Victor,
I have run out of ideas about the possible reasons for this issue. Could you send me a version of your file(s) so that I can reproduce the error and fix the issue? Confidentiality in the various files and/or models shared with the Abaqus2Matlab work team is explicitly declared.
Thank you and sorry for the delayed answer.
Best,
George
Dear George,
Thank you for your reply. Unfortunately, I got the same error. For reference: I have indeed an MPC in my model. I am trying to preferably have a rigid body to model a mass, tied to a deformable shell-element body; however, since this might cause me some problems in my model, I am attempting to make the first body deformable as well. My goal is to obtain the structural matrices of Structure 2 to analyze it, and ideally having Structure one just as an added mass in the global M and K matrices. So far, I tried the easier thing to do, which is having both structures to be deformable and run a Dynamic/Implicit simulation.
This is what I wrote in the Abaqus input file, to generate two different sets of matrices and compare them (the second one is the one I had been using up until your suggestion):
** Output Global Stiffness Matrix *Step, name=INPUTMATRIX1 *MATRIX GENERATE, MPC=YES, SOURCE=ALL, FIELD=ALL, STIFFNESS, MASS, STRUCTURAL DAMPING *MATRIX OUTPUT, STIFFNESS, MASS, STRUCTURAL DAMPING, FORMAT=MATRIX INPUT *End Step ** Output Global Stiffness Matrix *Step, name=INPUTMATRIX2 *MATRIX GENERATE, STIFFNESS, MASS, STRUCTURAL DAMPING *MATRIX OUTPUT, STIFFNESS, MASS, STRUCTURAL DAMPING, FORMAT=MATRIX INPUT *End Step
Both sets of matrices were identical. This is the error message I get in Matlab:
Cannot grow a matrix with greater than intmax() elements.
Error in matrixGen (line 1) Error in getMatrix (line 106) K=matrixGen(mtxFile,zeros(0,1),zeros(1,0));
Any further help would be VERY appreciated.
Best regards,
Victor
Dear Victor,
It seems that the issue is not related to the intmax('int32') restriction. Please do the following and let me know if it will work:
1) Specify in the Abaqus input file the option *MATRIX GENERATE, MPC=YES, SOURCE=ALL, FIELD=ALL and delete the parameters ELEMENT BY ELEMENT and PUBLIC NODES, if they exist.
2) Specify in the Abaqus input file the option *MATRIX OUTPUT,FORMAT=MATRIX INPUT.
Please run the Abaqus analysis with the above options and try to extract the matrix with Abaqus2Matlab.
Let me know if the issue is fixed.
Thank you for your consideration,
George
Dear George, please allow me to add: interestingly enough, I tried assembling a different matrix, with a similar size (19392-by-19392) (actually a bit larger than the matrix with the problem described above, which is 18336-by-18336), and getMatrix could handle it without a problem. Might it be a problem with the elements themselves?
Thank you again.
Victor
Dear George,
Thank you for your prompt response. However, in my case, even if I reduced the matrix to be approximately 500,000 and 250,000 nonzero elements for the mass and stiffness, respectively, I get the same intmax error as above. Clearly the number of non-zero elements is less than the intmax('int32') = 2,147,483,647 limit . Does the getMatrix code compile the matrices by full matrix assembly and then converts it to sparse? Even if this were the case, the full matrices would have around 338 million elements in this case, which is below the 2.1 billion int32 limit. So I am at a loss here and unable to find a solution.
What could be causing this particular problem??
Also, if there is no other way around it, how would you suggest implementing a for loop to tackle this problem?
Thank you very much for all your help.
Victor
Dear Victor,
Thank you very much for your consideration.
Apparently, at least an array with number of elements higher than intmax('int32') is involved in the process. In the following link, the various array size restrictions for code generation are presented:
https://www.mathworks.com/help/coder/ug/array-size-restrictions-for-code-generation.html
Since the function matrixGen.mexw64 is MEXed and is called by getMatrix.m, it is obvious that the above restrictions apply to both of these functions.
However, since this functionality works for smaller matrices, there is a way to bypass this issue if, instead of extracting the full structural matrix, you extract smaller chunks of it with the use of a loop and then assemble these into the final format. See the following link for more information:
https://www.mathworks.com/matlabcentral/answers/166142-how-can-i-re-mex-matlab-coder-generated-c-h-and-o-files-using-largedimarrays-flag#answer_161922
I hope that the above helps you.
Best regards!
George