what is the exact function in openFoam to get the eigenVectors of a volsymmTensorField A ? If it will return a tensor , then how are the vectors aligned, they will be as rows or as columns in the tensor?
The function is really easy:
eigenVectors(A) should work
And it will return in your case a volTensorField T
For each cell i, the first eigen vector is T.internalField()[i].x(), the second T.internalField()[i].y() and the third T.internalField()[i].z()
But to answer directly they are store by line
so the first one is composed of xx, xy and xz.
In the code they use the constructor line 67 there:
i am trying to get eigenVectors of the strain rate tensor E, so i tried
volSymmTensorField E = symm(Gr);
and it didn't work !!!! i get this error:
Any ideas ????
my fault, eigenVectors is implemented only with volTensorField as input parameter not with volSymmTensorField.
So you will have to convert your E in a volTensorField. Hopefully a trick like tensor(1, 0, 0, 0, 1, 0, 0, 0, 1)*E will do the trick...
it didn't work as you said, i think it seems that eigenVectors() function does not accept a tensor with dimensions, any idea how to take only the values of the dimensioned volSymmTensorField "E" and put them in another dimensionless volTensorField (for example "E2" ) ???
thanks a lot
Hi it should work for a dimensionedTensor, since its implemented in the dimensionedTensor class. Probably it does not work on the boundaries... Try to work only on the internal field.
dimensionedTensorField myTensorFieldOfTheInternal = myVolTensorFieldWhatIHave.internal();
dimensionedTensorField myDesiredEigenvectors = eigenVectors(myTensorFieldOfTheInternal);
Then you give it back as
myEigenVectors.internal() = myDesiredEigenvectors;
If you need the values on the boundary, maybe you have to loop over those and do the same.
Hope this helps
thanks a lot for your anwser, but i tried this inside the time loop:
volSymmTensorField E = symm(Gr);
and it compiles well. What i need to know now, is it OK like this for filling all Srate components ? however E is symmetric tensor but Srate is not;
RK: ----inside .H file, Srate defined as:
I tried the above recommendations to obtain the eigenVectors but I get a NO_READ error. Also, can anyone on this forum tell me how to obtain the eigenvectors as three different vectors instead of a tensor so that I can easily plot the individual vectors as arrows.
thanks for the helpful discussion. Nevertheless, I have two remaining questions:
1.) How can I calculate the eigenvector for known eigenvalues?
(Reason: My problem has one real and two complex conjugate eigenvalues. I get an error calculating the complex eigenvectors, hence I would like to calculate only the eigenvector for the real eigenvalue.)
Therefor I would like to use the following function (defined in 'tensor.C' at line 207 (for OF 3.0.1).
2.) Assigning the return value like this (for a simple test case)
error: reference to ‘vector’ is ambiguous
Why that?! The return type should be 'vector'?!
I would be glad for help,
Stop - it works :)
For Foamers with similar problems:
I should have defined the return value as a volVectorField (and not as a volTensorField like for the function 'eigenVectors').
Still not clear, but it works, so what!
About the eigenvectors and eigenvalue, Alberto has implemented a solver to handle this. check it out here: https://bitbucket.org/albertop/eigensolver
|All times are GMT -4. The time now is 08:14.|