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/)
-   -   is there a post processing keyword for obtaining mass flow rate and total mass? (https://www.cfd-online.com/Forums/openfoam-post-processing/115525-there-post-processing-keyword-obtaining-mass-flow-rate-total-mass.html)

immortality April 1, 2013 17:07

is there a post processing keyword for obtaining mass flow rate and total mass?
 
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?

sharonyue April 1, 2013 23:06

Quote:

Originally Posted by immortality (Post 417682)
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,

immortality April 2, 2013 00:15

thank you.then type massflow in the terminal?

sharonyue April 2, 2013 02:35

Quote:

Originally Posted by immortality (Post 417732)
thank you.then type massflow in the terminal?

Nope,just add this in controlDict, and see what happens in the terminal.

Regards,

immortality April 2, 2013 05:27

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 April 2, 2013 08:57

can write phi in previous time folders?

sharonyue April 2, 2013 08:59

Quote:

Originally Posted by immortality (Post 417777)
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,

immortality April 2, 2013 09:08

do you know what does valueOutput mean and why is set to false?

sharonyue April 2, 2013 19:29

Quote:

Originally Posted by immortality (Post 417842)
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,

immortality April 3, 2013 04:05

how to obtain mass balance after run?
 
i want a code that can calculate net mass on patches(add mass inflow and outflow on patches) preferably in a time period.

Bernhard April 3, 2013 06:31

Check out the patchAverage and patchIntegrate utilities. They should be able to do what you need.

immortality April 3, 2013 09:44

how can move this thread to post processing forum to get more helps and answers?

immortality April 3, 2013 16:48

patchAverage and patchIntegrate doesn't work on surfaceScalarFields.
any idea?
thanks.

immortality April 3, 2013 17:04

whats the command for calculating mass flow?
 
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?

wyldckat April 3, 2013 19:19

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 (Post 418191)
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...

immortality April 4, 2013 08:02

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 April 4, 2013 17:54

is it possible to use a mass flow rate and/or summation of mass on patches during an interval code for compiling?

wyldckat April 6, 2013 07:51

2 Attachment(s)
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

immortality April 6, 2013 09:47

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 April 9, 2013 05:51

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 ;) )


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