getting warning while using eigs on the matrices obtained from freefem++
10 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Christine Tobler
on 13 Feb 2024
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 Comments
Bruno Luong
on 14 Feb 2024
Edited: Bruno Luong
on 14 Feb 2024
"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
on 14 Feb 2024
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))
eig(full(K(2:end, 2:end)), full(M(2:end, 2:end)))
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.
More Answers (1)
Bruno Luong
on 13 Feb 2024
Try to follow the suggestion you get " Consider specifying a perturbed numeric sigma value to improve the condition of the matrix."
5 Comments
Bruno Luong
on 13 Feb 2024
Edited: Bruno Luong
on 13 Feb 2024
"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.
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!