Improve efficiency of AssembleFEMatrices?

7 ビュー (過去 30 日間)
Elliot Bontoft
Elliot Bontoft 2021 年 3 月 30 日
コメント済み: Ravi Kumar 2021 年 3 月 31 日
Dear all,
I am using the PDE Toolbox to perform a FEM simulation. I am using the following toolbox function to aquire the matrices I am after:
FEM = assembleFEMatrices(model,'nullspace')
However, the only matrices I require are the global stiffness matrix (FEM.Kc) and nodal force vector (FEM.Fc).
The issue is that the assembleFEMatrices function is quite costly. I was wondering if there is a way improve the efficiency of this? Could the stiffness matrix and force vector be calculated another way, i.e. could they be calculated from the results of the 'solve' function that is less time consuming:
results = solve(model);
Or if it is possible to assemble ONLY the matrices you desire to reduce the computational expense?
Thank you for any advices/solutions that can be offered

採用された回答

Ravi Kumar
Ravi Kumar 2021 年 3 月 30 日
If you are using R2020b or newer version of MATLAB, you should be able to specify required matrices as input:
Regards,
Ravi
  3 件のコメント
Elliot Bontoft
Elliot Bontoft 2021 年 3 月 31 日
Hi all,
Ravi was right and this was possible through using specified requested matrices in the input. You just have to manually impose the boundary conditions to build the stiffness matrix and force vector, as follows:
FEM = assembleFEMatrices(model,'HKAQFG');
[FEM.B,Or] = pdenullorth(FEM.H); % compute the nullspace of columns of H
FEM_Fc = FEM.B'*(FEM.F + FEM.G);
FEM_Kc = FEM.B'*(FEM.K + FEM.A + FEM.Q)*FEM.B;
This is notably faster than using
FEM = assembleFEMatrices(model,'nullspace')
to access the FEM.Fc and FEM.Kc matrices
Ravi Kumar
Ravi Kumar 2021 年 3 月 31 日
Eaxctly! Selecting a subset of matrices or specifying BC appliction option are sort of orthogonal. You need to do the way you are doing. I would also add, you can assemble some of these matrices once and some that have some variation over time or solution repeatedly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeneral PDEs についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by