CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

Eigenvectors of a volFieldTensor

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 19, 2020, 02:55
Default Eigenvectors of a volFieldTensor
  #1
New Member
 
Nazario Mastroianni
Join Date: Feb 2020
Posts: 3
Rep Power: 6
NazarioM is on a distinguished road
Hello FOAMers,
I am new to OpenFOAM and not very experienced with C++ so my questions might be very trivial for many/most of you. However, I have not been able to find an exhaustive answer, so...
I need to compute the eigenvectors of a volTensorField E. eigenVectors(E) returns a volTensorField, but how can I get each individual eigenvector? From what I have read, they should be defined in the internalField, as lines, but I haven't been able to get them.
From what I understand, there is no direct way of extracting a vector from a tensor, so I thought I could compute the eigenvalues first and then the corresponding eigenvector for each eigenvalue. However, I'm facing the same issue when I use eigenValues(E) (a volVectorField): for some reason, I am not able to extract each individual eigenvalue.
Can anyone explain to me how to do?

Thanks in advance,
N.
NazarioM is offline   Reply With Quote

Old   February 19, 2020, 17:22
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
You can access a tensor within volTensorField by using square brackets, e.g.

const auto eVecs = eigenVectors(E);
const auto eVec = eVecs[0]; // first element within the list.

Hope didnt misunderstand your question.
HPE is offline   Reply With Quote

Old   February 19, 2020, 18:10
Default
  #3
New Member
 
Nazario Mastroianni
Join Date: Feb 2020
Posts: 3
Rep Power: 6
NazarioM is on a distinguished road
Quote:
Originally Posted by HPE View Post
You can access a tensor within volTensorField by using square brackets, e.g.

const auto eVecs = eigenVectors(E);
const auto eVec = eVecs[0]; // first element within the list.

Hope didnt misunderstand your question.
Thank you for your answer, HPE. Unfortunately, it did not work, as I get an error saying "no match for operator []".
I have come up with a workaround, calculating the eigenvalues first and then the corresponding eigenvector for each eigenvalue. However I can only obtain the values in the internalField in this way (because I use forAll cellI). I would need my eigenvectors to be defined over the entire domain, boundary included.
Do you have any other solution?
NazarioM is offline   Reply With Quote

Old   February 19, 2020, 22:00
Default
  #4
New Member
 
Nazario Mastroianni
Join Date: Feb 2020
Posts: 3
Rep Power: 6
NazarioM is on a distinguished road
Update:

It is sufficient to multiply eigenVectors(T) by a vector vx(1,0,0) to extract the first eigenvector (first row of eigenVectors(T)), and similarly for the other two.

Last edited by NazarioM; February 20, 2020 at 06:10.
NazarioM is offline   Reply With Quote

Old   February 20, 2020, 11:39
Default
  #5
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 932
Rep Power: 12
HPE is on a distinguished road
Could you please share a bit of code, otherwise difficult to follow what needs to be done?
HPE is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Normalization of eigenvectors of the Euler equations bubble45 Main CFD Forum 9 March 16, 2015 17:09
Eigenvalues and eigenvectors? Vino Main CFD Forum 2 August 16, 2014 22:18
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


All times are GMT -4. The time now is 04:45.