UDF to calculate phase-averaged turbulence variables in a periodic flow
I'm new to Fluent UDF. But I need to write a UDF to calculate phase-average turbulence variables in a 3D time-periodic flow. I describe it in detail as follow:
I'm simulating a full 3D stirred vessel via both RANS and LES method. Comparisons between turbulence variables will be made. It's reported that direct ensemble-averaged result will not work in this case, due to pseudo-turbulence (contribution from the periodic flow). I found some hints from the post by Lionel Larcheveque (http://www.cfd-online.com/Forums/mai...intensity.html).
For convenience, I copied that original post below:
Suppose you have a periodic signal (for instance pressure signal). You can then define a period duration D. Then divide this duration into n equal intervals of time. At any given time t, you will be able to determine in which sub-interval i you are, i.e. :
A + B*D + (i-1)*D/n < t < A + B*D + i*D/n
with A a constant and B the number of periods since the beginning of the experiment or the calculation.
For each sub-interval 1 <= i <= n :
*** compute classical statistics Mi(u)=U_i, Mi(v)=V_i, Mi(u^2) and Mi(v^2) (M means mean, _i for phase i)
*** phase fluctuations u'_i and v'_i are given by :
*** phase averaged turbulent intensity may be defined for instance by the ratio :
In practice, you have to store arrays of size n for the sums of u, v, u^2 and v^2 and for the number of samples. At each time, identify the phase number i, and then add instantaneous u, v, u^2 and v^2 data to the i th element of the related arrays and increase by 1 the number of samples for the i th phase. At the end, for each i, divide the element i by the number of samples of the i th phase to obtain phase averaged statistics.
Since I'm new UDF user, could anybody kindly help me with that or give me some advice (which macros & functions should I use)?
|All times are GMT -4. The time now is 01:23.|