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/)
-   -   flowRatePatch for multiple patches simultaneously (https://www.cfd-online.com/Forums/openfoam-post-processing/197118-flowratepatch-multiple-patches-simultaneously.html)

kmallick December 29, 2017 00:51

flowRatePatch for multiple patches simultaneously
 
I am trying to process data during run time of an OF model. I can successfully output volume flow rate through a specific patch (say outlet) per instructions here:

https://cfd.direct/openfoam/user-gui...rocessing-cli/

However, I would like to output flow rates for more than one patch, say for both inlet and outlet. Specifically I would like to dump the data like this in two columns:

_________ Inlet______Outlet
time______x.xx_______y.yy

What changes do I need to make to my flowRatePatch file? This is my current one:

HTML Code:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                |
  \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox
  \\    /  O peration    |
    \\  /    A nd          | Web:      www.OpenFOAM.org
    \\/    M anipulation  |
-------------------------------------------------------------------------------
Description
    Calculates the flow rate through a specified patch by summing the flux on
    patch faces.  For solvers where the flux is volumetric, the flow rate is
    volumetric; where flux is mass flux, the flow rate is mass flow rate.

\*---------------------------------------------------------------------------*/

name    outlet;

#includeEtc "caseDicts/postProcessing/flowRate/flowRatePatch.cfg"

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


CFDelix December 29, 2017 03:27

Swak4Foam
 
swak4foam is used to do runtime outputs/calculations/...

You need this in your controlDict
Code:

functions{
massFlow

    {
        type patchMassFlow;
        outputControl timeStep;
        verbose true;
        patches
        (
            inlet
            outlet
        );
        factor 1;
        outputInterval 1;
    }
}

you find more information in here: http://openfoamwiki.net/images/2/2a/...esentation.pdf

in case you only need the finished solution try:
https://www.cfd-online.com/Forums/op...lculation.html

kmallick December 29, 2017 14:19

Thanks for your help and suggestion. I tried your method and I got:

HTML Code:

[5] --> FOAM FATAL ERROR:
[5] Unknown function type patchMassFlow

I am not sure where the patchMassFlow function is residing. BTW I have swak4Foam compiled and working.

I would also prefer to use OF's built-in function of flowRatePatch. Its working perfectly for one defined surface (outlet). I thought that it may be simple to add another surface to the output column.

I tried this in flowRatePatch, but OF didn't like that ether

HTML Code:

name    (inlet outlet);

#includeEtc "caseDicts/postProcessing/flowRate/flowRatePatch.cfg"


CFDelix January 2, 2018 02:39

libs included?
 
If you have swak compiled and working I guess you also have the libs in the controlDict ?

I use

Code:

    "libsimpleSwakFunctionObjects.so"
    "libswakFunctionObjects.so"

Is the type "swakExpression" working for you?
Then you could define your own expression for massFlow, but I believe I cannot help you with rewriting the flowRatePatch function from OF.

cfd lover March 31, 2018 00:50

flowRatePatch for multiple patches simultaneously
 
i finally became able of solving this issue.
By writing a bash file it is possible to calculate flow rate patch on different boundaries. Here i leave the linux command:
sed -i "s/name inlet;/name outlet;/g" system/flowRatePatch

mm66 May 9, 2019 13:38

Quote:

Originally Posted by CFDelix (Post 676365)
swak4foam is used to do runtime outputs/calculations/...

You need this in your controlDict
Code:

functions{
massFlow

    {
        type patchMassFlow;
        outputControl timeStep;
        verbose true;
        patches
        (
            inlet
            outlet
        );
        factor 1;
        outputInterval 1;
    }
}

you find more information in here: http://openfoamwiki.net/images/2/2a/...esentation.pdf

in case you only need the finished solution try:
https://www.cfd-online.com/Forums/op...lculation.html


Hi Felix,
Seems like OpenFOAM 18 users cannot use swak4foam. I also cannot get flowRatePatch running due to the following warning (simulation continues without patch calculation):


Starting time loop

--> FOAM Warning :
From function bool Foam::functionObjectList::read()
in file db/functionObjects/functionObjectList/functionObjectList.C at line 738
Reading "/home/mm/OpenFOAM/OpenFOAM-v1812/20190509/system/controlDict"
Entry name is not a dictionary



Any thoughts on this are most appreciate :)


All times are GMT -4. The time now is 19:36.