
[Sponsors] 
June 30, 2011, 05:14 
Why Uprime2mean is minus in some grids?

#1 
Senior Member

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? 

July 1, 2011, 06:45 

#3 
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
how can i delete a post ?
Last edited by gregor; July 1, 2011 at 07:11. 

July 6, 2011, 07:56 

#5 
New Member
Vadims Geza
Join Date: Apr 2010
Location: Latvia
Posts: 9
Rep Power: 7 
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 

January 23, 2012, 20:00 

#7 
Member
pooyan
Join Date: Nov 2011
Posts: 62
Rep Power: 5 
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 

January 24, 2012, 02:21 

#8 
Senior Member
Join Date: Mar 2011
Posts: 174
Rep Power: 6 
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; scalar beta = 0.0; if (faItems_[i].timeBase()) { alpha = (totalTime_[i]  dt)/totalTime_[i]; beta = dt/totalTime_[i]; } else { alpha = scalar(totalIter_[i]  1)/scalar(totalIter_[i]); beta = 1.0/scalar(totalIter_[i]); } prime2MeanField = alpha*prime2MeanField + beta*sqr(baseField)  sqr(meanField); Code:
prime2MeanField = alpha*prime2MeanField + beta*sqr(baseField)  beta*sqr(meanField); 

January 24, 2012, 08:59 

#9  
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
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 Last edited by gregor; January 24, 2012 at 11:28. 

January 24, 2012, 09:57 

#10 
Senior Member
Join Date: Mar 2011
Posts: 174
Rep Power: 6 
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? 

January 24, 2012, 11:13 

#11 
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
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=(N1)x^2+x^2 since you need for sigma^2_pr <x>^2_{N1} 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 Last edited by gregor; January 24, 2012 at 12:08. 

January 24, 2012, 12:20 

#12 
Senior Member
Join Date: Mar 2011
Posts: 174
Rep Power: 6 
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>_{i1}^2 in (1) come from? It does not exist in OF.  The substitution in (2) was performed incorrectly, terms like (n1)/n and <phi>_{i2}^2 are missing in the parenthesis.  Where did sigma_{i2} 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>_{i1}^2 after your note about addMeanSqrToPrime2Mean. To be honest, this confuses me even more. 

January 24, 2012, 12:41 

#13  
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
Quote:
Quote:
Quote:
thats the step performed in addMeanSqrToPrime2Mean in fieldAverageTemplates.C line 264 Code:
prime2MeanField += sqr(meanField); you could write (3) as 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 Last edited by gregor; January 24, 2012 at 13:10. 

January 24, 2012, 12:56 

#14 
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
You could try it by evaluting it manually. 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. But once you use the current mean value the old mean values has to be taken out.


January 24, 2012, 13:25 

#15 
Senior Member
Join Date: Mar 2011
Posts: 174
Rep Power: 6 
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 (N2)/(N1) (<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? 

January 24, 2012, 13:36 

#16 
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
Yes i guess it is the same reason why you calculate the average by
<phi> = alpha*<phi>_{i1} + 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 

August 9, 2012, 23:52 

#17  
New Member
Getnet
Join Date: Aug 2011
Location: LSU
Posts: 20
Rep Power: 6 
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! 

August 13, 2012, 04:45 

#18  
Member
Gregor Olenik
Join Date: Jun 2009
Location: http://greole.github.io/
Posts: 78
Rep Power: 8 
Quote:
I agree that the document is very sloppy written. The point is, that your current mean value is the final value for your time series up to time i. Last edited by gregor; August 13, 2012 at 09:19. 

August 22, 2012, 03:33 

#19 
New Member
Getnet
Join Date: Aug 2011
Location: LSU
Posts: 20
Rep Power: 6 
Thanks Gregor . I appreciate it.


November 14, 2012, 08:31 

#20 
New Member

UPrime2mean has 6 components 0,1,2...5. Among these which are <uu>, <v v> and <ww>?


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Time step at coarse grids  D3sT  Main CFD Forum  0  December 6, 2010 12:15 
A question about dynamic overset grids  JXIA  Main CFD Forum  4  January 10, 2008 04:50 
Reloading grids in Pre  Pascale Fonteijn  CFX  1  July 7, 2003 13:33 
Minus Volume of cells  di bonga  CFX  2  April 8, 2001 13:38 
UDF Face Fluxes & Partitioned Grids  Greg Perkins  FLUENT  0  April 6, 2001 01:50 