![]() |
Why Uprime2mean is minus in some grids?
Dear Foamers,
I need mean value of u'u', v'v' and w'w' to reach to u' , v' and w'. when uprime2mean in controlDict switched on these values were written in time folders. But i don't know why they are minus in some grids. Any suggestion? |
If it is mean of U'U', it should be positive, shouldn't it?
|
how can i delete a post ?
|
Any suggestion?
|
as I know, uprime2mean is a symmetric tensor, thus with 6 components. cross components (say, U'W') can be negative. check if You are observing right components.
Best Regards |
You are right.
its 6 components are: U'U U'V' U'W' V'V' V'W' W'W' As you say U'W' can be negative but my problem is U'U' is negative in some grids ! |
Hi Maysam,
Did you get any answer from your question?! do you know how uprime2Mean is calculated? I have problem to find out how this parameter is calculated. Thanks, Pooyan |
Call this a stupid question but I have to ask:
prime2Mean is calculated in src/postProcessing/functionObjects/field/fieldAverage/fieldAverage/fieldAverageTemplates.C with the following code Code:
scalar alpha = 0.0;Code:
prime2MeanField = |
Quote:
No it shouldn't they're using the following identy: 1/(n)sum^n(phi_i-<phi>)^2=1/n*sum^n(phi_i^2)-<phi>^2 , where <.> is an averaged value http://en.wikipedia.org/wiki/Computa...r_the_variance Edit: added missing 1/n |
1 Attachment(s)
Yes, I am aware of this identity (by the way, you missed 1/(n) in the first sum of the RHS).
However, I have to insist that there is something wrong. I attach a small pdf with my derivations, can you find the error? |
1 Attachment(s)
i will look through equations when i find some time, in the meanwhile you can have a look at my document.
But i think the problem is that you don't consider the mean value as a "on the fly value" so you can not simply use N<x>^2=(N-1)x^2+x^2 since you need for sigma^2_pr <x>^2_{N-1} instead <x>^2_N Gregor PS: And be aware that actually two steps are performed 1. removing the old mean value in addMeanSqrToPrime2Mean<scalar, scalar> in fieldAverage.C Line 175 2. evaluating the variance using current mean value calculatePrime2MeanFields<scalar, scalar> in fieldAverage.C Line192 |
Sorry but there seem to be many errors in your derivations:
- In your calculations, you take (1) (which, I assume, is your interpretation of the OF expression) as correct, while I am trying to see if it can be proven. - Where did the term <phi>_{i-1}^2 in (1) come from? It does not exist in OF. - The substitution in (2) was performed incorrectly, terms like (n-1)/n and <phi>_{i-2}^2 are missing in the parenthesis. - Where did sigma_{i-2} go in (3)? - Where did the sum come up in (4)? and so on... EDIT: I now see your point about the existence of <phi>_{i-1}^2 after your note about addMeanSqrToPrime2Mean. To be honest, this confuses me even more. |
Quote:
Quote:
Quote:
thats the step performed in addMeanSqrToPrime2Mean in fieldAverageTemplates.C line 264 Code:
prime2MeanField += sqr(meanField);Quote:
Quote:
sigma = alpha * phi^2_old + beta*phi^2 - <phi>_i^2 which is sigma = <phi^2>_i - <phi>_i^2 or sigma = 1/n sum(phi_i^2) - <phi>_i^2 . I know its not nice and there are many typos but may be you still see the point Gregor |
Quote:
|
Well, I thought about it on the way home.
It's quite simple now that you told me about addMeanSqr. You can add and substract (N-2)/(N-1) (<x>)^2 in my last equation and the OF expression is obtained. Thanks for your help, patience and time, it is clear now! I assume that this square is added in the beginning to avoid numerical errors, cancellations of significant digits and so on, right? |
Yes i guess it is the same reason why you calculate the average by
<phi> = alpha*<phi>_{i-1} + beta * phi instead of using phiS += phi phiA = phi/N to avoid big numbers. Sorry if wasn't that clear. Explaining something easy is an art ;) |
Quote:
You said "The point is you want to have a variance every time step but your final mean value is unknown, therefore you take the current mean value." I understand most of your derivations however, I am still confused on the idea of using the "current mean value" instead of the "final mean value". For the variance, we need the final mean value and using the current mean value may have a significant effect for strongly separated flows. I also see a difference on the last term of your derivation on the "test.pdf" file. You used <phi>_i^2 on the last term in equation (2) however <phi>^2 is coming on your equation (3). It seems you are going from the current mean to the final mean value. I appreciate your help on this part. It took me some time to get convinced with the way "prim2Mean" is calculated in OpenFOAM. Thanks a lot! |
Quote:
Quote:
|
Thanks Gregor . I appreciate it.
|
UPrime2mean has 6 components 0,1,2...5. Among these which are <uu>, <v v> and <ww>?
|
| All times are GMT -4. The time now is 21:14. |