Loading...
Searching...
No Matches
histogram.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016 OpenFOAM Foundation
9 Copyright (C) 2017-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::histogram
29
30Group
31 grpFieldFunctionObjects
32
33Description
34 Computes the volume-weighted histogram of an input \c volScalarField.
35
36 Operands:
37 \table
38 Operand | Type | Location
39 input | volScalarField | <time>/inputField
40 output file | dat | postProcessing/<FO>/<time>/histogram
41 output field | - | -
42 \endtable
43
44 The data written contains four columns (from left to right):
45 - time
46 - mid-point of histogram bin
47 - histogram counts - number of samples in each bin
48 - volume-weighted histogram values
49
50Usage
51 Minimal example by using \c system/controlDict.functions:
52 \verbatim
53 histogramFO
54 {
55 // Mandatory entries
56 type histogram;
57 libs (fieldFunctionObjects);
58 field <word>;
59 model <word>;
60
61 // Conditional entries
62
63 // Option-1: when model == equalBinWidth
64
65 // Option-2: when model == unequalBinWidth
66
67 // Inherited entries
68 ...
69 }
70 \endverbatim
71
72 where the entries mean:
73 \table
74 Property | Description | Type | Reqd | Deflt
75 type | Type name: histogram | word | yes | -
76 libs | Library name: fieldFunctionObjects | word | yes | -
77 field | Name of operand field | word | yes | -
78 model | Name of the histogram model | word | yes | -
79 \endtable
80
81 Options for the \c model entry:
82 \verbatim
83 equalBinWidth | Use equal-bin width
84 unequalBinWidth | Use unequal-bin widths
85 \endverbatim
86
87 The inherited entries are elaborated in:
88 - \link functionObject.H \endlink
89 - \link writeFile.H \endlink
90
91SourceFiles
92 histogram.C
93
94\*---------------------------------------------------------------------------*/
95
96#ifndef Foam_functionObjects_histogram_H
97#define Foam_functionObjects_histogram_H
98
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103namespace Foam
104{
105
106// Forward Declarations
107class histogramModel;
108
109namespace functionObjects
110{
111
112/*---------------------------------------------------------------------------*\
113 Class histogram Declaration
114\*---------------------------------------------------------------------------*/
115
116class histogram
117:
119{
120 // Private Data
121
122 //- Histogram model
123 autoPtr<histogramModel> histogramModelPtr_;
124
125
126public:
127
128 //- Runtime type information
129 TypeName("histogram");
130
131
132 // Constructors
133
134 //- Construct from name, Time and dictionary
136 (
137 const word& name,
138 const Time& runTime,
139 const dictionary& dict
140 );
141
142 //- No copy construct
143 histogram(const histogram&) = delete;
144
145 //- No copy assignment
146 void operator=(const histogram&) = delete;
147
148
149 // Destructor
150 virtual ~histogram() = default;
151
152
153 // Member Functions
154
155 //- Read the function-object dictionary
156 virtual bool read(const dictionary& dict);
158 //- Execute the function-object operations (effectively no-op)
159 virtual bool execute();
160
161 //- Write the function-object results
162 // postProcess overrides the usual writeControl behaviour and
163 // forces writing always (used in post-processing mode)
164 virtual bool write();
165};
166
167
168// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169
170} // End namespace functionObjects
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175#endif
176
177// ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Computes the volume-weighted histogram of an input volScalarField.
Definition histogram.H:160
void operator=(const histogram &)=delete
No copy assignment.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition histogram.C:56
TypeName("histogram")
Runtime type information.
histogram(const histogram &)=delete
No copy construct.
virtual bool execute()
Execute the function-object operations (effectively no-op).
Definition histogram.C:71
virtual bool write()
Write the function-object results.
Definition histogram.C:77
histogram(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition histogram.C:41
A base class for histogram models.
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68