Return time averages/deviations and gradients

132 views
Skip to first unread message

Giulio Ortali

unread,
Jan 21, 2020, 4:41:56 AM1/21/20
to PyFR Mailing List
Hi to all,

I need to compute some mean-field and turbulent features of a pyfr simulation. In particular I need to have velocity and pressure mean fields, k, omega, epsilon and nu_t, in order to compare them to RANS results. To do this I need to compute, inside pyfr:

* time averages of velocity and pressure
* fluctuations in time (instantaneous field - average field) for velocity
* space gradients of the velocity fluctuations computed above
* time averages of some transformations (products and sums) of the gradients computed above

Is It possible to complete one or some of this tasks inside pyfr? right now I'm using paraview to perform this but it's quite inefficent. It would be good enough to have the space gradients of the velocity field for each timestep, being the most expensive part.

Thanks in advance,
Giulio

Giorgio Giangaspero

unread,
Jan 21, 2020, 5:03:45 AM1/21/20
to PyFR Mailing List
Hi Giulio

you can use the time-average plugin to compute the running average of any combination of the primitive variables. See [soln-plugin-tavg] in the user guide.
For instance you can have the averages of the primitive variables with:

avg-rho = rho
avg-u = u
avg-v = v
avg-w = w
avg-p = p

products:
avg-p2 = p*p

and gradients:
avg-grad-u-x = grad_u_x
avg-grad-v-z = grad_v_z

Note also that you can have the gradients of the variables stored in a pyfr solution file computed and exported to Paraview by adding the -g option to the export command, for instance:

pyfr export -g mesh.pyfrm solution.pyfrs solution.vtu


Best
Giorgio

Giulio Ortali

unread,
Jan 21, 2020, 5:13:18 AM1/21/20
to PyFR Mailing List
Hi Giorgio,
Thanks for the reply!

Last question, is there an easy way to compute the time average of the gradient of the fluctuation?  Where the fluctuation is u - avg-u.

Giulio.

Giorgio Giangaspero

unread,
Jan 21, 2020, 5:52:32 AM1/21/20
to PyFR Mailing List
Hi Giulio

in RANS the time average of the fluctuations is zero by definition, and so will its gradients.
In case you want to compute the time-average of the gradients of the product of fluctuations (for instance, the gradients of the components of the Reynolds stress), then, as differentiating and taking the mean commute, you could get the gradients of the time-average of the product of fluctuations as follows:
0. keep in mind that avg(fluct-u*fluct-u) = avg(u*u) - avg(u)*avg(u)
1. get in pyfr the time average of the the variable and its square, say u and u*u
2. either compute the gradients of the time-average solution in Paraview or export the solution with the gradients as mentioned in the previous post.
3. in Paraview, compute the (gradients of) the product of fluctuations as the difference between the (gradients of) time-average of u*u and the (gradients of) time-average u squared: avg(u*u) - avg(u)*avg(u)

best
Giorgio

Giulio Ortali

unread,
Jan 21, 2020, 7:30:27 AM1/21/20
to PyFR Mailing List
Hi Giorgio,
I need to compute the average of the product of the gradients of the fluctuations:

CodeCogsEqn.gif


I could do this simply by exporting the gradients of the velocity field, then inside paraview do all the remaining computations. Is there a better way to do this than that?

Giulio

Giorgio Giangaspero

unread,
Jan 22, 2020, 6:18:02 AM1/22/20
to PyFR Mailing List
I think you can compute them by collecting the time-average of :

avg-grad-u-x = grad_u_x
avg-grad-u-x-squared = grad_u_x*grad_u_x

then in Paraview

avg-grad-u-x-squared - (avg-grad-u-x)^2

similarly for all the other components
Reply all
Reply to author
Forward
0 new messages