mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add weightedAreaIntegrate operation for surfaceFieldValue
This commit is contained in:
@ -64,7 +64,7 @@ template<>
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
15
|
16
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
@ -77,6 +77,7 @@ const char* Foam::NamedEnum
|
|||||||
"areaAverage",
|
"areaAverage",
|
||||||
"weightedAreaAverage",
|
"weightedAreaAverage",
|
||||||
"areaIntegrate",
|
"areaIntegrate",
|
||||||
|
"weightedAreaIntegrate",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
"CoV",
|
"CoV",
|
||||||
@ -93,7 +94,7 @@ const Foam::NamedEnum
|
|||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
15
|
16
|
||||||
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,14 +109,15 @@ Usage
|
|||||||
sumDirectionBalance | sum of balance of values in given direction
|
sumDirectionBalance | sum of balance of values in given direction
|
||||||
average | ensemble average
|
average | ensemble average
|
||||||
weightedAverage | weighted average
|
weightedAverage | weighted average
|
||||||
areaAverage | area weighted average
|
areaAverage | area-weighted average
|
||||||
weightedAreaAverage | weighted area average
|
weightedAreaAverage | weighted area average
|
||||||
areaIntegrate | area integral
|
areaIntegrate | area integral
|
||||||
|
weightedAreaIntegrate | weighted area integral
|
||||||
min | minimum
|
min | minimum
|
||||||
max | maximum
|
max | maximum
|
||||||
CoV | coefficient of variation: standard deviation/mean
|
CoV | coefficient of variation: standard deviation/mean
|
||||||
areaNormalAverage| area weighted average in face normal direction
|
areaNormalAverage| area-weighted average in face normal direction
|
||||||
areaNormalIntegrate | area weighted integral in face normal directon
|
areaNormalIntegrate | area-weighted integral in face normal directon
|
||||||
\endplaintable
|
\endplaintable
|
||||||
|
|
||||||
Note
|
Note
|
||||||
@ -210,6 +211,7 @@ public:
|
|||||||
opAreaAverage, //!< Area average
|
opAreaAverage, //!< Area average
|
||||||
opWeightedAreaAverage, //!< Weighted area average
|
opWeightedAreaAverage, //!< Weighted area average
|
||||||
opAreaIntegrate, //!< Area integral
|
opAreaIntegrate, //!< Area integral
|
||||||
|
opWeightedAreaIntegrate, //!< Weighted area integral
|
||||||
opMin, //!< Minimum
|
opMin, //!< Minimum
|
||||||
opMax, //!< Maximum
|
opMax, //!< Maximum
|
||||||
opCoV, //!< Coefficient of variation
|
opCoV, //!< Coefficient of variation
|
||||||
@ -218,7 +220,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 15> operationTypeNames_;
|
static const NamedEnum<operationType, 16> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -176,10 +176,9 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
case opWeightedAverage:
|
case opWeightedAverage:
|
||||||
{
|
{
|
||||||
label wSize = returnReduce(weightField.size(), sumOp<label>());
|
if (returnReduce(weightField.size(), sumOp<label>()))
|
||||||
|
|
||||||
if (wSize > 0)
|
|
||||||
{
|
{
|
||||||
|
// has weights
|
||||||
result =
|
result =
|
||||||
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
|
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
@ -192,31 +191,40 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
case opAreaAverage:
|
case opAreaAverage:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField factor(mag(Sf));
|
||||||
|
|
||||||
result = gSum(magSf*values)/gSum(magSf);
|
result = gSum(factor*values)/gSum(factor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAreaAverage:
|
case opWeightedAreaAverage:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField factor
|
||||||
label wSize = returnReduce(weightField.size(), sumOp<label>());
|
(
|
||||||
|
returnReduce(weightField.size(), sumOp<label>()) // has weights
|
||||||
|
? weightField*mag(Sf)
|
||||||
|
: mag(Sf)
|
||||||
|
);
|
||||||
|
|
||||||
if (wSize > 0)
|
result = gSum(factor*values)/gSum(factor);
|
||||||
{
|
|
||||||
result = gSum(weightField*magSf*values)/gSum(magSf*weightField);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = gSum(magSf*values)/gSum(magSf);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaIntegrate:
|
case opAreaIntegrate:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField factor(mag(Sf));
|
||||||
|
|
||||||
result = gSum(magSf*values);
|
result = gSum(factor*values);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case opWeightedAreaIntegrate:
|
||||||
|
{
|
||||||
|
const scalarField factor
|
||||||
|
(
|
||||||
|
returnReduce(weightField.size(), sumOp<label>()) // has weights
|
||||||
|
? weightField*mag(Sf)
|
||||||
|
: mag(Sf)
|
||||||
|
);
|
||||||
|
|
||||||
|
result = gSum(factor*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opMin:
|
case opMin:
|
||||||
|
|||||||
Reference in New Issue
Block a user