CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (http://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   Area(or mass)-weighted average vs. time at an outlet (http://www.cfd-online.com/Forums/openfoam-post-processing/102120-area-mass-weighted-average-vs-time-outlet.html)

enoch May 22, 2012 18:22

Area(or mass)-weighted average vs. time at an outlet
 
Dear foamers,

I am sorry for a redundant question about plotting aveaged quantity vs. time at an outlet, but I could not find a helpful posting to me. I'd like to plot area(or mass)-weighted average with time at the outlet. I need it to check if the solution is steady-state and for post-processing work. Thanks in advance for your help.

gschaider May 22, 2012 19:32

Quote:

Originally Posted by enoch (Post 362556)
Dear foamers,

I am sorry for a redundant question about plotting aveaged quantity vs. time at an outlet, but I could not find a helpful posting to me. I'd like to plot area(or mass)-weighted average with time at the outlet. I need it to check if the solution is steady-state and for post-processing work. Thanks in advance for your help.

http://openfoamwiki.net/index.php/Co...unctionObjects

enoch May 23, 2012 18:03

swak4Faom and pyFoamTimelinePlot.py
 
Quote:

Originally Posted by gschaider (Post 362567)

Thanks for the link.
I've found that swak4Foam include that library. I tried to run one example available in the examples directory of swak4Foam. I could not see a plot using pyFoamTimelinePlot.py. I've already installed pyFoam. Why can't I see the plot? Below is log information that I capture.

===
jeong@pulsedPitzDaily:$ pyFoamTimelinePlot.py . --dir=patchMassFlows_massFlowSimple --basic-mode=lines
set term png nocrop enhanced
set xrange [1e-05:0.02929]
set output "patchMassFlows_massFlowSimple_writeTime_0_Value_m assFlow.png"
set title "Directory: patchMassFlows_massFlowSimple WriteTime: 0 Value: massFlow"
plot "./patchMassFlows_massFlowSimple/0/massFlow" using 1:2 title "inlet" with lines , "./patchMassFlows_massFlowSimple/0/massFlow" using 1:3 title "outlet" with lines
jeong@pulsedPitzDaily:$

gschaider May 24, 2012 09:10

Quote:

Originally Posted by enoch (Post 362753)
Thanks for the link.
I've found that swak4Foam include that library. I tried to run one example available in the examples directory of swak4Foam. I could not see a plot using pyFoamTimelinePlot.py. I've already installed pyFoam. Why can't I see the plot? Below is log information that I capture.

===
jeong@pulsedPitzDaily:$ pyFoamTimelinePlot.py . --dir=patchMassFlows_massFlowSimple --basic-mode=lines
set term png nocrop enhanced
set xrange [1e-05:0.02929]
set output "patchMassFlows_massFlowSimple_writeTime_0_Value_m assFlow.png"
set title "Directory: patchMassFlows_massFlowSimple WriteTime: 0 Value: massFlow"
plot "./patchMassFlows_massFlowSimple/0/massFlow" using 1:2 title "inlet" with lines , "./patchMassFlows_massFlowSimple/0/massFlow" using 1:3 title "outlet" with lines
jeong@pulsedPitzDaily:$

That's all the utility does: generate the commands that make Gnuplot generate the plot. Send them into a pipe to gnuplot and you get a PNG:
Code:

pyFoamTimelinePlot.py . --dir=patchMassFlows_massFlowSimple --basic-mode=lines | gnuplot
(or copy them to the Gnuplot command-line)

The advantage of this is that you have all the flexibility of the Gnuplot-command line if you want it: redirect the output to a file. Change the options (scale logarithmic, set tics, etc). THEN plot

enoch May 24, 2012 11:37

calcualte flow rate
 
Quote:

Originally Posted by gschaider (Post 362896)
That's all the utility does: generate the commands that make Gnuplot generate the plot. Send them into a pipe to gnuplot and you get a PNG:
Code:

pyFoamTimelinePlot.py . --dir=patchMassFlows_massFlowSimple --basic-mode=lines | gnuplot
(or copy them to the Gnuplot command-line)

The advantage of this is that you have all the flexibility of the Gnuplot-command line if you want it: redirect the output to a file. Change the options (scale logarithmic, set tics, etc). THEN plot


Thank you for your further tip. I wanted to plot flow rate in time at the inlet and outlet (alpha*phia and beta*phiab) in two phase flows. How can I calculate the quantity in the two phase problems. Below is the script for a single phase flow. Thanks in advance for your help.

massFlowSwak
{
type patchExpression;
verbose true;
accumulations (
sum
);
patches (
inlet
outlet
);
expression "phi";
}

gschaider May 24, 2012 12:15

Quote:

Originally Posted by enoch (Post 362938)
Thank you for your further tip. I wanted to plot flow rate in time at the inlet and outlet (alpha*phia and beta*phiab) in two phase flows. How can I calculate the quantity in the two phase problems. Below is the script for a single phase flow. Thanks in advance for your help.

massFlowSwak
{
type patchExpression;
verbose true;
accumulations (
sum
);
patches (
inlet
outlet
);
expression "phi";
}

The answer is in your question
Code:

expression "alpha*phia+beta*phib";
should do the trick. Although I'm not too familiar with that solver so it could be
Code:

expression "phia+phib";
(depends how phiX is defined)

You can use ANY field in the expression. It only has to be there under that name. That is the only limitation. Whether it makes phyiscal sense is another thing


All times are GMT -4. The time now is 01:12.