mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added coefficient of variance (CoV) operation to fieldValues function objects
This commit is contained in:
@ -134,6 +134,25 @@ Type Foam::fieldValues::faceSource::processValues
|
||||
result = max(values);
|
||||
break;
|
||||
}
|
||||
case opCoV:
|
||||
{
|
||||
Type meanValue = sum(values*magSf)/sum(magSf);
|
||||
|
||||
const label nComp = pTraits<Type>::nComponents;
|
||||
|
||||
for (direction d=0; d<nComp; ++d)
|
||||
{
|
||||
scalarField vals(values.component(d));
|
||||
scalar mean = component(meanValue, d);
|
||||
scalar& res = setComponent(result, d);
|
||||
|
||||
res =
|
||||
sqrt(sum(magSf*sqr(vals - mean))/(magSf.size()*sum(magSf)))
|
||||
/mean;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// Do nothing
|
||||
|
||||
Reference in New Issue
Block a user