CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Post-Processing (https://www.cfd-online.com/Forums/openfoam-post-processing/)
-   -   How to implement regionSizeDistribution (https://www.cfd-online.com/Forums/openfoam-post-processing/123854-how-implement-regionsizedistribution.html)

tong September 23, 2013 01:13

How to implement regionSizeDistribution
 
Hi,

I have completed an analysis using twoPhaseEulerFoam solver and have some results files. My case is similar to the tutorial bubblecolumn case where bubble flows up to the outlet at the top of the domain.

I want to get a plot of the droplet size distribution at the outlet. I have found that there is a function called 'regionSizeDistribution' and there is an example showing the inputs and outputs of the function, however where and how do I implement this function? ie. do I copy, for example, this function:

regionSizeDistribution1
{
type regionSizeDistribution;
functionObjectLibs ("libfieldFunctionObjects.so");
...
field alpha;
patches (outlet);
threshold 0.4;
fields (p U);
nBins 100;
maxDiameter 0.5e-4;
minDiameter 0;
setFormat gnuplot;
}

into the controldict file and then re-run the solver again at the time I want?

Thank you in advance,
Tong

tong October 12, 2013 01:22

please, any help will be great.

tong October 14, 2013 04:39

regionSizeDistribution plot
 
Hi,

I had successfully ran the regionSizeDistribtion function in controlDict for my case which is suppose to plot a histogram of droplet sizes vs frequency they occur on a specified patch. After running the case, two new files appear in the latest time file: alpha1_background and alpha1_liquidCore. However, there was no histogram to be found anywhere. I was just wondering how does the output for regionSizeDistribution work? Where does the histogram saved to?

Regards,
Tong

wyldckat November 9, 2013 14:09

Greetings Tong,

I got your private message and I'll answer here on the forum, since more people can take advantage of this.

I've tested this on the tutorial "multiphase/twoPhaseEulerFoam/bubbleColumn" and used the following "system/controDict":
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.2                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application    twoPhaseEulerFoam;

startFrom      startTime;

startTime      0;

stopAt          endTime;

endTime        20;

deltaT          0.002;

writeControl    runTime;

writeInterval  0.5;

purgeWrite      0;

writeFormat    ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision  6;

runTimeModifiable yes;

adjustTimeStep  no;

maxCo          0.5;

maxDeltaT      1;

functions
{
    fieldAverage1
    {
        type            fieldAverage;
        functionObjectLibs ( "libfieldFunctionObjects.so" );
        outputControl  outputTime;
        fields
        (
            U1
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }

            U2
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }

            alpha1
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }

            p
            {
                mean        on;
                prime2Mean  off;
                base        time;
            }
        );
    }

    regionSizeDistribution1
    {
        type            regionSizeDistribution;
        functionObjectLibs ("libfieldFunctionObjects.so");
        outputControl  outputTime;
        field          alpha1;
        patches        (inlet);
        threshold      0.5;
        fields          (p U);
        nBins          100;
        maxDiameter    0.5;
        setFormat      gnuplot;
    }
}


// ************************************************************************* //

As you can see, this is essentially what's described in the Doxygen generated code documentation. Specifically, the part that was added was this:
Code:

    regionSizeDistribution1
    {
        type            regionSizeDistribution;
        functionObjectLibs ("libfieldFunctionObjects.so");
        outputControl  outputTime;
        field          alpha1;
        patches        (inlet);
        threshold      0.5;
        fields          (p U);
        nBins          100;
        maxDiameter    0.5;
        setFormat      gnuplot;
    }

As for the resulting files (available only after running twoPhaseEulerFoam with the new "controlDict"), they are located inside the folder "postProcessing/regionSizeDistribution1", more specifically inside each dedicated time folder.
Inside each one of those time folders you'll find Gnuplot scripts, which can be executed by giving them to the gnuplot command, e.g.:
Code:

gnuplot postProcessing/regionSizeDistribution1/0.5/diameter_count.gplt
The downside is that all of the plots will save the resulting plot into the file "diameter.ps".

Best regards,
Bruno

tong May 13, 2014 07:24

Hi,

Are max and min diameter set to meters or millimeters by default?

Thanks


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