CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

flowRatePatch for multiple patches simultaneously

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By cfd lover

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 29, 2017, 00:51
Default flowRatePatch for multiple patches simultaneously
  #1
New Member
 
Kaushik Mallick
Join Date: Jan 2017
Posts: 10
Rep Power: 9
kmallick is on a distinguished road
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"

// ************************************************************************* //
kmallick is offline   Reply With Quote

Old   December 29, 2017, 03:27
Default Swak4Foam
  #2
New Member
 
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 8
CFDelix is on a distinguished road
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
CFDelix is offline   Reply With Quote

Old   December 29, 2017, 14:19
Default
  #3
New Member
 
Kaushik Mallick
Join Date: Jan 2017
Posts: 10
Rep Power: 9
kmallick is on a distinguished road
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"
kmallick is offline   Reply With Quote

Old   January 2, 2018, 02:39
Default libs included?
  #4
New Member
 
Felix S
Join Date: Jun 2017
Posts: 11
Rep Power: 8
CFDelix is on a distinguished road
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.
CFDelix is offline   Reply With Quote

Old   March 31, 2018, 00:50
Default flowRatePatch for multiple patches simultaneously
  #5
New Member
 
Ali Mohammadi
Join Date: Oct 2017
Posts: 15
Rep Power: 8
cfd lover is on a distinguished road
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
saeed sangchooly likes this.
cfd lover is offline   Reply With Quote

Old   May 9, 2019, 13:38
Default
  #6
Member
 
Join Date: Mar 2019
Posts: 81
Rep Power: 7
mm66 is on a distinguished road
Quote:
Originally Posted by CFDelix View Post
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
mm66 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Foam::error::PrintStack almir OpenFOAM Running, Solving & CFD 91 December 21, 2022 04:50
Possible bug with stitchMesh and cyclics in OpenFoam Jack001 OpenFOAM Pre-Processing 0 May 21, 2016 08:00
[mesh manipulation] mirrorMesh and undoing the joining of patches chegdan OpenFOAM Meshing & Mesh Conversion 3 October 21, 2015 08:09
Cyclic boundaries in OF 21x morard OpenFOAM 25 May 13, 2013 22:35
Regarding periodic BC in ICEM generated grid Tarak OpenFOAM 32 April 30, 2013 14:46


All times are GMT -4. The time now is 06:07.