functionObject::surfaceFieldValue: Added support for weighting with negative fields

For example this allows the an inlet flux to be used to create a weighted
average.

Resolves bug-report https://bugs.openfoam.org/view.php?id=3384
This commit is contained in:
Henry Weller
2019-11-11 12:20:35 +00:00
parent 263a22a67b
commit a5c33c5e18

View File

@ -153,6 +153,7 @@ processSameTypeValues
{
if (weightField.size())
{
Info << weightField << endl;
result = sum(weightField*values);
}
else
@ -197,7 +198,9 @@ processSameTypeValues
{
if (weightField.size())
{
result = sum(weightField*values)/max(sum(weightField), vSmall);
result =
sum(weightField*values)
/stabilise(sum(weightField), vSmall);
}
else
{
@ -220,7 +223,7 @@ processSameTypeValues
{
result =
sum(weightField*magSf*values)
/max(sum(magSf*weightField), vSmall);
/stabilise(sum(magSf*weightField), vSmall);
}
else
{