- **OpenFOAM Bugs**
(*http://www.cfd-online.com/Forums/openfoam-bugs/*)

- - **EigenVecotrsbug**
(*http://www.cfd-online.com/Forums/openfoam-bugs/62509-eigenvecotrsbug.html*)

Hi all~
I'm trying to get eigHi all~
I'm trying to get eigenvalues and eigenvectors from some tensor. There is no problem in tensor and in eigenvalues. but The problem occurs when one of eigenvalue is negative. and I found some source code in /home/asteria/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/primitives/tensor/tensor.C in line 186 and 382 as below. ---------------below------------------------- vector eigenVector(const tensor& t, const scalar lambda) { if (lambda < SMALL) { return vector::zero; } ---------------------------------------------- I think this line is the reason it gives zero vector when of which eigenvalue is negative. Do you guys have any idea about why they add line like these? Thanks in advance, Hyunchang |

Hi Hyunchang,
I think this Hi Hyunchang,
I think this is a slight oversight and the test should be if (mag(lambda) < SMALL) to avoid attempting to calculate eigenvectors for zero eigenvalues. Of coarse it is debatable if SMALL is the correct level of smallness for the test and I am open to suggestions. Henry |

Hi, Henry. Thanks for your ansHi, Henry. Thanks for your answer.
I changed the file, /home/asteria/OpenFOAM/OpenFOAM-1.4.1/src/OpenFOAM/lnInclude/tensor.C and compile it again and did tensorTest and the result is like this. asteria@leehc:~/OpenFOAM/OpenFOAM-1.4.1/applications/test/tensor> tensorTest (2 4 6 5 7 9 8 10 12) (1.33333 1.33333 -0.333333 1.33333 1.83333 -0.333333 -0.333333 -0.333333 0.333333) (1 0 0 1.66533e-16 1 0 -5.55112e-17 0 1) (1 2 3)(4 5 6)(7 8 9) tensor (9e-05 5.65685e-05 0 5.65685e-05 8.90625e-05 5.21632e-05 0 5.21632e-05 4.6143e-05) eigenvalues (-2.09381e-06 6.80075e-05 0.000159292) eigenvectors (0.384905 -0.626627 0.677633 0.705091 -0.274123 -0.653991 0.595563 0.729517 0.336317) Check determinant -2.26823e-14 -2.26823e-14 Check eigenvectors (-8.05919e-07 1.31204e-06 -1.41884e-06)(-8.05919e-07 1.31204e-06 -1.41884e-06) (4.79514e-05 -1.86424e-05 -4.44762e-05)(4.79514e-05 -1.86424e-05 -4.44762e-05) (9.48684e-05 0.000116206 5.35726e-05)(9.48684e-05 0.000116206 5.35726e-05) Check transformation (157 367 577 367 856 1345 577 1345 2113) (157 367 577 367 856 1345 577 1345 2113) Check symmetric transformation (157 367 577 856 1345 2113) (1 2 3 4 6 9) (1 2 3 4 5 6) (2 4 6 8 10 12) 129 11.3578 I changed the tensor, t6 as I want. Now although one of three eigenvalues is negative, but it still gives correct eigenvectors.(I compared it with the result of mathematica.) and Henry. I know it could be a silly question but I'm quite new and fool in c++ and OpenFOAM. How can I find the definition of SMALL? and can you explain me about the role of lnInclude folder? cause I changed the tensor.C file in that( lnInclude) folder but after recompiling tensor.C in the other folder is also changed! Thanks to stand me. Hyunchang. ps. And We are trying to modify twoPhaseEulerFoam that it could solve additional moments transfer equations. But I don't know much about how to write code in OpenFOAM, like defining new variable and solving new equation and something like that. so I'm doing that very silly way and I'm not sure that I'm going right direction. so can I send you a question when I need your advise? |

There are various ways to findThere are various ways to find things in OpenFOAM source, you could use the Doxygen documentation and search-engine or more directly use grep e.g.
cd $FOAM_SRC/OpenFOAM/lnInclude grep SMALL *.H which will give you doubleScalar.H:static const doubleScalar doubleScalarSMALL = 1.0e-15; and floatScalar.H:static const floatScalar floatScalarSMALL = 1.0e-6; OpenCFD would be happy to help you develop your OpenFOAM applications as part of a support contract, details of which can be requested from our web-site. Henry |

Thanks Henry http://www.cfd-on |

All times are GMT -4. The time now is 02:54. |