functionObjects: Rationalised use of enumerations by using the C++11 scoped form
This commit is contained in:
@ -60,7 +60,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem()
|
|||||||
meanFieldName_("unknown"),
|
meanFieldName_("unknown"),
|
||||||
prime2Mean_(0),
|
prime2Mean_(0),
|
||||||
prime2MeanFieldName_("unknown"),
|
prime2MeanFieldName_("unknown"),
|
||||||
base_(ITER),
|
base_(baseType::iter),
|
||||||
window_(-1.0),
|
window_(-1.0),
|
||||||
windowName_("")
|
windowName_("")
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -89,10 +89,10 @@ public:
|
|||||||
static const word EXT_PRIME2MEAN;
|
static const word EXT_PRIME2MEAN;
|
||||||
|
|
||||||
//- Enumeration defining the averaging base type
|
//- Enumeration defining the averaging base type
|
||||||
enum baseType
|
enum class baseType
|
||||||
{
|
{
|
||||||
ITER,
|
iter,
|
||||||
TIME
|
time
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -198,16 +198,16 @@ public:
|
|||||||
return baseTypeNames_[base_];
|
return baseTypeNames_[base_];
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if base is ITER
|
//- Return true if base is iter
|
||||||
Switch iterBase() const
|
Switch iterBase() const
|
||||||
{
|
{
|
||||||
return base_ == ITER;
|
return base_ == baseType::iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return true if base is time
|
//- Return true if base is time
|
||||||
Switch timeBase() const
|
Switch timeBase() const
|
||||||
{
|
{
|
||||||
return base_ == TIME;
|
return base_ == baseType::time;
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar window() const
|
scalar window() const
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Foam::functionObjects::fieldAverageItem::fieldAverageItem(Istream& is)
|
|||||||
meanFieldName_("unknown"),
|
meanFieldName_("unknown"),
|
||||||
prime2Mean_(0),
|
prime2Mean_(0),
|
||||||
prime2MeanFieldName_("unknown"),
|
prime2MeanFieldName_("unknown"),
|
||||||
base_(ITER),
|
base_(baseType::iter),
|
||||||
window_(-1.0)
|
window_(-1.0)
|
||||||
{
|
{
|
||||||
is.check
|
is.check
|
||||||
|
|||||||
@ -106,7 +106,7 @@ Foam::functionObjects::fieldMinMax::fieldMinMax
|
|||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
logFiles(obr_, name),
|
logFiles(obr_, name),
|
||||||
location_(true),
|
location_(true),
|
||||||
mode_(mdMag),
|
mode_(modeType::mag),
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -150,7 +150,7 @@ bool Foam::functionObjects::fieldMinMax::write()
|
|||||||
|
|
||||||
forAll(fieldSet_, fieldi)
|
forAll(fieldSet_, fieldi)
|
||||||
{
|
{
|
||||||
calcMinMaxFields<scalar>(fieldSet_[fieldi], mdCmpt);
|
calcMinMaxFields<scalar>(fieldSet_[fieldi], modeType::cmpt);
|
||||||
calcMinMaxFields<vector>(fieldSet_[fieldi], mode_);
|
calcMinMaxFields<vector>(fieldSet_[fieldi], mode_);
|
||||||
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldi], mode_);
|
calcMinMaxFields<sphericalTensor>(fieldSet_[fieldi], mode_);
|
||||||
calcMinMaxFields<symmTensor>(fieldSet_[fieldi], mode_);
|
calcMinMaxFields<symmTensor>(fieldSet_[fieldi], mode_);
|
||||||
|
|||||||
@ -97,10 +97,10 @@ class fieldMinMax
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum modeType
|
enum class modeType
|
||||||
{
|
{
|
||||||
mdMag,
|
mag,
|
||||||
mdCmpt
|
cmpt
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -119,7 +119,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
|||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case mdMag:
|
case modeType::mag:
|
||||||
{
|
{
|
||||||
const volScalarField magField(mag(field));
|
const volScalarField magField(mag(field));
|
||||||
const volScalarField::Boundary& magFieldBoundary =
|
const volScalarField::Boundary& magFieldBoundary =
|
||||||
@ -205,7 +205,7 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mdCmpt:
|
case modeType::cmpt:
|
||||||
{
|
{
|
||||||
const typename fieldType::Boundary&
|
const typename fieldType::Boundary&
|
||||||
fieldBoundary = field.boundaryField();
|
fieldBoundary = field.boundaryField();
|
||||||
|
|||||||
@ -108,7 +108,7 @@ Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
|||||||
:
|
:
|
||||||
regionFunctionObject(name, runTime, dict),
|
regionFunctionObject(name, runTime, dict),
|
||||||
logFiles(obr_, name),
|
logFiles(obr_, name),
|
||||||
operation_(opSubtract),
|
operation_(operationType::subtract),
|
||||||
region1Ptr_(nullptr),
|
region1Ptr_(nullptr),
|
||||||
region2Ptr_(nullptr)
|
region2Ptr_(nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -100,13 +100,13 @@ class fieldValueDelta
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
enum operationType
|
enum class operationType
|
||||||
{
|
{
|
||||||
opAdd,
|
add,
|
||||||
opSubtract,
|
subtract,
|
||||||
opMin,
|
min,
|
||||||
opMax,
|
max,
|
||||||
opAverage
|
average
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
|
|||||||
@ -40,27 +40,27 @@ Type Foam::functionObjects::fieldValues::fieldValueDelta::applyOperation
|
|||||||
|
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
case opAdd:
|
case operationType::add:
|
||||||
{
|
{
|
||||||
result = value1 + value2;
|
result = value1 + value2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSubtract:
|
case operationType::subtract:
|
||||||
{
|
{
|
||||||
result = value1 - value2;
|
result = value1 - value2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMin:
|
case operationType::min:
|
||||||
{
|
{
|
||||||
result = min(value1, value2);
|
result = min(value1, value2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMax:
|
case operationType::max:
|
||||||
{
|
{
|
||||||
result = max(value1, value2);
|
result = max(value1, value2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAverage:
|
case operationType::average:
|
||||||
{
|
{
|
||||||
result = 0.5*(value1 + value2);
|
result = 0.5*(value1 + value2);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -430,17 +430,17 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
|
|
||||||
switch (regionType_)
|
switch (regionType_)
|
||||||
{
|
{
|
||||||
case stFaceZone:
|
case regionTypes::faceZone:
|
||||||
{
|
{
|
||||||
setFaceZoneFaces();
|
setFaceZoneFaces();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stPatch:
|
case regionTypes::patch:
|
||||||
{
|
{
|
||||||
setPatchFaces();
|
setPatchFaces();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stSampledSurface:
|
case regionTypes::sampledSurface:
|
||||||
{
|
{
|
||||||
sampledSurfaceFaces(dict);
|
sampledSurfaceFaces(dict);
|
||||||
break;
|
break;
|
||||||
@ -480,7 +480,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
{
|
{
|
||||||
Info<< " weight field = " << weightFieldName_ << nl;
|
Info<< " weight field = " << weightFieldName_ << nl;
|
||||||
|
|
||||||
if (regionType_ == stSampledSurface)
|
if (regionType_ == regionTypes::sampledSurface)
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
FatalIOErrorInFunction(dict)
|
||||||
<< "Cannot use weightField for a sampledSurface"
|
<< "Cannot use weightField for a sampledSurface"
|
||||||
@ -541,7 +541,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::writeFileHeader
|
|||||||
const label i
|
const label i
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (operation_ != opNone)
|
if (operation_ != operationType::none)
|
||||||
{
|
{
|
||||||
writeCommented(file(), "Region type : ");
|
writeCommented(file(), "Region type : ");
|
||||||
file() << regionTypeNames_[regionType_] << " " << regionName_ << endl;
|
file() << regionTypeNames_[regionType_] << " " << regionName_ << endl;
|
||||||
@ -579,12 +579,12 @@ processValues
|
|||||||
{
|
{
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
case opSumDirection:
|
case operationType::sumDirection:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
return sum(pos0(values*(Sf & n))*mag(values));
|
return sum(pos0(values*(Sf & n))*mag(values));
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case operationType::sumDirectionBalance:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
const scalarField nv(values*(Sf & n));
|
const scalarField nv(values*(Sf & n));
|
||||||
@ -611,7 +611,7 @@ processValues
|
|||||||
{
|
{
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
case opSumDirection:
|
case operationType::sumDirection:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
n /= mag(n) + rootVSmall;
|
n /= mag(n) + rootVSmall;
|
||||||
@ -619,7 +619,7 @@ processValues
|
|||||||
|
|
||||||
return sum(pos0(nv)*n*(nv));
|
return sum(pos0(nv)*n*(nv));
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case operationType::sumDirectionBalance:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
n /= mag(n) + rootVSmall;
|
n /= mag(n) + rootVSmall;
|
||||||
@ -627,12 +627,12 @@ processValues
|
|||||||
|
|
||||||
return sum(pos0(nv)*n*(nv));
|
return sum(pos0(nv)*n*(nv));
|
||||||
}
|
}
|
||||||
case opAreaNormalAverage:
|
case operationType::areaNormalAverage:
|
||||||
{
|
{
|
||||||
scalar result = sum(values & Sf)/sum(mag(Sf));
|
scalar result = sum(values & Sf)/sum(mag(Sf));
|
||||||
return vector(result, 0.0, 0.0);
|
return vector(result, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
case opAreaNormalIntegrate:
|
case operationType::areaNormalIntegrate:
|
||||||
{
|
{
|
||||||
scalar result = sum(values & Sf);
|
scalar result = sum(values & Sf);
|
||||||
return vector(result, 0.0, 0.0);
|
return vector(result, 0.0, 0.0);
|
||||||
@ -719,7 +719,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
|||||||
|
|
||||||
bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
||||||
{
|
{
|
||||||
if (operation_ != opNone)
|
if (operation_ != operationType::none)
|
||||||
{
|
{
|
||||||
fieldValue::write();
|
fieldValue::write();
|
||||||
}
|
}
|
||||||
@ -729,7 +729,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
|||||||
surfacePtr_().update();
|
surfacePtr_().update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != operationType::none && Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file());
|
writeTime(file());
|
||||||
}
|
}
|
||||||
@ -737,7 +737,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
|||||||
if (writeArea_)
|
if (writeArea_)
|
||||||
{
|
{
|
||||||
totalArea_ = totalArea();
|
totalArea_ = totalArea();
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != operationType::none && Pstream::master())
|
||||||
{
|
{
|
||||||
file() << tab << totalArea_;
|
file() << tab << totalArea_;
|
||||||
}
|
}
|
||||||
@ -811,7 +811,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != operationType::none && Pstream::master())
|
||||||
{
|
{
|
||||||
file() << endl;
|
file() << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,11 +192,11 @@ public:
|
|||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- region type enumeration
|
//- region type enumeration
|
||||||
enum regionTypes
|
enum class regionTypes
|
||||||
{
|
{
|
||||||
stFaceZone,
|
faceZone,
|
||||||
stPatch,
|
patch,
|
||||||
stSampledSurface
|
sampledSurface
|
||||||
};
|
};
|
||||||
|
|
||||||
//- region type names
|
//- region type names
|
||||||
@ -204,25 +204,25 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
enum operationType
|
enum class operationType
|
||||||
{
|
{
|
||||||
opNone,
|
none,
|
||||||
opSum,
|
sum,
|
||||||
opWeightedSum,
|
weightedSum,
|
||||||
opSumMag,
|
sumMag,
|
||||||
opSumDirection,
|
sumDirection,
|
||||||
opSumDirectionBalance,
|
sumDirectionBalance,
|
||||||
opAverage,
|
average,
|
||||||
opWeightedAverage,
|
weightedAverage,
|
||||||
opAreaAverage,
|
areaAverage,
|
||||||
opWeightedAreaAverage,
|
weightedAreaAverage,
|
||||||
opAreaIntegrate,
|
areaIntegrate,
|
||||||
opWeightedAreaIntegrate,
|
weightedAreaIntegrate,
|
||||||
opMin,
|
min,
|
||||||
opMax,
|
max,
|
||||||
opCoV,
|
CoV,
|
||||||
opAreaNormalAverage,
|
areaNormalAverage,
|
||||||
opAreaNormalIntegrate
|
areaNormalIntegrate
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
|
|||||||
@ -41,7 +41,11 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
|
|||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
|
||||||
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
if
|
||||||
|
(
|
||||||
|
regionType_ != regionTypes::sampledSurface
|
||||||
|
&& obr_.foundObject<sf>(fieldName)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -66,7 +70,11 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
|||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
|
||||||
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
if
|
||||||
|
(
|
||||||
|
regionType_ != regionTypes::sampledSurface
|
||||||
|
&& obr_.foundObject<sf>(fieldName)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<sf>(fieldName), applyOrientation);
|
return filterField(obr_.lookupObject<sf>(fieldName), applyOrientation);
|
||||||
}
|
}
|
||||||
@ -136,12 +144,12 @@ processSameTypeValues
|
|||||||
Type result = Zero;
|
Type result = Zero;
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
case opSum:
|
case operationType::sum:
|
||||||
{
|
{
|
||||||
result = sum(values);
|
result = sum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedSum:
|
case operationType::weightedSum:
|
||||||
{
|
{
|
||||||
if (weightField.size())
|
if (weightField.size())
|
||||||
{
|
{
|
||||||
@ -153,12 +161,12 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSumMag:
|
case operationType::sumMag:
|
||||||
{
|
{
|
||||||
result = sum(cmptMag(values));
|
result = sum(cmptMag(values));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSumDirection:
|
case operationType::sumDirection:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Operation " << operationTypeNames_[operation_]
|
<< "Operation " << operationTypeNames_[operation_]
|
||||||
@ -169,7 +177,7 @@ processSameTypeValues
|
|||||||
result = Zero;
|
result = Zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case operationType::sumDirectionBalance:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Operation " << operationTypeNames_[operation_]
|
<< "Operation " << operationTypeNames_[operation_]
|
||||||
@ -180,12 +188,12 @@ processSameTypeValues
|
|||||||
result = Zero;
|
result = Zero;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAverage:
|
case operationType::average:
|
||||||
{
|
{
|
||||||
result = sum(values)/values.size();
|
result = sum(values)/values.size();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAverage:
|
case operationType::weightedAverage:
|
||||||
{
|
{
|
||||||
if (weightField.size())
|
if (weightField.size())
|
||||||
{
|
{
|
||||||
@ -197,14 +205,14 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaAverage:
|
case operationType::areaAverage:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
result = sum(magSf*values)/sum(magSf);
|
result = sum(magSf*values)/sum(magSf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAreaAverage:
|
case operationType::weightedAreaAverage:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
@ -218,14 +226,14 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaIntegrate:
|
case operationType::areaIntegrate:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
result = sum(magSf*values);
|
result = sum(magSf*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAreaIntegrate:
|
case operationType::weightedAreaIntegrate:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
@ -239,17 +247,17 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMin:
|
case operationType::min:
|
||||||
{
|
{
|
||||||
result = min(values);
|
result = min(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMax:
|
case operationType::max:
|
||||||
{
|
{
|
||||||
result = max(values);
|
result = max(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opCoV:
|
case operationType::CoV:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
@ -268,11 +276,11 @@ processSameTypeValues
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaNormalAverage:
|
case operationType::areaNormalAverage:
|
||||||
{}
|
{}
|
||||||
case opAreaNormalIntegrate:
|
case operationType::areaNormalIntegrate:
|
||||||
{}
|
{}
|
||||||
case opNone:
|
case operationType::none:
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +363,7 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation_ != opNone)
|
if (operation_ != operationType::none)
|
||||||
{
|
{
|
||||||
// Apply scale factor
|
// Apply scale factor
|
||||||
values *= scaleFactor_;
|
values *= scaleFactor_;
|
||||||
|
|||||||
@ -131,21 +131,21 @@ public:
|
|||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
enum operationType
|
enum class operationType
|
||||||
{
|
{
|
||||||
opNone,
|
none,
|
||||||
opSum,
|
sum,
|
||||||
opWeightedSum,
|
weightedSum,
|
||||||
opSumMag,
|
sumMag,
|
||||||
opAverage,
|
average,
|
||||||
opWeightedAverage,
|
weightedAverage,
|
||||||
opVolAverage,
|
volAverage,
|
||||||
opWeightedVolAverage,
|
weightedVolAverage,
|
||||||
opVolIntegrate,
|
volIntegrate,
|
||||||
opWeightedVolIntegrate,
|
weightedVolIntegrate,
|
||||||
opMin,
|
min,
|
||||||
opMax,
|
max,
|
||||||
opCoV
|
CoV
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
|
|||||||
@ -82,62 +82,62 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
Type result = Zero;
|
Type result = Zero;
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
case opSum:
|
case operationType::sum:
|
||||||
{
|
{
|
||||||
result = gSum(values);
|
result = gSum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedSum:
|
case operationType::weightedSum:
|
||||||
{
|
{
|
||||||
result = gSum(weightField*values);
|
result = gSum(weightField*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSumMag:
|
case operationType::sumMag:
|
||||||
{
|
{
|
||||||
result = gSum(cmptMag(values));
|
result = gSum(cmptMag(values));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAverage:
|
case operationType::average:
|
||||||
{
|
{
|
||||||
result = gSum(values)/nCells();
|
result = gSum(values)/nCells();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAverage:
|
case operationType::weightedAverage:
|
||||||
{
|
{
|
||||||
result = gSum(weightField*values)/gSum(weightField);
|
result = gSum(weightField*values)/gSum(weightField);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opVolAverage:
|
case operationType::volAverage:
|
||||||
{
|
{
|
||||||
result = gSum(V*values)/this->V();
|
result = gSum(V*values)/this->V();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedVolAverage:
|
case operationType::weightedVolAverage:
|
||||||
{
|
{
|
||||||
result = gSum(weightField*V*values)/gSum(weightField*V);
|
result = gSum(weightField*V*values)/gSum(weightField*V);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opVolIntegrate:
|
case operationType::volIntegrate:
|
||||||
{
|
{
|
||||||
result = gSum(V*values);
|
result = gSum(V*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedVolIntegrate:
|
case operationType::weightedVolIntegrate:
|
||||||
{
|
{
|
||||||
result = gSum(weightField*V*values);
|
result = gSum(weightField*V*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMin:
|
case operationType::min:
|
||||||
{
|
{
|
||||||
result = gMin(values);
|
result = gMin(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMax:
|
case operationType::max:
|
||||||
{
|
{
|
||||||
result = gMax(values);
|
result = gMax(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opCoV:
|
case operationType::CoV:
|
||||||
{
|
{
|
||||||
Type meanValue = gSum(values*V)/this->V();
|
Type meanValue = gSum(values*V)/this->V();
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opNone:
|
case operationType::none:
|
||||||
{}
|
{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,8 +65,8 @@ void Foam::functionObjects::interfaceHeight::writePositions()
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
writeTime(file(HEIGHT_FILE));
|
writeTime(file(fileID::heightFile));
|
||||||
writeTime(file(POSITION_FILE));
|
writeTime(file(fileID::positionFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(locations_, li)
|
forAll(locations_, li)
|
||||||
@ -124,16 +124,16 @@ void Foam::functionObjects::interfaceHeight::writePositions()
|
|||||||
|
|
||||||
const Foam::Omanip<int> w = valueWidth(1);
|
const Foam::Omanip<int> w = valueWidth(1);
|
||||||
|
|
||||||
file(HEIGHT_FILE) << w << hIB << w << hIL;
|
file(fileID::heightFile) << w << hIB << w << hIL;
|
||||||
file(POSITION_FILE) << '(' << w << p.x() << w << p.y()
|
file(fileID::positionFile) << '(' << w << p.x() << w << p.y()
|
||||||
<< valueWidth() << p.z() << ") ";
|
<< valueWidth() << p.z() << ") ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
file(HEIGHT_FILE).endl();
|
file(fileID::heightFile).endl();
|
||||||
file(POSITION_FILE).endl();
|
file(fileID::positionFile).endl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ void Foam::functionObjects::interfaceHeight::writeFileHeader(const label i)
|
|||||||
|
|
||||||
switch (fileID(i))
|
switch (fileID(i))
|
||||||
{
|
{
|
||||||
case HEIGHT_FILE:
|
case fileID::heightFile:
|
||||||
writeHeaderValue
|
writeHeaderValue
|
||||||
(
|
(
|
||||||
file(i),
|
file(i),
|
||||||
@ -168,7 +168,7 @@ void Foam::functionObjects::interfaceHeight::writeFileHeader(const label i)
|
|||||||
"Interface height above the location"
|
"Interface height above the location"
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case POSITION_FILE:
|
case fileID::positionFile:
|
||||||
writeHeaderValue(file(i), "p", "Interface position");
|
writeHeaderValue(file(i), "p", "Interface position");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -180,10 +180,10 @@ void Foam::functionObjects::interfaceHeight::writeFileHeader(const label i)
|
|||||||
{
|
{
|
||||||
switch (fileID(i))
|
switch (fileID(i))
|
||||||
{
|
{
|
||||||
case HEIGHT_FILE:
|
case fileID::heightFile:
|
||||||
file(i) << w << li << w << ' ';
|
file(i) << w << li << w << ' ';
|
||||||
break;
|
break;
|
||||||
case POSITION_FILE:
|
case fileID::positionFile:
|
||||||
file(i) << w << li << w << ' ' << w << ' ' << " ";
|
file(i) << w << li << w << ' ' << w << ' ' << " ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -195,10 +195,10 @@ void Foam::functionObjects::interfaceHeight::writeFileHeader(const label i)
|
|||||||
{
|
{
|
||||||
switch (fileID(i))
|
switch (fileID(i))
|
||||||
{
|
{
|
||||||
case HEIGHT_FILE:
|
case fileID::heightFile:
|
||||||
file(i) << w << "hB" << w << "hL";
|
file(i) << w << "hB" << w << "hL";
|
||||||
break;
|
break;
|
||||||
case POSITION_FILE:
|
case fileID::positionFile:
|
||||||
file(i) << w << "p" << w << ' ' << w << ' ' << " ";
|
file(i) << w << "p" << w << ' ' << w << ' ' << " ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -224,12 +224,7 @@ Foam::functionObjects::interfaceHeight::interfaceHeight
|
|||||||
interpolationScheme_("cellPoint")
|
interpolationScheme_("cellPoint")
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
resetNames({"height", "position"});
|
||||||
wordList names(2);
|
|
||||||
names[HEIGHT_FILE] = "height";
|
|
||||||
names[POSITION_FILE] = "position";
|
|
||||||
|
|
||||||
resetNames(wordList(names));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -104,12 +104,19 @@ class interfaceHeight
|
|||||||
// Private Enumerations
|
// Private Enumerations
|
||||||
|
|
||||||
//- File enumeration
|
//- File enumeration
|
||||||
enum fileID
|
enum class fileID
|
||||||
{
|
{
|
||||||
HEIGHT_FILE = 0,
|
heightFile = 0,
|
||||||
POSITION_FILE = 1
|
positionFile = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using logFiles::file;
|
||||||
|
|
||||||
|
Ostream& file(const fileID fid)
|
||||||
|
{
|
||||||
|
return logFiles::file(label(fid));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@ -266,7 +266,7 @@ void Foam::functionObjects::streamLine::track()
|
|||||||
vvInterp,
|
vvInterp,
|
||||||
UIndex, // index of U in vvInterp
|
UIndex, // index of U in vvInterp
|
||||||
|
|
||||||
trackDirection_ == trackDirection::FORWARD,
|
trackDirection_ == trackDirection::forward,
|
||||||
|
|
||||||
nSubCycle_, // automatic track control:step through cells in steps?
|
nSubCycle_, // automatic track control:step through cells in steps?
|
||||||
trackLength_, // fixed track length
|
trackLength_, // fixed track length
|
||||||
@ -281,14 +281,14 @@ void Foam::functionObjects::streamLine::track()
|
|||||||
const scalar trackTime = Foam::sqrt(great);
|
const scalar trackTime = Foam::sqrt(great);
|
||||||
|
|
||||||
// Track
|
// Track
|
||||||
if (trackDirection_ == trackDirection::BOTH)
|
if (trackDirection_ == trackDirection::both)
|
||||||
{
|
{
|
||||||
initialParticles = particles;
|
initialParticles = particles;
|
||||||
}
|
}
|
||||||
|
|
||||||
particles.move(particles, td, trackTime);
|
particles.move(particles, td, trackTime);
|
||||||
|
|
||||||
if (trackDirection_ == trackDirection::BOTH)
|
if (trackDirection_ == trackDirection::both)
|
||||||
{
|
{
|
||||||
particles.IDLList<streamLineParticle>::operator=(initialParticles);
|
particles.IDLList<streamLineParticle>::operator=(initialParticles);
|
||||||
td.trackForward_ = !td.trackForward_;
|
td.trackForward_ = !td.trackForward_;
|
||||||
@ -347,8 +347,8 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
trackDirection_ =
|
trackDirection_ =
|
||||||
dict.lookupType<bool>("trackForward")
|
dict.lookupType<bool>("trackForward")
|
||||||
? trackDirection::FORWARD
|
? trackDirection::forward
|
||||||
: trackDirection::BACKWARD;
|
: trackDirection::backward;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -136,11 +136,11 @@ public:
|
|||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- Track direction enumerations
|
//- Track direction enumerations
|
||||||
enum trackDirection
|
enum class trackDirection
|
||||||
{
|
{
|
||||||
FORWARD,
|
forward,
|
||||||
BACKWARD,
|
backward,
|
||||||
BOTH
|
both
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Track direction enumeration names
|
//- Track direction enumeration names
|
||||||
|
|||||||
@ -91,34 +91,6 @@ const Foam::NamedEnum
|
|||||||
7
|
7
|
||||||
> Foam::functionObjects::turbulenceFields::incompressibleFieldNames_;
|
> Foam::functionObjects::turbulenceFields::incompressibleFieldNames_;
|
||||||
|
|
||||||
const Foam::word Foam::functionObjects::turbulenceFields::modelName
|
|
||||||
(
|
|
||||||
Foam::turbulenceModel::propertiesName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
bool Foam::functionObjects::turbulenceFields::compressible()
|
|
||||||
{
|
|
||||||
if (obr_.foundObject<compressible::turbulenceModel>(modelName))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (obr_.foundObject<incompressible::turbulenceModel>(modelName))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Turbulence model not found in database, deactivating"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -144,6 +116,12 @@ Foam::functionObjects::turbulenceFields::~turbulenceFields()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word& Foam::functionObjects::turbulenceFields::modelName()
|
||||||
|
{
|
||||||
|
return Foam::turbulenceModel::propertiesName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (dict.found("field"))
|
if (dict.found("field"))
|
||||||
@ -161,7 +139,7 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
|||||||
Info<< "storing fields:" << nl;
|
Info<< "storing fields:" << nl;
|
||||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||||
{
|
{
|
||||||
Info<< " " << modelName << ':' << iter.key() << nl;
|
Info<< " " << modelName() << ':' << iter.key() << nl;
|
||||||
}
|
}
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
@ -176,59 +154,57 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::turbulenceFields::execute()
|
bool Foam::functionObjects::turbulenceFields::execute()
|
||||||
{
|
{
|
||||||
bool comp = compressible();
|
if (obr_.foundObject<compressible::turbulenceModel>(modelName()))
|
||||||
|
|
||||||
if (comp)
|
|
||||||
{
|
{
|
||||||
const compressible::turbulenceModel& model =
|
const compressible::turbulenceModel& model =
|
||||||
obr_.lookupObject<compressible::turbulenceModel>(modelName);
|
obr_.lookupObject<compressible::turbulenceModel>(modelName());
|
||||||
|
|
||||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||||
{
|
{
|
||||||
const word& f = iter.key();
|
const word& f = iter.key();
|
||||||
switch (compressibleFieldNames_[f])
|
switch (compressibleFieldNames_[f])
|
||||||
{
|
{
|
||||||
case cfK:
|
case compressibleField::k:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.k());
|
processField<scalar>(f, model.k());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfEpsilon:
|
case compressibleField::epsilon:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.epsilon());
|
processField<scalar>(f, model.epsilon());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfOmega:
|
case compressibleField::omega:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, omega(model));
|
processField<scalar>(f, omega(model));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfMut:
|
case compressibleField::mut:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.mut());
|
processField<scalar>(f, model.mut());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfMuEff:
|
case compressibleField::muEff:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.muEff());
|
processField<scalar>(f, model.muEff());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfAlphat:
|
case compressibleField::alphat:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.alphat());
|
processField<scalar>(f, model.alphat());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfAlphaEff:
|
case compressibleField::alphaEff:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.alphaEff());
|
processField<scalar>(f, model.alphaEff());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfR:
|
case compressibleField::R:
|
||||||
{
|
{
|
||||||
processField<symmTensor>(f, model.R());
|
processField<symmTensor>(f, model.R());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case cfDevRhoReff:
|
case compressibleField::devRhoReff:
|
||||||
{
|
{
|
||||||
processField<symmTensor>(f, model.devRhoReff());
|
processField<symmTensor>(f, model.devRhoReff());
|
||||||
break;
|
break;
|
||||||
@ -236,52 +212,52 @@ bool Foam::functionObjects::turbulenceFields::execute()
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Invalid field selection" << abort(FatalError);
|
<< "Invalid field selection" << exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (obr_.foundObject<incompressible::turbulenceModel>(modelName()))
|
||||||
{
|
{
|
||||||
const incompressible::turbulenceModel& model =
|
const incompressible::turbulenceModel& model =
|
||||||
obr_.lookupObject<incompressible::turbulenceModel>(modelName);
|
obr_.lookupObject<incompressible::turbulenceModel>(modelName());
|
||||||
|
|
||||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||||
{
|
{
|
||||||
const word& f = iter.key();
|
const word& f = iter.key();
|
||||||
switch (incompressibleFieldNames_[f])
|
switch (incompressibleFieldNames_[f])
|
||||||
{
|
{
|
||||||
case ifK:
|
case incompressibleField::k:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.k());
|
processField<scalar>(f, model.k());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifEpsilon:
|
case incompressibleField::epsilon:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.epsilon());
|
processField<scalar>(f, model.epsilon());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifOmega:
|
case incompressibleField::omega:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, omega(model));
|
processField<scalar>(f, omega(model));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifNut:
|
case incompressibleField::nut:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.nut());
|
processField<scalar>(f, model.nut());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifNuEff:
|
case incompressibleField::nuEff:
|
||||||
{
|
{
|
||||||
processField<scalar>(f, model.nuEff());
|
processField<scalar>(f, model.nuEff());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifR:
|
case incompressibleField::R:
|
||||||
{
|
{
|
||||||
processField<symmTensor>(f, model.R());
|
processField<symmTensor>(f, model.R());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ifDevReff:
|
case incompressibleField::devReff:
|
||||||
{
|
{
|
||||||
processField<symmTensor>(f, model.devReff());
|
processField<symmTensor>(f, model.devReff());
|
||||||
break;
|
break;
|
||||||
@ -289,11 +265,17 @@ bool Foam::functionObjects::turbulenceFields::execute()
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Invalid field selection" << abort(FatalError);
|
<< "Invalid field selection" << exit(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Turbulence model not found in database, deactivating"
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -303,7 +285,7 @@ bool Foam::functionObjects::turbulenceFields::write()
|
|||||||
{
|
{
|
||||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||||
{
|
{
|
||||||
const word fieldName = modelName + ':' + iter.key();
|
const word fieldName = modelName() + ':' + iter.key();
|
||||||
writeObject(fieldName);
|
writeObject(fieldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -106,34 +106,32 @@ class turbulenceFields
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum compressibleField
|
enum class compressibleField
|
||||||
{
|
{
|
||||||
cfK,
|
k,
|
||||||
cfEpsilon,
|
epsilon,
|
||||||
cfOmega,
|
omega,
|
||||||
cfMut,
|
mut,
|
||||||
cfMuEff,
|
muEff,
|
||||||
cfAlphat,
|
alphat,
|
||||||
cfAlphaEff,
|
alphaEff,
|
||||||
cfR,
|
R,
|
||||||
cfDevRhoReff
|
devRhoReff
|
||||||
};
|
};
|
||||||
static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
|
static const NamedEnum<compressibleField, 9> compressibleFieldNames_;
|
||||||
|
|
||||||
enum incompressibleField
|
enum class incompressibleField
|
||||||
{
|
{
|
||||||
ifK,
|
k,
|
||||||
ifEpsilon,
|
epsilon,
|
||||||
ifOmega,
|
omega,
|
||||||
ifNut,
|
nut,
|
||||||
ifNuEff,
|
nuEff,
|
||||||
ifR,
|
R,
|
||||||
ifDevReff
|
devReff
|
||||||
};
|
};
|
||||||
static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
|
static const NamedEnum<incompressibleField, 7> incompressibleFieldNames_;
|
||||||
|
|
||||||
static const word modelName;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -145,8 +143,7 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Return true if compressible turbulence model is identified
|
static const word& modelName();
|
||||||
bool compressible();
|
|
||||||
|
|
||||||
//- Process the turbulence field
|
//- Process the turbulence field
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -36,7 +36,7 @@ void Foam::functionObjects::turbulenceFields::processField
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||||
|
|
||||||
const word scopedName = modelName + ':' + fieldName;
|
const word scopedName = modelName() + ':' + fieldName;
|
||||||
|
|
||||||
if (obr_.foundObject<FieldType>(scopedName))
|
if (obr_.foundObject<FieldType>(scopedName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -44,7 +44,7 @@ void Foam::functionObjects::forceCoeffs::writeFileHeader(const label i)
|
|||||||
{
|
{
|
||||||
switch (fileID(i))
|
switch (fileID(i))
|
||||||
{
|
{
|
||||||
case MAIN_FILE:
|
case fileID::mainFile:
|
||||||
{
|
{
|
||||||
// force coeff data
|
// force coeff data
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ void Foam::functionObjects::forceCoeffs::writeFileHeader(const label i)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BINS_FILE:
|
case fileID::binsFile:
|
||||||
{
|
{
|
||||||
// bin coeff data
|
// bin coeff data
|
||||||
|
|
||||||
@ -217,8 +217,8 @@ bool Foam::functionObjects::forceCoeffs::write()
|
|||||||
scalar Clf = Cl/2.0 + Cm;
|
scalar Clf = Cl/2.0 + Cm;
|
||||||
scalar Clr = Cl/2.0 - Cm;
|
scalar Clr = Cl/2.0 - Cm;
|
||||||
|
|
||||||
writeTime(file(MAIN_FILE));
|
writeTime(file(fileID::mainFile));
|
||||||
file(MAIN_FILE)
|
file(fileID::mainFile)
|
||||||
<< tab << Cm << tab << Cd
|
<< tab << Cm << tab << Cd
|
||||||
<< tab << Cl << tab << Clf << tab << Clr << endl;
|
<< tab << Cl << tab << Clf << tab << Clr << endl;
|
||||||
|
|
||||||
@ -241,17 +241,17 @@ bool Foam::functionObjects::forceCoeffs::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTime(file(BINS_FILE));
|
writeTime(file(fileID::binsFile));
|
||||||
|
|
||||||
forAll(coeffs[0], i)
|
forAll(coeffs[0], i)
|
||||||
{
|
{
|
||||||
file(BINS_FILE)
|
file(fileID::binsFile)
|
||||||
<< tab << coeffs[2][i]
|
<< tab << coeffs[2][i]
|
||||||
<< tab << coeffs[1][i]
|
<< tab << coeffs[1][i]
|
||||||
<< tab << coeffs[0][i];
|
<< tab << coeffs[0][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
file(BINS_FILE) << endl;
|
file(fileID::binsFile) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log << endl;
|
Log << endl;
|
||||||
|
|||||||
@ -54,7 +54,7 @@ Foam::wordList Foam::functionObjects::forces::createFileNames
|
|||||||
|
|
||||||
const word forceType(dict.lookup("type"));
|
const word forceType(dict.lookup("type"));
|
||||||
|
|
||||||
// Name for file(MAIN_FILE=0)
|
// Name for file(fileID::mainFile=0)
|
||||||
names.append(forceType);
|
names.append(forceType);
|
||||||
|
|
||||||
if (dict.found("binData"))
|
if (dict.found("binData"))
|
||||||
@ -63,7 +63,7 @@ Foam::wordList Foam::functionObjects::forces::createFileNames
|
|||||||
label nb = readLabel(binDict.lookup("nBin"));
|
label nb = readLabel(binDict.lookup("nBin"));
|
||||||
if (nb > 0)
|
if (nb > 0)
|
||||||
{
|
{
|
||||||
// Name for file(BINS_FILE=1)
|
// Name for file(fileID::binsFile=1)
|
||||||
names.append(forceType + "_bins");
|
names.append(forceType + "_bins");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ void Foam::functionObjects::forces::writeFileHeader(const label i)
|
|||||||
{
|
{
|
||||||
switch (fileID(i))
|
switch (fileID(i))
|
||||||
{
|
{
|
||||||
case MAIN_FILE:
|
case fileID::mainFile:
|
||||||
{
|
{
|
||||||
// force data
|
// force data
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ void Foam::functionObjects::forces::writeFileHeader(const label i)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BINS_FILE:
|
case fileID::binsFile:
|
||||||
{
|
{
|
||||||
// bin data
|
// bin data
|
||||||
|
|
||||||
@ -423,9 +423,9 @@ void Foam::functionObjects::forces::writeForces()
|
|||||||
<< " porous : " << sum(moment_[2])
|
<< " porous : " << sum(moment_[2])
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
writeTime(file(MAIN_FILE));
|
writeTime(file(fileID::mainFile));
|
||||||
|
|
||||||
file(MAIN_FILE) << tab << setw(1) << '('
|
file(fileID::mainFile) << tab << setw(1) << '('
|
||||||
<< sum(force_[0]) << setw(1) << ' '
|
<< sum(force_[0]) << setw(1) << ' '
|
||||||
<< sum(force_[1]) << setw(1) << ' '
|
<< sum(force_[1]) << setw(1) << ' '
|
||||||
<< sum(force_[2]) << setw(3) << ") ("
|
<< sum(force_[2]) << setw(3) << ") ("
|
||||||
@ -442,7 +442,7 @@ void Foam::functionObjects::forces::writeForces()
|
|||||||
vectorField localMomentT(coordSys_.localVector(moment_[1]));
|
vectorField localMomentT(coordSys_.localVector(moment_[1]));
|
||||||
vectorField localMomentP(coordSys_.localVector(moment_[2]));
|
vectorField localMomentP(coordSys_.localVector(moment_[2]));
|
||||||
|
|
||||||
file(MAIN_FILE) << tab << setw(1) << '('
|
file(fileID::mainFile) << tab << setw(1) << '('
|
||||||
<< sum(localForceN) << setw(1) << ' '
|
<< sum(localForceN) << setw(1) << ' '
|
||||||
<< sum(localForceT) << setw(1) << ' '
|
<< sum(localForceT) << setw(1) << ' '
|
||||||
<< sum(localForceP) << setw(3) << ") ("
|
<< sum(localForceP) << setw(3) << ") ("
|
||||||
@ -451,7 +451,7 @@ void Foam::functionObjects::forces::writeForces()
|
|||||||
<< sum(localMomentP) << setw(1) << ')';
|
<< sum(localMomentP) << setw(1) << ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
file(MAIN_FILE) << endl;
|
file(fileID::mainFile) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,11 +479,11 @@ void Foam::functionObjects::forces::writeBins()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeTime(file(BINS_FILE));
|
writeTime(file(fileID::binsFile));
|
||||||
|
|
||||||
forAll(f[0], i)
|
forAll(f[0], i)
|
||||||
{
|
{
|
||||||
file(BINS_FILE)
|
file(fileID::binsFile)
|
||||||
<< tab << setw(1) << '('
|
<< tab << setw(1) << '('
|
||||||
<< f[0][i] << setw(1) << ' '
|
<< f[0][i] << setw(1) << ' '
|
||||||
<< f[1][i] << setw(1) << ' '
|
<< f[1][i] << setw(1) << ' '
|
||||||
@ -519,7 +519,7 @@ void Foam::functionObjects::forces::writeBins()
|
|||||||
|
|
||||||
forAll(lf[0], i)
|
forAll(lf[0], i)
|
||||||
{
|
{
|
||||||
file(BINS_FILE)
|
file(fileID::binsFile)
|
||||||
<< tab << setw(1) << '('
|
<< tab << setw(1) << '('
|
||||||
<< lf[0][i] << setw(1) << ' '
|
<< lf[0][i] << setw(1) << ' '
|
||||||
<< lf[1][i] << setw(1) << ' '
|
<< lf[1][i] << setw(1) << ' '
|
||||||
@ -530,7 +530,7 @@ void Foam::functionObjects::forces::writeBins()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file(BINS_FILE) << endl;
|
file(fileID::binsFile) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -139,10 +139,10 @@ protected:
|
|||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Enumeration for ensuring the right file is accessed
|
//- Enumeration for ensuring the right file is accessed
|
||||||
enum fileID
|
enum class fileID
|
||||||
{
|
{
|
||||||
MAIN_FILE = 0,
|
mainFile = 0,
|
||||||
BINS_FILE = 1
|
binsFile = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Pressure, viscous and porous force per bin
|
//- Pressure, viscous and porous force per bin
|
||||||
@ -215,6 +215,13 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
using logFiles::file;
|
||||||
|
|
||||||
|
Ostream& file(const fileID fid)
|
||||||
|
{
|
||||||
|
return logFiles::file(label(fid));
|
||||||
|
}
|
||||||
|
|
||||||
//- Create file names for forces and bins
|
//- Create file names for forces and bins
|
||||||
wordList createFileNames(const dictionary& dict) const;
|
wordList createFileNames(const dictionary& dict) const;
|
||||||
|
|
||||||
|
|||||||
@ -94,7 +94,7 @@ Foam::functionObjects::abort::abort
|
|||||||
functionObject(name),
|
functionObject(name),
|
||||||
time_(runTime),
|
time_(runTime),
|
||||||
abortFile_("$FOAM_CASE/" + name),
|
abortFile_("$FOAM_CASE/" + name),
|
||||||
action_(nextWrite)
|
action_(actionType::nextWrite)
|
||||||
{
|
{
|
||||||
abortFile_.expand();
|
abortFile_.expand();
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -120,7 +120,7 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
action_ = nextWrite;
|
action_ = actionType::nextWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.readIfPresent("file", abortFile_))
|
if (dict.readIfPresent("file", abortFile_))
|
||||||
@ -141,7 +141,7 @@ bool Foam::functionObjects::abort::execute()
|
|||||||
{
|
{
|
||||||
switch (action_)
|
switch (action_)
|
||||||
{
|
{
|
||||||
case noWriteNow :
|
case actionType::noWriteNow :
|
||||||
{
|
{
|
||||||
if (time_.stopAt(Time::saNoWriteNow))
|
if (time_.stopAt(Time::saNoWriteNow))
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ bool Foam::functionObjects::abort::execute()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case writeNow :
|
case actionType::writeNow :
|
||||||
{
|
{
|
||||||
if (time_.stopAt(Time::saWriteNow))
|
if (time_.stopAt(Time::saWriteNow))
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ bool Foam::functionObjects::abort::execute()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case nextWrite :
|
case actionType::nextWrite :
|
||||||
{
|
{
|
||||||
if (time_.stopAt(Time::saNextWrite))
|
if (time_.stopAt(Time::saNextWrite))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public:
|
|||||||
// Public data
|
// Public data
|
||||||
|
|
||||||
//- Enumeration defining the type of action
|
//- Enumeration defining the type of action
|
||||||
enum actionType
|
enum class actionType
|
||||||
{
|
{
|
||||||
noWriteNow, //!< stop immediately without writing data
|
noWriteNow, //!< stop immediately without writing data
|
||||||
writeNow, //!< write data and stop immediately
|
writeNow, //!< write data and stop immediately
|
||||||
|
|||||||
@ -73,7 +73,7 @@ void Foam::functionObjects::writeObjects::writeObject
|
|||||||
{
|
{
|
||||||
switch (writeOption_)
|
switch (writeOption_)
|
||||||
{
|
{
|
||||||
case AUTO_WRITE:
|
case writeOption::AUTO_WRITE:
|
||||||
{
|
{
|
||||||
if(obj.writeOpt() != IOobject::AUTO_WRITE)
|
if(obj.writeOpt() != IOobject::AUTO_WRITE)
|
||||||
{
|
{
|
||||||
@ -82,7 +82,7 @@ void Foam::functionObjects::writeObjects::writeObject
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NO_WRITE:
|
case writeOption::NO_WRITE:
|
||||||
{
|
{
|
||||||
if(obj.writeOpt() != IOobject::NO_WRITE)
|
if(obj.writeOpt() != IOobject::NO_WRITE)
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ void Foam::functionObjects::writeObjects::writeObject
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ANY_WRITE:
|
case writeOption::ANY_WRITE:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ Foam::functionObjects::writeObjects::writeObjects
|
|||||||
),
|
),
|
||||||
log
|
log
|
||||||
),
|
),
|
||||||
writeOption_(ANY_WRITE)
|
writeOption_(writeOption::ANY_WRITE)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -174,7 +174,7 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writeOption_ = ANY_WRITE;
|
writeOption_ = writeOption::ANY_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return functionObject::read(dict);
|
return functionObject::read(dict);
|
||||||
|
|||||||
@ -107,7 +107,7 @@ public:
|
|||||||
|
|
||||||
//- Re-enumeration defining the write options, based on the original
|
//- Re-enumeration defining the write options, based on the original
|
||||||
// ones at IOobject::writeOption
|
// ones at IOobject::writeOption
|
||||||
enum writeOption
|
enum class writeOption
|
||||||
{
|
{
|
||||||
AUTO_WRITE,
|
AUTO_WRITE,
|
||||||
NO_WRITE,
|
NO_WRITE,
|
||||||
|
|||||||
Reference in New Issue
Block a user