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

is there a post processing keyword for obtaining mass flow rate and total mass?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 1, 2013, 17:07
Default is there a post processing keyword for obtaining mass flow rate and total mass?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I was searching about a function to calculate mass flow rate during the run.now i need to calculate mass flow rate and also total mass entering in or exiting from a patch after the end of run.does anyone know the related keyword or way to do this?
immortality is offline   Reply With Quote

Old   April 1, 2013, 23:06
Default
  #2
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by immortality View Post
I was searching about a function to calculate mass flow rate during the run.now i need to calculate mass flow rate and also total mass entering in or exiting from a patch after the end of run.does anyone know the related keyword or way to do this?

Hi,

Try this code from Mr.Prasant

Code:
functions
{
    massflow
    {
        type            faceSource;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled         true;
        outputControl    timeStep;
        log             true;
        valueOutput     false;
        source          patch;
        sourceName      yourpatchname;
        operation       sum;

        fields
        (
            phi
        );
    }
}
Regards,
BlnPhoenix likes this.
sharonyue is offline   Reply With Quote

Old   April 2, 2013, 00:15
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thank you.then type massflow in the terminal?
immortality is offline   Reply With Quote

Old   April 2, 2013, 02:35
Default
  #4
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by immortality View Post
thank you.then type massflow in the terminal?
Nope,just add this in controlDict, and see what happens in the terminal.

Regards,
sharonyue is offline   Reply With Quote

Old   April 2, 2013, 05:27
Default
  #5
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
i think this add mass flow rates in new time folders.is there a way to calculating it after the run has done?like keywords Mach,Pe,vorticity,etc in postProcessing?
immortality is offline   Reply With Quote

Old   April 2, 2013, 08:57
Default
  #6
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
can write phi in previous time folders?
immortality is offline   Reply With Quote

Old   April 2, 2013, 08:59
Default
  #7
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by immortality View Post
i think this add mass flow rates in new time folders.is there a way to calculating it after the run has done?like keywords Mach,Pe,vorticity,etc in postProcessing?
I am not sure for that,if you know just let me know.Thanks

Regards,
sharonyue is offline   Reply With Quote

Old   April 2, 2013, 09:08
Default
  #8
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
do you know what does valueOutput mean and why is set to false?
immortality is offline   Reply With Quote

Old   April 2, 2013, 19:29
Default
  #9
Senior Member
 
Dongyue Li
Join Date: Jun 2012
Location: Beijing, China
Posts: 838
Rep Power: 17
sharonyue is on a distinguished road
Quote:
Originally Posted by immortality View Post
do you know what does valueOutput mean and why is set to false?
Sorry,I forget that,but you can alter that and see what happens.

Regards,
sharonyue is offline   Reply With Quote

Old   April 3, 2013, 04:05
Default how to obtain mass balance after run?
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
i want a code that can calculate net mass on patches(add mass inflow and outflow on patches) preferably in a time period.
immortality is offline   Reply With Quote

Old   April 3, 2013, 06:31
Default
  #11
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Check out the patchAverage and patchIntegrate utilities. They should be able to do what you need.
Bernhard is offline   Reply With Quote

Old   April 3, 2013, 09:44
Default
  #12
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
how can move this thread to post processing forum to get more helps and answers?
immortality is offline   Reply With Quote

Old   April 3, 2013, 16:48
Default
  #13
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
patchAverage and patchIntegrate doesn't work on surfaceScalarFields.
any idea?
thanks.
immortality is offline   Reply With Quote

Old   April 3, 2013, 17:04
Default whats the command for calculating mass flow?
  #14
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
I was searching about a function to calculate mass flow rate during the run.now i need to calculate mass flow rate and also total mass entering in or exiting from a patch after the end of run.does anyone know the related keyword or way to do this?
immortality is offline   Reply With Quote

Old   April 3, 2013, 19:19
Default
  #15
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all,

I've moved this thread to the post-processing forum. And to quote my answer from a few minutes ago on another thread:
Quote:
Originally Posted by wyldckat View Post
For calculating mass flow, the following has been around for several years now: http://openfoamwiki.net/index.php/Contrib_calcMassFlow
Best regards,
Bruno

PS: also moved a few other related posts/threads started by Ehsan...
__________________

Last edited by wyldckat; April 3, 2013 at 19:23. Reason: see "PS:"
wyldckat is offline   Reply With Quote

