Dear Code_Saturne developers,
Hello and could you please give me some suggestions about this question:
I am using Code_Saturne 6.0.5 via GUI to calculate the time-averaged values of some variables, as shown in the figure below. But now, I want to define a new variable, "Velocity[1]*Velocity[2]", and get its time-averaged value in the calculation.
I suppose this is not able to achieve in GUI? If so, what user subroutine should I revise to add this new variable? And what subroutine to calculate the time-averaged value of this variable?
Many thanks and best regards,
Ruonan
Define a new variable and calculate its time-averaged value
Forum rules
Please read the forum usage recommendations before posting.
Please read the forum usage recommendations before posting.
-
- Posts: 4079
- Joined: Mon Feb 20, 2012 3:25 pm
Re: Define a new variable and calculate its time-averaged value
Hello,
Search for "Time moment" here https://www.code-saturne.org/cms/sites/ ... eters.html
Regards,
Yvan
Search for "Time moment" here https://www.code-saturne.org/cms/sites/ ... eters.html
Regards,
Yvan
Re: Define a new variable and calculate its time-averaged value
Hello Yvan,
Thank you very much for your help. I got the codes for calculating time-averaged "Velocity[1]*Velocity[2]" on the fly.
I used these values to calculate the Reynolds stress (velocity fluctuation), got good agreements compared with experimental data.
Best regards,
Ruonan
Thank you very much for your help. I got the codes for calculating time-averaged "Velocity[1]*Velocity[2]" on the fly.
Code: Select all
void
cs_user_time_moments(void)
{
{
int moment_f_id[] = {CS_F_(vel)->id, CS_F_(vel)->id};
int moment_c_id[] = {1, 2};
int n_fields = 2;
cs_time_moment_define_by_field_ids("v_w_mean",
n_fields,
moment_f_id,
moment_c_id,
CS_TIME_MOMENT_MEAN,
1, /* nt_start */
-1, /* t_start */
CS_TIME_MOMENT_RESTART_AUTO,
NULL);
}
cs_field_set_key_int_bits(cs_field_by_name("v_w_mean"),
cs_field_key_id("post_vis"),
CS_POST_ON_LOCATION);
}
Best regards,
Ruonan