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

application     twoPhaseEulerFoam;

startFrom       latestTime;

startTime       0;

stopAt          endTime;

endTime         150;

deltaT          0.001;

writeControl    runTime;

writeInterval   1;

purgeWrite      0;

writeFormat     ascii;

writePrecision  6;

writeCompression uncompressed;

timeFormat      general;

timePrecision   6;

runTimeModifiable yes;

adjustTimeStep  yes;

maxCo           0.75;

maxDeltaT       1;

functions 
     {
      #includeFunc residuals
      }
      
functions
{
    /*volumeAverage
    {
        type            volFieldValue;
        libs            ("libfieldFunctionObjects.so");

        log             false;
        writeControl    timeStep;
        writeInterval   1;
        writeFields     false;
 
        regionType      all;
        operation       volAverage;

        fields
        (
            alpha.air
            alpha.water
        );
    }*/

    surfacePlane1
    {
        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        enabled         yes;
        writeControl    timeStep;
        writeInterval   1; 
        log             no;
    
        writeFields     no;
    
        regionType      sampledSurface;
        name            sampledSurfaceNormalZ1;
        sampledSurfaceDict
        {
            type                    cuttingPlane;
            planeType               pointAndNormal;
            pointAndNormalDict
            {
                    basePoint       (0 0 0.225);  
                    normalVector    (0 0 1);
            }
        
            interpolate true;
        }
    
        operation       areaAverage;
        fields
        (
           alpha.air
        );
    }

    surfacePlane2
    {
        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        enabled         yes;
        writeControl    timeStep;
        writeInterval   1; 
        log             no;
    
        writeFields     no;
    
        regionType      sampledSurface;
        name            sampledSurfaceNormalZ1;
        sampledSurfaceDict
        {
            type                    cuttingPlane;
            planeType               pointAndNormal;
            pointAndNormalDict
            {
                    basePoint       (0 0 0.825);  
                    normalVector    (0 0 1);
            }
        
            interpolate true;
        }
    
        operation       areaAverage;
        fields
        (
           alpha.air
        );
    }

    surfacePlane3
    {
        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        enabled         yes;
        writeControl    timeStep;
        writeInterval   1; 
        log             no;
    
        writeFields     no;
    
        regionType      sampledSurface;
        name            sampledSurfaceNormalZ1;
        sampledSurfaceDict
        {
            type                    cuttingPlane;
            planeType               pointAndNormal;
            pointAndNormalDict
            {
                    basePoint       (0 0 0.1);  
                    normalVector    (0 0 1);
            }
        
            interpolate true;
        }
    
        operation       areaAverage;
        fields
        (
           alpha.air
        );
    }
    
    airflowrate_out
    {
        type            surfaceFieldValue;
        libs             ("libfieldFunctionObjects.so");
        
        log             false;
        writeControl    timeStep;
        writeInterval   1;
        writeFields     false;
 
        regionType      patch;
        name            OUTLET;
        operation       sum;
        
        weightField     alpha.air;
        
        fields
        (
             phi
         );
    }

    fieldAverage1
    {
        type            fieldAverage;
        libs ( "libfieldFunctionObjects.so" );
        writeControl    writeTime;
        fields
        (
            U.air
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }

            U.water
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }

            alpha.air
            {
                 mean        on;
                 prime2Mean  off;
                 base        time;
            }

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

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