This changes simplifies the specification of functionObjects in controlDict and is consistent with the 'libs' option in controlDict to load special solver libraries. Support for the old 'functionObjectLibs' name is supported for backward compatibility.
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
| ========= | |
|
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
| \\ / O peration | Version: dev |
|
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
|
| \\/ M anipulation | |
|
|
\*---------------------------------------------------------------------------*/
|
|
|
|
inletMassFlowRate
|
|
{
|
|
type faceSource;
|
|
libs ("libfieldFunctionObjects.so");
|
|
|
|
fields
|
|
(
|
|
alphaRhoPhi.gas
|
|
alphaRhoPhi.liquid
|
|
);
|
|
|
|
valueOutput false;
|
|
log true;
|
|
surfaceFormat null;
|
|
|
|
source patch;
|
|
sourceName inlet;
|
|
|
|
operation sum;
|
|
|
|
writeControl timeStep;
|
|
}
|
|
|
|
outletMassFlowRate
|
|
{
|
|
type faceSource;
|
|
libs ("libfieldFunctionObjects.so");
|
|
|
|
fields
|
|
(
|
|
alphaRhoPhi.gas
|
|
alphaRhoPhi.liquid
|
|
);
|
|
|
|
valueOutput false;
|
|
log true;
|
|
surfaceFormat null;
|
|
|
|
source patch;
|
|
sourceName outlet;
|
|
|
|
operation sum;
|
|
|
|
writeControl timeStep;
|
|
}
|
|
|
|
totalMass
|
|
{
|
|
type coded;
|
|
libs ("libutilityFunctionObjects.so");
|
|
redirectType error;
|
|
|
|
code
|
|
#{
|
|
const volScalarField& alphaGas =
|
|
mesh().lookupObject<volScalarField>("alpha.gas");
|
|
const volScalarField& alphaLiquid =
|
|
mesh().lookupObject<volScalarField>("alpha.liquid");
|
|
|
|
const volScalarField& rhoGas =
|
|
mesh().lookupObject<volScalarField>("thermo:rho.gas");
|
|
const volScalarField& rhoLiquid =
|
|
mesh().lookupObject<volScalarField>("thermo:rho.liquid");
|
|
|
|
const volScalarField& dmdt =
|
|
mesh().lookupObject<volScalarField>("dmdt.gasAndLiquid");
|
|
|
|
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
|
|
<< " volIntegrate(all) for dmdt = "
|
|
<< gSum(dmdt*v) << endl
|
|
<< endl;
|
|
#};
|
|
}
|
|
|
|
// ************************************************************************* //
|