|
[Sponsors] |
March 21, 2011, 08:11 |
eigenVectors ?
|
#1 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi Foamers,
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? thanks T.D. |
|
March 21, 2011, 09:40 |
|
#2 |
Member
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17 |
Hello,
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: http://foam.sourceforge.net/docs/cpp..._8H_source.php Best regards, Fred
__________________
Frederic Collonval Technische Universität München Thermodynamics Dpt. |
|
March 21, 2011, 10:06 |
|
#3 | |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi,
i am trying to get eigenVectors of the strain rate tensor E, so i tried volTensorField Gr=fvc::grad(U); volSymmTensorField E = symm(Gr); volTensorField T=eigenVectors(E); and it didn't work !!!! i get this error: Quote:
Any ideas ???? |
||
March 21, 2011, 12:19 |
|
#4 |
Member
Frederic Collonval
Join Date: Apr 2009
Location: Technische Universitaet Munich - Lehrstuhl fuer Thermodynamik
Posts: 53
Rep Power: 17 |
Hello T.D.,
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... Good luck, Frederic
__________________
Frederic Collonval Technische Universität München Thermodynamics Dpt. |
|
March 22, 2011, 03:37 |
|
#5 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi
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 yours, T.D. Last edited by T.D.; March 22, 2011 at 03:51. Reason: forgot something need to be changed |
|
March 23, 2011, 02:24 |
|
#6 |
Senior Member
Kathrin Kissling
Join Date: Mar 2009
Location: Besigheim, Germany
Posts: 134
Rep Power: 17 |
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 volTensorField myEigenVectors ( IOobject ( "myEigenVectors", myVolTensorFieldWhatIHave.time().timeName(), myVolTensorFieldWhatIHave.mesh(), IOobject::NO_READ ), myVolTensorFieldWhatIHave.mesh(), dimensionedTensor::zero ); 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 Kathrin Last edited by kathrin_kissling; March 23, 2011 at 02:29. Reason: Formating screwed up |
|
March 23, 2011, 03:59 |
|
#7 |
Senior Member
Join Date: Sep 2010
Posts: 226
Rep Power: 16 |
Hi,
thanks a lot for your anwser, but i tried this inside the time loop: volTensorField Gr=fvc::grad(U); volSymmTensorField E = symm(Gr); Srate.component(0)=E.component(0); Srate.component(1)=E.component(1); Srate.component(2)=E.component(2); Srate.component(3)=E.component(3); Srate.component(4)=E.component(4); Srate.component(5)=E.component(5); Srate.component(6)=E.component(6); Srate.component(7)=E.component(7); Srate.component(8)=E.component(8); volTensorField Ei=eigenVectors(Srate); 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: volTensorField Srate ( IOobject ( "Srate", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh ); --------------------------------------------------------------------- yours, T.D. |
|
October 21, 2013, 02:47 |
|
#8 |
Member
Ripudaman Manchanda
Join Date: May 2013
Posts: 55
Rep Power: 13 |
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.
|
|
February 3, 2016, 04:12 |
|
#9 |
Member
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 10 |
Dear Foamers,
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). Code:
Foam::vector eigenVector (const tensor & t, const scalar lambda) 2.) Assigning the return value like this (for a simple test case) Code:
vector eigenvector_real = eigenVector( Tensor, eigenvalue_real ); error: reference to ‘vector’ is ambiguous Why that?! The return type should be 'vector'?! I would be glad for help, Peter |
|
February 3, 2016, 04:27 |
|
#10 |
Member
Peter
Join Date: Nov 2015
Location: Hamburg, Germany
Posts: 57
Rep Power: 10 |
Stop - it works
For Foamers with similar problems: -> 1.) I should have defined the return value as a volVectorField (and not as a volTensorField like for the function 'eigenVectors'). Code:
volVectorField EV = U * 0.0; forAll(l_ci, i) // l_r is a volScalarField for the real eigenvalue { ... // calculate real eigenvalue l_r[i] EV[i] = eigenVector(gradU[i], l_r[i]); } -> 2.) Still not clear, but it works, so what! Peter |
|
February 13, 2016, 04:48 |
|
#11 |
Senior Member
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17 |
Hi guys,
About the eigenvectors and eigenvalue, Alberto has implemented a solver to handle this. check it out here: https://bitbucket.org/albertop/eigensolver Good luck!
__________________
My OpenFOAM algorithm website: http://dyfluid.com By far the largest Chinese CFD-based forum: http://www.cfd-china.com/category/6/openfoam We provide lots of clusters to Chinese customers, and we are considering to do business overseas: http://dyfluid.com/DMCmodel.html |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
EigenVectors and volSymmTensorField | shane5ul | OpenFOAM | 0 | November 25, 2009 11:23 |
Eigenvectors and solution to sparse linear system. | mr_fluent | Main CFD Forum | 0 | August 6, 2009 21:13 |
Texts for eigenvalues, eigenvectors & pde's | diaw (Des Aubery) | Main CFD Forum | 24 | April 24, 2006 11:32 |
Eigenvalues and Eigenvectors for 3-D TVD Finite Volume Solver | Axel Rohde | Main CFD Forum | 3 | April 2, 2000 17:42 |
Eigenvalues & Eigenvectors in General Geometries for 3-D TVD Solver | Axel Rohde | Main CFD Forum | 3 | October 6, 1999 14:48 |