CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   How to calculate <w'T'>? (https://www.cfd-online.com/Forums/openfoam/115687-how-calculate-wt.html)

 ripperjack April 4, 2013 15:18

How to calculate <w'T'>?

Hi guys,

I am simulating DNS channel flows using Openfoam, and I want to show contours of <w'T'>, where <> means average, w' is the z-direction velocity fluctuation, and T' is temperature fluctuation.

I tried to define a new variable Q=w*T and average Q by adding the following lines into system/controlDict. But it seems to be incorrect because it will calculate <(wT)'> instead of <w'T'>.
Code:

```    fieldAverage1     {     ...         fields         (             Q             {                 mean        on;                 prime2Mean  on;                 base        time;             }     ...```
I am thinking if I can add some lines into the solver to define <w'T'> as a new variables and output them correctly.You guys can give me some hint to do this? Many thanks!

 Lieven April 4, 2013 16:59

I guess the easiest way would be to do two simulations.
1. During the first run you calculate <w> and <T>
2. During the second run you read in <w> and <T>, and evaluate Q = (w-<w>)*(T-<T>) and take the average of Q like you are doing

I'm aware that this is a bit unfavourable from computational point of view, but I don't really see an other option. If you find one however, let me know! cause this is an interesting issue.

Cheers,

L

 ripperjack April 4, 2013 21:23

Quote:
 Originally Posted by Lieven (Post 418426) I guess the easiest way would be to do two simulations. 1. During the first run you calculate and 2. During the second run you read in and , and evaluate Q = (w-)*(T-) and take the average of Q like you are doing I'm aware that this is a bit unfavourable from computational point of view, but I don't really see an other option. If you find one however, let me know! cause this is an interesting issue. Cheers, L
Hi Lieven,
Based on your suggestion, I am thinking may be I can do it in one run. I will try the following procedures:
1. Define new variables w (U.component(2)), wMean (<w>) and TMean (<T>) in solver and read their values from meshes (an initial value is given at start-time).
2. Define new variable Q=(w-wMean)*(T-TMean). (that is the instant w'T' value, not averaged one)
3. Add the following average lines in system/controlDict to calculate wMean, TMean, and QMean (that is <w'T'> we want).
Code:

```    fieldAverage1     {       .....         fields         (             ....             w             {                 mean        on;                 prime2Mean  on;                 base        time;             }             T             {                 mean        on;                 prime2Mean  on;                 base        time;             }             Q             {                 mean        on;                 prime2Mean  on;                 base        time;             }         .....```
By doing this, at each running step, the solver will read wMean and TMean calculated by the above commands in system/controlDict. And based on the wMean and TMean, the instant w'T' is calcualted and then <w'T'> can be calculated.
I have added the lines mentioned above into my solver, and it is running, no error. However, I need to run a real simulation to verify if the above method produce correct results.
Cheers!

 morard April 5, 2013 03:00

Hi ripperjack,

you just have to add a new field in your solve, wT, and then average it. You wil also need averaged values of w and T. At the end, you can modify postChannel utility to calculate <w'T'>.

<w'T'> = <wT> - <w><T>

Regards

 ripperjack April 5, 2013 09:13

Quote:
 Originally Posted by morard (Post 418483) Hi ripperjack, you just have to add a new field in your solve, wT, and then average it. You wil also need averaged values of w and T. At the end, you can modify postChannel utility to calculate . = - Regards
Hi Morard,
Great! That the simplest way to do it! Thanks Morard!
Regards

 All times are GMT -4. The time now is 07:59.