86 lines
2.1 KiB
C++
86 lines
2.1 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
========= |
|
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
\\ / O peration | Website: https://openfoam.org
|
|
\\ / A nd | Version: 12
|
|
\\/ M anipulation |
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
inletMassFlowRate
|
|
{
|
|
type surfaceFieldValue;
|
|
libs ("libfieldFunctionObjects.so");
|
|
|
|
fields
|
|
(
|
|
alphaRhoPhi.gas
|
|
alphaRhoPhi.liquid
|
|
);
|
|
|
|
writeFields false;
|
|
log true;
|
|
surfaceFormat none;
|
|
|
|
select patch;
|
|
name inlet;
|
|
|
|
operation sum;
|
|
|
|
writeControl timeStep;
|
|
}
|
|
|
|
outletMassFlowRate
|
|
{
|
|
type surfaceFieldValue;
|
|
libs ("libfieldFunctionObjects.so");
|
|
|
|
fields
|
|
(
|
|
alphaRhoPhi.gas
|
|
alphaRhoPhi.liquid
|
|
);
|
|
|
|
writeFields false;
|
|
log true;
|
|
surfaceFormat none;
|
|
|
|
select patch;
|
|
name outlet;
|
|
|
|
operation sum;
|
|
|
|
writeControl timeStep;
|
|
}
|
|
|
|
totalMass
|
|
{
|
|
type coded;
|
|
|
|
// Load the library containing the 'coded' functionObject
|
|
libs ("libutilityFunctionObjects.so");
|
|
|
|
codeExecute
|
|
#{
|
|
const volScalarField& alphaGas =
|
|
mesh().lookupObject<volScalarField>("alpha.gas");
|
|
const volScalarField& alphaLiquid =
|
|
mesh().lookupObject<volScalarField>("alpha.liquid");
|
|
|
|
const volScalarField& rhoGas =
|
|
mesh().lookupObject<volScalarField>("rho.gas");
|
|
const volScalarField& rhoLiquid =
|
|
mesh().lookupObject<volScalarField>("rho.liquid");
|
|
|
|
const scalarField& v = mesh().V();
|
|
|
|
Info<< "coded totalMass output:" << endl
|
|
<< " volIntegrate(all) for alpha.gas*rho.gas = "
|
|
<< gSum(alphaGas*rhoGas*v) << endl
|
|
<< " volIntegrate(all) for alpha.liquid*rho.liquid = "
|
|
<< gSum(alphaLiquid*rhoLiquid*v) << endl
|
|
<< endl;
|
|
#};
|
|
}
|
|
|
|
// ************************************************************************* //
|