Incorrect eigenvalues for a symmetric positive-definite matrix
Summary
It appears I am getting incorrect eigenvalues for a symmetric positive-definite matrix. It results in incorrect eigenvectors which end up being linearly dependant (as if the matrix was defective). This impacts the turbulentInletDFSEM
as eddy
objects lose a dimension.
Steps to reproduce
Here's a minimal example, I concocted:
#include "fvCFD.H"
int main(int argc, char *argv[])
{
Info<< "\nCalculating eigenvalues of a symmetric positive-definite matrix\n";
symmTensor A = symmTensor(
0.005,
-0.0003,
0.001,
0.002,
0.0001,
0.002);
vector lambda(eigenValues(A));
Info<< "Eigenvalues (OpenFOAM): " << lambda << endl;
Info<< "Eigenvalues (numpy.linalg): (0.00532289, 0.00160802, 0.0020691)" << endl;
return 0;
}
What is the current bug behaviour?
Output I am getting:
Eigenvalues (OpenFOAM): (0.00183856 0.00183856 0.00532289)
Eigenvalues (numpy.linalg): (0.00532289, 0.00160802, 0.0020691)
What is the expected correct behaviour?
See above. I compared it with numpy.linalg
.
Environment information
- OpenFOAM version : v2006
- Operating system : Arch Linux
- Hardware info : Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
- Compiler : gcc :
Possible fixes
Use alternatives eigensolvers. I currently went with Eigen but I am looking for another OpenFOAM native solution.
Edited by Robert Manson-Sawko