Skip to content
Snippets Groups Projects
Commit 866ca15d authored by mattijs's avatar mattijs Committed by Andrew Heather
Browse files

ENH: tensor: stabilise eigenvectors

parent 2ba52686
No related branches found
No related tags found
No related merge requests found
......@@ -150,7 +150,7 @@ Foam::vector Foam::eigenValues(const tensor& t)
if (R2 < Q3)
{
scalar sqrtQ = sqrt(Q);
scalar theta = acos(R/(Q*sqrtQ));
scalar theta = acos(min(1.0, max(-1.0, R/(Q*sqrtQ))));
scalar m2SqrtQ = -2*sqrtQ;
scalar aBy3 = a/3;
......@@ -345,7 +345,7 @@ Foam::vector Foam::eigenValues(const symmTensor& t)
if (R2 < Q3)
{
scalar sqrtQ = sqrt(Q);
scalar theta = acos(R/(Q*sqrtQ));
scalar theta = acos(min(1.0, max(-1.0, R/(Q*sqrtQ))));
scalar m2SqrtQ = -2*sqrtQ;
scalar aBy3 = a/3;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment