- **OpenFOAM Running, Solving & CFD**
(*https://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Eigenvector for the largest positive eigenvalue of the symm( fvc::grad ( U ) )**
(*https://www.cfd-online.com/Forums/openfoam-solving/79932-eigenvector-largest-positive-eigenvalue-symm-fvc-grad-u.html*)

Eigenvector for the largest positive eigenvalue of the symm( fvc::grad ( U ) )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 |

Dear Forum Users
Some body with the experience on how to deal with this , please comment. Thanks in advance Regards jaswi |

All times are GMT -4. The time now is 01:16. |