COM: Separate htc FO from general FO and reactingEuler solvers (#1714)

The phase systems tables for multiphase solvers create conflict
between each other as they are defined in the same namespace and using
similar class names.

Therefore a special htc function object for reactingEulerSolver was
added (reactingEulerHtcModel), located under
src/phaseSystemModels/reactingEulerFoam/functionObjects/

This commit includes the following:

- Relocate solvers/reactingEulerFoam functionObjects to
  src/phaseSystemModels
- Remove links for fieldFunctionObject to multiphase libs to avoid
  conflicts
- New FO for htc for reactingEulerFoam called reactingEulerHtcModel
This commit is contained in:
sergio
2020-06-01 12:53:30 -07:00
committed by Mark Olesen
parent cf09b67b28
commit 95f7ed0342
26 changed files with 421 additions and 85 deletions

View File

@ -3,6 +3,5 @@ cd "${0%/*}" || exit # Run from this directory
wclean reactingTwoPhaseEulerFoam
wclean reactingMultiphaseEulerFoam
wclean libso functionObjects
#------------------------------------------------------------------------------

View File

@ -16,6 +16,5 @@ esac
reactingTwoPhaseEulerFoam/Allwmake $targetType $*
reactingMultiphaseEulerFoam/Allwmake $targetType $*
wmake $targetType functionObjects
#------------------------------------------------------------------------------

View File

@ -1,4 +0,0 @@
sizeDistribution/sizeDistribution.C
phaseForces/phaseForces.C
LIB = $(FOAM_LIBBIN)/libreactingEulerFoamFunctionObjects

View File

@ -1,11 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/functionObjects/field/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/interfacialModels/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/phaseSystems/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lfieldFunctionObjects

View File

@ -1,308 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "phaseForces.H"
#include "addToRunTimeSelectionTable.H"
#include "BlendedInterfacialModel.H"
#include "dragModel.H"
#include "virtualMassModel.H"
#include "liftModel.H"
#include "wallLubricationModel.H"
#include "turbulentDispersionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(phaseForces, 0);
addToRunTimeSelectionTable(functionObject, phaseForces, dictionary);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class modelType>
Foam::tmp<Foam::volVectorField>
Foam::functionObjects::phaseForces::nonDragForce(const phasePair& pair) const
{
const BlendedInterfacialModel<modelType>& model =
fluid_.lookupBlendedSubModel<modelType>(pair);
if (&pair.phase1() == &phase_)
{
return model.template F<vector>();
}
else
{
return -model.template F<vector>();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::phaseForces::phaseForces
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
phase_
(
mesh_.lookupObject<phaseModel>
(
IOobject::groupName("alpha", dict.get<word>("phase"))
)
),
fluid_(mesh_.lookupObject<phaseSystem>("phaseProperties"))
{
read(dict);
forAllConstIter
(
phaseSystem::phasePairTable,
fluid_.phasePairs(),
iter
)
{
const phasePair& pair = iter();
if (pair.contains(phase_) && !pair.ordered())
{
if (fluid_.foundBlendedSubModel<dragModel>(pair))
{
forceFields_.set
(
dragModel::typeName,
new volVectorField
(
IOobject
(
IOobject::groupName("dragForce", phase_.name()),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector(dimForce/dimVolume)
)
);
}
if (fluid_.foundBlendedSubModel<virtualMassModel>(pair))
{
forceFields_.set
(
virtualMassModel::typeName,
new volVectorField
(
IOobject
(
IOobject::groupName
(
"virtualMassForce",
phase_.name()
),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector(dimForce/dimVolume)
)
);
}
if (fluid_.foundBlendedSubModel<liftModel>(pair))
{
forceFields_.set
(
liftModel::typeName,
new volVectorField
(
IOobject
(
IOobject::groupName("liftForce", phase_.name()),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector(dimForce/dimVolume)
)
);
}
if (fluid_.foundBlendedSubModel<wallLubricationModel>(pair))
{
forceFields_.set
(
wallLubricationModel::typeName,
new volVectorField
(
IOobject
(
IOobject::groupName
(
"wallLubricationForce",
phase_.name()
),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector(dimForce/dimVolume)
)
);
}
if (fluid_.foundBlendedSubModel<turbulentDispersionModel>(pair))
{
forceFields_.set
(
turbulentDispersionModel::typeName,
new volVectorField
(
IOobject
(
IOobject::groupName
(
"turbulentDispersionForce",
phase_.name()
),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedVector(dimForce/dimVolume)
)
);
}
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::phaseForces::~phaseForces()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::phaseForces::read(const dictionary& dict)
{
fvMeshFunctionObject::read(dict);
return true;
}
bool Foam::functionObjects::phaseForces::execute()
{
forAllIter
(
HashPtrTable<volVectorField>,
forceFields_,
iter
)
{
const word& type = iter.key();
volVectorField& force = *iter();
force *= 0.0;
forAllConstIter
(
phaseSystem::phasePairTable,
fluid_.phasePairs(),
iter2
)
{
const phasePair& pair = iter2();
if (pair.contains(phase_) && !pair.ordered())
{
if (type == "dragModel")
{
force +=
fluid_.lookupBlendedSubModel<dragModel>(pair).K()
*(pair.otherPhase(phase_).U() - phase_.U());
}
if (type == "virtualMassModel")
{
force +=
fluid_.lookupBlendedSubModel<virtualMassModel>(pair).K()
*(
pair.otherPhase(phase_).DUDt()
- phase_.DUDt()
);
}
if (type == "liftModel")
{
force = nonDragForce<liftModel>(pair);
}
if (type == "wallLubricationModel")
{
force = nonDragForce<wallLubricationModel>(pair);
}
if (type == "turbulentDispersionModel")
{
force = nonDragForce<turbulentDispersionModel>(pair);
}
}
}
}
return true;
}
bool Foam::functionObjects::phaseForces::write()
{
forAllIter
(
HashPtrTable<volVectorField>,
forceFields_,
iter
)
{
writeObject(iter()->name());
}
return true;
}
// ************************************************************************* //

View File

@ -1,165 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::phaseForces
Description
This function object calculates and outputs the blended interfacial forces
acting on a given phase, i.e. drag, virtual mass, lift, wall-lubrication and
turbulent dispersion. Note that it works only in run-time processing mode
and in combination with the reactingEulerFoam solvers.
For a simulation involving more than two phases, the accumulated force is
calculated by looping over all phasePairs involving that phase. The fields
are stored in the database so that they can be processed further, e.g. with
the fieldAveraging functionObject.
Example of function object specification:
\verbatim
phaseForces.water
{
type phaseForces;
libs (reactingEulerFoamFunctionObjects);
writeControl writeTime;
writeInterval 1;
...
phaseName water;
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: phaseForces | yes |
phaseName | Name of evaluated phase | yes |
\endtable
See also
Foam::BlendedInterfacialModel
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObject
SourceFiles
phaseForces.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_phaseForces_H
#define functionObjects_phaseForces_H
#include "fvMeshFunctionObject.H"
#include "phaseSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class phaseForces Declaration
\*---------------------------------------------------------------------------*/
class phaseForces
:
public fvMeshFunctionObject
{
// Private Member Functions
//- Disallow default bitwise copy construct
phaseForces(const phaseForces&);
//- Disallow default bitwise assignment
void operator=(const phaseForces&);
protected:
// Protected data
HashPtrTable<volVectorField> forceFields_;
//- Phase for which forces are evaluated
const phaseModel& phase_;
//- Constant access to phaseSystem
const phaseSystem& fluid_;
// Protected Member Functions
//- Evaluate and return non-drag force
template<class modelType>
tmp<volVectorField> nonDragForce(const phasePair& key) const;
public:
//- Runtime type information
TypeName("phaseForces");
// Constructors
//- Construct from Time and dictionary
phaseForces
(
const word& name,
const Time& runTime,
const dictionary&
);
//- Destructor
virtual ~phaseForces();
// Member Functions
//- Read the input data
virtual bool read(const dictionary& dict);
//- Calculate the force fields
virtual bool execute();
//- Write the force fields
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,600 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "sizeDistribution.H"
#include "sizeGroup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(sizeDistribution, 0);
addToRunTimeSelectionTable(functionObject, sizeDistribution, dictionary);
}
}
const Foam::Enum
<
Foam::functionObjects::sizeDistribution::selectionModeTypes
>
Foam::functionObjects::sizeDistribution::selectionModeTypeNames_
({
{selectionModeTypes::rtCellZone, "cellZone"},
{selectionModeTypes::rtAll, "all"},
});
const Foam::Enum
<
Foam::functionObjects::sizeDistribution::functionTypes
>
Foam::functionObjects::sizeDistribution::functionTypeNames_
({
{functionTypes::ftNdf, "numberDensity"},
{functionTypes::ftVdf, "volumeDensity"},
{functionTypes::ftNc, "numberConcentration"},
{functionTypes::ftMom, "moments"},
});
const Foam::Enum
<
Foam::functionObjects::sizeDistribution::abszissaTypes
>
Foam::functionObjects::sizeDistribution::abszissaTypeNames_
({
{abszissaTypes::atDiameter, "diameter"},
{abszissaTypes::atVolume, "volume"},
});
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::functionObjects::sizeDistribution::initialise
(
const dictionary& dict
)
{
switch (functionType_)
{
case ftNdf:
{
break;
}
case ftVdf:
{
break;
}
case ftNc:
{
break;
}
case ftMom:
{
break;
}
default:
{
FatalIOErrorInLookup
(
dict,
"functionType",
word::null,
functionTypeNames_
) << exit(FatalIOError);
}
}
switch (abszissaType_)
{
case atDiameter:
{
break;
}
case atVolume:
{
break;
}
default:
{
FatalIOErrorInLookup
(
dict,
"abszissaType",
word::null,
abszissaTypeNames_
) << exit(FatalIOError);
}
}
setCellZoneCells();
if (nCells_ == 0)
{
FatalIOErrorInFunction(dict)
<< type() << " " << name() << ": "
<< selectionModeTypeNames_[selectionModeType_]
<< '(' << selectionModeTypeName_ << "):" << nl
<< " Selection has no cells" << exit(FatalIOError);
}
volume_ = volume();
Info<< type() << " " << name() << ":"
<< selectionModeTypeNames_[selectionModeType_]
<< '(' << selectionModeTypeName_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << volume_
<< nl << endl;
}
void Foam::functionObjects::sizeDistribution::setCellZoneCells()
{
switch (selectionModeType_)
{
case rtCellZone:
{
dict().readEntry("cellZone", selectionModeTypeName_);
label zoneId =
mesh().cellZones().findZoneID(selectionModeTypeName_);
if (zoneId < 0)
{
FatalIOErrorInFunction(dict_)
<< "Unknown cellZone name: " << selectionModeTypeName_
<< ". Valid cellZone names are: "
<< mesh().cellZones().names()
<< nl << exit(FatalIOError);
}
cellId_ = mesh().cellZones()[zoneId];
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
break;
}
case rtAll:
{
cellId_ = identity(mesh().nCells());
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
break;
}
default:
{
FatalIOErrorInLookup
(
dict_,
"selectionMode",
word::null,
selectionModeTypeNames_
) << exit(FatalIOError);
}
}
}
Foam::scalar Foam::functionObjects::sizeDistribution::volume() const
{
return gSum(filterField(mesh().V()));
}
void Foam::functionObjects::sizeDistribution::combineFields(scalarField& field)
{
List<scalarField> allValues(Pstream::nProcs());
allValues[Pstream::myProcNo()] = field;
Pstream::gatherList(allValues);
if (Pstream::master())
{
field =
ListListOps::combine<scalarField>
(
allValues,
accessOp<scalarField>()
);
}
}
Foam::tmp<Foam::scalarField>
Foam::functionObjects::sizeDistribution::filterField
(
const scalarField& field
) const
{
return tmp<scalarField>(new scalarField(field, cellId_));
}
void Foam::functionObjects::sizeDistribution::writeFileHeader
(
const label i
)
{
OFstream& file = this->file();
switch (functionType_)
{
case ftNdf:
{
writeHeader(file, "Number density function");
break;
}
case ftVdf:
{
writeHeader(file, "Volume density function");
break;
}
case ftNc:
{
writeHeader(file, "Number concentration");
break;
}
case ftMom:
{
writeHeader(file, "Moments");
break;
}
}
switch (abszissaType_)
{
case atVolume:
{
writeCommented(file, "Time/volume");
break;
}
case atDiameter:
{
writeCommented(file, "Time/diameter");
break;
}
}
switch (functionType_)
{
case ftMom:
{
for (label i = 0; i <= momentOrder_; i++)
{
file() << tab << i;
}
break;
}
default:
{
forAll(popBal_.sizeGroups(), sizeGroupi)
{
const diameterModels::sizeGroup& fi =
popBal_.sizeGroups()[sizeGroupi];
switch (abszissaType_)
{
case atDiameter:
{
file() << tab << fi.d().value();
break;
}
case atVolume:
{
file() << tab << fi.x().value();
break;
}
}
}
break;
}
}
file << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::sizeDistribution::sizeDistribution
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
writeFile(obr_, name),
dict_(dict),
selectionModeType_
(
selectionModeTypeNames_.get("selectionMode", dict)
),
selectionModeTypeName_(word::null),
functionType_(functionTypeNames_.get("functionType", dict)),
abszissaType_(abszissaTypeNames_.get("abszissaType", dict)),
nCells_(0),
cellId_(),
volume_(0.0),
writeVolume_(dict.getOrDefault("writeVolume", false)),
popBal_
(
obr_.lookupObject<Foam::diameterModels::populationBalanceModel>
(
dict.get<word>("populationBalance")
)
),
N_(popBal_.sizeGroups().size()),
momentOrder_(dict.getOrDefault<label>("momentOrder", 0)),
normalize_(dict.getOrDefault("normalize", false)),
sumN_(0.0),
sumV_(0.0)
{
read(dict);
resetFile(name);
createFile(name);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::sizeDistribution::~sizeDistribution()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::sizeDistribution::read(const dictionary& dict)
{
if (dict != dict_)
{
dict_ = dict;
}
fvMeshFunctionObject::read(dict);
writeFile::read(dict);
initialise(dict);
return true;
}
bool Foam::functionObjects::sizeDistribution::execute()
{
return true;
}
bool Foam::functionObjects::sizeDistribution::write()
{
writeFileHeader();
writeCurrentTime(file());
Log << type() << " " << name() << " write" << nl;
scalarField V(filterField(mesh().V()));
combineFields(V);
sumN_ = 0;
sumV_ = 0;
forAll(N_, i)
{
const Foam::diameterModels::sizeGroup& fi = popBal_.sizeGroups()[i];
const volScalarField& alpha = fi.VelocityGroup().phase();
scalarField Ni(fi*alpha/fi.x());
scalarField values(filterField(Ni));
scalarField V(filterField(mesh().V()));
// Combine onto master
combineFields(values);
combineFields(V);
if (Pstream::master())
{
// Calculate volume-averaged number concentration
N_[i] = sum(V*values)/sum(V);
}
sumN_ += N_[i];
sumV_ += N_[i]*fi.x().value();
}
if (Pstream::master())
{
switch (functionType_)
{
case ftMom:
{
for (label m = 0; m <= momentOrder_; m++)
{
scalar result(0.0);
forAll(N_, i)
{
const Foam::diameterModels::sizeGroup& fi =
popBal_.sizeGroups()[i];
switch (abszissaType_)
{
case atVolume:
{
result += pow(fi.x().value(), m)*N_[i];
break;
}
case atDiameter:
{
result += pow(fi.d().value(), m)*N_[i];
break;
}
}
}
file() << tab << result;
}
break;
}
default:
{
forAll(popBal_.sizeGroups(), i)
{
const Foam::diameterModels::sizeGroup& fi =
popBal_.sizeGroups()[i];
scalar result(0.0);
scalar delta(0.0);
switch (abszissaType_)
{
case atVolume:
{
delta = popBal_.v()[i+1].value()
- popBal_.v()[i].value();
break;
}
case atDiameter:
{
const scalar& formFactor =
fi.VelocityGroup().formFactor().value();
delta =
pow
(
popBal_.v()[i+1].value()
/formFactor,
1.0/3.0
)
- pow
(
popBal_.v()[i].value()
/formFactor,
1.0/3.0
);
break;
}
}
switch (functionType_)
{
case ftNdf:
{
if (normalize_ == true)
{
result = N_[i]/delta/sumN_;
}
else
{
result = N_[i]/delta;
}
break;
}
case ftVdf:
{
if (normalize_ == true)
{
result = N_[i]*fi.x().value()/delta/sumV_;
}
else
{
result = N_[i]*fi.x().value()/delta;
}
break;
}
case ftNc:
{
if (normalize_ == true)
{
result = N_[i]/sumN_;
}
else
{
result = N_[i];
}
break;
}
default:
{
break;
}
}
file()<< tab << result;
}
}
}
}
{
file()<< endl;
}
Log << endl;
return true;
}
// ************************************************************************* //

View File

@ -1,279 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::functionObjects::sizeDistribution
Description
This function object calculates and outputs information about the size
distribution of the dispersed phase, such as the number density function or
its moments. It is designed to be used exclusively with the population
balance modeling functionality of the reactingEulerFoam solvers. It can be
applied to a specific cellZone or the entire domain.
Example of function object specification:
\verbatim
box.all.numberDensity.volume.bubbles
{
type sizeDistribution;
libs (reactingEulerFoamFunctionObjects);
writeControl outputTime;
writeInterval 1;
log true;
...
functionType numberDensity;
abszissaType volume;
selectionMode all;
populationBalanceModel bubbles;
normalize true;
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: sizeDistribution | yes |
functionType | numberDensity, volumeDensity, numberConcentration,
moments | yes |
abszissaType | volume, diameter | yes |
momentOrder | Write moment up to given order | no | 0
selectionMode | Evaluate for cellZone or entire mesh | yes |
cellZone | Required if selectionMode is cellZone | |
populationBalanceModel | Respective populationBalanceModel | yes |
normalize | Normalization | no |
\endtable
See also
Foam::diameterModels::populationBalanceModel
Foam::functionObject
Foam::functionObjects::fvMeshFunctionObject
Foam::functionObjects::writeFile
SourceFiles
sizeDistribution.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_sizeDistribution_H
#define functionObjects_sizeDistribution_H
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "populationBalanceModel.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class sizeDistribution Declaration
\*---------------------------------------------------------------------------*/
class sizeDistribution
:
public fvMeshFunctionObject,
public writeFile
{
public:
// Public data types
//- Selection mode type enumeration
enum selectionModeTypes
{
rtCellZone,
rtAll
};
//- Selection mode type names
static const Enum<selectionModeTypes> selectionModeTypeNames_;
//- Function type enumeration
enum functionTypes
{
ftNdf,
ftVdf,
ftNc,
ftMom
};
//- Function type names
static const Enum<functionTypes> functionTypeNames_;
//- abszissa type enumeration
enum abszissaTypes
{
atDiameter,
atVolume,
};
//- Abszissa type names
static const Enum<abszissaTypes> abszissaTypeNames_;
protected:
// Protected data
//- Construction dictionary
dictionary dict_;
//- Selection mode type
selectionModeTypes selectionModeType_;
//- Name of selection
word selectionModeTypeName_;
//- Function type
functionTypes functionType_;
//- Abszissa type
abszissaTypes abszissaType_;
//- Global number of cells
label nCells_;
//- Local list of cell IDs
labelList cellId_;
//- Total volume of the evaluated selection
scalar volume_;
//- Optionally write the volume of the sizeDistribution
bool writeVolume_;
//- PopulationBalance
const Foam::diameterModels::populationBalanceModel& popBal_;
//- Number concentrations
List<scalar> N_;
//- Write moments up to specified order with respect to abszissaType
label momentOrder_;
//- Normalization switch
const Switch normalize_;
//- Sum of number concentrations
scalar sumN_;
//- Volumertic sum
scalar sumV_;
// Protected Member Functions
//- Initialise, e.g. cell addressing
void initialise(const dictionary& dict);
//- Set cells to evaluate based on a cell zone
void setCellZoneCells();
//- Calculate and return volume of the evaluated cell zone
scalar volume() const;
//- Combine fields from all processor domains into single field
void combineFields(scalarField& field);
//- Filter field according to cellIds
tmp<scalarField> filterField(const scalarField& field) const;
//- Output file header information
void writeFileHeader(const label i = 0);
public:
//- Runtime type information
TypeName("sizeDistribution");
// Constructors
//- Construct from Time and dictionary
sizeDistribution
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~sizeDistribution();
// Member Functions
//- Return the reference to the construction dictionary
const dictionary& dict() const
{
return dict_;
}
//- Return the local list of cell IDs
const labelList& cellId() const
{
return cellId_;
}
//- Helper function to return the reference to the mesh
const fvMesh& mesh() const
{
return refCast<const fvMesh>(obr_);
}
//- Read from dictionary
virtual bool read(const dictionary& dict);
//- Execute
virtual bool execute();
//- Write
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //