mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
functionObjects:surfaceFieldValue, volFieldValue: Added weightedSum and weighted[Area|Vol]Integrate
Patch contributed by Timo Niemi, VTT. Resolves patch request https://bugs.openfoam.org/view.php?id=2452
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -65,11 +65,12 @@ template<>
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
15
|
17
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
|
"weightedSum",
|
||||||
"sumMag",
|
"sumMag",
|
||||||
"sumDirection",
|
"sumDirection",
|
||||||
"sumDirectionBalance",
|
"sumDirectionBalance",
|
||||||
@ -78,6 +79,7 @@ const char* Foam::NamedEnum
|
|||||||
"areaAverage",
|
"areaAverage",
|
||||||
"weightedAreaAverage",
|
"weightedAreaAverage",
|
||||||
"areaIntegrate",
|
"areaIntegrate",
|
||||||
|
"weightedAreaIntegrate",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
"CoV",
|
"CoV",
|
||||||
@ -94,7 +96,7 @@ const Foam::NamedEnum
|
|||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
15
|
17
|
||||||
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -116,6 +116,7 @@ Usage
|
|||||||
\plaintable
|
\plaintable
|
||||||
none | no operation
|
none | no operation
|
||||||
sum | sum
|
sum | sum
|
||||||
|
weightedSum | weighted sum
|
||||||
sumMag | sum of component magnitudes
|
sumMag | sum of component magnitudes
|
||||||
sumDirection | sum values which are positive in given direction
|
sumDirection | sum values which are positive in given direction
|
||||||
sumDirectionBalance | sum of balance of values in given direction
|
sumDirectionBalance | sum of balance of values in given direction
|
||||||
@ -124,6 +125,7 @@ Usage
|
|||||||
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
|
||||||
@ -209,6 +211,7 @@ public:
|
|||||||
{
|
{
|
||||||
opNone,
|
opNone,
|
||||||
opSum,
|
opSum,
|
||||||
|
opWeightedSum,
|
||||||
opSumMag,
|
opSumMag,
|
||||||
opSumDirection,
|
opSumDirection,
|
||||||
opSumDirectionBalance,
|
opSumDirectionBalance,
|
||||||
@ -217,6 +220,7 @@ public:
|
|||||||
opAreaAverage,
|
opAreaAverage,
|
||||||
opWeightedAreaAverage,
|
opWeightedAreaAverage,
|
||||||
opAreaIntegrate,
|
opAreaIntegrate,
|
||||||
|
opWeightedAreaIntegrate,
|
||||||
opMin,
|
opMin,
|
||||||
opMax,
|
opMax,
|
||||||
opCoV,
|
opCoV,
|
||||||
@ -225,7 +229,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 15> operationTypeNames_;
|
static const NamedEnum<operationType, 17> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -141,6 +141,18 @@ processSameTypeValues
|
|||||||
result = sum(values);
|
result = sum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedSum:
|
||||||
|
{
|
||||||
|
if (weightField.size())
|
||||||
|
{
|
||||||
|
result = sum(weightField*values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = sum(values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opSumMag:
|
case opSumMag:
|
||||||
{
|
{
|
||||||
result = sum(cmptMag(values));
|
result = sum(cmptMag(values));
|
||||||
@ -213,6 +225,20 @@ processSameTypeValues
|
|||||||
result = sum(magSf*values);
|
result = sum(magSf*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedAreaIntegrate:
|
||||||
|
{
|
||||||
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
|
if (weightField.size())
|
||||||
|
{
|
||||||
|
result = sum(weightField*magSf*values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = sum(magSf*values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opMin:
|
case opMin:
|
||||||
{
|
{
|
||||||
result = min(values);
|
result = min(values);
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -48,17 +48,19 @@ const char*
|
|||||||
Foam::NamedEnum
|
Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
||||||
11
|
13
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
|
"weightedSum",
|
||||||
"sumMag",
|
"sumMag",
|
||||||
"average",
|
"average",
|
||||||
"weightedAverage",
|
"weightedAverage",
|
||||||
"volAverage",
|
"volAverage",
|
||||||
"weightedVolAverage",
|
"weightedVolAverage",
|
||||||
"volIntegrate",
|
"volIntegrate",
|
||||||
|
"weightedVolIntegrate",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
"CoV"
|
"CoV"
|
||||||
@ -67,7 +69,7 @@ Foam::NamedEnum
|
|||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
||||||
11
|
13
|
||||||
> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
|
> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -79,17 +79,19 @@ Usage
|
|||||||
|
|
||||||
The \c operation is one of:
|
The \c operation is one of:
|
||||||
\plaintable
|
\plaintable
|
||||||
none | No operation
|
none | No operation
|
||||||
sum | Sum
|
sum | Sum
|
||||||
sumMag | Sum of component magnitudes
|
weightedSum | Weighted sum
|
||||||
average | Ensemble average
|
sumMag | Sum of component magnitudes
|
||||||
weightedAverage | Weighted average
|
average | Ensemble average
|
||||||
volAverage | Volume weighted average
|
weightedAverage | Weighted average
|
||||||
weightedVolAverage | Weighted volume average
|
volAverage | Volume weighted average
|
||||||
volIntegrate | Volume integral
|
weightedVolAverage | Weighted volume average
|
||||||
min | Minimum
|
volIntegrate | Volume integral
|
||||||
max | Maximum
|
weightedVolIntegrate | Weighted volume integral
|
||||||
CoV | Coefficient of variation: standard deviation/mean
|
min | Minimum
|
||||||
|
max | Maximum
|
||||||
|
CoV | Coefficient of variation: standard deviation/mean
|
||||||
\endplaintable
|
\endplaintable
|
||||||
|
|
||||||
See also
|
See also
|
||||||
@ -136,19 +138,21 @@ public:
|
|||||||
{
|
{
|
||||||
opNone,
|
opNone,
|
||||||
opSum,
|
opSum,
|
||||||
|
opWeightedSum,
|
||||||
opSumMag,
|
opSumMag,
|
||||||
opAverage,
|
opAverage,
|
||||||
opWeightedAverage,
|
opWeightedAverage,
|
||||||
opVolAverage,
|
opVolAverage,
|
||||||
opWeightedVolAverage,
|
opWeightedVolAverage,
|
||||||
opVolIntegrate,
|
opVolIntegrate,
|
||||||
|
opWeightedVolIntegrate,
|
||||||
opMin,
|
opMin,
|
||||||
opMax,
|
opMax,
|
||||||
opCoV
|
opCoV
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 11> operationTypeNames_;
|
static const NamedEnum<operationType, 13> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -158,7 +162,7 @@ protected:
|
|||||||
//- Operation to apply to values
|
//- Operation to apply to values
|
||||||
operationType operation_;
|
operationType operation_;
|
||||||
|
|
||||||
//- Weight field name - only used for opWeightedAverage mode
|
//- Weight field name - only used for weighted modes
|
||||||
word weightFieldName_;
|
word weightFieldName_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -87,6 +87,11 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
result = gSum(values);
|
result = gSum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedSum:
|
||||||
|
{
|
||||||
|
result = gSum(weightField*values);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opSumMag:
|
case opSumMag:
|
||||||
{
|
{
|
||||||
result = gSum(cmptMag(values));
|
result = gSum(cmptMag(values));
|
||||||
@ -117,6 +122,11 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
result = gSum(V*values);
|
result = gSum(V*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedVolIntegrate:
|
||||||
|
{
|
||||||
|
result = gSum(weightField*V*values);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opMin:
|
case opMin:
|
||||||
{
|
{
|
||||||
result = gMin(values);
|
result = gMin(values);
|
||||||
|
|||||||
Reference in New Issue
Block a user