Old   April 4, 2013, 08:02
Default
  #16
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
thank you dear Bruno for moving!
the thread gives this error in compiling as I put in Cp thread for more convenience of readers:
Code:
ehsan@Ehsan-com:~/Desktop/calcMassFlow$ wmake
Making dependency list for source file calcMassFlow.C
could not open file fvCFD.H for source file calcMassFlow.C
could not open file FaceSetUtilities.H for source file calcMassFlow.C
SOURCE=calcMassFlow.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam220/src/cfdTools/lnInclude -I/opt/openfoam220/src/cfdTools/general/lnInclude 	 -I/opt/openfoam220/src/meshTools/lnInclude 	 -I/home/ehsan/OpenFOAM/ehsan-2.2.0/Libraries/cellFaceSetUtilities/lnInclude -IlnInclude -I. -I/opt/openfoam220/src/OpenFOAM/lnInclude -I/opt/openfoam220/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/calcMassFlow.o
calcMassFlow.C:33:19: fatal error: fvCFD.H: No such file or directory
compilation terminated.
make: *** [Make/linux64GccDPOpt/calcMassFlow.o] Error 1
could you please help to modify it too?
if mass flow trouble resolves almost my work can be finished successfully.
immortality is offline   Reply With Quote

Old   April 4, 2013, 17:54
Default
  #17
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
is it possible to use a mass flow rate and/or summation of mass on patches during an interval code for compiling?
immortality is offline   Reply With Quote

Old   April 6, 2013, 07:51
Default
  #18
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi Ehsan,

Just a little pointer before continuing to the issue with calcMassFlow - simpleFunctionObjects can easily be used for calculating the mass flow during run: http://www.cfd-online.com/Forums/ope...tml#post418739 - although I vaguely remember you writing somewhere about how you need to calculate it after the solver had already been executed.

So, moving onto the adaptation of calcMassFlow to OpenFOAM 2.2:
  • Attached is the adaptation I've quickly made, based on the following sources:
  • After unpacking it, go into the unpacked folder and run:
    Code:
    wmake
  • An example of a "system/calcMassFlowDict" is as follows:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.2.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      calcMassFlowDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    bcs
    (
    left  
    right
    );
    
    //Example for setting rho - uncomment the next line
    //rho rho [ 1 -3 0 0 0 0 0 ] 1.0;
WARNING: I have not thoroughly tested this... I've only made a quick adaptation of the code. Therefore, I advise you to use funkyDoCalc, as addressed on the other thread: http://www.cfd-online.com/Forums/ope...uring-run.html

_________________________
Edit: as per requested, I've managed to create a variant that writes to file instead of the standard output. Based on the instructions above, here's the ones for calcMassFlow2File to OpenFOAM 2.2:
  • After unpacking it, go into the unpacked folder and run:
    Code:
    wmake
  • An example of a "system/calcMassFlowDict" is as follows:
    Code:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  2.2.x                                 |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version     2.0;
        format      ascii;
        class       dictionary;
        location    "system";
        object      calcMassFlowDict;
    }
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    bcs
    (
    left  
    right
    );
    
    //Output file name
    outputFileName "inlet_outlet.log";
    
    //option for outputting with no units
    outputWithoutUnits yes;
    
    //Example for setting rho - uncomment the next line
    //rho rho [ 1 -3 0 0 0 0 0 ] 1.0;
  • The new keyword "outputFileName" is for defining the file where the values are saved.
  • The other new keyword "outputWithoutUnits" is for choosing whether the units should be present inside the file or not, but just for the mass flow values.
  • The application name is calcMassFlow2File.

Best regards,
Bruno
Attached Files
File Type: gz calcMassFlow_for_OF2.2.tar.gz (5.0 KB, 22 views)
File Type: gz calcMassFlow2File_for_OF2.2.tar.gz (5.3 KB, 21 views)
immortality likes this.
__________________

Last edited by wyldckat; April 14, 2013 at 06:47. Reason: added calcMassFlow2File
wyldckat is offline   Reply With Quote

Old   April 6, 2013, 09:47
Default
  #19
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
Thank you dear Bruno.it works.i put the results in a log file.
is it possible that all left flow rate values be writed separately and after ending of left values right values be writed too.
like:
left:
time0 value0
time1 value1
time2 value2
.
.
.
right:
time0 value0
time1 value1
time2 value2
immortality is offline   Reply With Quote

Old   April 9, 2013, 05:51
Default
  #20
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
could you please do some modifications in very useful (i think the sole)post processing tool for calculating mass flow rate to write in a file with a good order?then it will be a complete nice tool for anyone to refer to(and specially for me )
immortality 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
Target Mass Flow Rate Nitin FLUENT 9 June 17, 2017 10:30
how to set BC for compressible flow target mass flow rate foolboy007 FLUENT 1 April 4, 2012 03:24
Mass flow rate through each cell Babakjingo Main CFD Forum 0 August 21, 2011 03:18
particle, parcel and mass flow rate balance flybird FLUENT 0 May 24, 2007 10:44
mass flow inlet Denis Tschumperle FLUENT 7 August 9, 2000 02:19


All times are GMT -4. The time now is 16:39.