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/)
-   -   Monitoring flow rate on patch in OpenFOAM v2012 (https://www.cfd-online.com/Forums/openfoam-post-processing/237051-monitoring-flow-rate-patch-openfoam-v2012.html)

olher3 June 28, 2021 06:29

Monitoring flow rate on patch in OpenFOAM v2012
 
Hello,

after a 6 year break, I currently have an OpenFOAM project again. For this I use the latest version v2012.
Unfortunately, the keywords have changed over time. I have a model with 4 outlets (out1, out2, out3, out4) I would like to monitor the volume flow [m³/s] or mass flow [kg/s] on these during the simulation.


Solver: simpleFoam


Can someone give me an example of the function in the controlDict?
My old spelling no longer works.



Best wishes

O.Herz

Tobermory June 28, 2021 11:27

The fieldFunction that you are after is surfaceFieldValue, I think (https://www.openfoam.com/documentati...ieldValue.html). Here's an example of its use for a case where I wanted the massflow-weighted average values of two scalars on a patch called outlet:

Code:

functions
{
    surfaceFieldValue1
    {
        type            surfaceFieldValue;
        libs            ("libfieldFunctionObjects.so");
        enabled        yes;
        writeControl    writeTime;
        log            yes;
        writeFields    no;
        regionType      patch;
        name            outlet;
        operation      weightedAverage;
        weightField    phi;
        fields
        (
            H2O
            T
        );
    }
}

For your application, change out weightedAverage for sum, change the field to phi, and adjust the patch name. You get the idea, hopefully. Good luck.

olher3 June 29, 2021 03:29

Hello,


thanky you very much.
It works!


Best Regards


O.Herz

popopo September 7, 2023 13:04

How do I write this to a file?
 
How do I write this to a file, say flowrate.txt?


Thanks!


All times are GMT -4. The time now is 02:47.