/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  v2506                                 |
|   \\  /    A nd           | Website:  www.openfoam.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

application     buoyantBoussinesqSimpleFoam;

startFrom       latestTime;
startTime       0;

stopAt          endTime;

endTime         90000;

deltaT          1;

writeControl    timeStep;

writeInterval   500;

purgeWrite      120;

writeFormat     ascii;
writePrecision  6;
writeCompression off;

timeFormat      general;
timePrecision   6;

runTimeModifiable true;

functions
{
    yPlus
    {
        type            yPlus;
        libs            (fieldFunctionObjects);
        writeControl    writeTime;
        patches         (bottomWallInlet bottomWallTest bottomWallOutlet topWall);
    }

    // --- Residuals ---
    residuals
    {
        type            solverInfo;
        libs            (utilityFunctionObjects);
        writeControl    timeStep;
        writeInterval   1;
        fields          (p_rgh U T k epsilon phit f);
    }

    // --- Mass Balance ---
    inletFlux
    {
        type            surfaceFieldValue;
        libs            (fieldFunctionObjects);
        writeControl    timeStep;
        writeInterval   100;
        log             true;
        writeFields     false;
        operation       sum;
        regionType      patch;
        name            inlet;
        fields          (phi);
    }

    outletFlux
    {
        type            surfaceFieldValue;
        libs            (fieldFunctionObjects);
        writeControl    timeStep;
        writeInterval   100;
        log             true;
        writeFields     false;
        operation       sum;
        regionType      patch;
        name            outlet;
        fields          (phi);
    }

    // --- Pressure Drop ---
    inletPressure
    {
        type            surfaceFieldValue;
        libs            (fieldFunctionObjects);
        writeControl    timeStep;
        writeInterval   100;
        log             true;
        writeFields     false;
        operation       areaAverage;
        regionType      patch;
        name            inlet;
        fields          (p_rgh); 
    }

    outletPressure
    {
        type            surfaceFieldValue;
        libs            (fieldFunctionObjects);
        writeControl    timeStep;
        writeInterval   100;
        log             true;
        writeFields     false;
        operation       areaAverage;
        regionType      patch;
        name            outlet;
        fields          (p_rgh); 
    }

    // --- Thermal Convergence ---
    wallTemperature
    {
        type            surfaceFieldValue;
        libs            (fieldFunctionObjects);
        writeControl    timeStep;
        writeInterval   100;
        log             true;
        writeFields     false;
        operation       areaAverage;
        regionType      patch;
        name            bottomWallTest;
        fields          (T);
    }
}

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