Calculate fields and profiles for velocity time average and standard deviation
Hi There,
I'm looking to post process a velocity field by computing mean and standard deviation, but it doesn't look like there is a built in utility for that. Can/should I use foamCalc? If so, how would I go about doing this? After that, I'd like to plot mean and std cross-stream profiles at specified streamwise and vertical positions. It would be nice to parse the data with Python so I can generate plots with matplotlib. Is there any simple way to do this? pyFOAM perhaps? |
Quote:
One alternative would be PythonFlu which is a Python-wrapper around the OpenFOAM-libraries. You could read the data files using that and then do your matplotlib-thing. Another possibility would be swak4Foam. Just computing the mean (you mean the volume weighted average by that?) and standard-deviation (that depends on your definition of "mean") can be done with simple expressions. For more advance postprocessing I just recently pushed something to the publicly available development version: funkyPythonPostproc. That utility reads OF-data files, executes swak-functionObjects on those and hands over results (via global variables) to a python-script as numpy-arrays. And numpy is the de-facto-standary for scientific/numeric libraries in Python .... Only problem is that there is just one Example for that in the swak-distro, but I think it should be sufficient to understand how to do that yourself. Ah. And behaviour in parallel may still be subject to change. That's why it's not in a release yet. |
Quote:
It seems that it's also possible to export *.csv files and do Python scripting from ParaView. Would this be a reasonable approach as well? I'm not fully familiar with the capabilities. |
Quote:
I just haven't updated that version compatibility in a long time Quote:
And I'm not a big fan of the graph-plots in Paraview. For that gnuplot or matplotlib might be more flexible for you (Your milage may vary) |
What about re-running the case with active fieldAverage functionObject, or maybe run the functionObject on the finished solution?
The mean velocity is straight forward and the prime2mean quantity may be related to the standard deviation, but don't nail me on that. Code:
fieldAverage1 |
Quote:
|
Quote:
If I use prime2mean, this will compute the variance, correct? If I could then take the square root I'd have my standard deviation, but I'm still left with the question of how to get the cell values into Numpy arrays. |
Quote:
Quote:
- pythonFlu - From the field file strip off the stuff before and after the internalField and read it directly with numpy - Maybe I'm obnoxious. But with the development version of swak (it's not yet in a release) something like this is possible: http://sourceforge.net/p/openfoam-ex...ythonPostproc/ (Just preload the fields generated by fieldAverage and pass them to the python-code) |
Quote:
|
Dear Pete,
did you get a solution for this task? I am also interested in calcuating mean and standard deviation. According to the mixing quality I dont need a field of velocity, but a field of concentration. Can you give me some hints on this problem? |
Quote:
Here is a case that does that, with some extra code for parameterization via Python: https://github.com/petebachant/UNH-RVAT-turbinesFoam |
Dear Pete,
I was not able to fix my problem in this kind of way. I was glad to find anothere way to determinate the mixing quality. If someone else has trouble with this you can find the solution here. https://www.cfd-online.com/Forums/bl...ity-index.html |
All times are GMT -4. The time now is 08:52. |