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/)
-   -   Volume fraction for entire domain in interFoam (http://www.cfd-online.com/Forums/openfoam-post-processing/102051-volume-fraction-entire-domain-interfoam.html)

jmcneill May 21, 2012 08:49

Volume fraction for entire domain in interFoam
 
All,
I'm trying to determine the total phase-1 volume fraction at each time step of a simulation to calculate the mass of phase-1 in the domain. I've tried a few methods with swak4foam and Paraview, but I'm not confident in the numbers I am seeing. I noticed that the value I want is written to the log file at each time step as "Phase-1 volume fraction =". Is there a simple way to write this value to a separate output file? Thanks in advance.

Phicau May 21, 2012 09:32

Hi

just type on a terminal if your log file is named "log":

Code:

cat log | grep Liquid | cut -d' ' -f6 > massLog
and you will get a file called massLog with the mass evolution.

jmcneill May 21, 2012 10:20

Grep is an interesting thought. Thanks for that. I haven't used grep before, but is there a way to write the time in addition to alpha1? I eventually want to be able to plot alpha1 vs time.

Phicau May 21, 2012 10:26

I think it would be fairly easy to write a python script to do that. Just take into account that you have several mass values each time.

gschaider May 21, 2012 17:59

Quote:

Originally Posted by jmcneill (Post 362226)
Grep is an interesting thought. Thanks for that. I haven't used grep before, but is there a way to write the time in addition to alpha1? I eventually want to be able to plot alpha1 vs time.

Quote:

Originally Posted by Phicau (Post 362228)
I think it would be fairly easy to write a python script to do that. Just take into account that you have several mass values each time.

Extracting values from a log and plotting them can be easily (that's what I think) done with http://openfoamwiki.net/index.php/Co...omRegexp-files

Bernhard May 22, 2012 02:10

Alternatively, you can use volumeIntegrate from the simpleFunctionObjects (see contribution by Bernhard Gschaider)
http://openfoamwiki.net/index.php/Co...unctionObjects

Advantage here is that you don't need an extra step if you put it in the controlDict.


All times are GMT -4. The time now is 04:57.