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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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