CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   Lambda-2 criterion (http://www.cfd-online.com/Forums/main/99674-lambda-2-criterion.html)

 saeedi April 9, 2012 13:16

Lambda-2 criterion

Hi there,

Does any one know how to calculate Lambda-2 criterion?
I read the original paper by Adrian but I could not fully get it.
I know how to calculate Q-criterion and I have done it for some cases but for Lambda-2 I have problem.

 sbaffini April 10, 2012 06:22

1 Attachment(s)
Dear saeedi,

the lambda 2 criterion simply concerns the definition of the scalar lambda2 and how turbulent structures can be visualized by proper isosurfaces of lambda2 (like for the Q criterion). Hence, the real difference with the scalar Q is how you compute the scalar lambda2.

This is defined as the second (in magnitude) eigenvalue of the matrix:

where:

This requires the construction of the characteristic cubic equation and its resolution in order to obtain lambda2 (that is, lambda2 is the second solution of the cubic characteristic equation).

For coherent structures the matrix above can be related to the opposite of the pressure Hessian matrix. As this matrix is real and symmetric, it has two positive eigenvalues when the pressure is at minimum. As a consequence, the matrix above has two negative eigenvalues and lambda2 is certainly negative (for coherent structures). How much negative you have to pick its isosurfaces is (for what i understand) related to the visual appealing of your images (like for the Q criterion)

I still have to seriously use and check it (so it comes without any warranty) but, some time ago, i made a routine for the computation of lambda2 in Fluent (you find it attached). It is very rudimental but i remember it did the job. Also, it is basically C so you can clearly adapt the core part to your needs (Fluent related parts are very understandable also for non-Fluent users)

Once you got lambda2, you just need to pick some negative isosurface and you're done

Hope it helps

 FMDenaro April 10, 2012 06:39

Hi,
Paolo wrote a complete explanation, I just add that the relevant paper for the lambda-2 criterion is :
http://journals.cambridge.org/action...ine&aid=353418

furhtermore, you can read the dedicated section in the book of Lesiuer.

Just as practical suggestion coming from my experience:

1) a threshold value lamba2 =0 is not useful for many flows, for example in confined turbulence. Too structures are identified, I suggest to use a slight greater value

2) identification of vortical structure with such a criterion is "static", does not imply the coherence of the identified structures.

 saeedi April 10, 2012 08:14

Hi Paolo and Flippo,

Great and clear answers. I almost got it. Thank you so much.

one question: Paolo, so the above matrix is -1 times pressure hessian ?
I mean in theory we can also calculate pressure hessian and choose the negative of the second aigen value?

one more question: Flippo, Could you please explain the point (2) a bit more?

P.S. : I am the one who asked about LES filters last week and you two guided me on it. I wrote the routine for dynamic smagorinsky and it is working nicely. Now I am going to add more sophisticated models.

 FMDenaro April 10, 2012 08:22

Quote:
 Originally Posted by saeedi (Post 353965) Hi Paolo and Flippo, Great and clear answers. I almost got it. Thank you so much. one question: Paolo, so the above matrix is -1 times pressure hessian ? I mean in theory we can also calculate pressure hessian and choose the negative of the second aigen value? one more question: Flippo, Could you please explain the point (2) a bit more? P.S. : I am the one who asked about LES filters last week and you two guided me on it. I wrote the routine for dynamic smagorinsky and it is working nicely. Now I am going to add more sophisticated models.

The definition of what is a "coherent structure" is quite vague ...but it is somehow related to that fact that the life of a vortical structure must be at least greater than the characteristic turnover time. Therefore, once identified some vortices with the lamba2 criterion you have just a snaphot at a fixed time. What happens to this vortices after some time? Some will be dissipated rapidly, others can be considered "coherent" beacause will survive for sufficient time. Hence, identification is only the first step...
For example, you could explore the spectral energy content in time and discovering if some energy peak remains relevant for some time period.

 saeedi April 10, 2012 08:31

Quote:
 Originally Posted by FMDenaro (Post 353967) The definition of what is a "coherent structure" is quite vague ...but it is somehow related to that fact that the life of a vortical structure must be at least greater than the characteristic turnover time. Therefore, once identified some vortices with the lamba2 criterion you have just a snaphot at a fixed time. What happens to this vortices after some time? Some will be dissipated rapidly, others can be considered "coherent" beacause will survive for sufficient time. Hence, identification is only the first step... For example, you could explore the spectral energy content in time and discovering if some energy peak remains relevant for some time period.
Ok. Got it. Or we can provide the variation of the same contours over time (like animation) and qualitatively see which ones remains. This will show us coherent structures qualitatively. right?

 FMDenaro April 10, 2012 08:40

yes, someway once identified (and marked) a vortex, you should follow in its evolution for a period of time greater than the turnover time, assessing if it is coherent or disappears ...
A statistical analysis of coherence can be found in:
Jeong J, Hussain F, Schoppa W, Kim J. Coherent structures near the wall in a turbulent channel flow. Journal of Fluid Mechanics 1997; 332: 185–214.

 sbaffini April 10, 2012 10:01

Dear saeedi,

according to my understanding of this matter you are correct and the reason for using such a matrix (instead of the negative of the pressure Hessian) is barely due to the lower order of the derivatives involved in it which, by the way, are also already available (see my routine, where i simply ask fluent for them). In contrast, pressure 2nd derivative should be computed on purpose (and in my case it wasn't an option).

However, i don't actually know if there are more intrinsic reasons for this (e.g., if the whole reasoning is still valid for compressible flows etc.), but doing what other people do usually is the best first step if you don't know what to do. Actually, i simply got the lambda2 definition from the Lesieur's book cited by Filippo and used it

 saeedi April 10, 2012 10:43

Good!
So much thanks to both of you

Hi Paolo

Best
Mehdi

 sbaffini April 26, 2012 16:01

Dear mahdi,

sorry if it looks silly by i have first to ask you to do the following:

1 - go under /solve/set/expert and when asked to keep memory from being freezed answer yes

2 - compute, say, 5 time steps (just to be sure)

3 - add 1 user defined memory

4 - load the udf and interpret it

5 - use it under define on demand

6 - under the surface->isosurface GUI menu define an isosurface of user_defined_memory_0

This is for what concerns the basic functionality (which indeed i already tested and now i tested again, it works for me)... that is, it works. As i said, i still have to check its correctness, but it should be ok.

Of course, if you want to produce an animation, you have to call it at every time step you need an image, then the isosurface is automatically updated

Dear Paolo

thanks for your quick reply. now it is working. I am begiiner in fluent :D

best
mehdi

 SonyCFD May 1, 2012 01:21

Dear Paolo,
I am using your UDF for Lambda2.
As per your guidelines, I followed till step 3.
But in step 4 I get an error as below -
undefined reference to `main'
ld returned 1 exit status

Thanks and Regards,

 sbaffini May 1, 2012 10:00

Dear Sony,

i'm afraid i can't be of much help as i never had such error in interpreting the udf, on linux clusters in parallel as well as in serial on a windows machine.

However, could you say what is your Fluent configuration:

Linux/Windows - Serial/Parallel - 3d/3ddp

Also, is the udf in your working directory?

Another thing which usually bother me is using an udf written under windows (i admit it, i usually work on windows) on a linux machine, as i usually forget the dos2unix command, which is required to get it properly interpreted/compiled.

Dear Paolo

Could you please guide me ? how can use reletive velocity in the your lambda2 udf. is it possible to modify that?

Best
Mehdi

 sbaffini May 7, 2012 13:11

Dear mehdi,

i admit that i have little knowledge about the accessibility and nature of the relative velocity in the UDFs. However, let us assume you have this in some variable C_U_REL(c,t), C_V_REL(c,t) and C_W_REL(c,t).

What you have to do is to add a first subroutine to the code (a DEFINE_ON_DEMAND one) in which you copy your relative velocities in user defined scalar variables. Then what should change in the main code for lambda2 is that the velocity gradients have to be substituted with those of the user defined scalars.

Finally, you should call them in sequence when a new lambda2 iso-surface is needed.

The writing of the whole thing is probably more cumbersome than it appears at first sight; also, it is still necessary to check that all the variables are readily accessible.
However it should not be difficult; i would provide some code but i have no time at the moment and you can surely copy and paste pieces from the UDF manual or Fluent online resources.

Dear Paolo

I have claculated the relative velocities and define them in user defined scalers.
and then expect usuing the relative velocities gradient i use the gradient of these scalers ( relative velocites).

but again while running the Demand i get some Fatel error. I cheked after this eror the scalers for relative velocitires are correct and they are gettingg value.

 sbaffini May 21, 2012 07:44

Dear mehdi,

generally speaking, the ACCESS VIOLATION error (which, i guess, is the one you're getting) is related to your UDF trying to access some variables which are not defined
and/or are not accessible for some other reason (e.g., the gradient of some variable after it has being freed or face variables for interior threads, etc.). Now, in order for the UDF to work correctly, you have to be sure that the accessed variables are actually accessible.

So, before going deep in the debug, i suggest you to delete from the UDF all the parts relative to the lambda2 criterion and leave only those concerning the definition of the relative velocities and the access to their gradients. My idea is that the problem you are facing is relative to that part.

Also, from the Fluent 14 Manual (i think it is available somewhere online too if you don't have one. I don't have others now so i can't check for you), you have two examples concerning the retrieval of gradients for user defined scalars. The first one is under Data Access Macros - > User Defined Memory Macros (Paragraph 3.2.10.6 of the UDF Manual for Fluent 14). The second one is under Detailed UDF Examples -> User Defined Scalars (Paragraph 8.2.5).

Hope it helps

 SonyCFD May 22, 2012 02:09

Lambda 2

Dear Paolo,
sorry for the delayed response.
I am using Linux in parallel and I use 3ddp.

Now I have managed to get to step 5. I got rid of the compilation error.
However, in step 6, when I try to create iso-surface, the min and max value of user memory 0 are both zeros. Hence it cannot create, a surface.

Please advise. For memory - I have defined 1 UD Memory Locations and 0 UD Node Memory Locations

Many Thanks,
Sony

Quote:
 Originally Posted by sbaffini (Post 358640) Dear Sony, i'm afraid i can't be of much help as i never had such error in interpreting the udf, on linux clusters in parallel as well as in serial on a windows machine. However, could you say what is your Fluent configuration: Linux/Windows - Serial/Parallel - 3d/3ddp Also, is the udf in your working directory? Another thing which usually bother me is using an udf written under windows (i admit it, i usually work on windows) on a linux machine, as i usually forget the dos2unix command, which is required to get it properly interpreted/compiled.

 sbaffini May 22, 2012 05:34

Dear Sony,

as a first guess i would say that there is something wrong with the velocity field and or derivatives used for lambda2. I am saying this because your settings seem correct and the UDF is correctly interpreted. As for mahdi, could you try to remove all the lambda2 related parts from the UDF and try to see if the UDM you use can receive, say, some of the derivatives?

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