Page 1 of 1

Computing moments of gradient

Posted: Mon Apr 11, 2016 5:21 pm
by C.FLAG.
Dear users, developpers,

I am trying to compute the moments (mean and variance) of the velocity gradient. Following the examples, in cs_user_time_moments, I am using cs_time_moment_define_by_func to use a function which compute the velocity gradient.

But there is a problem : the gradient is defined on the (real+ghost) cells while the moments are only defined on the real cells. Is it possible to remove the ghost values from the field? Or to compute the gradient only on the real cells?

I am running version 4.0.4 (with fixed cs_time_moment.c). Attached is the corresponding file cs_user_parameters.c

Best regards,
Cedric

Re: Computing moments of gradient

Posted: Mon Apr 11, 2016 7:12 pm
by Yvan Fournier
Hello,

You code seems "almost correct": when copying results from the gradient (shape [n_cells_with_ghosts][3][3]) to the results (shape [n_cells][3][3], you outer loop (on cell_id) should simply be on n_cells and not n_cells_with_ghosts.

Note also that you can create special "variance" user variables for variances (such as the one on velocity) which are solved in a "turbulence" sense, which might be useful for you (I can explain the time moments, but for turbulent variances, the theory documentation or Sofiane can explain them better than me).

Regards,

Yvan

Re: Computing moments of gradient

Posted: Tue Apr 12, 2016 7:50 am
by C.FLAG.
Dear Yvan,

Your solution seems to work like a charm. And while waiting for converged results, I will look at the theory documentation, see if i can build something more optimized.

Thank you for your help,
Best regards,
Cedric