# Eigenvector for the largest positive eigenvalue of the symm( fvc::grad ( U ) )

 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 8, 2010, 13:52 Eigenvector for the largest positive eigenvalue of the symm( fvc::grad ( U ) ) #1 Senior Member   Join Date: Mar 2009 Posts: 248 Rep Power: 9 Dear Forum users Good Evening For some post processing , I need to find out the eigenvector, which corresponds to the largest positive eigenvalue of symmetric part of the velocity gradient tensor . Here is what I am doing : volVectorField eigenVLarge ( IOobject ( "eigenVLarge", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ), mesh, dimensionedVector("", dimless, vector(0, 0, 0)) ); volTensorField gradU = fvc::grad( U ); volSymmTensorField D = symm(gradU); forAll(UDef, cellI) { // Grab the tensor in the current cell const tensor& tCurrent = D[cellI]; // Evaluate the eignevalues vector eVal = eigenValues(tCurrent); // The routine which returns the eigenvalues, sorts them in increasing order // of their magnitude. So if i need to find the largest eigenvalue then I have to // search for the maximum of three numbers. I did a workaround which is // not very OpenFOAMy style. Here is what I did label minIndex = -1; label maxIndex = -1; if( (eVal.x() <= eVal.y()) && (eVal.x() <= eVal.z()) ) { minIndex = 0; if ( eVal.y() < eVal.z()) { maxIndex = 2; } else { maxIndex = 1; } } if( (eVal.y() <= eVal.x()) && (eVal.y() <= eVal.z()) ) { minIndex = 1; if ( eVal.x() < eVal.z()) { maxIndex = 2; } else { maxIndex = 0; } } if( (eVal.z() <= eVal.x()) && (eVal.z() <= eVal.y()) ) { minIndex = 2; if ( eVal.x() < eVal.y()) { maxIndex = 1; } else { maxIndex = 0; } } // Once I have the maxIndex and minIndex I can get the eigenvectors // corresponding to the maximum eigenvalues like this tensor eVector = eigenVectors(tCurrent); if (maxIndex == 0) { eigenVLarge[cellI] = eVector.x(); } else if (maxIndex == 1) { eigenVLarge[cellI] = eVector.y(); } else if (maxIndex == 2) { eigenVLarge[cellI] = eVector.z(); } eigenVLarge.write(); This is very much not OpenFOAM style and I am sure there is some better way to get the eigenVector which corresponds to the maximum eigenvalue of the strain rate tensor D It would be nice if somebody aware of this could please share their experience. Thanks alot Best Regards jaswi Last edited by jaswi; September 8, 2010 at 13:54. Reason: found some typos :-)

 September 13, 2010, 08:43 #2 Senior Member   Join Date: Mar 2009 Posts: 248 Rep Power: 9 Dear Forum Users Some body with the experience on how to deal with this , please comment. Thanks in advance Regards jaswi

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post J CFX 11 November 3, 2008 17:46 Matt U. Main CFD Forum 6 July 4, 2005 05:29 Chris Main CFD Forum 8 December 18, 2003 09:35 Stephen Main CFD Forum 0 April 7, 2003 10:28 Abhi Main CFD Forum 12 July 8, 2002 09:11

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