functionObjects/.../*FieldValue: Protect against division by zero
Patch contributed by Timo Niemi, VTT. Resolves bug report https://bugs.openfoam.org/view.php?id=3370
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -197,7 +197,7 @@ processSameTypeValues
|
||||
{
|
||||
if (weightField.size())
|
||||
{
|
||||
result = sum(weightField*values)/sum(weightField);
|
||||
result = sum(weightField*values)/max(sum(weightField), vSmall);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -218,7 +218,9 @@ processSameTypeValues
|
||||
|
||||
if (weightField.size())
|
||||
{
|
||||
result = sum(weightField*magSf*values)/sum(magSf*weightField);
|
||||
result =
|
||||
sum(weightField*magSf*values)
|
||||
/max(sum(magSf*weightField), vSmall);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user