CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Calculate mass flow rate during run time in OpenFOAM (https://www.cfd-online.com/Forums/openfoam/217696-calculate-mass-flow-rate-during-run-time-openfoam.html)

aishk May 21, 2019 16:27

Calculate mass flow rate during run time in OpenFOAM
 
Hi all!

I am using the icoUncoupledKinematicParcel solver for a simple hopper-particle simulation. I have used "manual injection" and I need the mass flow rate through a specific plane in the hopper during its emptying. But when I try to do it through ParaView, I get U(0,0,0) (if I use slice -> integrate variables -> calculator). Does anyone know how to calculate the value of U or MFR through a plane or rectify this error?

Thanks for any help!

jherb May 22, 2019 09:00

You could add a function to system/controlDict which outputs the massflow in the directory postProcessing:
Code:

functions

{
  outletMassFlowYourPatch
  {
        type            surfaceFieldValue;
        functionObjectLibs ("libfieldFunctionObjects.so");
        enabled        true;
        writeControl    timeStep;
        writeInterval  100;
        log            true;
        writeFields    false;
        regionType      patch;
        name            yourPatch;
        operation      sum;
        fields
        (
            phi
        );
  }
   

}


If you want do this on a plane inside the fluid domain, you could try an internal baffle.

aishk May 23, 2019 18:41

Hi @jherb,

I tried both these options. I still get phi=0 at each time step in the outlet file.

Any other way to solve this?

Thank you!

jherb May 24, 2019 04:11

Which version of OpenFOAM are you using? Have a look at the source code of your solver (icoUncoupledKinematicParcel?) and check which field is used the flux. Then use that field in the functions object. Also did you get a postProcessing folder at all? The example I gave you outputs the values only every 100th time step. Change the value of writeInterval to 1.

aishk May 24, 2019 12:45

I am using OpenFOAM-dev for ubuntu. It looks like phi is velocity,U in icoUncoupledKinematicParcel.
I did get a postProcessing folder but all values of phi were zero at each 100 timesteps. Even when I reduce the timesteps to 1 it is zero.
I am not sure what is wrong. The magnitude of U in paraView is not zero though. The particles have velocity.

Yann May 27, 2019 07:03

Hello aishk,

In the example given by jherb, the function object computes the fluid flowrate, since phi refers to the fluid flux. The flux might be 0 in your case if you have a static fluid and if particles are just transported thanks to gravity and/or injection velocity. (this is what happens in the original hopper tutorial)

Since you want data related to particles, you need to use cloudFunctions, which are defined in your kinematicCloudProperties file. Among other cloud functions, facePostProcessing might do what you want :

Code:

Class
    Foam::FacePostProcessing
Description
    Records particle face quantities on used-specified face zone
    Currently supports:
        accummulated mass
        average mass flux

To use it, you need to define your plane as a faceZone (ie using topoSet) and then define the facePostProcessing function in your kinematicCloudProperties:

Code:

cloudFunctions
{
    myPostProcessing1
    {
        type            facePostProcessing;
        surfaceFormat    none;
        resetOnWrite    no;
        log                yes;
   
        faceZones
        (
            myPlaneFaceZone
        );
    }
}

You can switch off the "resetOnWrite" depending on whether you want the accumulated mass since start or since last write.


Have fun,

Yann


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