How to compute TKE Budgets
Posted: Sun Sep 10, 2017 5:58 pm
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:
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?
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 could anyone shed some light on how I would go about doing this?