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/)
-   -   Mass Flow rate through a plane (https://www.cfd-online.com/Forums/openfoam-post-processing/78435-mass-flow-rate-through-plane.html)

titio July 21, 2010 18:08

Mass Flow rate through a plane
 
Hi foamers,

I am starting to feel desesperate guys. I am trying to calculate the mass flow through a plane that it is not a patch, as the massCalcFlow does. Is there any way of this the easy way, say using foamCalc or some other utility that I am not aware of. If not possible to do that easily, I will do it in the code, and I will contribute it to the community, if I manage to do it.

Can anyone help me out. Thanks in advance,

António Martins

PS: OpenFOAM really needs a good documentation, but it seems capitalism and common good do not mix very well... and the problems with the documentation site only helped the commercial software even more....

olesen July 22, 2010 03:20

Quote:

Originally Posted by titio (Post 268402)
Hi foamers,

I am starting to feel desesperate guys. I am trying to calculate the mass flow through a plane that it is not a patch, as the massCalcFlow does. Is there any way of this the easy way, say using foamCalc or some other utility that I am not aware of. If not possible to do that easily, I will do it in the code, and I will contribute it to the community, if I manage to do it.

Can anyone help me out. Thanks in advance,

I'd guess that there just isn't a generic place for such a massflow sampling and that's why it hasn't made its way into the code.
Note that this is all much easier when sampling on a patch, since you can simply use the phi directly there.

Nonetheless, this code fragment should give you a few ideas (I hope).

Code:

// defined somewhere in the surrounding class:
PtrList<sampledPlane> gammaPlanes_;


void Foam::massFlowInfo::calculateAndWrite
(
    const volVectorField& U,
    const volScalarField& rho
) const
{
    forAll(gammaPlanes_, planeI)
    {
        const sampledPlane& pln = gammaPlanes_[planeI];

        label nFaces = pln.faces().size();
        reduce(nFaces, sumOp<label>());

        if (nFaces)
        {
            // the velocity normal to the plane
            scalarField Uproj = pln.project
            (
                pln.sample(U)
            );

            scalar U_mean = pln.average(Uproj);

            scalarField rhoU = pln.sample(rho) * Uproj;
            scalar massFlow = pln.integrate(rhoU);

            Info<< pln.name() << nl
                << "  area      = " << pln.area() << nl
                << "  massFlow  = " << massFlow << "  ("
                << (massFlow * 3600) << " kg/h)" << nl
                << "  U_mean    = " << U_mean
                << endl;
        }
        else
        {
            Info<< pln.name() << nl
                << "  area      = " << 0
                << endl;
        }
    }
}


titio July 22, 2010 14:23

Thanks
 
Thanks olesen. I will try the code and I will let you know if its worked.

Thanks,

Titio

chegdan October 26, 2010 17:54

what happened with this?
 
Was this resolved? if so, please share how you made this possible.

robingilbert October 26, 2010 18:00

try swak4Foam:

http://openfoamwiki.net/index.php/Contrib/swak4Foam

to calculate flow rate through internal faceZone this works. i have tried it. to calculate the flow through a patch u can use calcMassFlow:

http://openfoamwiki.net/index.php/Contrib_calcMassFlow

maysmech October 27, 2010 17:59

hi,


How can i calculate mass flow rate of a patch by using paraView software?

misakagan March 25, 2012 20:08

how to construct sampledPlane?
 
Quote:

Originally Posted by olesen (Post 268435)
I'd guess that there just isn't a generic place for such a massflow sampling and that's why it hasn't made its way into the code.
Note that this is all much easier when sampling on a patch, since you can simply use the phi directly there.

Nonetheless, this code fragment should give you a few ideas (I hope).

Code:

// defined somewhere in the surrounding class:
PtrList<sampledPlane> gammaPlanes_;


void Foam::massFlowInfo::calculateAndWrite
(
    const volVectorField& U,
    const volScalarField& rho
) const
{
    forAll(gammaPlanes_, planeI)
    {
        const sampledPlane& pln = gammaPlanes_[planeI];

        label nFaces = pln.faces().size();
        reduce(nFaces, sumOp<label>());

        if (nFaces)
        {
            // the velocity normal to the plane
            scalarField Uproj = pln.project
            (
                pln.sample(U)
            );

            scalar U_mean = pln.average(Uproj);

            scalarField rhoU = pln.sample(rho) * Uproj;
            scalar massFlow = pln.integrate(rhoU);

            Info<< pln.name() << nl
                << "  area      = " << pln.area() << nl
                << "  massFlow  = " << massFlow << "  ("
                << (massFlow * 3600) << " kg/h)" << nl
                << "  U_mean    = " << U_mean
                << endl;
        }
        else
        {
            Info<< pln.name() << nl
                << "  area      = " << 0
                << endl;
        }
    }
}


Dear Mr. Olesen,

The code is very helpful, but I wonder also how the parts related to construction of sampledPlane's is implemented. Normally sampledPlane's are constructed on runtime using the sampleDict with runtimeselectiontable. I don't know how to construct them in a regular way with the direction vectors and basepoints.

Any suggestion would be a lot of help.

Best,

Asim

misakagan March 25, 2012 20:41

Ok I found the answer. I have to create cuttingPlane's and construct sampledPlane's using those cuttingPlane's...

krndv August 22, 2017 03:22

solution?
 
Quote:

Originally Posted by maysmech (Post 281082)
hi,


How can i calculate mass flow rate of a patch by using paraView software?



hello,

have you got answer for this? Please share if you know/

Thank you

Flowkersma August 22, 2017 04:46

Quote:

Originally Posted by krndv (Post 661468)
hello,

have you got answer for this? Please share if you know/

Thank you

1. Calculate rho * U_N with "Calculator".
2. Use "IntegrateVariables" filter to calculate the massflow.


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