What can I do to reduce sparse system solve time for a finite element analysis?

18 次查看(过去 30 天)
Hello! I've programmed a structural finite element analysis code in Matlab and have verified it by comparing results with those from the commercial FEA code Abaqus. The Matlab code works fine from a solution accuracy standpoint, but the solve time seems to become unusually large as the size of the system matrix increases, compared to the same analysis in Abaqus.
I've read numerous posts on this forum and a range of other webpages regarding Matlab sparse solvers, but I haven't been able to make any progress on this solution time issue. Maybe I just haven't read the right ones; if so, I apologize in advance for asking a question that has already been answered. Hopefully some people here can help steer me the right way :-) I'll do my best to provide all the relevant information about the Matlab code:
  1. It uses sparse storage for the system matrix KG and load vector P
  2. I'm primarily using the \ operator to solve the system: sol = KG \ P
  3. All analyses are small-displacement and use linear elastic materials. The Abaqus analyses use Abaqus/Standard and are 'linear perturbation' analyses in Abaqus terminology.
  4. In the small analyses I've run, KG is 7,944 x 7,944. This takes ~4 seconds to solve in Matlab and ~1.2 seconds to solve in Abaqus. Density is 0.0080 via nnz(KG)/prod(size(KG)).
  5. In the large analyses, KG is 55,479 x 55,479. This takes ~600 seconds (!) to solve in Matlab, but only ~4 seconds to solve in Abaqus. This seems bizarre -- what am I missing? Density is 0.0012.
  6. For what it's worth, the Abaqus output files state it is using a direct sparse solver (not an iterative method). Here is the key information on this solver as copied from the Abaqus documentation: The direct linear equation solver finds the exact solution to this system of linear equations (up to machine precision). The direct linear equation solver in Abaqus/Standard uses a sparse, direct, Gauss elimination method. The direct sparse solver uses a “multifront” technique that can reduce the computational time to solve the equations dramatically if the equation system has a sparse structure.
  7. Matlab's iterative methods may offer some potential to speed things up, but from the trials I've done so far, it seems I have to reduce accuracy by an unacceptable amount to get an appreciable reduction in run time.
  8. I've tried the RCM and AMD reordering functions but have seen no reduction in solution time -- maybe I did this wrong?
abc = symrcm(KG);
testSol.rcm = KG(abc,abc) \ P(abc);
For reference, here are spy plots of the KG matrices for a small model, in the as-built form, and after AMD and RCM. Note that in the as-built cases, there are nonzero terms along the right and bottom 'edges' of KG due to constraint equations. For completeness, the next batch of three spy plots is for a large model (which are fundamentally the same as the small KG matrices). Still scratching my head on what the issue is....
Thanks in advance for any guidance :-)
John
  4 个评论
Matt J
Matt J 2017-1-17
编辑:Matt J 2017-1-17
Maybe the Abaqus solver algorithm is just much more efficient (?)
Maybe, and in particular, we don't know anything about the "multifront" technique mentioned. However, it is equally possible that Abaqus achieves speed by using a less robust method than MATLAB.
Gaussian elimination, in particular, is supposed to be hazardous, unless careful pivoting rules are applied. MATLAB's sparse linear solver appears to consider a range of alternatives to Gaussian elimination,
Of course, it might also be that, in the space of FEA problems, Gaussian elimination happens to be pretty reliable...
jjp11
jjp11 2017-1-17
All good thoughts, Matt. Thanks for the input. In doing a bit more poking around, I came across some posts by Tim Davis on these forums and found that he publishes a package of sparse solvers, including some that use multifrontal techniques:
I'll be taking a look at those next....

请先登录,再进行评论。

回答(1 个)

Paulo Ribeiro
Paulo Ribeiro 2018-6-11
John,
Please monitor your RAM. The direct solver has this drawback and can ruin your runtime if memory goes to HDD swap. I have been doing some 2D elasticity codes and here are some CPU samples:
KG order | A\b time (s)
230,000 2
925,000 12
2,550,000 46
My setup: i7 7700hq with 16Gb of RAM; Preprocessing provided by GiD; Direct solver with sparse matrix; Clamped beam with a transverse load.
Regards,
Paulo

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by