mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Re-inistated weighted-average fieldAverage usage
This commit is contained in:
@ -50,12 +50,13 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::fieldValues::cellSource::operationType,
|
Foam::fieldValues::cellSource::operationType,
|
||||||
8
|
9
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
"average",
|
"average",
|
||||||
|
"weightedAverage",
|
||||||
"volAverage",
|
"volAverage",
|
||||||
"volIntegrate",
|
"volIntegrate",
|
||||||
"min",
|
"min",
|
||||||
@ -68,7 +69,7 @@ namespace Foam
|
|||||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
const Foam::NamedEnum<Foam::fieldValues::cellSource::sourceType, 2>
|
||||||
Foam::fieldValues::cellSource::sourceTypeNames_;
|
Foam::fieldValues::cellSource::sourceTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 8>
|
const Foam::NamedEnum<Foam::fieldValues::cellSource::operationType, 9>
|
||||||
Foam::fieldValues::cellSource::operationTypeNames_;
|
Foam::fieldValues::cellSource::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,9 +51,12 @@ Description
|
|||||||
- none
|
- none
|
||||||
- sum
|
- sum
|
||||||
- average
|
- average
|
||||||
|
- weightedAverage
|
||||||
- volAverage
|
- volAverage
|
||||||
- volIntegrate
|
- volIntegrate
|
||||||
- CoV (Coefficient of variation: standard deviation/mean)
|
- CoV (Coefficient of variation: standard deviation/mean)
|
||||||
|
- min
|
||||||
|
- max
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
cellSource.C
|
cellSource.C
|
||||||
@ -105,6 +108,7 @@ public:
|
|||||||
opNone,
|
opNone,
|
||||||
opSum,
|
opSum,
|
||||||
opAverage,
|
opAverage,
|
||||||
|
opWeightedAverage,
|
||||||
opVolAverage,
|
opVolAverage,
|
||||||
opVolIntegrate,
|
opVolIntegrate,
|
||||||
opMin,
|
opMin,
|
||||||
@ -113,7 +117,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 8> operationTypeNames_;
|
static const NamedEnum<operationType, 9> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -169,7 +173,8 @@ protected:
|
|||||||
Type processValues
|
Type processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& V
|
const scalarField& V,
|
||||||
|
const scalarField& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
|
|||||||
@ -78,7 +78,8 @@ template<class Type>
|
|||||||
Type Foam::fieldValues::cellSource::processValues
|
Type Foam::fieldValues::cellSource::processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& V
|
const scalarField& V,
|
||||||
|
const scalarField& weightField
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Type result = pTraits<Type>::zero;
|
Type result = pTraits<Type>::zero;
|
||||||
@ -94,6 +95,11 @@ Type Foam::fieldValues::cellSource::processValues
|
|||||||
result = sum(values)/values.size();
|
result = sum(values)/values.size();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedAverage:
|
||||||
|
{
|
||||||
|
result = sum(values)/sum(weightField);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opVolAverage:
|
case opVolAverage:
|
||||||
{
|
{
|
||||||
result = sum(values*V)/sum(V);
|
result = sum(values*V)/sum(V);
|
||||||
@ -169,7 +175,7 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
Type result = processValues(values, V);
|
Type result = processValues(values, V, weightField);
|
||||||
|
|
||||||
if (valueOutput_)
|
if (valueOutput_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,12 +53,13 @@ namespace Foam
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::fieldValues::faceSource::operationType,
|
Foam::fieldValues::faceSource::operationType,
|
||||||
8
|
9
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
"average",
|
"average",
|
||||||
|
"weightedAverage",
|
||||||
"areaAverage",
|
"areaAverage",
|
||||||
"areaIntegrate",
|
"areaIntegrate",
|
||||||
"min",
|
"min",
|
||||||
@ -72,7 +73,7 @@ namespace Foam
|
|||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
|
||||||
Foam::fieldValues::faceSource::sourceTypeNames_;
|
Foam::fieldValues::faceSource::sourceTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 8>
|
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 9>
|
||||||
Foam::fieldValues::faceSource::operationTypeNames_;
|
Foam::fieldValues::faceSource::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,7 @@ Description
|
|||||||
- none
|
- none
|
||||||
- sum
|
- sum
|
||||||
- average
|
- average
|
||||||
|
- weightedAverage
|
||||||
- areaAverage
|
- areaAverage
|
||||||
- areaIntegrate
|
- areaIntegrate
|
||||||
- min
|
- min
|
||||||
@ -132,6 +133,7 @@ public:
|
|||||||
opNone,
|
opNone,
|
||||||
opSum,
|
opSum,
|
||||||
opAverage,
|
opAverage,
|
||||||
|
opWeightedAverage,
|
||||||
opAreaAverage,
|
opAreaAverage,
|
||||||
opAreaIntegrate,
|
opAreaIntegrate,
|
||||||
opMin,
|
opMin,
|
||||||
@ -140,7 +142,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 8> operationTypeNames_;
|
static const NamedEnum<operationType, 9> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -215,7 +217,8 @@ protected:
|
|||||||
Type processValues
|
Type processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& magSf
|
const scalarField& magSf,
|
||||||
|
const scalarField& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
|
|||||||
@ -97,7 +97,9 @@ template<class Type>
|
|||||||
Type Foam::fieldValues::faceSource::processValues
|
Type Foam::fieldValues::faceSource::processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const scalarField& magSf
|
const scalarField& magSf,
|
||||||
|
const scalarField& weightField
|
||||||
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Type result = pTraits<Type>::zero;
|
Type result = pTraits<Type>::zero;
|
||||||
@ -113,6 +115,11 @@ Type Foam::fieldValues::faceSource::processValues
|
|||||||
result = sum(values)/values.size();
|
result = sum(values)/values.size();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedAverage:
|
||||||
|
{
|
||||||
|
result = sum(values)/sum(weightField);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opAreaAverage:
|
case opAreaAverage:
|
||||||
{
|
{
|
||||||
result = sum(values*magSf)/sum(magSf);
|
result = sum(values*magSf)/sum(magSf);
|
||||||
@ -203,7 +210,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
Type result = processValues(values, magSf);
|
Type result = processValues(values, magSf, weightField);
|
||||||
|
|
||||||
if (valueOutput_)
|
if (valueOutput_)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user