ENH: fieldStatistics: New function object for statistics of input fields
Summary
This update introduces a new function object, fieldStatistics, which is expected to replace the fieldMinMax function object in future releases.
Details of new models
A typical example of the new keywords is as follows:
fieldStatistics
{
// Mandatory entries
type fieldStatistics;
libs (fieldFunctionObjects);
fields (p U k Co);
statistics (mean variance min max);
// Optional entries
mode magnitude; // component;
mean arithmetic; // volumetric;
extrema true;
internal false;
// Inherited entries
writePrecision 8;
writeToFile true;
useUserTime true;
region region0;
enabled true;
log true;
timeStart 0;
timeEnd 1000;
executeControl timeStep;
executeInterval 1;
writeControl writeTime;
writeInterval 1;
}
The following functionalities can be highlighted:
- The
fieldMinMaxfunctionality, i.e. providing the extrema values of the input fields and their metadata, can be reproduced by the optional bool keywordextrema. - The internal fields, i.e. excluding the boundary fields, are handled by the optional bool keyword
internal. - Two different averaging routines can be chosen, i.e.
arithmeticandvolumetric, by the keywordmean. - Four statistics of the input fields can be calculated:
- Central-tendency statistics:
mean. - Dispersion statistics:
variance,min,max.
- Central-tendency statistics:
- The statistics are output to a file per input field and to the standard stream with uniform delimiter.
Risks
- When using
mode=magnitude, thefieldStatisticsfunction object (FO) calculates the statistics of the magnitude of the input fields, rather than the magnitude of the statistics of the input fields. The effect ofmode=magnitudein thefieldMinMaxFO differs in thatmode=magnitudeandmode=componentbehave identically for scalar fields.- For example, in a scalar field with two values, -1 and 1, the
fieldMinMaxFO with eithermode=magnitudeormode=componentproducesmin=-1. This happens because, for scalar fields, the mode is always treated ascomponent, even ifmode=magnitudeis input. - However, in
fieldStatistics's backward-compatibility forfieldMinMaxby setting theextrema=true, this behavior is different:- With
mode=magnitude, the minimum value is computed asmin=1. - With
mode=component, the minimum value is computed asmin=-1for the scalar field.
- With
- For example, in a scalar field with two values, -1 and 1, the
- Unlike the
fieldMinMax, thefieldStatistics's backward-compatibility forfieldMinMaxoutputs the extrema data per field, rather than a single file for all fields. - Stable algorithms for the calculation of
varianceneed to be investigated.
Edited by Kutalmış Berçin