フィルターのクリア

getting warning while using eigs on the matrices obtained from freefem++

21 ビュー (過去 30 日間)
AMIT
AMIT 2024 年 2 月 13 日
編集済み: Bruno Luong 2024 年 2 月 14 日
I am trying to solve for the temporal stability of the incompressible viscous plane poiseuille flow using freefem++.
When i import the matrices and solve for eigen value using eigs , i get this warning:
Warning: The first input matrix, shifted by sigma, is close to singular or badly scaled (RCOND = 7.026665e-305) and results may be inaccurate. Consider specifying a perturbed numeric sigma value to improve the condition of the matrix.
Do i have to do some preconditioning in the matrices in freefem or is there some option in the MATLAB to do the same.

採用された回答

Christine Tobler
Christine Tobler 2024 年 2 月 13 日
If modifying the input sigma doesn't help, it's likely that for your call eigs(A, B, sigma, ...) the matrices are such that A - sigma*B is always singular for any sigma.
This would mean there is at least one vector v for which A*v = 0 and B*v = 0, meaning this is an "eigenvector" for every possible eigenvalue sigma. That means the eigenvalue problem is ill-posed.
This is not so uncommon for matrices coming from FEM, it basically means the matrix size is larger than than the degrees of freedom in the underlying problem.
I'm not an expert on FEM, but for example, if we apply Dirichlet conditions to the first basis, this likely means that the first row and column of both A and B is all zero. That would lead to exactly the issue above. Removing the first row and column of both A and B would result in a smaller and well-posed problem.
Possibly freefem++ provides some options that would cut out these additional degrees of freedom? I don't know the software well enough to help with this.
  5 件のコメント
Bruno Luong
Bruno Luong 2024 年 2 月 14 日
編集済み: Bruno Luong 2024 年 2 月 14 日
"I think for a Dirichlet condition, it's not just the diagonal that is zero"
Not that I said. I said that the row-columb is 0s but the diagonal term is NON-zero (eg., 1), and rhs set to the value of dirichlet value * K(1,1).
K = assemblymatrix();
K(1, :)=0; K(1,1) = 1; rhs(1) = u1; % u1 is value of solution u at node 1
Christine Tobler
Christine Tobler 2024 年 2 月 14 日
If the requested number of eigenvalues is more than half the size of the matrix, eigs falls back to eig, since this is more efficient.
And eig will return something for this case, although as you can see there are some NaN eigenvalues, and the others don't match what would happen otherwise:
K=rand(4); K=K*K'; K(1, :)=0; K(:, 1) = 0; K=sparse(K+K');
M=rand(4); M=M*M'; M(1,:)=0; M(:,1)=0; M=sparse(M+M');
eig(full(K), full(M))
ans = 4×1
NaN 0.1363 0.7073 NaN
eig(full(K(2:end, 2:end)), full(M(2:end, 2:end)))
ans = 3×1
0.2181 0.5539 2.7989
This is because EIG is based on the QZ decomposition, which would not be affordable for the sparse case since it returns completely dense matrices. In EIGS, instead an LU decomposition of K-sigma*M is computed, which is used to solve linear systems; for this reason, EIGS errors if that matrix is singular.

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

その他の回答 (1 件)

Bruno Luong
Bruno Luong 2024 年 2 月 13 日
Try to follow the suggestion you get " Consider specifying a perturbed numeric sigma value to improve the condition of the matrix."
  5 件のコメント
AMIT
AMIT 2024 年 2 月 13 日
i do know that real part of eigen values will lie between 0 to 0.8 and i used 5 for sigma. Also in eigs i have two matrices for MX=lambda N X eigen value problem.
Also following the above suggestion i get this message:
The first input matrix, shifted by sigma, is singular, therefore sigma is an eigenvalue of the first input matrix. Consider specifying a perturbed numeric sigma value to improve the condition of the matrix.
WarnIfIllConditioned(rcond(dAminusSigmaB), 'A', eigsSigma);
applyOP = AminusSigmaBSolve(A, B, innerOpts.sigma, Amatrix, n, ...
Error in eigs (line 122)
[applyOP, applyM] = getOps(A, B, n, spdB, shiftAndInvert, R, cholB, permB,...
Bruno Luong
Bruno Luong 2024 年 2 月 13 日
編集済み: Bruno Luong 2024 年 2 月 13 日
"i do know that real part of eigen values will lie between 0 to 0.8 and i used 5 for sigma. "
Why you chose 5 if you know the realpart is in between 0 and 0.8? How exactly do you call eigs?
If the matrices is from FEM simulation, the chance that the eigen value is exactly 5 is zero.
I suspect the call eigs command is incorrect, sounds like you mix up k and sigma arguments and your matrix M is singular.

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

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by