Skip to main content

histogram

Description

The histogram function object computes the volume-weighted histogram of an input volScalarField.

Operands

OperandTypeLocation
inputvolScalarField$FOAM_CASE/<time>/<inpField>
output filedat$FOAM_CASE/postProcessing/<FO>/<time>/<file>
output field--

The set written contains two columns, the first the volume averaged values, the second the raw bin count.

Usage

Example of the histogram function object by using functions sub-dictionary in system/controlDict file:

histogram1
{
// Mandatory entries (unmodifiable)
type histogram;
libs (fieldFunctionObjects);

// Mandatory (inherited) entries (runtime modifiable)
field p;
nBins 100;
setFormat gnuplot;

// Optional entries (runtime modifiable)
max 5;
min -5;

// Optional (inherited) entries
writePrecision 8;
writeToFile true;
useUserTime true;
region region0;
enabled true;
log true;
timeStart 0;
timeEnd 1000;
executeControl timeStep;
executeInterval 1;
writeControl timeStep;
writeInterval 1;
}

where the entries mean:

PropertyDescriptionTypeRequiredDefault
typeType name: histogramwordyes-
libsLibrary name: fieldFunctionObjectswordyes-
fieldName of operand fieldwordyes-
nBinsNumber of histogram binslabelyes-
setFormatOutput formatwordyes-
maxMaximum value sampledscalarnofieldMax
minminimum value sampledscalarno0.0

The inherited entries are elaborated in:

Usage by the postProcess utility is not available.

Notes on entries

If max is not provided it will use the field's min and max as the bin extremes. If max is provided but not min, it will use 0.

Further information

Tutorial:

Source code:

API:

History: Introduced in version v1606+