reactingEulerFoam: sizeDistribution: Naming conventions

The keyword which selects how the subset over which the function
operates is generated has been renamed to "selectionMode", to make it
more consistent with other parts of the OpenFOAM (e.g., fvOptions). It
can still take the value "all" or "cellZone". A cell zone is now
specified with a "cellZone", again for consistency.

Error messaging has also been overhauled.

Patch contributed by Institute of Fluid Dynamics,
Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
This commit is contained in:
Will Bainbridge
2019-02-01 14:24:33 +00:00
parent 860a40d237
commit 756d10c37c
10 changed files with 59 additions and 52 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,7 @@ template<>
const char* const char*
Foam::NamedEnum Foam::NamedEnum
< <
Foam::functionObjects::sizeDistribution::regionTypes, Foam::functionObjects::sizeDistribution::selectionModeTypes,
2 2
>::names[] = {"cellZone", "all"}; >::names[] = {"cellZone", "all"};
@ -70,9 +70,9 @@ Foam::NamedEnum
const Foam::NamedEnum const Foam::NamedEnum
< <
Foam::functionObjects::sizeDistribution::regionTypes, Foam::functionObjects::sizeDistribution::selectionModeTypes,
2 2
> Foam::functionObjects::sizeDistribution::regionTypeNames_; > Foam::functionObjects::sizeDistribution::selectionModeTypeNames_;
const Foam::NamedEnum const Foam::NamedEnum
< <
@ -118,9 +118,9 @@ void Foam::functionObjects::sizeDistribution::initialise
default: default:
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown function type. Valid function types are:" << "Unknown functionType. Valid types are:"
<< functionTypeNames_ << nl << exit(FatalError); << functionTypeNames_ << nl << exit(FatalIOError);
} }
} }
@ -138,9 +138,9 @@ void Foam::functionObjects::sizeDistribution::initialise
default: default:
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< "Unknown abszissa type. Valid abszissa types are:" << "Unknown abszissaType. Valid types are:"
<< abszissaTypeNames_ << nl << exit(FatalError); << abszissaTypeNames_ << nl << exit(FatalIOError);
} }
} }
@ -148,16 +148,18 @@ void Foam::functionObjects::sizeDistribution::initialise
if (nCells_ == 0) if (nCells_ == 0)
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict)
<< type() << " " << name() << ": " << type() << " " << name() << ": "
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl << selectionModeTypeNames_[selectionModeType_]
<< " Region has no cells" << exit(FatalError); << "(" << selectionModeTypeName_ << "):" << nl
<< " Selection has no cells" << exit(FatalIOError);
} }
volume_ = volume(); volume_ = volume();
Info<< type() << " " << name() << ":" Info<< type() << " " << name() << ":"
<< regionTypeNames_[regionType_] << "(" << regionName_ << "):" << nl << selectionModeTypeNames_[selectionModeType_]
<< "(" << selectionModeTypeName_ << "):" << nl
<< " total cells = " << nCells_ << nl << " total cells = " << nCells_ << nl
<< " total volume = " << volume_ << " total volume = " << volume_
<< nl << endl; << nl << endl;
@ -166,20 +168,22 @@ void Foam::functionObjects::sizeDistribution::initialise
void Foam::functionObjects::sizeDistribution::setCellZoneCells() void Foam::functionObjects::sizeDistribution::setCellZoneCells()
{ {
switch (regionType_) switch (selectionModeType_)
{ {
case rtCellZone: case rtCellZone:
{ {
dict().lookup("name") >> regionName_; dict().lookup("cellZone") >> selectionModeTypeName_;
label zoneId = mesh().cellZones().findZoneID(regionName_); label zoneId =
mesh().cellZones().findZoneID(selectionModeTypeName_);
if (zoneId < 0) if (zoneId < 0)
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict_)
<< "Unknown cell zone name: " << regionName_ << "Unknown cellZone name: " << selectionModeTypeName_
<< ". Valid cell zones are: " << mesh().cellZones().names() << ". Valid cellZone names are: "
<< nl << exit(FatalError); << mesh().cellZones().names()
<< nl << exit(FatalIOError);
} }
cellId_ = mesh().cellZones()[zoneId]; cellId_ = mesh().cellZones()[zoneId];
@ -196,9 +200,9 @@ void Foam::functionObjects::sizeDistribution::setCellZoneCells()
default: default:
{ {
FatalErrorInFunction FatalIOErrorInFunction(dict_)
<< "Unknown region type. Valid region types are:" << "Unknown selectionMode type. Valid selectionMode types are:"
<< regionTypeNames_ << nl << exit(FatalError); << selectionModeTypeNames_ << nl << exit(FatalIOError);
} }
} }
} }
@ -345,8 +349,11 @@ Foam::functionObjects::sizeDistribution::sizeDistribution
fvMeshFunctionObject(name, runTime, dict), fvMeshFunctionObject(name, runTime, dict),
logFiles(obr_, name), logFiles(obr_, name),
dict_(dict), dict_(dict),
regionType_(regionTypeNames_.read(dict.lookup("regionType"))), selectionModeType_
regionName_(word::null), (
selectionModeTypeNames_.read(dict.lookup("selectionMode"))
),
selectionModeTypeName_(word::null),
functionType_(functionTypeNames_.read(dict.lookup("functionType"))), functionType_(functionTypeNames_.read(dict.lookup("functionType"))),
abszissaType_(abszissaTypeNames_.read(dict.lookup("abszissaType"))), abszissaType_(abszissaTypeNames_.read(dict.lookup("abszissaType"))),
nCells_(0), nCells_(0),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation \\ / A nd | Copyright (C) 2017-2019 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ Description
... ...
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalanceModel bubbles; populationBalanceModel bubbles;
normalize true; normalize true;
} }
@ -57,8 +57,8 @@ Usage
moments | yes | moments | yes |
abszissaType | volume, diameter | yes | abszissaType | volume, diameter | yes |
momentOrder | Write moment up to given order | no | 0 momentOrder | Write moment up to given order | no | 0
regionType | Evaluate for cellZone or entire mesh | yes | selectionMode | Evaluate for cellZone or entire mesh | yes |
cellZoneName | Required if regionType is cellZone | | cellZone | Required if selectionMode is cellZone | |
populationBalanceModel | Respective populationBalanceModel | yes | populationBalanceModel | Respective populationBalanceModel | yes |
normalize | Normalization | no | normalize | Normalization | no |
\endtable \endtable
@ -106,15 +106,15 @@ public:
// Public data types // Public data types
//- Region type enumeration //- Selection mode type enumeration
enum regionTypes enum selectionModeTypes
{ {
rtCellZone, rtCellZone,
rtAll rtAll
}; };
//- Region type names //- Selection mode type names
static const NamedEnum<regionTypes, 2> regionTypeNames_; static const NamedEnum<selectionModeTypes, 2> selectionModeTypeNames_;
//- Function type enumeration //- Function type enumeration
@ -148,11 +148,11 @@ protected:
//- Construction dictionary //- Construction dictionary
dictionary dict_; dictionary dict_;
//- Region type //- Selection mode type
regionTypes regionType_; selectionModeTypes selectionModeType_;
//- Name of region //- Name of selection
word regionName_; word selectionModeTypeName_;
//- Function type //- Function type
functionTypes functionType_; functionTypes functionType_;
@ -166,7 +166,7 @@ protected:
//- Local list of cell IDs //- Local list of cell IDs
labelList cellId_; labelList cellId_;
//- Total volume of the evaluated region //- Total volume of the evaluated selection
scalar volume_; scalar volume_;
//- Optionally write the volume of the sizeDistribution //- Optionally write the volume of the sizeDistribution

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType diameter; abszissaType diameter;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
normalize true; normalize true;
} }
@ -80,7 +80,7 @@ functions
functionType volumeDensity; functionType volumeDensity;
abszissaType diameter; abszissaType diameter;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
normalize true; normalize true;
} }

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
@ -80,7 +80,7 @@ functions
functionType moments; functionType moments;
momentOrder 2; momentOrder 2;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -64,7 +64,7 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
@ -80,7 +80,7 @@ functions
functionType moments; functionType moments;
momentOrder 2; momentOrder 2;
abszissaType volume; abszissaType volume;
regionType all; selectionMode all;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -115,8 +115,8 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType diameter; abszissaType diameter;
regionType cellZone; selectionMode cellZone;
name zone; cellZone zone;
populationBalance bubbles; populationBalance bubbles;
} }
} }

View File

@ -101,8 +101,8 @@ functions
functionType numberDensity; functionType numberDensity;
abszissaType diameter; abszissaType diameter;
regionType cellZone; selectionMode cellZone;
name zone; cellZone zone;
populationBalance bubbles; populationBalance bubbles;
} }
} }