Page 1 of 1

How to compute TKE Budgets

Posted: Sun Sep 10, 2017 5:58 pm
by Oscar
I am attempting to compute turbulent kinetic energy budget terms in an LES in CS V5. For example, in order to calculate the dissipation term I require to compute the average of the product of the velocity gradient tensor with itself.

Calculation of time averages is currently done in cs_user_parameters.c, for example for the velocity moments:

Code: Select all

       /* Average and variance of the velocity vector */
       int moment_f_id[] = {CS_F_(u)->id};
       int moment_c_id[] = {-1};
       int n_fields = 1;
       const char *sum_comp_name[] = {"Vel_avg", "Vel_var"};
       cs_time_moment_type_t m_type[] = {CS_TIME_MOMENT_MEAN,
                                         CS_TIME_MOMENT_VARIANCE};
       for (int i = 0; i < 2; i++) {
           bft_printf("velocity i %d \n", i);
           cs_time_moment_define_by_field_ids(sum_comp_name[i],
                                              n_fields,
                                              moment_f_id,
                                              moment_c_id,
                                              m_type[i],
                                              n_start, /* nt_start */
                                              -1,   /* t_start */
                                              CS_TIME_MOMENT_RESTART_AUTO,
                                              NULL);
       };
so it seems I can get what I want by CS_F_() to access the field I want. But the product of gradient tensors is not an available variable that I can pass to the C function, and that would need to be separately computed, presumably in cs_user_postprocess_var.f90

So could anyone shed some light on how I would go about doing this?

Re: How to compute TKE Budgets

Posted: Tue Sep 12, 2017 11:55 am
by Yvan Fournier
Hello,

Time averages are probably not the best solution to compute a TKE budget. The code also handles "variance" type fields which are specifically suited to turbulence.

I'll need to check with the turbulence specialists.

Best regards,

Yvan

Re: How to compute TKE Budgets

Posted: Tue Sep 12, 2017 9:28 pm
by Oscar
Thank you for your response. Main terms of interest that I want to calculate are for example for the velocity field the terms:

turbulent dissipation:


turbulent generation/production is defined as:



diffusion terms:



As you can see these require ensemble averages of the gradients of unsteady and steady terms which will have to turn into time averages. Unless you have an alternative to computing these as time averages I am all ears because at the moment I am only able to calculate the reynolds stresses as outlined in my first post. I am unsure how I would go about for moments specified above.

Thank you for your help.

Oscar

Re: How to compute TKE Budgets

Posted: Wed Oct 25, 2017 10:38 am
by Oscar
Does anyone have a suggestion for solving this problem, I am very keen on understanding how CS can be used to compute these budget terms!

Re: How to compute TKE Budgets

Posted: Sun Oct 29, 2017 11:51 pm
by Yvan Fournier
Hello,

I'll remind some colleagues with better knowledge of this part of the code to check the forum...

Regards,

Yvan

Re: How to compute TKE Budgets

Posted: Mon Sep 09, 2024 4:03 pm
by StandardRANSUser001
Hi Yvon and Oscar,

It has been a few years since Oscar's original post.

I have a similar interest in analysing the Reynolds-stress budgets, but I am interested in studying this with an RSM. Is there an inbuilt function or tool that I could use to save these values for each component of the Reynolds-stress tensor?

Any assistance would be greatly appreciated.

Best regards,
Sean Hanrahan

Re: How to compute TKE Budgets

Posted: Tue Sep 10, 2024 7:30 pm
by Yvan Fournier
Hello,

In the development version, there are quite a few optional fields than can be used to save various intermediate terms in the RSM solution, which might be useful for this (see src/turb/cs_turbulence_rij.cpp). Some elements of associated field names may be given in the Doxygen/HTML documentation, but perusing the code/searching for "algo:" may be easier. Defining fields with the matching names allows intermediate terms to be saved in them.

In any case, for detailed budgets, I recommend checking the code itself to see how things are done (and possibly add instrumentation/computations there if there is no matching user-defined file), rather than to try to find examples, unless you are lucky with a search on previous posts on this forum.

Best regards,

Yvan