CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Standard deviation for every time step

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2012, 06:29
Default Standard deviation for every time step
  #1
New Member
 
shyam prasad
Join Date: Mar 2009
Posts: 25
Rep Power: 17
shyam is on a distinguished road
Dear Foamers,
I would like to track the standard deviation of a tracer in the domain with respect to time. The following is what I have appended in the controlDict to get the sum(xi-xmean)^2. Later I can manipulate this using excel or python to evaluate the standard deviation. Is there any way I can obtain standard deviation in the function objects itself.


/***********************************************/
libs (
"libOpenFOAM.so" // keeps paraFoam happy
"libtwoPhaseInterfaceProperties.so"
"libinterfaceProperties.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);

functions
(
deviation
{
type swakExpression;
valueType internalField;
verbose true;
expression "(pow((T-0.0220541),2))";
accumulations (sum);
}
);
/************************************************** **/
shyam is offline   Reply With Quote

Old   April 18, 2012, 20:05
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by shyam View Post
Dear Foamers,
I would like to track the standard deviation of a tracer in the domain with respect to time. The following is what I have appended in the controlDict to get the sum(xi-xmean)^2. Later I can manipulate this using excel or python to evaluate the standard deviation. Is there any way I can obtain standard deviation in the function objects itself.


/***********************************************/
libs (
"libOpenFOAM.so" // keeps paraFoam happy
"libtwoPhaseInterfaceProperties.so"
"libinterfaceProperties.so"
"libsimpleSwakFunctionObjects.so"
"libswakFunctionObjects.so"
);

functions
(
deviation
{
type swakExpression;
valueType internalField;
verbose true;
expression "(pow((T-0.0220541),2))";
accumulations (sum);
}
);
/************************************************** **/
I don't quite get the problem. Is it that you're currently hardcoding Tmean? If all the cells are of equal size (but if they aren't your approach wouldn't have worked too) something like

Code:
variables (
  "Tmean=average(T);"
);
expression "pow((T-Tmean),2)";
accumulations (average);
should do the trick. For cells of equal size you'll have to use the cell volumes as "probabilities" (that won't work with "average")

But maybe I misunderstood your question
gschaider is offline   Reply With Quote

Old   April 19, 2012, 01:45
Default
  #3
New Member
 
shyam prasad
Join Date: Mar 2009
Posts: 25
Rep Power: 17
shyam is on a distinguished road
Thanks Bernhard,
Would like to thank you for making swak4Foam available for the openfoam community.

functions
(
deviation
{
type swakExpression;
valueType internalField;
verbose true;
expression "(pow((T-0.0220541),2))";
accumulations (sum);
}
);

I want to use the above sum as below

sd = pow(sum,0.5)/no. of cells.
shyam is offline   Reply With Quote

Old   April 19, 2012, 08:39
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by shyam View Post
Thanks Bernhard,
Would like to thank you for making swak4Foam available for the openfoam community.

functions
(
deviation
{
type swakExpression;
valueType internalField;
verbose true;
expression "(pow((T-0.0220541),2))";
accumulations (sum);
}
);

I want to use the above sum as below

sd = pow(sum,0.5)/no. of cells.
"Number of cells" is not available as a function as usually "average" does that anyway. A workaround would be "max(id()+1)" (id() being the number of the cell) but this does NOT work in parallel (as id() is local to the CPU. For this reason there is also no "number of cells"-function)

As I said in the other posting: arithmetic mean only makes sense if all cells are of the same size (otherwise tiny cells have the same "influence" as big cells)
gschaider is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
High Courant Number @ icoFoam Artex85 OpenFOAM Running, Solving & CFD 11 February 16, 2017 14:40
Hydrostatic Pressure and Gravity miliante OpenFOAM Running, Solving & CFD 132 October 7, 2012 23:50
Problem with FloatingObject Leech OpenFOAM Running, Solving & CFD 10 March 29, 2012 16:24
Intermediate step during a time step Burn OpenFOAM 0 July 16, 2009 11:01
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 15:38.